diff --git a/dist/cli.js b/dist/cli.js index 683c9a272198fb446d2aab46ab2e56ad1e432821..6d70b3016292f90b7a77712a5b1b8de8210ccea6 100755 --- a/dist/cli.js +++ b/dist/cli.js @@ -58784,7 +58784,7 @@ var RUNTIME_IIFE; var init_runtime_inline = __esm({ "../core/dist/generated/runtime-inline.js"() { "use strict"; - RUNTIME_IIFE = '"use strict";(()=>{var qm=Object.create;var Xi=Object.defineProperty;var $m=Object.getOwnPropertyDescriptor;var jm=Object.getOwnPropertyNames;var Km=Object.getPrototypeOf,Ym=Object.prototype.hasOwnProperty;var Xm=(e,t,n)=>t in e?Xi(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var ae=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var Jm=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of jm(t))!Ym.call(e,i)&&i!==n&&Xi(e,i,{get:()=>t[i],enumerable:!(r=$m(t,i))||r.enumerable});return e};var Qm=(e,t,n)=>(n=e!=null?qm(Km(e)):{},Jm(t||!e||!e.__esModule?Xi(n,"default",{value:e,enumerable:!0}):n,e));var ge=(e,t,n)=>Xm(e,typeof t!="symbol"?t+"":t,n);var Lu=ae((aA,Ko)=>{var Z=String,Nu=function(){return{isColorSupported:!1,reset:Z,bold:Z,dim:Z,italic:Z,underline:Z,inverse:Z,hidden:Z,strikethrough:Z,black:Z,red:Z,green:Z,yellow:Z,blue:Z,magenta:Z,cyan:Z,white:Z,gray:Z,bgBlack:Z,bgRed:Z,bgGreen:Z,bgYellow:Z,bgBlue:Z,bgMagenta:Z,bgCyan:Z,bgWhite:Z,blackBright:Z,redBright:Z,greenBright:Z,yellowBright:Z,blueBright:Z,magentaBright:Z,cyanBright:Z,whiteBright:Z,bgBlackBright:Z,bgRedBright:Z,bgGreenBright:Z,bgYellowBright:Z,bgBlueBright:Z,bgMagentaBright:Z,bgCyanBright:Z,bgWhiteBright:Z}};Ko.exports=Nu();Ko.exports.createColors=Nu});var Yo=ae(()=>{});var Xr=ae((uA,Pu)=>{"use strict";var Du=Lu(),Iu=Yo(),Hn=class e extends Error{constructor(t,n,r,i,o,a){super(t),this.name="CssSyntaxError",this.reason=t,o&&(this.file=o),i&&(this.source=i),a&&(this.plugin=a),typeof n<"u"&&typeof r<"u"&&(typeof n=="number"?(this.line=n,this.column=r):(this.line=n.line,this.column=n.column,this.endLine=r.line,this.endColumn=r.column)),this.setMessage(),Error.captureStackTrace&&Error.captureStackTrace(this,e)}setMessage(){this.message=this.plugin?this.plugin+": ":"",this.message+=this.file?this.file:"",typeof this.line<"u"&&(this.message+=":"+this.line+":"+this.column),this.message+=": "+this.reason}showSourceCode(t){if(!this.source)return"";let n=this.source;t==null&&(t=Du.isColorSupported);let r=c=>c,i=c=>c,o=c=>c;if(t){let{bold:c,gray:f,red:m}=Du.createColors(!0);i=p=>c(m(p)),r=p=>f(p),Iu&&(o=p=>Iu(p))}let a=n.split(/\\r?\\n/),l=Math.max(this.line-3,0),s=Math.min(this.line+2,a.length),u=String(s).length;return a.slice(l,s).map((c,f)=>{let m=l+1+f,p=" "+(" "+m).slice(-u)+" | ";if(m===this.line){if(c.length>160){let v=20,x=Math.max(0,this.column-v),_=Math.max(this.column+v,this.endColumn+v),R=c.slice(x,_),T=r(p.replace(/\\d/g," "))+c.slice(0,Math.min(this.column-1,v-1)).replace(/[^\\t]/g," ");return i(">")+r(p)+o(R)+`\n `+T+i("^")}let b=r(p.replace(/\\d/g," "))+c.slice(0,this.column-1).replace(/[^\\t]/g," ");return i(">")+r(p)+o(c)+`\n `+b+i("^")}return" "+r(p)+o(c)}).join(`\n`)}toString(){let t=this.showSourceCode();return t&&(t=`\n\n`+t+`\n`),this.name+": "+this.message+t}};Pu.exports=Hn;Hn.default=Hn});var Xo=ae((cA,Hu)=>{"use strict";var g0=/(<)(\\/?style\\b)/gi,b0=/(<)(!--)/g;function ht(e){return typeof e!="string"||!e.includes("<")?e:e.replace(g0,"\\\\3c $2").replace(b0,"\\\\3c $2")}var Ou={after:`\n`,beforeClose:`\n`,beforeComment:`\n`,beforeDecl:`\n`,beforeOpen:" ",beforeRule:`\n`,colon:": ",commentLeft:" ",commentRight:" ",emptyBody:"",indent:" ",semicolon:!1};function x0(e){return e[0].toUpperCase()+e.slice(1)}var Gn=class{constructor(t){this.builder=t}atrule(t,n){let r=t.raws,i="@"+t.name,o=t.params?this.rawValue(t,"params"):"";if(typeof r.afterName<"u"?i+=r.afterName:o&&(i+=" "),t.nodes)this.block(t,i+o);else{let a=(r.between||"")+(n?";":"");this.builder(ht(i+o+a),t)}}beforeAfter(t,n){let r;t.type==="decl"?r=this.raw(t,null,"beforeDecl"):t.type==="comment"?r=this.raw(t,null,"beforeComment"):n==="before"?r=this.raw(t,null,"beforeRule"):r=this.raw(t,null,"beforeClose");let i=t.parent,o=0;for(;i&&i.type!=="root";)o+=1,i=i.parent;if(r.includes(`\n`)){let a=this.raw(t,null,"indent");if(a.length)for(let l=0;l0&&n[r].type==="comment";)r-=1;let i=this.raw(t,"semicolon"),o=t.type==="document";for(let a=0;a{if(i=u.raws[n],typeof i<"u")return!1})}return typeof i>"u"&&(i=Ou[r]),l[r]=i,i}rawBeforeClose(t){let n;return t.walk(r=>{if(r.nodes&&r.nodes.length>0&&typeof r.raws.after<"u")return n=r.raws.after,n.includes(`\n`)&&(n=n.replace(/[^\\n]+$/,"")),!1}),n&&(n=n.replace(/\\S/g,"")),n}rawBeforeComment(t,n){let r;return t.walkComments(i=>{if(typeof i.raws.before<"u")return r=i.raws.before,r.includes(`\n`)&&(r=r.replace(/[^\\n]+$/,"")),!1}),typeof r>"u"?r=this.raw(n,null,"beforeDecl"):r&&(r=r.replace(/\\S/g,"")),r}rawBeforeDecl(t,n){let r;return t.walkDecls(i=>{if(typeof i.raws.before<"u")return r=i.raws.before,r.includes(`\n`)&&(r=r.replace(/[^\\n]+$/,"")),!1}),typeof r>"u"?r=this.raw(n,null,"beforeRule"):r&&(r=r.replace(/\\S/g,"")),r}rawBeforeOpen(t){let n;return t.walk(r=>{if(r.type!=="decl"&&(n=r.raws.between,typeof n<"u"))return!1}),n}rawBeforeRule(t){let n;return t.walk(r=>{if(r.nodes&&(r.parent!==t||t.first!==r)&&typeof r.raws.before<"u")return n=r.raws.before,n.includes(`\n`)&&(n=n.replace(/[^\\n]+$/,"")),!1}),n&&(n=n.replace(/\\S/g,"")),n}rawColon(t){let n;return t.walkDecls(r=>{if(typeof r.raws.between<"u")return n=r.raws.between.replace(/[^\\s:]/g,""),!1}),n}rawEmptyBody(t){let n;return t.walk(r=>{if(r.nodes&&r.nodes.length===0&&(n=r.raws.after,typeof n<"u"))return!1}),n}rawIndent(t){if(t.raws.indent)return t.raws.indent;let n;return t.walk(r=>{let i=r.parent;if(i&&i!==t&&i.parent&&i.parent===t&&typeof r.raws.before<"u"){let o=r.raws.before.split(`\n`);return n=o[o.length-1],n=n.replace(/\\S/g,""),!1}}),n}rawSemicolon(t){let n;return t.walk(r=>{if(r.nodes&&r.nodes.length&&r.last.type==="decl"&&(n=r.raws.semicolon,typeof n<"u"))return!1}),n}rawValue(t,n){let r=t[n],i=t.raws[n];return i&&i.value===r?i.raw:r}root(t){if(this.body(t),t.raws.after){let n=t.raws.after,r=t.parent&&t.parent.type==="document";this.builder(r?n:ht(n))}}rule(t){this.block(t,this.rawValue(t,"selector")),t.raws.ownSemicolon&&this.builder(ht(t.raws.ownSemicolon),t,"end")}stringify(t,n){if(!this[t.type])throw new Error("Unknown AST node type "+t.type+". Maybe you need to change PostCSS stringifier.");this[t.type](t,n)}};Hu.exports=Gn;Gn.default=Gn});var Bn=ae((dA,Gu)=>{"use strict";var y0=Xo();function Jo(e,t){new y0(t).stringify(e)}Gu.exports=Jo;Jo.default=Jo});var Jr=ae((fA,Qo)=>{"use strict";Qo.exports.isClean=Symbol("isClean");Qo.exports.my=Symbol("my")});var Vn=ae((mA,Bu)=>{"use strict";var v0=Xr(),S0=Xo(),A0=Bn(),{isClean:Un,my:E0}=Jr();function Zo(e,t){let n=new e.constructor;for(let r in e){if(!Object.prototype.hasOwnProperty.call(e,r)||r==="proxyCache")continue;let i=e[r],o=typeof i;r==="parent"&&o==="object"?t&&(n[r]=t):r==="source"?n[r]=i:Array.isArray(i)?n[r]=i.map(a=>Zo(a,n)):(o==="object"&&i!==null&&(i=Zo(i)),n[r]=i)}return n}function tt(e,t){if(t&&typeof t.offset<"u")return t.offset;let n=1,r=1,i=0;for(let o=0;ot.root().toProxy():t[n]},set(t,n,r){return t[n]===r||(t[n]=r,(n==="prop"||n==="value"||n==="name"||n==="params"||n==="important"||n==="text")&&t.markDirty()),!0}}}markClean(){this[Un]=!0}markDirty(){if(this[Un]){this[Un]=!1;let t=this;for(;t=t.parent;)t[Un]=!1}}next(){if(!this.parent)return;let t=this.parent.index(this);return this.parent.nodes[t+1]}positionBy(t={}){let n=this.source.start;if(t.index)n=this.positionInside(t.index);else if(t.word){let r="document"in this.source.input?this.source.input.document:this.source.input.css,o=r.slice(tt(r,this.source.start),tt(r,this.source.end)).indexOf(t.word);o!==-1&&(n=this.positionInside(o))}return n}positionInside(t){let n=this.source.start.column,r=this.source.start.line,i="document"in this.source.input?this.source.input.document:this.source.input.css,o=tt(i,this.source.start),a=o+t;for(let l=o;ltypeof s=="object"&&s.toJSON?s.toJSON(null,n):s);else if(typeof l=="object"&&l.toJSON)r[a]=l.toJSON(null,n);else if(a==="source"){if(l==null)continue;let s=n.get(l.input);s==null&&(s=o,n.set(l.input,o),o++),r[a]={end:l.end,inputId:s,start:l.start}}else r[a]=l}return i&&(r.inputs=[...n.keys()].map(a=>a.toJSON())),r}toProxy(){return this.proxyCache||(this.proxyCache=new Proxy(this,this.getProxyProcessor())),this.proxyCache}toString(t=A0){t.stringify&&(t=t.stringify);let n="";return t(this,r=>{n+=r}),n}warn(t,n,r={}){let i={node:this};for(let o in r)i[o]=r[o];return t.warn(n,i)}};Bu.exports=Wn;Wn.default=Wn});var qn=ae((pA,Uu)=>{"use strict";var w0=Vn(),zn=class extends w0{constructor(t){super(t),this.type="comment"}};Uu.exports=zn;zn.default=zn});var jn=ae((hA,Wu)=>{"use strict";var C0=Vn(),$n=class extends C0{get variable(){return this.prop.startsWith("--")||this.prop[0]==="$"}constructor(t){t&&typeof t.value<"u"&&typeof t.value!="string"&&(t={...t,value:String(t.value)}),super(t),this.type="decl"}};Wu.exports=$n;$n.default=$n});var gt=ae((gA,Ju)=>{"use strict";var Vu=qn(),zu=jn(),_0=Vn(),{isClean:qu,my:$u}=Jr(),ea,ju,Ku,ta;function Yu(e){return e.map(t=>(t.nodes&&(t.nodes=Yu(t.nodes)),delete t.source,t))}function Xu(e){if(e[qu]=!1,e.proxyOf.nodes)for(let t of e.proxyOf.nodes)Xu(t)}var We=class e extends _0{get first(){if(this.proxyOf.nodes)return this.proxyOf.nodes[0]}get last(){if(this.proxyOf.nodes)return this.proxyOf.nodes[this.proxyOf.nodes.length-1]}append(...t){for(let n of t){let r=this.normalize(n,this.last);for(let i of r)this.proxyOf.nodes.push(i)}return this.markDirty(),this}cleanRaws(t){if(super.cleanRaws(t),this.nodes)for(let n of this.nodes)n.cleanRaws(t)}each(t){if(!this.proxyOf.nodes)return;let n=this.getIterator(),r,i;for(;this.indexes[n]t[n](...r.map(i=>typeof i=="function"?(o,a)=>i(o.toProxy(),a):i)):n==="every"||n==="some"?r=>t[n]((i,...o)=>r(i.toProxy(),...o)):n==="root"?()=>t.root().toProxy():n==="nodes"?t.nodes.map(r=>r.toProxy()):n==="first"||n==="last"?t[n].toProxy():t[n]:t[n]},set(t,n,r){return t[n]===r||(t[n]=r,(n==="name"||n==="params"||n==="selector")&&t.markDirty()),!0}}}index(t){return typeof t=="number"?t:(t.proxyOf&&(t=t.proxyOf),this.proxyOf.nodes.indexOf(t))}insertAfter(t,n){let r=this.index(t),i=this.normalize(n,this.proxyOf.nodes[r]).reverse();r=this.index(t);for(let a of i)this.proxyOf.nodes.splice(r+1,0,a);let o;for(let a in this.indexes)o=this.indexes[a],r"u")t=[];else if(Array.isArray(t)){t=t.slice(0);for(let i of t)i.parent&&i.parent.removeChild(i,"ignore")}else if(t.type==="root"&&this.type!=="document"){t=t.nodes.slice(0);for(let i of t)i.parent&&i.parent.removeChild(i,"ignore")}else if(t.type)t=[t];else if(t.prop){if(typeof t.value>"u")throw new Error("Value field is missed in node creation");typeof t.value!="string"&&(t.value=String(t.value)),t=[new zu(t)]}else if(t.selector||t.selectors)t=[new ta(t)];else if(t.name)t=[new ea(t)];else if(t.text)t=[new Vu(t)];else throw new Error("Unknown node type in node creation");return t.map(i=>(i[$u]||e.rebuild(i),i=i.proxyOf,i.parent&&i.parent.removeChild(i),i[qu]&&Xu(i),i.raws||(i.raws={}),typeof i.raws.before>"u"&&n&&typeof n.raws.before<"u"&&(i.raws.before=n.raws.before.replace(/\\S/g,"")),i.parent=this.proxyOf,i))}prepend(...t){t=t.reverse();for(let n of t){let r=this.normalize(n,this.first,"prepend").reverse();for(let i of r)this.proxyOf.nodes.unshift(i);for(let i in this.indexes)this.indexes[i]=this.indexes[i]+r.length}return this.markDirty(),this}push(t){return t.parent=this,this.proxyOf.nodes.push(t),this}removeAll(){for(let t of this.proxyOf.nodes)t.parent=void 0;return this.proxyOf.nodes=[],this.markDirty(),this}removeChild(t){t=this.index(t),this.proxyOf.nodes[t].parent=void 0,this.proxyOf.nodes.splice(t,1);let n;for(let r in this.indexes)n=this.indexes[r],n>=t&&(this.indexes[r]=n-1);return this.markDirty(),this}replaceValues(t,n,r){return r||(r=n,n={}),this.walkDecls(i=>{n.props&&!n.props.includes(i.prop)||n.fast&&!i.value.includes(n.fast)||(i.value=i.value.replace(t,r))}),this.markDirty(),this}some(t){return this.nodes.some(t)}walk(t){return this.each((n,r)=>{let i;try{i=t(n,r)}catch(o){throw n.addToError(o)}return i!==!1&&n.walk&&(i=n.walk(t)),i})}walkAtRules(t,n){return n?t instanceof RegExp?this.walk((r,i)=>{if(r.type==="atrule"&&t.test(r.name))return n(r,i)}):this.walk((r,i)=>{if(r.type==="atrule"&&r.name===t)return n(r,i)}):(n=t,this.walk((r,i)=>{if(r.type==="atrule")return n(r,i)}))}walkComments(t){return this.walk((n,r)=>{if(n.type==="comment")return t(n,r)})}walkDecls(t,n){return n?t instanceof RegExp?this.walk((r,i)=>{if(r.type==="decl"&&t.test(r.prop))return n(r,i)}):this.walk((r,i)=>{if(r.type==="decl"&&r.prop===t)return n(r,i)}):(n=t,this.walk((r,i)=>{if(r.type==="decl")return n(r,i)}))}walkRules(t,n){return n?t instanceof RegExp?this.walk((r,i)=>{if(r.type==="rule"&&t.test(r.selector))return n(r,i)}):this.walk((r,i)=>{if(r.type==="rule"&&r.selector===t)return n(r,i)}):(n=t,this.walk((r,i)=>{if(r.type==="rule")return n(r,i)}))}};We.registerParse=e=>{ju=e};We.registerRule=e=>{ta=e};We.registerAtRule=e=>{ea=e};We.registerRoot=e=>{Ku=e};Ju.exports=We;We.default=We;We.rebuild=e=>{e.type==="atrule"?Object.setPrototypeOf(e,ea.prototype):e.type==="rule"?Object.setPrototypeOf(e,ta.prototype):e.type==="decl"?Object.setPrototypeOf(e,zu.prototype):e.type==="comment"?Object.setPrototypeOf(e,Vu.prototype):e.type==="root"&&Object.setPrototypeOf(e,Ku.prototype),e[$u]=!0,e.nodes&&e.nodes.forEach(t=>{We.rebuild(t)})}});var Qr=ae((bA,Zu)=>{"use strict";var Qu=gt(),Yt=class extends Qu{constructor(t){super(t),this.type="atrule"}append(...t){return this.proxyOf.nodes||(this.nodes=[]),super.append(...t)}prepend(...t){return this.proxyOf.nodes||(this.nodes=[]),super.prepend(...t)}};Zu.exports=Yt;Yt.default=Yt;Qu.registerAtRule(Yt)});var Zr=ae((xA,nc)=>{"use strict";var T0=gt(),ec,tc,kt=class extends T0{constructor(t){super({type:"document",...t}),this.nodes||(this.nodes=[])}toResult(t={}){return new ec(new tc,this,t).stringify()}};kt.registerLazyResult=e=>{ec=e};kt.registerProcessor=e=>{tc=e};nc.exports=kt;kt.default=kt});var ic=ae((yA,rc)=>{var R0="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict",k0=(e,t=21)=>(n=t)=>{let r="",i=n|0;for(;i--;)r+=e[Math.random()*e.length|0];return r},M0=(e=21)=>{let t="",n=e|0;for(;n--;)t+=R0[Math.random()*64|0];return t};rc.exports={nanoid:M0,customAlphabet:k0}});var ei=ae(()=>{});var ti=ae(()=>{});var na=ae(()=>{});var oc=ae(()=>{});var ia=ae((RA,lc)=>{"use strict";var{existsSync:F0,readFileSync:N0}=oc(),{dirname:ra,join:L0}=ei(),{SourceMapConsumer:ac,SourceMapGenerator:sc}=ti();function D0(e){return Buffer?Buffer.from(e,"base64").toString():window.atob(e)}var Kn=class{constructor(t,n){if(n.map===!1)return;n.unsafeMap&&(this.unsafeMap=!0),this.loadAnnotation(t),this.inline=this.startWith(this.annotation,"data:");let r=n.map?n.map.prev:void 0,i=this.loadMap(n.from,r);!this.mapFile&&n.from&&(this.mapFile=n.from),this.mapFile&&(this.root=ra(this.mapFile)),i&&(this.text=i)}consumer(){return this.consumerCache||(this.consumerCache=new ac(this.json||this.text)),this.consumerCache}decodeInline(t){let n=/^data:application\\/json;charset=utf-?8;base64,/,r=/^data:application\\/json;base64,/,i=/^data:application\\/json;charset=utf-?8,/,o=/^data:application\\/json,/,a=t.match(i)||t.match(o);if(a)return decodeURIComponent(t.substr(a[0].length));let l=t.match(n)||t.match(r);if(l)return D0(t.substr(l[0].length));let s=t.slice(22);throw s=s.slice(0,s.indexOf(",")),new Error("Unsupported source map encoding "+s)}getAnnotationURL(t){return t.replace(/^\\/\\*\\s*# sourceMappingURL=/,"").trim()}isMap(t){return typeof t!="object"?!1:typeof t.mappings=="string"||typeof t._mappings=="string"||Array.isArray(t.sections)}loadAnnotation(t){let n=t.match(/\\/\\*\\s*# sourceMappingURL=/g);if(!n)return;let r=t.lastIndexOf(n.pop()),i=t.indexOf("*/",r);r>-1&&i>-1&&(this.annotation=this.getAnnotationURL(t.substring(r,i)))}loadFile(t,n,r){if(!(!r&&!this.unsafeMap&&!/\\.map$/i.test(t))&&(this.root=ra(t),F0(t)))return this.mapFile=t,N0(t,"utf-8").toString().trim()}loadMap(t,n){if(n===!1)return!1;if(n){if(typeof n=="string")return n;if(typeof n=="function"){let r=n(t);if(r){let i=this.loadFile(r,t,!0);if(!i)throw new Error("Unable to load previous source map: "+r.toString());return i}}else{if(n instanceof ac)return sc.fromSourceMap(n).toString();if(n instanceof sc)return n.toString();if(this.isMap(n))return JSON.stringify(n);throw new Error("Unsupported previous source map format: "+n.toString())}}else{if(this.inline)return this.decodeInline(this.annotation);if(this.annotation){let r=this.annotation;t&&(r=L0(ra(t),r));let i=this.loadFile(r,t,!1);if(i)try{this.json=JSON.parse(i.replace(/^\\)]}\'[^\\n]*\\n/,""))}catch{return}return i}}}startWith(t,n){return t?t.substr(0,n.length)===n:!1}withContent(){return!!(this.consumer().sourcesContent&&this.consumer().sourcesContent.length>0)}};lc.exports=Kn;Kn.default=Kn});var Yn=ae((kA,mc)=>{"use strict";var{nanoid:I0}=ic(),{isAbsolute:sa,resolve:la}=ei(),{SourceMapConsumer:P0,SourceMapGenerator:O0}=ti(),{fileURLToPath:uc,pathToFileURL:ni}=na(),cc=Xr(),H0=ia(),oa=Yo(),aa=Symbol("lineToIndexCache"),G0=!!(P0&&O0),dc=!!(la&&sa);function fc(e){if(e[aa])return e[aa];let t=e.css.split(`\n`),n=new Array(t.length),r=0;for(let i=0,o=t.length;i"u"||typeof t=="object"&&!t.toString)throw new Error(`PostCSS received ${t} instead of CSS string`);if(this.css=t.toString(),this.css[0]==="\\uFEFF"||this.css[0]==="\\uFFFE"?(this.hasBOM=!0,this.css=this.css.slice(1)):this.hasBOM=!1,this.document=this.css,n.document&&(this.document=n.document.toString()),n.from&&(!dc||/^\\w+:\\/\\//.test(n.from)||sa(n.from)?this.file=n.from:this.file=la(n.from)),dc&&G0){let r=new H0(this.css,n);if(r.text){this.map=r;let i=r.consumer().file;!this.file&&i&&(this.file=this.mapResolve(i))}}this.file||(this.id=""),this.map&&(this.map.file=this.from)}error(t,n,r,i={}){let o,a,l,s,u;if(n&&typeof n=="object"){let f=n,m=r;if(typeof f.offset=="number"){s=f.offset;let p=this.fromOffset(s);n=p.line,r=p.col}else n=f.line,r=f.column,s=this.fromLineAndColumn(n,r);if(typeof m.offset=="number"){l=m.offset;let p=this.fromOffset(l);a=p.line,o=p.col}else a=m.line,o=m.column,l=this.fromLineAndColumn(m.line,m.column)}else if(r)s=this.fromLineAndColumn(n,r);else{s=n;let f=this.fromOffset(s);n=f.line,r=f.col}let c=this.origin(n,r,a,o);return c?u=new cc(t,c.endLine===void 0?c.line:{column:c.column,line:c.line},c.endLine===void 0?c.column:{column:c.endColumn,line:c.endLine},c.source,c.file,i.plugin):u=new cc(t,a===void 0?n:{column:r,line:n},a===void 0?r:{column:o,line:a},this.css,this.file,i.plugin),u.input={column:r,endColumn:o,endLine:a,endOffset:l,line:n,offset:s,source:this.css},this.file&&(ni&&(u.input.url=ni(this.file).toString()),u.input.file=this.file),u}fromLineAndColumn(t,n){return fc(this)[t-1]+n-1}fromOffset(t){let n=fc(this),r=n[n.length-1],i=0;if(t>=r)i=n.length-1;else{let o=n.length-2,a;for(;i>1),t=n[a+1])i=a+1;else{i=a;break}}return{col:t-n[i]+1,line:i+1}}mapResolve(t){return/^\\w+:\\/\\//.test(t)?t:la(this.map.consumer().sourceRoot||this.map.root||".",t)}origin(t,n,r,i){if(!this.map)return!1;let o=this.map.consumer(),a=o.originalPositionFor({column:n,line:t});if(!a.source)return!1;let l;typeof r=="number"&&(l=o.originalPositionFor({column:i,line:r}));let s;sa(a.source)?s=ni(a.source):s=new URL(a.source,this.map.consumer().sourceRoot||ni(this.map.mapFile));let u={column:a.column,endColumn:l&&l.column,endLine:l&&l.line,line:a.line,url:s.toString()};if(s.protocol==="file:")if(uc)u.file=uc(s);else throw new Error("file: protocol is not available in this PostCSS build");let c=o.sourceContentFor(a.source);return c&&(u.source=c),u}toJSON(){let t={};for(let n of["hasBOM","css","file","id"])this[n]!=null&&(t[n]=this[n]);return this.map&&(t.map={...this.map},t.map.consumerCache&&(t.map.consumerCache=void 0)),t}};mc.exports=Xt;Xt.default=Xt;oa&&oa.registerInput&&oa.registerInput(Xt)});var Jt=ae((MA,bc)=>{"use strict";var pc=gt(),hc,gc,bt=class extends pc{constructor(t){super(t),this.type="root",this.nodes||(this.nodes=[])}normalize(t,n,r){let i=super.normalize(t);if(n){if(r==="prepend")this.nodes.length>1?n.raws.before=this.nodes[1].raws.before:delete n.raws.before;else if(this.first!==n)for(let o of i)o.raws.before=n.raws.before}return i}removeChild(t,n){let r=this.index(t);return!n&&r===0&&this.nodes.length>1&&(this.nodes[1].raws.before=this.nodes[r].raws.before),super.removeChild(t)}toResult(t={}){return new hc(new gc,this,t).stringify()}};bt.registerLazyResult=e=>{hc=e};bt.registerProcessor=e=>{gc=e};bc.exports=bt;bt.default=bt;pc.registerRoot(bt)});var ua=ae((FA,xc)=>{"use strict";var Xn={comma(e){return Xn.split(e,[","],!0)},space(e){let t=[" ",`\n`," "];return Xn.split(e,t)},split(e,t,n){let r=[],i="",o=!1,a=0,l=!1,s="",u=!1;for(let c of e)u?u=!1:c==="\\\\"?u=!0:l?c===s&&(l=!1):c===\'"\'||c==="\'"?(l=!0,s=c):c==="("?a+=1:c===")"?a>0&&(a-=1):a===0&&t.includes(c)&&(o=!0),o?(i!==""&&r.push(i.trim()),i="",o=!1):i+=c;return(n||i!=="")&&r.push(i.trim()),r}};xc.exports=Xn;Xn.default=Xn});var ri=ae((NA,vc)=>{"use strict";var yc=gt(),B0=ua(),Qt=class extends yc{get selectors(){return B0.comma(this.selector)}set selectors(t){let n=this.selector?this.selector.match(/,\\s*/):null,r=n?n[0]:","+this.raw("between","beforeOpen");this.selector=t.join(r)}constructor(t){super(t),this.type="rule",this.nodes||(this.nodes=[])}};vc.exports=Qt;Qt.default=Qt;yc.registerRule(Qt)});var Ac=ae((LA,Sc)=>{"use strict";var U0=Qr(),W0=qn(),V0=jn(),z0=Yn(),q0=ia(),$0=Jt(),j0=ri();function Jn(e,t){if(Array.isArray(e))return e.map(i=>Jn(i));let{inputs:n,...r}=e;if(n){t=[];for(let i of n){let o={...i,__proto__:z0.prototype};o.map&&(o.map={...o.map,__proto__:q0.prototype}),t.push(o)}}if(r.nodes&&(r.nodes=e.nodes.map(i=>Jn(i,t))),r.source){let{inputId:i,...o}=r.source;r.source=o,i!=null&&(r.source.input=t[i])}if(r.type==="root")return new $0(r);if(r.type==="decl")return new V0(r);if(r.type==="rule")return new j0(r);if(r.type==="comment")return new W0(r);if(r.type==="atrule")return new U0(r);throw new Error("Unknown node type: "+e.type)}Sc.exports=Jn;Jn.default=Jn});var da=ae((DA,Rc)=>{"use strict";var{dirname:ii,relative:wc,resolve:Cc,sep:_c}=ei(),{SourceMapConsumer:Tc,SourceMapGenerator:oi}=ti(),{pathToFileURL:Ec}=na(),K0=Yn(),Y0=!!(Tc&&oi),X0=!!(ii&&Cc&&wc&&_c),ca=class{constructor(t,n,r,i){this.stringify=t,this.mapOpts=r.map||{},this.root=n,this.opts=r,this.css=i,this.originalCSS=i,this.usesFileUrls=!this.mapOpts.from&&this.mapOpts.absolute,this.memoizedFileURLs=new Map,this.memoizedPaths=new Map,this.memoizedURLs=new Map}addAnnotation(){let t;this.isInline()?t="data:application/json;base64,"+this.toBase64(this.map.toString()):typeof this.mapOpts.annotation=="string"?t=this.mapOpts.annotation:typeof this.mapOpts.annotation=="function"?t=this.mapOpts.annotation(this.opts.to,this.root):t=this.outputFile()+".map";let n=`\n`;this.css.includes(`\\r\n`)&&(n=`\\r\n`),this.css+=n+"/*# sourceMappingURL="+t+" */"}applyPrevMaps(){for(let t of this.previous()){let n=this.toUrl(this.path(t.file)),r=t.root||ii(t.file),i;this.mapOpts.sourcesContent===!1?(i=new Tc(t.text),i.sourcesContent&&(i.sourcesContent=null)):i=t.consumer(),this.map.applySourceMap(i,n,this.toUrl(this.path(r)))}}clearAnnotation(){if(this.mapOpts.annotation!==!1){if(this.root){let t;for(let n=this.root.nodes.length-1;n>=0;n--)t=this.root.nodes[n],t.type==="comment"&&t.text.startsWith("# sourceMappingURL=")&&this.root.removeChild(n)}else if(this.css){let t;for(;(t=this.css.lastIndexOf("/*#"))!==-1;){let n=this.css.indexOf("*/",t+3);if(n===-1)break;for(;t>0&&this.css[t-1]===`\n`;)t--;this.css=this.css.slice(0,t)+this.css.slice(n+2)}}}}generate(){if(this.clearAnnotation(),X0&&Y0&&this.isMap())return this.generateMap();{let t="";return this.stringify(this.root,n=>{t+=n}),[t]}}generateMap(){if(this.root)this.generateString();else if(this.previous().length===1){let t=this.previous()[0].consumer();t.file=this.outputFile(),this.map=oi.fromSourceMap(t,{ignoreInvalidMapping:!0})}else this.map=new oi({file:this.outputFile(),ignoreInvalidMapping:!0}),this.map.addMapping({generated:{column:0,line:1},original:{column:0,line:1},source:this.opts.from?this.toUrl(this.path(this.opts.from)):""});return this.isSourcesContent()&&this.setSourcesContent(),this.root&&this.previous().length>0&&this.applyPrevMaps(),this.isAnnotation()&&this.addAnnotation(),this.isInline()?[this.css]:[this.css,this.map]}generateString(){this.css="",this.map=new oi({file:this.outputFile(),ignoreInvalidMapping:!0});let t=1,n=1,r="",i={generated:{column:0,line:0},original:{column:0,line:0},source:""},o,a;this.stringify(this.root,(l,s,u)=>{if(this.css+=l,s&&u!=="end"&&(i.generated.line=t,i.generated.column=n-1,s.source&&s.source.start?(i.source=this.sourcePath(s),i.original.line=s.source.start.line,i.original.column=s.source.start.column-1,this.map.addMapping(i)):(i.source=r,i.original.line=1,i.original.column=0,this.map.addMapping(i))),a=l.match(/\\n/g),a?(t+=a.length,o=l.lastIndexOf(`\n`),n=l.length-o):n+=l.length,s&&u!=="start"){let c=s.parent||{raws:{}};(!(s.type==="decl"||s.type==="atrule"&&!s.nodes)||s!==c.last||c.raws.semicolon)&&(s.source&&s.source.end?(i.source=this.sourcePath(s),i.original.line=s.source.end.line,i.original.column=s.source.end.column-1,i.generated.line=t,i.generated.column=n-2,this.map.addMapping(i)):(i.source=r,i.original.line=1,i.original.column=0,i.generated.line=t,i.generated.column=n-1,this.map.addMapping(i)))}})}isAnnotation(){return this.isInline()?!0:typeof this.mapOpts.annotation<"u"?this.mapOpts.annotation:this.previous().length?this.previous().some(t=>t.annotation):!0}isInline(){if(typeof this.mapOpts.inline<"u")return this.mapOpts.inline;let t=this.mapOpts.annotation;return typeof t<"u"&&t!==!0?!1:this.previous().length?this.previous().some(n=>n.inline):!0}isMap(){return typeof this.opts.map<"u"?!!this.opts.map:this.previous().length>0}isSourcesContent(){return typeof this.mapOpts.sourcesContent<"u"?this.mapOpts.sourcesContent:this.previous().length?this.previous().some(t=>t.withContent()):!0}outputFile(){return this.opts.to?this.path(this.opts.to):this.opts.from?this.path(this.opts.from):"to.css"}path(t){if(this.mapOpts.absolute||t.charCodeAt(0)===60||/^\\w+:\\/\\//.test(t))return t;let n=this.memoizedPaths.get(t);if(n)return n;let r=this.opts.to?ii(this.opts.to):".";typeof this.mapOpts.annotation=="string"&&(r=ii(Cc(r,this.mapOpts.annotation)));let i=wc(r,t);return this.memoizedPaths.set(t,i),i}previous(){if(!this.previousMaps)if(this.previousMaps=[],this.root)this.root.walk(t=>{if(t.source&&t.source.input.map){let n=t.source.input.map;this.previousMaps.includes(n)||this.previousMaps.push(n)}});else{let t=new K0(this.originalCSS,this.opts);t.map&&this.previousMaps.push(t.map)}return this.previousMaps}setSourcesContent(){let t={};if(this.root)this.root.walk(n=>{if(n.source){let r=n.source.input.from;if(r&&!t[r]){t[r]=!0;let i=this.usesFileUrls?this.toFileUrl(r):this.toUrl(this.path(r));this.map.setSourceContent(i,n.source.input.css)}}});else if(this.css){let n=this.opts.from?this.toUrl(this.path(this.opts.from)):"";this.map.setSourceContent(n,this.css)}}sourcePath(t){return this.mapOpts.from?this.toUrl(this.mapOpts.from):this.usesFileUrls?this.toFileUrl(t.source.input.from):this.toUrl(this.path(t.source.input.from))}toBase64(t){return Buffer?Buffer.from(t).toString("base64"):window.btoa(unescape(encodeURIComponent(t)))}toFileUrl(t){let n=this.memoizedFileURLs.get(t);if(n)return n;if(Ec){let r=Ec(t).toString();return this.memoizedFileURLs.set(t,r),r}else throw new Error("`map.absolute` option is not available in this PostCSS build")}toUrl(t){let n=this.memoizedURLs.get(t);if(n)return n;_c==="\\\\"&&(t=t.replace(/\\\\/g,"/"));let r=encodeURI(t).replace(/[#?]/g,encodeURIComponent);return this.memoizedURLs.set(t,r),r}};Rc.exports=ca});var Fc=ae((IA,Mc)=>{"use strict";var ai=/[\\t\\n\\f\\r "#\'()/;[\\\\\\]{}]/g,si=/[\\t\\n\\f\\r !"#\'():;@[\\\\\\]{}]|\\/(?=\\*)/g,J0=/.[\\r\\n"\'(/\\\\]/,kc=/[\\da-f]/i;Mc.exports=function(t,n={}){let r=t.css.valueOf(),i=n.ignoreErrors,o,a,l,s,u,c,f,m,p,b,v=r.length,x=0,_=[],R=[],T=-1;function M(){return x}function D(C){throw t.error("Unclosed "+C,x)}function E(){return R.length===0&&x>=v}function S(C){if(R.length)return R.pop();if(x>=v)return;let F=C?C.ignoreUnclosed:!1;switch(o=r.charCodeAt(x),o){case 10:case 32:case 9:case 13:case 12:{s=x;do s+=1,o=r.charCodeAt(s);while(o===32||o===10||o===9||o===13||o===12);c=["space",r.slice(x,s)],x=s-1;break}case 91:case 93:case 123:case 125:case 58:case 59:case 41:{let I=String.fromCharCode(o);c=[I,I,x];break}case 40:{if(b=_.length?_.pop()[1]:"",p=r.charCodeAt(x+1),b==="url"&&p!==39&&p!==34&&p!==32&&p!==10&&p!==9&&p!==12&&p!==13){s=x;do{if(f=!1,s=r.indexOf(")",s+1),s===-1)if(i||F){s=x;break}else D("bracket");for(m=s;r.charCodeAt(m-1)===92;)m-=1,f=!f}while(f);c=["brackets",r.slice(x,s+1),x,s],x=s}else x<=T?c=["(","(",x]:(s=r.indexOf(")",x+1),a=r.slice(x,s+1),s===-1||J0.test(a)?(T=s===-1?v:s,c=["(","(",x]):(c=["brackets",a,x,s],x=s));break}case 39:case 34:{u=o===39?"\'":\'"\',s=x;do{if(f=!1,s=r.indexOf(u,s+1),s===-1)if(i||F){s=x+1;break}else D("string");for(m=s;r.charCodeAt(m-1)===92;)m-=1,f=!f}while(f);c=["string",r.slice(x,s+1),x,s],x=s;break}case 64:{ai.lastIndex=x+1,ai.test(r),ai.lastIndex===0?s=r.length-1:s=ai.lastIndex-2,c=["at-word",r.slice(x,s+1),x,s],x=s;break}case 92:{for(s=x,l=!0;r.charCodeAt(s+1)===92;)s+=1,l=!l;if(o=r.charCodeAt(s+1),l&&o!==47&&o!==32&&o!==10&&o!==9&&o!==13&&o!==12&&(s+=1,kc.test(r.charAt(s)))){for(;kc.test(r.charAt(s+1));)s+=1;r.charCodeAt(s+1)===32&&(s+=1)}c=["word",r.slice(x,s+1),x,s],x=s;break}default:{o===47&&r.charCodeAt(x+1)===42?(s=r.indexOf("*/",x+2)+1,s===0&&(i||F?s=r.length:D("comment")),c=["comment",r.slice(x,s+1),x,s],x=s):(si.lastIndex=x+1,si.test(r),si.lastIndex===0?s=r.length-1:s=si.lastIndex-2,c=["word",r.slice(x,s+1),x,s],_.push(c),x=s);break}}return x++,c}function A(C){R.push(C)}return{back:A,endOfFile:E,nextToken:S,position:M}}});var Ic=ae((PA,Dc)=>{"use strict";var Q0=Qr(),Z0=qn(),eg=jn(),tg=Jt(),Nc=ri(),ng=Fc(),Lc={empty:!0,space:!0};function rg(e){for(let t=e.length-1;t>=0;t--){let n=e[t],r=n[3]||n[2];if(r)return r}}var fa=class{constructor(t){this.input=t,this.root=new tg,this.current=this.root,this.spaces="",this.semicolon=!1,this.createTokenizer(),this.root.source={input:t,start:{column:1,line:1,offset:0}}}atrule(t){let n=new Q0;n.name=t[1].slice(1),n.name===""&&this.unnamedAtrule(n,t),this.init(n,t[2]);let r,i,o,a=!1,l=!1,s=[],u=[];for(;!this.tokenizer.endOfFile();){if(t=this.tokenizer.nextToken(),r=t[0],r==="("||r==="["?u.push(r==="("?")":"]"):r==="{"&&u.length>0?u.push("}"):r===u[u.length-1]&&u.pop(),u.length===0)if(r===";"){n.source.end=this.getPosition(t[2]),n.source.end.offset++,this.semicolon=!0;break}else if(r==="{"){l=!0;break}else if(r==="}"){if(s.length>0){for(o=s.length-1,i=s[o];i&&i[0]==="space";)i=s[--o];i&&(n.source.end=this.getPosition(i[3]||i[2]),n.source.end.offset++)}this.end(t);break}else s.push(t);else s.push(t);if(this.tokenizer.endOfFile()){a=!0;break}}n.raws.between=this.spacesAndCommentsFromEnd(s),s.length?(n.raws.afterName=this.spacesAndCommentsFromStart(s),this.raw(n,"params",s),a&&(t=s[s.length-1],n.source.end=this.getPosition(t[3]||t[2]),n.source.end.offset++,this.spaces=n.raws.between,n.raws.between="")):(n.raws.afterName="",n.params=""),l&&(n.nodes=[],this.current=n)}checkMissedSemicolon(t){let n=this.colon(t);if(n===!1)return;let r=0,i;for(let o=n-1;o>=0&&(i=t[o],!(i[0]!=="space"&&(r+=1,r===2)));o--);throw this.input.error("Missed semicolon",i[0]==="word"?i[3]+1:i[2])}colon(t){let n=0,r,i,o;for(let[a,l]of t.entries()){if(i=l,o=i[0],o==="("&&(n+=1),o===")"&&(n-=1),n===0&&o===":")if(!r)this.doubleColon(i);else{if(r[0]==="word"&&r[1]==="progid")continue;return a}r=i}return!1}comment(t){let n=new Z0;this.init(n,t[2]),n.source.end=this.getPosition(t[3]||t[2]),n.source.end.offset++;let r=t[1].slice(2,-2);if(!r.trim())n.text="",n.raws.left=r,n.raws.right="";else{let i=r.match(/^(\\s*)([^]*\\S)(\\s*)$/);n.text=i[2],n.raws.left=i[1],n.raws.right=i[3]}}createTokenizer(){this.tokenizer=ng(this.input)}decl(t,n){let r=new eg;this.init(r,t[0][2]);let i=t[t.length-1];for(i[0]===";"&&(this.semicolon=!0,t.pop()),r.source.end=this.getPosition(i[3]||i[2]||rg(t)),r.source.end.offset++;t[0][0]!=="word";)t.length===1&&this.unknownWord(t),r.raws.before+=t.shift()[1];for(r.source.start=this.getPosition(t[0][2]),r.prop="";t.length;){let u=t[0][0];if(u===":"||u==="space"||u==="comment")break;r.prop+=t.shift()[1]}r.raws.between="";let o;for(;t.length;)if(o=t.shift(),o[0]===":"){r.raws.between+=o[1];break}else o[0]==="word"&&/\\w/.test(o[1])&&this.unknownWord([o]),r.raws.between+=o[1];(r.prop[0]==="_"||r.prop[0]==="*")&&(r.raws.before+=r.prop[0],r.prop=r.prop.slice(1));let a=[],l;for(;t.length&&(l=t[0][0],!(l!=="space"&&l!=="comment"));)a.push(t.shift());this.precheckMissedSemicolon(t);for(let u=t.length-1;u>=0;u--){if(o=t[u],o[1].toLowerCase()==="!important"){r.important=!0;let c=this.stringFrom(t,u);c=this.spacesFromEnd(t)+c,c!==" !important"&&(r.raws.important=c);break}else if(o[1].toLowerCase()==="important"){let c=t.slice(0),f="";for(let m=u;m>0;m--){let p=c[m][0];if(f.trim().startsWith("!")&&p!=="space")break;f=c.pop()[1]+f}f.trim().startsWith("!")&&(r.important=!0,r.raws.important=f,t=c)}if(o[0]!=="space"&&o[0]!=="comment")break}t.some(u=>u[0]!=="space"&&u[0]!=="comment")&&(r.raws.between+=a.map(u=>u[1]).join(""),a=[]),this.raw(r,"value",a.concat(t),n),r.value.includes(":")&&!n&&this.checkMissedSemicolon(t)}doubleColon(t){throw this.input.error("Double colon",{offset:t[2]},{offset:t[2]+t[1].length})}emptyRule(t){let n=new Nc;this.init(n,t[2]),n.selector="",n.raws.between="",this.current=n}end(t){this.current.nodes&&this.current.nodes.length&&(this.current.raws.semicolon=this.semicolon),this.semicolon=!1,this.current.raws.after=(this.current.raws.after||"")+this.spaces,this.spaces="",this.current.parent?(this.current.source.end=this.getPosition(t[2]),this.current.source.end.offset++,this.current=this.current.parent):this.unexpectedClose(t)}endFile(){this.current.parent&&this.unclosedBlock(),this.current.nodes&&this.current.nodes.length&&(this.current.raws.semicolon=this.semicolon),this.current.raws.after=(this.current.raws.after||"")+this.spaces,this.root.source.end=this.getPosition(this.tokenizer.position())}freeSemicolon(t){if(this.spaces+=t[1],this.current.nodes){let n=this.current.nodes[this.current.nodes.length-1];n&&n.type==="rule"&&!n.raws.ownSemicolon&&(n.raws.ownSemicolon=this.spaces,this.spaces="",n.source.end=this.getPosition(t[2]),n.source.end.offset+=n.raws.ownSemicolon.length)}}getPosition(t){let n=this.input.fromOffset(t);return{column:n.col,line:n.line,offset:t}}init(t,n){this.current.push(t),t.source={input:this.input,start:this.getPosition(n)},t.raws.before=this.spaces,this.spaces="",t.type!=="comment"&&(this.semicolon=!1)}other(t){let n=!1,r=null,i=!1,o=null,a=[],l=t[1].startsWith("--"),s=[],u=t;for(;u;){if(r=u[0],s.push(u),r==="("||r==="[")o||(o=u),a.push(r==="("?")":"]");else if(l&&i&&r==="{")o||(o=u),a.push("}");else if(a.length===0)if(r===";")if(i){this.decl(s,l);return}else break;else if(r==="{"){this.rule(s);return}else if(r==="}"){this.tokenizer.back(s.pop()),n=!0;break}else r===":"&&(i=!0);else r===a[a.length-1]&&(a.pop(),a.length===0&&(o=null));u=this.tokenizer.nextToken()}if(this.tokenizer.endOfFile()&&(n=!0),a.length>0&&this.unclosedBracket(o),n&&i){if(!l)for(;s.length&&(u=s[s.length-1][0],!(u!=="space"&&u!=="comment"));)this.tokenizer.back(s.pop());this.decl(s,l)}else this.unknownWord(s)}parse(){let t;for(;!this.tokenizer.endOfFile();)switch(t=this.tokenizer.nextToken(),t[0]){case"space":this.spaces+=t[1];break;case";":this.freeSemicolon(t);break;case"}":this.end(t);break;case"comment":this.comment(t);break;case"at-word":this.atrule(t);break;case"{":this.emptyRule(t);break;default:this.other(t);break}this.endFile()}precheckMissedSemicolon(){}raw(t,n,r,i){let o,a,l=r.length,s="",u=!0,c,f;for(let m=0;mp+b[1],"");t.raws[n]={raw:m,value:s}}t[n]=s}rule(t){t.pop();let n=new Nc;this.init(n,t[0][2]),n.raws.between=this.spacesAndCommentsFromEnd(t),this.raw(n,"selector",t),this.current=n}spacesAndCommentsFromEnd(t){let n,r="";for(;t.length&&(n=t[t.length-1][0],!(n!=="space"&&n!=="comment"));)r=t.pop()[1]+r;return r}spacesAndCommentsFromStart(t){let n,r="";for(;t.length&&(n=t[0][0],!(n!=="space"&&n!=="comment"));)r+=t.shift()[1];return r}spacesFromEnd(t){let n,r="";for(;t.length&&(n=t[t.length-1][0],n==="space");)r=t.pop()[1]+r;return r}stringFrom(t,n){let r="";for(let i=n;i{"use strict";var ig=gt(),og=Yn(),ag=Ic();function li(e,t){let n=new og(e,t),r=new ag(n);try{r.parse()}catch(i){throw i}return r.root}Pc.exports=li;li.default=li;ig.registerParse(li)});var ma=ae((HA,Oc)=>{"use strict";var Qn=class{constructor(t,n={}){if(this.type="warning",this.text=t,n.node&&n.node.source){let r=n.node.rangeBy(n);this.line=r.start.line,this.column=r.start.column,this.endLine=r.end.line,this.endColumn=r.end.column}for(let r in n)this[r]=n[r]}toString(){return this.node?this.node.error(this.text,{index:this.index,plugin:this.plugin,word:this.word}).message:this.plugin?this.plugin+": "+this.text:this.text}};Oc.exports=Qn;Qn.default=Qn});var ci=ae((GA,Hc)=>{"use strict";var sg=ma(),Zn=class{get content(){return this.css}constructor(t,n,r){this.processor=t,this.messages=[],this.root=n,this.opts=r,this.css="",this.map=void 0}toString(){return this.css}warn(t,n={}){n.plugin||this.lastPlugin&&this.lastPlugin.postcssPlugin&&(n.plugin=this.lastPlugin.postcssPlugin);let r=new sg(t,n);return this.messages.push(r),r}warnings(){return this.messages.filter(t=>t.type==="warning")}};Hc.exports=Zn;Zn.default=Zn});var pa=ae((BA,Bc)=>{"use strict";var Gc={};Bc.exports=function(t){Gc[t]||(Gc[t]=!0,typeof console<"u"&&console.warn&&console.warn(t))}});var ba=ae((WA,zc)=>{"use strict";var lg=gt(),ug=Zr(),cg=da(),dg=ui(),Uc=ci(),fg=Jt(),mg=Bn(),{isClean:Ke,my:pg}=Jr(),UA=pa(),hg={atrule:"AtRule",comment:"Comment",decl:"Declaration",document:"Document",root:"Root",rule:"Rule"},gg={AtRule:!0,AtRuleExit:!0,Comment:!0,CommentExit:!0,Declaration:!0,DeclarationExit:!0,Document:!0,DocumentExit:!0,Once:!0,OnceExit:!0,postcssPlugin:!0,prepare:!0,Root:!0,RootExit:!0,Rule:!0,RuleExit:!0},bg={Once:!0,postcssPlugin:!0,prepare:!0},Zt=0;function er(e){return typeof e=="object"&&typeof e.then=="function"}function Vc(e){let t=!1,n=hg[e.type];return e.type==="decl"?t=e.prop.toLowerCase():e.type==="atrule"&&(t=e.name.toLowerCase()),t&&e.append?[n,n+"-"+t,Zt,n+"Exit",n+"Exit-"+t]:t?[n,n+"-"+t,n+"Exit",n+"Exit-"+t]:e.append?[n,Zt,n+"Exit"]:[n,n+"Exit"]}function Wc(e){let t;return e.type==="document"?t=["Document",Zt,"DocumentExit"]:e.type==="root"?t=["Root",Zt,"RootExit"]:t=Vc(e),{eventIndex:0,events:t,iterator:0,node:e,visitorIndex:0,visitors:[]}}function ha(e){return e[Ke]=!1,e.nodes&&e.nodes.forEach(t=>ha(t)),e}var ga={},xt=class e{get content(){return this.stringify().content}get css(){return this.stringify().css}get map(){return this.stringify().map}get messages(){return this.sync().messages}get opts(){return this.result.opts}get processor(){return this.result.processor}get root(){return this.sync().root}get[Symbol.toStringTag](){return"LazyResult"}constructor(t,n,r){this.stringified=!1,this.processed=!1;let i;if(typeof n=="object"&&n!==null&&(n.type==="root"||n.type==="document"))i=ha(n);else if(n instanceof e||n instanceof Uc)i=ha(n.root),n.map&&(typeof r.map>"u"&&(r.map={}),r.map.inline||(r.map.inline=!1),r.map.prev=n.map);else{let o=dg;r.syntax&&(o=r.syntax.parse),r.parser&&(o=r.parser),o.parse&&(o=o.parse);try{i=o(n,r)}catch(a){this.processed=!0,this.error=a}i&&!i[pg]&&lg.rebuild(i)}this.result=new Uc(t,i,r),this.helpers={...ga,postcss:ga,result:this.result},this.plugins=this.processor.plugins.map(o=>typeof o=="object"&&o.prepare?{...o,...o.prepare(this.result)}:o)}async(){return this.error?Promise.reject(this.error):this.processed?Promise.resolve(this.result):(this.processing||(this.processing=this.runAsync()),this.processing)}catch(t){return this.async().catch(t)}finally(t){return this.async().then(t,t)}getAsyncError(){throw new Error("Use process(css).then(cb) to work with async plugins")}handleError(t,n){let r=this.result.lastPlugin;try{n&&n.addToError(t),this.error=t,t.name==="CssSyntaxError"&&!t.plugin?(t.plugin=r.postcssPlugin,t.setMessage()):r.postcssVersion}catch(i){console&&console.error&&console.error(i)}return t}prepareVisitors(){this.listeners={};let t=(n,r,i)=>{this.listeners[r]||(this.listeners[r]=[]),this.listeners[r].push([n,i])};for(let n of this.plugins)if(typeof n=="object")for(let r in n){if(!gg[r]&&/^[A-Z]/.test(r))throw new Error(`Unknown event ${r} in ${n.postcssPlugin}. Try to update PostCSS (${this.processor.version} now).`);if(!bg[r])if(typeof n[r]=="object")for(let i in n[r])i==="*"?t(n,r,n[r][i]):t(n,r+"-"+i.toLowerCase(),n[r][i]);else typeof n[r]=="function"&&t(n,r,n[r])}this.hasListener=Object.keys(this.listeners).length>0}async runAsync(){this.plugin=0;for(let t=0;t0;){let r=this.visitTick(n);if(er(r))try{await r}catch(i){let o=n[n.length-1].node;throw this.handleError(i,o)}}}if(this.listeners.OnceExit)for(let[n,r]of this.listeners.OnceExit){this.result.lastPlugin=n;try{if(t.type==="document"){let i=t.nodes.map(o=>r(o,this.helpers));await Promise.all(i)}else await r(t,this.helpers)}catch(i){throw this.handleError(i)}}}return this.processed=!0,this.stringify()}runOnRoot(t){this.result.lastPlugin=t;try{if(typeof t=="object"&&t.Once){if(this.result.root.type==="document"){let n=this.result.root.nodes.map(r=>t.Once(r,this.helpers));return er(n[0])?Promise.all(n):n}return t.Once(this.result.root,this.helpers)}else if(typeof t=="function")return t(this.result.root,this.result)}catch(n){throw this.handleError(n)}}stringify(){if(this.error)throw this.error;if(this.stringified)return this.result;this.stringified=!0,this.sync();let t=this.result.opts,n=mg;t.syntax&&(n=t.syntax.stringify),t.stringifier&&(n=t.stringifier),n.stringify&&(n=n.stringify);let r=this.result.root.source;if(t.map===void 0&&!(r&&r.input&&r.input.map)){let a="";return n(this.result.root,l=>{a+=l}),this.result.css=a,this.result}let o=new cg(n,this.result.root,this.result.opts).generate();return this.result.css=o[0],this.result.map=o[1],this.result}sync(){if(this.error)throw this.error;if(this.processed)return this.result;if(this.processed=!0,this.processing)throw this.getAsyncError();for(let t of this.plugins){let n=this.runOnRoot(t);if(er(n))throw this.getAsyncError()}if(this.prepareVisitors(),this.hasListener){let t=this.result.root;for(;!t[Ke];)t[Ke]=!0,this.walkSync(t);if(this.listeners.OnceExit)if(t.type==="document")for(let n of t.nodes)this.visitSync(this.listeners.OnceExit,n);else this.visitSync(this.listeners.OnceExit,t)}return this.result}then(t,n){return this.async().then(t,n)}toString(){return this.css}visitSync(t,n){for(let[r,i]of t){this.result.lastPlugin=r;let o;try{o=i(n,this.helpers)}catch(a){throw this.handleError(a,n.proxyOf)}if(n.type!=="root"&&n.type!=="document"&&!n.parent)return!0;if(er(o))throw this.getAsyncError()}}visitTick(t){let n=t[t.length-1],{node:r,visitors:i}=n;if(r.type!=="root"&&r.type!=="document"&&!r.parent){t.pop();return}if(i.length>0&&n.visitorIndex{i[Ke]||this.walkSync(i)});else{let i=this.listeners[r];if(i&&this.visitSync(i,t.toProxy()))return}}warnings(){return this.sync().warnings()}};xt.registerPostcss=e=>{ga=e};zc.exports=xt;xt.default=xt;fg.registerLazyResult(xt);ug.registerLazyResult(xt)});var $c=ae((zA,qc)=>{"use strict";var xg=da(),yg=ui(),vg=ci(),Sg=Bn(),VA=pa(),tr=class{get content(){return this.result.css}get css(){return this.result.css}get map(){return this.result.map}get messages(){return[]}get opts(){return this.result.opts}get processor(){return this.result.processor}get root(){if(this._root)return this._root;let t,n=yg;try{t=n(this._css,this._opts)}catch(r){this.error=r}if(this.error)throw this.error;return this._root=t,t}get[Symbol.toStringTag](){return"NoWorkResult"}constructor(t,n,r){n=n.toString(),this.stringified=!1,this._processor=t,this._css=n,this._opts=r,this._map=void 0;let i=Sg;this.result=new vg(this._processor,void 0,this._opts),this.result.css=n;let o=this;Object.defineProperty(this.result,"root",{get(){return o.root}});let a=new xg(i,void 0,this._opts,n);if(a.isMap()){let[l,s]=a.generate();l&&(this.result.css=l),s&&(this.result.map=s)}else a.clearAnnotation(),this.result.css=a.css}async(){return this.error?Promise.reject(this.error):Promise.resolve(this.result)}catch(t){return this.async().catch(t)}finally(t){return this.async().then(t,t)}sync(){if(this.error)throw this.error;return this.result}then(t,n){return this.async().then(t,n)}toString(){return this._css}warnings(){return[]}};qc.exports=tr;tr.default=tr});var Kc=ae((qA,jc)=>{"use strict";var Ag=Zr(),Eg=ba(),wg=$c(),Cg=Jt(),Mt=class{constructor(t=[]){this.version="8.5.14",this.plugins=this.normalize(t)}normalize(t){let n=[];for(let r of t)if(r.postcss===!0?r=r():r.postcss&&(r=r.postcss),typeof r=="object"&&Array.isArray(r.plugins))n=n.concat(r.plugins);else if(typeof r=="object"&&r.postcssPlugin)n.push(r);else if(typeof r=="function")n.push(r);else if(!(typeof r=="object"&&(r.parse||r.stringify)))throw new Error(r+" is not a PostCSS plugin");return n}process(t,n={}){return!this.plugins.length&&!n.parser&&!n.stringifier&&!n.syntax?new wg(this,t,n):new Eg(this,t,n)}use(t){return this.plugins=this.plugins.concat(this.normalize([t])),this}};jc.exports=Mt;Mt.default=Mt;Cg.registerProcessor(Mt);Ag.registerProcessor(Mt)});var nd=ae(($A,td)=>{"use strict";var Yc=Qr(),Xc=qn(),_g=gt(),Tg=Xr(),Jc=jn(),Qc=Zr(),Rg=Ac(),kg=Yn(),Mg=ba(),Fg=ua(),Ng=Vn(),Lg=ui(),xa=Kc(),Dg=ci(),Zc=Jt(),ed=ri(),Ig=Bn(),Pg=ma();function ce(...e){return e.length===1&&Array.isArray(e[0])&&(e=e[0]),new xa(e)}ce.plugin=function(t,n){let r=!1;function i(...a){console&&console.warn&&!r&&(r=!0,console.warn(t+`: postcss.plugin was deprecated. Migration guide:\nhttps://evilmartians.com/chronicles/postcss-8-plugin-migration`),process.env.LANG&&process.env.LANG.startsWith("cn")&&console.warn(t+`: \\u91CC\\u9762 postcss.plugin \\u88AB\\u5F03\\u7528. \\u8FC1\\u79FB\\u6307\\u5357:\nhttps://www.w3ctech.com/topic/2226`));let l=n(...a);return l.postcssPlugin=t,l.postcssVersion=new xa().version,l}let o;return Object.defineProperty(i,"postcss",{get(){return o||(o=i()),o}}),i.process=function(a,l,s){return ce([i(s)]).process(a,l)},i};ce.stringify=Ig;ce.parse=Lg;ce.fromJSON=Rg;ce.list=Fg;ce.comment=e=>new Xc(e);ce.atRule=e=>new Yc(e);ce.decl=e=>new Jc(e);ce.rule=e=>new ed(e);ce.root=e=>new Zc(e);ce.document=e=>new Qc(e);ce.CssSyntaxError=Tg;ce.Declaration=Jc;ce.Container=_g;ce.Processor=xa;ce.Document=Qc;ce.Comment=Xc;ce.Warning=Pg;ce.AtRule=Yc;ce.Result=Dg;ce.Input=kg;ce.Rule=ed;ce.Root=Zc;ce.Node=Ng;Mg.registerPostcss(ce);td.exports=ce;ce.default=ce});function Cr(){return globalThis}function L(e,t){if(typeof window>"u")return;let n=Cr(),r=n.__hf?.onSwallowed;if(r)try{r({label:e,error:t})}catch(i){}(n.__hfDebug||n.__HYPERFRAMES_DEBUG)&&console.debug(`[hyperframes] ${e} swallowed:`,t)}var Zm=["seconds-time","rational-fps","seek-keep-playing","composition-manifest-v1","runtime-data"];function ep(e,t){let n=Math.abs(e),r=Math.abs(t);for(;r!==0;){let i=n%r;n=r,r=i}return n||1}function tp(e){let t=Number.isFinite(e)&&e>0?e:30,n=Number.isInteger(t)?1:1e6,r=Math.round(t*n),i=ep(r,n);return{numerator:r/i,denominator:n/i}}function Ji(e){if(typeof e!="object"||e===null)return null;let t=e;return!Number.isFinite(t.numerator)||!Number.isFinite(t.denominator)||(t.numerator??0)<=0||(t.denominator??0)<=0?null:Number(t.numerator)/Number(t.denominator)}function _r(e){return{protocolVersion:1,capabilities:Zm,fps:tp(e)}}function np(e){return Array.isArray(e)&&e.every(t=>typeof t=="string")}function Hs(e,t=30){if(typeof e!="object"||e===null)return{status:"legacy",fps:t};let n=e;if(n.protocolVersion===void 0)return{status:"legacy",fps:t};if(n.protocolVersion!==1)return{status:"unsupported",code:"unsupported_protocol_version",receivedVersion:n.protocolVersion};let r=Ji(n.fps);return r===null||!np(n.capabilities)?{status:"unsupported",code:"invalid_protocol_metadata",receivedVersion:n.protocolVersion}:{status:"supported",fps:r,metadata:n}}var Gs=30;function Bs(e){Gs=Number.isFinite(e)&&e>0?e:30}function be(e){try{window.parent.postMessage({...e,..._r(Gs)},"*")}catch(t){L("bridge.postMessage",t)}}var rp={play:(e,t)=>t.onPlay(),pause:(e,t)=>t.onPause(),"stop-media":(e,t)=>t.onStopMedia(),seek:(e,t)=>t.onSeek(ip(e,t),e.seekMode??"commit"),tick:(e,t)=>t.onTick(),"set-muted":(e,t)=>t.onSetMuted(!!e.muted),"set-volume":(e,t)=>t.onSetVolume(Math.max(0,Math.min(1,Number(e.volume??1)))),"set-media-output-muted":(e,t)=>t.onSetMediaOutputMuted(!!e.muted),"set-native-media-sync-disabled":(e,t)=>t.onSetNativeMediaSyncDisabled(!!e.disabled),"set-web-audio-media-disabled":(e,t)=>t.onSetWebAudioMediaDisabled(!!e.disabled),"set-playback-rate":(e,t)=>t.onSetPlaybackRate(Number(e.playbackRate??1)),"set-root-duration":(e,t)=>t.onSetRootDuration(Number(e.durationSeconds??0)),"set-color-grading":(e,t)=>t.onSetColorGrading(e.target??null,e.grading??null),"set-color-grading-compare":(e,t)=>t.onSetColorGradingCompare(e.target??null,e.compare??null),"enable-pick-mode":(e,t)=>t.onEnablePickMode(),"disable-pick-mode":(e,t)=>t.onDisablePickMode(),"flash-elements":e=>ap(e),"set-runtime-data":(e,t)=>{typeof e.channel=="string"&&t.onSetRuntimeData?.(e.channel,e.payload,e.requestId)},"clear-runtime-data":(e,t)=>{typeof e.channel=="string"&&t.onClearRuntimeData?.(e.channel,e.requestId)}};function ip(e,t){let n=Number(e.timeSeconds);if(Number.isFinite(n))return Math.max(0,n);let i=Ji(e.fps)??t.getCanonicalFps();return Math.max(0,Number(e.frame??0))/i}function op(e){let t=Hs(e);return t.status!=="unsupported"?!1:(be({source:"hf-preview",type:"diagnostic",code:`runtime.protocol.${t.code}`,details:{receivedVersion:typeof t.receivedVersion=="string"||typeof t.receivedVersion=="number"?t.receivedVersion:null}}),!0)}function ap(e){let t=e.selectors,n=e.duration||800;t&&sp(t,n)}function Us(e){let t=n=>{let r=n.data;if(!r||r.source!=="hf-parent"||r.type!=="control"||op(r))return;let i=r.action;if(typeof i!="string")return;let o=rp[i];o&&o(r,e)};return window.addEventListener("message",t),be({source:"hf-preview",type:"ready"}),t}function sp(e,t){if(!document.getElementById("__hf-flash-styles")){let n=document.createElement("style");n.id="__hf-flash-styles",n.textContent=`\n .__hf-flash {\n outline: 2px solid rgba(59, 130, 246, 0.6) !important;\n outline-offset: 2px !important;\n animation: __hf-flash-pulse ${t}ms ease-out forwards !important;\n }\n @keyframes __hf-flash-pulse {\n 0% { outline-color: rgba(59, 130, 246, 0.8); }\n 100% { outline-color: transparent; }\n }\n `,document.head.appendChild(n)}for(let n of e)try{document.querySelectorAll(n).forEach(i=>{i.classList.add("__hf-flash"),setTimeout(()=>i.classList.remove("__hf-flash"),t)})}catch(r){L("bridge.flashElements.querySelector",r)}}var Qi=null;function Ws(e){Qi=e}function Ne(e,t){if(Qi)try{Qi({source:"hf-preview",type:"analytics",event:e,properties:t??{}})}catch(n){L("runtime.analytics.site1",n)}}function lp(e){let t=e.toLowerCase().replace(/[^a-z0-9]+/g,"-"),n=0,r=t.length;for(;nn&&t[r-1]==="-";)r--;let i=t.slice(n,r);return i.length>0?i:"node"}function Pt(e){return`--${lp(e)}`}function Vs(e){let t=new Map;for(let n of e){let r=Pt(n),i=t.get(r);i?i.includes(n)||i.push(n):t.set(r,[n])}return[...t.values()].filter(n=>n.length>1)}function qs(){if(typeof document>"u")return{};let e=new Set;document.documentElement?.hasAttribute("data-composition-variables")&&e.add(document.documentElement);for(let i of Array.from(document.querySelectorAll("[data-composition-variables]")))e.add(i);let t={};for(let i of e)Object.assign(t,bn(i));let n=Rr(),r={...t,...n};for(let i of e)eo(i,r);return r}var zs=new Set;function $s(e){let t=e?.getAttribute("data-composition-variables");if(!t)return[];let n;try{n=JSON.parse(t)}catch{return[]}return Array.isArray(n)?n.filter(r=>!!r&&typeof r=="object"):[]}function up(e,t){return t?.trim()||e.getAttribute("data-composition-id")?.trim()||e.querySelector("[data-composition-id]")?.getAttribute("data-composition-id")?.trim()||"composition"}function cp(e){return Array.isArray(e.options)?e.options.map(t=>t&&typeof t=="object"?t.value:t).filter(t=>typeof t=="string"||typeof t=="number"):[]}function dp(e,t){if(typeof e.id!="string")return null;let n=t[e.id];if(n==null||"default"in e&&String(n)===String(e.default))return null;let r=cp(e);return r.length===0||r.some(i=>String(i)===String(n))?null:{id:e.id,value:n,allowed:r}}function eo(e,t,n){if(!e)return;let r=$s(e);if(r.length===0)return;let i=up(e,n);for(let o of r){let a=dp(o,t);if(!a)continue;let l=`${i}|${a.id}|${String(a.value)}`;if(zs.has(l))continue;zs.add(l);let s="default"in o?JSON.stringify(o.default):"the composition default";console.warn(`[hyperframes] runtime_unknown_enum_value: ${i} variable "${a.id}" got ${JSON.stringify(a.value)}, which is not a declared option (${a.allowed.join(", ")}). Rendering ${s} instead.`)}}function bn(e){let t={};for(let n of $s(e))typeof n.id!="string"||!("default"in n)||(t[n.id]=n.default);return t}var Zi="data-hf-css-vars";function Tr(e){return"style"in e&&typeof e.style?.setProperty=="function"}function to(e,t){if(!Tr(e))return;let n=[];for(let[r,i]of Object.entries(t))if(typeof i=="string"&&i!==""||typeof i=="number"){let o=Pt(r);e.style.setProperty(o,String(i)),n.push(o)}n.length>0&&e.setAttribute(Zi,n.join(" "))}function js(e,t,n){let r={};for(let[i,o]of Object.entries(t)){let a=Pt(i);((Tr(e)?e.style.getPropertyValue(a):"")||(n?n.getComputedStyle(e).getPropertyValue(a):"")).trim()===""&&(r[i]=o)}return r}function Ks(e){if(!Tr(e))return;let t=e.getAttribute(Zi);if(t){for(let n of t.split(" "))n.startsWith("--")&&e.style.removeProperty(n);e.removeAttribute(Zi)}}function Ys(e){let t=new Set;e.documentElement?.hasAttribute("data-composition-variables")&&t.add(e.documentElement);for(let i of Array.from(e.querySelectorAll("[data-composition-variables]")))t.add(i);let n=Rr(),r=[];for(let i of t)r.push(...fp(i,n,e.defaultView));for(let i of Vs(r))console.warn(`composition variables ${i.join(", ")} collapse to the same CSS property ${Pt(i[0]??"")} \\u2014 rename one to avoid cross-talk`)}function fp(e,t,n){if(!Tr(e))return[];let r=bn(e),i={};for(let[o,a]of Object.entries(r)){if(o in t)continue;let l=Pt(o);(e.style.getPropertyValue(l)||(n?n.getComputedStyle(e).getPropertyValue(l):"")).trim()===""&&(i[o]=a)}for(let[o,a]of Object.entries(t))o in r&&(i[o]=a);return to(e,i),Object.keys(r)}function Xs(e){let t=e.getAttribute("data-variable-values");if(!t)return{};let n;try{n=JSON.parse(t)}catch{return{}}return!n||typeof n!="object"||Array.isArray(n)?{}:n}function Rr(){if(typeof window>"u")return{};let e=window.__hfVariables;return!e||typeof e!="object"||Array.isArray(e)?{}:e}function Js(e){let t=[],n=u=>{if(typeof u.getAnimations!="function")return[];try{return u.getAnimations()}catch{return[]}},r=u=>e?.resolveStartSeconds?e.resolveStartSeconds(u):Number.parseFloat(u.getAttribute("data-start")??"0")||0,i=(u,c)=>{let f=null;try{f=u.effect?.getComputedTiming?.()??null}catch(p){L("runtime.adapters.css.site5",p)}if(!f)return{};let m=Number(f.endTime);return Number.isFinite(m)?{endSeconds:c+m/1e3}:{unbounded:!0}},o=(u,c)=>{for(let f of u){try{f.currentTime=c}catch(m){L("runtime.adapters.css.site1",m)}try{f.pause()}catch(m){L("runtime.adapters.css.site2",m)}}},a=u=>{for(let c of u)try{c.play()}catch(f){L("runtime.adapters.css.site3",f)}},l=u=>{for(let c of u)try{c.pause()}catch(f){L("runtime.adapters.css.site4",f)}},s=u=>{u.baseDelay?u.el.style.animationDelay=u.baseDelay:u.el.style.removeProperty("animation-delay"),u.basePlayState?u.el.style.animationPlayState=u.basePlayState:u.el.style.removeProperty("animation-play-state")};return{name:"css",discover:()=>{t=[];let u=document.querySelectorAll("*");for(let c of u){if(!(c instanceof HTMLElement))continue;let f=window.getComputedStyle(c);!f.animationName||f.animationName==="none"||t.push({el:c,baseDelay:c.style.animationDelay||"",basePlayState:c.style.animationPlayState||"",animations:n(c)})}},getInferredDurationSeconds:()=>{let u=0;for(let c of t){if(!c.el.isConnected)continue;let f=r(c.el);for(let m of n(c.el)){let p=i(m,f);p.endSeconds!=null&&(u=Math.max(u,p.endSeconds))}}return u>0?u:null},seek:u=>{let c=Number(u.time)||0;for(let f of t){if(!f.el.isConnected)continue;let m=r(f.el),p=Math.max(0,c-m)*1e3,b=f.animations;if(b.length>0){o(b,p);continue}f.el.style.animationPlayState="paused",f.el.style.animationDelay=`-${(p/1e3).toFixed(3)}s`}},pause:()=>{for(let u of t){if(!u.el.isConnected)continue;let c=u.animations;c.length>0&&l(c),s(u)}},play:()=>{for(let u of t)u.el.isConnected&&(s(u),a(u.animations))},revert:()=>{t=[]}}}function Qs(e){return{name:"gsap",discover:()=>{},seek:t=>{let n=e.getTimeline();if(!n)return;n.pause();let r=Math.max(0,Number(t.time)||0),i=t.suppressEvents===!0;typeof n.totalTime=="function"?(n.totalTime(r+.001,!0),n.totalTime(r,i)):n.seek(r,i)},pause:()=>{let t=e.getTimeline();t&&t.pause()}}}function Zs(){return{name:"animejs",discover:()=>{try{let e=window.anime;if(!e||typeof e.running>"u")return;let t=e.running;if(!Array.isArray(t)||t.length===0)return;let n=window.__hfAnime??[],r=new Set(n);for(let i of t)r.has(i)||n.push(i);window.__hfAnime=n}catch(e){L("runtime.adapters.animejs.site1",e)}},seek:e=>{let t=Math.max(0,(Number(e.time)||0)*1e3),n=window.__hfAnime;if(!(!n||n.length===0))for(let r of n)try{typeof r.seek=="function"&&r.seek(t)}catch(i){L("runtime.adapters.animejs.site2",i)}},pause:()=>{let e=window.__hfAnime;if(!(!e||e.length===0))for(let t of e)try{typeof t.pause=="function"&&t.pause()}catch(n){L("runtime.adapters.animejs.site3",n)}},play:()=>{let e=window.__hfAnime;if(!(!e||e.length===0))for(let t of e)try{typeof t.play=="function"&&t.play()}catch(n){L("runtime.adapters.animejs.site4",n)}},revert:()=>{}}}function tl(){return{name:"lottie",discover:()=>{try{let e=window.lottie;if(e&&typeof e.getRegisteredAnimations=="function"){let t=e.getRegisteredAnimations();if(Array.isArray(t)&&t.length>0){let n=window.__hfLottie??[],r=new Set(n);for(let i of t)r.has(i)||n.push(i);window.__hfLottie=n}}}catch(e){L("runtime.adapters.lottie.site1",e)}},seek:e=>{let t=Math.max(0,Number(e.time)||0),n=window.__hfLottie;if(!(!n||n.length===0))for(let r of n)try{if(no(r))r.goToAndStop(t*1e3,!1);else if(ro(r)){if(typeof r.setCurrentRawFrameValue=="function"){let i=r.totalFrames??0,o=r.frameRate??30,a=t*o;i>0&&r.setCurrentRawFrameValue(Math.min(a,i-1))}else if(typeof r.seek=="function"){let i=r.duration??1,o=Math.min(100,t/i*100);r.seek(o)}}}catch(i){L("runtime.adapters.lottie.site2",i)}},pause:()=>{let e=window.__hfLottie;if(!(!e||e.length===0))for(let t of e)try{(no(t)||ro(t))&&t.pause()}catch(n){L("runtime.adapters.lottie.site3",n)}},revert:()=>{},getInferredDurationSeconds:()=>{let e=window.__hfLottie;if(!e||e.length===0)return null;let t=0,n=!1;for(let r of e){let i=null;try{i=mp(r)}catch(o){L("runtime.adapters.lottie.site4",o)}i!=null&&(n=!0,t=Math.max(t,i))}return n?t:null}}}function el(e,t){return!Number.isFinite(e)||!e||e<=0||!Number.isFinite(t)||!t||t<=0?null:e/t}function mp(e){return no(e)?el(e.totalFrames,e.frameRate):ro(e)?Number.isFinite(e.duration)&&(e.duration??0)>0?e.duration??null:el(e.totalFrames,e.frameRate):null}function no(e){return typeof e=="object"&&e!==null&&typeof e.goToAndStop=="function"}function ro(e){return typeof e=="object"&&e!==null&&typeof e.pause=="function"&&("totalFrames"in e||"duration"in e)}var io=-1,kr=new Set,Ot,oo=0;function nl(e){let t=[],n=!0,r={time:e,waitUntil:o=>{if(!n)throw new Error("hf-seek waitUntil() must be called synchronously from the event listener");t.push(o)}};try{window.dispatchEvent(new CustomEvent("hf-seek",{detail:r}))}catch(o){L("runtime.adapters.seek-dispatch.site1",o)}finally{n=!1}if(t.length===0)return;let i=Promise.all(t).then(()=>({status:"fulfilled"})).catch(o=>({status:"rejected",reason:o}));kr.add(i),i.then(o=>{kr.delete(i)&&o.status==="rejected"&&Ot===void 0&&(Ot={reason:o.reason})})}function Mr(e){e!==io&&(io=e,nl(e))}function Fr(e){io=e,nl(e)}function rl(){return oo>0}async function ao(){oo+=1;let e=Ot;try{for(await Promise.resolve();kr.size>0;){let r=(await Promise.all([...kr])).find(i=>i.status==="rejected");e===void 0&&r?.status==="rejected"&&(e={reason:r.reason})}let t=Ot;if(e===void 0&&(e=t),Ot===t&&(Ot=void 0),e)throw e.reason}finally{oo-=1}}function il(){let e=null,t=0,n=null,r=null,i=null,o=null,a=()=>{if(typeof window>"u")return null;let c=window.THREE?.DefaultLoadingManager;return!c||typeof c!="object"||typeof c.itemsLoaded!="number"||typeof c.itemsTotal!="number"?null:c},l=u=>{o||u.itemsTotal<=u.itemsLoaded||(o=new Promise(c=>{u.onLoad=function(){try{i?.call(this)}finally{o=null,u.onLoad=i??null,c()}}}))},s=u=>{n!==u&&(n=u,r=u.onStart??null,i=u.onLoad??null,u.onStart=function(c,f,m){try{r?.call(this,c,f,m)}finally{l(u)}})};return{name:"three",discover:()=>{let u=a();u&&(s(u),l(u))},seek:u=>{e=Math.max(0,Number(u.time)||0),t=e,window.__hfThreeTime=e,Mr(e)},pause:()=>{e==null&&(e=Math.max(0,t))},play:()=>{e=null},revert:()=>{e=null,t=0},getReadyPromise:()=>{let u=a();return!u||u.itemsTotal<=u.itemsLoaded?null:(o||l(u),o)}}}function qe(e){let t=null,n=new WeakSet;return{name:e.name,discover:()=>{},seek:()=>{},pause:()=>{},play:()=>{},revert:()=>{},getReadyPromise:()=>{let r=e.getInstances();if(r.length===0)return null;let i=r.filter(o=>!n.has(o));return i.length===0?null:t||(t=Promise.allSettled(i.map(o=>e.waitFor(o).then(()=>{n.add(o)}))).then(()=>{t=null}),t)}}}function ol(){return qe({name:"mapbox",getInstances:()=>{if(typeof window>"u")return[];let e=window.__hfMapbox;return Array.isArray(e)?e:[]},waitFor:e=>new Promise(t=>{if(e.loaded()){t();return}e.on("load",t)})})}function al(){return qe({name:"leaflet",getInstances:()=>{if(typeof window>"u")return[];let e=window.__hfLeaflet;return Array.isArray(e)?e:[]},waitFor:e=>new Promise(t=>e.whenReady(t))})}function sl(){return qe({name:"google-maps",getInstances:()=>{if(typeof window>"u")return[];let e=window.__hfGoogleMaps;return Array.isArray(e)?e:[]},waitFor:e=>new Promise(t=>{let n=e.addListener("tilesloaded",()=>{n.remove(),t()})})})}function ll(){return qe({name:"maplibre",getInstances:()=>{if(typeof window>"u")return[];let e=window.__hfMaplibre;return Array.isArray(e)?e:[]},waitFor:e=>new Promise(t=>{if(e.loaded()){t();return}e.on("load",t)})})}function ul(){return qe({name:"d3",getInstances:()=>{if(typeof window>"u")return[];let e=window.__hfD3;return Array.isArray(e)?e:[]},waitFor:e=>e.end()})}var pp=250;function cl(){let e=null,t=0,n=null,r=()=>{n!==null&&(window.clearInterval(n),n=null)},i=()=>{n===null&&document.querySelector("[data-composition-id][data-requires-webgpu]")&&(n=window.setInterval(()=>{e!==null&&(rl()||(window.__hfTypegpuTime=e,Fr(e)))},pp))};return{name:"typegpu",discover:()=>{},seek:o=>{e=Math.max(0,Number(o.time)||0),t=e,window.__hfTypegpuTime=e,Mr(e)},pause:()=>{e==null&&(e=Math.max(0,t)),i()},play:()=>{r(),e=null},revert:()=>{r(),e=null,t=0}}}var xn="data-hf-render-id",dl="data-hf-group-render-id";function hp(e){return e.getAttribute(xn)||e.id||null}var gp="__render_frame_",bp="__";function xp(e){return`${gp}${e}${bp}`}function yp(e){let t=hp(e);return t?xp(t):null}function ut(e){let t=yp(e);if(!t)return null;let n=document.getElementById(t);return n instanceof HTMLImageElement?n:null}function fl(e){let t=e.nextElementSibling;if(t instanceof HTMLImageElement&&t.classList.contains("__render_frame__")&&t.complete&&t.naturalWidth>0)return t;let n=ut(e);return n&&n.complete&&n.naturalWidth>0?n:null}function ml(){let e=globalThis.GPUQueue;if(!e?.prototype?.copyExternalImageToTexture)return;let t=e.prototype.copyExternalImageToTexture;e.prototype.copyExternalImageToTexture=function(n,r,i){if(n?.source instanceof HTMLVideoElement){let o=fl(n.source);if(o)return t.call(this,{...n,source:o},r,i)}return t.call(this,n,r,i)}}function pl(){let e=[globalThis.WebGL2RenderingContext,globalThis.WebGLRenderingContext],t=["texImage2D","texSubImage2D"];for(let n of e){let r=n?.prototype;if(r)for(let i of t){let o=r[i];if(typeof o!="function"||o.__hfVideoPatched)continue;let a=function(...l){let s=l.length-1,u=l[s];if(u instanceof HTMLVideoElement){let c=fl(u);c&&(l[s]=c)}return o.apply(this,l)};a.__hfVideoPatched=!0,r[i]=a}}}function hl(){let e=!1,t=0,n=!1,r,i,o,a=new Set,l=new WeakMap,s=()=>{if(!document.getAnimations)return[];try{return document.getAnimations()}catch{return[]}},u=x=>{let _=Number(x.currentTime);return Number.isFinite(_)&&_>0?_:0},c=(x,_)=>_<=0?x:x>=_?Math.max(0,x-_):x,f=(x,_)=>{let R=l.get(x);if(R)return R;let T={compositionTimeMs:_,animationTimeMs:e?c(u(x),_):u(x)};return l.set(x,T),T},m=(x,_)=>{if(!a.has(x)){a.add(x);let R=()=>{a.delete(x)};try{x.addEventListener("finish",R,{once:!0}),x.addEventListener("cancel",R,{once:!0})}catch(T){L("runtime.adapters.waapi.site4",T)}}f(x,_)},p=(x,_)=>{for(let R of x)m(R,_)},b=()=>{if(n||typeof Element>"u")return;let x=Element.prototype;if(typeof x.animate!="function"||x.__hfOriginalAnimate)return;let _=x.animate;try{Object.defineProperty(x,"__hfOriginalAnimate",{value:_,configurable:!0});let R=function(...T){let M=_.apply(this,T);return m(M,t),M};x.animate=R,r=x,i=_,o=R,n=!0}catch{}},v=x=>{let _=null;try{_=x.effect?.getComputedTiming?.()??null}catch(M){L("runtime.adapters.waapi.site4",M)}if(!_)return{};let R=Number(_.endTime);return Number.isFinite(R)?{endSeconds:(l.get(x)?.compositionTimeMs??0)/1e3+R/1e3}:{unbounded:!0}};return{name:"waapi",discover:()=>{e=!0,b(),p(s(),t)},seek:x=>{let _=Math.max(0,(Number(x.time)||0)*1e3);t=_,(!e||a.size>0)&&p(s(),e?_:0);for(let R of a){let T=e?f(R,_):f(R,0),M=T.animationTimeMs+Math.max(0,_-T.compositionTimeMs);try{R.currentTime=M}catch(D){L("runtime.adapters.waapi.site1",D)}try{R.pause()}catch(D){L("runtime.adapters.waapi.site2",D)}}},pause:()=>{e||p(s(),t);for(let x of a)try{x.pause()}catch(_){L("runtime.adapters.waapi.site3",_)}},revert:()=>{if(a.clear(),l=new WeakMap,e=!1,t=0,r&&i&&o&&r.animate===o)try{r.animate=i,r.__hfOriginalAnimate===i&&delete r.__hfOriginalAnimate}catch(x){L("runtime.adapters.waapi.site5",x)}r=void 0,i=void 0,o=void 0,n=!1},getInferredDurationSeconds:()=>{let x=0;for(let _ of s()){let R=v(_);R.endSeconds!=null&&(x=Math.max(x,R.endSeconds))}return x>0?x:null}}}var so=3.981071705534972;function Le(e){return Number.isFinite(e)?Math.max(0,Math.min(so,e)):1}function Nr(e){return Number.isFinite(e)?Math.max(0,Math.min(1,e)):1}function gl(e,t){let n=typeof HTMLMediaElement>"u"?void 0:Object.getOwnPropertyDescriptor(HTMLMediaElement.prototype,"volume"),r=n?.get,i=n?.set;if(!r||!i)return t();let o=Number(r.call(e));Object.defineProperty(e,"volume",{configurable:!0,get:()=>o,set:a=>{o=Number(a),i.call(e,Nr(o))}});try{return t()}finally{delete e.volume,i.call(e,Nr(o))}}var Ht=Object.freeze({start:"data-start",duration:"data-duration",trackIndex:"data-track-index",derivedEnd:"data-end",legacyTrack:"data-layer"}),yv=Object.freeze([Ht.start,Ht.duration,Ht.trackIndex]),vv=Object.freeze([Ht.derivedEnd]),Sv=Object.freeze([Ht.derivedEnd,Ht.legacyTrack]);function Gt(e){if(e==null||e.trim()==="")return null;let t=Number(e);return Number.isFinite(t)?t:null}var xl=/^[A-Za-z0-9_.:-]+$/;function yl(e,t){let n=e.charCodeAt(t);return n>=48&&n<=57}function bl(e,t){let n=t;for(;n>=0&&yl(e,n);)n--;return n}function vp(e,t){let n=t;for(;n>=0&&(e[n]??"").trim()==="";)n--;return n}function Sp(e){let t=e.length-1;if(!yl(e,t))return null;let n=bl(e,t);return e[n]==="."&&(n=bl(e,n-1)),n+1}function Ap(e){let t=Sp(e);if(t==null)return null;let n=vp(e,t-1),r=e[n];if(r!=="+"&&r!=="-")return null;let i=e.slice(0,n).trim();if(!xl.test(i))return null;let o=Number(e.slice(t));return Number.isFinite(o)?{refId:i,operator:r,magnitude:o}:null}function lo(e){let t=(e??"").trim();if(!t)return null;let n=Gt(t);if(n!=null)return{kind:"absolute",value:n};if(xl.test(t))return{kind:"reference",refId:t,offset:0};let r=Ap(t);return r?{kind:"reference",refId:r.refId,offset:r.operator==="-"?-r.magnitude:r.magnitude}:null}function vl(e){return Number.isFinite(e)&&e>0?Math.max(.1,Math.min(5,e)):1}function ve(e){return Gt(e)}function _e(e){let t=Number.parseFloat(e.getAttribute("data-playback-rate")??""),n=Number.isFinite(t)&&t>0?t:typeof HTMLMediaElement<"u"&&e instanceof HTMLMediaElement?e.defaultPlaybackRate:1;return vl(n)}function yn(e){let t=n=>{let r=ve(n);return r==null?null:Number.isFinite(r)&&r>=0?r:null};return t(e.getAttribute("data-playback-start"))??t(e.getAttribute("data-media-start"))??0}function Qe(e,t){return Ep(t,yn(e),_e(e))}function Ep(e,t,n){return Number.isFinite(e)?Math.max(0,e-t)/vl(n):null}function wp(e,t,n){let r=e.filter(o=>Number.isFinite(o.time)&&Number.isFinite(o.volume)).map(o=>({time:Math.max(0,o.time-t),volume:Le(o.volume)})).sort((o,a)=>o.time-a.time),i=[];for(let o of r){let a=i.at(-1);a&&Math.abs(a.time-o.time)<1e-9?a.volume=o.volume:i.push(o)}return i.length===0||i[0].time>0&&i.unshift({time:0,volume:Le(n)}),i}function Sl(e,t){if(e.length===0)return 1;let n=0;for(;n=e[n+1].time;)n+=1;let r=e[n],i=e[n+1]??r,o=i.time-r.time,a=o<=0?0:Math.min(1,Math.max(0,(t-r.time)/o));return r.volume+(i.volume-r.volume)*a}function Cp(e,t,n,r){let i=e.at(-1);!i||Math.abs(i.volume-n.volume)>1e-4?(i&&t&&t.time>i.time&&e.push(t),e.push(n)):r&&n.time>i.time&&e.push(n)}function _p(e){let t=Number.parseFloat(e??"");return Number.isFinite(t)?t:void 0}function Al(e,t){let n=ve(e.dataset.start)??0,r=ve(e.dataset.end)??void 0,i=ve(e.dataset.duration)??void 0,o=t;i!==void 0&&i>0?o=n+i:r!==void 0&&r>n&&(o=r);let a=_p(e.dataset.volume)??1;return{start:n,end:o,staticVolume:Le(a)}}function Tp(e,t,n,r){let{start:i,end:o,staticVolume:a}=Al(e,n),l=1/Math.min(60,Math.max(1,r)),s=Math.max(0,i),u=Math.min(n,o),c=gl(e,()=>{e.volume=a;let m=[],p;for(let b=s;b<=u+1e-6;b=Math.min(u,b+l)){t(b);let v=Number(e.volume);if(Number.isFinite(v)){let x={time:Number(b.toFixed(6)),volume:Number(Le(v).toFixed(6))};Cp(m,p,x,b===u),p=x}if(b===u)break}return m});return c.some(m=>Math.abs(m.volume-a)>1e-4)?c:null}function El(e,t,n,r,i={}){if(i.allowLiveTimelineSeek===!1||!t||!(e instanceof HTMLAudioElement)&&!(e instanceof HTMLVideoElement)||n<=0)return;let o=s=>{try{typeof t.totalTime=="function"?t.totalTime(s,!0):typeof t.seek=="function"&&t.seek(s,!0)}catch{}},a=typeof t.totalTime=="function"?Number(t.totalTime()):typeof t.seek=="function"?Number(t.seek()):0,l=Tp(e,o,n,60);if(Number.isFinite(a)&&o(a),l){let{start:s,staticVolume:u}=Al(e,n),c=wp(l,s,u);c.length>0&&r.set(e,c)}}var Tt="data-fx-chain",Fv=Tt.slice(5),wl=1,vn=(e="frequency",t="Frequency",n=1e3,r=20,i=2e4)=>({kind:"number",key:e,label:t,unit:"Hz",min:r,max:i,step:1,default:n,scale:"log",automatable:!0}),uo=(e=.707,t="Bandwidth \\u2014 higher is narrower.")=>({kind:"number",key:"q",label:"Q",unit:"",min:.1,max:20,step:.01,default:e,scale:"log",automatable:!0,hint:t}),Lr=(e=-40,t=40,n=0)=>({kind:"number",key:"gain",label:"Gain",unit:"dB",min:e,max:t,step:.1,default:n,automatable:!0}),Cl={kind:"enum",key:"poles",label:"Slope",options:[{value:"1",label:"6 dB/oct"},{value:"2",label:"12 dB/oct"}],default:"2",hint:"Two poles is the usual biquad; one pole is gentler."},Tl=[{id:"gain",label:"Gain",group:"dynamics",description:"Raise or lower the whole signal. Automate it to duck under something else.",params:[Lr(-60,12,0)],web:"gain-node"},{id:"peaking",label:"Peaking EQ",group:"filter",description:"Boost or cut a band, leaving everything either side alone.",params:[vn("frequency","Frequency",1e3),Lr(-40,40,0),uo(1)],web:"biquad-peaking"},{id:"lowshelf",label:"Low Shelf",group:"filter",description:"Lift or drop everything below the corner frequency.",params:[vn("frequency","Frequency",200,20,2e3),Lr(-40,40,0)],web:"biquad-lowshelf"},{id:"highshelf",label:"High Shelf",group:"filter",description:"Lift or drop everything above the corner frequency.",params:[vn("frequency","Frequency",4e3,500,2e4),Lr(-40,40,0)],web:"biquad-highshelf"},{id:"highpass",label:"High-pass",group:"filter",description:"Remove low frequencies \\u2014 the usual fix for rumble on a voice.",params:[vn("frequency","Cutoff",300,20,2e4),uo(.707),Cl],web:"biquad-highpass"},{id:"lowpass",label:"Low-pass",group:"filter",description:"Remove high frequencies \\u2014 darkens or muffles a track.",params:[vn("frequency","Cutoff",8e3,100,2e4),uo(.707),Cl],web:"biquad-lowpass"},{id:"compressor",label:"Compressor",group:"dynamics",description:"Pull loud parts down so the quiet ones can come up.",params:[{kind:"number",key:"threshold",label:"Threshold",unit:"dB",min:-60,max:0,step:.5,default:-24,hint:"Level above which the compressor starts working."},{kind:"number",key:"ratio",label:"Ratio",unit:":1",min:1,max:20,step:.1,default:4},{kind:"number",key:"attack",label:"Attack",unit:"ms",min:.01,max:2e3,step:.1,default:20,scale:"log"},{kind:"number",key:"release",label:"Release",unit:"ms",min:.01,max:9e3,step:1,default:250,scale:"log"},{kind:"number",key:"knee",label:"Knee",unit:"",min:1,max:8,step:.01,default:2.83,hint:"1 is a hard corner; higher eases into it."},{kind:"number",key:"makeup",label:"Makeup",unit:"dB",min:0,max:36,step:.1,default:0},{kind:"number",key:"mix",label:"Mix",unit:"",min:0,max:1,step:.01,default:1,hint:"Below 1 blends the dry signal back in."}],web:"worklet-compressor"},{id:"limiter",label:"Limiter",group:"dynamics",description:"Hard ceiling \\u2014 nothing gets past the limit.",params:[{kind:"number",key:"limit",label:"Ceiling",unit:"dB",min:-24,max:0,step:.1,default:-1},{kind:"number",key:"attack",label:"Attack",unit:"ms",min:.1,max:80,step:.1,default:5},{kind:"number",key:"release",label:"Release",unit:"ms",min:1,max:8e3,step:1,default:50,scale:"log"},{kind:"number",key:"level_out",label:"Output",unit:"dB",min:-24,max:24,step:.1,default:0}],web:"worklet-limiter"},{id:"gate",label:"Noise Gate",group:"dynamics",description:"Silence the track when it drops below the threshold.",params:[{kind:"number",key:"threshold",label:"Threshold",unit:"dB",min:-80,max:0,step:.5,default:-35},{kind:"number",key:"range",label:"Range",unit:"dB",min:-80,max:0,step:.5,default:-24,hint:"How far down the gate pulls when closed."},{kind:"number",key:"ratio",label:"Ratio",unit:":1",min:1,max:20,step:.1,default:10},{kind:"number",key:"attack",label:"Attack",unit:"ms",min:.01,max:9e3,step:.1,default:1,scale:"log"},{kind:"number",key:"release",label:"Release",unit:"ms",min:.01,max:9e3,step:1,default:100,scale:"log"},{kind:"number",key:"knee",label:"Knee",unit:"",min:1,max:8,step:.01,default:2.83}],web:"worklet-gate"},{id:"saturate",label:"Saturation",group:"nonlinear",description:"Soft-clip the waveform for warmth or outright distortion.",params:[{kind:"enum",key:"type",label:"Curve",options:[{value:"tanh",label:"Tanh"},{value:"atan",label:"Arctan"},{value:"cubic",label:"Cubic"},{value:"exp",label:"Exponential"},{value:"alg",label:"Algebraic"},{value:"quintic",label:"Quintic"},{value:"sin",label:"Sine"},{value:"erf",label:"Error function"},{value:"hard",label:"Hard clip"}],default:"tanh"},{kind:"number",key:"threshold",label:"Threshold",unit:"dB",min:-40,max:0,step:.1,default:-6},{kind:"number",key:"output",automatable:!0,label:"Output",unit:"dB",min:-24,max:24,step:.1,default:0},{kind:"number",key:"oversample",label:"Oversample",unit:"x",min:1,max:8,step:1,default:4,hint:"Higher costs more but keeps aliasing down."}],web:"waveshaper"},{id:"bitcrush",label:"Bitcrush",group:"nonlinear",description:"Drop bit depth and sample rate for a lo-fi, digital sound.",params:[{kind:"number",key:"bits",label:"Bit depth",unit:"bit",min:1,max:32,step:.1,default:8},{kind:"number",key:"samples",label:"Sample hold",unit:"x",min:1,max:250,step:1,default:1,hint:"Repeats each sample N times \\u2014 a crude downsample."},{kind:"number",key:"mix",label:"Mix",unit:"",min:0,max:1,step:.01,default:1}],web:"worklet-bitcrush"},{id:"pitchshift",label:"Pitch shift",group:"time",description:"Shifts pitch up or down without changing playback speed. Adds ~50 ms of latency.",params:[{kind:"number",key:"semitones",label:"Semitones",unit:"st",min:-12,max:12,step:1,default:0},{kind:"number",key:"mix",label:"Mix",unit:"",min:0,max:1,step:.01,default:1}],web:"worklet-pitchshift"},{id:"delay",label:"Delay",group:"time",description:"Repeating echoes behind the dry signal.",params:[{kind:"number",key:"time",automatable:!0,label:"Time",unit:"ms",min:1,max:5e3,step:1,default:250,scale:"log"},{kind:"number",key:"feedback",automatable:!0,label:"Feedback",unit:"",min:.01,max:.95,step:.01,default:.35},{kind:"number",key:"mix",automatable:!0,label:"Mix",unit:"",min:0,max:1,step:.01,default:.4}],web:"delay-feedback"},{id:"chorus",label:"Chorus",group:"time",description:"Detuned copies of the signal for width and thickness.",params:[{kind:"number",key:"delay",automatable:!0,label:"Delay",unit:"ms",min:1,max:100,step:.1,default:7},{kind:"number",key:"depth",automatable:!0,label:"Depth",unit:"ms",min:0,max:10,step:.01,default:2},{kind:"number",key:"speed",automatable:!0,label:"Rate",unit:"Hz",min:.01,max:10,step:.01,default:1},{kind:"number",key:"mix",automatable:!0,label:"Mix",unit:"",min:0,max:1,step:.01,default:.5}],web:"chorus-lfo"},{id:"phaser",label:"Phaser",group:"time",description:"Sweeping notches moving through the spectrum.",params:[{kind:"number",key:"in_gain",automatable:!0,label:"Input",unit:"",min:0,max:1,step:.01,default:.4},{kind:"number",key:"out_gain",automatable:!0,label:"Output",unit:"",min:0,max:2,step:.01,default:.74},{kind:"number",key:"delay",label:"Delay",unit:"ms",min:.1,max:5,step:.1,default:3},{kind:"number",key:"decay",label:"Decay",unit:"",min:0,max:.99,step:.01,default:.4},{kind:"number",key:"speed",automatable:!0,label:"Rate",unit:"Hz",min:.1,max:2,step:.01,default:.5},{kind:"enum",key:"type",label:"Waveform",options:[{value:"0",label:"Triangular"},{value:"1",label:"Sinusoidal"}],default:"0"}],web:"allpass-phaser"},{id:"reverb",label:"Reverb",group:"time",description:"Room tail. Both ends convolve the same generated impulse, so preview matches render.",params:[{kind:"number",key:"size",label:"Room size",unit:"",min:.05,max:1,step:.01,default:.7},{kind:"number",key:"damping",label:"Damping",unit:"",min:0,max:1,step:.01,default:.5,hint:"Higher rolls the top off the tail faster."},{kind:"number",key:"wet",automatable:!0,label:"Wet",unit:"",min:0,max:1,step:.01,default:.35},{kind:"number",key:"dry",automatable:!0,label:"Dry",unit:"",min:0,max:1,step:.01,default:.7}],web:"convolver"}],co=new Map(Tl.map(e=>[e.id,e]));function Sn(e){return co.get(e)}var Nv=Tl.map(e=>e.id);function An(e,t){let n=co.get(e);if(!n)return{};let r={};for(let i of n.params){let o=t?.[i.key];if(i.kind==="enum"){let l=i.options.some(s=>s.value===o);r[i.key]=l?o:i.default;continue}let a=typeof o=="number"?o:typeof o=="string"&&o.trim()!==""?Number(o):Number.NaN;r[i.key]=Number.isFinite(a)?Math.min(i.max,Math.max(i.min,a)):i.default}return r}var ct=class extends Error{constructor(t){super(t),this.name="AudioFxChainError"}};function Rl(e){let t;try{t=JSON.parse(e)}catch(i){throw new ct(`Chain file is not valid JSON: ${i.message}`)}if(typeof t!="object"||t===null)throw new ct("Chain file must be a JSON object.");let n=t;if(n.version!==wl)throw new ct(`Unsupported chain version: ${String(n.version)}`);if(!Array.isArray(n.nodes))throw new ct("Chain file is missing a `nodes` array.");let r=n.nodes.map(Rp);return{version:wl,nodes:r}}function En(e){return e.nodes.filter(t=>t.enabled!==!1)}function Rp(e,t){if(typeof e!="object"||e===null)throw new ct(`Node ${t} is not an object.`);let n=e;if(typeof n.type!="string"||!co.has(n.type))throw new ct(`Node ${t} has unknown effect type: ${String(n.type)}`);return Mp({type:n.type,id:Dr(n.id),fromCarve:_l(n.fromCarve),fromPreset:Dr(n.fromPreset),label:Dr(n.label),fromEq:Dr(n.fromEq),fromLeveller:_l(n.fromLeveller),presetAmount:kp(n.presetAmount),enabled:n.enabled!==!1,params:An(n.type,n.params??void 0)})}function Dr(e){return typeof e=="string"&&e?e:void 0}function _l(e){return e===!0?!0:void 0}function kp(e){if(!(typeof e!="number"||!Number.isFinite(e)))return Math.min(1,Math.max(0,e))}function Mp(e){for(let t of Object.keys(e))e[t]===void 0&&delete e[t];return e}var et="data-automation",Pv=et.slice(5),Ir=1,Fp=512,Ze=class extends Error{constructor(t){super(t),this.name="AudioAutomationError"}},Bt="volume";function Cn(e){if(e===Bt)return{kind:"volume"};let t=e.split(".");if(t.length===3&&t[0]==="fx"&&t[1]===Np){let i=t[2];return i?{kind:"preset",presetId:i}:null}if(t.length!==3||t[0]!=="fx")return null;let[,n,r]=t;return!n||!r?null:{kind:"fx",nodeId:n,param:r}}var Np="preset";var Lp={min:0,max:1,step:.01,unit:"",label:"Amount",scale:"linear",default:1},Pr={min:0,max:so,step:.01,unit:"",label:"Volume",scale:"linear",default:1};function fo(e,t){let n=Cn(e);if(!n)return null;if(n.kind==="volume")return Pr;if(n.kind==="preset")return t?.nodes.some(l=>l.fromPreset===n.presetId)?{...Lp,label:`${n.presetId} \\xB7 Amount`}:null;let r=t?.nodes.find(a=>a.id===n.nodeId);if(!r)return null;let i=Sn(r.type),o=i?.params.find(a=>a.key===n.param);return!o||o.kind!=="number"?null:{min:o.min,max:o.max,step:o.step,unit:o.unit,label:`${i?.label??r.type} \\xB7 ${o.label}`,scale:o.scale==="log"&&o.min>0?"log":"linear",default:o.default}}function wn(e){if(typeof e=="number")return Number.isFinite(e)?e:null;if(typeof e=="string"&&e.trim()!==""){let t=Number(e);return Number.isFinite(t)?t:null}return null}function Dp(e){let t=wn(e);return t===null||t===0?0:Math.min(1,Math.max(-1,t))}function kl(e,t){let n=wn(e),r=wn(t);if(n===null||r===null)return null;let i=l=>Math.min(.999,Math.max(.001,l)),o=i(n),a=i(r);return Math.abs(o-a)<1e-6?null:{x:o,y:a}}function Ip(e){let t=Dp(e?.curve),n=kl(e?.viaX,e?.viaY);return{...t?{curve:t}:{},...n?{viaX:n.x,viaY:n.y}:{}}}function Pp(e,t){let n=wn(e?.t),r=wn(e?.v);if(n===null||r===null)return null;let i=t?Math.min(t.max,Math.max(t.min,r)):r;return{t:Math.max(0,n),v:i,...Ip(e)}}function Ml(e,t){let n=e.map(i=>Pp(i,t)).filter(i=>i!==null).sort((i,o)=>i.t-o.t),r=[];for(let i of n)r.length>0&&r[r.length-1].t===i.t?r[r.length-1]=i:r.push(i);return r.slice(0,Fp)}function Op(e){let t=[];for(let n of e.lanes){if(!Cn(n.target))continue;let r=n.target===Bt?Pr:null,i=Ml(n.points??[],r);i.length>0&&t.push({target:n.target,points:i})}return{version:Ir,lanes:t}}function Fl(e,t){let n=[];for(let r of e.lanes){let i=fo(r.target,t);if(!i)continue;let o=Ml(r.points,i);o.length>0&&n.push({target:r.target,points:o})}return{version:Ir,lanes:n}}function Or(e){let t;try{t=JSON.parse(e)}catch(i){throw new Ze(`Automation is not valid JSON: ${i.message}`)}if(typeof t!="object"||t===null)throw new Ze("Automation must be a JSON object.");let n=t;if(n.version!==Ir)throw new Ze(`Unsupported automation version: ${String(n.version)}`);if(!Array.isArray(n.lanes))throw new Ze("Automation is missing a `lanes` array.");let r=n.lanes.map((i,o)=>{if(typeof i!="object"||i===null)throw new Ze(`Lane ${o} is not an object.`);let a=i;if(typeof a.target!="string"||!Cn(a.target))throw new Ze(`Lane ${o} has an unreadable target: ${String(a.target)}`);if(!Array.isArray(a.points))throw new Ze(`Lane ${o} is missing a \\`points\\` array.`);return{target:a.target,points:a.points}});return Op({version:Ir,lanes:r})}function Hp(e,t){return t?Math.pow(e,Math.pow(2,2*t)):e}function Gp(e,t){let n=e-.5,r=t-.5,i=.999,o=1e6,a=n>0?n/(i-e):n<0?-n/(e-(1-i)):0,l=r>0?r/(i-t):r<0?-r/(t-(1-i)):0,s=Math.min(o,Math.max(1,a,l));return{cx:e+n/s,cy:t+r/s,w:s}}function Bp(e,t,n){let{cx:r,cy:i,w:o}=Gp(t,n),a=2-2*o,l=e*a-1+2*o*r,s=-e*a-2*o*r,u=Up(l,s,e),c=1-u,f=c*c+2*o*u*c+u*u;return f>0?(2*o*i*u*c+u*u)/f:e}function Up(e,t,n){if(Math.abs(e)<1e-12)return Math.abs(t)<1e-12?n:-n/t;let r=Math.sqrt(Math.max(0,t*t-4*e*n)),i=(-t+r)/(2*e),o=(-t-r)/(2*e),a=l=>l>=-1e-9&&l<=1+1e-9;return a(i)?Math.min(1,Math.max(0,i)):a(o)?Math.min(1,Math.max(0,o)):n}function Wp(e,t){let n=kl(t.viaX,t.viaY);return n?Bp(Math.min(1,Math.max(0,e)),n.x,n.y):Hp(e,t.curve)}function Vp(e,t,n,r){return r==="log"&&e>0&&t>0?Math.exp(Math.log(e)+(Math.log(t)-Math.log(e))*n):e+(t-e)*n}function _n(e,t,n="linear"){let r=e.points;if(r.length===0)return 0;let i=r[0];if(t<=i.t)return i.v;let o=r[r.length-1];if(t>=o.t)return o.v;let a=0,l=r.length-1;for(;l-a>1;){let f=a+l>>1;r[f].t<=t?a=f:l=f}let s=r[a],u=r[l],c=u.t-s.t;return c<=0?u.v:Vp(s.v,u.v,Wp((t-s.t)/c,s),n)}function Nl(e){return e.points.length<=1||e.points.every(t=>t.v===e.points[0].v)}function Ll(e,t,n,r,i="linear"){let o=Math.max(2,Math.floor(r)),a=new Float32Array(o),l=n-t;for(let s=0;sr.target===Bt)??null}catch{n=null}return Hr.size>zp&&Hr.clear(),Hr.set(e,n),n}function Dl(e,t){let n=(typeof e.getAttribute=="function"?e.getAttribute(et):null)??"";if(!n)return null;let r=qp(n);return!r||r.points.length===0?null:_n(r,t)}var Ut="hf-audio-group",Gr="data-audio-group";function mo(e){let t=e?.getAttribute("data-volume"),n=t?parseFloat(t):1;return Number.isFinite(n)?n:1}function po(e,t){let n=Array.from(e?.querySelectorAll?.(`${Ut}[${xn}]`)??[]).find(i=>i.getAttribute(xn)===t);if(n)return n;let r=e?.getElementById(t)??null;return r&&r.tagName?.toLowerCase()===Ut?r:null}function Br(e,t){let n=t?.getAttribute?.(dl)??t?.getAttribute?.(Gr);return n?po(e,n)?.hasAttribute("data-hidden")??!1:!1}function Il(e){return typeof e.tagName!="string"||e.tagName.toLowerCase()!=="audio"||typeof e.getAttribute!="function"?null:e.getAttribute(Gr)||null}function Pl(e){let t="__hf-audio-group-inert";if(!e?.head||e.getElementById(t))return;let n=e.createElement("style");n.id=t,n.textContent=`${Ut}{display:none!important}`,e.head.appendChild(n)}function $e(e){return yn(e)}function Ol(e){let t=e.isVideo?e.explicitDuration??e.sourceDuration:e.sourceDuration,n=(e.isVideo?[t,e.hostRemaining]:[t,e.hostRemaining,e.explicitDuration]).filter(r=>r!=null&&Number.isFinite(r)&&r>=0);return n.length>0?Math.min(...n):null}function Hl(e){let t=Array.from(document.querySelectorAll("video, audio")),n=e?.shouldIncludeElement?t.filter(a=>e.shouldIncludeElement?.(a)):t.filter(a=>a.hasAttribute("data-start")),r=[],i=[],o=0;for(let a of n){let l=e?.resolveStartSeconds?e.resolveStartSeconds(a):Number.parseFloat(a.dataset.start??"0");if(!Number.isFinite(l))continue;let s=$e(a),u=_e(a),c=a.loop,f=Number.isFinite(a.duration)&&a.duration>0?a.duration:null,m=e?.resolveDurationSeconds?.(a)??Number.parseFloat(a.dataset.duration??"");(!Number.isFinite(m)||m<0)&&f!=null&&(m=Math.max(0,(f-s)/u));let p=Number.isFinite(m)&&m>=0,b=p?l+m:Number.POSITIVE_INFINITY,v=Number.parseFloat(a.dataset.volume??""),x={el:a,start:l,mediaStart:s,duration:p?m:Number.POSITIVE_INFINITY,end:b,volume:Number.isFinite(v)?v:null,playbackRate:u,loop:c,sourceDuration:f};r.push(x),a.tagName==="VIDEO"&&i.push(x),Number.isFinite(b)&&(o=Math.max(o,b))}return{timedMediaEls:n,mediaClips:r,videoClips:i,maxMediaEnd:o}}var go=new WeakMap,Ur=new WeakMap,Tn=new WeakMap,bo=new WeakSet,Wt=new WeakSet;function $p(e){if(Wt.has(e))return;Wt.add(e);let t=()=>Wt.delete(e);e.addEventListener("playing",t,{once:!0}),e.addEventListener("pause",t,{once:!0}),e.addEventListener("error",t,{once:!0})}var jp=3;function Kp(e){return e.error!=null||e.networkState===jp}var xo=new WeakMap;function ho(e){return Number.isFinite(e)?Math.max(0,Math.min(1,e)):1}function yo(e){go.delete(e),Ur.delete(e),Tn.delete(e),bo.delete(e),xo.delete(e)}function Gl(e){let t=!!(e.outputMuted||e.userMuted);for(let n of e.clips){let{el:r}=n;if(!r.isConnected)continue;let i=(e.timeSeconds-n.start)*n.playbackRate+n.mediaStart,o=r.tagName==="VIDEO"&&!n.loop,a=o&&n.sourceDuration!=null&&i>=n.sourceDuration&&e.timeSeconds>=n.start&&e.timeSeconds=n.mediaStart&&i=n.start&&e.timeSeconds=0&&(!r.ended||n.loop||a||u)){if(Ur.set(r,i),n.loop&&n.sourceDuration!=null&&n.sourceDuration>0){let H=n.sourceDuration-n.mediaStart;H>0&&i>=n.sourceDuration&&(i=n.mediaStart+(i-n.mediaStart)%H)}let m=ho(e.userVolume??1),p=Le(n.volume??1),b=xo.get(r),v=ho(r.volume),x,_=Dl(r,e.timeSeconds-n.start);if(_!==null)x=Le(_);else if(n.volumeKeyframes&&n.volumeKeyframes.length>0){let H=e.timeSeconds-n.start;x=Le(Sl(n.volumeKeyframes,H))}else e.isWebAudioRouted?.(r)?x=p:b===void 0?x=p>1?p:v:Math.abs(v-b)>1e-4?x=v:x=p;let T=r.closest("[data-hidden]")!==null||Br(r.ownerDocument,r)?0:ho(x*m);r.volume=T,xo.set(r,T),e.onElementVolume?.(r,T,x),(t||e.isWebAudioOwned?.(r))&&(r.muted=!0),r.preload!=="auto"&&(r.preload="auto");try{r.playbackRate=n.playbackRate*e.playbackRate}catch(H){L("runtime.media.site1",H)}let M=.04,D=2,E=r.currentTime||0,S=Math.abs(E-i),A=i-E,C=go.get(r);go.set(r,A);let F=C===void 0,I=!F&&Math.abs(A-C)>.5,q=S>3,W=r.tagName==="AUDIO"&&F&&E-i>M,Y=a&&S>.001||r.ended&&u&&S>.001||W||S>.5&&(F||I||q),k=r.tagName==="VIDEO"&&!r.paused,U=C!==void 0&&Math.abs(A-C)<.004,ie=!1;if(!k&&!Y&&!F&&U&&S>M){let H=(Tn.get(r)??0)+1;Tn.set(r,H),H>=D&&(ie=!0,Tn.set(r,0))}else S<=M&&Tn.set(r,0);let P=!k&&e.forceSync&&S>.02;if(Y||ie||P){if(!(r.tagName==="VIDEO"&&!!ut(r))){try{r.currentTime=i}catch(V){L("runtime.media.site2",V)}if(Math.abs(r.currentTime-i)>.5&&!bo.has(r)){bo.add(r),r.load();try{r.currentTime=i}catch(V){L("runtime.media.site3",V)}}}Wt.delete(r)}a?r.paused||r.pause():e.playing&&r.paused&&!Wt.has(r)&&!Kp(r)?($p(r),r.play().catch(H=>{Wt.delete(r),(H&&typeof H=="object"&&"name"in H?String(H.name??""):"")==="NotAllowedError"&&e.onAutoplayBlocked?.()})):!e.playing&&!r.paused&&r.pause();continue}let f=e.timeSeconds>=n.start&&e.timeSecondsn.length)&&(n=r);return n?t[n]??null:null}function Jp(e,t){let n=e.normalize("NFC").toLowerCase(),r=-1,i=null,o=!1;for(let[a,l]of Object.entries(t)){let s=a.normalize("NFC").toLowerCase();n.endsWith(s)&&(s.length>r?(r=s.length,i=l,o=!1):s.length===r&&(o=!0))}return o?null:i}function Ao(e,t){return t[e]??Xp(e,t)??Jp(e,t)}function Qp(e,t){let n=new URL(e,document.baseURI);return n.searchParams.set(Yp,t?t.hasAlpha?"vp8":"h264":"auto"),n.href}var Zp={cross_origin:"video reports zero decodable width but its source is cross-origin; no local proxy can be served for it",proxy_playback_failed:"the authoring proxy itself failed to decode; render output is unaffected",browser_safe_codec:"the file errored but its codec is browser-decodable; a proxy cannot help (the file itself is likely corrupt)",invalid_source_url:"the media source URL is malformed and cannot be proxied"};function Rt(e,t,n){if(Wl.has(e))return;Wl.add(e);let r=Zp[t];be({source:"hf-preview",type:"diagnostic",code:Ul,details:{asset:n,codecName:null,reason:t,note:r}}),console.info(`[hyperframes] ${Ul}: "${n}" (${t}): ${r}`)}function Eo(e,t=null,n="reactive"){if(Rn.has(e))return;let r=Wr(e),i;try{i=Qp(r,t)}catch(l){L("runtime.mediaProxy.swap",l),Rt(e,"invalid_source_url",r);return}Rn.add(e),yo(e),e.src=i,e.load();let o=t?.codecName??null;be({source:"hf-preview",type:"diagnostic",code:Bl,details:{asset:r,codecName:o,trigger:n,note:"render output is unaffected; only this preview element was swapped to an authoring proxy"}}),console.info(`[hyperframes] ${Bl}: "${r}" uses a codec (${o??"unknown"}) this browser can\'t decode; auto-swapped to an authoring proxy for this preview only. Render output is unaffected.`)}function Vl(e){if(vo(e)||!(e instanceof HTMLVideoElement)||Rn.has(e))return;let t=window.__HF_MEDIA_CODEC_MAP__;if(!t)return;let n=So(e);if(n===null)return;let r=Ao(n,t);if(!r||!r.browserHostile)return;let i=r.representativeMime?e.canPlayType(r.representativeMime):"";i==="probably"||i==="maybe"||Eo(e,r,"proactive")}function zl(e){if(vo(e)||!(e instanceof HTMLVideoElement)||e.videoWidth!==0)return;let t=Wr(e);if(Rn.has(e)){Rt(e,"proxy_playback_failed",t);return}let n=window.__HF_MEDIA_CODEC_MAP__;if(!n)return;let r=So(e);if(r===null){Rt(e,"cross_origin",t);return}let i=Ao(r,n);if(i&&!i.browserHostile){Rt(e,"browser_safe_codec",t);return}Eo(e,i,"reactive")}function ql(e){if(vo(e)||!(e instanceof HTMLVideoElement))return;let t=Wr(e);if(Rn.has(e)){Rt(e,"proxy_playback_failed",t);return}let n=window.__HF_MEDIA_CODEC_MAP__;if(!n)return;let r=So(e);if(r===null){Rt(e,"cross_origin",t);return}let i=Ao(r,n);if(i&&!i.browserHostile){Rt(e,"browser_safe_codec",t);return}Eo(e,i,"tertiary")}var Se=class extends Error{constructor(n,r=null){super(r==null?n:`${n} at line ${r}`);ge(this,"lineNumber");this.name="CubeLutParseError",this.lineNumber=r}},eh=[0,0,0],th=[1,1,1],Vr=64;function nh(e){let t=!1;for(let n=0;nn)throw new Se(`LUT_3D_SIZE ${l} exceeds max ${n}`,m);continue}if(!oh(v)){if(v.startsWith("LUT_"))throw new Se(`Unsupported cube keyword ${v}`,m);continue}if(!l)throw a?new Se("1D cube LUTs are not supported yet",m):new Se("LUT data appears before LUT_3D_SIZE",m);if(b.length!==3)throw new Se("LUT data rows must contain three numbers",m);s.push(dt(b[0],m),dt(b[1],m),dt(b[2],m))}if(a&&l)throw new Se("Mixed 1D and 3D cube LUTs are not supported yet");if(!l)throw a?new Se("1D cube LUTs are not supported yet"):new Se("Missing LUT_3D_SIZE");rh(i,o);let c=l*l*l;if(s.length!==c*3)throw new Se(`Expected ${c} LUT rows for size ${l}, found ${s.length/3}`);return{title:r,size:l,domainMin:i,domainMax:o,data:new Float32Array(s)}}function ah(e){return Number.isFinite(e)?Math.min(1,Math.max(0,e)):0}function kn(e){return Math.round(ah(e)*255)}function wo(e){let t=e.size,n=t*t,r=t,i=new Uint8Array(n*r*4);for(let o=0;o3*Math.abs(n)?3*n:i}function Ae(e,t){let n=e[t];if(n===void 0)throw new RangeError("Color curve points must be contiguous");return n}function sh(e){let t=[],n=[],r=Ae(e,0);for(let a of e.slice(1)){let l=a[0]-r[0];t.push(l),n.push((a[1]-r[1])/l),r=a}let i=Ae(n,0);if(e.length===2)return[i,i];let o=new Array(e.length);o[0]=nu(Ae(t,0),Ae(t,1),i,Ae(n,1)),o[o.length-1]=nu(Ae(t,t.length-1),Ae(t,t.length-2),Ae(n,n.length-1),Ae(n,n.length-2));for(let a=1;a=n)throw new RangeError("Curve output bounds must be finite and increasing");if(e.some(([,r])=>rn))throw new RangeError(`Curve outputs must be between ${t} and ${n}`)}function uh(e,t,n,r,i){let o=n[0]-t[0],a=Math.min(1,Math.max(0,(e-t[0])/o)),l=a*a,s=l*a;return(2*s-3*l+1)*t[1]+(s-2*l+a)*o*r+(-2*s+3*l)*n[1]+(s-l)*o*i}function iu(e,t,n,r,i){lh(e,r,i);let o=sh(e),a=new Float32Array(t),l=0;for(let s=0;sAe(e,l+1)[0];)l+=1;let c=Ae(e,l),f=Ae(e,l+1),m=uh(u,c,f,Ae(o,l),Ae(o,l+1));a[s]=Math.min(i,Math.max(r,m))}return a}function Vt(e,t=je){if(ru(e,t),e.length>Mn)throw new RangeError(`A color curve supports at most ${Mn} points`);if(e.some(([n])=>n<0||n>1))throw new RangeError("Color curve inputs must be between 0 and 1");if(e[0]?.[0]!==0||e[e.length-1]?.[0]!==1)throw new RangeError("Color curves must include input endpoints 0 and 1");return iu(e,t,n=>n/(t-1),0,1)}function _o(e,t,n,r=je){if(e.length<3)throw new RangeError("A hue curve requires at least three points");if(e.length>Mn)throw new RangeError(`A hue curve supports at most ${Mn} points`);let i=[...e].sort((s,u)=>s[0]-u[0]);for(let s=0;s=360)throw new RangeError("Hue curve inputs must be from 0 up to 360 degrees");if(s>0&&u[0]===i[s-1]?.[0])throw new RangeError("Hue curve inputs must be unique")}let o=i.slice(-2).map(([s,u])=>[s-360,u]),a=i.slice(0,2).map(([s,u])=>[s+360,u]),l=[...o,...i,...a];return ru(l,r),iu(l,r,s=>s/r*360,t,n)}var Fn="data-color-grading",Nn="data-hf-color-grading-source-hidden",$r="data-hf-authored-opacity",uu="__hf_color_grading_",dh=Yl,ko={exposure:0,contrast:0,highlights:0,shadows:0,whites:0,blacks:0,temperature:0,tint:0,vibrance:0,saturation:0},Mo={vignette:0,vignetteMidpoint:.5,vignetteRoundness:0,vignetteFeather:.65,grain:0,grainSize:.25,grainRoughness:.5},Fo={blur:0,pixelate:0,chromaBleed:0,tapeDamage:0,tapeTracking:0,tapeNoise:1,tapeSpeed:.5,filmArtifacts:0,halftone:0,halftoneSize:0,twoInkPrint:0,twoInkPrintSize:0,ascii:0,asciiSize:5/76,asciiInvert:0,asciiStyle:0,asciiColor:1,asciiRotation:0,dither:0,ditherSize:0,bloom:0,bloomRadius:8,monoScreen:0,monoScreenSize:0,monoScreenAngle:0,monoScreenSpread:0,monoScreenShape:0,monoScreenInvert:0,scanlines:0,scanlineCount:0,scanlineSoftness:0,chromaticAberration:0,chromaticAngle:0,crtCurvature:0,digitalGlitch:0,digitalGlitchColorSplit:0,digitalGlitchLineTear:0,digitalGlitchPixelate:0,digitalGlitchBlockAmount:0,digitalGlitchBlockDisplacement:0,digitalGlitchBlockOpacity:0,digitalGlitchSpeed:0,engraving:0,engravingSpacing:7/17,engravingMinThickness:.2,engravingMaxThickness:3.2/7,engravingAngle:.25,engravingContrast:7/15,engravingSharpness:.59,engravingWave:.2,engravingWaveFrequency:2/9,crosshatch:0,crosshatchSpacing:7/25,crosshatchThickness:.25,crosshatchAngle:.25,crosshatchContrast:1/3,crosshatchEdges:.5,crosshatchLineWeight:0,crosshatchWave:.33,crosshatchWaveFrequency:2/9,kuwahara:0,kuwaharaRadius:1/7,kuwaharaSharpness:5/16,kuwaharaSaturation:.5};var jr=Xl,cu=Jl,du=Ql,fu=Zl,Lo=eu,Do=tu,ou={exposure:.03,contrast:-.12,highlights:-.1,shadows:.16,whites:-.04,blacks:.08,temperature:.13,vibrance:-.08,saturation:-.08},au={vignette:.18};function Ee(e,t,n={},r={},i={},o=1){return{id:e,label:t,intensity:o,adjust:{...ko,...n},details:{...Mo,...r},effects:{...Fo,...i}}}var Io=[Ee("neutral","Neutral"),Ee("warm-daylight","Warm Daylight",{exposure:.06,contrast:.07,highlights:-.06,shadows:.08,temperature:.18,saturation:.08}),Ee("clean-studio","Clean Studio",{contrast:.08,highlights:-.08,shadows:.06,temperature:-.08,tint:.03,saturation:.04}),Ee("skin-soft","Skin Soft",{exposure:.04,contrast:-.03,highlights:-.12,shadows:.12,temperature:.08,tint:.02,saturation:.04}),Ee("food-pop","Food Pop",{exposure:.06,contrast:.1,shadows:.06,temperature:.14,vibrance:.1,saturation:.18}),Ee("night-lift","Night Lift",{exposure:.08,contrast:.08,highlights:-.18,shadows:.2,blacks:-.08,saturation:.04},{vignette:.12}),Ee("muted-editorial","Muted Editorial",{exposure:-.02,contrast:.08,highlights:-.08,shadows:.06,blacks:-.05,temperature:-.03,saturation:-.12},{vignette:.1}),Ee("vintage-wash","Vintage Wash",ou,au),Ee("mono-clean","Mono Clean",{contrast:.12,highlights:-.04,shadows:.04,blacks:-.08,saturation:-1}),Ee("mono-fade","Mono Fade",{contrast:-.04,highlights:-.06,shadows:.1,blacks:.12,saturation:-1},{vignette:.08}),Ee("soft-boost","Soft Boost",{exposure:.06,contrast:-.04,highlights:-.14,shadows:.16,vibrance:.08,saturation:.1}),Ee("bright-pop","Bright Pop",{exposure:.12,contrast:.12,whites:.08,blacks:-.04,vibrance:.08,saturation:.14}),Ee("deep-contrast","Deep Contrast",{exposure:-.03,contrast:.2,highlights:-.08,shadows:-.08,blacks:-.12,saturation:.06}),Ee("creator-camcorder","Creator Camcorder",{contrast:.08,highlights:-.05,shadows:.02,whites:.03,blacks:-.04,temperature:-.03,tint:-.015,vibrance:-.03,saturation:-.06},{vignette:.06,grain:.08,grainSize:.18,grainRoughness:.58},{chromaBleed:.55},.72),Ee("vhs-playback","VHS Playback",{contrast:-.04,saturation:-.08},{grain:.16,grainSize:.12,grainRoughness:.72},{tapeDamage:.82,tapeTracking:.85,tapeNoise:.3,tapeSpeed:.5,chromaBleed:.5,chromaticAberration:.18,scanlines:.35,scanlineCount:.17,scanlineSoftness:1,digitalGlitch:.32,digitalGlitchLineTear:.08,digitalGlitchSpeed:.5}),Ee("home-movie-8mm","8mm Home Movie",ou,{...au,vignette:.28,vignetteMidpoint:.54,vignetteFeather:.72,grain:.34,grainSize:.18,grainRoughness:.72},{filmArtifacts:.62},.72),Ee("editorial-halftone","Editorial Halftone",{contrast:.04,saturation:.04},{},{halftone:.94,halftoneSize:.36}),Ee("two-ink-print","Two-Ink Print",{contrast:.08,highlights:-.06,shadows:.04},{},{twoInkPrint:1,twoInkPrintSize:.42})],fh=new Map(Io.map(e=>[e.id,e])),mh=/^\\$(?:\\{([A-Za-z0-9_.:-]+)\\}|([A-Za-z0-9_.:-]+))$/,ph={exposure:{min:-2,max:2},contrast:{min:-1,max:1},highlights:{min:-1,max:1},shadows:{min:-1,max:1},whites:{min:-1,max:1},blacks:{min:-1,max:1},temperature:{min:-1,max:1},tint:{min:-1,max:1},vibrance:{min:-1,max:1},saturation:{min:-1,max:1}},zt={hue:0,amount:0,level:0},su={amount:me.unit,level:me.signedUnit},ft=[[0,0],[1,1]],qt=[],hh={hueVsHue:me.secondaryHueShift,hueVsSaturation:me.signedUnit,hueVsLuma:me.signedUnit},To={center:0,range:180,softness:0},Ro={min:0,max:1,softness:.05},gh={vignette:me.unit,vignetteMidpoint:me.unit,vignetteRoundness:me.signedUnit,vignetteFeather:me.unit,grain:me.unit,grainSize:me.unit,grainRoughness:me.unit},No=me.unit,bh=me.effects,mu=["blur","pixelate","chromaBleed","tapeDamage","filmArtifacts","halftone","twoInkPrint","ascii","dither","bloom","monoScreen","scanlines","chromaticAberration","crtCurvature","digitalGlitch","engraving","crosshatch","kuwahara"];var xh=Io.filter(e=>mu.some(t=>e.effects[t]>1e-4)),gS=Io.filter(e=>!xh.includes(e)),bS={blur:{blur:.45},pixelate:{pixelate:.55},bloom:{bloom:.55,bloomRadius:8},chromaBleed:{chromaBleed:.55},tapeDamage:{tapeDamage:.65,tapeTracking:.55,tapeNoise:.25,tapeSpeed:.5},filmArtifacts:{filmArtifacts:.55},scanlines:{scanlines:.35,scanlineCount:.17,scanlineSoftness:1},chromaticAberration:{chromaticAberration:.15,chromaticAngle:0},crtCurvature:{crtCurvature:.2},digitalGlitch:{digitalGlitch:.55,digitalGlitchColorSplit:.25,digitalGlitchLineTear:.25,digitalGlitchPixelate:.15,digitalGlitchBlockAmount:.5,digitalGlitchBlockDisplacement:.25,digitalGlitchBlockOpacity:0,digitalGlitchSpeed:.5},halftone:{halftone:.94,halftoneSize:.36},twoInkPrint:{twoInkPrint:1,twoInkPrintSize:.42},ascii:{ascii:1,asciiSize:5/76,asciiInvert:0,asciiStyle:0,asciiColor:1,asciiRotation:0},dither:{dither:1,ditherSize:.5},monoScreen:{monoScreen:1,monoScreenSize:.35,monoScreenAngle:.25,monoScreenSpread:.3,monoScreenShape:0,monoScreenInvert:0},engraving:{engraving:1,engravingSpacing:7/17,engravingMinThickness:.2,engravingMaxThickness:3.2/7,engravingAngle:.25,engravingContrast:7/15,engravingSharpness:.59,engravingWave:.2,engravingWaveFrequency:2/9},crosshatch:{crosshatch:1,crosshatchSpacing:7/25,crosshatchThickness:.25,crosshatchAngle:.25,crosshatchContrast:1/3,crosshatchEdges:.5,crosshatchLineWeight:0,crosshatchWave:.33,crosshatchWaveFrequency:2/9},kuwahara:{kuwahara:1,kuwaharaRadius:1/7,kuwaharaSharpness:5/16,kuwaharaSaturation:.5}},pu=[{path:"intensity",name:"--hf-color-grading-intensity",min:0,max:1},{path:"lut.intensity",name:"--hf-color-grading-lut-intensity",min:0,max:1},{path:"adjust.exposure",name:"--hf-color-grading-exposure",min:-2,max:2},{path:"effects.blur",name:"--hf-color-grading-blur",min:0,max:1},{path:"effects.bloom",name:"--hf-color-grading-bloom",min:0,max:3},{path:"effects.kuwahara",name:"--hf-color-grading-kuwahara",min:0,max:1},{path:"effects.pixelate",name:"--hf-color-grading-pixelate",min:0,max:1},{path:"effects.ascii",name:"--hf-color-grading-ascii",min:0,max:1},{path:"effects.dither",name:"--hf-color-grading-dither",min:0,max:1}];var yh=/^#[0-9a-f]{6}$/i;function vh(e){return!Array.isArray(e)||e.length<2||e.length>6||!e.every(t=>typeof t=="string"&&yh.test(t))?null:e.map(t=>t.toLowerCase())}function Te(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function qr(e,t,n){return Number.isFinite(e)?Math.min(n,Math.max(t,e)):0}function hu(e,t){let n=typeof e=="number"?e:Number(e);return Number.isFinite(n)?Math.min(1,Math.max(0,n)):t}function Re(e,t){let n=typeof e=="number"?e:Number(e);return Number.isFinite(n)?qr(n,t.min,t.max):0}function Po(e,t=0){let n=typeof e=="number"?e:Number(e);return Number.isFinite(n)?(n%360+360)%360:t}function Sh(e){let t=Te(e)?e:{};return cu.reduce((n,r)=>{let i=Te(t[r])?t[r]:{};return n[r]={hue:Po(i.hue,zt.hue),amount:Re(i.amount??zt.amount,su.amount),level:Re(i.level??zt.level,su.level)},n},{shadows:{...zt},midtones:{...zt},highlights:{...zt}})}function Ah(e){if(!Array.isArray(e)||e.length!==2)return null;let t=Number(e[0]),n=Number(e[1]);return Number.isFinite(t)&&Number.isFinite(n)?[qr(t,0,1),qr(n,0,1)]:null}function gu(e){return e.some((t,n)=>n>0&&t[0]===e[n-1]?.[0])}function Eh(e){(e[0]?.[0]??0)>0&&e.unshift([0,0]),(e.at(-1)?.[0]??1)<1&&e.push([1,1])}function wh(e){if(!Array.isArray(e)||e.length<2)return ft;let t=[];for(let n of e){let r=Ah(n);if(!r)return ft;t.push(r)}return t.sort((n,r)=>n[0]-r[0]),gu(t)||(Eh(t),t.length>16)?ft:t}function Ch(e){let t=Te(e)?e:{};return du.reduce((n,r)=>(n[r]=wh(t[r]),n),{master:ft,red:ft,green:ft,blue:ft})}function _h(e,t){if(!Array.isArray(e)||e.length!==2)return null;let n=Number(e[0]),r=Number(e[1]);return Number.isFinite(n)&&Number.isFinite(r)?[Po(n),qr(r,t.min,t.max)]:null}function Th(e,t){if(!Array.isArray(e)||e.length<3||e.length>16)return qt;let n=[];for(let r of e){let i=_h(r,t);if(!i)return qt;n.push(i)}return n.sort((r,i)=>r[0]-i[0]),gu(n)?qt:n}function Rh(e){let t=Te(e)?e:{};return fu.reduce((n,r)=>(n[r]=Th(t[r],hh[r]),n),{hueVsHue:qt,hueVsSaturation:qt,hueVsLuma:qt})}function lu(e){let t=Te(e)?e:{},n=Re(t.min??Ro.min,No),r=Re(t.max??Ro.max,No);return{min:Math.min(n,r),max:Math.max(n,r),softness:Re(t.softness??Ro.softness,me.secondarySoftRangeSoftness)}}function kh(e){let t=Te(e)?e:{},n=Re(t.range??To.range,me.secondaryHueRange);return{center:Po(t.center,To.center),range:n,softness:Re(t.softness??To.softness,{min:me.secondaryHueSoftness.min,max:me.secondaryHueCombinedMax-n})}}function Mh(e){return{hueShift:Re(e.hueShift??0,me.secondaryHueShift),saturation:Re(e.saturation??0,me.signedUnit),luma:Re(e.luma??0,me.signedUnit),temperature:Re(e.temperature??0,me.signedUnit),tint:Re(e.tint??0,me.signedUnit)}}function Fh(e){return!Te(e)||!Te(e.key)||!Te(e.correction)?null:{enabled:e.enabled!==!1,key:{hue:kh(e.key.hue),saturation:lu(e.key.saturation),luma:lu(e.key.luma)},correction:Mh(e.correction)}}function Nh(e){if(!Array.isArray(e))return[];let t=[];for(let n of e.slice(0,4)){let r=Fh(n);r&&t.push(r)}return t}function Lh(e){if(e==null)return null;let t=String(e).trim();return t||null}function Dh(e){if(e==null)return null;if(typeof e=="string"){let n=e.trim();return n?{src:n,intensity:1}:null}if(!Te(e))return null;let t=e.src;return typeof t!="string"||t.trim()===""?null:{src:t.trim(),intensity:hu(e.intensity,1)}}function Ih(e){if(typeof e=="string"){let t=e.trim();if(!t)return null;if(t.startsWith("{"))try{let n=JSON.parse(t);return Te(n)?n:null}catch{return null}return{preset:t}}return Te(e)?e:null}function Ph(e,t){let n=e.trim().match(mh);if(!n)return e;let r=n[1]??n[2]??"";return r&&Object.hasOwn(t,r)?t[r]:e}function zr(e,t){if(typeof e=="string"){let r=Ph(e,t);if(r!==e)return r;let i=e.trim();if(!i.startsWith("{"))return e;try{return zr(JSON.parse(i),t)}catch{return e}}if(Array.isArray(e))return e.map(r=>zr(r,t));if(!Te(e))return e;let n={};for(let[r,i]of Object.entries(e))n[r]=zr(i,t);return n}function Oh(e){return e?fh.get(e)??null:null}function Kr(e){let t=Ih(e);if(!t||t.enabled===!1)return null;let n=Lh(t.preset),r=Oh(n),i=r?.adjust??ko,o=r?.details??Mo,a=r?.effects??Fo,l=Te(t.adjust)?t.adjust:{},s=Te(t.details)?t.details:{},u=Te(t.effects)?t.effects:{},c=jr.reduce((p,b)=>(p[b]=Re(l[b]??i[b],ph[b]),p),{...ko}),f=Lo.reduce((p,b)=>(p[b]=Re(s[b]??o[b],gh[b]),p),{...Mo}),m=Do.reduce((p,b)=>(p[b]=Re(u[b]??a[b],bh[b]??No),p),{...Fo});return{enabled:!0,preset:n,intensity:hu(t.intensity,r?.intensity??1),adjust:c,wheels:Sh(t.wheels),curves:Ch(t.curves),hueCurves:Rh(t.hueCurves),secondaries:Nh(t.secondaries),details:f,effects:m,palette:vh(t.palette),lut:Dh(t.lut),colorSpace:typeof t.colorSpace=="string"&&t.colorSpace.trim()?t.colorSpace.trim():dh}}function bu(e,t){return Kr(zr(e,t))}function Hh(e){return cu.some(t=>Math.abs(e[t].amount)>1e-4||Math.abs(e[t].level)>1e-4)}function Oo(e){return du.some(t=>e[t].some(([n,r])=>Math.abs(n-r)>1e-4))}function Ho(e){return fu.some(t=>e[t].some(([,n])=>Math.abs(n)>1e-4))}function Go(e){return e.some(t=>t.enabled&&Object.values(t.correction).some(n=>Math.abs(n)>1e-4))}function xu(e){return e?.enabled?Math.abs(e.details.vignette)>1e-4||Math.abs(e.details.grain)>1e-4||mu.some(n=>Math.abs(e.effects[n])>1e-4)?!0:e.intensity===0?!1:e.lut&&e.lut.intensity!==0?!0:jr.some(n=>Math.abs(e.adjust[n])>1e-4)||(e.wheels?Hh(e.wheels):!1)||(e.curves?Oo(e.curves):!1)||(e.hueCurves?Ho(e.hueCurves):!1)||(e.secondaries?Go(e.secondaries):!1):!1}var Gh=["[data-hyperframes-ignore]","[data-hyperframes-picker-ignore]","[data-hf-ignore]","[data-no-inspect]","[data-no-pick]","[data-hyper-shader-loading]"].join(","),Bh=["[data-hyperframes-picker-block]","[data-hyper-shader-loading]"].join(",");function yu(e){let t=!1,n=null,r=null,i=null,o=null;function a(S,A){try{window.dispatchEvent(new CustomEvent(S,{detail:A}))}catch(C){L("runtime.picker.site1",C)}}function l(S){i=S,a("hyperframe:picker:hovered",{elementInfo:i,isPickMode:t,timestamp:Date.now()})}function s(S){o=S,a("hyperframe:picker:selected",{elementInfo:o,isPickMode:t,timestamp:Date.now()})}function u(S){let A=S.ownerDocument.defaultView;if(!A)return!1;let C=S;for(;C&&C!==document.body&&C!==document.documentElement;){let F=A.getComputedStyle(C);if(F.display==="none"||F.visibility==="hidden"||F.pointerEvents==="none")return!0;let I=Number.parseFloat(F.opacity);if(Number.isFinite(I)&&I<=.01&&!C.hasAttribute(Nn))return!0;C=C.parentElement}return!1}function c(S){if(!S||S===document.body||S===document.documentElement)return!1;let A=S.tagName.toLowerCase();return!(A==="script"||A==="style"||A==="link"||A==="meta"||S.classList.contains("__hf-pick-highlight")||S.closest(Gh)||u(S))}function f(S){return!!S?.closest(Bh)}function m(S){let A=S;if(A.id)return`#${CSS.escape(A.id)}`;let C=S.getAttribute("data-composition-id");if(C)return`[data-composition-id="${CSS.escape(C)}"]`;let F=S.getAttribute("data-composition-src");if(F)return`[data-composition-src="${CSS.escape(F)}"]`;let I=S.getAttribute("data-track-index");if(I)return`[data-track-index="${CSS.escape(I)}"]`;let q=S.tagName.toLowerCase(),W=S.parentElement;if(!W)return q;let Y=W.querySelectorAll(`:scope > ${q}`);if(Y.length===1)return q;for(let k=0;kI.length>q?`${I.slice(0,q-1)}\\u2026`:I;return A==="h1"||A==="h2"||A==="h3"?"Heading":A==="p"||A==="span"||A==="div"?C.length>0?F(C,56):"Text":A==="img"?"Image":A==="video"?"Video":A==="audio"?"Audio":A==="svg"?"Shape":S.getAttribute("data-composition-src")?"Composition":A==="section"?"Section":`${A.charAt(0).toUpperCase()}${A.slice(1)}`}function b(S,A,C){let F=typeof C=="number"&&C>0?C:8,I=[];if(document.elementsFromPoint)I=document.elementsFromPoint(S,A);else if(document.elementFromPoint){let Y=document.elementFromPoint(S,A);I=Y?[Y]:[]}if(f(I[0]??null))return[];let q={},W=[];for(let[Y,k]of I.entries()){if(!c(k))continue;let U=`${k.tagName}::${k.id||""}::${Y}`;if(!q[U]&&(q[U]=!0,W.push(k),W.length>=F))break}return W}function v(S){let A=S.getBoundingClientRect(),C={};for(let I of Array.from(S.attributes))I.name.startsWith("data-")&&(C[I.name]=I.value);return{id:S.id||null,tagName:S.tagName.toLowerCase(),selector:m(S),label:p(S),boundingBox:{x:A.left,y:A.top,width:A.width,height:A.height},textContent:S.textContent?S.textContent.trim().slice(0,200):null,src:S.getAttribute("src")||S.getAttribute("data-composition-src")||null,dataAttributes:C}}function x(S,A,C){return b(S,A,C).map(v)}function _(S){if(!t)return;let C=b(S.clientX,S.clientY,1)[0]??(S.target instanceof Element?S.target:null);if(!c(C)||n===C)return;n&&n.classList.remove("__hf-pick-highlight"),n=C,C.classList.add("__hf-pick-highlight");let F=v(C);l(F),e.postMessage({source:"hf-preview",type:"element-hovered",elementInfo:F})}function R(S){if(!t)return;S.preventDefault(),S.stopPropagation(),S.stopImmediatePropagation();let A=x(S.clientX,S.clientY,8);A.length!==0&&(l(A[0]??null),e.postMessage({source:"hf-preview",type:"element-pick-candidates",candidates:A,selectedIndex:0,point:{x:S.clientX,y:S.clientY}}))}function T(S){S.key==="Escape"&&(D(),e.postMessage({source:"hf-preview",type:"pick-mode-cancelled"}))}function M(){t||(t=!0,r=document.createElement("style"),r.textContent=[".__hf-pick-highlight { outline: 2px solid #4f8cf7 !important; outline-offset: 2px; cursor: crosshair !important; }",".__hf-pick-active * { cursor: crosshair !important; }"].join(`\n`),document.head.appendChild(r),document.body.classList.add("__hf-pick-active"),document.addEventListener("mousemove",_,!0),document.addEventListener("click",R,!0),document.addEventListener("keydown",T,!0),a("hyperframe:picker:mode",{isPickMode:!0,timestamp:Date.now()}))}function D(){t&&(t=!1,n&&(n.classList.remove("__hf-pick-highlight"),n=null),r&&(r.remove(),r=null),document.body.classList.remove("__hf-pick-active"),document.removeEventListener("mousemove",_,!0),document.removeEventListener("click",R,!0),document.removeEventListener("keydown",T,!0),a("hyperframe:picker:mode",{isPickMode:!1,timestamp:Date.now()}))}function E(){window.__HF_PICKER_API={enable:M,disable:D,isActive:()=>t,getHovered:()=>i,getSelected:()=>o,getCandidatesAtPoint:(S,A,C)=>Number.isFinite(S)&&Number.isFinite(A)?x(S,A,C):[],pickAtPoint:(S,A,C)=>{if(!Number.isFinite(S)||!Number.isFinite(A))return null;let F=x(S,A,8);if(!F.length)return null;let I=Math.max(0,Math.min(F.length-1,Number(C??0))),q=F[I]??null;return q?(s(q),e.postMessage({source:"hf-preview",type:"element-picked",elementInfo:q}),D(),q):null},pickManyAtPoint:(S,A,C)=>{if(!Number.isFinite(S)||!Number.isFinite(A))return[];let F=x(S,A,8);if(!F.length)return[];let I=[],q=Array.isArray(C)?C:[0];for(let W of q){let Y=Math.max(0,Math.min(F.length-1,Math.floor(Number(W)))),k=F[Y];if(!k)continue;I.some(ie=>ie.selector===k.selector&&ie.tagName===k.tagName)||I.push(k)}return I.length?(s(I[0]??null),e.postMessage({source:"hf-preview",type:"element-picked-many",elementInfos:I}),D(),I):[]}},a("hyperframe:picker:api-ready",{hasApi:!0,timestamp:Date.now()})}return{enablePickMode:M,disablePickMode:D,installPickerApi:E}}var Uh=["width","height","top","left","right","bottom","inset","object-fit","object-position","z-index","opacity","visibility","filter","mix-blend-mode","backdrop-filter","border-radius","overflow","clip-path","mask","mask-image","mask-size","mask-position","mask-repeat","transform","transform-origin","translate","rotate","scale","box-sizing"];function $t(e,t){let n=Number.isFinite(t)&&t>0?t:30,r=Number.isFinite(e)&&e>0?e:0;return Math.floor(r*n+1e-9)/n}function vu(e,t,n=Uh){for(let r of n){let i=t.getPropertyValue(r);i&&e.setProperty(r,i)}}function Ln(e,t,n){let r=e?.[t];return typeof r=="function"?Number(r.call(e))||n:typeof r=="number"&&Number.isFinite(r)?r:(r!=null&&L("runtime.player.nonConformantNum",{prop:t,actual:typeof r}),n)}function Ue(e,t){let n=e?.[t];if(typeof n=="function"){n.call(e);return}n!==void 0&&L("runtime.player.nonConformantVoid",{method:t,actual:typeof n})}function Dn(e,t,n){if(e){for(let r of Object.values(e))if(!(!r||r===t))try{n(r)}catch(i){L("runtime.player.site1",i)}}}function Su(e,t,n,r){let i=$t(t,n),o=r?.suppressEvents===!0;return Ue(e,"pause"),typeof e.totalTime=="function"?e.totalTime(i,o):typeof e.seek=="function"&&e.seek(i,o),i}function Wh(e,t,n,r,i){let o=[];Dn(e,t,a=>{Ue(a,"play"),o.push(a)});try{return Su(t,n,r,i)}finally{for(let a of o)try{Ue(a,"pause")}catch(l){L("runtime.player.site2",l)}}}function Vh(e,t){Dn(e,t,n=>{Ue(n,"play")})}function Au(e){let t=e.transport;return t?{_timeline:null,play:()=>t.play(),pause:()=>t.pause(),seek:(n,r)=>t.seek(n,r),renderSeek:(n,r)=>t.renderSeek(n,r),getTime:()=>t.getTime(),getDuration:()=>t.getDuration(),isPlaying:()=>t.isPlaying(),setPlaybackRate:n=>t.setPlaybackRate(n),getPlaybackRate:()=>t.getPlaybackRate()}:{_timeline:null,play:()=>{let n=e.getTimeline();if(!n||e.getIsPlaying())return;let r=Math.max(0,Number(e.getSafeDuration?.()??Ln(n,"duration",0))||0);r>0&&Math.max(0,Ln(n,"time",0))>=r&&(Ue(n,"pause"),typeof n.seek=="function"&&n.seek(0,!1),e.onDeterministicSeek(0),e.setIsPlaying(!1),e.onSyncMedia(0,!1),e.onRenderFrameSeek(0)),typeof n.timeScale=="function"&&n.timeScale(e.getPlaybackRate()),Ue(n,"play"),Dn(e.getTimelineRegistry?.(),n,i=>{typeof i.timeScale=="function"&&i.timeScale(e.getPlaybackRate()),Ue(i,"play")}),e.onDeterministicPlay(),e.setIsPlaying(!0),e.onShowNativeVideos(),e.onStatePost(!0)},pause:()=>{let n=e.getTimeline();if(!n)return;Ue(n,"pause"),Dn(e.getTimelineRegistry?.(),n,i=>{Ue(i,"pause")});let r=Math.max(0,Ln(n,"time",0));e.onDeterministicSeek(r),e.onDeterministicPause(),e.setIsPlaying(!1),e.onSyncMedia(r,!1),e.onRenderFrameSeek(r),e.onStatePost(!0)},seek:(n,r)=>{let i=e.getTimeline();if(!i)return;let o=Math.max(0,Number(n)||0),a=e.getIsPlaying(),l=Wh(e.getTimelineRegistry?.(),i,o,e.getCanonicalFps());e.onDeterministicSeek(l),r?.keepPlaying&&a?(typeof i.timeScale=="function"&&i.timeScale(e.getPlaybackRate()),Ue(i,"play"),Dn(e.getTimelineRegistry?.(),i,s=>{typeof s.timeScale=="function"&&s.timeScale(e.getPlaybackRate()),Ue(s,"play")}),e.onDeterministicPlay(),e.onShowNativeVideos(),e.onSyncMedia(l,!0)):(e.setIsPlaying(!1),e.onSyncMedia(l,!1)),e.onRenderFrameSeek(l),e.onStatePost(!0)},renderSeek:(n,r)=>{let i=e.getTimeline(),o=e.getCanonicalFps(),a=i?(Vh(e.getTimelineRegistry?.(),i),Su(i,n,o,r)):$t(Math.max(0,Number(n)||0),o);e.onDeterministicSeek(a,r),e.setIsPlaying(!1),e.onSyncMedia(a,!1),e.onRenderFrameSeek(a),e.onStatePost(!0)},getTime:()=>Ln(e.getTimeline(),"time",0),getDuration:()=>Ln(e.getTimeline(),"duration",0),isPlaying:()=>e.getIsPlaying(),setPlaybackRate:n=>e.setPlaybackRate(n),getPlaybackRate:()=>e.getPlaybackRate()}}function Eu(){return{capturedTimeline:null,isPlaying:!1,currentTime:0,deterministicAdapters:[],canonicalFps:30,bridgeMuted:!1,bridgeVolume:1,mediaOutputMuted:!1,nativeMediaSyncDisabled:!1,webAudioMediaDisabled:!1,mediaAutoplayBlockedPosted:!1,mediaForceSyncNextTick:!1,playbackRate:1,bridgeLastPostedFrame:-1,bridgeLastPostedAt:0,bridgeLastPostedPlaying:!1,bridgeLastPostedMuted:!1,bridgeMaxPostIntervalMs:80,controlBridgeHandler:null,beforeUnloadHandler:null,injectedCompStyles:[],injectedCompScripts:[],injectedCompLinks:[],cachedTimedMediaEls:[],cachedMediaClips:[],cachedVideoClips:[],cachedMediaTimelineDurationSeconds:0,tornDown:!1,transportClock:null,transportRafId:null}}var zh=new Set(["SCRIPT","STYLE","LINK","META","TEMPLATE","NOSCRIPT"]);function Bo(e){return e.id||e.getAttribute("data-hf-id")||null}function qh(e){return ve(e)}function $h(e,t){let n=e.getAttribute("data-composition-id");if(!n)return null;let r=Number(t[n]?.duration?.());return Number.isFinite(r)&&r>0?r:null}function jh(e){return!(e instanceof HTMLMediaElement)||!Number.isFinite(e.duration)?null:Qe(e,e.duration)}function Kh(e,t,n,r){let i=qh(e.getAttribute("data-duration"));return i!=null&&i>0?i:$h(e,t)??jh(e)??Math.max(0,n-r)}function Yh(e){for(let[t,n]of e){let r=t.parentElement;for(;r;){let i=e.get(r);if(i){n.parentId=i.id,i.children.push(n);break}r=r.parentElement}}}function wu(e){let{startResolver:t,timelineRegistry:n,rootDuration:r}=e,i=new Map,o=document.querySelector("[data-composition-id]"),a=0;for(let l of document.querySelectorAll("[data-start]")){if(l===o||zh.has(l.tagName))continue;let s=t.resolveStartForElement(l,0);if(Kh(l,n,r,s)<=0)continue;let u={id:Bo(l)??`__clip-${a++}`,element:l,parentId:null,children:[]};i.set(l,u)}return Yh(i),{roots:Array.from(i.values()).filter(l=>l.parentId===null)}}function In(e){if(e==null||typeof e=="string"&&e.trim()==="")return null;let t=typeof e=="number"?e:Number(e);return Number.isFinite(t)?t:null}function jt(e){let t=In(e.start);if(t==null)return null;let n=Math.max(0,t),r=In(e.duration),i=In(e.authoredDuration),o=r!=null&&r>0?r:i!=null&&i>0?i:null;if(o!=null)return{start:n,duration:o,end:n+o};let a=In(e.end),l=In(e.authoredEnd),s=a!=null&&a>n?a:l!=null&&l>n?l:null;return{start:n,duration:s==null?null:s-n,end:s}}var Uo="css:root",Cu=["backdrop-filter","clip-path","filter","mask","mask-border-source","mask-image","perspective","rotate","scale","transform","translate","-webkit-mask-image"],Xh=new Set([...Cu,"contain","isolation","mask-border","mix-blend-mode","opacity"]),Jh=new Set(["absolute","relative"]),Qh=new Set(["flex","inline-flex","grid","inline-grid"]),Zh=new Set(["layout","paint","strict","content"]),e0=new Set(["size","inline-size"]);function t0(e){return e.position==="fixed"||e.position==="sticky"}function n0(e,t){if(t.zIndex==="auto"||t.zIndex==="")return!1;if(Jh.has(t.position))return!0;let n=e.parentElement?e.ownerDocument.defaultView?.getComputedStyle(e.parentElement).display:null;return n!=null&&Qh.has(n)}function r0(e){let t=Number.parseFloat(e.opacity);if(Number.isFinite(t)&&t<1||e.getPropertyValue("isolation")==="isolate")return!0;let n=e.getPropertyValue("mix-blend-mode");return n&&n!=="normal"?!0:Cu.some(r=>{let i=e.getPropertyValue(r);return i!==""&&i!=="none"})}function i0(e){return e.getPropertyValue("contain").split(/\\s+/).some(n=>Zh.has(n))?!0:e0.has(e.getPropertyValue("container-type"))}function o0(e){return e.getPropertyValue("will-change").split(",").map(t=>t.trim()).some(t=>Xh.has(t))}function a0(e,t){return t0(t)||n0(e,t)||r0(t)||i0(t)?!0:o0(t)}function s0(e){let t=[],n=e;for(;n?.parentElement;)t.push(Array.prototype.indexOf.call(n.parentElement.children,n)),n=n.parentElement;return`css:${t.reverse().join(".")}`}function Yr(e){let t=e.ownerDocument.defaultView;if(!t)return Uo;let n=e.parentElement;for(;n&&n!==e.ownerDocument.documentElement;){try{if(a0(n,t.getComputedStyle(n)))return s0(n)}catch{return Uo}n=n.parentElement}return Uo}function mt(e){let t=e.timelineRegistry??{},n=e.includeAuthoredTimingAttrs??!1,r=e.documentRef??document,i=new WeakMap,o=new WeakMap,a=new Set,l=m=>{let p=r.getElementById(m);return p||(r.querySelector(`[data-composition-id="${CSS.escape(m)}"]`)??null)},s=m=>{let p=m.ownerDocument.defaultView?.HTMLMediaElement;return p?m instanceof p:typeof HTMLMediaElement<"u"&&m instanceof HTMLMediaElement},u=m=>{let p=o.get(m);if(p!==void 0)return p;let b=null,v=jt({start:0,duration:m.getAttribute("data-duration"),authoredDuration:n?m.getAttribute("data-hf-authored-duration"):null});if(v?.duration!=null&&v.duration>0&&(b=v.duration),b==null||b<=0){let x=f(m,0),_=jt({start:x,end:m.getAttribute("data-end"),authoredEnd:n?m.getAttribute("data-hf-authored-end"):null});_?.duration!=null&&_.duration>0&&(b=_.duration)}if((b==null||b<=0)&&s(m)){let x=yn(m);Number.isFinite(m.duration)&&m.duration>x&&(b=(m.duration-x)/_e(m))}if(b==null||b<=0){let x=m.getAttribute("data-composition-id");if(x){let _=t[x]??null;if(_&&typeof _.duration=="function")try{let R=Number(_.duration());Number.isFinite(R)&&R>0&&(b=R)}catch(R){L("runtime.startResolver.site1",R)}}}return b!=null&&Number.isFinite(b)&&b>0?(o.set(m,b),b):(o.set(m,null),null)},c=(m,p)=>{if(m.hasAttribute("data-composition-id")){let v=m.parentElement?.closest("[data-composition-id]");return v?f(v,p):0}let b=m.closest("[data-composition-id]");return b?f(b,p):0},f=(m,p)=>{let b=i.get(m);if(b!==void 0)return b??p;if(a.has(m))return p;a.add(m);try{let v=lo(m.getAttribute("data-start"));if(!v){if(m.hasAttribute("data-composition-id")){let M=m.parentElement;if(M&&(M.hasAttribute("data-composition-src")||M.hasAttribute("data-composition-id")||M.hasAttribute("data-composition-file"))){let D=f(M,p);return i.set(m,D),D}}return i.set(m,p),p}if(v.kind==="absolute"){let M=Math.max(0,v.value),D=Math.max(0,c(m,p)+M);return i.set(m,D),D}let x=l(v.refId);if(!x)return i.set(m,p),p;let _=f(x,0),R=u(x);if(R==null||R<=0){let M=Math.max(0,_+v.offset);return i.set(m,M),M}let T=Math.max(0,_+R+v.offset);return i.set(m,T),T}finally{a.delete(m)}};return{resolveStartForElement:(m,p=0)=>f(m,Math.max(0,p)),resolveDurationForElement:m=>u(m)}}function Wo(e){let t=e.trim().toLowerCase();return!(!t||t==="main"||t.includes("caption")||t.includes("ambient"))}function pt(e){return ve(e)}function Vo(e){let t=e.getAttribute("data-duration"),n=e.getAttribute("data-hf-authored-duration"),r=jt({start:0,duration:t,authoredDuration:n})?.duration;return r??([t,n].map(pt).some(o=>o!=null&&o<=0)?0:null)}function _u(e){return jt({start:0,end:e.getAttribute("data-end"),authoredEnd:e.getAttribute("data-hf-authored-end")})?.end??null}function zo(e){try{let t=e.style?.zIndex;if(t&&t!=="auto"){let n=parseInt(t,10);if(Number.isFinite(n))return n}return 0}catch{return 0}}function qo(...e){let t=e.filter(n=>Number.isFinite(n??null));return t.length===0?null:Math.max(...t)}function $o(e,t){let n=e.getAttribute("data-track-index")??e.getAttribute("data-track");if(n==null)return t;let r=Number.parseInt(n,10);return Number.isFinite(r)?r:t}function On(e){let t=String(e??"").trim();if(!t)return null;let n=t.toLowerCase();if(n.startsWith("data:")||n.startsWith("javascript:"))return null;try{return new URL(t,document.baseURI).toString()}catch{return t}}function Tu(e){let t=e.getAttribute("src")??e.getAttribute("data-src");if(t)return On(t);let n=e.getAttribute("data-composition-src");if(n)return On(n);let r=e.querySelector("img[src], video[src], audio[src], source[src]");return r?On(r.getAttribute("src")):null}function u0(e){let t=e.className;return typeof t!="string"?null:t.split(/\\s+/).map(n=>n.trim()).find(n=>n&&n!=="clip"&&!n.startsWith("__hf-"))??null}function c0(e){if(!e)return null;try{return new URL(e,document.baseURI).pathname.split("/").filter(Boolean).at(-1)??null}catch{return e.split(/[\\\\/]/).filter(Boolean).at(-1)??null}}function d0(e){let t=e.textContent?.replace(/\\s+/g," ").trim();return t?t.length>32?`${t.slice(0,31)}...`:t:null}function Pn(e){let t=e.replace(/\\.[^.]+$/i,"").replace(/[-_]+/g," ").replace(/\\s+/g," ").trim();return t?t.replace(/\\b\\w/g,n=>n.toUpperCase()):e}function f0(e,t,n){let r=e.getAttribute("data-timeline-label")??e.getAttribute("data-label")??e.getAttribute("aria-label")??null;if(r?.trim())return r.trim();let i=e.getAttribute("data-composition-id");if(i)return Pn(i);let o=e.id;if(o)return Pn(o);let a=u0(e);if(a)return Pn(a);let l=c0(Tu(e));if(l)return Pn(l);let s=d0(e);return s||`${Pn(t)} ${n+1}`}function Ru(e){let n=window.__timelines??{},r=mt({timelineRegistry:n,includeAuthoredTimingAttrs:!0}),i=z=>{if(!z)return null;let O=n[z]??null;if(!O||typeof O.duration!="function")return null;try{let B=Number(O.duration());return Number.isFinite(B)&&B>0?B:null}catch{return null}},o=z=>{let O=pt(z.getAttribute("data-duration"));return O!=null&&O>0?O:Number.isFinite(z.duration)?Qe(z,z.duration):null},a=()=>{let z=Array.from(document.querySelectorAll("video[data-start], audio[data-start]"));if(z.length===0)return null;let O=0;for(let B of z){let ee=B.hasAttribute("data-hf-auto-start")?r.resolveStartForElement(B,0):Math.max(0,Number(B.getAttribute("data-start")??0)||0);if(!Number.isFinite(ee))continue;let K=o(B);K==null||K<=0||(O=Math.max(O,Math.max(0,ee)+K))}return O>0?O:null},l=(z,O)=>{let B=[],ee=null,K=null,te=null,J=z.parentElement;for(;J;){let X=J.getAttribute("data-composition-id");X&&(B.push(X),!te&&J!==O&&(te=X),ee==null&&(ee=r.resolveStartForElement(J,0)),K==null&&(K=pt(J.getAttribute("data-duration"))??i(X)??null)),J=J.parentElement}return{parentCompositionId:te,compositionAncestors:B.reverse(),inheritedStart:ee,inheritedDuration:K}},s=document.querySelector("[data-composition-id]"),u=Array.from(document.querySelectorAll("[data-composition-id]")),c=s?.getAttribute("data-composition-id")??null,f=s?r.resolveStartForElement(s,0):0,m=a(),p=m!=null?Math.max(0,m-Math.max(0,f)):null,b=i(c),v=Vo(s??document.body),x=qo(...u.filter(z=>z!==s).map(z=>{let O=r.resolveStartForElement(z,0),B=r.resolveDurationForElement(z)??i(z.getAttribute("data-composition-id"))??null;return!Number.isFinite(O)||B==null||B<=0?null:Math.max(0,O)+B})),_=x!=null?Math.max(0,x-Math.max(0,f)):null,R=typeof b=="number"&&Number.isFinite(b)&&b>0?b:null,T=typeof v=="number"&&Number.isFinite(v)&&v>0?v:null,M=typeof p=="number"&&Number.isFinite(p)&&p>0?p:null,D=typeof _=="number"&&Number.isFinite(_)&&_>0?_:null,E=qo(M,D),S=R!=null&&E!=null&&R>E+1,C=T??(S?E:qo(R,M,D))??null,I=(C!=null?f+C:null)??(typeof m=="number"&&Number.isFinite(m)&&m>0?m:null),q=(z,O)=>!Number.isFinite(O)||O<=0?0:I==null||!Number.isFinite(I)?O:!Number.isFinite(z)||z>=I?0:Math.max(0,Math.min(O,I-z)),W=[],Y=[],k=Array.from(document.querySelectorAll("[data-start], [data-track-index], [data-composition-id], video, audio, img")),U=0;for(let[z,O]of k.entries()){if(O===s||["SCRIPT","STYLE","LINK","META","TEMPLATE","NOSCRIPT"].includes(O.tagName))continue;let B=l(O,s),ee=r.resolveStartForElement(O,B.inheritedStart??0),K=O.getAttribute("data-composition-id"),te=Vo(O);if(te==null&&K&&K!==c&&(te=i(K)),te==null&&O instanceof HTMLMediaElement&&Number.isFinite(O.duration)&&(te=Qe(O,O.duration)),te==null){let Fe=B.inheritedDuration;if(Fe!=null&&Fe>0){let Ce=(B.inheritedStart??0)+Fe;te=Math.max(0,Ce-ee)}}if(te==null||te<=0||(te=q(ee,te),te<=0))continue;let J=ee+te;U=Math.max(U,J);let X=O.tagName.toLowerCase(),Pe=K&&K!==c?"composition":X==="video"?"video":X==="audio"?"audio":X==="img"?"image":"element";W.push({id:Bo(O)??K??null,label:f0(O,Pe,W.length),start:ee,duration:te,track:$o(O,z),zIndex:zo(O),stackingContextId:Yr(O),kind:Pe,tagName:X,compositionId:O.getAttribute("data-composition-id"),compositionAncestors:B.compositionAncestors,parentCompositionId:B.parentCompositionId,nodePath:null,compositionSrc:On(O.getAttribute("data-composition-src")),playbackStart:$e(O),playbackRate:_e(O),assetUrl:Tu(O),timelineRole:O.getAttribute("data-timeline-role"),timelineLabel:O.getAttribute("data-timeline-label"),timelineGroup:O.getAttribute("data-timeline-group"),timelinePriority:pt(O.getAttribute("data-timeline-priority"))})}let ie=new Set(W.map(z=>z.id)),P=s?.getAttribute("data-composition-id")??null,H=P?n[P]??null:null;if(H&&s){let z=H;if(typeof z.getChildren=="function")try{let O=z.getChildren(!0,!0,!1)??[],B=new Map;for(let te of s.children){let J=te;if(!J.id)continue;let X=J.tagName.toLowerCase();X==="script"||X==="style"||X==="link"||B.set(J,{id:J.id,start:1/0,end:-1/0})}let ee=te=>{let J=te;for(;J;){if(B.has(J))return J;if(J===s)return null;J=J.parentElement}return null};for(let te of O){if(typeof te.targets!="function"||typeof te.startTime!="function"||typeof te.duration!="function")continue;let J=te.startTime(),X=te.parent;for(;X&&X!==H&&typeof X.startTime=="function";)J+=X.startTime(),X=X.parent;let Pe=J+te.duration();if(!(!Number.isFinite(J)||!Number.isFinite(Pe)))for(let Fe of te.targets()){if(!(Fe instanceof Element))continue;let cn=ee(Fe);if(!cn)continue;let Ce=B.get(cn);Ce&&(Ce.start=Math.min(Ce.start,J),Ce.end=Math.max(Ce.end,Pe))}}let K=W.length>0?Math.max(...W.map(te=>te.track))+1:0;for(let[te,J]of B){if(J.start===1/0||J.end===-1/0)continue;let X=te;if(ie.has(X.id))continue;let Pe=Math.max(0,J.end-J.start);if(Pe<=0)continue;let Fe=q(J.start,Pe);Fe<=0||(U=Math.max(U,J.start+Fe),W.push({id:X.id,label:X.getAttribute("data-timeline-label")??X.getAttribute("data-label")??X.getAttribute("aria-label")??X.id,start:J.start,duration:Fe,track:$o(X,K),zIndex:zo(X),stackingContextId:Yr(X),kind:"element",tagName:X.tagName.toLowerCase(),compositionId:X.getAttribute("data-composition-id"),compositionAncestors:P?[P]:[],parentCompositionId:P,nodePath:null,compositionSrc:null,playbackStart:$e(X),playbackRate:_e(X),assetUrl:null,timelineRole:X.getAttribute("data-timeline-role"),timelineLabel:X.getAttribute("data-timeline-label"),timelineGroup:X.getAttribute("data-timeline-group"),timelinePriority:pt(X.getAttribute("data-timeline-priority"))}),ie.add(X.id))}}catch(O){L("runtime.timeline.site1",O)}}if(s&&C!=null&&C>0){let z=W.length>0?Math.max(...W.map(O=>O.track))+1:0;for(let O of s.children){let B=O;if(!B.id||ie.has(B.id))continue;let ee=B.getAttribute("data-timeline-role");if(ee!=="overlay"&&ee!=="persistent-overlay")continue;let K=B.tagName.toLowerCase();if(K==="script"||K==="style"||K==="link"||K==="meta"||window.getComputedStyle(B).display==="none")continue;let J=q(0,C);J<=0||(U=Math.max(U,J),W.push({id:B.id,label:B.getAttribute("data-timeline-label")??B.getAttribute("data-label")??B.getAttribute("aria-label")??B.id,start:0,duration:J,track:$o(B,z),zIndex:zo(B),stackingContextId:Yr(B),kind:"element",tagName:K,compositionId:B.getAttribute("data-composition-id"),compositionAncestors:P?[P]:[],parentCompositionId:P,nodePath:null,compositionSrc:null,playbackStart:$e(B),playbackRate:_e(B),assetUrl:null,timelineRole:ee,timelineLabel:B.getAttribute("data-timeline-label"),timelineGroup:B.getAttribute("data-timeline-group"),timelinePriority:pt(B.getAttribute("data-timeline-priority"))}),ie.add(B.id))}}for(let z of u){if(z===s)continue;let O=z.getAttribute("data-composition-id");if(!O||!Wo(O))continue;let B=r.resolveStartForElement(z,0),ee=Vo(z);if((ee==null||ee<=0)&&_u(z)!=null){let X=_u(z);ee=Math.max(0,X-B)}let K=i(O),te=ee&&ee>0?ee:K;if(te==null||te<=0)continue;let J=q(B,te);J<=0||Y.push({id:O,label:z.getAttribute("data-label")??O,start:B,duration:J,thumbnailUrl:On(z.getAttribute("data-thumbnail-url")),avatarName:null})}let V=Math.max(1,U||1,C??0),j=S&&T==null,we=j?Number.POSITIVE_INFINITY:Math.max(1,Math.ceil(V*Math.max(1,e.canonicalFps)));return{..._r(e.canonicalFps),source:"hf-preview",type:"timeline",compositionContractVersion:1,durationSeconds:j?Number.POSITIVE_INFINITY:V,durationInFrames:we,clips:W,scenes:Y,compositionWidth:pt(s?.getAttribute("data-width"))??1920,compositionHeight:pt(s?.getAttribute("data-height"))??1080}}var jo="data-composition-id",m0="data-composition-src",p0=`[${jo}]`,iA=`[${m0}]`,ku="style",Mu="script",h0=\'link[rel="stylesheet"], link[rel="preconnect"]\';function Kt(e){return e?Array.from(e):[]}function Fu(e){let{contentNode:t,head:n,documentElement:r,hasTemplate:i,compositionId:o}=e,a=Kt(t.querySelectorAll(p0)),l=o?a.find(c=>c.getAttribute(jo)===o)??null:a[0]??null,s=(l??a[0])?.getAttribute(jo)?.trim()||"",u=i?null:n??null;return{innerRoot:l,authoredCompositionId:o||s||null,scriptCompositionId:s||o||null,authoredRootId:l?.getAttribute("id")?.trim()||null,styleSources:[...Kt(u?.querySelectorAll(ku)),...Kt(t.querySelectorAll(ku))],scriptSources:[...Kt(u?.querySelectorAll(Mu)),...Kt(t.querySelectorAll(Mu))],linkSources:Kt(n?.querySelectorAll(h0)),variableDefaultCarriers:[r,l].filter(c=>c!=null)}}var pe=Qm(nd(),1),rd=pe.default,jA=pe.default.stringify,KA=pe.default.fromJSON,YA=pe.default.plugin,XA=pe.default.parse,JA=pe.default.list,QA=pe.default.document,ZA=pe.default.comment,eE=pe.default.atRule,tE=pe.default.rule,nE=pe.default.decl,rE=pe.default.root,iE=pe.default.CssSyntaxError,oE=pe.default.Declaration,aE=pe.default.Container,sE=pe.default.Processor,lE=pe.default.Document,uE=pe.default.Comment,cE=pe.default.Warning,dE=pe.default.AtRule,fE=pe.default.Result,mE=pe.default.Input,pE=pe.default.Rule,hE=pe.default.Root,gE=pe.default.Node;var ya="data-hf-authored-id",id="data-hf-inner-root";function va(e){return e.replace(/[.*+?^${}()|[\\]\\\\]/g,"\\\\$&")}function Sa(e){return e.replace(/\\\\/g,"\\\\\\\\").replace(/"/g,\'\\\\"\')}function Og(e){return e&&e.replace(/[^a-zA-Z0-9_-]/g,n=>`\\\\${n}`).replace(/^-?\\d/,n=>`\\\\${n}`)}function ad(e){let t=e.trim();return t?Array.from(new Set([t,Og(t)])).filter(Boolean):[]}function Hg(e){return!!e&&/[\\w-]/.test(e)}function Gg(e,t,n){let r=ad(t).sort((l,s)=>s.length-l.length);if(r.length===0)return e;let i="",o=0,a=null;for(let l=0;l0?e[l-1]:"";if(a){i+=s,s===a&&u!=="\\\\"&&(a=null);continue}if(s===\'"\'||s==="\'"){a=s,i+=s;continue}if(s==="["){o+=1,i+=s;continue}if(s==="]"){o=Math.max(0,o-1),i+=s;continue}if(s==="#"&&o===0){let c=r.find(f=>e.startsWith(f,l+1));if(c){let f=e[l+1+c.length];if(!Hg(f)){i+=n,l+=c.length;continue}}}i+=s}return i}function Bg(e,t){let n=t?.trim();return n?Gg(e,n,`[${ya}="${Sa(n)}"]`):e}function od(e){return`${e}:not(:has([${id}])), ${e} > [${id}]`}function Ug(e,t,n,r,i,o){let a=Bg(e,r),l=Wg(a,t,n),s=l.trim();if(!s||s==="*")return e;if(/^(html|body|:root)$/i.test(s))return o?od(t):e;let u=new RegExp(`\\\\[\\\\s*data-composition-id\\\\s*=\\\\s*(["\'])${va(n)}\\\\1\\\\s*\\\\]`,"g");if(u.test(s))return s.replace(u,"").trim()===""?od(t):l.replace(u,t);let c=l.match(/^\\s*/)?.[0]??"",f=l.match(/\\s*$/)?.[0]??"";if(i){let m=r?`[${ya}="${Sa(r)}"]`:null;if(m&&s.startsWith(m)){let p=s.slice(m.length);return`${c}${t}${m}${p}${f}`}}return`${c}${t} ${s}${f}`}function Wg(e,t,n){let r=va(n),i=String.raw`\\[\\s*data-composition-id\\s*=\\s*(?:"${r}"|\'${r}\')\\s*\\]`,o=String.raw`\\s*\\[\\s*data-(?:start|duration)\\s*=\\s*(?:"[^"]*"|\'[^\']*\')\\s*\\]`;return e.replace(new RegExp(`${i}(?:${o})+`,"g"),t).replace(new RegExp(`(?:${o})+${i}`,"g"),t)}var Vg=new Set(["keyframes","-webkit-keyframes","font-face"]);function zg(e){return e?.type==="atrule"}function qg(e){let t=e.parent;for(;t;){if(zg(t)&&Vg.has(t.name.toLowerCase()))return!0;t=t.parent}return!1}function $g(e){let t=e.parent;for(;t;){if(t.type==="rule")return!0;t=t.parent}return!1}function sd(e,t,n,r,i){let o=t.trim();if(!e||!o)return e;let a=n||`[data-composition-id="${Sa(o)}"]`,l=rd.parse(e);return l.walkRules(s=>{qg(s)||$g(s)||(s.selectors=s.selectors.map(u=>Ug(u,a,o,r,i?.compoundAuthoredRoot,i?.scopeRootSelectors)))}),l.toResult({map:!1}).css}function nt(e){return JSON.stringify(e).replace(/ 0 ? selector[index - 1] : "";\n if (quote) {\n result += char;\n if (char === quote && previousChar !== "\\\\\\\\") {\n quote = null;\n }\n continue;\n }\n if (char === \'"\' || char === "\'") {\n quote = char;\n result += char;\n continue;\n }\n if (char === "[") {\n bracketDepth += 1;\n result += char;\n continue;\n }\n if (char === "]") {\n bracketDepth = Math.max(0, bracketDepth - 1);\n result += char;\n continue;\n }\n if (char === "#" && bracketDepth === 0) {\n var matchedForm = null;\n for (var formIndex = 0; formIndex < __hfAuthoredRootIdForms.length; formIndex += 1) {\n var form = __hfAuthoredRootIdForms[formIndex];\n if (selector.slice(index + 1, index + 1 + form.length) === form) {\n matchedForm = form;\n break;\n }\n }\n if (matchedForm) {\n var nextChar = selector[index + 1 + matchedForm.length];\n if (!__hfIsSelectorNameChar(nextChar)) {\n result += __hfAuthoredRootSelector;\n index += matchedForm.length;\n continue;\n }\n }\n }\n result += char;\n }\n return result;\n };\n var __hfNormalizeSelector = function(selector) {\n if (!__hfCompId || typeof selector !== "string") return selector;\n var normalized = selector\n .replace(new RegExp(__hfRootSelectorPattern + \'(?:\' + __hfTimingSelectorPattern + \')+\', \'g\'), __hfRootSelector)\n .replace(new RegExp(\'(?:\' + __hfTimingSelectorPattern + \')+\' + __hfRootSelectorPattern, \'g\'), __hfRootSelector);\n if (__hfAuthoredRootSelector) {\n normalized = __hfReplaceAuthoredRootIdSelectors(normalized);\n }\n return normalized;\n };\n var __hfFindRoot = function() {\n if (!__hfRoot && __hfRootSelector) {\n __hfRoot = window.document.querySelector(__hfRootSelector);\n }\n return __hfRoot;\n };\n var __hfContains = function(node) {\n var root = __hfFindRoot();\n return !root || node === root || root.contains(node);\n };\n var __hfQueryAll = function(selector) {\n var root = __hfFindRoot();\n if (!root || typeof selector !== "string") {\n return window.document.querySelectorAll(selector);\n }\n return Array.prototype.filter.call(window.document.querySelectorAll(__hfNormalizeSelector(selector)), function(node) {\n return __hfContains(node);\n });\n };\n var __hfQueryOne = function(selector) {\n var matches = __hfQueryAll(selector);\n return matches[0] || null;\n };\n var __hfGetElementById = function(id) {\n var found = window.document.getElementById(id);\n if (found && __hfContains(found)) return found;\n var root = __hfFindRoot();\n if (!root) return found || null;\n var idValue = id + "";\n if (__hfAuthoredRootId && __hfAuthoredRootId === idValue && root.getAttribute && root.getAttribute(__hfAuthoredRootAttr) === idValue) {\n return root;\n }\n if (root.id === idValue) return root;\n if (typeof root.querySelector !== "function") return null;\n try {\n var authoredRootMatch = root.querySelector(\'[\' + __hfAuthoredRootAttr + \'="\' + __hfEscapeAttr(idValue) + \'"]\');\n if (authoredRootMatch) return authoredRootMatch;\n } catch {}\n if (typeof CSS !== "undefined" && CSS && typeof CSS.escape === "function") {\n try {\n return root.querySelector("#" + CSS.escape(idValue)) || null;\n } catch {}\n }\n try {\n return root.querySelector(\'[id="\' + __hfEscapeAttr(idValue) + \'"]\') || null;\n } catch {}\n return null;\n };\n var __hfScopedDocument = typeof Proxy === "function"\n ? new Proxy(window.document, {\n get: function(target, prop, receiver) {\n if (prop === "querySelector") return __hfQueryOne;\n if (prop === "querySelectorAll") return __hfQueryAll;\n if (prop === "getElementById") return __hfGetElementById;\n var value = Reflect.get(target, prop, target);\n return typeof value === "function" ? value.bind(target) : value;\n },\n })\n : window.document;\n var __hfTimelineRegistryProxy = null;\n var __hfGetTimelineRegistry = function() {\n window.__timelines = window.__timelines || {};\n if (!__hfCompId || __hfCompId === __hfTimelineCompId || typeof Proxy !== "function") {\n return window.__timelines;\n }\n if (!__hfTimelineRegistryProxy) {\n __hfTimelineRegistryProxy = new Proxy(window.__timelines, {\n get: function(target, prop, receiver) {\n if (prop !== __hfCompId) {\n return Reflect.get(target, prop, target);\n }\n var authoredValue = Reflect.get(target, prop, target);\n return authoredValue === undefined\n ? Reflect.get(target, __hfTimelineCompId, target)\n : authoredValue;\n },\n set: function(target, prop, value, receiver) {\n if (prop !== __hfCompId) {\n return Reflect.set(target, prop, value, target);\n }\n // The authored node remains in the compiled DOM when its local id\n // differs from the runtime mount id, so readiness legitimately sees\n // both compositions. Publish the same timeline under both identities\n // instead of replacing one with the other.\n var authoredSet = Reflect.set(target, __hfCompId, value, target);\n var runtimeSet = Reflect.set(target, __hfTimelineCompId, value, target);\n return authoredSet && runtimeSet;\n },\n });\n }\n return __hfTimelineRegistryProxy;\n };\n var __hfScopedWindow = typeof Proxy === "function"\n ? new Proxy(window, {\n get: function(target, prop, receiver) {\n if (prop === "__timelines") return __hfGetTimelineRegistry();\n // Inside a sub-composition, __hyperframes is passed as a bare script\n // param bound to the SCOPED variant (per-comp getVariables). But\n // authors routinely write the documented window.__hyperframes.\n // getVariables() form, which would otherwise fall through to the host\n // page\'s base __hyperframes and return the WRONG (or empty) variables\n // for this instance. Route it to the scoped variant too so both\n // spellings resolve to this composition\'s own variables.\n // (__hfScopedHyperframes is a hoisted var assigned below, before any\n // sub-comp script -- the only code that reads this -- runs.)\n if (prop === "__hyperframes") return __hfScopedHyperframes;\n // Native window methods must stay bound to the real window. Handed\n // back unbound, "this" at call time is this Proxy and Chrome rejects\n // it with "Illegal invocation", which broke window.addEventListener,\n // setTimeout, matchMedia and getComputedStyle inside every\n // sub-composition -- including the window.addEventListener("hf-seek",\n // ...) form the Three.js and TypeGPU adapters document. The sibling\n // document and gsap proxies here already bind.\n //\n // Only bind non-constructors. Function.prototype.bind drops static\n // members, so binding a class exposed on window (window.Texts and\n // friends) would silently strip its statics. Built-in methods have\n // no .prototype; classes and constructor functions do.\n var value = Reflect.get(target, prop, target);\n return typeof value === "function" && value.prototype === undefined\n ? value.bind(target)\n : value;\n },\n set: function(target, prop, value, receiver) {\n if (prop === "__timelines") {\n // Common authoring boilerplate assigns the registry back to\n // itself (window.__timelines = window.__timelines || {}). The\n // getter above returns our proxy; do not replace the canonical\n // registry with that proxy or later wrappers will stack proxies.\n if (value === __hfTimelineRegistryProxy) return true;\n target.__timelines = value || {};\n __hfTimelineRegistryProxy = null;\n return true;\n }\n return Reflect.set(target, prop, value, target);\n },\n })\n : window;\n var __hfResolveGsapTarget = function(target) {\n if (typeof target !== "string") return target;\n return __hfQueryAll(target);\n };\n var __hfScopeTimeline = function(timeline) {\n if (!timeline || timeline.__hfScopedCompositionRoot === __hfFindRoot()) return timeline;\n ["to", "from", "fromTo", "set"].forEach(function(method) {\n var original = timeline[method];\n if (typeof original !== "function") return;\n timeline[method] = function(target) {\n var args = Array.prototype.slice.call(arguments);\n args[0] = __hfResolveGsapTarget(target);\n return original.apply(timeline, args);\n };\n });\n try {\n Object.defineProperty(timeline, "__hfScopedCompositionRoot", {\n value: __hfFindRoot(),\n configurable: true,\n });\n } catch {\n // Best-effort: timelines coming from user code may have a frozen target\n // or a non-extensible defineProperty path. Swallow \\u2014 the scoped root\n // is an enrichment, not a correctness invariant for playback.\n }\n return timeline;\n };\n var __hfBaseGsap = typeof gsap === "undefined" ? window.gsap : gsap;\n var __hfScopedGsap = !__hfBaseGsap || typeof Proxy !== "function"\n ? __hfBaseGsap\n : new Proxy(__hfBaseGsap, {\n get: function(target, prop, receiver) {\n if (prop === "timeline") {\n return function() {\n return __hfScopeTimeline(target.timeline.apply(target, arguments));\n };\n }\n if (prop === "to" || prop === "from" || prop === "fromTo" || prop === "set") {\n return function(firstArg) {\n var args = Array.prototype.slice.call(arguments);\n args[0] = __hfResolveGsapTarget(firstArg);\n return target[prop].apply(target, args);\n };\n }\n if (prop === "utils" && target.utils && typeof Proxy === "function") {\n return new Proxy(target.utils, {\n get: function(utilsTarget, utilsProp, utilsReceiver) {\n if (utilsProp === "toArray") {\n return function(firstArg) {\n var args = Array.prototype.slice.call(arguments);\n args[0] = __hfResolveGsapTarget(firstArg);\n return utilsTarget.toArray.apply(utilsTarget, args);\n };\n }\n if (utilsProp === "selector") {\n return function(base) {\n var baseEl = typeof base === "string" ? __hfQueryOne(base) : base;\n var root = baseEl || __hfFindRoot();\n return function(selector) {\n if (!root || typeof selector !== "string") return [];\n return Array.prototype.filter.call(\n window.document.querySelectorAll(__hfNormalizeSelector(selector)),\n function(node) {\n return node === root || (typeof root.contains === "function" && root.contains(node));\n },\n );\n };\n };\n }\n var value = Reflect.get(utilsTarget, utilsProp, utilsTarget);\n return typeof value === "function" ? value.bind(utilsTarget) : value;\n },\n });\n }\n var value = Reflect.get(target, prop, target);\n return typeof value === "function" ? value.bind(target) : value;\n },\n });\n var __hfBaseHyperframes = window.__hyperframes;\n var __hfScopedHyperframes = !__hfBaseHyperframes\n ? __hfBaseHyperframes\n : Object.assign({}, __hfBaseHyperframes, {\n getVariables: function() {\n var byComp = window.__hfVariablesByComp;\n var scoped = byComp && __hfTimelineCompId ? byComp[__hfTimelineCompId] : null;\n return scoped ? Object.assign({}, scoped) : {};\n },\n });\n var __hfRun = function() {\n try {\n (function(document, gsap, window, __hyperframes) {\n${e.replace(/<\\/(script)/gi,"<\\\\/$1")}\n }).call(window, __hfScopedDocument, __hfScopedGsap, __hfScopedWindow, __hfScopedHyperframes);\n } catch (_err) {\n console.error(__hfErrorLabel, __hfCompId, _err);\n }\n };\n __hfFindRoot();\n __hfRun();\n})();`}var jg=["data-composition-id","data-composition-file","data-start","data-duration","data-end","data-track-index","data-track","data-composition-src","data-hf-authored-duration","data-hf-authored-end"];function ud(e){let t=e.getAttribute("id")?.trim();for(let n of jg)e.removeAttribute(n);t&&(e.removeAttribute("id"),e.setAttribute("data-hf-authored-id",t)),e.setAttribute("data-hf-inner-root","true")}var Kg=8e3,Yg=/^(?![a-zA-Z][a-zA-Z\\d+\\-.]*:)(?!\\/\\/)(?!\\/)(?!\\.\\.?\\/).+/,Xg=/\\burl\\(\\s*(["\']?)([^)"\']+)\\1\\s*\\)/g,Jg=["src","href"];function Qg(e){return!e||e.startsWith("http://")||e.startsWith("https://")||e.startsWith("//")||e.startsWith("data:")||e.startsWith("#")||e.startsWith("/")}function fd(e,t){if(!t)return e;let n=e.trim();if(Qg(n)||!n.startsWith("../")&&n!=="..")return e;try{return new URL(n,t).href}catch{return e}}function md(e,t){return!t||!e?e:e.replace(Xg,(n,r,i)=>{let o=fd(i||"",t);return o===i?n:`url(${r||""}${o}${r||""})`})}function Zg(e,t){for(let n of Array.from(e.querySelectorAll("[src], [href]")))for(let r of Jg){let i=n.getAttribute(r);if(i==null)continue;let o=fd(i,t);o!==i&&n.setAttribute(r,o)}}function eb(e,t){for(let n of Array.from(e.querySelectorAll("[style]"))){let r=n.getAttribute("style");if(r==null)continue;let i=md(r,t);i!==r&&n.setAttribute("style",i)}}function tb(e,t){for(let n of Array.from(e.querySelectorAll("style"))){let r=n.textContent||"",i=md(r,t);i!==r&&(n.textContent=i)}}function pd(e,t){if(t){Zg(e,t),eb(e,t),tb(e,t);for(let n of Array.from(e.querySelectorAll("template")))pd(n.content,t)}}function nb(e,t){return`${e}__hf${t}`}var rb=e=>new Promise(t=>{let n=!1,r=Date.now(),i=null,o=a=>{n||(n=!0,i!=null&&window.clearTimeout(i),t({status:a,elapsedMs:Math.max(0,Date.now()-r)}))};e.addEventListener("load",()=>o("load"),{once:!0}),e.addEventListener("error",()=>o("error"),{once:!0}),i=window.setTimeout(()=>o("timeout"),Kg)});function Aa(e){for(;e.firstChild;)e.removeChild(e.firstChild);e.textContent=""}function cd(e){for(let t of Array.from(e.querySelectorAll("style, script")))t.remove()}function ib(e){let t=document.importNode(e,!0);ud(t);let n=t.getAttribute("data-width"),r=t.getAttribute("data-height");return t.style.width=n?`${n}px`:"100%",t.style.height=r?`${r}px`:"100%",t}function ob(e,t){let n=e.trim();if(!n)return e;try{return Yg.test(n)&&!n.startsWith("#")&&!n.startsWith("?")?new URL(n,document.baseURI).toString():t?new URL(n,t).toString():new URL(n,document.baseURI).toString()}catch{return e}}function dd(e,t){try{let n=new URL(e),r=new URL(t);return n.search="",n.hash="",r.search="",r.hash="",n.href===r.href}catch{return!1}}function di(e){let t=(e.getAttribute("data-composition-id")||"").trim()||null;return{authoredCompositionId:(e.getAttribute("data-hf-original-composition-id")||t||"").trim()||null,runtimeCompositionId:t}}function ab(e){let t=new Map;for(let n of e){let r=di(n).authoredCompositionId||"";r&&t.set(r,(t.get(r)||0)+1)}return t}function hd(e){let t=di(e).authoredCompositionId;return t?!!document.querySelector(`template#${CSS.escape(t)}-template`):!1}function sb(e){return!!e.querySelector(\'[data-hf-inner-root="true"]\')}function lb(e){return e.hasAttribute("data-composition-src")?!0:hd(e)?e.children.length===0||e.hasAttribute("data-hf-original-composition-id")?!0:sb(e):!1}function wa(){return Array.from(document.querySelectorAll("[data-composition-src], [data-composition-id]")).filter(t=>t.hasAttribute("data-composition-src")?!0:hd(t))}function gd(){let e=window.__hfVariablesByComp;if(!e)return;let t=new Set(wa().map(n=>di(n).runtimeCompositionId).filter(n=>!!n));for(let n of Object.keys(e))t.has(n)||delete e[n]}function bd(e,t=ab(e)){let n=new Map,r=new Map;for(let i of e){let{authoredCompositionId:o,runtimeCompositionId:a}=di(i),l=lb(i);if(!o){r.set(i,{authoredCompositionId:null,runtimeCompositionId:a});continue}let s=(t.get(o)||0)>1,u=a||o;if(l){let c=s?(n.get(o)||0)+1:0;s&&n.set(o,c),u=s?nb(o,c):o,s?i.setAttribute("data-hf-original-composition-id",o):i.removeAttribute("data-hf-original-composition-id"),i.setAttribute("data-composition-id",u),a&&a!==u&&window.__hfVariablesByComp&&delete window.__hfVariablesByComp[a]}r.set(i,{authoredCompositionId:o,runtimeCompositionId:u})}return r}async function Ea(e){let t=Fu({contentNode:e.sourceNode,head:e.head,hasTemplate:e.hasTemplate,compositionId:e.authoredCompositionId}),n=t.innerRoot instanceof HTMLElement?t.innerRoot:null,r=n??e.sourceNode,i=t.authoredCompositionId,o=t.scriptCompositionId,a=e.runtimeCompositionId||null,l=t.authoredRootId,s=a?`[data-composition-id="${CSS.escape(a)}"]`:void 0;for(let m of t.linkSources){let p=(m.getAttribute("href")||"").trim();if(!p)continue;let b=e.compositionUrl?new URL(p,e.compositionUrl).href:p;if(e.compositionUrl&&dd(b,e.compositionUrl)||document.head.querySelector(`link[href="${CSS.escape(b)}"]`))continue;let v=m.cloneNode(!0);v instanceof HTMLLinkElement&&(v.href=b,document.head.appendChild(v),e.injectedLinks.push(v))}(m=>{for(let p of m){let b=p.cloneNode(!0);b instanceof HTMLStyleElement&&(i&&(b.textContent=sd(b.textContent||"",i,s,l,{scopeRootSelectors:!0})),document.head.appendChild(b),e.injectedStyles.push(b))}})(t.styleSources);let c=m=>{let p=m.getAttribute("type")?.trim()??"",b=m.getAttribute("src")?.trim()??"";if(b){let x=ob(b,e.compositionUrl);return e.compositionUrl&&dd(x,e.compositionUrl)?null:{kind:"external",src:x,type:p}}let v=m.textContent?.trim()??"";return v?{kind:"inline",content:v,type:p,scopeCompositionId:o}:null},f=t.scriptSources.map(c).filter(m=>m!==null);if(n){let m=n.getAttribute("data-width"),p=n.getAttribute("data-height"),b=e.parseDimensionPx(m),v=e.parseDimensionPx(p);m&&e.host.setAttribute("data-width",m),p&&e.host.setAttribute("data-height",p),b&&e.host instanceof HTMLElement&&(e.host.style.width=b),v&&e.host instanceof HTMLElement&&(e.host.style.height=v),n.hasAttribute("data-timeline-locked")&&e.host.setAttribute("data-timeline-locked","");let x=ib(n);!e.authoredCompositionId&&i&&x.setAttribute("data-composition-id",i),cd(x),e.host.appendChild(x)}else if(e.hasTemplate){let m=document.importNode(r,!0);cd(m),e.host.appendChild(m)}else e.host.innerHTML=e.fallbackBodyInnerHtml;a&&ub(e,r,a);for(let m of f){let p=document.createElement("script");if(m.type&&(p.type=m.type),p.async=!1,m.kind==="external"?p.src=m.src:m.type.toLowerCase()==="module"?p.textContent=m.content:m.scopeCompositionId?p.textContent=ld(m.content,m.scopeCompositionId,"[HyperFrames] composition script error:",s,a||m.scopeCompositionId,l):p.textContent=`(function(){${m.content}})();`,document.body.appendChild(p),e.injectedScripts.push(p),m.kind==="external"){let b=await rb(p);b.status!=="load"&&e.onDiagnostic?.({code:"external_composition_script_load_issue",details:{hostCompositionId:e.authoredCompositionId,runtimeCompositionId:e.runtimeCompositionId,hostCompositionSrc:e.hostCompositionSrc,resolvedScriptSrc:m.src,loadStatus:b.status,elapsedMs:b.elapsedMs}})}}}async function xd(e){let t=wa();if(gd(),t.length===0)return;let n=bd(t),r=t.filter(i=>{if(i.hasAttribute("data-composition-src")||i.children.length>0)return!1;let o=n.get(i)?.authoredCompositionId;return o?!!document.querySelector(`template#${CSS.escape(o)}-template`):!1});if(r.length!==0)for(let i of r){let o=n.get(i),a=o?.authoredCompositionId;if(!a)continue;let l=document.querySelector(`template#${CSS.escape(a)}-template`);Aa(i),await Ea({host:i,authoredCompositionId:a,runtimeCompositionId:o?.runtimeCompositionId||a,hostCompositionSrc:`template#${a}-template`,sourceNode:l.content,hasTemplate:!0,fallbackBodyInnerHtml:"",compositionUrl:null,injectedStyles:e.injectedStyles,injectedScripts:e.injectedScripts,injectedLinks:e.injectedLinks,parseDimensionPx:e.parseDimensionPx,onDiagnostic:e.onDiagnostic})}}async function yd(e){let t=wa();if(gd(),t.length===0)return;let n=bd(t),r=t.filter(i=>i.hasAttribute("data-composition-src"));r.length!==0&&await Promise.all(r.map(async i=>{let o=i.getAttribute("data-composition-src");if(!o)return;let a=n.get(i),l=a?.authoredCompositionId||null,s=a?.runtimeCompositionId||l||null,u=null;try{u=new URL(o,document.baseURI)}catch{u=null}Aa(i);try{let c=l!=null?document.querySelector(`template#${CSS.escape(l)}-template`):null;if(c){await Ea({host:i,authoredCompositionId:l,runtimeCompositionId:s,hostCompositionSrc:o,sourceNode:c.content,hasTemplate:!0,fallbackBodyInnerHtml:"",compositionUrl:u,injectedStyles:e.injectedStyles,injectedScripts:e.injectedScripts,injectedLinks:e.injectedLinks,parseDimensionPx:e.parseDimensionPx,onDiagnostic:e.onDiagnostic});return}let f=await fetch(o);if(!f.ok)throw new Error(`HTTP ${f.status}`);let m=await f.text(),b=new DOMParser().parseFromString(m,"text/html");pd(b,u);let v=(l?b.querySelector(`template#${CSS.escape(l)}-template`):null)??b.querySelector("template"),x=v?v.content:b.body;await Ea({host:i,authoredCompositionId:l,runtimeCompositionId:s,hostCompositionSrc:o,sourceNode:x,hasTemplate:!!v,fallbackBodyInnerHtml:b.body.innerHTML,compositionUrl:u,injectedStyles:e.injectedStyles,injectedScripts:e.injectedScripts,injectedLinks:e.injectedLinks,parseDimensionPx:e.parseDimensionPx,head:b.head,declaredVariableDefaults:bn(b.documentElement),variableDeclarer:b.documentElement,onDiagnostic:e.onDiagnostic})}catch(c){e.onDiagnostic?.({code:"external_composition_load_failed",details:{hostCompositionId:l,runtimeCompositionId:s,hostCompositionSrc:o,errorMessage:c instanceof Error?c.message:"unknown_error"}}),Aa(i)}}))}function ub(e,t,n){let i={...e.declaredVariableDefaults??(t instanceof Element?bn(t):{}),...Xs(e.host)};eo(e.variableDeclarer??(t instanceof Element?t:null),i,n),Ks(e.host),Object.keys(i).length>0?(window.__hfVariablesByComp||(window.__hfVariablesByComp={}),window.__hfVariablesByComp[n]=i,to(e.host,{...js(e.host,i,window),...Rr()})):window.__hfVariablesByComp&&delete window.__hfVariablesByComp[n]}function Ca(e){let n=e.vars.data?.captionState;return n==="dim"||n==="active"?n:void 0}function cb(e){return e instanceof HTMLElement?e.dataset.captionWrapper!=="true"?e:e.querySelector(":scope > span")??null:null}function db(){let e=[],t=document.querySelectorAll(".caption-group");for(let n of t)for(let r of n.children){if(!(r instanceof HTMLElement))continue;let i=r.dataset.captionWrapper==="true"?r.querySelector(":scope > span"):r.tagName==="SPAN"?r:null;i&&e.push(i)}return e}function fb(e){let t=e.parentElement;if(t?.dataset.captionWrapper==="true")return t;let n=document.createElement("span");return n.style.display="inline-block",n.dataset.captionWrapper="true",e.parentNode?.insertBefore(n,e),n.appendChild(e),n}function _a(){let e=window.gsap;e&&document.querySelectorAll(".caption-group").length!==0&&fetch("caption-overrides.json").then(t=>t.ok?t.json():null).then(t=>{if(!t||!Array.isArray(t)||t.length===0)return;let n=db();for(let r of t){let i=null;if(r.wordId&&(i=cb(document.getElementById(r.wordId))),!i&&r.wordIndex!==void 0&&(i=n[r.wordIndex]??null),!i)continue;let o={},a={};if(r.x!==void 0&&(o.x=r.x),r.y!==void 0&&(o.y=r.y),r.scale!==void 0&&(o.scale=r.scale),r.rotation!==void 0&&(o.rotation=r.rotation),r.opacity!==void 0&&(a.opacity=r.opacity),r.fontSize!==void 0&&(a.fontSize=`${r.fontSize}px`),r.fontWeight!==void 0&&(a.fontWeight=r.fontWeight),r.fontFamily!==void 0&&(a.fontFamily=r.fontFamily),r.activeColor||r.dimColor){let s=e.getTweensOf(i).filter(f=>f.vars.color!==void 0).sort((f,m)=>f.startTime()-m.startTime()),u=s.find(f=>Ca(f)==="dim")??s.find(f=>Ca(f)===void 0),c=u?String(u.vars.color):"";for(let f of s)(Ca(f)??(String(f.vars.color)===c?"dim":"active"))==="dim"?r.dimColor&&(f.vars.color=r.dimColor):r.activeColor&&(f.vars.color=r.activeColor);r.dimColor&&e.set(i,{color:r.dimColor})}if(Object.keys(a).length>0&&e.set(i,a),Object.keys(o).length>0){let l=fb(i);e.set(l,o)}}}).catch(()=>{})}var Ra="data-hf-edit-base-x",ka="data-hf-edit-base-y",en="data-hf-edit-original-translate",fi=e=>{let t=parseFloat(e??"");return Number.isFinite(t)?t:0},mb=e=>{let t=[],n=0,r="";for(let i of e.trim())i==="("&&(n+=1),i===")"&&(n=Math.max(0,n-1)),/\\s/.test(i)&&n===0?(r&&t.push(r),r=""):r+=i;return r&&t.push(r),t},vd=/^-?(?:\\d+(?:\\.\\d+)?|\\.\\d+)px$/,Ta=(e,t)=>vd.test(e)&&vd.test(t)?`${parseFloat(e)+parseFloat(t)}px`:`calc(${e} + ${t})`,pb=(e,t,n)=>{if(!e||e==="none")return`${t} ${n}`;let[r,i,o]=mb(e);if(r===void 0)return`${t} ${n}`;if(i===void 0)return`${Ta(r,t)} ${n}`;let a=o===void 0?"":` ${o}`;return`${Ta(r,t)} ${Ta(i,n)}${a}`},hb=e=>{try{e.ownerDocument.defaultView?.gsap?.getProperty?.(e,"x")}catch{}},gb=e=>{let t=e.style.getPropertyValue("translate").trim();if(t)return t==="none"?"":t;try{let n=e.ownerDocument.defaultView,r=n?n.getComputedStyle(e).getPropertyValue("translate").trim():"";return r==="none"?"":r}catch{return""}},Ma=new WeakMap;function bb(e,t){let n=Ma.get(e);if(!t?.force&&n!==void 0&&e.style.getPropertyValue("translate")!==n){Ne("position_edit_fold_skipped",{hfId:e.getAttribute("data-hf-id")});return}let r=fi(e.getAttribute("data-x"))-fi(e.getAttribute(Ra)),i=fi(e.getAttribute("data-y"))-fi(e.getAttribute(ka));e.hasAttribute(en)||e.setAttribute(en,gb(e)),n===void 0&&hb(e);let o=e.getAttribute(en)??"",a=pb(o,`${r}px`,`${i}px`);e.style.setProperty("translate",a),Ma.set(e,e.style.getPropertyValue("translate"))}function mi(e,t){let n=e.defaultView?.HTMLElement,r=e.defaultView?.SVGElement,i=s=>n||r?n!==void 0&&s instanceof n||r!==void 0&&s instanceof r:typeof s.style?.setProperty=="function",o=e.querySelectorAll(`[${en}]:not([${Ra}]):not([${ka}])`);for(let s=0;s{try{mi(t.document)}catch{}},r=f=>typeof f=="function"&&(Ad.has(f)||!!f[Sd]),i=f=>{Ad.add(f);try{Object.defineProperty(f,Sd,{value:!0})}catch{}},o=f=>{if(typeof f!="function"||r(f))return f;let m=function(...p){let b=f.apply(this,p);return n(),b};return i(m),m},a=(f,m)=>{let p=Ed.get(f);if(p?.has(m))return!0;let b=Object.getOwnPropertyDescriptor(f,m);if(b?.configurable===!1){let _=f[m];return typeof _=="function"&&(f[m]=o(_),n()),!1}let v=f[m],x=b?.set;return Object.defineProperty(f,m,{configurable:!0,enumerable:b?.enumerable??!0,get:()=>v,set:_=>{v=o(_),x?.call(f,_)}}),v=o(v),p??(p=new Set),p.add(m),Ed.set(f,p),n(),!0},l=(f,m)=>{let p=wd.get(t),b=Object.getOwnPropertyDescriptor(t,f);if(!p?.has(f)){if(b?.configurable===!1){let _=t[f];return _?a(_,m):!1}let x=t[f];Object.defineProperty(t,f,{configurable:!0,enumerable:b?.enumerable??!0,get:()=>x,set:_=>{x=_,x&&a(x,m)}}),p??(p=new Set),p.add(f),wd.set(t,p)}let v=t[f];return v?a(v,m):!1},s=()=>{let f=l("__hf","seek"),m=l("__player","renderSeek");return f&&m};if(s())return;let u=120,c=t.setInterval(()=>{if(s()){t.clearInterval(c);return}u-=1,u<=0&&t.clearInterval(c)},50)}function pi(e){let t=window,r=e.closest("[data-composition-id]")?.getAttribute("data-composition-id")?.trim()??"",i=r?t.__hfVariablesByComp?.[r]:void 0;if(i)return i;let o=t.__hyperframes?.getVariables?.();return o&&typeof o=="object"?o:t.__hfVariables??{}}function hi(e){return typeof e=="string"||typeof e=="number"||typeof e=="boolean"}function Fa(e){let t=e.replace(/[\\u0000-\\u0020]/g,""),n=/^([a-z][a-z0-9+.-]*):/i.exec(t);if(!n)return!0;let r=n[1]?.toLowerCase();return r?r==="https"||r==="http"||r==="blob"?!0:r==="data"?/^data:image\\//i.test(t):!1:!1}var _d=new Set(["img","video","audio","source"]);function xb(e){if(typeof e=="string"&&e.length>0)return e;if(e!==null&&typeof e=="object"){let t=e.url;if(typeof t=="string"&&t.length>0)return t}return null}function yb(e){return e.replace(/[;{}<>\\r\\n]/g,"")}function vb(e){if(hi(e))return String(e);if(e!==null&&typeof e=="object"){let t=e.name;if(typeof t=="string"&&t.length>0)return t}return null}function Na(e,t){let n=e.closest("[data-composition-id]"),r=t.get(n);if(r)return r;let i=pi(e);return t.set(n,i),i}function Sb(e,t){if(e.childElementCount===0){e.textContent=t;return}let n=!1;for(let r of Array.from(e.childNodes))r.nodeType===Node.TEXT_NODE&&(r.nodeValue=n?"":t,n=!0);n||e.insertBefore(e.ownerDocument.createTextNode(t),e.firstChild)}function Ab(e){return e.querySelector("[data-hf-root]")??e.getElementById("stage")??e.body?.firstElementChild??e.body}function Eb(e,t){let n=new Set,r=Ab(e);r&&n.add(r);for(let i of Array.from(e.querySelectorAll("[data-composition-id]")))n.add(i);for(let i of n){let o=Na(i,t);for(let[a,l]of Object.entries(o)){let s=vb(l);s!==null&&i instanceof HTMLElement&&i.style.setProperty(`--${a}`,yb(s))}}}function La(e){let t=new Map;Eb(e,t);for(let n of Array.from(e.querySelectorAll("[data-var-src]"))){let r=n.getAttribute("data-var-src")?.trim();if(!r)continue;if(!_d.has(n.tagName.toLowerCase())){console.warn(`[hyperframes] Ignoring data-var-src on <${n.tagName.toLowerCase()}>: variable-bound src is only allowed on ${Array.from(_d).join("/")}.`);continue}let i=xb(Na(n,t)[r]);if(i!==null){if(!Fa(i)){console.warn(`[hyperframes] Ignoring data-var-src="${r}": unsafe URL protocol.`);continue}n.setAttribute("src",i)}}for(let n of Array.from(e.querySelectorAll("[data-var-text]"))){let r=n.getAttribute("data-var-text")?.trim();if(!r)continue;let i=Na(n,t)[r];hi(i)&&Sb(n,String(i))}}var rt=new Map,wb="data-hf-color-grading-canvas",Cb="__hf_color_grading_canvas__";function Od(){if(typeof MutationObserver>"u"||typeof document>"u")return;let e=document.documentElement;if(!e)return;let t=r=>{r instanceof HTMLElement&&(r.hasAttribute($r)||r.setAttribute($r,r.style.opacity))},n=r=>{if(r instanceof Element){r.matches("video, img")&&t(r);for(let i of r.querySelectorAll("video, img"))t(i)}};n(e),new MutationObserver(r=>{for(let i of r)for(let o of i.addedNodes)n(o)}).observe(e,{childList:!0,subtree:!0})}var _b=16,Tb=4,nn={enabled:!1,position:.5,softness:0,lineWidth:2},Da=["#000000","#ffffff"],Rb=["#1a1a1a","#f5f5dc"],sr=3,kb=sr-1,Mb=5,Ia=`${je}.0`,Td=`${je-1}.0`,Fb=`${sr}.0`,Nb=`${(kb+.5)/sr}`;function gi(e){let t=e.getAttribute(Fn);return t==null?null:bu(t,pi(e))}var Lb=["attribute vec2 a_pos;","varying vec2 v_uv;","void main(){"," v_uv = a_pos * 0.5 + 0.5;"," gl_Position = vec4(a_pos, 0.0, 1.0);","}"].join(`\n`),Db=["#ifdef GL_FRAGMENT_PRECISION_HIGH","precision highp float;","#else","precision mediump float;","#endif","varying vec2 v_uv;","uniform sampler2D u_source;","uniform sampler2D u_blurSource;","uniform sampler2D u_bloomSource;","uniform sampler2D u_kuwaharaSource;","uniform sampler2D u_lut;","uniform sampler2D u_advanced;","uniform vec2 u_resolution;","uniform vec2 u_uvScale;","uniform vec2 u_uvOffset;","uniform float u_blurReady;","uniform float u_bloomReady;","uniform float u_kuwaharaReady;","uniform float u_lutEnabled;","uniform float u_lutSize;","uniform vec2 u_lutTextureSize;","uniform vec3 u_lutDomainMin;","uniform vec3 u_lutDomainMax;","uniform float u_lutIntensity;","uniform vec3 u_shadowWheel;","uniform vec3 u_midtoneWheel;","uniform vec3 u_highlightWheel;","uniform float u_rgbCurvesEnabled;","uniform float u_hueCurvesEnabled;","uniform float u_secondaryCount;","uniform float u_exposure;","uniform float u_contrast;","uniform float u_highlights;","uniform float u_shadows;","uniform float u_whites;","uniform float u_blacks;","uniform float u_temperature;","uniform float u_tint;","uniform float u_vibrance;","uniform float u_saturation;","uniform float u_vignette;","uniform float u_vignetteMidpoint;","uniform float u_vignetteRoundness;","uniform float u_vignetteFeather;","uniform float u_grain;","uniform float u_grainSize;","uniform float u_grainRoughness;","uniform float u_grainSeed;","uniform float u_effectTime;","uniform float u_blur;","uniform float u_bloom;","uniform float u_kuwahara;","uniform float u_pixelate;","uniform float u_chromaBleed;","uniform float u_tapeDamage;","uniform float u_tapeTracking;","uniform float u_tapeNoise;","uniform float u_tapeSpeed;","uniform float u_filmArtifacts;","uniform float u_halftone;","uniform float u_halftoneSize;","uniform float u_twoInkPrint;","uniform float u_twoInkPrintSize;","uniform float u_ascii;","uniform float u_asciiSize;","uniform float u_asciiInvert;","uniform float u_asciiStyle;","uniform float u_asciiColor;","uniform float u_asciiRotation;","uniform float u_dither;","uniform float u_ditherSize;","uniform float u_monoScreen;","uniform float u_monoScreenSize;","uniform float u_monoScreenAngle;","uniform float u_monoScreenSpread;","uniform float u_monoScreenShape;","uniform float u_monoScreenInvert;","uniform float u_scanlines;","uniform float u_scanlineCount;","uniform float u_scanlineSoftness;","uniform float u_chromaticAberration;","uniform float u_chromaticAngle;","uniform float u_crtCurvature;","uniform float u_digitalGlitch;","uniform float u_digitalGlitchColorSplit;","uniform float u_digitalGlitchLineTear;","uniform float u_digitalGlitchPixelate;","uniform float u_digitalGlitchBlockAmount;","uniform float u_digitalGlitchBlockDisplacement;","uniform float u_digitalGlitchBlockOpacity;","uniform float u_digitalGlitchSpeed;","uniform float u_engraving;","uniform float u_engravingSpacing;","uniform float u_engravingMinThickness;","uniform float u_engravingMaxThickness;","uniform float u_engravingAngle;","uniform float u_engravingContrast;","uniform float u_engravingSharpness;","uniform float u_engravingWave;","uniform float u_engravingWaveFrequency;","uniform float u_crosshatch;","uniform float u_crosshatchSpacing;","uniform float u_crosshatchThickness;","uniform float u_crosshatchAngle;","uniform float u_crosshatchContrast;","uniform float u_crosshatchEdges;","uniform float u_crosshatchLineWeight;","uniform float u_crosshatchWave;","uniform float u_crosshatchWaveFrequency;","uniform float u_paletteSize;","uniform vec3 u_palette0;","uniform vec3 u_palette1;","uniform vec3 u_palette2;","uniform vec3 u_palette3;","uniform vec3 u_palette4;","uniform vec3 u_palette5;","uniform float u_intensity;","uniform float u_compareEnabled;","uniform float u_comparePosition;","uniform float u_compareSoftness;","uniform float u_compareLineWidth;","const float PI = 3.14159265359;","float lumaOf(vec3 c){ return dot(c, vec3(0.2126, 0.7152, 0.0722)); }","float bt601Luma(vec3 c){ return dot(c, vec3(0.299, 0.587, 0.114)); }","float grainHash(vec2 p){ return fract(sin(dot(p, vec2(127.1, 311.7))) * 43758.5453123); }","float digitalHash(vec2 p){"," vec2 q = mod(floor(p), 251.0);"," float x = mod(q.x * q.x * 157.0 + q.x * 89.0, 251.0);"," float y = mod(q.y * q.y * 113.0 + q.y * 47.0, 251.0);"," float xy = mod(q.x * q.y * 71.0, 251.0);"," return mod(x + y + xy + 19.0, 251.0) / 251.0;","}","float colorSaturation(vec3 c){ return max(max(c.r, c.g), c.b) - min(min(c.r, c.g), c.b); }","vec2 clampUv(vec2 uv){ return clamp(uv, vec2(0.0), vec2(1.0)); }","vec2 applyCrtWarp(vec2 uv){"," vec2 centered = uv * 2.0 - 1.0;"," float curvature = clamp(u_crtCurvature, 0.0, 1.0) * 0.5;"," float dist = dot(centered, centered);"," centered *= 1.0 + curvature * dist;"," return centered * 0.5 + 0.5;","}","vec4 sampleSource(vec2 uv){ return texture2D(u_source, clampUv(uv)); }","vec4 sampleBlur(vec2 uv){ return texture2D(u_blurSource, clampUv(uv)); }","vec3 sampleBloom(vec2 uv){ return texture2D(u_bloomSource, clampUv(uv)).rgb; }","vec3 sampleKuwahara(vec2 uv){"," vec2 displayUv = uv * u_uvScale + u_uvOffset;"," return texture2D(u_kuwaharaSource, clampUv(displayUv)).rgb;","}","vec4 samplePrepared(vec2 uv){"," vec4 base = sampleSource(uv);"," float blur = clamp(u_blur, 0.0, 1.0);"," if (blur > 0.0 && u_blurReady > 0.5) base = mix(base, sampleBlur(uv), blur);"," float kuwahara = clamp(u_kuwahara, 0.0, 1.0);"," if (kuwahara > 0.0 && u_kuwaharaReady > 0.5) {"," base.rgb = mix(base.rgb, sampleKuwahara(uv), kuwahara);"," }"," return base;","}","float tapeTrackingBand(float y, float center, float width){"," float offset = fract(y - center + 0.5) - 0.5;"," float triangle = max(0.0, 1.0 - abs(offset) / max(width, 0.0001));"," return triangle * triangle * (3.0 - 2.0 * triangle);","}","vec4 sampleMedia(vec2 uv){"," float pixel = clamp(u_pixelate, 0.0, 1.0);"," vec2 sampleUv = uv;"," if (pixel > 0.0) {"," float blockSize = mix(1.0, 48.0, pixel);"," vec2 cells = max(u_resolution / blockSize, vec2(1.0));"," sampleUv = (floor(clamp(uv, vec2(0.0), vec2(0.999999)) * cells) + 0.5) / cells;"," }"," float tapeDamage = clamp(u_tapeDamage, 0.0, 1.0);"," float tapeTracking = clamp(u_tapeTracking, 0.0, 1.0);"," float tapeNoise = clamp(u_tapeNoise, 0.0, 1.0);"," float tapeTime = u_effectTime * mix(0.0, 2.0, clamp(u_tapeSpeed, 0.0, 1.0));"," float tapeFrame = floor(tapeTime * 60.0);"," float tapeLine = floor(sampleUv.y * u_resolution.y * 0.5);"," float lineJitter = (digitalHash(vec2(tapeLine, floor(tapeFrame * 0.5))) - 0.5) * 1.8 * tapeNoise;"," float slowWobble = sin(sampleUv.y * 32.0 + tapeTime * 2.6) * 0.55;"," float headSwitch = smoothstep(0.88, 1.0, sampleUv.y) * sin(sampleUv.y * 240.0 + tapeTime * 8.0) * 4.0;"," float trackingShift = tapeTrackingBand(sampleUv.y, fract(0.08 + tapeTime * 0.083), 0.035);"," trackingShift -= tapeTrackingBand(sampleUv.y, fract(0.28 + tapeTime * 0.061), 0.03) * 0.8;"," trackingShift += tapeTrackingBand(sampleUv.y, fract(0.5 + tapeTime * 0.047), 0.04) * 0.75;"," trackingShift -= tapeTrackingBand(sampleUv.y, fract(0.72 + tapeTime * 0.037), 0.028) * 0.65;"," trackingShift += tapeTrackingBand(sampleUv.y, fract(0.89 + tapeTime * 0.029), 0.032) * 0.55;"," trackingShift *= tapeTracking * 48.0;"," float tapeShift = (lineJitter + slowWobble + headSwitch + trackingShift) * tapeDamage;"," float texelX = 1.0 / max(u_resolution.x * max(u_uvScale.x, 0.00001), 1.0);"," vec2 tapeUv = sampleUv + vec2(tapeShift * texelX, 0.0);"," vec4 base = samplePrepared(tapeUv);"," if (tapeDamage > 0.0) {"," vec2 lumaStep = vec2(texelX * mix(1.0, 3.5, tapeDamage), 0.0);"," vec3 leftTape = samplePrepared(tapeUv - lumaStep).rgb;"," vec3 rightTape = samplePrepared(tapeUv + lumaStep).rgb;"," float tapeLuma = (bt601Luma(leftTape) + bt601Luma(base.rgb) * 2.0 + bt601Luma(rightTape)) * 0.25;"," vec3 centerChroma = base.rgb - vec3(bt601Luma(base.rgb));"," vec3 tapeColor = vec3(tapeLuma) + centerChroma;"," vec3 ghost = samplePrepared(tapeUv - vec2(texelX * 12.0, 0.0)).rgb;"," tapeColor = mix(tapeColor, ghost, 0.045 * tapeDamage);"," float fineNoise = digitalHash(floor(gl_FragCoord.xy) + vec2(tapeFrame * 17.0, tapeFrame * 3.0)) - 0.5;"," float band = digitalHash(vec2(floor(sampleUv.y * 92.0), floor(tapeFrame / 3.0)));"," float dropout = smoothstep(0.985, 1.0, band) * (digitalHash(vec2(floor(sampleUv.x * 18.0), tapeLine)) - 0.5);"," tapeColor += (fineNoise * 0.035 + dropout * 0.12) * tapeDamage * tapeNoise;"," base.rgb = mix(base.rgb, clamp(tapeColor, 0.0, 1.0), tapeDamage);"," }"," float chromaBleed = clamp(u_chromaBleed, 0.0, 1.0);"," if (chromaBleed > 0.0) {"," float radius = mix(1.0, 4.0, chromaBleed);"," vec2 stepUv = vec2(texelX * radius, 0.0);"," vec3 c0 = base.rgb;"," vec3 c1 = samplePrepared(tapeUv - stepUv).rgb;"," vec3 c2 = samplePrepared(tapeUv + stepUv).rgb;"," vec3 c3 = samplePrepared(tapeUv - stepUv * 2.0).rgb;"," vec3 c4 = samplePrepared(tapeUv + stepUv * 2.0).rgb;"," float centerLuma = lumaOf(base.rgb);"," vec3 blurredChroma = ((c0 - vec3(lumaOf(c0))) * 6.0 + (c1 - vec3(lumaOf(c1))) * 4.0 + (c2 - vec3(lumaOf(c2))) * 4.0 + (c3 - vec3(lumaOf(c3))) + (c4 - vec3(lumaOf(c4)))) / 16.0;"," base.rgb = mix(base.rgb, clamp(vec3(centerLuma) + blurredChroma, 0.0, 1.0), chromaBleed);"," }"," return base;","}","vec4 sampleChromaticMedia(vec2 uv, vec4 center){"," float amount = clamp(u_chromaticAberration, 0.0, 1.0);"," if (amount <= 0.0) return center;"," float angle = clamp(u_chromaticAngle, 0.0, 1.0) * PI * 2.0;"," vec2 offset = vec2(cos(angle), sin(angle)) * amount * 0.02;"," vec4 positive = sampleMedia(uv + offset);"," vec4 negative = sampleMedia(uv - offset);"," vec3 split = vec3(positive.r, center.g, negative.b);"," return vec4(split, center.a);","}","vec3 sampleDigitalSplit(vec2 uv, vec2 block, float time, float amount){"," float split = amount * 0.06;"," float direction = digitalHash(block * 0.4 + vec2(floor(time * 3.7), floor(time * 5.3)));"," vec2 axis = direction > 0.66 ? vec2(1.0, 0.0) : direction > 0.33 ? vec2(0.0, 1.0) : vec2(0.7071);"," vec4 center = sampleMedia(uv);"," return vec3(sampleMedia(uv + axis * split).r, center.g, sampleMedia(uv - axis * split).b);","}","vec3 applyDigitalGlitch(vec2 uv, vec3 source){"," float amount = clamp(u_digitalGlitch, 0.0, 1.0);"," if (amount <= 0.0) return source;"," float colorSplit = clamp(u_digitalGlitchColorSplit, 0.0, 1.0) * 2.0;"," float lineTear = clamp(u_digitalGlitchLineTear, 0.0, 1.0) * 2.0;"," float pixelate = clamp(u_digitalGlitchPixelate, 0.0, 1.0) * 2.0;"," float blockAmount = clamp(u_digitalGlitchBlockAmount, 0.0, 1.0);"," float blockDisplacement = clamp(u_digitalGlitchBlockDisplacement, 0.0, 1.0) * 2.0;"," float blockOpacity = clamp(u_digitalGlitchBlockOpacity, 0.0, 1.0);"," float speed = clamp(u_digitalGlitchSpeed, 0.0, 1.0) * 2.0;"," float time = u_effectTime * speed;"," float blockCount = 8.0 + blockAmount * 60.0;"," vec2 block = floor(uv * blockCount);"," float randomA = digitalHash(block + vec2(floor(time * 7.3), floor(time * 11.1)));"," float randomB = digitalHash(block * 0.7 + vec2(17.3 + floor(time * 6.6), 29.1));"," float randomC = digitalHash(block + vec2(floor(time * 5.7) * 13.0, 41.0));"," float randomD = digitalHash(block * 1.3 + vec2(7.0, floor(time * 3.2) * 7.0));"," vec2 displaced = uv;"," if (blockDisplacement > 0.0 && blockOpacity > 0.0) {"," float threshold = 1.0 - blockDisplacement * 0.4;"," if (randomA > threshold) {"," displaced += vec2((randomB - 0.5) * blockDisplacement * 0.5, (randomC - 0.5) * blockDisplacement * 0.3);"," }"," if (randomD > 0.92 && blockDisplacement > 0.5) {"," displaced.x += (digitalHash(vec2(block.y, floor(time * 8.0))) - 0.5) * blockDisplacement;"," }"," displaced = mix(uv, displaced, blockOpacity);"," }"," if (lineTear > 0.0) {"," float row = floor(uv.y * (50.0 + lineTear * 150.0));"," float tearA = digitalHash(vec2(row * 7.3 + floor(time * 12.0 + row * 0.1) * 3.7, 13.0));"," float tearB = digitalHash(vec2(row * 13.7 + floor(time * 8.3) * 5.1, 31.0));"," if (tearA > 1.0 - lineTear * 0.5) displaced.x += (tearB - 0.5) * lineTear * 0.4;"," if (tearB > 0.95 && lineTear > 0.3) displaced.x += (tearA - 0.5) * lineTear * 0.8;"," }"," if (pixelate > 0.0) {"," float pixelRandom = digitalHash(block * 0.5 + vec2(floor(time * 4.9), 53.0));"," if (pixelRandom > 1.0 - pixelate * 0.35) {"," float cells = 4.0 + (1.0 - pixelRandom) * pixelate * 40.0;"," displaced = (floor(clampUv(displaced) * cells) + 0.5) / cells;"," }"," }"," displaced = clampUv(displaced);"," vec3 glitch = sampleDigitalSplit(displaced, block, time, colorSplit);"," if (blockDisplacement > 0.2 && blockOpacity > 0.0) {"," float corruption = digitalHash(block * 1.1 + vec2(floor(time * 11.9), 67.0));"," vec3 changed = glitch;"," if (corruption > 0.9) changed = 1.0 - glitch;"," else if (corruption > 0.85) changed = corruption > 0.875 ? glitch.gbr : glitch.brg;"," else if (corruption > 0.8) {"," float channel = digitalHash(block + vec2(73.0));"," if (channel > 0.66) changed.r = min(changed.r * 2.0, 1.0);"," else if (channel > 0.33) changed.g = min(changed.g * 2.0, 1.0);"," else changed.b = min(changed.b * 2.0, 1.0);"," }"," glitch = mix(glitch, changed, blockOpacity);"," }"," if (blockOpacity > 0.0) {"," float flash = digitalHash(block * 0.8 + vec2(floor(time * 14.7), 83.0));"," vec3 flashed = flash > 0.97 ? min(glitch * 1.8, vec3(1.0)) : flash > 0.94 ? glitch * 0.3 : glitch;"," glitch = mix(glitch, flashed, blockOpacity * 0.6);"," }"," if (lineTear > 0.1) {"," float interference = pow(sin(uv.y * (300.0 + randomA * 200.0) + time * 30.0) * 0.5 + 0.5, 6.0);"," glitch -= interference * 0.08 * lineTear;"," }"," return mix(source, clamp(glitch, 0.0, 1.0), amount);","}","float dustMask(vec2 uv, float frameBucket){"," vec2 grid = vec2(128.0, 72.0);"," vec2 cell = floor(uv * grid);"," vec2 local = fract(uv * grid) - 0.5;"," float chance = grainHash(cell + frameBucket * 19.13);"," float radius = mix(0.05, 0.34, grainHash(cell + 7.1));"," return step(0.9975, chance) * (1.0 - smoothstep(radius, radius + 0.08, length(local)));","}","float screenDot(vec2 p, float ink, float angle, float sharpness){"," float c = cos(angle);"," float s = sin(angle);"," vec2 q = mat2(c, -s, s, c) * p;"," vec2 d = fract(q) - 0.5;"," float radius = sqrt(clamp(ink, 0.0, 1.0)) * 0.68;"," float edge = mix(0.16, 0.025, sharpness);"," return 1.0 - smoothstep(radius - edge, radius + edge, length(d));","}","vec3 paletteColor(float index);","float monoScreenMask(vec2 local, float radius, float shape, float softness){"," vec2 centered = local - 0.5;"," float distanceToInk = length(centered);"," if (shape > 0.5 && shape < 1.5) distanceToInk = max(abs(centered.x), abs(centered.y));"," if (shape > 1.5 && shape < 2.5) distanceToInk = abs(centered.x) + abs(centered.y);"," if (shape > 2.5 && shape < 3.5) distanceToInk = max(abs(centered.x) * 0.86 + centered.y * 0.5, -centered.y);"," if (shape > 3.5) distanceToInk = abs(centered.y);"," float shapeRadius = shape > 3.5 ? radius * 0.45 : radius;"," return 1.0 - smoothstep(shapeRadius, shapeRadius + softness, distanceToInk);","}","vec3 applyMonoScreen(vec3 source, float amount){"," if (amount <= 0.0) return source;"," float invert = step(0.5, u_monoScreenInvert);"," float coverage = mix(1.0 - lumaOf(source), lumaOf(source), invert);"," coverage = pow(clamp(coverage, 0.0, 1.0), mix(1.7, 0.58, clamp(u_monoScreenSpread, 0.0, 1.0)));"," float scale = max(min(u_resolution.x, u_resolution.y) / 540.0, 0.25);"," float cellPx = mix(4.0, 18.0, clamp(u_monoScreenSize, 0.0, 1.0)) * scale;"," float angle = clamp(u_monoScreenAngle, 0.0, 1.0) * PI * 0.5;"," float cosine = cos(angle);"," float sine = sin(angle);"," vec2 point = mat2(cosine, -sine, sine, cosine) * gl_FragCoord.xy / max(cellPx, 1.0);"," float radius = sqrt(coverage) * 0.68;"," float inkMask = monoScreenMask(fract(point), radius, floor(u_monoScreenShape + 0.5), 0.035);"," vec3 ink = paletteColor(0.0);"," vec3 paper = paletteColor(max(u_paletteSize - 1.0, 1.0));"," return mix(source, mix(paper, ink, inkMask), amount);","}","vec3 applyEngraving(vec3 source, float amount){"," if (amount <= 0.0) return source;"," float spacing = mix(3.0, 20.0, clamp(u_engravingSpacing, 0.0, 1.0));"," float minThickness = mix(0.0, 2.0, clamp(u_engravingMinThickness, 0.0, 1.0));"," float maxThickness = mix(1.0, 8.0, clamp(u_engravingMaxThickness, 0.0, 1.0));"," float angle = clamp(u_engravingAngle, 0.0, 1.0) * PI;"," vec2 alongAxis = vec2(cos(angle), sin(angle));"," vec2 acrossAxis = vec2(-alongAxis.y, alongAxis.x);"," float along = dot(gl_FragCoord.xy, alongAxis);"," float across = dot(gl_FragCoord.xy, acrossAxis);"," float frequency = mix(1.0, 10.0, clamp(u_engravingWaveFrequency, 0.0, 1.0));"," float wave = sin(along * frequency * 0.01);"," across += wave * clamp(u_engravingWave, 0.0, 1.0) * 3.0;"," float lineIndex = floor(across / max(spacing, 1.0));"," float lineDistance = abs(fract(across / max(spacing, 1.0)) - 0.5) * spacing;"," float contrast = mix(0.5, 2.0, clamp(u_engravingContrast, 0.0, 1.0));"," float darkness = 1.0 - pow(clamp(lumaOf(source), 0.0, 1.0), contrast);"," float variation = mix(0.88, 1.12, digitalHash(vec2(lineIndex, 73.0)));"," float thickness = mix(minThickness, maxThickness, darkness) * variation;"," float edge = mix(1.0, 0.3, clamp(u_engravingSharpness, 0.0, 1.0));"," float inkMask = 1.0 - smoothstep(max(thickness * 0.5 - edge, 0.0), thickness * 0.5 + edge, lineDistance);"," inkMask *= smoothstep(0.015, 0.12, darkness);"," vec3 ink = paletteColor(0.0);"," vec3 paper = paletteColor(max(u_paletteSize - 1.0, 1.0));"," return mix(source, mix(paper, ink, inkMask), amount);","}","float crosshatchLine(vec2 pixel, float angle, float spacing, float thickness, float seed){"," vec2 alongAxis = vec2(cos(angle), sin(angle));"," vec2 acrossAxis = vec2(-alongAxis.y, alongAxis.x);"," float along = dot(pixel, alongAxis);"," float across = dot(pixel, acrossAxis);"," float frequency = mix(1.0, 10.0, clamp(u_crosshatchWaveFrequency, 0.0, 1.0));"," across += sin(along * frequency * 0.02 + u_effectTime + seed) * clamp(u_crosshatchWave, 0.0, 1.0) * 5.0;"," float lineIndex = floor(across / max(spacing, 1.0));"," float distanceToLine = abs(fract(across / max(spacing, 1.0)) - 0.5) * spacing;"," float variation = mix(1.0, 0.5 + digitalHash(vec2(lineIndex, seed)), clamp(u_crosshatchLineWeight, 0.0, 1.0));"," float halfWidth = thickness * variation * 0.5;"," return 1.0 - smoothstep(max(halfWidth - 0.5, 0.0), halfWidth + 0.5, distanceToLine);","}","float crosshatchEdge(vec2 uv){"," vec2 texel = 1.0 / max(u_resolution * u_uvScale, vec2(1.0));"," float tl = lumaOf(sampleMedia(uv + texel * vec2(-1.0, -1.0)).rgb);"," float tc = lumaOf(sampleMedia(uv + texel * vec2( 0.0, -1.0)).rgb);"," float tr = lumaOf(sampleMedia(uv + texel * vec2( 1.0, -1.0)).rgb);"," float ml = lumaOf(sampleMedia(uv + texel * vec2(-1.0, 0.0)).rgb);"," float mr = lumaOf(sampleMedia(uv + texel * vec2( 1.0, 0.0)).rgb);"," float bl = lumaOf(sampleMedia(uv + texel * vec2(-1.0, 1.0)).rgb);"," float bc = lumaOf(sampleMedia(uv + texel * vec2( 0.0, 1.0)).rgb);"," float br = lumaOf(sampleMedia(uv + texel * vec2( 1.0, 1.0)).rgb);"," float gx = -tl - 2.0 * ml - bl + tr + 2.0 * mr + br;"," float gy = -tl - 2.0 * tc - tr + bl + 2.0 * bc + br;"," return length(vec2(gx, gy));","}","vec3 applyCrosshatch(vec2 uv, vec3 source, float amount){"," if (amount <= 0.0) return source;"," float spacing = mix(5.0, 30.0, clamp(u_crosshatchSpacing, 0.0, 1.0));"," float thickness = mix(1.0, 5.0, clamp(u_crosshatchThickness, 0.0, 1.0));"," float baseAngle = -clamp(u_crosshatchAngle, 0.0, 1.0) * PI;"," float contrast = mix(0.5, 2.0, clamp(u_crosshatchContrast, 0.0, 1.0));"," float darkness = 1.0 - pow(clamp(lumaOf(source), 0.0, 1.0), contrast);"," vec3 ink = paletteColor(0.0);"," vec3 paper = paletteColor(max(u_paletteSize - 1.0, 1.0));"," vec3 result = paper;"," float layer = crosshatchLine(gl_FragCoord.xy, baseAngle, spacing, thickness, 1.0) * smoothstep(0.2, 0.4, darkness);"," result = mix(result, ink, layer);"," layer = crosshatchLine(gl_FragCoord.xy, baseAngle + PI * 0.5, spacing * 0.95, thickness * 0.9, 2.0) * smoothstep(0.4, 0.6, darkness);"," result = mix(result, ink, layer);"," layer = crosshatchLine(gl_FragCoord.xy, baseAngle + PI * 0.25, spacing * 0.9, thickness * 0.8, 3.0) * smoothstep(0.6, 0.8, darkness);"," result = mix(result, ink, layer);"," layer = crosshatchLine(gl_FragCoord.xy, baseAngle - PI * 0.25, spacing * 0.85, thickness * 0.7, 4.0) * smoothstep(0.75, 0.9, darkness);"," result = mix(result, ink, layer);"," result = mix(result, ink, smoothstep(0.9, 1.0, darkness) * 0.8);"," float edgeStrength = mix(0.0, 2.0, clamp(u_crosshatchEdges, 0.0, 1.0));"," float edge = smoothstep(0.1, 0.3, crosshatchEdge(uv)) * edgeStrength;"," result = mix(result, ink, clamp(edge, 0.0, 1.0));"," return mix(source, result, amount);","}","vec3 applyHalftone(vec3 source, float amount){"," if (amount <= 0.0) return source;"," vec3 cmy = 1.0 - source;"," float k = min(cmy.r, min(cmy.g, cmy.b));"," vec3 inks = max(cmy - vec3(k * 0.72), 0.0);"," float scale = min(u_resolution.x, u_resolution.y) / 540.0;"," float cellPx = mix(5.0, 14.0, clamp(u_halftoneSize, 0.0, 1.0)) * max(scale, 0.25);"," vec2 p = gl_FragCoord.xy / max(cellPx, 1.0);"," float cyan = screenDot(p, inks.r, 0.261799, 0.78);"," float magenta = screenDot(p, inks.g, 1.308997, 0.78);"," float yellow = screenDot(p, inks.b, 0.0, 0.78);"," float blackInk = screenDot(p, k, 0.785398, 0.82);"," vec3 printColor = vec3(0.975, 0.962, 0.925);"," printColor *= mix(vec3(1.0), vec3(0.05, 0.79, 0.86), cyan);"," printColor *= mix(vec3(1.0), vec3(0.91, 0.08, 0.48), magenta);"," printColor *= mix(vec3(1.0), vec3(0.98, 0.83, 0.08), yellow);"," printColor *= mix(vec3(1.0), vec3(0.035), blackInk * 0.92);"," return mix(source, printColor, amount);","}","vec3 applyTwoInkPrint(vec3 source, float amount){"," if (amount <= 0.0) return source;"," float sourceLuma = lumaOf(source);"," float darkness = 1.0 - sourceLuma;"," float warmBias = clamp(source.r - (source.g + source.b) * 0.5, -0.35, 0.35);"," float coolBias = clamp((source.g + source.b) * 0.5 - source.r, -0.35, 0.35);"," float redTone = smoothstep(0.08, 0.72, darkness) * (1.0 - 0.68 * smoothstep(0.66, 1.0, darkness));"," float tealTone = smoothstep(0.30, 0.92, darkness);"," float redCoverage = clamp(redTone + warmBias * 1.35 - coolBias * 0.35, 0.0, 1.0);"," float tealCoverage = clamp(tealTone + coolBias * 1.1 - warmBias * 0.45, 0.0, 1.0);"," float scale = min(u_resolution.x, u_resolution.y) / 540.0;"," float cellPx = mix(4.5, 12.0, clamp(u_twoInkPrintSize, 0.0, 1.0)) * max(scale, 0.25);"," vec2 p = gl_FragCoord.xy / max(cellPx, 1.0);"," float redDot = screenDot(p, redCoverage, 0.261799, 0.84);"," float tealDot = screenDot(p + vec2(0.12, -0.08), tealCoverage, 1.308997, 0.84);"," float paperNoise = grainHash(floor(gl_FragCoord.xy * 0.5)) - 0.5;"," vec3 paper = vec3(0.955, 0.910, 0.795) + paperNoise * 0.018;"," vec3 vermilion = vec3(0.88, 0.13, 0.075);"," vec3 teal = vec3(0.035, 0.285, 0.355);"," vec3 overprint = vec3(0.045, 0.055, 0.052);"," vec3 printColor = paper * (1.0 - redDot) * (1.0 - tealDot);"," printColor += vermilion * redDot * (1.0 - tealDot);"," printColor += teal * (1.0 - redDot) * tealDot;"," printColor += overprint * redDot * tealDot;"," return mix(source, clamp(printColor, 0.0, 1.0), amount);","}","vec3 paletteColor(float index){"," if (index < 0.5) return u_palette0;"," if (index < 1.5) return u_palette1;"," if (index < 2.5) return u_palette2;"," if (index < 3.5) return u_palette3;"," if (index < 4.5) return u_palette4;"," return u_palette5;","}","float bayer4(vec2 point){"," vec2 cell = mod(floor(point), 4.0);"," if (cell.y < 0.5) {"," if (cell.x < 0.5) return 0.5 / 16.0;"," if (cell.x < 1.5) return 8.5 / 16.0;"," if (cell.x < 2.5) return 2.5 / 16.0;"," return 10.5 / 16.0;"," }"," if (cell.y < 1.5) {"," if (cell.x < 0.5) return 12.5 / 16.0;"," if (cell.x < 1.5) return 4.5 / 16.0;"," if (cell.x < 2.5) return 14.5 / 16.0;"," return 6.5 / 16.0;"," }"," if (cell.y < 2.5) {"," if (cell.x < 0.5) return 3.5 / 16.0;"," if (cell.x < 1.5) return 11.5 / 16.0;"," if (cell.x < 2.5) return 1.5 / 16.0;"," return 9.5 / 16.0;"," }"," if (cell.x < 0.5) return 15.5 / 16.0;"," if (cell.x < 1.5) return 7.5 / 16.0;"," if (cell.x < 2.5) return 13.5 / 16.0;"," return 5.5 / 16.0;","}","float standardAsciiSample(float brightness, vec2 grid){"," if (brightness < 0.1) return 0.0;"," if (brightness < 0.2) return grid.x == 2.0 && grid.y == 5.0 ? 1.0 : 0.0;"," if (brightness < 0.3) return grid.x == 2.0 && (grid.y == 2.0 || grid.y == 4.0) ? 1.0 : 0.0;"," if (brightness < 0.4) return (grid.y == 2.0 || grid.y == 4.0) && grid.x >= 1.0 && grid.x <= 3.0 ? 1.0 : 0.0;"," if (brightness < 0.5) {"," bool cross = (grid.x == 2.0 && grid.y >= 2.0 && grid.y <= 4.0) || (grid.y == 3.0 && grid.x >= 1.0 && grid.x <= 3.0);"," bool diagonals = (grid.x == 1.0 || grid.x == 3.0) && (grid.y == 2.0 || grid.y == 4.0);"," return cross || diagonals ? 1.0 : 0.0;"," }"," if (brightness < 0.6) {"," bool ring = ((grid.y == 2.0 || grid.y == 4.0) && grid.x >= 1.0 && grid.x <= 3.0) || ((grid.x == 1.0 || grid.x == 3.0) && grid.y == 3.0);"," return ring ? 1.0 : 0.0;"," }"," bool outline = ((grid.y == 1.0 || grid.y == 5.0) && grid.x >= 1.0 && grid.x <= 3.0) || ((grid.x == 0.0 || grid.x == 4.0) && grid.y >= 2.0 && grid.y <= 4.0) || ((grid.x == 1.0 || grid.x == 3.0) && grid.y >= 1.0 && grid.y <= 5.0);"," if (brightness < 0.7) return outline ? 1.0 : 0.0;"," if (brightness < 0.8) {"," bool slash = abs(grid.x - 2.0) == abs(grid.y - 3.0) && grid.x >= 1.0 && grid.x <= 3.0;"," return outline || slash ? 1.0 : 0.0;"," }"," if (brightness < 0.9) {"," bool loops = ((grid.y == 1.0 || grid.y == 3.0 || grid.y == 5.0) && grid.x >= 1.0 && grid.x <= 3.0) || ((grid.x == 1.0 || grid.x == 3.0) && (grid.y == 2.0 || grid.y == 4.0));"," return loops ? 1.0 : 0.0;"," }"," return 1.0;","}","float asciiStyleSample(float style, float brightness, vec2 uv){"," vec2 grid = floor(uv * vec2(5.0, 7.0));"," if (style < 0.5) return standardAsciiSample(brightness, grid);"," if (style < 1.5) {"," float checker = mod(grid.x + grid.y, 2.0);"," float ruled = mod(grid.x, 2.0) == 0.0 || mod(grid.y, 2.0) == 0.0 ? 1.0 : 0.0;"," if (brightness < 0.125) return 0.0;"," if (brightness < 0.25) return checker == 0.0 ? 0.5 : 0.0;"," if (brightness < 0.375) return ruled * 0.6;"," if (brightness < 0.5) return checker == 0.0 ? 1.0 : 0.0;"," if (brightness < 0.625) return ruled > 0.5 ? 1.0 : 0.3;"," if (brightness < 0.75) return checker == 0.0 ? 1.0 : 0.7;"," if (brightness < 0.875) return ruled > 0.5 ? 1.0 : 0.85;"," return 1.0;"," }"," if (style < 2.5) {"," if (brightness < 0.14) return 0.0;"," if (brightness < 0.28) return grid.x == 2.0 && grid.y == 1.0 ? 1.0 : 0.0;"," if (brightness < 0.42) return grid.x == 2.0 && grid.y == 5.0 ? 1.0 : 0.0;"," if (brightness < 0.56) return grid.y == 3.0 && grid.x >= 1.0 && grid.x <= 3.0 ? 1.0 : 0.0;"," if (brightness < 0.7) return (grid.x == 2.0 && grid.y >= 2.0 && grid.y <= 4.0) || (grid.y == 3.0 && grid.x >= 1.0 && grid.x <= 3.0) ? 1.0 : 0.0;"," if (brightness < 0.84) return abs(grid.x - 2.0) == abs(grid.y - 3.0) && grid.y >= 2.0 && grid.y <= 4.0 ? 1.0 : 0.0;"," return grid.x == 1.0 || grid.x == 3.0 || grid.y == 2.0 || grid.y == 4.0 ? 1.0 : 0.0;"," }"," if (style < 3.5) return grid.y >= 6.0 - brightness * 7.0 ? 1.0 : 0.0;"," if (style < 4.5) {"," vec2 dots = floor(uv * vec2(2.0, 4.0));"," if (brightness < 0.125) return 0.0;"," if (brightness < 0.25) return dots.y == 3.0 ? 1.0 : 0.0;"," if (brightness < 0.375) return dots.y >= 2.0 ? 1.0 : 0.0;"," if (brightness < 0.5) return dots.y >= 1.0 ? 1.0 : 0.0;"," if (brightness < 0.625) return dots.y >= 1.0 || dots.x == 1.0 ? 1.0 : 0.0;"," if (brightness < 0.75) return 1.0;"," if (brightness < 0.875) return mod(grid.x + grid.y, 2.0) < 1.5 ? 1.0 : 0.7;"," return 1.0;"," }"," if (style < 5.5) {"," if (brightness < 0.125) return 0.0;"," if (brightness < 0.25) return grid.x == 2.0 && grid.y == 3.0 ? 1.0 : 0.0;"," if (brightness < 0.375) return grid.y == 3.0 && grid.x >= 1.0 && grid.x <= 3.0 ? 1.0 : 0.0;"," if (brightness < 0.5) return grid.x + grid.y == 5.0 || grid.x + grid.y == 6.0 ? 1.0 : 0.0;"," if (brightness < 0.625) return grid.x == 2.0 ? 1.0 : 0.0;"," if (brightness < 0.75) return abs(grid.x - grid.y / 1.4) < 0.7 && grid.x >= 1.0 && grid.x <= 3.0 ? 1.0 : 0.0;"," if (brightness < 0.875) return grid.x == 2.0 || grid.y == 3.0 ? 1.0 : 0.0;"," return grid.x == 1.0 || grid.x == 3.0 || grid.y == 2.0 || grid.y == 4.0 ? 1.0 : 0.0;"," }"," if (style < 6.5) {"," bool top = grid.y == 0.0 && grid.x >= 1.0 && grid.x <= 3.0;"," bool topLeft = grid.x == 1.0 && grid.y <= 3.0;"," bool topRight = grid.x == 3.0 && grid.y <= 3.0;"," bool middle = grid.y == 3.0 && grid.x >= 1.0 && grid.x <= 3.0;"," bool bottomLeft = grid.x == 1.0 && grid.y >= 3.0;"," bool bottomRight = grid.x == 3.0 && grid.y >= 3.0;"," bool bottom = grid.y == 6.0 && grid.x >= 1.0 && grid.x <= 3.0;"," if (brightness < 0.1) return 0.0;"," if (brightness < 0.2) return topRight || bottomRight ? 1.0 : 0.0;"," if (brightness < 0.3) return top || topRight || middle || bottomLeft || bottom ? 1.0 : 0.0;"," if (brightness < 0.4) return top || topRight || middle || bottomRight || bottom ? 1.0 : 0.0;"," if (brightness < 0.5) return topLeft || middle || topRight || bottomRight ? 1.0 : 0.0;"," if (brightness < 0.6) return top || topLeft || middle || bottomRight || bottom ? 1.0 : 0.0;"," if (brightness < 0.7) return top || topLeft || middle || bottomLeft || bottomRight || bottom ? 1.0 : 0.0;"," if (brightness < 0.8) return top || topRight || bottomRight ? 1.0 : 0.0;"," if (brightness < 0.9) return top || topLeft || topRight || middle || bottomLeft || bottomRight || bottom ? 1.0 : 0.0;"," return top || topLeft || topRight || middle || bottomRight || bottom ? 1.0 : 0.0;"," }"," float slash = grid.x - grid.y;"," float backslash = grid.x + grid.y;"," if (brightness < 0.16) return 0.0;"," if (brightness < 0.33) return mod(slash, 3.0) < 0.5 ? 1.0 : 0.0;"," if (brightness < 0.5) return mod(slash, 2.0) < 0.5 ? 1.0 : 0.0;"," bool diagonalA = mod(slash, 2.0) < 0.5;"," bool diagonalB = mod(backslash, 2.0) < 0.5;"," if (brightness < 0.66) return diagonalA || diagonalB ? 1.0 : 0.0;"," if (brightness < 0.83) return mod(slash, 1.5) < 0.5 || mod(backslash, 1.5) < 0.5 ? 1.0 : 0.2;"," return mod(slash, 1.0) < 0.6 || mod(backslash, 1.0) < 0.6 ? 1.0 : 0.5;","}","vec3 rgbToHsv(vec3 color){"," float maximum = max(max(color.r, color.g), color.b);"," float minimum = min(min(color.r, color.g), color.b);"," float delta = maximum - minimum;"," float hue = 0.0;"," if (delta > 0.00001) {"," if (maximum == color.r) hue = mod((color.g - color.b) / delta, 6.0);"," else if (maximum == color.g) hue = (color.b - color.r) / delta + 2.0;"," else hue = (color.r - color.g) / delta + 4.0;"," hue = fract(hue / 6.0);"," }"," return vec3(hue, maximum > 0.00001 ? delta / maximum : 0.0, maximum);","}","vec3 hsvToRgb(vec3 color){"," vec3 bands = abs(fract(color.xxx + vec3(0.0, 0.6666667, 0.3333333)) * 6.0 - 3.0);"," return color.z * mix(vec3(1.0), clamp(bands - 1.0, 0.0, 1.0), color.y);","}","vec4 sampleAdvancedCurve(float coordinate, float row){",` float position = clamp(coordinate, 0.0, 1.0) * ${Td};`," float lower = floor(position);",` float upper = min(lower + 1.0, ${Td});`,` float y = (row + 0.5) / ${Fb};`,` vec4 before = texture2D(u_advanced, vec2((lower + 0.5) / ${Ia}, y));`,` vec4 after = texture2D(u_advanced, vec2((upper + 0.5) / ${Ia}, y));`," return mix(before, after, position - lower);","}","vec4 advancedConfig(float index){",` return texture2D(u_advanced, vec2((index + 0.5) / ${Ia}, ${Nb}));`,"}","vec3 wheelDirection(float hue){"," vec3 direction = hsvToRgb(vec3(fract(hue), 1.0, 1.0));"," direction -= vec3(lumaOf(direction));"," return direction / max(max(max(abs(direction.r), abs(direction.g)), abs(direction.b)), 0.0001);","}","vec3 applyTonalWheels(vec3 color){"," float luma = lumaOf(color);"," float shadows = 1.0 - smoothstep(0.0, 0.6, luma);"," float highlights = smoothstep(0.4, 1.0, luma);"," float midtones = max(0.0, 1.0 - shadows - highlights);"," float total = max(shadows + midtones + highlights, 0.0001);"," vec3 weights = vec3(shadows, midtones, highlights) / total;"," color += wheelDirection(u_shadowWheel.x) * u_shadowWheel.y * weights.x * 0.18;"," color += wheelDirection(u_midtoneWheel.x) * u_midtoneWheel.y * weights.y * 0.18;"," color += wheelDirection(u_highlightWheel.x) * u_highlightWheel.y * weights.z * 0.18;"," color += u_shadowWheel.z * weights.x * 0.25;"," color += u_midtoneWheel.z * weights.y * 0.25;"," color += u_highlightWheel.z * weights.z * 0.25;"," return color;","}","vec3 applyRgbCurves(vec3 color){"," if (u_rgbCurvesEnabled < 0.5) return color;"," vec3 master = vec3("," sampleAdvancedCurve(color.r, 0.0).a,"," sampleAdvancedCurve(color.g, 0.0).a,"," sampleAdvancedCurve(color.b, 0.0).a"," );"," return vec3("," sampleAdvancedCurve(master.r, 0.0).r,"," sampleAdvancedCurve(master.g, 0.0).g,"," sampleAdvancedCurve(master.b, 0.0).b"," );","}","float decodeSigned(float value){ return (value * 255.0 - 128.0) / 127.0; }","vec3 applyHueCurves(vec3 color){"," if (u_hueCurvesEnabled < 0.5) return color;"," vec3 hsv = rgbToHsv(clamp(color, 0.0, 1.0));"," vec3 curves = sampleAdvancedCurve(hsv.x, 1.0).rgb;"," float originalLuma = lumaOf(color);"," hsv.x = fract(hsv.x + decodeSigned(curves.r) * 0.5);"," hsv.y = clamp(hsv.y * max(0.0, 1.0 + decodeSigned(curves.g)), 0.0, 1.0);"," vec3 shifted = hsvToRgb(hsv);"," shifted += vec3(originalLuma - lumaOf(shifted) + decodeSigned(curves.b));"," return shifted;","}","float softRangeMask(float value, float minimum, float maximum, float softness){"," if (value < minimum) {"," if (softness <= 0.0) return 0.0;"," return smoothstep(minimum - softness, minimum, value);"," }"," if (value > maximum) {"," if (softness <= 0.0) return 0.0;"," return 1.0 - smoothstep(maximum, maximum + softness, value);"," }"," return 1.0;","}","float hueRangeMask(float hue, float saturation, vec3 key){"," float distance = abs(fract(hue - key.x + 0.5) - 0.5) * 360.0;"," float range = key.y * 180.0;"," float softness = key.z * 180.0;"," if (range < 179.999 && saturation < 0.001) return 0.0;"," if (distance <= range) return 1.0;"," if (softness <= 0.0) return 0.0;"," return 1.0 - smoothstep(range, range + softness, distance);","}","vec3 applySecondary(vec3 color, float index){"," float base = index * 5.0;"," vec4 hueKey = advancedConfig(base);"," vec4 saturationKey = advancedConfig(base + 1.0);"," vec4 lumaKey = advancedConfig(base + 2.0);"," vec4 correction = advancedConfig(base + 3.0);"," vec4 tintCorrection = advancedConfig(base + 4.0);"," vec3 hsv = rgbToHsv(clamp(color, 0.0, 1.0));"," float luma = lumaOf(color);"," float mask = hueRangeMask(hsv.x, hsv.y, hueKey.rgb);"," mask *= softRangeMask(hsv.y, saturationKey.x, saturationKey.y, saturationKey.z * 0.5);"," mask *= softRangeMask(luma, lumaKey.x, lumaKey.y, lumaKey.z * 0.5);"," if (mask <= 0.0) return color;"," hsv.x = fract(hsv.x + decodeSigned(correction.x) * 0.5);"," vec3 corrected = hsvToRgb(hsv);"," float correctedLuma = lumaOf(corrected);"," corrected = mix(vec3(correctedLuma), corrected, max(0.0, 1.0 + decodeSigned(correction.y)));"," corrected += vec3(decodeSigned(correction.z));"," float temperature = decodeSigned(correction.w);"," float tint = decodeSigned(tintCorrection.x);"," corrected.r += temperature * 0.08 + tint * 0.04;"," corrected.b -= temperature * 0.08 - tint * 0.04;"," corrected.g -= tint * 0.08;"," return mix(color, corrected, mask);","}","vec3 applyAdvancedGrade(vec3 color){"," color = applyTonalWheels(color);"," color = applyRgbCurves(color);"," color = applyHueCurves(color);"," if (u_secondaryCount > 0.5) color = applySecondary(color, 0.0);"," if (u_secondaryCount > 1.5) color = applySecondary(color, 1.0);"," if (u_secondaryCount > 2.5) color = applySecondary(color, 2.0);"," if (u_secondaryCount > 3.5) color = applySecondary(color, 3.0);"," return color;","}","vec3 sampleLut(float r, float g, float b){"," float size = max(u_lutSize, 2.0);"," float x = (r + b * size + 0.5) / max(u_lutTextureSize.x, 1.0);"," float y = (g + 0.5) / max(u_lutTextureSize.y, 1.0);"," return texture2D(u_lut, vec2(x, y)).rgb;","}","vec3 applyLut(vec3 color){"," if (u_lutEnabled < 0.5) return color;"," float size = max(u_lutSize, 2.0);"," vec3 span = max(u_lutDomainMax - u_lutDomainMin, vec3(0.00001));"," vec3 scaled = clamp((color - u_lutDomainMin) / span, 0.0, 1.0) * (size - 1.0);"," vec3 lo = floor(scaled);"," vec3 hi = min(lo + 1.0, vec3(size - 1.0));"," vec3 f = scaled - lo;"," vec3 c000 = sampleLut(lo.r, lo.g, lo.b);"," vec3 c100 = sampleLut(hi.r, lo.g, lo.b);"," vec3 c010 = sampleLut(lo.r, hi.g, lo.b);"," vec3 c110 = sampleLut(hi.r, hi.g, lo.b);"," vec3 c001 = sampleLut(lo.r, lo.g, hi.b);"," vec3 c101 = sampleLut(hi.r, lo.g, hi.b);"," vec3 c011 = sampleLut(lo.r, hi.g, hi.b);"," vec3 c111 = sampleLut(hi.r, hi.g, hi.b);"," vec3 c00 = mix(c000, c100, f.r);"," vec3 c10 = mix(c010, c110, f.r);"," vec3 c01 = mix(c001, c101, f.r);"," vec3 c11 = mix(c011, c111, f.r);"," vec3 c0 = mix(c00, c10, f.g);"," vec3 c1 = mix(c01, c11, f.g);"," vec3 lutColor = mix(c0, c1, f.b);"," return mix(color, lutColor, clamp(u_lutIntensity, 0.0, 1.0));","}","vec3 applyPrimaryGrade(vec3 color){"," color *= pow(2.0, u_exposure);"," float y = lumaOf(color);"," float shadowMask = 1.0 - smoothstep(0.0, 0.65, y);"," float highlightMask = smoothstep(0.35, 1.0, y);"," color += u_shadows * 0.35 * shadowMask;"," color += u_highlights * 0.35 * highlightMask;"," float blackPoint = clamp(u_blacks * 0.18, -0.18, 0.18);"," float whitePoint = clamp(1.0 - u_whites * 0.18, 0.82, 1.18);"," color = (color - blackPoint) / max(whitePoint - blackPoint, 0.2);"," color.r += u_temperature * 0.08 + u_tint * 0.04;"," color.b -= u_temperature * 0.08 - u_tint * 0.04;"," color.g -= u_tint * 0.08;"," color = (color - 0.5) * max(0.0, 1.0 + u_contrast) + 0.5;"," float satLuma = lumaOf(color);"," float currentSat = clamp(colorSaturation(color), 0.0, 1.0);"," float skinLike = smoothstep(0.02, 0.18, color.r - color.g) * smoothstep(0.0, 0.16, color.g - color.b) * smoothstep(0.18, 0.82, satLuma);"," float vibranceWeight = (1.0 - currentSat * 0.72) * mix(1.0, 0.55, skinLike);"," color = mix(vec3(satLuma), color, max(0.0, 1.0 + u_vibrance * vibranceWeight));"," color = mix(vec3(satLuma), color, max(0.0, 1.0 + u_saturation));"," return color;","}","vec3 applyColorGrade(vec3 color){"," color = applyPrimaryGrade(color);"," color = applyAdvancedGrade(color);"," return clamp(applyLut(clamp(color, 0.0, 1.0)), 0.0, 1.0);","}","vec3 applyDither(vec3 source, float amount){"," if (amount <= 0.0) return source;"," float scale = max(min(u_resolution.x, u_resolution.y) / 540.0, 0.25);"," float pixelSize = mix(1.0, 5.0, clamp(u_ditherSize, 0.0, 1.0)) * scale;"," vec2 block = floor(gl_FragCoord.xy / max(pixelSize, 1.0));"," float levels = clamp(u_paletteSize, 2.0, 6.0);"," float index = floor(clamp(lumaOf(source) * (levels - 1.0) + bayer4(block), 0.0, levels - 1.0));"," return mix(source, paletteColor(index), amount);","}","vec2 asciiEdgeDirection(vec2 uv, vec2 stepUv){"," float topLeft = bt601Luma(sampleMedia(uv + vec2(-stepUv.x, -stepUv.y)).rgb);"," float top = bt601Luma(sampleMedia(uv + vec2(0.0, -stepUv.y)).rgb);"," float topRight = bt601Luma(sampleMedia(uv + vec2(stepUv.x, -stepUv.y)).rgb);"," float left = bt601Luma(sampleMedia(uv + vec2(-stepUv.x, 0.0)).rgb);"," float right = bt601Luma(sampleMedia(uv + vec2(stepUv.x, 0.0)).rgb);"," float bottomLeft = bt601Luma(sampleMedia(uv + vec2(-stepUv.x, stepUv.y)).rgb);"," float bottom = bt601Luma(sampleMedia(uv + vec2(0.0, stepUv.y)).rgb);"," float bottomRight = bt601Luma(sampleMedia(uv + stepUv).rgb);"," float x = -topLeft - 2.0 * left - bottomLeft + topRight + 2.0 * right + bottomRight;"," float y = -topLeft - 2.0 * top - topRight + bottomLeft + 2.0 * bottom + bottomRight;"," return vec2(x, y);","}","vec2 rotateAsciiUv(vec2 uv, float angle){"," float cosine = cos(angle);"," float sine = sin(angle);"," vec2 centered = uv - 0.5;"," return vec2(centered.x * cosine - centered.y * sine, centered.x * sine + centered.y * cosine) + 0.5;","}","vec3 applyAscii(vec3 source, float amount){"," if (amount <= 0.0) return source;"," float scale = max(min(u_resolution.x, u_resolution.y) / 540.0, 0.25);"," float cellHeight = mix(4.0, 80.0, clamp(u_asciiSize, 0.0, 1.0)) * scale;"," vec2 cellSize = vec2(cellHeight);"," vec2 cell = floor(gl_FragCoord.xy / cellSize);"," vec2 cellVuv = (cell + 0.5) * cellSize / max(u_resolution, vec2(1.0));"," vec2 cellUv = (cellVuv - u_uvOffset) / u_uvScale;"," cellUv = applyCrtWarp(cellUv);"," vec3 cellColor = applyColorGrade(sampleMedia(cellUv).rgb);"," float brightness = bt601Luma(cellColor);"," float invert = step(0.5, u_asciiInvert);"," brightness = mix(brightness, 1.0 - brightness, invert);"," vec2 glyphUv = fract(gl_FragCoord.xy / cellSize);"," float rotation = clamp(u_asciiRotation, 0.0, 1.0);"," if (rotation > 0.0) {"," vec2 cellStepUv = cellSize / max(u_resolution * u_uvScale, vec2(1.0));"," vec2 edge = asciiEdgeDirection(cellUv, cellStepUv);"," if (length(edge) > 0.1) glyphUv = mix(glyphUv, rotateAsciiUv(glyphUv, atan(edge.y, edge.x)), rotation);"," }"," float ink = asciiStyleSample(floor(u_asciiStyle + 0.5), brightness, glyphUv);"," vec3 background = paletteColor(0.0);"," vec3 inkColor = mix(paletteColor(max(u_paletteSize - 1.0, 1.0)), cellColor, clamp(u_asciiColor, 0.0, 1.0));"," vec3 asciiColor = mix(background, inkColor, ink);"," return mix(source, asciiColor, amount);","}","vec3 applyScanlines(vec3 source, float amount){"," if (amount <= 0.0) return source;"," float count = mix(50.0, 500.0, clamp(u_scanlineCount, 0.0, 1.0));"," float softness = clamp(u_scanlineSoftness, 0.0, 1.0);"," float wave = 0.5 + 0.5 * sin(v_uv.y * count * PI);"," float line = mix(1.0 - wave, pow(1.0 - wave, 2.2), softness);"," return source * (1.0 - line * amount);","}","void main(){"," vec2 uv = (v_uv - u_uvOffset) / u_uvScale;"," if (uv.x < 0.0 || uv.y < 0.0 || uv.x > 1.0 || uv.y > 1.0) {"," gl_FragColor = vec4(0.0);"," return;"," }"," vec4 originalSample = sampleSource(uv);"," uv = applyCrtWarp(uv);"," vec2 displayEdge = smoothstep(vec2(0.0), vec2(0.006), uv) * (1.0 - smoothstep(vec2(0.994), vec2(1.0), uv));"," float displayMask = displayEdge.x * displayEdge.y;"," vec4 sampleColor = sampleMedia(uv);"," sampleColor = sampleChromaticMedia(uv, sampleColor);"," sampleColor.rgb = applyDigitalGlitch(uv, sampleColor.rgb);"," vec3 original = originalSample.rgb;"," vec3 color = mix(sampleColor.rgb, applyColorGrade(sampleColor.rgb), u_intensity);"," float grainAmount = clamp(u_grain, 0.0, 1.0);"," if (grainAmount > 0.0) {"," float grainPixelSize = mix(1.0, 6.0, clamp(u_grainSize, 0.0, 1.0));"," vec2 grainCoord = floor(gl_FragCoord.xy / grainPixelSize) + vec2(u_grainSeed, u_grainSeed * 1.37);"," float grainBase = grainHash(grainCoord) - grainHash(grainCoord + vec2(19.19, 73.31));"," float grainFine = grainHash(gl_FragCoord.xy + vec2(u_grainSeed * 2.11, u_grainSeed * 0.71)) - 0.5;"," float grain = mix(grainBase * 0.7, grainBase + grainFine * 0.35, clamp(u_grainRoughness, 0.0, 1.0));"," float grainLuma = lumaOf(color);"," float grainMask = smoothstep(0.02, 0.55, grainLuma) * (1.0 - smoothstep(0.88, 1.0, grainLuma));"," color += grain * grainAmount * mix(0.025, 0.08, grainMask);"," }"," float filmArtifacts = clamp(u_filmArtifacts, 0.0, 1.0);"," if (filmArtifacts > 0.0) {"," float filmFrame = floor(u_grainSeed);"," float dust = dustMask(v_uv, floor(filmFrame / 3.0));"," float dustTone = grainHash(vec2(floor(filmFrame / 3.0), 8.0));"," color = mix(color, vec3(dustTone > 0.5 ? 0.95 : 0.02), dust * 0.72 * filmArtifacts);"," float scratchBucket = floor(filmFrame / 12.0);"," float scratchX = grainHash(vec2(scratchBucket, 4.2));"," float scratchLife = step(0.78, grainHash(vec2(scratchBucket, 8.4)));"," float scratch = (1.0 - smoothstep(0.0, 1.4 / max(u_resolution.x, 1.0), abs(v_uv.x - scratchX))) * scratchLife;"," color = mix(color, vec3(0.94, 0.88, 0.76), scratch * 0.28 * filmArtifacts);"," }"," color = applyMonoScreen(clamp(color, 0.0, 1.0), clamp(u_monoScreen, 0.0, 1.0));"," color = applyEngraving(clamp(color, 0.0, 1.0), clamp(u_engraving, 0.0, 1.0));"," color = applyCrosshatch(uv, clamp(color, 0.0, 1.0), clamp(u_crosshatch, 0.0, 1.0));"," color = applyHalftone(clamp(color, 0.0, 1.0), clamp(u_halftone, 0.0, 1.0));"," color = applyTwoInkPrint(clamp(color, 0.0, 1.0), clamp(u_twoInkPrint, 0.0, 1.0));"," color = applyDither(clamp(color, 0.0, 1.0), clamp(u_dither, 0.0, 1.0));"," color = applyAscii(clamp(color, 0.0, 1.0), clamp(u_ascii, 0.0, 1.0));"," if (u_bloomReady > 0.5 && u_bloom > 0.0) color += sampleBloom(uv) * u_bloom;"," color = applyScanlines(clamp(color, 0.0, 1.0), clamp(u_scanlines, 0.0, 1.0));"," vec2 vignetteAspect = u_resolution.x > u_resolution.y"," ? vec2(u_resolution.x / max(u_resolution.y, 1.0), 1.0)"," : vec2(1.0, u_resolution.y / max(u_resolution.x, 1.0));"," vec2 vignetteUv = abs((v_uv - vec2(0.5)) * 2.0) * vignetteAspect;"," float vignettePower = mix(8.0, 1.8, clamp(u_vignetteRoundness * 0.5 + 0.5, 0.0, 1.0));"," float vignetteDistance = pow(pow(vignetteUv.x, vignettePower) + pow(vignetteUv.y, vignettePower), 1.0 / vignettePower);"," float vignetteMidpoint = mix(0.22, 1.08, clamp(u_vignetteMidpoint, 0.0, 1.0));"," float vignetteFeather = mix(0.08, 0.72, clamp(u_vignetteFeather, 0.0, 1.0));"," float vignetteMask = smoothstep(vignetteMidpoint, vignetteMidpoint + vignetteFeather, vignetteDistance);"," color *= 1.0 - vignetteMask * clamp(u_vignette, 0.0, 1.0) * 0.75;"," float warpActive = step(0.0001, u_crtCurvature);"," color *= mix(1.0, displayMask, warpActive);"," vec3 graded = clamp(color, 0.0, 1.0);"," if (u_compareEnabled > 0.5) {"," float pos = clamp(u_comparePosition, 0.0, 1.0);"," float softness = max(u_compareSoftness, 0.00001);"," float afterMask = smoothstep(pos - softness, pos + softness, v_uv.x);"," vec3 splitColor = mix(original, graded, afterMask);"," float lineMask = 0.0;"," if (u_compareLineWidth > 0.0) {"," float lineWidth = max(u_compareLineWidth / max(u_resolution.x, 1.0), 0.00001);"," lineMask = 1.0 - smoothstep(lineWidth, lineWidth * 1.8, abs(v_uv.x - pos));"," }"," gl_FragColor = vec4(mix(splitColor, vec3(1.0), lineMask * 0.82), sampleColor.a);"," return;"," }"," gl_FragColor = vec4(graded, sampleColor.a);","}"].join(`\n`),Ib=["#ifdef GL_FRAGMENT_PRECISION_HIGH","precision highp float;","#else","precision mediump float;","#endif","varying vec2 v_uv;","uniform sampler2D u_source;","uniform vec2 u_resolution;","uniform vec2 u_direction;","uniform float u_radius;","uniform float u_bloomPass;","uniform float u_threshold;","vec4 readSource(vec2 uv){"," vec4 color = texture2D(u_source, clamp(uv, vec2(0.0), vec2(1.0)));"," if (u_bloomPass > 0.5) {"," float luminance = dot(color.rgb, vec3(0.299, 0.587, 0.114));"," if (u_threshold >= 0.0 && luminance <= u_threshold) color.rgb = vec3(0.0);"," return vec4(color.rgb, 1.0);"," }"," color.rgb *= color.a;"," return color;","}","void main(){"," if (u_bloomPass > 0.5) {"," vec2 stepUv = u_direction * max(u_radius, 0.0) / max(u_resolution, vec2(1.0)) * 0.5;"," vec4 bloom = readSource(v_uv) * 0.227027;"," bloom += readSource(v_uv + stepUv) * 0.1945946;"," bloom += readSource(v_uv - stepUv) * 0.1945946;"," bloom += readSource(v_uv + stepUv * 2.0) * 0.1216216;"," bloom += readSource(v_uv - stepUv * 2.0) * 0.1216216;"," bloom += readSource(v_uv + stepUv * 3.0) * 0.054054;"," bloom += readSource(v_uv - stepUv * 3.0) * 0.054054;"," bloom += readSource(v_uv + stepUv * 4.0) * 0.016216;"," bloom += readSource(v_uv - stepUv * 4.0) * 0.016216;"," gl_FragColor = bloom;"," return;"," }"," vec2 stepUv = u_direction * max(u_radius, 0.0) / max(u_resolution, vec2(1.0)) / 12.0;"," vec4 color = readSource(v_uv) * 0.08077993;"," color += readSource(v_uv + stepUv * 1.0) * 0.07918038;"," color += readSource(v_uv - stepUv * 1.0) * 0.07918038;"," color += readSource(v_uv + stepUv * 2.0) * 0.07456928;"," color += readSource(v_uv - stepUv * 2.0) * 0.07456928;"," color += readSource(v_uv + stepUv * 3.0) * 0.06747307;"," color += readSource(v_uv - stepUv * 3.0) * 0.06747307;"," color += readSource(v_uv + stepUv * 4.0) * 0.05865827;"," color += readSource(v_uv - stepUv * 4.0) * 0.05865827;"," color += readSource(v_uv + stepUv * 5.0) * 0.04899551;"," color += readSource(v_uv - stepUv * 5.0) * 0.04899551;"," color += readSource(v_uv + stepUv * 6.0) * 0.03931982;"," color += readSource(v_uv - stepUv * 6.0) * 0.03931982;"," color += readSource(v_uv + stepUv * 7.0) * 0.03031761;"," color += readSource(v_uv - stepUv * 7.0) * 0.03031761;"," color += readSource(v_uv + stepUv * 8.0) * 0.02245983;"," color += readSource(v_uv - stepUv * 8.0) * 0.02245983;"," color += readSource(v_uv + stepUv * 9.0) * 0.01598624;"," color += readSource(v_uv - stepUv * 9.0) * 0.01598624;"," color += readSource(v_uv + stepUv * 10.0) * 0.01093238;"," color += readSource(v_uv - stepUv * 10.0) * 0.01093238;"," color += readSource(v_uv + stepUv * 11.0) * 0.00718308;"," color += readSource(v_uv - stepUv * 11.0) * 0.00718308;"," color += readSource(v_uv + stepUv * 12.0) * 0.00453456;"," color += readSource(v_uv - stepUv * 12.0) * 0.00453456;"," if (color.a > 0.0001) color.rgb /= color.a;"," gl_FragColor = color;","}"].join(`\n`),Pb=["#ifdef GL_FRAGMENT_PRECISION_HIGH","precision highp float;","#else","precision mediump float;","#endif","varying vec2 v_uv;","uniform sampler2D u_source;","uniform sampler2D u_blurSource;","uniform vec2 u_texel;","uniform vec2 u_uvScale;","uniform vec2 u_uvOffset;","uniform float u_blurReady;","uniform float u_blur;","uniform float u_kuwaharaRadius;","vec3 readPrepared(vec2 displayUv){"," vec2 uv = (displayUv - u_uvOffset) / u_uvScale;"," vec3 color = texture2D(u_source, clamp(uv, vec2(0.0), vec2(1.0))).rgb;"," if (u_blurReady > 0.5 && u_blur > 0.0) {"," vec3 blurred = texture2D(u_blurSource, clamp(uv, vec2(0.0), vec2(1.0))).rgb;"," color = mix(color, blurred, clamp(u_blur, 0.0, 1.0));"," }"," return color;","}","void main(){"," float radius = floor(mix(2.0, 16.0, clamp(u_kuwaharaRadius, 0.0, 1.0)) + 0.5);"," vec3 sum = vec3(0.0);"," float sumSquares = 0.0;"," float count = 0.0;"," for (int offset = 0; offset <= 16; offset++) {"," if (float(offset) > radius) continue;"," vec3 color = readPrepared(v_uv + vec2(float(offset), 0.0) * u_texel);"," sum += color;"," sumSquares += dot(color, color) / 3.0;"," count += 1.0;"," }"," gl_FragColor = vec4(sum / count, sumSquares / count);","}"].join(`\n`),Ob=["#ifdef GL_FRAGMENT_PRECISION_HIGH","precision highp float;","#else","precision mediump float;","#endif","varying vec2 v_uv;","uniform sampler2D u_kuwaharaMoments;","uniform vec2 u_texel;","uniform float u_kuwaharaRadius;","uniform float u_kuwaharaSharpness;","uniform float u_kuwaharaSaturation;","void main(){"," float radius = floor(mix(2.0, 16.0, clamp(u_kuwaharaRadius, 0.0, 1.0)) + 0.5);"," vec2 origins[4];"," origins[0] = vec2(-radius, -radius);"," origins[1] = vec2(0.0, -radius);"," origins[2] = vec2(-radius, 0.0);"," origins[3] = vec2(0.0, 0.0);"," vec3 means[4];"," float variances[4];"," float minVariance = 1.0;"," for (int quadrant = 0; quadrant < 4; quadrant++) {"," vec4 moment = vec4(0.0);"," float count = 0.0;"," for (int offset = 0; offset <= 16; offset++) {"," if (float(offset) > radius) continue;"," vec2 sampleOffset = origins[quadrant] + vec2(0.0, float(offset));"," moment += texture2D(u_kuwaharaMoments, clamp(v_uv + sampleOffset * u_texel, vec2(0.0), vec2(1.0)));"," count += 1.0;"," }"," moment /= count;"," vec3 mean = moment.rgb;"," float meanSquare = moment.a * 3.0;"," float variance = max(meanSquare - dot(mean, mean), 0.0);"," means[quadrant] = mean;"," variances[quadrant] = variance;"," minVariance = min(minVariance, variance);"," }"," float exponent = 1.0 + clamp(u_kuwaharaSharpness, 0.0, 1.0) * 8.0;"," vec3 result = vec3(0.0);"," float totalWeight = 0.0;"," for (int quadrant = 0; quadrant < 4; quadrant++) {"," float weight = pow((minVariance + 0.0001) / (variances[quadrant] + 0.0001), exponent);"," result += means[quadrant] * weight;"," totalWeight += weight;"," }"," result /= max(totalWeight, 0.0001);"," float luma = dot(result, vec3(0.2126, 0.7152, 0.0722));"," float saturation = clamp(u_kuwaharaSaturation, 0.0, 1.0) * 2.0;"," gl_FragColor = vec4(clamp(mix(vec3(luma), result, saturation), 0.0, 1.0), 1.0);","}"].join(`\n`);function Nt(e){return e instanceof HTMLVideoElement||e instanceof HTMLImageElement}function Rd(e){let t=window.getComputedStyle(e);return t.display!=="none"&&t.visibility!=="hidden"}function kd(e,t,n){let r=e.createShader(n);return r?(e.shaderSource(r,t),e.compileShader(r),e.getShaderParameter(r,e.COMPILE_STATUS)?r:(L("runtime.colorGrading.compileShader",e.getShaderInfoLog(r)),e.deleteShader(r),null)):null}function Si(e,t=Db){let n=kd(e,Lb,e.VERTEX_SHADER),r=kd(e,t,e.FRAGMENT_SHADER);if(!n||!r)return n&&e.deleteShader(n),r&&e.deleteShader(r),null;let i=e.createProgram();return i?(e.attachShader(i,n),e.attachShader(i,r),e.linkProgram(i),e.deleteShader(n),e.deleteShader(r),e.getProgramParameter(i,e.LINK_STATUS)?i:(L("runtime.colorGrading.linkProgram",e.getProgramInfoLog(i)),e.deleteProgram(i),null)):null}function bi(e,t=e.LINEAR,n=e.UNSIGNED_BYTE){let r=e.createTexture();return r?(e.bindTexture(e.TEXTURE_2D,r),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,t),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,t),e.texImage2D(e.TEXTURE_2D,0,e.RGBA,1,1,0,e.RGBA,n,null),r):null}function Hb(e,t){let n=Si(e,Ib);return n?{program:n,quad:t,position:e.getAttribLocation(n,"a_pos"),source:e.getUniformLocation(n,"u_source"),resolution:e.getUniformLocation(n,"u_resolution"),direction:e.getUniformLocation(n,"u_direction"),radius:e.getUniformLocation(n,"u_radius"),bloomPass:e.getUniformLocation(n,"u_bloomPass"),threshold:e.getUniformLocation(n,"u_threshold")}:null}function Gb(e,t){let n=Si(e,Pb);return n?{program:n,quad:t,position:e.getAttribLocation(n,"a_pos"),source:e.getUniformLocation(n,"u_source"),blurSource:e.getUniformLocation(n,"u_blurSource"),texel:e.getUniformLocation(n,"u_texel"),uvScale:e.getUniformLocation(n,"u_uvScale"),uvOffset:e.getUniformLocation(n,"u_uvOffset"),blurReady:e.getUniformLocation(n,"u_blurReady"),blur:e.getUniformLocation(n,"u_blur"),radius:e.getUniformLocation(n,"u_kuwaharaRadius")}:null}function Bb(e,t){let n=Si(e,Ob);return n?{program:n,quad:t,position:e.getAttribLocation(n,"a_pos"),moments:e.getUniformLocation(n,"u_kuwaharaMoments"),texel:e.getUniformLocation(n,"u_texel"),radius:e.getUniformLocation(n,"u_kuwaharaRadius"),sharpness:e.getUniformLocation(n,"u_kuwaharaSharpness"),saturation:e.getUniformLocation(n,"u_kuwaharaSaturation")}:null}function ir(e,t=e.UNSIGNED_BYTE,n=e.LINEAR){let r=bi(e,n,t),i=e.createFramebuffer();if(!r||!i)return r&&e.deleteTexture(r),i&&e.deleteFramebuffer(i),null;e.bindFramebuffer(e.FRAMEBUFFER,i),e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,r,0);let o=e.checkFramebufferStatus(e.FRAMEBUFFER);return e.bindFramebuffer(e.FRAMEBUFFER,null),o!==e.FRAMEBUFFER_COMPLETE?(e.deleteTexture(r),e.deleteFramebuffer(i),null):{texture:r,framebuffer:i,type:t,width:1,height:1}}function yi(e,t,n,r){t.width===n&&t.height===r||(t.width=n,t.height=r,e.bindTexture(e.TEXTURE_2D,t.texture),e.texImage2D(e.TEXTURE_2D,0,e.RGBA,n,r,0,e.RGBA,t.type,null))}function Pa(e,t,n){let r=[];for(let i of n){let o=e.getUniformLocation(t,`u_${i}`);o!==null&&r.push([i,o])}return r}function Md(e,t,n){t&&e.deleteProgram(t);for(let r of n)r&&e.deleteTexture(r)}function Ba(e){let t=e.getContext("webgl",{alpha:!0,premultipliedAlpha:!1});if(!t)return null;let n=Si(t),r=bi(t),i=bi(t,t.NEAREST),o=bi(t,t.NEAREST);if(!n||!r||!i||!o)return Md(t,n,[r,i,o]),null;let a=t.createBuffer();return a?(t.bindBuffer(t.ARRAY_BUFFER,a),t.bufferData(t.ARRAY_BUFFER,new Float32Array([-1,-1,1,-1,-1,1,1,1]),t.STATIC_DRAW),{gl:t,program:{program:n,texture:r,lutTexture:i,advancedTexture:o,advancedSignature:null,quad:a,position:t.getAttribLocation(n,"a_pos"),source:t.getUniformLocation(n,"u_source"),blurSource:t.getUniformLocation(n,"u_blurSource"),bloomSource:t.getUniformLocation(n,"u_bloomSource"),kuwaharaSource:t.getUniformLocation(n,"u_kuwaharaSource"),lut:t.getUniformLocation(n,"u_lut"),advanced:t.getUniformLocation(n,"u_advanced"),resolution:t.getUniformLocation(n,"u_resolution"),uvScale:t.getUniformLocation(n,"u_uvScale"),uvOffset:t.getUniformLocation(n,"u_uvOffset"),blurReady:t.getUniformLocation(n,"u_blurReady"),bloomReady:t.getUniformLocation(n,"u_bloomReady"),kuwaharaReady:t.getUniformLocation(n,"u_kuwaharaReady"),lutEnabled:t.getUniformLocation(n,"u_lutEnabled"),lutSize:t.getUniformLocation(n,"u_lutSize"),lutTextureSize:t.getUniformLocation(n,"u_lutTextureSize"),lutDomainMin:t.getUniformLocation(n,"u_lutDomainMin"),lutDomainMax:t.getUniformLocation(n,"u_lutDomainMax"),lutIntensity:t.getUniformLocation(n,"u_lutIntensity"),shadowWheel:t.getUniformLocation(n,"u_shadowWheel"),midtoneWheel:t.getUniformLocation(n,"u_midtoneWheel"),highlightWheel:t.getUniformLocation(n,"u_highlightWheel"),rgbCurvesEnabled:t.getUniformLocation(n,"u_rgbCurvesEnabled"),hueCurvesEnabled:t.getUniformLocation(n,"u_hueCurvesEnabled"),secondaryCount:t.getUniformLocation(n,"u_secondaryCount"),adjustUniforms:Pa(t,n,jr),detailUniforms:Pa(t,n,Lo),effectUniforms:Pa(t,n,Do),grainSeed:t.getUniformLocation(n,"u_grainSeed"),effectTime:t.getUniformLocation(n,"u_effectTime"),paletteSize:t.getUniformLocation(n,"u_paletteSize"),palette0:t.getUniformLocation(n,"u_palette0"),palette1:t.getUniformLocation(n,"u_palette1"),palette2:t.getUniformLocation(n,"u_palette2"),palette3:t.getUniformLocation(n,"u_palette3"),palette4:t.getUniformLocation(n,"u_palette4"),palette5:t.getUniformLocation(n,"u_palette5"),intensity:t.getUniformLocation(n,"u_intensity"),compareEnabled:t.getUniformLocation(n,"u_compareEnabled"),comparePosition:t.getUniformLocation(n,"u_comparePosition"),compareSoftness:t.getUniformLocation(n,"u_compareSoftness"),compareLineWidth:t.getUniformLocation(n,"u_compareLineWidth")}}):(Md(t,n,[r,i,o]),null)}function Ub(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function Wb(e){if(!Ub(e))return{...nn};let t=(n,r,i,o)=>{let a=typeof n=="number"?n:Number(n);return Math.min(o,Math.max(i,Number.isFinite(a)?a:r))};return{enabled:e.enabled===!0,position:t(e.position,nn.position,0,1),softness:t(e.softness,nn.softness,0,.25),lineWidth:t(e.lineWidth,nn.lineWidth,0,12)}}function Hd(e){try{let t=new URL(e,document.baseURI);return t.protocol==="data:"?{href:t.href}:t.protocol!=="http:"&&t.protocol!=="https:"?{error:"LUT must be project-local or a data URL"}:t.origin!==window.location.origin?{error:"Remote LUT URLs are not supported"}:{href:t.href}}catch{return{error:"Invalid LUT URL"}}}function Ai(e){return e instanceof Error?e.message:"LUT failed to load"}function Vb(e){let t=2166136261;for(let n=0;n>>0)%1e4}function Gd(e){let t=e.id||e.currentSrc||e.getAttribute("src")||`${e.tagName}:${Array.prototype.indexOf.call(e.parentNode?.children??[],e)}`;return Vb(t)}function Ua(e){let t=Hd(e);if("error"in t)return{state:"error",message:t.error};let n=rt.get(t.href);if(n)return n;let r=fetch(t.href,{credentials:"same-origin"}).then(o=>{if(!o.ok)throw new Error(`Failed to load LUT (${o.status})`);return o.text()}).then(o=>Kl(o,{maxSize:Vr})),i={state:"pending",promise:r};for(;rt.size>=_b;){let o=rt.keys().next().value;if(!o)break;rt.delete(o)}return rt.set(t.href,i),r.then(o=>{rt.get(t.href)===i&&rt.set(t.href,{state:"ready",lut:o})},o=>{rt.get(t.href)===i&&rt.set(t.href,{state:"error",message:Ai(o)})}),i}function Fd(e,t,n){if(e.lut?.src===t)return e.lut;let r=wo(n),{gl:i,program:o}=e;try{return Bd(i,o.lutTexture,r),e.lut={src:t,size:n.size,domainMin:n.domainMin,domainMax:n.domainMax,textureWidth:r.width,textureHeight:r.height},e.lutError=null,e.lutLoadingSrc=null,e.lut}catch(a){return e.lut=null,e.lutError=Ai(a),e.lutLoadingSrc=null,L("runtime.colorGrading.uploadLut",a),null}}async function zb(e){let t=Ua(e);if(t.state==="ready")return t.lut;if(t.state==="pending")return t.promise;throw new Error(t.message)}function Bd(e,t,n){e.activeTexture(e.TEXTURE2),e.bindTexture(e.TEXTURE_2D,t),e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,!1),e.texImage2D(e.TEXTURE_2D,0,e.RGBA,n.width,n.height,0,e.RGBA,e.UNSIGNED_BYTE,n.data)}function qb(e,t,n){let r=wo(n),{gl:i,program:o}=e;return Bd(i,o.lutTexture,r),{src:t,size:n.size,domainMin:n.domainMin,domainMax:n.domainMax,textureWidth:r.width,textureHeight:r.height}}function Xe(e,t){e.deleteTexture(t.texture),e.deleteFramebuffer(t.framebuffer)}function Wa(e){let t=e.effectTargets;t&&(e.gl.deleteProgram(t.blurProgram.program),Xe(e.gl,t.scratch),Xe(e.gl,t.blur),t.bloom&&Xe(e.gl,t.bloom),e.effectTargets=null)}function Va(e){let t=e.kuwaharaTargets;t&&(e.gl.deleteProgram(t.horizontalProgram.program),e.gl.deleteProgram(t.resolveProgram.program),Xe(e.gl,t.moments),Xe(e.gl,t.output),e.kuwaharaTargets=null)}function xi(e,t=!1){Wa(e),Va(e),$b(e.gl,e.program),t&&e.gl.getExtension("WEBGL_lose_context")?.loseContext()}function $b(e,t){e.deleteTexture(t.texture),e.deleteTexture(t.lutTexture),e.deleteTexture(t.advancedTexture),e.deleteBuffer(t.quad),e.deleteProgram(t.program)}function jb(e){let t=Ba(e.canvas);return t?(xi(e),e.gl=t.gl,e.program=t.program,e.lut=null,e.lutLoadingSrc=null,e.lutError=null,e.effectError=null,!0):!1}function Ga(e){if(!e.sourceHidden)return;e.element.removeAttribute(Nn);let t=e.element.style.getPropertyValue("opacity"),n=e.element.style.getPropertyPriority("opacity");t==="0"&&n==="important"&&(e.sourceInlineOpacity===null?e.element.style.removeProperty("opacity"):e.element.style.setProperty("opacity",e.sourceInlineOpacity,e.sourceInlineOpacityPriority)),e.sourceHidden=!1}function Kb(e){if(e.effectTargets)return e.effectTargets;let{gl:t}=e,n=Hb(t,e.program.quad),r=ir(t),i=ir(t);return!n||!r||!i?(n&&t.deleteProgram(n.program),r&&Xe(t,r),i&&Xe(t,i),e.effectError="Framebuffer effects unavailable",null):(e.effectError=null,e.effectTargets={blurProgram:n,scratch:r,blur:i,bloom:null},e.effectTargets)}function Yb(e,t){return t.bloom||(t.bloom=ir(e.gl),e.effectError=t.bloom?null:"Framebuffer effects unavailable"),t.bloom}function Nd(e){let t=e.effectTargets;t?.bloom&&(Xe(e.gl,t.bloom),t.bloom=null)}function Xb(e){if(e.kuwaharaTargets)return e.kuwaharaTargets;let{gl:t}=e,n=t.getExtension("OES_texture_half_float"),r=t.getExtension("EXT_color_buffer_half_float");if(!n||!r)return e.effectError="Kuwahara requires half-float framebuffer support",null;let i=Gb(t,e.program.quad),o=Bb(t,e.program.quad),a=ir(t,n.HALF_FLOAT_OES,t.NEAREST),l=ir(t);return!i||!o||!a||!l?(Jb(t,i,o,a,l),e.effectError="Kuwahara framebuffer effects unavailable",null):(e.kuwaharaTargets={horizontalProgram:i,resolveProgram:o,moments:a,output:l},e.kuwaharaTargets)}function Jb(e,t,n,r,i){t&&e.deleteProgram(t.program),n&&e.deleteProgram(n.program),r&&Xe(e,r),i&&Xe(e,i)}function Ud(e,t,n,r,i){let o=Math.max(1,Math.ceil(r)),a=Math.max(1,Math.ceil(i));return yi(e,t,o,a),yi(e,n,o,a),{width:o,height:a}}function vi(e,t,n,r,i,o,a,l=!1,s=-1){e.bindFramebuffer(e.FRAMEBUFFER,r.framebuffer),e.viewport(0,0,i.width,i.height),e.useProgram(t.program),e.activeTexture(e.TEXTURE0),e.bindTexture(e.TEXTURE_2D,n),e.uniform1i(t.source,0),e.uniform2f(t.resolution,i.width,i.height),e.uniform2f(t.direction,o.x,o.y),e.uniform1f(t.radius,a),e.uniform1f(t.bloomPass,l?1:0),e.uniform1f(t.threshold,s),or(e,t)}function Qb(e,t,n,r,i,o,a){let l=Ud(e,t.scratch,r,i/2,o/2),s=a/2;vi(e,t.blurProgram,n,t.scratch,l,{x:1,y:0},s,!0,.5),vi(e,t.blurProgram,t.scratch.texture,r,l,{x:0,y:1},s,!0)}function Zb(e,t,n,r,i,o,a){let l=n;for(let s=0;s.55?3:2),!0}function nx(e,t,n,r,i,o){if(n<=0)return Nd(e),null;o||Nd(e);let a=o?Yb(e,t):t.blur;return a?(Qb(e.gl,t,e.program.texture,a,i.width,i.height,r),a.texture):null}function rx(e,t,n,r){let{program:i}=e,o=t.effects.blur,a=t.effects.bloom;if(o<=0&&a<=0)return e.effectTargets&&r&&Wa(e),{blurReady:!1,bloomReady:!1,blurTexture:i.texture,bloomTexture:i.texture};let l=Kb(e);if(!l)return{blurReady:!1,bloomReady:!1,blurTexture:i.texture,bloomTexture:i.texture};let s=tx(e,l,o,n),u=nx(e,l,a,t.effects.bloomRadius,n,s);return{blurReady:s,bloomReady:u!==null,blurTexture:l.blur.texture,bloomTexture:u??i.texture}}function ix(e,t,n,r,i,o,a){let l=t.effects.kuwahara;if(l<=0&&!o)return e.kuwaharaTargets&&a&&Va(e),{kuwaharaReady:!1,kuwaharaTexture:e.program.texture};let s=Xb(e);return!s||l<=0?{kuwaharaReady:!1,kuwaharaTexture:s?.output.texture??e.program.texture}:(ex(e.gl,s,e.program.texture,e.effectTargets?.blur.texture??e.program.texture,n,r,i,t.effects),{kuwaharaReady:!0,kuwaharaTexture:s.output.texture})}function Wd(e,t,n,r,i={}){let o=i.releaseIdleTargets??!0;e.effectError=null;let a=rx(e,t,n,o),l=ix(e,t,n,r,a.blurReady,i.preserveKuwahara??!1,o);return{...a,...l}}function ox(e){let t=e.grading.lut?.src.trim()??"",n=e.grading.lut?.intensity??1;if(!t||n<=0)return e.lut=null,e.lutLoadingSrc=null,e.lutError=null,null;let r=Hd(t);if("error"in r)return e.lut=null,e.lutLoadingSrc=null,e.lutError=r.error,null;if(e.lut?.src===r.href)return e.lut;e.lut=null;let i=Ua(t);return i.state==="ready"?Fd(e,r.href,i.lut):i.state==="error"?(e.lutError=i.message,e.lutLoadingSrc=null,null):(e.lutLoadingSrc!==r.href&&(e.lutLoadingSrc=r.href,e.lutError=null,i.promise.then(o=>{e.destroyed||e.grading.lut?.src.trim()!==t||(Fd(e,r.href,o),De(e))},o=>{e.destroyed||e.grading.lut?.src.trim()!==t||(e.lut=null,e.lutError=Ai(o),e.lutLoadingSrc=null,De(e))})),null)}function nr(e){if(!e)return null;if(typeof e=="string"){let t=e.trim();if(!t)return null;let n=document.getElementById(t.replace(/^#/,""));if(n&&Nt(n))return n;try{let r=document.querySelector(t);return r&&Nt(r)?r:null}catch{return null}}if(e.hfId){let t=document.querySelector(`[data-hf-id="${CSS.escape(e.hfId)}"]`);if(t&&Nt(t))return t}if(e.id){let t=document.getElementById(e.id);if(t&&Nt(t))return t}if(!e.selector)return null;try{let t=Array.from(document.querySelectorAll(e.selector)),n=Math.max(0,Math.floor(Number(e.selectorIndex??0)||0)),r=t[n]??null;return r&&Nt(r)?r:null}catch{return null}}function Vd(e){return e instanceof HTMLVideoElement?e.videoWidth>0&&e.videoHeight>0?{width:e.videoWidth,height:e.videoHeight}:null:e instanceof HTMLImageElement&&e.naturalWidth>0&&e.naturalHeight>0?{width:e.naturalWidth,height:e.naturalHeight}:null}function zd(e){return e instanceof HTMLVideoElement?e.readyState>=HTMLMediaElement.HAVE_CURRENT_DATA&&e.videoWidth>0&&e.videoHeight>0:e instanceof HTMLImageElement?e.complete&&e.naturalWidth>0&&e.naturalHeight>0:!1}function qd(e){let t=ut(e);return t&&zd(t)?t:null}function Ld(e){if(!(e instanceof HTMLVideoElement))return!1;let t=qd(e);if(!t)return!1;let n=window.getComputedStyle(t);return n.display!=="none"&&n.visibility!=="hidden"}function ax(e){return e instanceof HTMLImageElement&&e.classList.contains("__render_frame__")}function sx(e,t){t.parentNode&&t.nextSibling!==e.canvas&&t.parentNode.insertBefore(e.canvas,t.nextSibling)}function $d(e){if(e instanceof HTMLVideoElement){let t=qd(e);if(t)return t}return zd(e)?e:null}function Dd(e,t){let n=e.toLowerCase();if(n==="center")return .5;if(t==="x"){if(n==="left")return 0;if(n==="right")return 1}else{if(n==="top")return 0;if(n==="bottom")return 1}if(n.endsWith("%")){let r=Number.parseFloat(n);return Number.isFinite(r)?r/100:null}return null}function lx(e){let t=e.trim().split(/\\s+/).filter(Boolean),n=.5,r=.5;for(let i=0;i0)){r=l;continue}}return{x:n,y:r}}function jd(e,t,n,r,i,o){if(e<=0||t<=0||n<=0||r<=0)return{scaleX:1,scaleY:1,offsetX:0,offsetY:0};let a=i||"fill",l=e,s=t;if(a==="contain"||a==="cover"||a==="scale-down"){let m=a==="cover"?Math.max(e/n,t/r):Math.min(e/n,t/r);l=n*m,s=r*m,a==="scale-down"&&l>n&&s>r&&(l=n,s=r)}else a==="none"&&(l=n,s=r);let u=lx(o||"center"),c=(e-l)*u.x/e,f=(t-s)*u.y/t;return{scaleX:l/e,scaleY:s/t,offsetX:c,offsetY:f}}function ux(e,t){window.getComputedStyle(t).position==="static"&&(e.touchedParent||(e.touchedParent=t,e.parentInlinePosition=t.style.position||null),t.style.position="relative")}function Id(e,t){return Math.max(0,Math.round(e>0?e:t))}function cx(e,t){let{element:n,canvas:r}=e,i=n.parentElement;i&&ux(e,i);let o=window.getComputedStyle(t);vu(r.style,o),r.style.pointerEvents="none",r.style.position="absolute",r.style.inset="auto",r.style.left=`${n.offsetLeft}px`,r.style.top=`${n.offsetTop}px`,r.style.right="auto",r.style.bottom="auto",r.style.width=`${n.offsetWidth}px`,r.style.height=`${n.offsetHeight}px`,r.style.display="block",r.style.opacity=e.sourceOpacityForCanvas,r.style.visibility=e.sourceVisibleForCanvas?"visible":"hidden";let a=n.getBoundingClientRect(),l=Id(n.offsetWidth,a.width),s=Id(n.offsetHeight,a.height);if(l<=0||s<=0)return r.style.display="none",null;let u=Math.max(1,window.devicePixelRatio||1),c=Math.round(l*u),f=Math.round(s*u);return r.width!==c&&(r.width=c),r.height!==f&&(r.height=f),{width:c,height:f}}function tn(e,t,n){e.uniform3f(t,Number.parseInt(n.slice(1,3),16)/255,Number.parseInt(n.slice(3,5),16)/255,Number.parseInt(n.slice(5,7),16)/255)}function Lt(e,t,n,r){e.set(r,(t*je+n)*4)}function yt(e,t){return Math.min(1,Math.max(1/255,(e*(127/t)+128)/255))}function Oa(e,t,n){return e.length>=3?_o(e,t,n):new Float32Array(je)}function Ft(e,t){return e[t]??0}function dx(e,t,n){let r=Vt(t.red),i=Vt(t.green),o=Vt(t.blue),a=Vt(t.master),l=Oa(n.hueVsHue,-180,180),s=Oa(n.hueVsSaturation,-1,1),u=Oa(n.hueVsLuma,-1,1);for(let c=0;cM+Number(D.enabled),0):0;(v||x||_>0)&&hx(e,t,n,b),Ha(e,t.shadowWheel,n.wheels.shadows),Ha(e,t.midtoneWheel,n.wheels.midtones),Ha(e,t.highlightWheel,n.wheels.highlights),e.uniform1f(t.rgbCurvesEnabled,v?1:0),e.uniform1f(t.hueCurvesEnabled,x?1:0),e.uniform1f(t.secondaryCount,_);for(let[M,D]of t.adjustUniforms)e.uniform1f(D,n.adjust[M]);for(let[M,D]of t.detailUniforms)e.uniform1f(D,n.details[M]);e.uniform1f(t.grainSeed,c),e.uniform1f(t.effectTime,f);for(let[M,D]of t.effectUniforms)e.uniform1f(D,n.effects[M]);let R=n.palette??(n.effects.engraving>0||n.effects.crosshatch>0?Rb:Da),T=R[R.length-1]??Da[1];e.uniform1f(t.paletteSize,R.length),tn(e,t.palette0,R[0]??Da[0]),tn(e,t.palette1,R[1]??T),tn(e,t.palette2,R[2]??T),tn(e,t.palette3,R[3]??T),tn(e,t.palette4,R[4]??T),tn(e,t.palette5,R[5]??T),e.uniform1f(t.intensity,n.intensity),e.uniform1f(t.compareEnabled,l.enabled?1:0),e.uniform1f(t.comparePosition,l.position),e.uniform1f(t.compareSoftness,l.softness),e.uniform1f(t.compareLineWidth,l.lineWidth)}function gx(e){if(!e.sourceHidden){let t=e.element.getAttribute($r);t!==null?(e.sourceInlineOpacity=t===""?null:t,e.sourceInlineOpacityPriority=""):(e.sourceInlineOpacity=e.element.style.getPropertyValue("opacity")||null,e.sourceInlineOpacityPriority=e.element.style.getPropertyPriority("opacity"))}e.element.setAttribute(Nn,"true"),e.element.style.setProperty("opacity","0","important"),e.sourceHidden=!0}function it(e){let t=pu.find(n=>n.path===e);if(!t)throw new Error(`Missing color-grading animation property: ${e}`);return t}var Yd=it("intensity"),Xd=it("lut.intensity"),Jd=it("adjust.exposure"),Qd=it("effects.kuwahara"),Zd=[["blur",it("effects.blur")],["bloom",it("effects.bloom")],["kuwahara",Qd],["pixelate",it("effects.pixelate")],["ascii",it("effects.ascii")],["dither",it("effects.dither")]],ef=[Yd,Xd,Jd,...Zd.map(([,e])=>e)];function Dt(e,t){let n=e.style.getPropertyValue(t.name);if(!n)return null;let r=Number(n);return Number.isFinite(r)?Math.min(t.max,Math.max(t.min,r)):null}function rr(e,t){return t!==null&&(xu(t)||ef.some(n=>Dt(e,n)!==null))}function bx(e,t){let n=null;for(let[r,i]of Zd){let o=Dt(e,i);o!==null&&(n??(n={...t.effects}),n[r]=o)}return n}function xx(e){let{element:t,grading:n}=e,r=Dt(t,Yd),i=Dt(t,Xd),o=Dt(t,Jd),a=bx(t,n);if(![r,i,o].some(u=>u!==null)&&a===null)return n;let s={...n,adjust:o===null?n.adjust:{...n.adjust,exposure:o},effects:a??n.effects};return r!==null&&(s.intensity=r),n.lut&&i!==null&&(s.lut={...n.lut,intensity:i}),s}function tf(e,t,n){e.activeTexture(e.TEXTURE0),e.bindTexture(e.TEXTURE_2D,t),e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,!0),e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,n)}function nf(e,t,n){let r=[t.texture,n.blurTexture,t.lutTexture,n.kuwaharaTexture,n.bloomTexture,t.advancedTexture];for(let[i,o]of r.entries())e.activeTexture(e.TEXTURE0+i),e.bindTexture(e.TEXTURE_2D,o)}function De(e){if(e.destroyed||e.contextLost)return!1;let t=$d(e.element);if(!t)return e.hasDrawn||(e.canvas.style.display="none"),!1;let n=Vd(t);if(!n)return!1;let r=t instanceof HTMLElement?t:e.element,i=e.element.style.getPropertyValue("opacity"),o=e.element.style.getPropertyPriority("opacity"),a=e.sourceHidden&&i==="0"&&o==="important",l=e.element.style.getPropertyValue("visibility"),s=ax(t);s&&sx(e,t),a&&!s&&(e.sourceInlineOpacity!==null?e.element.style.setProperty("opacity",e.sourceInlineOpacity,e.sourceInlineOpacityPriority||""):e.element.style.removeProperty("opacity"));let u=window.getComputedStyle(s?t:e.element);e.sourceOpacityForCanvas=u.opacity||"1",a&&!s&&e.element.style.setProperty("opacity","0","important"),e.sourceVisibleForCanvas=(s||l!=="hidden")&&u.visibility!=="hidden";let c=cx(e,r);if(!c)return!1;let f=window.getComputedStyle(r),m=jd(c.width,c.height,n.width,n.height,f.objectFit,f.objectPosition),{gl:p,program:b}=e;try{let v=xx(e),x=ox(e);tf(p,b.texture,t);let _=Dt(e.element,Qd)!==null,R=Wd(e,v,c,m,{preserveKuwahara:_});p.bindFramebuffer(p.FRAMEBUFFER,null),p.viewport(0,0,c.width,c.height),p.useProgram(b.program),nf(p,b,R);let T=window.__player?.getTime?.(),M=typeof T=="number"&&Number.isFinite(T)?Math.max(0,T):e.element instanceof HTMLVideoElement?Math.max(0,e.element.currentTime):0,D=e.grainSeed+Math.floor(M*60);return Kd(p,b,v,x,R.blurReady,R.bloomReady,R.kuwaharaReady,e.compare,c,m,D,M),or(p,b),gx(e),e.hasDrawn=!0,e.drawError=null,!0}catch(v){return e.drawError=v instanceof Error?v.message:"Shader draw failed",L("runtime.colorGrading.drawEntry",v),!1}}function yx(e,t,n){let r=e.getBoundingClientRect(),i=e.offsetWidth||r.width||t.width,o=e.offsetHeight||r.height||t.height,a=Math.min(320,Math.max(64,Math.round(n??160))),l=i>0&&o>0?i/o:t.width/t.height;return l>=1?{width:a,height:Math.max(1,Math.round(a/l))}:{width:Math.max(1,Math.round(a*l)),height:a}}function vx(){let e=document.createElement("canvas"),t=Ba(e);return t?{canvas:e,...t,lut:null,effectTargets:null,kuwaharaTargets:null,effectError:null}:null}function Sx(e,t){let n=t?void 0:window.__player?.getTime?.();return typeof n=="number"&&Number.isFinite(n)?Math.max(0,n):e instanceof HTMLVideoElement?Math.max(0,e.currentTime):0}function Ax(e,t,n,r){let i=$d(t);if(!i)return null;let o=Vd(i);if(!o)return null;let a=yx(t,o,n);e.canvas.width=a.width,e.canvas.height=a.height;let l=i instanceof HTMLElement?i:t,s=window.getComputedStyle(l),u=jd(a.width,a.height,o.width,o.height,s.objectFit,s.objectPosition);return tf(e.gl,e.program.texture,i),{dimensions:a,uv:u,effectTime:Sx(t,r),grainSeed:Gd(t)+(t instanceof HTMLVideoElement?Math.floor(t.currentTime*60):0)}}async function Ex(e,t,n,r,i=!1){let o=Ax(e,t,r,i);if(!o)return null;let{dimensions:a,uv:l,grainSeed:s,effectTime:u}=o,c=[];for(let f of n.slice(0,32)){let m=Kr(f.grading);if(!m){c.push({id:f.id,dataUrl:null,error:"Invalid grading"});continue}let p=null;try{m.lut&&(e.lut?.src!==m.lut.src&&(e.lut=qb(e,m.lut.src,await zb(m.lut.src))),p=e.lut),c.push({id:f.id,dataUrl:wx(e,m,p,a,l,s,u)})}catch(b){c.push({id:f.id,dataUrl:null,error:Ai(b)})}}return{...a,images:c}}function wx(e,t,n,r,i,o,a){let{canvas:l,gl:s,program:u}=e,c=Wd(e,t,r,i,{releaseIdleTargets:!1});return s.bindFramebuffer(s.FRAMEBUFFER,null),s.viewport(0,0,r.width,r.height),s.useProgram(u.program),nf(s,u,c),n||(e.lut=null),Kd(s,u,t,n,c.blurReady,c.bloomReady,c.kuwaharaReady,nn,r,i,o,a),or(s,u),l.toDataURL("image/png")}function Ye(e,t,n,r){t.addEventListener(n,r),e.cleanup.push(()=>t.removeEventListener(n,r))}function Cx(e){e.animationFrame!==null&&(window.cancelAnimationFrame(e.animationFrame),e.animationFrame=null),e.videoFrameHandle!==null&&e.element instanceof HTMLVideoElement&&(e.element.cancelVideoFrameCallback?.(e.videoFrameHandle),e.videoFrameHandle=null)}function ar(e){if(e.destroyed||!(e.element instanceof HTMLVideoElement)||e.videoFrameHandle!==null||e.animationFrame!==null)return;let t=e.element,n=t;if(typeof n.requestVideoFrameCallback=="function"){e.videoFrameHandle=n.requestVideoFrameCallback(()=>{e.videoFrameHandle=null,De(e),!e.destroyed&&!t.paused&&!t.ended&&ar(e)});return}e.animationFrame=window.requestAnimationFrame(()=>{e.animationFrame=null,De(e),!e.destroyed&&!t.paused&&!t.ended&&ar(e)})}function _x(e){let t=()=>{De(e)};if(Ye(e,e.element,"load",t),Ye(e,e.element,"loadedmetadata",t),Ye(e,e.element,"loadeddata",t),Ye(e,e.element,"seeked",t),Ye(e,e.element,"timeupdate",t),Ye(e,window,"resize",t),e.element instanceof HTMLVideoElement&&(Ye(e,e.element,"play",()=>ar(e)),Ye(e,e.element,"pause",t)),Ye(e,e.canvas,"webglcontextlost",n=>{n.preventDefault(),e.contextLost=!0,e.drawError="WebGL context lost",e.canvas.style.display="none",Ga(e)}),Ye(e,e.canvas,"webglcontextrestored",()=>{if(e.contextLost=!1,!jb(e)){e.contextLost=!0,e.drawError="WebGL context restore failed",Ga(e);return}e.drawError=null,De(e)}),typeof ResizeObserver<"u"&&(e.resizeObserver=new ResizeObserver(t),e.resizeObserver.observe(e.element)),typeof MutationObserver<"u"){let n=()=>{let a=e.element.style;return`${a.transform}|${a.translate}|${a.rotate}|${a.scale}|${a.left}|${a.top}|${a.width}|${a.height}`},r=n(),i=!1,o=new MutationObserver(()=>{i||n()!==r&&(i=!0,requestAnimationFrame(()=>{i=!1,r=n(),De(e)}))});o.observe(e.element,{attributes:!0,attributeFilter:["style"]}),e.cleanup.push(()=>o.disconnect())}}function Tx(e){if(e.destroyed)return null;e.destroyed=!0,Cx(e),e.resizeObserver?.disconnect();for(let t of e.cleanup)t();return e.cleanup.length=0,e.canvas.remove(),Wa(e),Va(e),Ga(e),e.touchedParent&&(e.parentInlinePosition===null?e.touchedParent.style.removeProperty("position"):e.touchedParent.style.position=e.parentInlinePosition),{canvas:e.canvas,gl:e.gl,program:e.program,effectTargets:null,kuwaharaTargets:null,effectError:null}}function rf(e,t){return e.removeAttribute("style"),t.id?e.id=`${uu}${t.id}`:e.removeAttribute("id"),e.className=Cb,e.setAttribute(wb,"true"),e.setAttribute("data-hyperframes-ignore",""),e.setAttribute("data-hyperframes-picker-ignore",""),e.setAttribute("data-hf-ignore",""),e.setAttribute("aria-hidden","true"),e.style.pointerEvents="none",e.style.display="none",t.parentNode?.insertBefore(e,t.nextSibling),e}function Rx(e){return rf(document.createElement("canvas"),e)}function of(){let e=new WeakMap,t=new Set,n=[],r=null,i=null,o=Promise.resolve(),a=!1,l=(E,S,A)=>{let C=e.get(E);if(C)return C.grading=S,C.source=A,De(C),E instanceof HTMLVideoElement&&!E.paused&&ar(C),!0;let F=n.pop();if(F)rf(F.canvas,E);else{let q=Rx(E),W=Ba(q);if(!W)return q.remove(),!1;F={canvas:q,gl:W.gl,program:W.program,effectTargets:null,kuwaharaTargets:null,effectError:null}}let I={element:E,...F,grading:S,compare:{...nn},lut:null,lutLoadingSrc:null,lutError:null,drawError:null,effectTargets:null,kuwaharaTargets:null,effectError:null,source:A,animationFrame:null,videoFrameHandle:null,resizeObserver:null,cleanup:[],touchedParent:null,parentInlinePosition:null,sourceHidden:!1,sourceInlineOpacity:null,sourceInlineOpacityPriority:"",sourceOpacityForCanvas:window.getComputedStyle(E).opacity||"1",sourceVisibleForCanvas:window.getComputedStyle(E).visibility!=="hidden",hasDrawn:!1,contextLost:!1,grainSeed:Gd(E),destroyed:!1};return e.set(E,I),t.add(E),_x(I),De(I),E instanceof HTMLVideoElement&&!E.paused&&ar(I),!0},s=(E,S)=>{if(a)return!1;let A=nr(E);if(!A)return!1;let C=e.get(A);if(!C){let F=gi(A);if(!rr(A,F)||!l(A,F,"attribute"))return!1;C=e.get(A)}return C?(C.compare=Wb(S),De(C),!0):!1},u=E=>{let S=e.get(E);if(!S)return;let A=Tx(S);A&&(S.contextLost||n.length>=Tb?xi(A,!0):n.push(A)),e.delete(E),t.delete(E)},c=()=>{if(a)return 0;let E=new Set;document.querySelectorAll(`video[${Fn}], img[${Fn}]`).forEach(A=>{if(!Nt(A))return;E.add(A);let C=gi(A);rr(A,C)&&(Rd(A)||Ld(A))?l(A,C,"attribute"):u(A)});for(let A of t){let C=e.get(A);C&&(!A.isConnected||C.source==="attribute"&&!E.has(A))&&u(A)}return t.size},f=()=>{if(a)return 0;let E=0;for(let S of t){let A=e.get(S);A&&De(A)&&(E+=1)}return E},m=async()=>{let E=new Set;for(let S of t){let A=e.get(S)?.grading.lut;if(!A?.src.trim()||(A.intensity??1)<=0)continue;let C=Ua(A.src);C.state==="pending"&&E.add(C.promise)}return E.size>0&&await Promise.allSettled(E),f(),E.size},p=()=>{if(a)return 0;let E=0;for(let S of t){let A=e.get(S);!A||!ef.some(F=>Dt(S,F)!==null)||S instanceof HTMLVideoElement&&!S.paused&&!S.ended||De(A)&&(E+=1)}return E},b=(E,S)=>{if(a)return!1;let A=nr(E);if(!A)return!1;let C=Kr(S);return rr(A,C)?l(A,C,"live"):(u(A),!0)},v=(E,S)=>{if(!Nt(E))return!1;let A=e.get(E);if(!A){if(!S)return!1;let C=gi(E);return rr(E,C)&&l(E,C,"attribute")}return A.sourceVisibleForCanvas=S,!S&&A.source==="attribute"&&u(E),!0},x=E=>{let S=nr(E);if(!S)return{state:"missing",message:"Media not found"};let A=e.get(S);if(A)return A.effectError?{state:"unavailable",message:A.effectError}:A.drawError?{state:"unavailable",message:A.drawError}:A.lutError?{state:"unavailable",message:`LUT error: ${A.lutError}`}:A.grading.lut&&A.lutLoadingSrc?{state:"pending",message:"Loading LUT"}:A.canvas.style.display==="none"?{state:"pending",message:"Waiting for media frame"}:{state:"active",message:A.lut?"Shader + LUT active":"Shader active"};let C=gi(S);return rr(S,C)?!Rd(S)&&!Ld(S)?{state:"pending",message:"Waiting for visible media"}:{state:"unavailable",message:"WebGL unavailable"}:{state:"inactive",message:"No grading applied"}},_=async(E,S,A)=>{let C=async()=>{if(a||S.length===0)return null;let I=nr(E);return!I||(i??(i=vx()),!i)?null:Ex(i,I,S,A?.maxDimension,A?.useMediaTime)},F=o.then(C,C);return o=F.then(()=>{},()=>{}),F},R=E=>{let S=nr(E);if(!(S instanceof HTMLVideoElement))return null;if(!S.paused)return()=>{};let A=S.currentTime,C=S.loop,F=S.muted;return S.loop=!0,S.muted=!0,(S.ended||Number.isFinite(S.duration)&&A>=S.duration)&&(S.currentTime=0),S.play().catch(()=>{}),()=>{S.pause(),S.loop=C,S.muted=F,S.currentTime=A}},T=()=>{if(!a){a=!0,r?.disconnect(),r=null;for(let E of t)u(E);for(let E of n)xi(E,!0);n.length=0,i&&(xi(i,!0),i=null)}};document.body&&(r=new MutationObserver(()=>c()),r.observe(document.body,{childList:!0,subtree:!0,attributes:!0,attributeFilter:[Fn]}));let M={refresh:c,redraw:f,redrawAnimated:p,waitForActiveLuts:m,setGrading:b,setCompare:s,setSourceVisibility:v,getStatus:x,renderPreviews:_,startPreviewPlayback:R,destroy:T},D=window;return D.__hf=D.__hf||{},D.__hf.colorGrading=M,c(),M}var Ei=class{constructor(t){ge(this,"_baseTime",0);ge(this,"_playStartMs",null);ge(this,"_rate",1);ge(this,"_duration",1/0);ge(this,"_nowMs");ge(this,"_audioSource",null);this._baseTime=t?.initialTime??0,this._rate=t?.rate??1,this._duration=t?.duration??1/0,this._nowMs=t?.nowMs??(()=>performance.now())}now(){if(this._playStartMs===null)return this._baseTime;if(this._audioSource){let r=null;if("currentTimeSeconds"in this._audioSource)r=this._audioSource.currentTimeSeconds;else{let{el:i,compositionStart:o,mediaStart:a}=this._audioSource;!i.paused&&Number.isFinite(i.currentTime)&&(r=(i.currentTime-a)/(i.playbackRate>0?i.playbackRate:1)*this._rate+o)}if(r!==null)return Number.isFinite(this._duration)&&r>=this._duration?this._duration:Math.max(0,r)}let t=(this._nowMs()-this._playStartMs)/1e3,n=this._baseTime+t*this._rate;return Number.isFinite(this._duration)&&n>=this._duration?this._duration:Math.max(0,n)}play(){return this._playStartMs!==null||Number.isFinite(this._duration)&&this._baseTime>=this._duration?!1:(this._playStartMs=this._nowMs(),!0)}pause(){return this._playStartMs===null?!1:(this._baseTime=this.now(),this._playStartMs=null,!0)}seek(t){let n=Number.isFinite(this._duration)?Math.max(0,Math.min(t,this._duration)):Math.max(0,t);this._baseTime=n,this._playStartMs!==null&&(this._playStartMs=this._nowMs())}isPlaying(){return this._playStartMs!==null}setRate(t){let n=Number.isFinite(t)&&t>0?Math.max(.1,Math.min(5,t)):1;this._playStartMs!==null&&(this._baseTime=this.now(),this._playStartMs=this._nowMs()),this._rate=n}getRate(){return this._rate}setDuration(t){this._duration=Number.isFinite(t)&&t>0?t:1/0,this._baseTime>this._duration&&(this._baseTime=this._duration)}getDuration(){return this._duration}attachAudioSource(t){this._audioSource=t}detachAudioSource(){this._audioSource&&this._playStartMs!==null&&(this._baseTime=this.now(),this._playStartMs=this._nowMs()),this._audioSource=null}hasAudioSource(){return this._audioSource!==null}getSource(){if(this._audioSource&&this._playStartMs!==null){if("currentTimeSeconds"in this._audioSource)return"audio";let{el:t}=this._audioSource;if(!t.paused&&Number.isFinite(t.currentTime))return"audio"}return"monotonic"}snapshot(){return{time:this.now(),playing:this.isPlaying(),rate:this._rate,duration:this._duration,source:this.getSource()}}reachedEnd(){return Number.isFinite(this._duration)&&this.now()>=this._duration}};var kx=100,Mx=8,Fx=4096,za=e=>e;function Nx(e,t,n){return!(!!e.curve||e.viaX!==void 0&&e.viaY!==void 0)&&t==="linear"&&!n}function Lx(e){let t=Math.ceil(e*kx);return Math.min(Fx,Math.max(Mx,t))}function Dx(e,t,n,r,i){let{scheduledAt:o,elapsed:a,rate:l}=r,s=i??za,u=R=>o+(R-a)/l,c=e.points[t],f=e.points[t+1],m=u(f.t);if(m<=o)return null;let p=Math.max(o,u(c.t)),b=m-p;if(b<=0)return null;if(Nx(c,n,i))return{kind:"ramp",time:m,value:s(f.v)};let v=Lx(b),x=Ll(e,Math.max(c.t,a),f.t,v,n),_=new Float32Array(v);for(let R=0;Rl.id).map(l=>[l.id,l.handle])),a=[];for(let l of e.lanes){let s=Cn(l.target);if(!s)continue;let u=s.kind==="preset"?i?.[s.presetId]:s.kind==="fx"?o.get(s.nodeId)?.automation?.[s.param]:void 0;if(!u||u.length===0)continue;let c=fo(l.target,t);c&&(qa(u,l,c.scale,r),a.push(...u))}return a}function sf(e){return e.lanes.find(t=>t.target===Bt)??null}var Ox=`\nconst dbToLin = (db) => Math.pow(10, db / 20);\n\n/**\n * One-pole envelope followers, one per channel.\n *\n * Per channel matters: the followers advance once per sample, so a single shared\n * follower stepped once per channel per sample. On stereo that ran a 20 ms attack\n * as 10 ms, and gave the right channel a gain computed from an envelope that had\n * already traversed the left \\u2014 so the two channels ducked by different amounts\n * from the same input and the image pumped.\n */\nclass EnvBank {\n constructor(attackMs, releaseMs) { this.set(attackMs, releaseMs); this.values = []; }\n set(attackMs, releaseMs) {\n this.a = Math.exp(-1 / (sampleRate * Math.max(1e-5, attackMs / 1000)));\n this.r = Math.exp(-1 / (sampleRate * Math.max(1e-5, releaseMs / 1000)));\n }\n push(ch, x) {\n const prev = this.values[ch] ?? 0;\n const m = Math.abs(x);\n const c = m > prev ? this.a : this.r;\n const next = m + c * (prev - m);\n this.values[ch] = next;\n return next;\n }\n}\n\n/** Soft-knee gain computer in dB, matching acompressor\'s shape. */\nfunction kneeGain(envDb, thresholdDb, ratio, kneeDb) {\n const over = envDb - thresholdDb;\n if (kneeDb > 0 && over > -kneeDb && over < kneeDb) {\n const t = (over + kneeDb) / (2 * kneeDb);\n return -((1 - 1 / ratio) * kneeDb * t * t);\n }\n return over > 0 ? -(over * (1 - 1 / ratio)) : 0;\n}\n\n// log10/exp per sample is the single most expensive thing a dynamics processor\n// can do on the audio thread, and every sample below the knee needs neither:\n// its gain is exactly unity. Comparing envelopes in the linear domain lets the\n// quiet majority of samples skip the transcendentals entirely.\nconst LN10_OVER_20 = Math.LN10 / 20;\nconst dbToLinFast = (db) => Math.exp(db * LN10_OVER_20);\n\nclass HfCompressor extends AudioWorkletProcessor {\n constructor(o) {\n super();\n this.p = o.processorOptions || {};\n this.env = new EnvBank(this.p.attack ?? 20, this.p.release ?? 250);\n this.port.onmessage = (e) => {\n if (e.data && e.data.__hfDispose) { this.dead = true; return; }\n this.p = { ...this.p, ...e.data };\n this.env.set(this.p.attack ?? 20, this.p.release ?? 250);\n };\n }\n process(inputs, outputs) {\n if (this.dead) return false;\n const i = inputs[0], o = outputs[0];\n if (!i || !i.length) return true;\n const p = this.p;\n const makeup = dbToLin(p.makeup ?? 0);\n const mix = p.mix ?? 1;\n // Knee is expressed as a ratio in FFmpeg; convert to dB width.\n const kneeDb = 20 * Math.log10(Math.max(1.0001, p.knee ?? 2.83));\n const thresholdDb = p.threshold ?? -24;\n const ratio = p.ratio ?? 4;\n // Below this the gain computer returns unity, so the sample needs no\n // logarithm at all.\n const kneeStartLin = dbToLin(thresholdDb - kneeDb);\n const dry = 1 - mix;\n for (let ch = 0; ch < i.length; ch++) {\n const inp = i[ch], out = o[ch];\n for (let n = 0; n < inp.length; n++) {\n const x = inp[n];\n // Per-channel follower, and the sub-knee shortcut: below the knee the\n // gain is exactly unity, so the sample needs no logarithm at all.\n const env = this.env.push(ch, x);\n if (env <= kneeStartLin) {\n out[n] = x * makeup * mix + x * dry;\n continue;\n }\n const envDb = 20 * Math.log10(env);\n const g = dbToLinFast(kneeGain(envDb, thresholdDb, ratio, kneeDb));\n out[n] = x * g * makeup * mix + x * dry;\n }\n }\n return true;\n }\n}\nregisterProcessor("hf-compressor", HfCompressor);\n\nclass HfLimiter extends AudioWorkletProcessor {\n constructor(o) {\n super();\n this.p = o.processorOptions || {};\n this.env = new EnvBank(this.p.attack ?? 5, this.p.release ?? 50);\n this.port.onmessage = (e) => {\n if (e.data && e.data.__hfDispose) { this.dead = true; return; }\n this.p = { ...this.p, ...e.data };\n this.env.set(this.p.attack ?? 5, this.p.release ?? 50);\n };\n }\n process(inputs, outputs) {\n if (this.dead) return false;\n const i = inputs[0], o = outputs[0];\n if (!i || !i.length) return true;\n const ceiling = dbToLin(this.p.limit ?? -1);\n const outGain = dbToLin(this.p.level_out ?? 0);\n for (let ch = 0; ch < i.length; ch++) {\n const inp = i[ch], out = o[ch];\n for (let n = 0; n < inp.length; n++) {\n const x = inp[n];\n const env = this.env.push(ch, x);\n // Only ever attenuate: a limiter that can raise level is a compressor.\n const g = env > ceiling ? ceiling / env : 1;\n out[n] = x * g * outGain;\n }\n }\n return true;\n }\n}\nregisterProcessor("hf-limiter", HfLimiter);\n\nclass HfGate extends AudioWorkletProcessor {\n constructor(o) {\n super();\n this.p = o.processorOptions || {};\n this.env = new EnvBank(this.p.attack ?? 1, this.p.release ?? 100);\n this.gains = [];\n this.port.onmessage = (e) => {\n if (e.data && e.data.__hfDispose) { this.dead = true; return; }\n this.p = { ...this.p, ...e.data };\n this.env.set(this.p.attack ?? 1, this.p.release ?? 100);\n };\n }\n process(inputs, outputs) {\n if (this.dead) return false;\n const i = inputs[0], o = outputs[0];\n if (!i || !i.length) return true;\n const p = this.p;\n const threshold = dbToLin(p.threshold ?? -35);\n const floor = dbToLin(p.range ?? -24);\n const ratio = p.ratio ?? 10;\n // Knee is declared in the registry as a ratio, like the compressor\'s; a\n // hard threshold ignored it and chattered on material sitting right at the\n // gate point.\n const kneeDb = 20 * Math.log10(Math.max(1.0001, p.knee ?? 2.83));\n const kneeLin = dbToLin((p.threshold ?? -35) + kneeDb);\n for (let ch = 0; ch < i.length; ch++) {\n const inp = i[ch], out = o[ch];\n for (let n = 0; n < inp.length; n++) {\n const x = inp[n];\n const env = this.env.push(ch, x);\n let target = 1;\n // Above the threshold the gate is fully open; skip the pow entirely.\n if (env < threshold) {\n const under = env > 1e-9 ? threshold / env : 1e9;\n target = Math.max(floor, 1 / Math.pow(under, ratio - 1));\n if (!isFinite(target)) target = floor;\n }\n // Smooth toward the target so the gate does not click on every sample.\n const held = this.gains[ch] ?? 1;\n const c = target < held ? this.env.r : this.env.a;\n const smoothed = target + c * (held - target);\n this.gains[ch] = smoothed;\n out[n] = x * smoothed;\n }\n }\n return true;\n }\n}\nregisterProcessor("hf-gate", HfGate);\n\nclass HfBitcrush extends AudioWorkletProcessor {\n constructor(o) {\n super();\n this.p = o.processorOptions || {};\n this.holds = [];\n this.held = [];\n this.port.onmessage = (e) => {\n if (e.data && e.data.__hfDispose) { this.dead = true; return; }\n this.p = { ...this.p, ...e.data };\n };\n }\n process(inputs, outputs) {\n if (this.dead) return false;\n const i = inputs[0], o = outputs[0];\n if (!i || !i.length) return true;\n const p = this.p;\n const levels = Math.pow(2, (p.bits ?? 8) - 1);\n const step = Math.max(1, Math.round(p.samples ?? 1));\n const mix = p.mix ?? 1;\n for (let ch = 0; ch < i.length; ch++) {\n const inp = i[ch], out = o[ch];\n if (this.held[ch] === undefined) this.held[ch] = 0;\n if (this.holds[ch] === undefined) this.holds[ch] = 0;\n for (let n = 0; n < inp.length; n++) {\n // Per channel: advancing one shared counter only on the last channel\n // left every earlier channel either unheld or frozen for a whole\n // 128-sample quantum, clicking once a block.\n if (this.holds[ch] === 0) this.held[ch] = Math.round(inp[n] * levels) / levels;\n out[n] = this.held[ch] * mix + inp[n] * (1 - mix);\n this.holds[ch] = (this.holds[ch] + 1) % step;\n }\n }\n return true;\n }\n}\nregisterProcessor("hf-bitcrush", HfBitcrush);\n\n/** Linear-interpolated read, \\`delaySamples\\` behind the write head. */\nfunction readTap(ring, write, delaySamples) {\n const len = ring.length;\n const pos = (write - 1 - delaySamples + len) % len;\n const i0 = Math.floor(pos);\n const frac = pos - i0;\n const i1 = (i0 + 1) % len;\n return ring[i0] * (1 - frac) + ring[i1] * frac;\n}\n\n/** Equal-power-ish crossfade, zero at a tap\'s reset point \\u2014 hides the splice. */\nfunction xfade(phase) {\n return Math.sin(Math.PI * phase);\n}\n\n/**\n * Dual-tap granular delay line: two read taps 180\\xB0 apart in a 100 ms grain,\n * each sweeping at a speed relative to the write head that shifts pitch\n * without changing duration. One tap is always fading in as the other fades\n * out, which hides the splice each tap makes when it wraps.\n *\n * write/phase are block-level state, advanced once per SAMPLE across all\n * channels together (not once per channel) \\u2014 advancing them inside the\n * per-channel loop would move the tap 2x/4x too fast on a stereo/quad input.\n */\nclass HfPitchshift extends AudioWorkletProcessor {\n constructor(o) {\n super();\n this.p = o.processorOptions || {};\n this.grain = Math.round(sampleRate * 0.1);\n this.buf = [];\n this.write = 0;\n this.phase = 0;\n // Samples written so far, capped at one grain. The taps read up to a grain\n // behind the write head, so until this fills they would read the ring\'s\n // zeros \\u2014 the head of every clip came out attenuated or silent.\n this.filled = 0;\n // How much of the wet (pitch-shifted) path is currently in the output, and\n // where it is heading. Crossing between dry and wet is a ~50 ms jump in the\n // signal, so it is RAMPED rather than switched: a hard swap either way is a\n // click. Ramping in both directions is also what lets a node return to true\n // bypass at semitones 0 \\u2014 a one-way latch left preview stuck with the delay\n // that the render, building a fresh node from the attribute, does not have.\n this.wet = 0;\n this.wetTarget = 0;\n // ~15 ms one-pole, short enough to feel immediate on a slider drag and long\n // enough that the splice is inaudible.\n this.wetCoef = Math.exp(-1 / (sampleRate * 0.015));\n this.port.onmessage = (e) => {\n if (e.data && e.data.__hfDispose) { this.dead = true; return; }\n this.p = { ...this.p, ...e.data };\n };\n }\n process(inputs, outputs) {\n if (this.dead) return false;\n const i = inputs[0], o = outputs[0];\n if (!i || !i.length) return true;\n const p = this.p;\n const semitones = Math.max(-12, Math.min(12, p.semitones ?? 0));\n const mix = Math.max(0, Math.min(1, p.mix ?? 1));\n const grain = this.grain;\n const ringLen = grain * 2;\n const n = i[0] ? i[0].length : 0;\n for (let ch = 0; ch < i.length; ch++) {\n if (!this.buf[ch]) this.buf[ch] = new Float32Array(ringLen);\n }\n\n // Nothing to shift, or mixed fully out. The grain delay is ~grain/2\n // whatever the ratio, so at semitones=0 this degenerated into a pure 50 ms\n // delay of the signal \\u2014 while the copy for that exact setting reads\n // "Unchanged pitch".\n this.wetTarget = semitones === 0 ? 0 : mix;\n\n // Fully dry AND settled: take the cheap transparent path. The ring keeps\n // filling, so a later shift does not start cold.\n if (this.wetTarget === 0 && this.wet < 1e-4) {\n this.wet = 0;\n let w = this.write;\n for (let s = 0; s < n; s++) {\n for (let ch = 0; ch < i.length; ch++) {\n const x = i[ch][s];\n this.buf[ch][w] = x;\n o[ch][s] = x;\n }\n w = (w + 1) % ringLen;\n }\n this.write = w;\n this.filled = Math.min(grain, this.filled + n);\n return true;\n }\n\n const ratio = Math.pow(2, semitones / 12);\n const inc = (1 - ratio) / grain;\n let write = this.write, phase = this.phase, filled = this.filled, wetNow = this.wet;\n const target = this.wetTarget, coef = this.wetCoef;\n for (let s = 0; s < n; s++) {\n phase += inc;\n phase -= Math.floor(phase);\n const phaseB = (phase + 0.5) % 1;\n const gA = xfade(phase), gB = xfade(phaseB);\n // Ramp the wet path in as the ring fills rather than reading zeros:\n // 100 ms of unshifted audio at the head of a clip beats 50 ms of silence.\n const warm = filled >= grain ? 1 : filled / grain;\n wetNow = target + coef * (wetNow - target);\n const wetMix = wetNow * warm;\n for (let ch = 0; ch < i.length; ch++) {\n const ring = this.buf[ch];\n const inp = i[ch], out = o[ch];\n const x = inp[s];\n ring[write] = x;\n const wet =\n readTap(ring, write, phase * grain) * gA + readTap(ring, write, phaseB * grain) * gB;\n out[s] = x * (1 - wetMix) + wet * wetMix;\n }\n write = (write + 1) % ringLen;\n if (filled < grain) filled++;\n }\n this.write = write;\n this.phase = phase;\n this.filled = filled;\n this.wet = wetNow;\n return true;\n }\n}\nregisterProcessor("hf-pitchshift", HfPitchshift);\n`,$a=new WeakMap;function ja(e){return lf.has(e)}var lf=new WeakSet;function Ka(e){let t=$a.get(e);return t||(t=(async()=>{if(!e.audioWorklet)throw new Error("AudioWorklet is unavailable \\u2014 the page needs a secure context (https, localhost or file://)");let n=`data:text/javascript;base64,${btoa(String.fromCharCode(...new TextEncoder().encode(Ox)))}`;await e.audioWorklet.addModule(n),lf.add(e)})().catch(n=>{throw $a.delete(e),n}),$a.set(e,t)),t}function Hx(e,t,n){let r=.6+Math.max(0,Math.min(1,t))*2.6,i=Math.max(1,Math.floor(e*r)),o=new Float32Array(i),a=Math.round(t*1e3)*2654435761+Math.round(n*1e3)*40503>>>0,l=()=>(a=a*1664525+1013904223>>>0,a/4294967295*2-1),s=Math.max(.001,1-Math.max(0,Math.min(1,n))),u=0,c=0;for(let m=0;m0)for(let m=0;mtypeof e=="number"?e:Number(e??0),Ya=e=>e/1e3;function ff(e,t,n,r){let i=Math.max(1,Math.round(e.sampleRate)),o=e.createBuffer(1,i,e.sampleRate),a=o.getChannelData(0);for(let u=0;u1-n}]}function pf(e,t,n){e.gain.value=n,t.gain.value=1-n}function Ja(e,t,n){return{input:e,output:e,update:t,automation:n,dispose:()=>e.disconnect()}}var Gx=new Set(["peaking","highpass","lowpass"]),uf=e=>Math.pow(10,e/20),Bx=(e,t)=>{let n=e.createGain(),r=i=>{n.gain.value=uf(de(i.gain))};return r(t),Ja(n,r,{gain:[{param:n.gain,map:uf}]})};function ur(e,t){return(n,r)=>{let i=n.createBiquadFilter();i.type=e;let o=a=>{i.frequency.value=de(a.frequency),a.q!==void 0&&(i.Q.value=de(a.q)),t&&(i.gain.value=de(a.gain))};return o(r),Ja(i,o,{frequency:[{param:i.frequency}],...Gx.has(e)?{q:[{param:i.Q}]}:{},...t?{gain:[{param:i.gain}]}:{}})}}function Ux(e){return(t,n)=>{let r=Math.tan(Math.PI*de(n.frequency)/t.sampleRate),i=e==="highpass"?t.createIIRFilter([1/(1+r),-1/(1+r)],[1,(r-1)/(r+1)]):t.createIIRFilter([r/(1+r),r/(1+r)],[1,(r-1)/(r+1)]);return Ja(i,()=>{})}}function cr(e){return(t,n)=>{let r=new AudioWorkletNode(t,e,{processorOptions:{...n}});return{input:r,output:r,update:i=>r.port.postMessage({...i}),dispose:()=>{r.port.postMessage({__hfDispose:!0}),r.disconnect()}}}}var Wx={tanh:Math.tanh,atan:e=>2/Math.PI*Math.atan(Math.PI/2*e),cubic:e=>Math.abs(e)>=1?Math.sign(e):e-e**3/3,exp:e=>Math.sign(e)*(1-Math.exp(-Math.abs(e))),alg:e=>e/Math.sqrt(1+e*e),quintic:e=>Math.abs(e)>=1?Math.sign(e):e-e**5/5,sin:e=>Math.abs(e)>=1?Math.sign(e):Math.sin(Math.PI/2*e),erf:e=>Math.tanh(1.20211*e),hard:e=>Math.max(-1,Math.min(1,e))},Vx=(e,t)=>{let n=e.createWaveShaper(),r=e.createGain(),i=e.createGain();r.connect(n).connect(i);let o=a=>{let l=Wx[String(a.type)]??Math.tanh,s=Math.pow(10,de(a.threshold)/20),u=8192,c=new Float32Array(u);for(let f=0;f=4?"4x":de(a.oversample)>=2?"2x":"none",i.gain.value=Math.pow(10,de(a.output)/20)};return o(t),{input:r,output:i,update:o,automation:{output:[{param:i.gain,map:a=>Math.pow(10,a/20)}]},dispose:()=>{r.disconnect(),n.disconnect(),i.disconnect()}}},zx=(e,t)=>{let n=e.createGain(),r=e.createGain(),i=e.createDelay(5),o=e.createGain(),a=e.createGain(),l=e.createGain();n.connect(i),i.connect(o),o.connect(i),i.connect(a).connect(r),n.connect(l).connect(r);let s=u=>{i.delayTime.value=Math.min(5,de(u.time)/1e3),o.gain.value=de(u.feedback),pf(a,l,de(u.mix))};return s(t),{input:n,output:r,update:s,automation:{time:[{param:i.delayTime,map:u=>Math.min(5,Ya(u))}],feedback:[{param:o.gain}],mix:Xa(a.gain,l.gain)},dispose:()=>[n,r,i,o,a,l].forEach(u=>u.disconnect())}},qx=(e,t,n)=>{let r=e.createGain(),i=e.createGain(),o=e.createDelay(.5),a=ff(e,"sine",de(t.speed),n),l=e.createGain(),s=e.createGain(),u=e.createGain();a.connect(l).connect(o.delayTime),r.connect(o).connect(s).connect(i),r.connect(u).connect(i);let c=f=>{o.delayTime.value=de(f.delay)/1e3,l.gain.value=de(f.depth)/1e3,a.playbackRate.value=de(f.speed),pf(s,u,de(f.mix))};return c(t),{input:r,output:i,update:c,automation:{delay:[{param:o.delayTime,map:Ya}],depth:[{param:l.gain,map:Ya}],speed:[{param:a.playbackRate}],mix:Xa(s.gain,u.gain)},dispose:()=>{mf(a),[r,i,o,l,s,u].forEach(f=>f.disconnect())}}},$x=6,jx=(e,t,n)=>{let r=e.createGain(),i=e.createGain(),o=e.createGain(),a=e.createGain(),l=ff(e,String(t.type)==="1"?"sine":"triangle",de(t.speed),n),s=e.createGain(),u=e.createGain(),c=e.createGain(),f=[];r.connect(o);let m=o;for(let b=0;b<$x;b++){let v=e.createBiquadFilter();v.type="allpass",v.Q.value=.7071,s.connect(v.frequency),m.connect(v),m=v,f.push(v)}l.connect(s),m.connect(u).connect(a),o.connect(c).connect(a),a.connect(i);let p=b=>{let v=1e3/Math.max(.1,de(b.delay));for(let x of f)x.frequency.value=v;s.gain.value=v*de(b.decay),l.playbackRate.value=de(b.speed),o.gain.value=de(b.in_gain),a.gain.value=de(b.out_gain),u.gain.value=1,c.gain.value=1};return p(t),{input:r,output:i,update:p,automation:{speed:[{param:l.playbackRate}],in_gain:[{param:o.gain}],out_gain:[{param:a.gain}]},dispose:()=>{mf(l),[r,i,o,a,s,u,c,...f].forEach(b=>b.disconnect())}}},Kx=(e,t)=>{let n=e.createGain(),r=e.createGain(),i=e.createConvolver(),o=e.createGain(),a=e.createGain();i.normalize=!1,n.connect(i).connect(o).connect(r),n.connect(a).connect(r);let l="",s=u=>{let c=`${de(u.size)}:${de(u.damping)}`;if(c!==l){let f=Hx(e.sampleRate,de(u.size),de(u.damping)),m=e.createBuffer(1,f.length,e.sampleRate);m.getChannelData(0).set(f),i.buffer=m,l=c}o.gain.value=de(u.wet),a.gain.value=de(u.dry)};return s(t),{input:n,output:r,update:s,automation:{wet:[{param:o.gain}],dry:[{param:a.gain}]},dispose:()=>[n,r,i,o,a].forEach(u=>u.disconnect())}},Yx={"gain-node":Bx,"biquad-peaking":ur("peaking",!0),"biquad-lowshelf":ur("lowshelf",!0),"biquad-highshelf":ur("highshelf",!0),"biquad-highpass":ur("highpass",!1),"biquad-lowpass":ur("lowpass",!1),"worklet-compressor":cr("hf-compressor"),"worklet-limiter":cr("hf-limiter"),"worklet-gate":cr("hf-gate"),"worklet-bitcrush":cr("hf-bitcrush"),"worklet-pitchshift":cr("hf-pitchshift"),waveshaper:Vx,"delay-feedback":zx,"chorus-lfo":qx,"allpass-phaser":jx,convolver:Kx};function hf(e){return e.nodes.some(t=>Sn(t.type)?.web.startsWith("worklet-")??!1)}function Xx(e,t,n,r=0){let i=Sn(t);if(!i)throw new Error(`Unknown effect type: ${t}`);let o=An(t,n);if((t==="highpass"||t==="lowpass")&&String(o.poles)==="1")return Ux(t)(e,o,r);let a=Yx[i.web];if(!a)throw new Error(`No Web Audio builder for ${i.web}`);return a(e,o,r)}function cf(e){let t=[];for(let n of e){let r=n.fromPreset,i=t.at(-1);if(i&&i.preset===r)i.nodes.push(n);else{let o=typeof n.presetAmount=="number"?n.presetAmount:1;t.push({...r?{preset:r}:{},amount:Math.min(1,Math.max(0,o)),nodes:[n]})}}return t}function df(e){return En(e).map(t=>{let n=An(t.type,t.params),r=n.poles!==void 0?`:${n.poles}`:"",i=String(n.poles)==="1"?`@${n.frequency}`:"",o=t.type==="phaser"?`~${n.type}`:"",a=t.fromPreset?`%${t.fromPreset}`:"";return`${t.type}${r}${i}${o}${a}`}).join("|")}function gf(e,t,n=0){var f;let r=e.createGain(),i=e.createGain(),o=[],a=[],l=cf(En(t)),s=r;for(let m of l){let p=null;if(m.preset){let b=e.createGain(),v=e.createGain(),x=e.createGain(),_=e.createGain();x.gain.value=m.amount,v.gain.value=1-m.amount,s.connect(b),b.connect(v).connect(_),p={entry:b,wet:x,dry:v,join:_},s=b}for(let b of m.nodes){let v=Xx(e,b.type,b.params??{},n);s.connect(v.input),s=v.output,o.push({...b.id?{id:b.id}:{},type:b.type,handle:v})}p&&m.preset&&(s.connect(p.wet).connect(p.join),a.push({id:m.preset,...p}),s=p.join)}s.connect(i);let u=df(t),c={};for(let m of a)(c[f=m.id]??(c[f]=[])).push(...Xa(m.wet.gain,m.dry.gain));return{input:r,output:i,presets:c,nodes:o,update(m){if(df(m)!==u)return!1;En(m).forEach((b,v)=>{let x=o[v];x&&(x.handle.update(An(b.type,b.params)),b.id===void 0?delete x.id:x.id=b.id)});let p=0;for(let b of cf(En(m))){if(!b.preset)continue;let v=a[p++];!v||v.id!==b.preset||(v.wet.gain.value=b.amount,v.dry.gain.value=1-b.amount)}return!0},dispose(){for(let{handle:m}of o)m.dispose();for(let{entry:m,wet:p,dry:b,join:v}of a)m.disconnect(),p.disconnect(),b.disconnect(),v.disconnect();r.disconnect(),i.disconnect()}}}var bf={version:1,nodes:[]},xf={version:1,lanes:[]};function yf(e,t){let n=(typeof e.getAttribute=="function"?e.getAttribute(et):null)??"";if(!n)return xf;try{return Fl(Or(n),t)}catch{return xf}}function on(e){let t=(typeof e.getAttribute=="function"?e.getAttribute(Tt):null)??"";if(!t)return{chain:bf,raw:""};try{return{chain:Rl(t),raw:t}}catch{return{chain:bf,raw:""}}}function vf(e){return yf(e,on(e).chain)}function wi(e,t,n,r,i){let{chain:o}=on(t),a=null,l=[],s=!1,u=0,c=()=>{try{a?(n.disconnect(a.input),a.output.disconnect(r),a.dispose()):n.disconnect(r)}catch{}a=null},f=(T,M)=>{if(T.nodes.length===0){n.connect(r);return}if(hf(T)&&!ja(e)){n.connect(r);let D=++u;Ka(e).then(()=>{s||D!==u||x(on(t).chain)}).catch(()=>{});return}try{let D=gf(e,T,M);n.connect(D.input),D.output.connect(r),a=D}catch{n.connect(r)}},m=(T,M)=>{l=M&&a?af(yf(t,T),T,a.nodes,M,a.presets):[]},p=i?{...i}:null;f(o,p?.elapsed??0),m(o,p);let b=()=>{if(!p)return null;let T=typeof e.currentTime=="number"?e.currentTime:p.scheduledAt;return{scheduledAt:T,elapsed:p.elapsed+(T-p.scheduledAt)*p.rate,rate:p.rate}},v=T=>{let M=b();M&&(rn(l,M.scheduledAt),m(T,M))},x=T=>{let M=b();rn(l,M?.scheduledAt??0),c(),f(T,M?.elapsed??0),m(T,M)},_=null,R=t;return typeof MutationObserver<"u"&&typeof R?.nodeType=="number"&&(_=new MutationObserver(()=>{let T=on(t);l.length>0&&lr(l),!a||!a.update(T.chain)?x(T.chain):v(T.chain)}),_.observe(R,{attributes:!0,attributeFilter:[Tt,et]})),{reanchor:T=>{if(s)return;let M=b();M&&rn(l,M.scheduledAt),p={...T},m(on(t).chain,p)},setRate:T=>{let M=b();s||!M||!Number.isFinite(T)||T<=0||T===M.rate||(p={...M,rate:T},rn(l,M.scheduledAt),m(on(t).chain,p))},dispose:()=>{s=!0,_?.disconnect(),l.length>0&&rn(l,typeof e.currentTime=="number"?e.currentTime:0),a?.dispose()}}}var Sf="runtime_web_audio_bypass";function Qa(e,t){return typeof e.getAttribute=="function"?e.getAttribute(t):null}function dr(e,t){return Qa(e,t)!==null}function Jx(e){return dr(e,"crossorigin")?!0:e.crossOrigin!=null}function Qx(e){return typeof e.baseURI=="string"&&e.baseURI?e.baseURI:typeof document<"u"?document.baseURI:""}function Zx(e){let t=typeof e.currentSrc=="string"?e.currentSrc:"";if(t)return[t];let n=Qa(e,"src");if(n)return[n];if(typeof e.querySelectorAll!="function")return[];let r=[];for(let i of Array.from(e.querySelectorAll("source"))){let o=i.getAttribute("src");o&&r.push(o)}return r}function ey(e,t){if(typeof window>"u")return!1;let n;try{n=new URL(e,Qx(t))}catch{return!1}return n.protocol!=="http:"&&n.protocol!=="https:"||n.origin===window.location.origin?!1:!Jx(t)}function Ef(e){return(typeof e.currentSrc=="string"?e.currentSrc:"")?!0:dr(e,"src")}function an(e){for(let t of Zx(e))if(ey(t,e))return{kind:"decode-only",reason:"cross_origin_no_cors",asset:t};return{kind:"web-audio"}}function ty(e){let t=[];dr(e,Tt)&&t.push("fx-chain"),dr(e,et)&&t.push("automation"),dr(e,Gr)&&t.push("audio-group");let n=Number.parseFloat(Qa(e,"data-volume")??"");return Number.isFinite(n)&&n>1&&t.push("above-unity-gain"),t}function ny(){return typeof window<"u"&&!!window.__HF_EXPORT_RENDER_SEEK_CONFIG}var Af=new WeakSet;function sn(e,t){if(t.kind==="web-audio"||ny()||Af.has(e))return;let n=ty(e);Af.add(e);let r={asset:t.asset,reason:t.reason,lostProcessing:n,note:"cross-origin media without a `crossorigin` opt-in is silent through createMediaElementSource (Web Audio spec); using native playback instead"};be({source:"hf-preview",type:"diagnostic",code:Sf,details:r});let i=n.length>0?` Native playback cannot reproduce: ${n.join(", ")} \\u2014 proxy or download the asset to a same-origin URL to keep it.`:"";console.info(`[hyperframes] ${Sf}: "${t.asset}" (${t.reason}): Web Audio capture withheld; the track plays through native HTMLMediaElement output.${i}`)}function Za(e){return!Number.isFinite(e)||e<=0?1:e}function wf(e){return Le(e)}function ry(e,t){t||e.paused||!Cr().__hfDebug||console.debug("[hyperframes] webAudioTransport claimed fallback-playing element:",e.currentSrc||e.getAttribute("src")||"")}function iy(e,t){let{elapsed:n,mediaStart:r,scheduledAt:i,globalRate:o,mediaRate:a,clipDuration:l}=t,s=Number.isFinite(l)&&l>0,u=l*a;if(n>=0){let f=n*a,m=u-f;return s&&m<=0?!1:(s?e.start(0,f+r,m):e.start(0,f+r),!0)}let c=-n/o;return s?e.start(i+c,r,u):e.start(i+c,r),!0}function Ci(e,t,n){let r=sf(vf(e));r&&qa([{param:t.gain}],r,Pr.scale,n)}function fr(e){return e.sourceKind==="buffer"}var _i=class{constructor(){ge(this,"_ctx",null);ge(this,"_bufferCache",new Map);ge(this,"_failedSrcs",new Set);ge(this,"_mediaElementSources",new WeakMap);ge(this,"_activeSources",[]);ge(this,"_masterGain",null);ge(this,"_masterVolume",1);ge(this,"_masterMuted",!1);ge(this,"_groups",new Map);ge(this,"_rateAnchorCtx",0);ge(this,"_rateAnchorComp",0);ge(this,"_rate",1);ge(this,"_paused",!0);ge(this,"_playGeneration",0)}async init(){try{return this._ctx=new AudioContext,this._masterGain=this._ctx.createGain(),this._masterGain.connect(this._ctx.destination),this.applyMasterGain(),!0}catch{return!1}}get context(){return this._ctx}getTime(){return!this._ctx||this._paused?-1:this._rateAnchorComp+(this._ctx.currentTime-this._rateAnchorCtx)*this._rate}async decodeAudioElement(t){let n=t.currentSrc||t.getAttribute("src");if(!n)return null;if(this._bufferCache.has(n))return this._bufferCache.get(n);if(this._failedSrcs.has(n)||!this._ctx)return null;let r;try{let i=await fetch(n,{cache:"no-store"});if(!i.ok)return L("webAudioTransport.fetch",new Error(`${i.status} ${n}`)),null;r=await i.arrayBuffer()}catch(i){return L("webAudioTransport.fetch",i),null}try{let i=await this._ctx.decodeAudioData(r);return this._bufferCache.set(n,i),i}catch(i){return this._failedSrcs.add(n),L("webAudioTransport.decode",i),null}}startGeneration(){return this._playGeneration+=1,this._playGeneration}currentGeneration(){return this._playGeneration}acquireMediaElementSource(t){let n=this._mediaElementSources.get(t);if(n){let o=an(t);if(o.kind!=="web-audio"){try{n.disconnect()}catch{}return this._mediaElementSources.delete(t),sn(t,o),null}return n}if(!this._ctx)return null;let r=an(t);if(r.kind!=="web-audio")return sn(t,r),null;let i=this._ctx.createMediaElementSource(t);return this._mediaElementSources.set(t,i),i}async scheduleMediaElementPlayback(t,n,r,i,o,a,l=1){if(!this._ctx||!this._masterGain||a!==this._playGeneration)return null;try{if(this._ctx.state==="suspended"&&await this._ctx.resume(),a!==this._playGeneration)return null;let s=this.acquireMediaElementSource(t);if(!s)return null;let u=Za(l),c=this._ctx.createGain();c.gain.value=o;let f=this._ctx.currentTime,m=i-n,p={scheduledAt:f,elapsed:m,rate:u},b=wi(this._ctx,t,s,c,p);c.connect(this.resolveDestination(t,f,i,u)??this._masterGain),Ci(t,c,p),this._rate=u,this._rateAnchorCtx=f,this._rateAnchorComp=i;let v={fx:b,el:t,sourceNode:s,sourceKind:"media-element",gainNode:c,compositionStart:n,mediaStart:r,scheduledAt:f,priorMuted:t.muted,priorVolume:t.volume,mediaPlaybackRate:_e(t),bounded:!1};return t.volume=1,this._activeSources.push(v),this._paused=!1,v}catch(s){return L("webAudioTransport.mediaElementSource",s),null}}groupInput(t,n,r){let i=this._groups.get(t);if(i){if(i.generation!==this._playGeneration)try{i.reanchor(r),i.generation=this._playGeneration}catch(m){L("webAudioTransport.groupReanchor",m)}return i.input}if(!this._ctx||!this._masterGain)return null;let o=this._ctx.createGain(),a=this._ctx.createGain();a.connect(this._masterGain);let l=()=>po(n,t),s=l(),u=this._ctx.createGain();u.gain.value=s?.hasAttribute("data-hidden")?0:1,u.connect(a);let c=this._ctx.createGain();c.gain.value=wf(mo(s)),c.connect(u);let f=wi(this._ctx,s??{getAttribute:()=>null},o,c,r);return s&&Ci(s,c,r),this._groups.set(t,{input:o,fader:c,muteGain:u,fx:f,generation:this._playGeneration,reanchor:m=>{lr([{param:c.gain}]);let p=l();c.gain.value=wf(mo(p)),u.gain.value=p?.hasAttribute("data-hidden")?0:1,f?.reanchor(m),p&&Ci(p,c,m)},dispose:()=>{try{f?.dispose(),o.disconnect(),c.disconnect(),u.disconnect(),a.disconnect()}catch{}}}),o}setGroupMuted(t,n){let r=this._groups.get(t);if(r)try{r.muteGain.gain.value=n?0:1}catch(i){L("webAudioTransport.setGroupMuted",i)}}resolveDestination(t,n,r,i){if(!this._masterGain)return null;let o=Il(t);if(!o)return this._masterGain;let a={scheduledAt:n,elapsed:r,rate:i};return this.groupInput(o,t.ownerDocument,a)??this._masterGain}handleSourceEnded(t,n,r,i){let o=this._activeSources.indexOf(n);if(o!==-1){this._activeSources.splice(o,1),r.muted=i;try{t.disconnect(),n.fx?.dispose(),n.gainNode.disconnect()}catch{}this._activeSources.length===0&&(this._paused=!0)}}async schedulePlayback(t,n,r,i,o,a,l,s=1,u=Number.POSITIVE_INFINITY){if(!this._ctx||!this._masterGain||l!==this._playGeneration)return null;try{if(this._ctx.state==="suspended"&&await this._ctx.resume(),l!==this._playGeneration)return null;let c=Za(s),f=_e(t),m=c*f,p=this._ctx.createBufferSource();p.buffer=n,p.playbackRate.value=m;let b=this._ctx.createGain();b.gain.value=a;let v=o-r,x=this._ctx.currentTime,_={scheduledAt:x,elapsed:v,rate:c},R=wi(this._ctx,t,p,b,_);if(b.connect(this.resolveDestination(t,x,o,c)??this._masterGain),Ci(t,b,_),this._rate=c,this._rateAnchorCtx=x,this._rateAnchorComp=o,!iy(p,{elapsed:v,mediaStart:i,scheduledAt:x,globalRate:c,mediaRate:f,clipDuration:u}))return p.disconnect(),R?.dispose(),b.disconnect(),null;let T=t.muted;t.muted=!0,ry(t,T);let M={fx:R,el:t,sourceNode:p,sourceKind:"buffer",gainNode:b,compositionStart:r,mediaStart:i,scheduledAt:x,priorMuted:T,priorVolume:t.volume,mediaPlaybackRate:f,bounded:Number.isFinite(u)&&u>0};return this._activeSources.push(M),this._paused=!1,p.addEventListener("ended",()=>this.handleSourceEnded(p,M,t,T)),M}catch(c){return L("webAudioTransport.schedule",c),null}}setRate(t){let n=Za(t);if(n===this._rate)return!1;this._ctx&&!this._paused&&(this._rateAnchorComp=this.getTime(),this._rateAnchorCtx=this._ctx.currentTime),this._rate=n;for(let r of this._activeSources)try{fr(r)&&(r.sourceNode.playbackRate.value=n*r.mediaPlaybackRate),r.fx?.setRate(n)}catch(i){L("webAudioTransport.setRate",i)}for(let r of this._groups.values())try{r.fx?.setRate(n)}catch(i){L("webAudioTransport.setRate.group",i)}return!0}hasBoundedActiveSources(){return this._activeSources.some(t=>fr(t)&&t.bounded)}stopAll(){for(let t of this._activeSources){try{fr(t)&&t.sourceNode.stop(),t.sourceNode.disconnect(),t.fx?.dispose(),t.gainNode.disconnect()}catch{}fr(t)?t.el.muted=t.priorMuted:t.el.volume=t.priorVolume}this._activeSources=[],this._paused=!0}setVolume(t){this._masterVolume=Math.max(0,Math.min(1,t)),this.applyMasterGain()}setElementVolume(t,n){let r=Le(n);for(let i of this._activeSources)if(i.el===t)try{i.sourceKind==="media-element"&&(i.el.volume=1),i.gainNode.gain.value=r}catch(o){L("webAudioTransport.setElementVolume",o)}}setMuted(t){this._masterMuted=t,this.applyMasterGain()}applyMasterGain(){this._masterGain&&(this._masterGain.gain.value=this._masterMuted?0:this._masterVolume)}isActive(){return this._activeSources.length>0&&!this._paused}ownsElement(t){return!this._paused&&this._activeSources.some(n=>n.el===t&&fr(n))}routesElement(t){return!this._paused&&this._activeSources.some(n=>n.el===t)}destroy(){this.stopAll();for(let t of this._groups.values())t.dispose();if(this._groups.clear(),this._bufferCache.clear(),this._failedSrcs.clear(),this._mediaElementSources=new WeakMap,this._ctx)try{this._ctx.close()}catch{}this._ctx=null,this._masterGain=null,this._masterVolume=1,this._masterMuted=!1}};var Cf="data-hf-studio-manual-edit-gesture";function _f(e){return!Number.isInteger(e.tick)||e.tick<=0||e.tick%60!==0?!1:!(e.isPlaying&&e.hasCapturedTimeline&&e.currentTimeSeconds<2)}var oy=/^\\s*spring\\(\\s*([+-]?(?:\\d+(?:\\.\\d*)?|\\.\\d+))\\s*\\)\\s*$/;function Tf(e){return Math.max(0,Math.min(1,e))}function Rf(e){let t=oy.exec(e);if(!t)return null;let n=Number(t[1]);return Number.isFinite(n)?Tf(n):null}function kf(e,t){if(!Number.isFinite(e))return e;if(e<=0)return 0;if(e>=1)return 1;let n=Tf(t),r=12-n*6,i=Math.PI*2*(1+n*1.5),o=1-Math.exp(-r)*Math.cos(i);return(1-Math.exp(-r*e)*Math.cos(i*e))/o}var ay=/^\\s*wiggle\\(\\s*(\\d+)\\s*,\\s*(easeOut|easeInOut|anticipate|uniform)\\s*(?:,\\s*([+-]?(?:\\d+(?:\\.\\d*)?|\\.\\d+)(?:[eE][+-]?\\d+)?)\\s*)?\\)\\s*$/,sy=Math.PI*2;function ly(e){let t=ay.exec(e);if(!t)return null;let n=Number(t[1]);if(!Number.isSafeInteger(n)||n<1)return null;let r=t[2];if(r!=="easeOut"&&r!=="easeInOut"&&r!=="anticipate"&&r!=="uniform")return null;if(t[3]===void 0)return{wiggles:n,type:r};let i=Number(t[3]);return!Number.isFinite(i)||i<0||i>1?null:{wiggles:n,type:r,amplitude:i}}function uy(e,t,n,r){if(!Number.isFinite(e))return e;if(e<=0)return 0;if(e>=1)return 1;let i=r??(n==="easeInOut"?.08:n==="uniform"?.14:n==="anticipate"?.12:.16),o=n==="easeInOut"?i*Math.sin(Math.PI*e):n==="uniform"?i:i*(1-e);return e+(n==="anticipate"?-1:1)*o*Math.sin(sy*t*e)}function Mf(e,t){let n=ly(e);if(!n)return null;let r=`${n.wiggles}:${n.type}:${n.amplitude??"default"}`,i=t?.get(r);if(i)return i;let o=a=>uy(a,n.wiggles,n.type,n.amplitude);return t?.set(r,o),o}var cy=24,Ff=e=>e>=1?1:0,dy=e=>e,Ti=String.raw`([+-]?(?:\\d+(?:\\.\\d*)?|\\.\\d+)(?:e[+-]?\\d+)?)`,fy=new RegExp(String.raw`^\\s*M\\s*0\\s*,\\s*0\\s+C\\s*${Ti}\\s*,\\s*${Ti}\\s+${Ti}\\s*,\\s*${Ti}\\s+1\\s*,\\s*1\\s*$`,"i");function Nf(e,t,n){let r=1-e;return 3*r*r*e*t+3*r*e*e*n+e*e*e}function my(e,t,n,r,i){if(!Number.isFinite(e))return e;if(e<=0)return 0;if(e>=1)return 1;let o=0,a=1;for(let l=0;l1?null:a=>my(a,n,r,i,o)}function hy(e,t){if(!e.startsWith("spring("))return null;let n=Rf(e);if(n===null)return null;let r=t.get(n);if(r)return r;let i=o=>kf(o,n);return t.set(n,i),i}function gy(e,t){if(!e.startsWith("custom(")||!e.endsWith(")"))return null;let n=e.slice(7,-1),r=t.get(n);if(r)return r;let i=py(n);return i&&t.set(n,i),i}function Lf(e){if(e.__hfCustomEaseInstalled)return!0;let t=e.parseEase;if(!t)return!1;let n=new Map,r=new Map,i=new Map,o=s=>typeof s!="string"?null:s==="hold"?Ff:Mf(s,i)??hy(s,r)??gy(s,n),a=(s,u,c=[])=>{let f=o(s);return f||(typeof s=="string"&&/^(?:hold|spring|wiggle|custom)(?:\\(|$)/.test(s.trim())&&Ne("custom_ease_parse_failed",{ease:s}),t.call(u,s,...c)??dy)};e.parseEase=function(u,...c){return a(u,this,c)};let l=e.registerEase;if(typeof l=="function"){l("hold",Ff);let s=u=>{let c=f=>f;c.config=(...f)=>a(`${u}(${f.join(",")})`,e),l(u,c)};s("spring"),s("wiggle"),s("custom")}return e.__hfCustomEaseInstalled=!0,!0}var ns=new Map,mr=new Map,es=new Map,ts=()=>{},If=()=>{},Df=0;function rs(e){return/^[a-z][a-z0-9-]{0,63}$/.test(e)}function Pf(e){let t=(es.get(e)??0)+1;return es.set(e,t),t}function Of(e){return typeof e=="number"&&Number.isSafeInteger(e)&&e>0?e:(Df-=1,Df)}function is(e,t){let n=mr.get(e);if(!n)return;let r=()=>es.get(e)===t.generation&&mr.get(e)===n;try{Promise.resolve(n(t.payload)).then(()=>{r()&&If(e,t.requestId)},i=>{r()&&ts(e,t.requestId,i)})}catch(i){r()&&ts(e,t.requestId,i)}}function Hf(e){ts=e}function Gf(e){If=e}function Ri(e,t,n){if(!rs(e))return;let r={payload:t,requestId:Of(n),generation:Pf(e)};ns.set(e,r),is(e,r)}function ki(e,t){rs(e)&&(ns.delete(e),is(e,{payload:void 0,requestId:Of(t),generation:Pf(e)}))}function Bf(e,t){if(!rs(e))throw new Error(`Invalid HyperFrames runtime-data channel: ${e}`);mr.set(e,t);let n=ns.get(e);return n&&is(e,n),()=>{mr.get(e)===t&&mr.delete(e)}}var os="data-hf-authored-duration",as="data-hf-authored-end",Uf=!1;function ot(e){if(e){if(typeof e.pause!="function"){Uf||(Uf=!0,Ne("timeline_missing_pause",{}));return}try{e.pause()}catch(t){L("runtime.timeline.pause",t)}}}function by(){let e=window.__HF_EXPORT_RENDER_SEEK_CONFIG,t=e?.fps,n=e?.fpsSource,r=Number(t);return!e||t==null?{fps:null,source:"default",rawFpsSource:n,rawFps:t,fallbackReason:"missing"}:!Number.isFinite(r)||r<=0?{fps:null,source:"default",rawFpsSource:n,rawFps:t,fallbackReason:"invalid"}:{fps:r,source:n==="render-options"||n==="default"?n:"unknown",rawFpsSource:n,rawFps:t,fallbackReason:e.fpsFallbackReason}}function Wf(){let e=Eu(),t=()=>{};Ws(be),Hf((d,g,h)=>{be({source:"hf-preview",type:"runtime-data-error",channel:d,requestId:g,message:h instanceof Error?h.message:String(h)})}),Gf((d,g)=>{try{t()}catch(h){be({source:"hf-preview",type:"runtime-data-error",channel:d,requestId:g,message:h instanceof Error?h.message:String(h)});return}be({source:"hf-preview",type:"runtime-data-applied",channel:d,requestId:g})}),mi(document),La(document),Pl(document);let n=by();e.canonicalFps=n.fps??e.canonicalFps,Bs(e.canonicalFps),window.__HF_EXPORT_RENDER_SEEK_CONFIG&&console.info("[hyperframes] render runtime fps",{canonicalFps:e.canonicalFps,source:n.source,rawFpsSource:n.rawFpsSource,rawFps:n.rawFps,fallbackReason:n.fallbackReason});let r=null,i=null,o=null,a=[],l=new Set,s=null,u=new Set,c=(d,g,h)=>{u.has(d)||(u.add(d),Ne(g,h))};if(typeof window.__hfRuntimeTeardown=="function")try{window.__hfRuntimeTeardown()}catch(d){L("runtime.init.site1",d)}let f=new Ei;e.transportClock=f;let m=new _i,p=!1;m.init().then(d=>{p=d}),window.__hf=window.__hf||{};let b=d=>d.closest("[data-hidden]")!==null||Br(d.ownerDocument,d),v=()=>{let d=window.gsap,g=window;if(!(!d?.registerPlugin||g.__hfAutoNoopRegistered))try{d.registerPlugin({name:"_auto",init:()=>!1}),g.__hfAutoNoopRegistered=!0}catch(h){c("auto_marker_install_failed","auto_marker_install_failed",{reason:"threw"}),L("runtime.autoMarker.install",h)}},x=()=>{let d=window.gsap;if(!d){c("custom_ease_missing_gsap","custom_ease_install_failed",{reason:"missing_gsap"});return}try{Lf(d)||c("custom_ease_no_parse_ease","custom_ease_install_failed",{reason:"no_parseEase"})}catch(g){c("custom_ease_install_threw","custom_ease_install_failed",{reason:"threw"}),L("runtime.customEase.install",g)}};v(),x(),document.documentElement&&(document.documentElement.style.margin="0",document.documentElement.style.padding="0",document.documentElement.style.overflow="hidden"),document.body&&(document.body.style.margin="0",document.body.style.padding="0",document.body.style.overflow="hidden");try{Ys(document)}catch(d){L("runtime.init.cssVariables",d)}window.__timelines=window.__timelines||{};let _=()=>{let d=document.querySelector(\'[data-composition-id][data-root="true"]\');if(d instanceof HTMLElement)return d;let g=Array.from(document.querySelectorAll("[data-composition-id]"));return g.find(h=>!h.parentElement?.closest("[data-composition-id]"))??g[0]??null};if(Array.isArray(window.__timelines)){let d=window.__timelines,g=_()?.getAttribute("data-composition-id")??"root",h={};if(d.length===1)h[g]=d[0];else for(let y=0;y{a.push(d)},M=(d,g,h)=>{let y=h??`${d}:${JSON.stringify(g)}`;l.has(y)||(l.add(y),be({source:"hf-preview",type:"diagnostic",code:d,details:g}))},D=d=>{let g={scale:1,focusX:960,focusY:540},h=[],y=[],w={time:d.getTime(),duration:d.getDuration(),isPlaying:d.isPlaying(),renderMode:!1,timelineDirty:!1};return{play:d.play,pause:d.pause,seek:d.seek,getTime:d.getTime,getDuration:d.getDuration,isPlaying:d.isPlaying,getMainTimeline:()=>null,getElementBounds:()=>{},getElementsAtPoint:()=>{},setElementPosition:()=>{},previewElementPosition:()=>{},setElementKeyframes:()=>{},setElementScale:()=>{},setElementFontSize:()=>{},setElementTextContent:()=>{},setElementTextColor:()=>{},setElementTextShadow:()=>{},setElementTextFontWeight:()=>{},setElementTextFontFamily:()=>{},setElementTextOutline:()=>{},setElementTextHighlight:()=>{},setElementVolume:()=>{},setStageZoom:()=>{},getStageZoom:()=>g,setStageZoomKeyframes:()=>{},getStageZoomKeyframes:()=>h,addElement:()=>!1,removeElement:()=>!1,updateElementTiming:()=>!1,setElementTiming:()=>{},updateElementSrc:()=>!1,updateElementLayer:()=>!1,updateElementBasePosition:()=>!1,markTimelineDirty:()=>{},isTimelineDirty:()=>!1,rebuildTimeline:()=>{},ensureTimeline:()=>{},enableRenderMode:()=>{},disableRenderMode:()=>{},renderSeek:d.renderSeek,getElementVisibility:()=>({visible:!1}),getVisibleElements:()=>y,getRenderState:()=>({...w,time:d.getTime(),duration:d.getDuration(),isPlaying:d.isPlaying()})}},E=1/60,S=.75,A=.05,C=100,F=240,I=d=>{if(d instanceof Error)return d.message||String(d);if(typeof d=="string")return d;try{return JSON.stringify(d)}catch{return String(d??"")}},q=d=>{let g=d.toLowerCase();return g.includes("cannot read properties of null")||g.includes("cannot set properties of null")?{code:"runtime_null_dom_access",category:"dom-null-access"}:g.includes("failed to execute \'queryselector\'")?{code:"runtime_invalid_selector",category:"selector-invalid"}:g.includes("is not defined")?{code:"runtime_reference_missing",category:"reference-missing"}:{code:"runtime_script_error",category:"script-error"}},W=d=>{if(d==null||d.trim()==="")return null;let g=Number.parseFloat(d);return!Number.isFinite(g)||g<=0?null:`${g}px`},Y=()=>_(),k=()=>{let d=Y();if(!d)return;let g=W(d.getAttribute("data-width")),h=W(d.getAttribute("data-height"));g&&(d.style.width=g),h&&(d.style.height=h),g&&d.style.setProperty("--comp-width",g),h&&d.style.setProperty("--comp-height",h)},U=()=>{let d=Y(),g=Array.from(document.querySelectorAll("[data-composition-id]")).filter(h=>h.hasAttribute("data-duration")||h.hasAttribute("data-end"));for(let h of g){if(d&&h===d)continue;let y=h.getAttribute("data-duration"),w=h.getAttribute("data-end");y!=null&&!h.hasAttribute(os)&&h.setAttribute(os,y),w!=null&&!h.hasAttribute(as)&&h.setAttribute(as,w),h.removeAttribute("data-duration"),h.removeAttribute("data-end")}},ie=()=>{let d=Y();if(!d)return;d.style.position||(d.style.position="relative"),d.style.overflow="hidden";let g=W(d.getAttribute("data-width")),h=W(d.getAttribute("data-height"));g&&(d.style.width=g),h&&(d.style.height=h);let y=Array.from(d.children);for(let w of y){let N=w.tagName.toLowerCase();if(N==="script"||N==="style"||N==="link"||N==="meta"||!w.hasAttribute("data-start")||w.hasAttribute("data-hf-autostamped"))continue;let G=(w.style.top==="0px"||w.style.top==="0")&&(w.style.left==="0px"||w.style.left==="0")&&w.style.width==="100%"&&w.style.height==="100%",re=/translate\\(\\s*-50%\\s*,\\s*-50%\\s*\\)/.test(w.style.transform);if(G&&re&&!w.hasAttribute("data-width")&&!w.hasAttribute("data-height")){let ne=w.style.top,_t=w.style.left,ye=w.style.width,gn=w.style.height;w.style.top="",w.style.left="",w.style.width="",w.style.height="";let se=window.getComputedStyle(w);se.top!=="auto"||se.bottom!=="auto"||se.left!=="auto"||se.right!=="auto"||se.width!=="0px"||se.height!=="0px"||(w.style.top=ne,w.style.left=_t,w.style.width=ye,w.style.height=gn)}let $=window.getComputedStyle(w),le=$.position;if(le!=="absolute"&&le!=="fixed"&&(w.style.position="absolute"),!!w.style.top||!!w.style.bottom||$.top!=="auto"||$.bottom!=="auto"||(w.style.top="0"),!!w.style.left||!!w.style.right||$.left!=="auto"||$.right!=="auto"||(w.style.left="0"),N!=="audio"){let ne=W(w.getAttribute("data-width")),_t=W(w.getAttribute("data-height")),ye=$.width!=="0px"&&$.width!=="auto",gn=$.height!=="0px"&&$.height!=="auto";ne?!w.style.width&&!ye&&(w.style.width=ne):!w.style.width&&$.width==="0px"&&(w.style.width="100%"),_t?!w.style.height&&!gn&&(w.style.height=_t):!w.style.height&&$.height==="0px"&&(w.style.height="100%")}}},P=(d,g=0,h)=>mt({timelineRegistry:window.__timelines??{},includeAuthoredTimingAttrs:h?.includeAuthoredTimingAttrs??!0}).resolveStartForElement(d,g),H=(d,g)=>mt({timelineRegistry:window.__timelines??{},includeAuthoredTimingAttrs:g?.includeAuthoredTimingAttrs??!0}).resolveDurationForElement(d),V=d=>{let g=d.closest("[data-composition-id]"),h=g?P(g,0):null,y=g?H(g,{includeAuthoredTimingAttrs:!0}):null;return{compositionRoot:g,inheritedStart:h,inheritedDuration:y}},j=d=>{let g=V(d),h=g.inheritedStart??0,y=Gt(d.getAttribute("data-start"));if(d.hasAttribute("data-hf-auto-start")||y==null||h<=0)return P(d,h);let w=g.inheritedDuration,N=w!=null&&w>0?h+w:null;return y>=h&&(N==null||y{window.__hfResolveMediaStartSeconds===j&&delete window.__hfResolveMediaStartSeconds});let we=(d,g)=>{let h=d.tagName.toLowerCase();if(h==="script"||h==="style"||h==="link"||h==="meta")return!1;let w=h==="video"||h==="audio"?j(d):P(d,0),N=H(d),G=d.getAttribute("data-composition-id");if(G){let $=(window.__timelines??{})[G],le=null;if($&&typeof $.duration=="function"){let Me=Number($.duration());Number.isFinite(Me)&&Me>0&&(le=Me)}!(d.hasAttribute("data-duration")||d.hasAttribute("data-end")||d.hasAttribute(os)||d.hasAttribute(as))&&(N==null||N<=0)&&le!=null&&(N=le)}let re=N!=null&&N>0?w+N:Number.POSITIVE_INFINITY;return g>=w&&(Number.isFinite(re)?g{if(!d||typeof d.duration!="function")return null;try{let g=Number(d.duration());return Number.isFinite(g)?Math.max(0,g):null}catch{return null}},K=d=>typeof d=="number"&&Number.isFinite(d)&&d>E,te=d=>{let g=ve(d.getAttribute("data-duration"));return g!=null&&g>0?g:Number.isFinite(d.duration)?Qe(d,d.duration):null},J=()=>{let d=Array.from(document.querySelectorAll("video[data-start], audio[data-start]"));if(d.length===0)return null;let g=0;for(let h of d){let y=j(h);if(!Number.isFinite(y))continue;let w=te(h);w==null||w<=E||(g=Math.max(g,Math.max(0,y)+w))}return g>E?g:null},X=()=>{let d=Y();if(!d)return null;let g=window.__timelines??{},h=mt({timelineRegistry:g,includeAuthoredTimingAttrs:!0}),y=0,w=ve(d.getAttribute("data-duration"));w!=null&&w>0&&(y=w);let N=Array.from(d.querySelectorAll("[data-composition-id][data-start]"));for(let G of N){if(!(G instanceof Element)||G.parentElement?.closest("[data-composition-id]")!==d)continue;let $=h.resolveStartForElement(G,0),le=h.resolveDurationForElement(G);!Number.isFinite($)||le==null||le<=0||(y=Math.max(y,Math.max(0,$)+le))}return y>E?y:null},Pe=()=>{let d=J();return typeof d!="number"||!Number.isFinite(d)||d<=E?null:d},Fe=d=>K(d)?Math.max(E,d*S):E,cn=()=>{let d=0;for(let g of e.deterministicAdapters){let h=g.getInferredDurationSeconds;if(typeof h!="function")continue;let y=null;try{y=h()}catch(w){L("runtime.init.adapterDuration",w)}typeof y=="number"&&Number.isFinite(y)&&y>0&&(d=Math.max(d,y))}return d>E?d:null},Ce=(d,g=0)=>{let h=ee(d),y=Pe(),w=X(),N=cn(),G=Math.max(y??0,w??0,N??0),re=Number.isFinite(g)&&g>E?g:0,$=0;return K(h)?$=Math.max(h,G,re):K(G)?$=Math.max(G,re):$=re,$>0?Math.max(0,$):0},Oi=()=>{let d=window.__timelines??{},g=se=>{let oe=Object.entries(d).filter(ue=>!!ue[1]&&typeof ue[1].play=="function"&&typeof ue[1].pause=="function");if(oe.length!==1)return{timeline:null};let he=oe[0];if(!he)return{timeline:null};let[xe,fe]=he;return{timeline:fe,selectedTimelineIds:[xe],selectedDurationSeconds:ee(fe),diagnostics:{code:"root_timeline_sole_registered_fallback",details:{reason:se,soleTimelineId:xe}}}},h=mt({timelineRegistry:d,includeAuthoredTimingAttrs:!0}),y=Pe(),w=X(),N=Math.max(y??0,w??0)||null,G=Fe(N),re=se=>{let oe=document.querySelector(`[data-composition-id="${CSS.escape(se)}"]`);return oe?h.resolveStartForElement(oe,0):0},$=se=>{let oe=window.gsap;if(!oe||typeof oe.timeline!="function")return null;let he=oe.timeline({paused:!0});for(let xe of se)he.add(xe.timeline,re(xe.compositionId));return he},le=(se,oe)=>{if(!K(se))return null;let he=window.gsap;if(!he||typeof he.timeline!="function")return null;let xe=he.timeline({paused:!0});if(oe)try{xe.add(oe,0)}catch(ue){L("runtime.init.site2",ue)}let fe=xe;if(typeof fe.to=="function")try{fe.to({},{duration:se})}catch(ue){L("runtime.init.site3",ue)}return xe},Be=(se,oe)=>{let he=se;if(typeof he.getChildren!="function")return[];try{let xe=he.getChildren(!0,!0,!0)??[];if(!Array.isArray(xe))return[];let fe=[];for(let ue of oe)if(!xe.some(Je=>Je===ue.timeline))try{let Je=re(ue.compositionId);se.add(ue.timeline,Je),fe.push(ue.compositionId)}catch(Je){L("runtime.init.site4",Je)}return fe}catch{return[]}},Me=Y(),Q=Me?.getAttribute("data-composition-id")??null;if(!Q)return g("root_missing_composition_id");let ne=d[Q]??null,ye=(()=>{if(!Me)return[];let se=new Set,oe=Array.from(Me.querySelectorAll("[data-composition-id]")),he=[];for(let xe of oe){let fe=xe.getAttribute("data-composition-id");if(!fe||fe===Q||se.has(fe))continue;se.add(fe);let ue=d[fe]??null;if(!ue||typeof ue.play!="function"||typeof ue.pause!="function")continue;let lt=ee(ue);he.push({compositionId:fe,timeline:ue,durationSeconds:lt??0})}return he})(),gn=se=>{for(let oe of se){let he=oe.timeline;if(typeof he.paused=="function")try{he.paused(!1)}catch(xe){L("runtime.init.site5",xe)}}};if(ye.length>0&&gn(ye),ne){let se=ye.length>0?Be(ne,ye):[];if((ye.length>0||!document.querySelector("[data-composition-id]:not([data-composition-id=\'"+Q+"\'])"))&&(gr=!0),se.length>0)try{let fe=ne.time();ne.seek(fe,!1)}catch{}let oe=ee(ne);if(!K(oe)&&ye.length>0){let fe=ye.map(zm=>zm.compositionId),ue=$(ye),lt=ee(ue);if(ue&&K(lt))return{timeline:ue,selectedTimelineIds:fe,selectedDurationSeconds:lt,mediaDurationFloorSeconds:y,diagnostics:{code:"root_timeline_unusable_fallback",details:{rootCompositionId:Q,rootDurationSeconds:oe,fallbackKind:"composite_by_root_children",minCandidateDurationSeconds:G,selectedDurationSeconds:lt,mediaDurationFloorSeconds:y,authoredCompositionDurationFloorSeconds:w,selectedTimelineIds:fe,autoNestedChildren:se}}};let Je=le(N??0,ne),Yi=ee(Je);if(Je&&K(Yi))return{timeline:Je,selectedTimelineIds:[Q],selectedDurationSeconds:Yi,mediaDurationFloorSeconds:y,diagnostics:{code:"root_timeline_unusable_media_floor_fallback",details:{rootCompositionId:Q,rootDurationSeconds:oe,fallbackKind:"media_duration_floor",mediaDurationFloorSeconds:y,authoredCompositionDurationFloorSeconds:w,selectedDurationSeconds:Yi,selectedTimelineIds:[Q],autoNestedChildren:se}}}}if(!K(oe)&&ye.length===0){let fe=le(N??0,ne),ue=ee(fe);if(fe&&K(ue))return{timeline:fe,selectedTimelineIds:[Q],selectedDurationSeconds:ue,mediaDurationFloorSeconds:y,diagnostics:{code:"root_timeline_unusable_media_floor_fallback",details:{rootCompositionId:Q,rootDurationSeconds:oe,fallbackKind:"media_duration_floor",mediaDurationFloorSeconds:y,authoredCompositionDurationFloorSeconds:w,selectedDurationSeconds:ue,selectedTimelineIds:[Q]}}}}let he=ve(Me?.getAttribute("data-duration")),xe=Math.max(K(he)?he:0,w??0);if(xe>0&&K(xe)&&K(oe)&&xe>=oe+.5){let fe=ne;if(typeof fe.to=="function")try{fe.to({},{duration:0},xe)}catch(lt){L("runtime.init.site6",lt)}let ue=ee(ne);if(K(ue))return{timeline:ne,selectedTimelineIds:[Q],selectedDurationSeconds:ue,mediaDurationFloorSeconds:y,diagnostics:{code:"root_timeline_padded_to_declared_duration",details:{rootCompositionId:Q,rootDurationSeconds:oe,rootDeclaredDur:he,authoredCompositionDurationFloorSeconds:w,newDur:ue}}}}return{timeline:ne,selectedTimelineIds:[Q],selectedDurationSeconds:oe,mediaDurationFloorSeconds:y,diagnostics:se.length>0?{code:"root_timeline_auto_nested_children",details:{rootCompositionId:Q,selectedDurationSeconds:oe,autoNestedChildren:se}}:void 0}}if(ye.length>0){let se=ye.map(xe=>xe.compositionId),oe=$(ye),he=ee(oe);if(oe)return{timeline:oe,selectedTimelineIds:se,selectedDurationSeconds:he,mediaDurationFloorSeconds:y,diagnostics:{code:"root_timeline_missing_fallback",details:{rootCompositionId:Q,fallbackKind:"composite_by_root_children",minCandidateDurationSeconds:G,selectedDurationSeconds:he,mediaDurationFloorSeconds:y,selectedTimelineIds:se}}}}return g("root_composition_id_unmatched_in_registry")},gr=!1,Em=d=>{let g=window.gsap,h=d;if(!(!h||typeof h.getChildren!="function"||!g||typeof g.parseEase!="function"))for(let y of h.getChildren(!0,!0,!0)){let w=y,N=w.timeline;if(!N||!("_ease"in N)||typeof N._ease=="function")continue;let G=w.vars?.keyframes,$=(G&&!Array.isArray(G)?G.ease:void 0)??w.vars?.ease??"none";try{let le=g.parseEase($);typeof le=="function"&&(N._ease=le)}catch(le){Ne("keyframe_ease_repair_failed",{ease:typeof $=="string"?$:String($)}),L("runtime.keyframeEase.repair",le)}}},dn=()=>{if(x(),!B)return!1;let d=e.capturedTimeline,g=ee(d),h=K(g);if(d&&h&&gr)return!1;let y=Oi();if(!y.timeline)return!1;if(d&&d===y.timeline)return typeof d.timeScale=="function"&&d.timeScale(e.playbackRate),!1;e.capturedTimeline=y.timeline,typeof e.capturedTimeline.timeScale=="function"&&e.capturedTimeline.timeScale(e.playbackRate),Em(e.capturedTimeline);let w=Ce(e.capturedTimeline,0);if(w<=0&&typeof e.capturedTimeline.progress=="function"&&(e.capturedTimeline.progress(1,!0),e.capturedTimeline.progress(0,!1),ot(e.capturedTimeline)),w>0){try{f.setDuration(w)}catch{}if(typeof e.capturedTimeline.totalTime=="function"){typeof e.capturedTimeline.progress=="function"&&e.capturedTimeline.progress(1e-4,!0);let G=Math.max(0,e.currentTime||0);e.capturedTimeline.totalTime(G,!1),ot(e.capturedTimeline)}let N=window.__hfStudioManualEditsApply;typeof N=="function"&&N(),mi(document)}if(y.diagnostics&&be({source:"hf-preview",type:"diagnostic",code:y.diagnostics.code,details:y.diagnostics.details}),be({source:"hf-preview",type:"diagnostic",code:"timeline_bound",details:{selectedTimelineIds:y.selectedTimelineIds??[],selectedDurationSeconds:y.selectedDurationSeconds??null,mediaDurationFloorSeconds:y.mediaDurationFloorSeconds??null}}),window.parent!==window){let N=Y(),G=w>0?w:0,re=String(G>0?G:1),$=new Set,le=Q=>Q.tagName.toLowerCase()===Ut,Be=new Set(document.querySelectorAll("[data-start]")),Me=Q=>{let ne=Q.parentElement;for(;ne&&ne!==N;){if(Be.has(ne))return!0;ne=ne.parentElement}return!1};if(e.capturedTimeline.getChildren)try{for(let Q of e.capturedTimeline.getChildren(!0))if(typeof Q.targets=="function")for(let ne of Q.targets())ne instanceof HTMLElement&&ne!==N&&(le(ne)||ne.hasAttribute("data-start")||Me(ne)||$.has(ne)||($.add(ne),ne.setAttribute("data-start","0"),ne.setAttribute("data-duration",re),ne.setAttribute("data-hf-autostamped","1")))}catch{}if(N instanceof HTMLElement)for(let Q of N.querySelectorAll("[id]"))Q instanceof HTMLElement&&Q!==N&&(Q.hasAttribute("data-start")||Me(Q)||$.has(Q)||Q.tagName==="SCRIPT"||Q.tagName==="STYLE"||Q.tagName==="LINK"||le(Q)||($.add(Q),Q.setAttribute("data-start","0"),Q.setAttribute("data-duration",re),Q.setAttribute("data-hf-autostamped","1")))}for(let N of fn)br.delete(N),Es(N);return!0},gs=()=>{if(e.tornDown)return;let d=Oi();if(!d.timeline){e.capturedTimeline=null,gr=!1,f.setDuration(0),Ar(e.currentTime);return}e.capturedTimeline!==d.timeline&&(gr=!1,dn()),Ar(e.currentTime)};t=()=>{gs(),st()},window.__hfForceTimelineRebind=gs;let wm=()=>{let d=Y();if(!(d instanceof HTMLElement))return;let g=d.getBoundingClientRect(),h=Number(d.getAttribute("data-width")),y=Number(d.getAttribute("data-height")),w=window.getComputedStyle(d),N=Number.isFinite(h)&&h>0&&Number.isFinite(y)&&y>0,G=g.width<=0||g.height<=0||d.clientWidth<=0||d.clientHeight<=0;!N||!G||M("root_stage_layout_zero",{compositionId:d.getAttribute("data-composition-id")??null,declaredWidth:h,declaredHeight:y,rectWidth:Math.round(g.width),rectHeight:Math.round(g.height),clientWidth:d.clientWidth,clientHeight:d.clientHeight,display:w.display,visibility:w.visibility,overflow:w.overflow},`root-stage-layout-zero:${d.getAttribute("data-composition-id")??"unknown"}`)},Cm=()=>{e.tornDown||(s!=null&&window.cancelAnimationFrame(s),s=window.requestAnimationFrame(()=>{s=null,wm()}))},_m=()=>{i=d=>{let g=I(d.error??d.message).slice(0,F);if(!g)return;let h=q(g);be({source:"hf-preview",type:"diagnostic",code:h.code,details:{category:h.category,message:g,filename:d.filename||null,line:Number.isFinite(d.lineno)?d.lineno:null,column:Number.isFinite(d.colno)?d.colno:null}})},o=d=>{let g=I(d.reason).slice(0,F);if(!g)return;let h=q(g);be({source:"hf-preview",type:"diagnostic",code:`${h.code}_unhandled_rejection`,details:{category:`${h.category}-unhandled-rejection`,message:g}})},window.addEventListener("error",i),window.addEventListener("unhandledrejection",o)},Tm=()=>{let d=Array.from(document.querySelectorAll("img, video, audio, source, link[rel=\'stylesheet\']"));for(let h of d){let y=()=>{if(!(h instanceof Element))return;let w=h.tagName.toLowerCase(),N=h.getAttribute("src")??h.getAttribute("href")??h.getAttribute("poster")??null,G=w==="link"?"runtime_stylesheet_load_failed":"runtime_asset_load_failed";M(G,{tagName:w,assetUrl:N,currentSrc:(h instanceof HTMLImageElement||h instanceof HTMLMediaElement)&&h.currentSrc||null,readyState:h instanceof HTMLMediaElement?h.readyState:null,networkState:h instanceof HTMLMediaElement?h.networkState:null},`${G}:${w}:${N??"unknown"}`)};h.addEventListener("error",y),T(()=>{h.removeEventListener("error",y)})}let g=document.fonts;g&&g.ready.then(()=>{if(e.tornDown)return;let h=Array.from(g).filter(y=>y.status==="error").map(y=>y.family).filter(y=>!!y).slice(0,10);h.length!==0&&M("runtime_font_load_issue",{failedFamilies:h,totalFaces:Array.from(g).length},`runtime-font-load-issue:${h.join("|")}`)}).catch(()=>{})},Rm=(d,g)=>{if(!d.timeline)return!1;let h=e.capturedTimeline;if(h&&h===d.timeline)return!1;let y=Math.max(0,e.currentTime||0),w=e.isPlaying;e.capturedTimeline=d.timeline,typeof e.capturedTimeline.timeScale=="function"&&e.capturedTimeline.timeScale(e.playbackRate);try{ot(e.capturedTimeline),typeof e.capturedTimeline.seek=="function"&&e.capturedTimeline.seek(y,!1),w&&typeof e.capturedTimeline.play=="function"&&e.capturedTimeline.play()}catch(N){L("runtime.init.site7",N)}return be({source:"hf-preview",type:"diagnostic",code:"timeline_loop_guard_rebind",details:{reason:g,previousTime:y,selectedTimelineIds:d.selectedTimelineIds??[],selectedDurationSeconds:d.selectedDurationSeconds??null,mediaDurationFloorSeconds:d.mediaDurationFloorSeconds??null}}),!0},Et=null,bs=!1,xs=!1,fn=new Set,br=new WeakMap,xr=()=>{e.tornDown||(Et!=null&&window.clearTimeout(Et),Et=window.setTimeout(()=>{if(e.tornDown||(Et=null,xs&&window.__HF_EXPORT_RENDER_SEEK_CONFIG))return;let d=Oi();if(!d.timeline||!K(d.mediaDurationFloorSeconds??null))return;if(!e.capturedTimeline){dn()&&(st(),ke(!0));return}if(bs)return;let h=ee(e.capturedTimeline),y=d.selectedDurationSeconds??ee(d.timeline);K(y)&&(!K(h)||y>=h+A)&&Rm(d,"manual")&&(bs=!0,be({source:"hf-preview",type:"diagnostic",code:"timeline_rebind_after_media_metadata",details:{previousDurationSeconds:h??null,selectedDurationSeconds:y??null,selectedTimelineIds:d.selectedTimelineIds??[],mediaDurationFloorSeconds:d.mediaDurationFloorSeconds??null}}),st(),ke(!0))},C))},ys=d=>{d.currentTarget instanceof HTMLMediaElement&&zl(d.currentTarget)},vs=d=>{d.currentTarget instanceof HTMLMediaElement&&ql(d.currentTarget)},Ss=d=>{d instanceof HTMLAudioElement&&Ef(d)&&sn(d,an(d))},As=d=>{let g=d.currentTarget;g instanceof HTMLMediaElement&&Ss(g)},km=()=>{for(let d of fn)d.removeEventListener("loadedmetadata",xr),d.removeEventListener("durationchange",xr),d.removeEventListener("loadedmetadata",ys),d.removeEventListener("loadedmetadata",As),d.removeEventListener("error",vs);fn.clear()},Hi=()=>{if(e.tornDown)return;let d=Array.from(document.querySelectorAll("video, audio"));for(let g of d){if(fn.has(g))continue;fn.add(g);let h=Number.parseFloat(g.dataset.volume??"");Number.isFinite(h)&&(g.volume=Math.max(0,Math.min(1,h))),g.addEventListener("loadedmetadata",xr),g.addEventListener("durationchange",xr),g.addEventListener("loadedmetadata",As),Ss(g),g.addEventListener("loadedmetadata",ys),g.addEventListener("error",vs),Vl(g),g.preload!=="auto"&&(g.preload="auto"),g.readyState{br.has(d)||El(d,e.capturedTimeline,Ce(e.capturedTimeline,0),br,{allowLiveTimelineSeek:!window.__HF_RENDER_CAPTURE_MODE})},Gi=new WeakMap,ws=d=>{let g=Gi.get(d);if(g!==void 0)return g;let h=window.getComputedStyle(d).position,y=h==="static"||h==="relative"||h==="sticky";return Gi.set(d,y),y},Bi=new WeakMap,Mm=d=>{let g=Bi.get(d);if(g!==void 0)return g;let h=d.querySelector("[data-start]")===null;return Bi.set(d,h),h},Fm=()=>{Gi=new WeakMap,Bi=new WeakMap},Ui=new WeakMap,yr=new WeakSet,vr=!1,Cs=d=>d.matches("audio[data-start]")||d.querySelector("audio[data-start]")!==null,_s=new WeakMap,Sr=!0,Nm=()=>{if(Sr){Sr=!1;for(let d of document.querySelectorAll(Ut)){let g=d.hasAttribute("data-hidden");_s.get(d)!==g&&(_s.set(d,g),d.id&&m.setGroupMuted(d.id,g))}}},Ar=(d,g=Array.from(document.querySelectorAll("[data-start]")))=>{let h=Y();for(let y of g){if(!(y instanceof HTMLElement))continue;if(y.hasAttribute("data-hidden")){yr.has(y)||(Ui.set(y,y.style.getPropertyValue("display")),yr.add(y),Cs(y)&&(vr=!0),Sr=!0),y.style.display="none",(y instanceof HTMLVideoElement||y instanceof HTMLImageElement)&&r?.setSourceVisibility(y,!1);continue}if(yr.has(y)){let N=Ui.get(y);N?y.style.display=N:y.style.removeProperty("display"),Ui.delete(y),yr.delete(y),Cs(y)&&(vr=!0),Sr=!0}let w=we(y,d);if(w){let N=y.parentElement;for(;N&&N!==h;){if(N instanceof HTMLElement&&N.hasAttribute("data-start")&&!we(N,d)){w=!1;break}N=N.parentElement}}y.style.visibility=w?"visible":"hidden",(y instanceof HTMLVideoElement||y instanceof HTMLImageElement)&&r?.setSourceVisibility(y,w),w?ws(y)&&y.style.removeProperty("display"):ws(y)&&Mm(y)&&(y.style.display="none")}vr&&f.isPlaying()&&(m.stopAll(),ji()),vr=!1,Nm()},Oe=()=>{let d=Hl({shouldIncludeElement:h=>h.hasAttribute("data-start")||!!V(h).compositionRoot,resolveStartSeconds:h=>j(h),resolveDurationSeconds:h=>{let y=V(h),w=j(h),N=y.inheritedStart!=null&&y.inheritedDuration!=null&&y.inheritedDuration>0?Math.max(0,y.inheritedStart+y.inheritedDuration-w):null,G=Number.isFinite(h.duration)?Qe(h,h.duration):null,re=ve(h.dataset.duration),$=re!=null&&re>0?re:null;return Ol({isVideo:h.tagName==="VIDEO",sourceDuration:G,hostRemaining:N,explicitDuration:$})}});for(let h of d.mediaClips){let y=br.get(h.el);y&&(h.volumeKeyframes=y)}let g=e.mediaForceSyncNextTick;g&&(e.mediaForceSyncNextTick=!1),e.nativeMediaSyncDisabled||Gl({clips:d.mediaClips,timeSeconds:e.currentTime,playing:e.isPlaying,playbackRate:e.playbackRate,outputMuted:e.mediaOutputMuted,userMuted:e.bridgeMuted,userVolume:e.bridgeVolume,forceSync:g,onElementVolume:(h,y,w)=>m.setElementVolume(h,w),isWebAudioOwned:h=>m.ownsElement(h),isWebAudioRouted:h=>m.routesElement(h),onAutoplayBlocked:()=>{e.mediaAutoplayBlockedPosted||(e.mediaAutoplayBlockedPosted=!0,be({source:"hf-preview",type:"media-autoplay-blocked"}))}}),Ar(e.currentTime)},ke=d=>{let g=Math.max(0,Math.round((e.currentTime||0)*e.canonicalFps)),h=Date.now();(d||g!==e.bridgeLastPostedFrame||e.isPlaying!==e.bridgeLastPostedPlaying||e.bridgeMuted!==e.bridgeLastPostedMuted||h-e.bridgeLastPostedAt>=e.bridgeMaxPostIntervalMs)&&(e.bridgeLastPostedFrame=g,e.bridgeLastPostedPlaying=e.isPlaying,e.bridgeLastPostedMuted=e.bridgeMuted,e.bridgeLastPostedAt=h,be({source:"hf-preview",type:"state",frame:g,isPlaying:e.isPlaying,muted:e.bridgeMuted,playbackRate:e.playbackRate}))},Wi="",Ts=0,Lm=()=>{let d="";for(let g of document.querySelectorAll("[data-start]"))d+=`${g.id}:${g.tagName}|`;return d},st=()=>{U(),k(),ie();let d=Y();if(d){let y=W(d.getAttribute("data-width")),w=W(d.getAttribute("data-height")),N=y?parseInt(y,10):0,G=w?parseInt(w,10):0;N>0&&G>0&&be({source:"hf-preview",type:"stage-size",width:N,height:G})}dn();let g=Ru({canonicalFps:e.canonicalFps});window.__clipManifest=g;let h=Lm();if(Wi!==h&&Fm(),!window.__clipTree||Wi!==h){let y=window;window.__clipTree=wu({startResolver:mt({timelineRegistry:y.__timelines??{},includeAuthoredTimingAttrs:!0}),timelineRegistry:y.__timelines??{},rootDuration:g.durationInFrames/e.canonicalFps}),Wi=h}be(g),Cm()},Vi=d=>typeof d=="number"&&Number.isFinite(d)&&d>0?d:0,Dm=d=>{let g=Vi(Number(d));if(g<=0)return;let h=Y(),y=Vi(ve(h?.getAttribute("data-duration"))),w=Math.max(Ts,Vi(f.getDuration()),y);g<=w||(Ts=g,h?.setAttribute("data-duration",String(g)),f.setDuration(g),st(),ke(!0))},He=(d,g=0)=>{for(let h of e.deterministicAdapters){try{d==="discover"&&h.discover(),d==="pause"&&h.pause(),d==="play"&&h.play&&h.play()}catch(y){L("runtime.init.site8",y)}if(d==="discover")try{h.seek({time:g,suppressEvents:!0})}catch(y){L("runtime.init.site9",y)}}},wt=()=>{window.__renderReady=!1},mn=null,pn=!0,Im=()=>{let d=[];for(let g of e.deterministicAdapters){let h=g.getReadyPromise;if(typeof h=="function")try{let y=h();y&&d.push(y)}catch(y){L("runtime.init.adapterReady",y)}}return d},Pm=()=>{let d=Im();if(d.length===0)return mn=null,pn=!0,!0;let g=d[0];if(!g)return!0;let h=d.length===1?g:Promise.all(d);return h!==mn&&(mn=h,pn=!1,Promise.resolve(h).then(()=>{mn===h&&(pn=!0,wt())},y=>{mn===h&&(pn=!0,L("runtime.init.adapterReady",y),wt())})),pn};if(B)_a();else{let d={injectedStyles:e.injectedCompStyles,injectedScripts:e.injectedCompScripts,injectedLinks:e.injectedCompLinks,parseDimensionPx:W,onDiagnostic:({code:g,details:h})=>{be({source:"hf-preview",type:"diagnostic",code:g,details:h})}};yd(d).then(()=>xd(d)).finally(()=>{B=!0,Hi(),Tm(),_a(),La(document),wt()})}let Er=yu({postMessage:d=>be(d)});Er.installPickerApi(),Ar(e.currentTime,Array.from(document.querySelectorAll("video[data-start], img[data-start]")));let ze=of();r=ze,T(()=>{ze.destroy(),r=null});let zi=d=>{let g=Number(d);!Number.isFinite(g)||g<=0?e.playbackRate=1:e.playbackRate=Math.max(.1,Math.min(5,g)),e.mediaForceSyncNextTick=!0,e.capturedTimeline&&typeof e.capturedTimeline.timeScale=="function"&&e.capturedTimeline.timeScale(e.playbackRate);let h=document.querySelectorAll("video, audio");for(let y of h)if(y instanceof HTMLMediaElement)try{y.playbackRate=e.playbackRate}catch(w){L("runtime.init.site10",w)}},Rs={play:()=>{let d=e.capturedTimeline;if(f.isPlaying())return;let g=Ce(d,0);if(g>0)f.setDuration(g),f.reachedEnd()&&(f.seek(0),e.currentTime=0,Ct(0));else{let h=Y(),y=Number(h?.getAttribute("data-duration")??0);y>0&&f.setDuration(y)}ot(d),f.play()&&(e.isPlaying=!0,e.mediaForceSyncNextTick=!0,Ps(f.now()),p&&!e.nativeMediaSyncDisabled&&!e.webAudioMediaDisabled&&ji(),He("play"),Oe(),ze.redraw(),ke(!0))},pause:()=>{if(!f.isPlaying())return;m.stopAll(),f.detachAudioSource(),f.pause(),e.isPlaying=!1,e.currentTime=f.now(),e.mediaForceSyncNextTick=!0,Ps(e.currentTime);let d=e.capturedTimeline;ot(d),He("pause"),Oe(),ze.redraw(),ke(!0)},seek:(d,g)=>{let h=$t(Math.max(0,Number(d)||0),e.canonicalFps);m.stopAll(),f.detachAudioSource();let y=f.isPlaying();y&&f.pause(),f.seek(h),e.currentTime=f.now(),e.isPlaying=!1,e.mediaForceSyncNextTick=!0;let w=e.capturedTimeline;if(ot(w),Ct(e.currentTime),He("pause"),g?.keepPlaying&&y){Rs.play();return}Oe(),ze.redraw(),ke(!0)},renderSeek:(d,g)=>{xs=!0;let h=$t(Math.max(0,Number(d)||0),e.canonicalFps);m.stopAll(),f.detachAudioSource(),f.isPlaying()&&f.pause(),f.seek(h),e.currentTime=f.now(),e.isPlaying=!1,e.mediaForceSyncNextTick=!0,Ct(e.currentTime,{activateChildren:!0,suppressEvents:g?.suppressEvents}),He("pause"),Oe(),ze.redraw(),ke(!0)},getTime:()=>f.now(),getDuration:()=>{let d=f.getDuration();return Number.isFinite(d)?d:0},isPlaying:()=>f.isPlaying(),setPlaybackRate:d=>{zi(d),f.setRate(e.playbackRate),Os()},getPlaybackRate:()=>e.playbackRate},ks=Ce(e.capturedTimeline,0);ks>0&&f.setDuration(ks);let Ge=Au({getTimeline:()=>e.capturedTimeline,setTimeline:d=>{e.capturedTimeline=d},getTimelineRegistry:()=>window.__timelines??{},getIsPlaying:()=>e.isPlaying,setIsPlaying:d=>{e.isPlaying!==d&&(e.mediaForceSyncNextTick=!0),e.isPlaying=d},getPlaybackRate:()=>e.playbackRate,setPlaybackRate:zi,getCanonicalFps:()=>e.canonicalFps,onSyncMedia:(d,g)=>{e.currentTime=Math.max(0,Number(d)||0),e.isPlaying!==g&&(e.mediaForceSyncNextTick=!0),e.isPlaying=g,Oe()},onStatePost:ke,onDeterministicSeek:(d,g)=>{for(let h of e.deterministicAdapters)if(!(h.name==="gsap"&&e.capturedTimeline))try{h.seek({time:Number(d)||0,suppressEvents:g?.suppressEvents})}catch(y){L("runtime.init.site11",y)}},onDeterministicPause:()=>He("pause"),onDeterministicPlay:()=>He("play"),onRenderFrameSeek:()=>{ze.redraw()},onShowNativeVideos:()=>{},getSafeDuration:()=>Ce(e.capturedTimeline,0),transport:Rs});window.__player=D(Ge),window.__playerReady=!0,Ne("composition_loaded",{duration:Ge.getDuration(),compositionId:document.querySelector("[data-composition-id]")?.getAttribute("data-composition-id")??null}),e.deterministicAdapters=[hl(),Js({resolveStartSeconds:d=>P(d,0)}),Zs(),tl(),il(),ol(),al(),sl(),ll(),ul(),cl(),Qs({getTimeline:()=>e.capturedTimeline})],ml(),pl(),window.__hfReseekGpu=d=>{let g=Math.max(0,Number(d)||0);window.__hfThreeTime=g,window.__hfTypegpuTime=g,Fr(g)},window.__hfWaitForSeekCompletion=ao,a.push(()=>{window.__hfWaitForSeekCompletion===ao&&delete window.__hfWaitForSeekCompletion}),_m(),Hi(),He("discover");let Om=()=>{let d=e.capturedTimeline,g=dn();e.capturedTimeline&&(g||e.capturedTimeline!==d||!Ge._timeline)&&(Ge._timeline=e.capturedTimeline);let h=Ce(e.capturedTimeline,0);if(h>0&&f.setDuration(h),He("discover",e.currentTime),!e.capturedTimeline){let y=window.__timelines??{},w=Object.keys(y).filter(N=>y[N]);if(w.length>0){let G=Y()?.getAttribute("data-composition-id")??null;M("root_timeline_unbound_registry_present",{reason:G?"root data-composition-id has no matching key in window.__timelines":"root composition element has no data-composition-id attribute",rootCompositionId:G,registeredTimelineKeys:w},"root_timeline_unbound_registry_present"),console.warn("[hyperframes] Root timeline not bound \\u2014 render will freeze at t=0. "+(G?`Root data-composition-id is "${G}" but window.__timelines has no such key. `:"Root composition element has no data-composition-id. ")+`Registered timeline keys: [${w.join(", ")}]. Register the root timeline under its data-composition-id (window.__timelines["${G??""}"] = tl).`)}}window.__renderReady=!0,st(),ke(!0)},It=null,Hm=()=>{if(It)return;let d=()=>{window.removeEventListener("hf-timelines-built",d),It=null,wt()};It=d,window.addEventListener("hf-timelines-built",d)};T(()=>{It&&(window.removeEventListener("hf-timelines-built",It),It=null)}),wt=()=>{if(!B){window.__renderReady=!1;return}if(window.__hfTimelinesBuilding){window.__renderReady=!1,Hm();return}if(He("discover",e.currentTime),!Pm()){window.__renderReady=!1;return}Om()},wt(),B&&setTimeout(()=>{wt()},0);let wr=0,qi=!1,Ms=Number.NaN,Fs=null,$i=!1,Gm=(d,g,h,y)=>{try{let w=y?.suppressEvents===!0;ot(d),typeof d.totalTime=="function"?d.totalTime(g,w):d.seek(g,w)}catch(w){L(h,w)}},Bm=(d,g)=>{let h=window.__timelines??{},y=Y()?.getAttribute("data-composition-id")??null;for(let[w,N]of Object.entries(h)){if(!N||w===y)continue;let G=document.querySelector(`[data-composition-id="${CSS.escape(w)}"]`);if(!G)continue;let re=P(G,0);if(!Number.isFinite(re))continue;let $=ee(N),le=$e(G)+Math.max(0,d-re)*_e(G),Be=Math.max(0,$!=null&&$>0?Math.min($,le):le);Gm(N,Be,"runtime.init.transport.childTimeline",g)}},Ns=d=>{let g=window.__timelines??{};for(let h of Object.values(g))if(!(!h||h===d))try{h.play()}catch(y){L("runtime.init.activateSiblings",y)}},Ls=d=>typeof d=="object"&&d!==null,hn=new WeakMap,Um=["onStart","onUpdate","onComplete","onReverseComplete","onRepeat"],Ds=(d,g)=>{let h=d[g];if(typeof h!="function")return null;try{let y=Number(h.call(d));return Number.isFinite(y)?y:null}catch(y){return L("runtime.init.gsapCallbackDuration",y),null}},Wm=d=>{let g=hn.get(d);if(g!=null)return g;if(!("getChildren"in d)||typeof d.getChildren!="function")return!1;let h;try{h=d.getChildren(!0,!0,!0)}catch(y){return L("runtime.init.gsapCallbackChildren",y),hn.set(d,!1),!1}if(!Array.isArray(h))return hn.set(d,!1),!1;for(let y of h){if(!Ls(y))continue;let w=y.vars;if(!Ls(w)||!Um.some($=>typeof w[$]=="function"))continue;let re=Ds(y,"totalDuration")??Ds(y,"duration");if(re!=null&&re<=1e-6)return hn.set(d,!0),!0}return hn.set(d,!1),!1};function Ct(d,g){let h=e.capturedTimeline,y=g?.suppressEvents===!0;if(h){g?.activateChildren&&Ns(h);let w=h,N=d;if(typeof w.totalDuration=="function")try{let G=Number(w.totalDuration());Number.isFinite(G)&&G>0&&d>G&&(N=G)}catch(G){L("runtime.init.transport.clampDuration",G)}try{typeof h.totalTime=="function"?(h.totalTime(N,y),!y&&!Wm(h)&&(h.totalTime(N+.001,!0),h.totalTime(N,!0))):h.seek(N,y)}catch(G){L("runtime.init.transport.seek",G)}}Bm(d,g),h&&g?.activateChildren&&Ns(h);for(let w of e.deterministicAdapters)if(!(w.name==="gsap"&&h))try{w.seek({time:d,suppressEvents:y})}catch(N){L("runtime.init.transport.adapter",N)}}let Vm=()=>{try{return document.querySelector(`[${Cf}]`)!=null}catch{return!1}},Is=()=>{if(!(e.tornDown||qi)){qi=!0;try{if(e.transportRafId=window.requestAnimationFrame(Is),wr+=1,_f({tick:wr,isPlaying:f.isPlaying(),hasCapturedTimeline:e.capturedTimeline!=null,currentTimeSeconds:f.now()})){let y=e.capturedTimeline;if(dn()){e.capturedTimeline&&!Ge._timeline&&(Ge._timeline=e.capturedTimeline),e.capturedTimeline&&e.capturedTimeline!==y&&ot(e.capturedTimeline);let w=Ce(e.capturedTimeline,0);w>0&&f.setDuration(w),st()}}if(wr%20===0&&st(),wr%30===0&&Hi(),e.capturedTimeline){let y=Ce(e.capturedTimeline,0);y>0&&(!f.isPlaying()||y>=f.getDuration())&&f.setDuration(y)}if(f.isPlaying()&&!e.mediaOutputMuted)if(!e.nativeMediaSyncDisabled&&!e.webAudioMediaDisabled&&m.isActive()&&m.context){let y=m.getTime();y>=0&&f.attachAudioSource({currentTimeSeconds:y})}else{let y=document.querySelectorAll("audio[data-start]"),w=!1;for(let N of y){if(!(N instanceof HTMLMediaElement)||!N.isConnected||b(N))continue;let G=Number.parseFloat(N.dataset.start??""),re=ve(N.dataset.duration),$=re!=null&&re>0?G+re:1/0,le=$e(N);if(Number.isFinite(G)&&e.currentTime>=G&&e.currentTime<$){N.paused?!N.error&&N.readyState{let g=document.querySelectorAll("video, audio");for(let h of g){if(!(h instanceof HTMLMediaElement)||!h.isConnected)continue;let y=Number.parseFloat(h.dataset.start??"");if(!Number.isFinite(y))continue;let w=ve(h.dataset.duration),N=w!=null&&w>0?y+w:1/0;if(d=N)continue;let G=$e(h),re=d-y+G;if(re>=0)try{h.currentTime=re}catch{}}},ji=()=>{if(e.nativeMediaSyncDisabled||e.webAudioMediaDisabled)return;let d=m.startGeneration(),g=document.querySelectorAll("audio[data-start]");for(let h of g){if(!(h instanceof HTMLMediaElement)||!h.isConnected||b(h))continue;let y=Number.parseFloat(h.dataset.start??"");if(!Number.isFinite(y))continue;let w=$e(h),N=Number.parseFloat(h.dataset.volume??""),G=Number.isFinite(N)?N:1,re=ve(h.dataset.duration),$=re!=null&&re>0?re:Number.POSITIVE_INFINITY,le=h.closest("[data-composition-id]");if(le){let Q=P(le,0),ne=H(le,{includeAuthoredTimingAttrs:!0});ne!=null&&ne>0&&($=Math.min($,Math.max(0,Q+ne-y)))}let Be=an(h);sn(h,Be),(Be.kind==="web-audio"?m.scheduleMediaElementPlayback(h,y,w,f.now(),G,d,e.playbackRate):Promise.resolve(null)).then(Q=>{if(Q||!f.isPlaying())return;let ne=e.playbackRate*_e(h),_t=h.hasAttribute("data-fx-chain")||h.hasAttribute("data-automation");if(Math.abs(ne-1)>1e-9){Be.kind==="web-audio"&&_t&&(h.muted=!0);return}m.decodeAudioElement(h).then(ye=>{!ye||!f.isPlaying()||m.schedulePlayback(h,ye,y,w,f.now(),G,d,e.playbackRate,$)})})}};function Os(){m.setRate(e.playbackRate)&&!e.nativeMediaSyncDisabled&&!e.webAudioMediaDisabled&&p&&f.isPlaying()&&m.hasBoundedActiveSources()&&(m.stopAll(),ji())}if(e.capturedTimeline){let d=Ce(e.capturedTimeline,0);d>0&&f.setDuration(d),ot(e.capturedTimeline)}Cd(window),e.transportRafId=window.requestAnimationFrame(Is),st(),ke(!0),e.controlBridgeHandler=Us({onPlay:()=>{Ge.play(),Ne("composition_played",{time:Ge.getTime()})},onPause:()=>{Ge.pause(),Ne("composition_paused",{time:Ge.getTime()})},onStopMedia:()=>{m.stopAll();let d=document.querySelectorAll("video, audio");for(let g of d)g instanceof HTMLMediaElement&&!g.paused&&g.pause()},onSeek:(d,g)=>{Ge.seek(d),Ne("composition_seeked",{time:d})},onSetMuted:d=>{e.bridgeMuted=d;let g=d||e.mediaOutputMuted;m.setMuted(g);let h=document.querySelectorAll("video, audio");for(let y of h)y instanceof HTMLMediaElement&&(y.muted=g||y.defaultMuted)},onSetVolume:d=>{e.bridgeVolume=d,m.setVolume(d);let g=document.querySelectorAll("video, audio");for(let h of g){if(!(h instanceof HTMLMediaElement))continue;let y=parseFloat(h.dataset.volume??""),w=Number.isFinite(y)?y:1;h.volume=Nr(w*d)}},onSetMediaOutputMuted:d=>{e.mediaOutputMuted=d;let g=d||e.bridgeMuted;m.setMuted(g);let h=document.querySelectorAll("video, audio");for(let y of h)y instanceof HTMLMediaElement&&(y.muted=g||y.defaultMuted)},onSetNativeMediaSyncDisabled:d=>{e.nativeMediaSyncDisabled!==d&&(e.nativeMediaSyncDisabled=d,e.mediaForceSyncNextTick=!0,d?(m.stopAll(),f.detachAudioSource()):Oe())},onSetWebAudioMediaDisabled:d=>{e.webAudioMediaDisabled!==d&&(e.webAudioMediaDisabled=d,e.mediaForceSyncNextTick=!0,d&&(m.stopAll(),f.detachAudioSource()),Oe())},onSetPlaybackRate:d=>{zi(d),e.transportClock&&e.transportClock.setRate(e.playbackRate),Os()},onSetRootDuration:Dm,onSetColorGrading:(d,g)=>{ze.setGrading(d,g)},onSetColorGradingCompare:(d,g)=>{ze.setCompare(d,g)},onTick:()=>{if(e.tornDown||!f.isPlaying())return;let d=f.now();if(e.currentTime=d,Ct(d),f.reachedEnd()){m.stopAll(),f.detachAudioSource(),f.pause(),e.isPlaying=!1;let g=f.getDuration();Number.isFinite(g)&&(f.seek(g),e.currentTime=g,Ct(g)),He("pause"),Oe(),ke(!0)}},onEnablePickMode:()=>Er.enablePickMode(),onDisablePickMode:()=>Er.disablePickMode(),onSetRuntimeData:Ri,onClearRuntimeData:ki,getCanonicalFps:()=>e.canonicalFps});let Ki=()=>{if(!e.tornDown){e.tornDown=!0,e.transportRafId!=null&&(window.cancelAnimationFrame(e.transportRafId),e.transportRafId=null),e.transportClock=null,m.destroy(),Et!=null&&(window.clearTimeout(Et),Et=null),s!=null&&(window.cancelAnimationFrame(s),s=null),km(),e.controlBridgeHandler&&(window.removeEventListener("message",e.controlBridgeHandler),e.controlBridgeHandler=null),i&&(window.removeEventListener("error",i),i=null),o&&(window.removeEventListener("unhandledrejection",o),o=null),e.beforeUnloadHandler&&(window.removeEventListener("beforeunload",e.beforeUnloadHandler),e.beforeUnloadHandler=null),Er.disablePickMode();for(let d of e.deterministicAdapters)if(!(!d||typeof d.revert!="function"))try{d.revert()}catch(g){L("runtime.init.site12",g)}e.deterministicAdapters=[];for(let d of a.splice(0))try{d()}catch(g){L("runtime.init.site13",g)}for(let d of e.injectedCompStyles)try{d.remove()}catch(g){L("runtime.init.site14",g)}e.injectedCompStyles=[];for(let d of e.injectedCompLinks)try{d.remove()}catch(g){L("runtime.init.site15",g)}e.injectedCompLinks=[];for(let d of e.injectedCompScripts)try{d.remove()}catch(g){L("runtime.init.site16",g)}e.injectedCompScripts=[],e.capturedTimeline=null,t=()=>{},window.__hfRuntimeTeardown===Ki&&(window.__hfRuntimeTeardown=null)}};window.__hfRuntimeTeardown=Ki,e.beforeUnloadHandler=Ki,window.addEventListener("beforeunload",e.beforeUnloadHandler)}var Vf=["BN","BN","BN","BN","BN","BN","BN","BN","BN","S","B","S","WS","B","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","B","B","B","S","WS","ON","ON","ET","ET","ET","ON","ON","ON","ON","ON","ES","CS","ES","CS","CS","EN","EN","EN","EN","EN","EN","EN","EN","EN","EN","CS","ON","ON","ON","ON","ON","ON","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","ON","ON","ON","ON","ON","ON","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","ON","ON","ON","ON","BN","BN","BN","BN","BN","BN","B","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","CS","ON","ET","ET","ET","ET","ON","ON","ON","ON","L","ON","ON","BN","ON","ON","ET","ET","EN","EN","ON","L","ON","ON","ON","EN","L","ON","ON","ON","ON","ON","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","ON","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","ON","L","L","L","L","L","L","L","L"],ss=[[697,698,"ON"],[706,719,"ON"],[722,735,"ON"],[741,749,"ON"],[751,767,"ON"],[768,879,"NSM"],[884,885,"ON"],[894,894,"ON"],[900,901,"ON"],[903,903,"ON"],[1014,1014,"ON"],[1155,1161,"NSM"],[1418,1418,"ON"],[1421,1422,"ON"],[1423,1423,"ET"],[1424,1424,"R"],[1425,1469,"NSM"],[1470,1470,"R"],[1471,1471,"NSM"],[1472,1472,"R"],[1473,1474,"NSM"],[1475,1475,"R"],[1476,1477,"NSM"],[1478,1478,"R"],[1479,1479,"NSM"],[1480,1535,"R"],[1536,1541,"AN"],[1542,1543,"ON"],[1544,1544,"AL"],[1545,1546,"ET"],[1547,1547,"AL"],[1548,1548,"CS"],[1549,1549,"AL"],[1550,1551,"ON"],[1552,1562,"NSM"],[1563,1610,"AL"],[1611,1631,"NSM"],[1632,1641,"AN"],[1642,1642,"ET"],[1643,1644,"AN"],[1645,1647,"AL"],[1648,1648,"NSM"],[1649,1749,"AL"],[1750,1756,"NSM"],[1757,1757,"AN"],[1758,1758,"ON"],[1759,1764,"NSM"],[1765,1766,"AL"],[1767,1768,"NSM"],[1769,1769,"ON"],[1770,1773,"NSM"],[1774,1775,"AL"],[1776,1785,"EN"],[1786,1808,"AL"],[1809,1809,"NSM"],[1810,1839,"AL"],[1840,1866,"NSM"],[1867,1957,"AL"],[1958,1968,"NSM"],[1969,1983,"AL"],[1984,2026,"R"],[2027,2035,"NSM"],[2036,2037,"R"],[2038,2041,"ON"],[2042,2044,"R"],[2045,2045,"NSM"],[2046,2069,"R"],[2070,2073,"NSM"],[2074,2074,"R"],[2075,2083,"NSM"],[2084,2084,"R"],[2085,2087,"NSM"],[2088,2088,"R"],[2089,2093,"NSM"],[2094,2136,"R"],[2137,2139,"NSM"],[2140,2143,"R"],[2144,2191,"AL"],[2192,2193,"AN"],[2194,2198,"AL"],[2199,2207,"NSM"],[2208,2249,"AL"],[2250,2273,"NSM"],[2274,2274,"AN"],[2275,2306,"NSM"],[2362,2362,"NSM"],[2364,2364,"NSM"],[2369,2376,"NSM"],[2381,2381,"NSM"],[2385,2391,"NSM"],[2402,2403,"NSM"],[2433,2433,"NSM"],[2492,2492,"NSM"],[2497,2500,"NSM"],[2509,2509,"NSM"],[2530,2531,"NSM"],[2546,2547,"ET"],[2555,2555,"ET"],[2558,2558,"NSM"],[2561,2562,"NSM"],[2620,2620,"NSM"],[2625,2626,"NSM"],[2631,2632,"NSM"],[2635,2637,"NSM"],[2641,2641,"NSM"],[2672,2673,"NSM"],[2677,2677,"NSM"],[2689,2690,"NSM"],[2748,2748,"NSM"],[2753,2757,"NSM"],[2759,2760,"NSM"],[2765,2765,"NSM"],[2786,2787,"NSM"],[2801,2801,"ET"],[2810,2815,"NSM"],[2817,2817,"NSM"],[2876,2876,"NSM"],[2879,2879,"NSM"],[2881,2884,"NSM"],[2893,2893,"NSM"],[2901,2902,"NSM"],[2914,2915,"NSM"],[2946,2946,"NSM"],[3008,3008,"NSM"],[3021,3021,"NSM"],[3059,3064,"ON"],[3065,3065,"ET"],[3066,3066,"ON"],[3072,3072,"NSM"],[3076,3076,"NSM"],[3132,3132,"NSM"],[3134,3136,"NSM"],[3142,3144,"NSM"],[3146,3149,"NSM"],[3157,3158,"NSM"],[3170,3171,"NSM"],[3192,3198,"ON"],[3201,3201,"NSM"],[3260,3260,"NSM"],[3276,3277,"NSM"],[3298,3299,"NSM"],[3328,3329,"NSM"],[3387,3388,"NSM"],[3393,3396,"NSM"],[3405,3405,"NSM"],[3426,3427,"NSM"],[3457,3457,"NSM"],[3530,3530,"NSM"],[3538,3540,"NSM"],[3542,3542,"NSM"],[3633,3633,"NSM"],[3636,3642,"NSM"],[3647,3647,"ET"],[3655,3662,"NSM"],[3761,3761,"NSM"],[3764,3772,"NSM"],[3784,3790,"NSM"],[3864,3865,"NSM"],[3893,3893,"NSM"],[3895,3895,"NSM"],[3897,3897,"NSM"],[3898,3901,"ON"],[3953,3966,"NSM"],[3968,3972,"NSM"],[3974,3975,"NSM"],[3981,3991,"NSM"],[3993,4028,"NSM"],[4038,4038,"NSM"],[4141,4144,"NSM"],[4146,4151,"NSM"],[4153,4154,"NSM"],[4157,4158,"NSM"],[4184,4185,"NSM"],[4190,4192,"NSM"],[4209,4212,"NSM"],[4226,4226,"NSM"],[4229,4230,"NSM"],[4237,4237,"NSM"],[4253,4253,"NSM"],[4957,4959,"NSM"],[5008,5017,"ON"],[5120,5120,"ON"],[5760,5760,"WS"],[5787,5788,"ON"],[5906,5908,"NSM"],[5938,5939,"NSM"],[5970,5971,"NSM"],[6002,6003,"NSM"],[6068,6069,"NSM"],[6071,6077,"NSM"],[6086,6086,"NSM"],[6089,6099,"NSM"],[6107,6107,"ET"],[6109,6109,"NSM"],[6128,6137,"ON"],[6144,6154,"ON"],[6155,6157,"NSM"],[6158,6158,"BN"],[6159,6159,"NSM"],[6277,6278,"NSM"],[6313,6313,"NSM"],[6432,6434,"NSM"],[6439,6440,"NSM"],[6450,6450,"NSM"],[6457,6459,"NSM"],[6464,6464,"ON"],[6468,6469,"ON"],[6622,6655,"ON"],[6679,6680,"NSM"],[6683,6683,"NSM"],[6742,6742,"NSM"],[6744,6750,"NSM"],[6752,6752,"NSM"],[6754,6754,"NSM"],[6757,6764,"NSM"],[6771,6780,"NSM"],[6783,6783,"NSM"],[6832,6877,"NSM"],[6880,6891,"NSM"],[6912,6915,"NSM"],[6964,6964,"NSM"],[6966,6970,"NSM"],[6972,6972,"NSM"],[6978,6978,"NSM"],[7019,7027,"NSM"],[7040,7041,"NSM"],[7074,7077,"NSM"],[7080,7081,"NSM"],[7083,7085,"NSM"],[7142,7142,"NSM"],[7144,7145,"NSM"],[7149,7149,"NSM"],[7151,7153,"NSM"],[7212,7219,"NSM"],[7222,7223,"NSM"],[7376,7378,"NSM"],[7380,7392,"NSM"],[7394,7400,"NSM"],[7405,7405,"NSM"],[7412,7412,"NSM"],[7416,7417,"NSM"],[7616,7679,"NSM"],[8125,8125,"ON"],[8127,8129,"ON"],[8141,8143,"ON"],[8157,8159,"ON"],[8173,8175,"ON"],[8189,8190,"ON"],[8192,8202,"WS"],[8203,8205,"BN"],[8207,8207,"R"],[8208,8231,"ON"],[8232,8232,"WS"],[8233,8233,"B"],[8234,8238,"BN"],[8239,8239,"CS"],[8240,8244,"ET"],[8245,8259,"ON"],[8260,8260,"CS"],[8261,8286,"ON"],[8287,8287,"WS"],[8288,8303,"BN"],[8304,8304,"EN"],[8308,8313,"EN"],[8314,8315,"ES"],[8316,8318,"ON"],[8320,8329,"EN"],[8330,8331,"ES"],[8332,8334,"ON"],[8352,8399,"ET"],[8400,8432,"NSM"],[8448,8449,"ON"],[8451,8454,"ON"],[8456,8457,"ON"],[8468,8468,"ON"],[8470,8472,"ON"],[8478,8483,"ON"],[8485,8485,"ON"],[8487,8487,"ON"],[8489,8489,"ON"],[8494,8494,"ET"],[8506,8507,"ON"],[8512,8516,"ON"],[8522,8525,"ON"],[8528,8543,"ON"],[8585,8587,"ON"],[8592,8721,"ON"],[8722,8722,"ES"],[8723,8723,"ET"],[8724,9013,"ON"],[9083,9108,"ON"],[9110,9257,"ON"],[9280,9290,"ON"],[9312,9351,"ON"],[9352,9371,"EN"],[9450,9899,"ON"],[9901,10239,"ON"],[10496,11123,"ON"],[11126,11263,"ON"],[11493,11498,"ON"],[11503,11505,"NSM"],[11513,11519,"ON"],[11647,11647,"NSM"],[11744,11775,"NSM"],[11776,11869,"ON"],[11904,11929,"ON"],[11931,12019,"ON"],[12032,12245,"ON"],[12272,12287,"ON"],[12288,12288,"WS"],[12289,12292,"ON"],[12296,12320,"ON"],[12330,12333,"NSM"],[12336,12336,"ON"],[12342,12343,"ON"],[12349,12351,"ON"],[12441,12442,"NSM"],[12443,12444,"ON"],[12448,12448,"ON"],[12539,12539,"ON"],[12736,12773,"ON"],[12783,12783,"ON"],[12829,12830,"ON"],[12880,12895,"ON"],[12924,12926,"ON"],[12977,12991,"ON"],[13004,13007,"ON"],[13175,13178,"ON"],[13278,13279,"ON"],[13311,13311,"ON"],[19904,19967,"ON"],[42128,42182,"ON"],[42509,42511,"ON"],[42607,42610,"NSM"],[42611,42611,"ON"],[42612,42621,"NSM"],[42622,42623,"ON"],[42654,42655,"NSM"],[42736,42737,"NSM"],[42752,42785,"ON"],[42888,42888,"ON"],[43010,43010,"NSM"],[43014,43014,"NSM"],[43019,43019,"NSM"],[43045,43046,"NSM"],[43048,43051,"ON"],[43052,43052,"NSM"],[43064,43065,"ET"],[43124,43127,"ON"],[43204,43205,"NSM"],[43232,43249,"NSM"],[43263,43263,"NSM"],[43302,43309,"NSM"],[43335,43345,"NSM"],[43392,43394,"NSM"],[43443,43443,"NSM"],[43446,43449,"NSM"],[43452,43453,"NSM"],[43493,43493,"NSM"],[43561,43566,"NSM"],[43569,43570,"NSM"],[43573,43574,"NSM"],[43587,43587,"NSM"],[43596,43596,"NSM"],[43644,43644,"NSM"],[43696,43696,"NSM"],[43698,43700,"NSM"],[43703,43704,"NSM"],[43710,43711,"NSM"],[43713,43713,"NSM"],[43756,43757,"NSM"],[43766,43766,"NSM"],[43882,43883,"ON"],[44005,44005,"NSM"],[44008,44008,"NSM"],[44013,44013,"NSM"],[64285,64285,"R"],[64286,64286,"NSM"],[64287,64296,"R"],[64297,64297,"ES"],[64298,64335,"R"],[64336,64450,"AL"],[64451,64466,"ON"],[64467,64829,"AL"],[64830,64847,"ON"],[64848,64911,"AL"],[64912,64913,"ON"],[64914,64967,"AL"],[64968,64975,"ON"],[64976,65007,"BN"],[65008,65020,"AL"],[65021,65023,"ON"],[65024,65039,"NSM"],[65040,65049,"ON"],[65056,65071,"NSM"],[65072,65103,"ON"],[65104,65104,"CS"],[65105,65105,"ON"],[65106,65106,"CS"],[65108,65108,"ON"],[65109,65109,"CS"],[65110,65118,"ON"],[65119,65119,"ET"],[65120,65121,"ON"],[65122,65123,"ES"],[65124,65126,"ON"],[65128,65128,"ON"],[65129,65130,"ET"],[65131,65131,"ON"],[65136,65278,"AL"],[65279,65279,"BN"],[65281,65282,"ON"],[65283,65285,"ET"],[65286,65290,"ON"],[65291,65291,"ES"],[65292,65292,"CS"],[65293,65293,"ES"],[65294,65295,"CS"],[65296,65305,"EN"],[65306,65306,"CS"],[65307,65312,"ON"],[65339,65344,"ON"],[65371,65381,"ON"],[65504,65505,"ET"],[65506,65508,"ON"],[65509,65510,"ET"],[65512,65518,"ON"],[65520,65528,"BN"],[65529,65533,"ON"],[65534,65535,"BN"],[65793,65793,"ON"],[65856,65932,"ON"],[65936,65948,"ON"],[65952,65952,"ON"],[66045,66045,"NSM"],[66272,66272,"NSM"],[66273,66299,"EN"],[66422,66426,"NSM"],[67584,67870,"R"],[67871,67871,"ON"],[67872,68096,"R"],[68097,68099,"NSM"],[68100,68100,"R"],[68101,68102,"NSM"],[68103,68107,"R"],[68108,68111,"NSM"],[68112,68151,"R"],[68152,68154,"NSM"],[68155,68158,"R"],[68159,68159,"NSM"],[68160,68324,"R"],[68325,68326,"NSM"],[68327,68408,"R"],[68409,68415,"ON"],[68416,68863,"R"],[68864,68899,"AL"],[68900,68903,"NSM"],[68904,68911,"AL"],[68912,68921,"AN"],[68922,68927,"AL"],[68928,68937,"AN"],[68938,68968,"R"],[68969,68973,"NSM"],[68974,68974,"ON"],[68975,69215,"R"],[69216,69246,"AN"],[69247,69290,"R"],[69291,69292,"NSM"],[69293,69311,"R"],[69312,69327,"AL"],[69328,69336,"ON"],[69337,69369,"AL"],[69370,69375,"NSM"],[69376,69423,"R"],[69424,69445,"AL"],[69446,69456,"NSM"],[69457,69487,"AL"],[69488,69505,"R"],[69506,69509,"NSM"],[69510,69631,"R"],[69633,69633,"NSM"],[69688,69702,"NSM"],[69714,69733,"ON"],[69744,69744,"NSM"],[69747,69748,"NSM"],[69759,69761,"NSM"],[69811,69814,"NSM"],[69817,69818,"NSM"],[69826,69826,"NSM"],[69888,69890,"NSM"],[69927,69931,"NSM"],[69933,69940,"NSM"],[70003,70003,"NSM"],[70016,70017,"NSM"],[70070,70078,"NSM"],[70089,70092,"NSM"],[70095,70095,"NSM"],[70191,70193,"NSM"],[70196,70196,"NSM"],[70198,70199,"NSM"],[70206,70206,"NSM"],[70209,70209,"NSM"],[70367,70367,"NSM"],[70371,70378,"NSM"],[70400,70401,"NSM"],[70459,70460,"NSM"],[70464,70464,"NSM"],[70502,70508,"NSM"],[70512,70516,"NSM"],[70587,70592,"NSM"],[70606,70606,"NSM"],[70608,70608,"NSM"],[70610,70610,"NSM"],[70625,70626,"NSM"],[70712,70719,"NSM"],[70722,70724,"NSM"],[70726,70726,"NSM"],[70750,70750,"NSM"],[70835,70840,"NSM"],[70842,70842,"NSM"],[70847,70848,"NSM"],[70850,70851,"NSM"],[71090,71093,"NSM"],[71100,71101,"NSM"],[71103,71104,"NSM"],[71132,71133,"NSM"],[71219,71226,"NSM"],[71229,71229,"NSM"],[71231,71232,"NSM"],[71264,71276,"ON"],[71339,71339,"NSM"],[71341,71341,"NSM"],[71344,71349,"NSM"],[71351,71351,"NSM"],[71453,71453,"NSM"],[71455,71455,"NSM"],[71458,71461,"NSM"],[71463,71467,"NSM"],[71727,71735,"NSM"],[71737,71738,"NSM"],[71995,71996,"NSM"],[71998,71998,"NSM"],[72003,72003,"NSM"],[72148,72151,"NSM"],[72154,72155,"NSM"],[72160,72160,"NSM"],[72193,72198,"NSM"],[72201,72202,"NSM"],[72243,72248,"NSM"],[72251,72254,"NSM"],[72263,72263,"NSM"],[72273,72278,"NSM"],[72281,72283,"NSM"],[72330,72342,"NSM"],[72344,72345,"NSM"],[72544,72544,"NSM"],[72546,72548,"NSM"],[72550,72550,"NSM"],[72752,72758,"NSM"],[72760,72765,"NSM"],[72850,72871,"NSM"],[72874,72880,"NSM"],[72882,72883,"NSM"],[72885,72886,"NSM"],[73009,73014,"NSM"],[73018,73018,"NSM"],[73020,73021,"NSM"],[73023,73029,"NSM"],[73031,73031,"NSM"],[73104,73105,"NSM"],[73109,73109,"NSM"],[73111,73111,"NSM"],[73459,73460,"NSM"],[73472,73473,"NSM"],[73526,73530,"NSM"],[73536,73536,"NSM"],[73538,73538,"NSM"],[73562,73562,"NSM"],[73685,73692,"ON"],[73693,73696,"ET"],[73697,73713,"ON"],[78912,78912,"NSM"],[78919,78933,"NSM"],[90398,90409,"NSM"],[90413,90415,"NSM"],[92912,92916,"NSM"],[92976,92982,"NSM"],[94031,94031,"NSM"],[94095,94098,"NSM"],[94178,94178,"ON"],[94180,94180,"NSM"],[113821,113822,"NSM"],[113824,113827,"BN"],[117760,117973,"ON"],[118e3,118009,"EN"],[118010,118012,"ON"],[118016,118451,"ON"],[118458,118480,"ON"],[118496,118512,"ON"],[118528,118573,"NSM"],[118576,118598,"NSM"],[119143,119145,"NSM"],[119155,119162,"BN"],[119163,119170,"NSM"],[119173,119179,"NSM"],[119210,119213,"NSM"],[119273,119274,"ON"],[119296,119361,"ON"],[119362,119364,"NSM"],[119365,119365,"ON"],[119552,119638,"ON"],[120513,120513,"ON"],[120539,120539,"ON"],[120571,120571,"ON"],[120597,120597,"ON"],[120629,120629,"ON"],[120655,120655,"ON"],[120687,120687,"ON"],[120713,120713,"ON"],[120745,120745,"ON"],[120771,120771,"ON"],[120782,120831,"EN"],[121344,121398,"NSM"],[121403,121452,"NSM"],[121461,121461,"NSM"],[121476,121476,"NSM"],[121499,121503,"NSM"],[121505,121519,"NSM"],[122880,122886,"NSM"],[122888,122904,"NSM"],[122907,122913,"NSM"],[122915,122916,"NSM"],[122918,122922,"NSM"],[123023,123023,"NSM"],[123184,123190,"NSM"],[123566,123566,"NSM"],[123628,123631,"NSM"],[123647,123647,"ET"],[124140,124143,"NSM"],[124398,124399,"NSM"],[124643,124643,"NSM"],[124646,124646,"NSM"],[124654,124655,"NSM"],[124661,124661,"NSM"],[124928,125135,"R"],[125136,125142,"NSM"],[125143,125251,"R"],[125252,125258,"NSM"],[125259,126063,"R"],[126064,126143,"AL"],[126144,126207,"R"],[126208,126287,"AL"],[126288,126463,"R"],[126464,126703,"AL"],[126704,126705,"ON"],[126706,126719,"AL"],[126720,126975,"R"],[126976,127019,"ON"],[127024,127123,"ON"],[127136,127150,"ON"],[127153,127167,"ON"],[127169,127183,"ON"],[127185,127221,"ON"],[127232,127242,"EN"],[127243,127247,"ON"],[127279,127279,"ON"],[127338,127343,"ON"],[127405,127405,"ON"],[127584,127589,"ON"],[127744,128728,"ON"],[128732,128748,"ON"],[128752,128764,"ON"],[128768,128985,"ON"],[128992,129003,"ON"],[129008,129008,"ON"],[129024,129035,"ON"],[129040,129095,"ON"],[129104,129113,"ON"],[129120,129159,"ON"],[129168,129197,"ON"],[129200,129211,"ON"],[129216,129217,"ON"],[129232,129240,"ON"],[129280,129623,"ON"],[129632,129645,"ON"],[129648,129660,"ON"],[129664,129674,"ON"],[129678,129734,"ON"],[129736,129736,"ON"],[129741,129756,"ON"],[129759,129770,"ON"],[129775,129784,"ON"],[129792,129938,"ON"],[129940,130031,"ON"],[130032,130041,"EN"],[130042,130042,"ON"],[131070,131071,"BN"],[196606,196607,"BN"],[262142,262143,"BN"],[327678,327679,"BN"],[393214,393215,"BN"],[458750,458751,"BN"],[524286,524287,"BN"],[589822,589823,"BN"],[655358,655359,"BN"],[720894,720895,"BN"],[786430,786431,"BN"],[851966,851967,"BN"],[917502,917759,"BN"],[917760,917999,"NSM"],[918e3,921599,"BN"],[983038,983039,"BN"],[1048574,1048575,"BN"],[1114110,1114111,"BN"]];function xy(e){if(e<=255)return Vf[e];let t=0,n=ss.length-1;for(;t<=n;){let r=t+n>>1,i=ss[r];if(ei[1]){t=r+1;continue}return i[2]}return"L"}function yy(e){let t=e.length;if(t===0)return null;let n=new Array(t),r=!1;for(let u=0;u=55296&&c<=56319&&u+1=56320&&b<=57343&&(f=(c-55296<<10)+(b-56320)+65536,m=2)}let p=xy(f);(p==="R"||p==="AL"||p==="AN")&&(r=!0);for(let b=0;b=0&&n[c]==="ET";c--)n[c]="EN";for(c=u+1;c0?n[u-1]:l,m=c0&&t.charCodeAt(t.length-1)===32&&(t=t.slice(0,-1)),t}function wy(e){return/[\\r\\f]/.test(e)?e.replace(/\\r\\n/g,`\n`).replace(/[\\r\\f]/g,`\n`):e.replace(/\\r\\n/g,`\n`)}var ls=null,Cy;function _y(){return ls===null&&(ls=new Intl.Segmenter(Cy,{granularity:"word"})),ls}var Ty=/\\p{Script=Arabic}/u,Mi=/\\p{M}/u,Qf=/\\p{Nd}/u;function qf(e){return Ty.test(e)}function $f(e){return e>=19968&&e<=40959||e>=13312&&e<=19903||e>=131072&&e<=173791||e>=173824&&e<=177983||e>=177984&&e<=178207||e>=178208&&e<=183983||e>=183984&&e<=191471||e>=191472&&e<=192093||e>=194560&&e<=195103||e>=196608&&e<=201551||e>=201552&&e<=205743||e>=205744&&e<=210041||e>=63744&&e<=64255||e>=12288&&e<=12351||e>=12352&&e<=12447||e>=12448&&e<=12543||e>=44032&&e<=55215||e>=65280&&e<=65519}function Ve(e){for(let t=0;t=55296&&n<=56319&&t+1=56320&&r<=57343){let i=(n-55296<<10)+(r-56320)+65536;if($f(i))return!0;t++;continue}}if($f(n))return!0}}return!1}function Ry(e){let t=Li(e);return t!==null&&(Ni.has(t)||vt.has(t))}var ky=new Set(["\\xA0","\\u202F","\\u2060","\\uFEFF"]);function My(e){return Ve(e)}function Fy(e){let t=Li(e);return t!==null&&ky.has(t)}function Fi(e){return!Ry(e)&&!Fy(e)}var Ni=new Set(["\\uFF0C","\\uFF0E","\\uFF01","\\uFF1A","\\uFF1B","\\uFF1F","\\u3001","\\u3002","\\u30FB","\\uFF09","\\u3015","\\u3009","\\u300B","\\u300D","\\u300F","\\u3011","\\u3017","\\u3019","\\u301B","\\u30FC","\\u3005","\\u303B","\\u309D","\\u309E","\\u30FD","\\u30FE"]),hr=new Set([\'"\',"(","[","{","\\u201C","\\u2018","\\xAB","\\u2039","\\uFF08","\\u3014","\\u3008","\\u300A","\\u300C","\\u300E","\\u3010","\\u3016","\\u3018","\\u301A"]),cs=new Set(["\'","\\u2019"]),vt=new Set([".",",","!","?",":",";","\\u060C","\\u061B","\\u061F","\\u0964","\\u0965","\\u104A","\\u104B","\\u104C","\\u104D","\\u104F",")","]","}","%",\'"\',"\\u201D","\\u2019","\\xBB","\\u203A","\\u2026"]),Ny=new Set([":",".","\\u060C","\\u061B"]),Ly=new Set(["\\u104F"]),Dy=new Set(["\\u201D","\\u2019","\\xBB","\\u203A","\\u300D","\\u300F","\\u3011","\\u300B","\\u3009","\\u3015","\\uFF09"]);function Iy(e){if(ds(e))return!0;let t=!1;for(let n of e){if(vt.has(n)){t=!0;continue}if(!(t&&Mi.test(n)))return!1}return t}function Py(e){for(let t of e)if(!Ni.has(t)&&!vt.has(t))return!1;return e.length>0}function Oy(e){if(ds(e))return!0;for(let t of e)if(!hr.has(t)&&!cs.has(t)&&!Mi.test(t))return!1;return e.length>0}function ds(e){let t=!1;for(let n of e)if(!(n==="\\\\"||Mi.test(n))){if(hr.has(n)||vt.has(n)||cs.has(n)){t=!0;continue}return!1}return t}function Zf(e,t){let n=t-1;if(n<=0)return Math.max(n,0);let r=e.charCodeAt(n);if(r<56320||r>57343)return n;let i=n-1;if(i<0)return n;let o=e.charCodeAt(i);return o>=55296&&o<=56319?i:n}function Li(e){if(e.length===0)return null;let t=Zf(e,e.length);return e.slice(t)}function Hy(e){let t=Array.from(e),n=t.length;for(;n>0;){let r=t[n-1];if(Mi.test(r)){n--;continue}if(hr.has(r)||cs.has(r)){n--;continue}break}return n<=0||n===t.length?null:{head:t.slice(0,n).join(""),tail:t.slice(n).join("")}}function Gy(e,t,n){return n==="text"&&!t&&e.length===1&&e!=="-"&&e!=="\\u2014"?e:null}function jf(e,t,n,r){let i=t[r],o=e[r];if(i==null)return o;let a=n[r];if(o.length===a)return o;let l=i.repeat(a);return e[r]=l,l}function Kf(e,t){return e&&t!==null&&Ny.has(t)}function By(e){let t=Li(e);return t!==null&&Ly.has(t)}function Uy(e){if(e.length<2||e[0]!==" ")return null;let t=e.slice(1);return/^\\p{M}+$/u.test(t)?{space:" ",marks:t}:null}function Di(e){let t=e.length;for(;t>0;){let n=Zf(e,t),r=e.slice(n,t);if(Dy.has(r))return!0;if(!vt.has(r))return!1;t=n}return!1}function Wy(e,t){if(t.preserveOrdinarySpaces||t.preserveHardBreaks){if(e===" ")return"preserved-space";if(e===" ")return"tab";if(t.preserveHardBreaks&&e===`\n`)return"hard-break"}return e===" "?"space":e==="\\xA0"||e==="\\u202F"||e==="\\u2060"||e==="\\uFEFF"?"glue":e==="\\u200B"?"zero-width-break":e==="\\xAD"?"soft-hyphen":"text"}var Vy=/[\\x20\\t\\n\\xA0\\xAD\\u200B\\u202F\\u2060\\uFEFF]/;function Ie(e){return e.length===1?e[0]:e.join("")}function zy(e,t){let n=[];for(let r=e.length-1;r>=0;r--)n.push(e[r]);return n.push(t),Ie(n)}function qy(e,t,n,r){if(!Vy.test(e))return[{text:e,isWordLike:t,kind:"text",start:n}];let i=[],o=null,a=[],l=n,s=!1,u=0;for(let c of e){let f=Wy(c,r),m=f==="text"&&t;if(o!==null&&f===o&&m===s){a.push(c),u+=c.length;continue}o!==null&&i.push({text:Ie(a),isWordLike:s,kind:o,start:l}),o=f,a=[c],l=n+u,s=m,u+=c.length}return o!==null&&i.push({text:Ie(a),isWordLike:s,kind:o,start:l}),i}function us(e){return e==="space"||e==="preserved-space"||e==="zero-width-break"||e==="hard-break"}var $y=/^[A-Za-z][A-Za-z0-9+.-]*:$/;function jy(e,t){let n=e.texts[t];return n.startsWith("www.")?!0:$y.test(n)&&t+1=e.len||us(e.kinds[l]))continue;let s=[],u=e.starts[l],c=l;for(;c0&&(t.push(Ie(s)),n.push(!0),r.push("text"),i.push(u),o=c-1)}return{len:t.length,texts:t,isWordLike:n,kinds:r,starts:i}}var Jy=new Set([":","-","/","\\xD7",",",".","+","\\u2013","\\u2014"]),Yf=/^[A-Za-z0-9_]+[,:;]*$/,Xf=/[,:;]+$/;function em(e){for(let t of e)if(Qf.test(t))return!0;return!1}function pr(e){if(e.length===0)return!1;for(let t of e)if(!(Qf.test(t)||Jy.has(t)))return!1;return!0}function Qy(e){let t=[],n=[],r=[],i=[];for(let o=0;o1;for(let u=0;u0&&s[k]==="text"&&F&&m[k]&&b[k]||A&&i>0&&s[k]==="text"&&Py(S.text)&&m[k]||A&&i>0&&s[k]==="text"&&v[k]?U():A&&i>0&&s[k]==="text"&&S.isWordLike&&I&&x[k]?(U(),l[k]=!0):C!==null&&i>0&&s[k]==="text"&&c[k]===C?f[k]=(f[k]??1)+1:A&&!S.isWordLike&&i>0&&s[k]==="text"&&(Iy(S.text)||S.text==="-"&&l[k])?U():(o[i]=S.text,a[i]=[S.text],l[i]=S.isWordLike,s[i]=S.kind,u[i]=S.start,c[i]=C,f[i]=C===null?0:1,m[i]=F,p[i]=I,b[i]=W,v[i]=Y,x[i]=Kf(I,q),i++)}for(let E=0;Enull),R=-1;for(let E=i-1;E>=0;E--){let S=o[E];if(S.length!==0){if(s[E]==="text"&&!l[E]&&Oy(S)&&R>=0&&s[R]==="text"){let A=_[R]??[];A.push(S),_[R]=A,u[R]=u[E],o[E]="";continue}R=E}}for(let E=0;E"u")return un={lineFitEpsilon:.005,carryCJKAfterClosingQuote:!1,preferPrefixWidthsForBreakableRuns:!1,preferEarlySoftHyphenBreak:!1},un;let e=navigator.userAgent,n=navigator.vendor==="Apple Computer, Inc."&&e.includes("Safari/")&&!e.includes("Chrome/")&&!e.includes("Chromium/")&&!e.includes("CriOS/")&&!e.includes("FxiOS/")&&!e.includes("EdgiOS/"),r=e.includes("Chrome/")||e.includes("Chromium/")||e.includes("CriOS/")||e.includes("Edg/");return un={lineFitEpsilon:n?1/64:.005,carryCJKAfterClosingQuote:r,preferPrefixWidthsForBreakableRuns:n,preferEarlySoftHyphenBreak:n},un}function u1(e){let t=e.match(/(\\d+(?:\\.\\d+)?)\\s*px/);return t?parseFloat(t[1]):16}function im(){return fs===null&&(fs=new Intl.Segmenter(void 0,{granularity:"grapheme"})),fs}function c1(e){return a1.test(e)||e.includes("\\uFE0F")}function om(e){return s1.test(e)}function d1(e,t){let n=rm.get(e);if(n!==void 0)return n;let r=ms();r.font=e;let i=r.measureText("\\u{1F600}").width;if(n=0,i>t+.5&&typeof document<"u"&&document.body!==null){let o=document.createElement("span");o.style.font=e,o.style.display="inline-block",o.style.visibility="hidden",o.style.position="absolute",o.textContent="\\u{1F600}",document.body.appendChild(o);let a=o.getBoundingClientRect().width;document.body.removeChild(o),i-a>.5&&(n=i-a)}return rm.set(e,n),n}function f1(e){let t=0,n=im();for(let r of n.segment(e))c1(r.segment)&&t++;return t}function m1(e,t){return t.emojiCount===void 0&&(t.emojiCount=f1(e)),t.emojiCount}function St(e,t,n){return n===0?t.width:t.width-m1(e,t)*n}function am(e,t,n,r,i){if(t.breakableFitAdvances!==void 0)return t.breakableFitAdvances;let o=im(),a=[];for(let c of o.segment(e))a.push(c.segment);if(a.length<=1)return t.breakableFitAdvances=null,t.breakableFitAdvances;if(i==="sum-graphemes"){let c=[];for(let f of a){let m=at(f,n);c.push(St(f,m,r))}return t.breakableFitAdvances=c,t.breakableFitAdvances}if(i==="pair-context"||a.length>o1){let c=[],f=null,m=0;for(let p of a){let b=at(p,n),v=St(p,b,r);if(f===null)c.push(v);else{let x=f+p,_=at(x,n);c.push(St(x,_,r)-m)}f=p,m=v}return t.breakableFitAdvances=c,t.breakableFitAdvances}let l=[],s="",u=0;for(let c of a){s+=c;let f=at(s,n),m=St(s,f,r);l.push(m-u),u=m}return t.breakableFitAdvances=l,t.breakableFitAdvances}function sm(e,t){let n=ms();n.font=e;let r=l1(e),i=u1(e),o=t?d1(e,i):0;return{cache:r,fontSize:i,emojiCorrection:o}}function p1(e,t){for(;tn+r)break;a=l,o++}return{fitCount:o,fittedWidth:a}}function h1(e,t){let n=0,r=e.chunks.length;for(;n0)return t;let i=e.chunks[t];if(i.startSegmentIndex===i.endSegmentIndex&&r===i.startSegmentIndex)return n.segmentIndex=r,n.graphemeIndex=0,t;for(r=e.widths.length?-1:(n.segmentIndex=i.consumedEndSegmentIndex,n.graphemeIndex=0,t+1)}function dm(e,t){if(t.segmentIndex>=e.widths.length)return-1;let n=h1(e,t.segmentIndex);return n<0?-1:cm(e,n,t)}function g1(e,t,n){if(n.segmentIndex>=e.widths.length)return-1;let r=t;for(;r=e.chunks[r].consumedEndSegmentIndex;)r++;return r>=e.chunks.length?-1:cm(e,r,n)}function fm(e,t){return e.simpleLineWalkFastPath?mm(e,t):ps(e,t)}function mm(e,t,n){let{widths:r,kinds:i,breakableFitAdvances:o}=e;if(r.length===0)return 0;let l=At().lineFitEpsilon,s=t+l,u=0,c=0,f=!1,m=0,p=0,b=0,v=0,x=-1,_=0;function R(){x=-1,_=0}function T(C=b,F=v,I=c){u++,n?.({startSegmentIndex:m,startGraphemeIndex:p,endSegmentIndex:C,endGraphemeIndex:F,width:I}),c=0,f=!1,R()}function M(C,F){f=!0,m=C,p=0,b=C+1,v=0,c=F}function D(C,F,I){f=!0,m=C,p=F,b=C,v=F+1,c=I}function E(C,F){if(!f){M(C,F);return}c+=F,b=C+1,v=0}function S(C,F){let I=o[C];for(let q=F;qs?(T(),D(C,q,W)):(c+=W,b=C,v=q+1):D(C,q,W)}f&&b===C&&v===I.length&&(b=C+1,v=0)}let A=0;for(;A=r.length));){let C=r[A],F=i[A],I=F==="space"||F==="preserved-space"||F==="tab"||F==="zero-width-break"||F==="soft-hyphen";if(!f){C>t&&o[A]!==null?S(A,0):M(A,C),I&&(x=A+1,_=c-C),A++;continue}if(c+C>s){if(I){E(A,C),T(A+1,0,c-C),A++;continue}if(x>=0){if(b>x||b===x&&v>0){T();continue}T(x,0,_);continue}if(C>t&&o[A]!==null){T(),S(A,0),A++;continue}T();continue}E(A,C),I&&(x=A+1,_=c-C),A++}return f&&T(),u}function ps(e,t,n){if(e.simpleLineWalkFastPath)return mm(e,t,n);let{widths:r,lineEndFitAdvances:i,lineEndPaintAdvances:o,kinds:a,breakableFitAdvances:l,discretionaryHyphenWidth:s,tabStopAdvance:u,chunks:c}=e;if(r.length===0||c.length===0)return 0;let f=At(),m=f.lineFitEpsilon,p=t+m,b=0,v=0,x=!1,_=0,R=0,T=0,M=0,D=-1,E=0,S=0,A=null;function C(){D=-1,E=0,S=0,A=null}function F(P=T,H=M,V=v){b++,n?.({startSegmentIndex:_,startGraphemeIndex:R,endSegmentIndex:P,endGraphemeIndex:H,width:V}),v=0,x=!1,C()}function I(P,H){x=!0,_=P,R=0,T=P+1,M=0,v=H}function q(P,H,V){x=!0,_=P,R=H,T=P,M=H+1,v=V}function W(P,H){if(!x){I(P,H);return}v+=H,T=P+1,M=0}function Y(P,H,V,j){if(!H)return;let we=P==="tab"?0:i[V],z=P==="tab"?j:o[V];D=V+1,E=v-j+we,S=v-j+z,A=P}function k(P,H){let V=l[P];for(let j=H;jp?(F(),q(P,j,we)):(v+=we,T=P,M=j+1):q(P,j,we)}x&&T===P&&M===V.length&&(T=P+1,M=0)}function U(P){if(A!=="soft-hyphen")return!1;let H=l[P];if(H==null)return!1;let{fitCount:V,fittedWidth:j}=um(H,v,t,m,s);return V===0?!1:(v=j,T=P,M=V,C(),V===H.length?(T=P+1,M=0,!0):(F(P,V,j+s),k(P,V),!0))}function ie(P){b++,n?.({startSegmentIndex:P.startSegmentIndex,startGraphemeIndex:0,endSegmentIndex:P.consumedEndSegmentIndex,endGraphemeIndex:0,width:0}),C()}for(let P=0;Pt&&l[V]!==null?k(V,0):I(V,z),Y(j,we,V,z),V++;continue}if(v+z>p){let B=v+(j==="tab"?0:i[V]),ee=v+(j==="tab"?z:o[V]);if(A==="soft-hyphen"&&f.preferEarlySoftHyphenBreak&&E<=p){F(D,0,S);continue}if(A==="soft-hyphen"&&U(V)){V++;continue}if(we&&B<=p){W(V,z),F(V+1,0,ee),V++;continue}if(D>=0&&E<=p){if(T>D||T===D&&M>0){F();continue}let K=D;F(K,0,S),V=K;continue}if(z>t&&l[V]!==null){F(),k(V,0),V++;continue}F();continue}W(V,z),Y(j,we,V,z),V++}if(x){let j=D===H.consumedEndSegmentIndex?S:v;F(H.consumedEndSegmentIndex,0,j)}}return b}function pm(e,t,n,r){let i=e.chunks[n];if(i.startSegmentIndex===i.endSegmentIndex)return t.segmentIndex=i.consumedEndSegmentIndex,t.graphemeIndex=0,0;let{widths:o,lineEndFitAdvances:a,lineEndPaintAdvances:l,kinds:s,breakableFitAdvances:u,discretionaryHyphenWidth:c,tabStopAdvance:f}=e,m=At(),p=m.lineFitEpsilon,b=r+p,v=0,x=!1,_=t.segmentIndex,R=t.graphemeIndex,T=-1,M=0,D=0,E=null;function S(){T=-1,M=0,D=0,E=null}function A(k=_,U=R,ie=v){return x?(t.segmentIndex=k,t.graphemeIndex=U,ie):null}function C(k,U){x=!0,_=k+1,R=0,v=U}function F(k,U,ie){x=!0,_=k,R=U+1,v=ie}function I(k,U){if(!x){C(k,U);return}v+=U,_=k+1,R=0}function q(k,U,ie,P){if(!U)return;let H=k==="tab"?0:a[ie],V=k==="tab"?P:l[ie];T=ie+1,M=v-P+H,D=v-P+V,E=k}function W(k,U){let ie=u[k];for(let P=U;Pb)return A();v+=H,_=k,R=P+1}}return x&&_===k&&R===ie.length&&(_=k+1,R=0),null}function Y(k){if(E!=="soft-hyphen"||T<0)return null;let U=u[k]??null;if(U!==null){let{fitCount:ie,fittedWidth:P}=um(U,v,r,p,c);if(ie===U.length)return v=P,_=k+1,R=0,S(),null;if(ie>0)return A(k,ie,P+c)}return M<=b?A(T,0,D):null}for(let k=t.segmentIndex;k0){let j=W(k,P);if(j!==null)return j}else if(H>r&&u[k]!==null){let j=W(k,0);if(j!==null)return j}else C(k,H);q(U,ie,k,H);continue}if(v+H>b){let j=v+(U==="tab"?0:a[k]),we=v+(U==="tab"?H:l[k]);if(E==="soft-hyphen"&&m.preferEarlySoftHyphenBreak&&M<=b)return A(T,0,D);let z=Y(k);if(z!==null)return z;if(ie&&j<=b)return I(k,H),A(k+1,0,we);if(T>=0&&M<=b)return _>T||_===T&&R>0?A():A(T,0,D);if(H>r&&u[k]!==null){let O=A();if(O!==null)return O;let B=W(k,0);if(B!==null)return B}return A()}I(k,H),q(U,ie,k,H)}return T===i.consumedEndSegmentIndex&&R===0?A(i.consumedEndSegmentIndex,0,D):A(i.consumedEndSegmentIndex,0,v)}function b1(e,t,n){let{widths:r,kinds:i,breakableFitAdvances:o}=e,l=At().lineFitEpsilon,s=n+l,u=0,c=!1,f=t.segmentIndex,m=t.graphemeIndex,p=-1,b=0;for(let v=t.segmentIndex;v0||x>n&&M!==null){let D=M,E=D[T];c=!0,u=E,f=v,m=T+1;for(let S=T+1;Ss)return t.segmentIndex=f,t.graphemeIndex=m,u;u+=A,f=v,m=S+1}f===v&&m===D.length&&(f=v+1,m=0)}else c=!0,u=x,f=v+1,m=0;R&&(p=v+1,b=u-x);continue}if(u+x>s)return R?(t.segmentIndex=v+1,t.graphemeIndex=0,u):p>=0?f>p||f===p&&m>0?(t.segmentIndex=f,t.graphemeIndex=m,u):(t.segmentIndex=p,t.graphemeIndex=0,b):(t.segmentIndex=f,t.graphemeIndex=m,u);u+=x,f=v+1,m=0,R&&(p=v+1,b=u-x)}return c?(t.segmentIndex=f,t.graphemeIndex=m,u):null}function x1(e,t,n){let r=dm(e,t);return r<0?null:e.simpleLineWalkFastPath?b1(e,t,n):pm(e,t,r,n)}function hm(e,t){if(e.widths.length===0)return{lineCount:0,maxLineWidth:0};let n={segmentIndex:0,graphemeIndex:0},r=0,i=0;if(!e.simpleLineWalkFastPath){let o=dm(e,n);for(;o>=0;){let a=pm(e,n,o,t);if(a===null)return{lineCount:r,maxLineWidth:i};r++,a>i&&(i=a),o=g1(e,o,n)}return{lineCount:r,maxLineWidth:i}}for(;;){let o=x1(e,n,t);if(o===null)return{lineCount:r,maxLineWidth:i};r++,o>i&&(i=o)}}var hs=null;function y1(){return hs===null&&(hs=new Intl.Segmenter(void 0,{granularity:"grapheme"})),hs}function v1(e){return e?{widths:[],lineEndFitAdvances:[],lineEndPaintAdvances:[],kinds:[],simpleLineWalkFastPath:!0,segLevels:null,breakableFitAdvances:[],discretionaryHyphenWidth:0,tabStopAdvance:0,chunks:[],segments:[]}:{widths:[],lineEndFitAdvances:[],lineEndPaintAdvances:[],kinds:[],simpleLineWalkFastPath:!0,segLevels:null,breakableFitAdvances:[],discretionaryHyphenWidth:0,tabStopAdvance:0,chunks:[]}}function S1(e,t){let n=[],r=[],i=0,o=!1,a=!1,l=!1;function s(){r.length!==0&&(n.push({text:r.length===1?r[0]:r.join(""),start:i}),r=[],o=!1,a=!1,l=!1)}function u(f,m,p){r=[f],i=m,o=p,a=Di(f),l=hr.has(f)}function c(f,m){r.push(f),o=o||m;let p=Di(f);f.length===1&&vt.has(f)?a=a||p:a=p,l=!1}for(let f of y1().segment(e)){let m=f.segment,p=Ve(m);if(r.length===0){u(m,f.index,p);continue}if(l||Ni.has(m)||vt.has(m)||t.carryCJKAfterClosingQuote&&p&&a){c(m,p);continue}if(!o&&!p){c(m,p);continue}s(),u(m,f.index,p)}return s(),n}function A1(e){if(e.length<=1)return e;let t=[],n=[e[0].text],r=e[0].start,i=Ve(e[0].text),o=Fi(e[0].text);function a(){t.push({text:n.length===1?n[0]:n.join(""),start:r})}for(let l=1;l1){let U="sum-graphemes";pr(S)?U="pair-context":i.preferPrefixWidthsForBreakableRuns&&(U="segment-prefixes");let ie=am(S,q,o,a,U);T(S,W,Y,k,A,C,ie);return}T(S,W,Y,k,A,C,null)}for(let S=0;S{n(C1(r))})}function xm(e,t){return hm(e,t)}function ym(e){let t=0;return _1(e,Number.POSITIVE_INFINITY,n=>{n.width>t&&(t=n.width)}),t}var T1={maxWidth:1600,baseFontSize:78,minFontSize:42,fontWeight:900,fontFamily:"Outfit",step:2};function vm(e,t){let n={...T1,...t},r=1.2;for(let i=n.baseFontSize;i>=n.minFontSize;i-=n.step){let o=`${n.fontWeight} ${i}px ${n.fontFamily}`,a=Ii(e,o),{lineCount:l}=Pi(a,n.maxWidth,i*r);if(l<=1)return{fontSize:i,fits:!0}}return{fontSize:n.minFontSize,fits:!1}}var Sm={prepare:Ii,layout:Pi,prepareWithSegments:bm,measureLineStats:xm,measureNaturalWidth:ym};window.__timelines=window.__timelines||{};Od();window.__hyperframes={fitTextFontSize:vm,getVariables:qs,pretext:Sm,registerRuntimeDataHandler:Bf,setRuntimeData:Ri,clearRuntimeData:ki};function Am(){let e=window;e.__hyperframeRuntimeBootstrapped||(e.__hyperframeRuntimeBootstrapped=!0,Wf())}document.readyState==="loading"?document.addEventListener("DOMContentLoaded",Am,{once:!0}):Am();})();\n'; + RUNTIME_IIFE = '"use strict";(()=>{var qm=Object.create;var Xi=Object.defineProperty;var $m=Object.getOwnPropertyDescriptor;var jm=Object.getOwnPropertyNames;var Km=Object.getPrototypeOf,Ym=Object.prototype.hasOwnProperty;var Xm=(e,t,n)=>t in e?Xi(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var ae=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var Jm=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of jm(t))!Ym.call(e,i)&&i!==n&&Xi(e,i,{get:()=>t[i],enumerable:!(r=$m(t,i))||r.enumerable});return e};var Qm=(e,t,n)=>(n=e!=null?qm(Km(e)):{},Jm(t||!e||!e.__esModule?Xi(n,"default",{value:e,enumerable:!0}):n,e));var ge=(e,t,n)=>Xm(e,typeof t!="symbol"?t+"":t,n);var Lu=ae((aA,Ko)=>{var Z=String,Nu=function(){return{isColorSupported:!1,reset:Z,bold:Z,dim:Z,italic:Z,underline:Z,inverse:Z,hidden:Z,strikethrough:Z,black:Z,red:Z,green:Z,yellow:Z,blue:Z,magenta:Z,cyan:Z,white:Z,gray:Z,bgBlack:Z,bgRed:Z,bgGreen:Z,bgYellow:Z,bgBlue:Z,bgMagenta:Z,bgCyan:Z,bgWhite:Z,blackBright:Z,redBright:Z,greenBright:Z,yellowBright:Z,blueBright:Z,magentaBright:Z,cyanBright:Z,whiteBright:Z,bgBlackBright:Z,bgRedBright:Z,bgGreenBright:Z,bgYellowBright:Z,bgBlueBright:Z,bgMagentaBright:Z,bgCyanBright:Z,bgWhiteBright:Z}};Ko.exports=Nu();Ko.exports.createColors=Nu});var Yo=ae(()=>{});var Xr=ae((uA,Pu)=>{"use strict";var Du=Lu(),Iu=Yo(),Hn=class e extends Error{constructor(t,n,r,i,o,a){super(t),this.name="CssSyntaxError",this.reason=t,o&&(this.file=o),i&&(this.source=i),a&&(this.plugin=a),typeof n<"u"&&typeof r<"u"&&(typeof n=="number"?(this.line=n,this.column=r):(this.line=n.line,this.column=n.column,this.endLine=r.line,this.endColumn=r.column)),this.setMessage(),Error.captureStackTrace&&Error.captureStackTrace(this,e)}setMessage(){this.message=this.plugin?this.plugin+": ":"",this.message+=this.file?this.file:"",typeof this.line<"u"&&(this.message+=":"+this.line+":"+this.column),this.message+=": "+this.reason}showSourceCode(t){if(!this.source)return"";let n=this.source;t==null&&(t=Du.isColorSupported);let r=c=>c,i=c=>c,o=c=>c;if(t){let{bold:c,gray:f,red:m}=Du.createColors(!0);i=p=>c(m(p)),r=p=>f(p),Iu&&(o=p=>Iu(p))}let a=n.split(/\\r?\\n/),l=Math.max(this.line-3,0),s=Math.min(this.line+2,a.length),u=String(s).length;return a.slice(l,s).map((c,f)=>{let m=l+1+f,p=" "+(" "+m).slice(-u)+" | ";if(m===this.line){if(c.length>160){let v=20,x=Math.max(0,this.column-v),_=Math.max(this.column+v,this.endColumn+v),R=c.slice(x,_),T=r(p.replace(/\\d/g," "))+c.slice(0,Math.min(this.column-1,v-1)).replace(/[^\\t]/g," ");return i(">")+r(p)+o(R)+`\n `+T+i("^")}let b=r(p.replace(/\\d/g," "))+c.slice(0,this.column-1).replace(/[^\\t]/g," ");return i(">")+r(p)+o(c)+`\n `+b+i("^")}return" "+r(p)+o(c)}).join(`\n`)}toString(){let t=this.showSourceCode();return t&&(t=`\n\n`+t+`\n`),this.name+": "+this.message+t}};Pu.exports=Hn;Hn.default=Hn});var Xo=ae((cA,Hu)=>{"use strict";var g0=/(<)(\\/?style\\b)/gi,b0=/(<)(!--)/g;function ht(e){return typeof e!="string"||!e.includes("<")?e:e.replace(g0,"\\\\3c $2").replace(b0,"\\\\3c $2")}var Ou={after:`\n`,beforeClose:`\n`,beforeComment:`\n`,beforeDecl:`\n`,beforeOpen:" ",beforeRule:`\n`,colon:": ",commentLeft:" ",commentRight:" ",emptyBody:"",indent:" ",semicolon:!1};function x0(e){return e[0].toUpperCase()+e.slice(1)}var Gn=class{constructor(t){this.builder=t}atrule(t,n){let r=t.raws,i="@"+t.name,o=t.params?this.rawValue(t,"params"):"";if(typeof r.afterName<"u"?i+=r.afterName:o&&(i+=" "),t.nodes)this.block(t,i+o);else{let a=(r.between||"")+(n?";":"");this.builder(ht(i+o+a),t)}}beforeAfter(t,n){let r;t.type==="decl"?r=this.raw(t,null,"beforeDecl"):t.type==="comment"?r=this.raw(t,null,"beforeComment"):n==="before"?r=this.raw(t,null,"beforeRule"):r=this.raw(t,null,"beforeClose");let i=t.parent,o=0;for(;i&&i.type!=="root";)o+=1,i=i.parent;if(r.includes(`\n`)){let a=this.raw(t,null,"indent");if(a.length)for(let l=0;l0&&n[r].type==="comment";)r-=1;let i=this.raw(t,"semicolon"),o=t.type==="document";for(let a=0;a{if(i=u.raws[n],typeof i<"u")return!1})}return typeof i>"u"&&(i=Ou[r]),l[r]=i,i}rawBeforeClose(t){let n;return t.walk(r=>{if(r.nodes&&r.nodes.length>0&&typeof r.raws.after<"u")return n=r.raws.after,n.includes(`\n`)&&(n=n.replace(/[^\\n]+$/,"")),!1}),n&&(n=n.replace(/\\S/g,"")),n}rawBeforeComment(t,n){let r;return t.walkComments(i=>{if(typeof i.raws.before<"u")return r=i.raws.before,r.includes(`\n`)&&(r=r.replace(/[^\\n]+$/,"")),!1}),typeof r>"u"?r=this.raw(n,null,"beforeDecl"):r&&(r=r.replace(/\\S/g,"")),r}rawBeforeDecl(t,n){let r;return t.walkDecls(i=>{if(typeof i.raws.before<"u")return r=i.raws.before,r.includes(`\n`)&&(r=r.replace(/[^\\n]+$/,"")),!1}),typeof r>"u"?r=this.raw(n,null,"beforeRule"):r&&(r=r.replace(/\\S/g,"")),r}rawBeforeOpen(t){let n;return t.walk(r=>{if(r.type!=="decl"&&(n=r.raws.between,typeof n<"u"))return!1}),n}rawBeforeRule(t){let n;return t.walk(r=>{if(r.nodes&&(r.parent!==t||t.first!==r)&&typeof r.raws.before<"u")return n=r.raws.before,n.includes(`\n`)&&(n=n.replace(/[^\\n]+$/,"")),!1}),n&&(n=n.replace(/\\S/g,"")),n}rawColon(t){let n;return t.walkDecls(r=>{if(typeof r.raws.between<"u")return n=r.raws.between.replace(/[^\\s:]/g,""),!1}),n}rawEmptyBody(t){let n;return t.walk(r=>{if(r.nodes&&r.nodes.length===0&&(n=r.raws.after,typeof n<"u"))return!1}),n}rawIndent(t){if(t.raws.indent)return t.raws.indent;let n;return t.walk(r=>{let i=r.parent;if(i&&i!==t&&i.parent&&i.parent===t&&typeof r.raws.before<"u"){let o=r.raws.before.split(`\n`);return n=o[o.length-1],n=n.replace(/\\S/g,""),!1}}),n}rawSemicolon(t){let n;return t.walk(r=>{if(r.nodes&&r.nodes.length&&r.last.type==="decl"&&(n=r.raws.semicolon,typeof n<"u"))return!1}),n}rawValue(t,n){let r=t[n],i=t.raws[n];return i&&i.value===r?i.raw:r}root(t){if(this.body(t),t.raws.after){let n=t.raws.after,r=t.parent&&t.parent.type==="document";this.builder(r?n:ht(n))}}rule(t){this.block(t,this.rawValue(t,"selector")),t.raws.ownSemicolon&&this.builder(ht(t.raws.ownSemicolon),t,"end")}stringify(t,n){if(!this[t.type])throw new Error("Unknown AST node type "+t.type+". Maybe you need to change PostCSS stringifier.");this[t.type](t,n)}};Hu.exports=Gn;Gn.default=Gn});var Bn=ae((dA,Gu)=>{"use strict";var y0=Xo();function Jo(e,t){new y0(t).stringify(e)}Gu.exports=Jo;Jo.default=Jo});var Jr=ae((fA,Qo)=>{"use strict";Qo.exports.isClean=Symbol("isClean");Qo.exports.my=Symbol("my")});var Vn=ae((mA,Bu)=>{"use strict";var v0=Xr(),S0=Xo(),A0=Bn(),{isClean:Un,my:E0}=Jr();function Zo(e,t){let n=new e.constructor;for(let r in e){if(!Object.prototype.hasOwnProperty.call(e,r)||r==="proxyCache")continue;let i=e[r],o=typeof i;r==="parent"&&o==="object"?t&&(n[r]=t):r==="source"?n[r]=i:Array.isArray(i)?n[r]=i.map(a=>Zo(a,n)):(o==="object"&&i!==null&&(i=Zo(i)),n[r]=i)}return n}function tt(e,t){if(t&&typeof t.offset<"u")return t.offset;let n=1,r=1,i=0;for(let o=0;ot.root().toProxy():t[n]},set(t,n,r){return t[n]===r||(t[n]=r,(n==="prop"||n==="value"||n==="name"||n==="params"||n==="important"||n==="text")&&t.markDirty()),!0}}}markClean(){this[Un]=!0}markDirty(){if(this[Un]){this[Un]=!1;let t=this;for(;t=t.parent;)t[Un]=!1}}next(){if(!this.parent)return;let t=this.parent.index(this);return this.parent.nodes[t+1]}positionBy(t={}){let n=this.source.start;if(t.index)n=this.positionInside(t.index);else if(t.word){let r="document"in this.source.input?this.source.input.document:this.source.input.css,o=r.slice(tt(r,this.source.start),tt(r,this.source.end)).indexOf(t.word);o!==-1&&(n=this.positionInside(o))}return n}positionInside(t){let n=this.source.start.column,r=this.source.start.line,i="document"in this.source.input?this.source.input.document:this.source.input.css,o=tt(i,this.source.start),a=o+t;for(let l=o;ltypeof s=="object"&&s.toJSON?s.toJSON(null,n):s);else if(typeof l=="object"&&l.toJSON)r[a]=l.toJSON(null,n);else if(a==="source"){if(l==null)continue;let s=n.get(l.input);s==null&&(s=o,n.set(l.input,o),o++),r[a]={end:l.end,inputId:s,start:l.start}}else r[a]=l}return i&&(r.inputs=[...n.keys()].map(a=>a.toJSON())),r}toProxy(){return this.proxyCache||(this.proxyCache=new Proxy(this,this.getProxyProcessor())),this.proxyCache}toString(t=A0){t.stringify&&(t=t.stringify);let n="";return t(this,r=>{n+=r}),n}warn(t,n,r={}){let i={node:this};for(let o in r)i[o]=r[o];return t.warn(n,i)}};Bu.exports=Wn;Wn.default=Wn});var qn=ae((pA,Uu)=>{"use strict";var w0=Vn(),zn=class extends w0{constructor(t){super(t),this.type="comment"}};Uu.exports=zn;zn.default=zn});var jn=ae((hA,Wu)=>{"use strict";var C0=Vn(),$n=class extends C0{get variable(){return this.prop.startsWith("--")||this.prop[0]==="$"}constructor(t){t&&typeof t.value<"u"&&typeof t.value!="string"&&(t={...t,value:String(t.value)}),super(t),this.type="decl"}};Wu.exports=$n;$n.default=$n});var gt=ae((gA,Ju)=>{"use strict";var Vu=qn(),zu=jn(),_0=Vn(),{isClean:qu,my:$u}=Jr(),ea,ju,Ku,ta;function Yu(e){return e.map(t=>(t.nodes&&(t.nodes=Yu(t.nodes)),delete t.source,t))}function Xu(e){if(e[qu]=!1,e.proxyOf.nodes)for(let t of e.proxyOf.nodes)Xu(t)}var We=class e extends _0{get first(){if(this.proxyOf.nodes)return this.proxyOf.nodes[0]}get last(){if(this.proxyOf.nodes)return this.proxyOf.nodes[this.proxyOf.nodes.length-1]}append(...t){for(let n of t){let r=this.normalize(n,this.last);for(let i of r)this.proxyOf.nodes.push(i)}return this.markDirty(),this}cleanRaws(t){if(super.cleanRaws(t),this.nodes)for(let n of this.nodes)n.cleanRaws(t)}each(t){if(!this.proxyOf.nodes)return;let n=this.getIterator(),r,i;for(;this.indexes[n]t[n](...r.map(i=>typeof i=="function"?(o,a)=>i(o.toProxy(),a):i)):n==="every"||n==="some"?r=>t[n]((i,...o)=>r(i.toProxy(),...o)):n==="root"?()=>t.root().toProxy():n==="nodes"?t.nodes.map(r=>r.toProxy()):n==="first"||n==="last"?t[n].toProxy():t[n]:t[n]},set(t,n,r){return t[n]===r||(t[n]=r,(n==="name"||n==="params"||n==="selector")&&t.markDirty()),!0}}}index(t){return typeof t=="number"?t:(t.proxyOf&&(t=t.proxyOf),this.proxyOf.nodes.indexOf(t))}insertAfter(t,n){let r=this.index(t),i=this.normalize(n,this.proxyOf.nodes[r]).reverse();r=this.index(t);for(let a of i)this.proxyOf.nodes.splice(r+1,0,a);let o;for(let a in this.indexes)o=this.indexes[a],r"u")t=[];else if(Array.isArray(t)){t=t.slice(0);for(let i of t)i.parent&&i.parent.removeChild(i,"ignore")}else if(t.type==="root"&&this.type!=="document"){t=t.nodes.slice(0);for(let i of t)i.parent&&i.parent.removeChild(i,"ignore")}else if(t.type)t=[t];else if(t.prop){if(typeof t.value>"u")throw new Error("Value field is missed in node creation");typeof t.value!="string"&&(t.value=String(t.value)),t=[new zu(t)]}else if(t.selector||t.selectors)t=[new ta(t)];else if(t.name)t=[new ea(t)];else if(t.text)t=[new Vu(t)];else throw new Error("Unknown node type in node creation");return t.map(i=>(i[$u]||e.rebuild(i),i=i.proxyOf,i.parent&&i.parent.removeChild(i),i[qu]&&Xu(i),i.raws||(i.raws={}),typeof i.raws.before>"u"&&n&&typeof n.raws.before<"u"&&(i.raws.before=n.raws.before.replace(/\\S/g,"")),i.parent=this.proxyOf,i))}prepend(...t){t=t.reverse();for(let n of t){let r=this.normalize(n,this.first,"prepend").reverse();for(let i of r)this.proxyOf.nodes.unshift(i);for(let i in this.indexes)this.indexes[i]=this.indexes[i]+r.length}return this.markDirty(),this}push(t){return t.parent=this,this.proxyOf.nodes.push(t),this}removeAll(){for(let t of this.proxyOf.nodes)t.parent=void 0;return this.proxyOf.nodes=[],this.markDirty(),this}removeChild(t){t=this.index(t),this.proxyOf.nodes[t].parent=void 0,this.proxyOf.nodes.splice(t,1);let n;for(let r in this.indexes)n=this.indexes[r],n>=t&&(this.indexes[r]=n-1);return this.markDirty(),this}replaceValues(t,n,r){return r||(r=n,n={}),this.walkDecls(i=>{n.props&&!n.props.includes(i.prop)||n.fast&&!i.value.includes(n.fast)||(i.value=i.value.replace(t,r))}),this.markDirty(),this}some(t){return this.nodes.some(t)}walk(t){return this.each((n,r)=>{let i;try{i=t(n,r)}catch(o){throw n.addToError(o)}return i!==!1&&n.walk&&(i=n.walk(t)),i})}walkAtRules(t,n){return n?t instanceof RegExp?this.walk((r,i)=>{if(r.type==="atrule"&&t.test(r.name))return n(r,i)}):this.walk((r,i)=>{if(r.type==="atrule"&&r.name===t)return n(r,i)}):(n=t,this.walk((r,i)=>{if(r.type==="atrule")return n(r,i)}))}walkComments(t){return this.walk((n,r)=>{if(n.type==="comment")return t(n,r)})}walkDecls(t,n){return n?t instanceof RegExp?this.walk((r,i)=>{if(r.type==="decl"&&t.test(r.prop))return n(r,i)}):this.walk((r,i)=>{if(r.type==="decl"&&r.prop===t)return n(r,i)}):(n=t,this.walk((r,i)=>{if(r.type==="decl")return n(r,i)}))}walkRules(t,n){return n?t instanceof RegExp?this.walk((r,i)=>{if(r.type==="rule"&&t.test(r.selector))return n(r,i)}):this.walk((r,i)=>{if(r.type==="rule"&&r.selector===t)return n(r,i)}):(n=t,this.walk((r,i)=>{if(r.type==="rule")return n(r,i)}))}};We.registerParse=e=>{ju=e};We.registerRule=e=>{ta=e};We.registerAtRule=e=>{ea=e};We.registerRoot=e=>{Ku=e};Ju.exports=We;We.default=We;We.rebuild=e=>{e.type==="atrule"?Object.setPrototypeOf(e,ea.prototype):e.type==="rule"?Object.setPrototypeOf(e,ta.prototype):e.type==="decl"?Object.setPrototypeOf(e,zu.prototype):e.type==="comment"?Object.setPrototypeOf(e,Vu.prototype):e.type==="root"&&Object.setPrototypeOf(e,Ku.prototype),e[$u]=!0,e.nodes&&e.nodes.forEach(t=>{We.rebuild(t)})}});var Qr=ae((bA,Zu)=>{"use strict";var Qu=gt(),Yt=class extends Qu{constructor(t){super(t),this.type="atrule"}append(...t){return this.proxyOf.nodes||(this.nodes=[]),super.append(...t)}prepend(...t){return this.proxyOf.nodes||(this.nodes=[]),super.prepend(...t)}};Zu.exports=Yt;Yt.default=Yt;Qu.registerAtRule(Yt)});var Zr=ae((xA,nc)=>{"use strict";var T0=gt(),ec,tc,kt=class extends T0{constructor(t){super({type:"document",...t}),this.nodes||(this.nodes=[])}toResult(t={}){return new ec(new tc,this,t).stringify()}};kt.registerLazyResult=e=>{ec=e};kt.registerProcessor=e=>{tc=e};nc.exports=kt;kt.default=kt});var ic=ae((yA,rc)=>{var R0="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict",k0=(e,t=21)=>(n=t)=>{let r="",i=n|0;for(;i--;)r+=e[Math.random()*e.length|0];return r},M0=(e=21)=>{let t="",n=e|0;for(;n--;)t+=R0[Math.random()*64|0];return t};rc.exports={nanoid:M0,customAlphabet:k0}});var ei=ae(()=>{});var ti=ae(()=>{});var na=ae(()=>{});var oc=ae(()=>{});var ia=ae((RA,lc)=>{"use strict";var{existsSync:F0,readFileSync:N0}=oc(),{dirname:ra,join:L0}=ei(),{SourceMapConsumer:ac,SourceMapGenerator:sc}=ti();function D0(e){return Buffer?Buffer.from(e,"base64").toString():window.atob(e)}var Kn=class{constructor(t,n){if(n.map===!1)return;n.unsafeMap&&(this.unsafeMap=!0),this.loadAnnotation(t),this.inline=this.startWith(this.annotation,"data:");let r=n.map?n.map.prev:void 0,i=this.loadMap(n.from,r);!this.mapFile&&n.from&&(this.mapFile=n.from),this.mapFile&&(this.root=ra(this.mapFile)),i&&(this.text=i)}consumer(){return this.consumerCache||(this.consumerCache=new ac(this.json||this.text)),this.consumerCache}decodeInline(t){let n=/^data:application\\/json;charset=utf-?8;base64,/,r=/^data:application\\/json;base64,/,i=/^data:application\\/json;charset=utf-?8,/,o=/^data:application\\/json,/,a=t.match(i)||t.match(o);if(a)return decodeURIComponent(t.substr(a[0].length));let l=t.match(n)||t.match(r);if(l)return D0(t.substr(l[0].length));let s=t.slice(22);throw s=s.slice(0,s.indexOf(",")),new Error("Unsupported source map encoding "+s)}getAnnotationURL(t){return t.replace(/^\\/\\*\\s*# sourceMappingURL=/,"").trim()}isMap(t){return typeof t!="object"?!1:typeof t.mappings=="string"||typeof t._mappings=="string"||Array.isArray(t.sections)}loadAnnotation(t){let n=t.match(/\\/\\*\\s*# sourceMappingURL=/g);if(!n)return;let r=t.lastIndexOf(n.pop()),i=t.indexOf("*/",r);r>-1&&i>-1&&(this.annotation=this.getAnnotationURL(t.substring(r,i)))}loadFile(t,n,r){if(!(!r&&!this.unsafeMap&&!/\\.map$/i.test(t))&&(this.root=ra(t),F0(t)))return this.mapFile=t,N0(t,"utf-8").toString().trim()}loadMap(t,n){if(n===!1)return!1;if(n){if(typeof n=="string")return n;if(typeof n=="function"){let r=n(t);if(r){let i=this.loadFile(r,t,!0);if(!i)throw new Error("Unable to load previous source map: "+r.toString());return i}}else{if(n instanceof ac)return sc.fromSourceMap(n).toString();if(n instanceof sc)return n.toString();if(this.isMap(n))return JSON.stringify(n);throw new Error("Unsupported previous source map format: "+n.toString())}}else{if(this.inline)return this.decodeInline(this.annotation);if(this.annotation){let r=this.annotation;t&&(r=L0(ra(t),r));let i=this.loadFile(r,t,!1);if(i)try{this.json=JSON.parse(i.replace(/^\\)]}\'[^\\n]*\\n/,""))}catch{return}return i}}}startWith(t,n){return t?t.substr(0,n.length)===n:!1}withContent(){return!!(this.consumer().sourcesContent&&this.consumer().sourcesContent.length>0)}};lc.exports=Kn;Kn.default=Kn});var Yn=ae((kA,mc)=>{"use strict";var{nanoid:I0}=ic(),{isAbsolute:sa,resolve:la}=ei(),{SourceMapConsumer:P0,SourceMapGenerator:O0}=ti(),{fileURLToPath:uc,pathToFileURL:ni}=na(),cc=Xr(),H0=ia(),oa=Yo(),aa=Symbol("lineToIndexCache"),G0=!!(P0&&O0),dc=!!(la&&sa);function fc(e){if(e[aa])return e[aa];let t=e.css.split(`\n`),n=new Array(t.length),r=0;for(let i=0,o=t.length;i"u"||typeof t=="object"&&!t.toString)throw new Error(`PostCSS received ${t} instead of CSS string`);if(this.css=t.toString(),this.css[0]==="\\uFEFF"||this.css[0]==="\\uFFFE"?(this.hasBOM=!0,this.css=this.css.slice(1)):this.hasBOM=!1,this.document=this.css,n.document&&(this.document=n.document.toString()),n.from&&(!dc||/^\\w+:\\/\\//.test(n.from)||sa(n.from)?this.file=n.from:this.file=la(n.from)),dc&&G0){let r=new H0(this.css,n);if(r.text){this.map=r;let i=r.consumer().file;!this.file&&i&&(this.file=this.mapResolve(i))}}this.file||(this.id=""),this.map&&(this.map.file=this.from)}error(t,n,r,i={}){let o,a,l,s,u;if(n&&typeof n=="object"){let f=n,m=r;if(typeof f.offset=="number"){s=f.offset;let p=this.fromOffset(s);n=p.line,r=p.col}else n=f.line,r=f.column,s=this.fromLineAndColumn(n,r);if(typeof m.offset=="number"){l=m.offset;let p=this.fromOffset(l);a=p.line,o=p.col}else a=m.line,o=m.column,l=this.fromLineAndColumn(m.line,m.column)}else if(r)s=this.fromLineAndColumn(n,r);else{s=n;let f=this.fromOffset(s);n=f.line,r=f.col}let c=this.origin(n,r,a,o);return c?u=new cc(t,c.endLine===void 0?c.line:{column:c.column,line:c.line},c.endLine===void 0?c.column:{column:c.endColumn,line:c.endLine},c.source,c.file,i.plugin):u=new cc(t,a===void 0?n:{column:r,line:n},a===void 0?r:{column:o,line:a},this.css,this.file,i.plugin),u.input={column:r,endColumn:o,endLine:a,endOffset:l,line:n,offset:s,source:this.css},this.file&&(ni&&(u.input.url=ni(this.file).toString()),u.input.file=this.file),u}fromLineAndColumn(t,n){return fc(this)[t-1]+n-1}fromOffset(t){let n=fc(this),r=n[n.length-1],i=0;if(t>=r)i=n.length-1;else{let o=n.length-2,a;for(;i>1),t=n[a+1])i=a+1;else{i=a;break}}return{col:t-n[i]+1,line:i+1}}mapResolve(t){return/^\\w+:\\/\\//.test(t)?t:la(this.map.consumer().sourceRoot||this.map.root||".",t)}origin(t,n,r,i){if(!this.map)return!1;let o=this.map.consumer(),a=o.originalPositionFor({column:n,line:t});if(!a.source)return!1;let l;typeof r=="number"&&(l=o.originalPositionFor({column:i,line:r}));let s;sa(a.source)?s=ni(a.source):s=new URL(a.source,this.map.consumer().sourceRoot||ni(this.map.mapFile));let u={column:a.column,endColumn:l&&l.column,endLine:l&&l.line,line:a.line,url:s.toString()};if(s.protocol==="file:")if(uc)u.file=uc(s);else throw new Error("file: protocol is not available in this PostCSS build");let c=o.sourceContentFor(a.source);return c&&(u.source=c),u}toJSON(){let t={};for(let n of["hasBOM","css","file","id"])this[n]!=null&&(t[n]=this[n]);return this.map&&(t.map={...this.map},t.map.consumerCache&&(t.map.consumerCache=void 0)),t}};mc.exports=Xt;Xt.default=Xt;oa&&oa.registerInput&&oa.registerInput(Xt)});var Jt=ae((MA,bc)=>{"use strict";var pc=gt(),hc,gc,bt=class extends pc{constructor(t){super(t),this.type="root",this.nodes||(this.nodes=[])}normalize(t,n,r){let i=super.normalize(t);if(n){if(r==="prepend")this.nodes.length>1?n.raws.before=this.nodes[1].raws.before:delete n.raws.before;else if(this.first!==n)for(let o of i)o.raws.before=n.raws.before}return i}removeChild(t,n){let r=this.index(t);return!n&&r===0&&this.nodes.length>1&&(this.nodes[1].raws.before=this.nodes[r].raws.before),super.removeChild(t)}toResult(t={}){return new hc(new gc,this,t).stringify()}};bt.registerLazyResult=e=>{hc=e};bt.registerProcessor=e=>{gc=e};bc.exports=bt;bt.default=bt;pc.registerRoot(bt)});var ua=ae((FA,xc)=>{"use strict";var Xn={comma(e){return Xn.split(e,[","],!0)},space(e){let t=[" ",`\n`," "];return Xn.split(e,t)},split(e,t,n){let r=[],i="",o=!1,a=0,l=!1,s="",u=!1;for(let c of e)u?u=!1:c==="\\\\"?u=!0:l?c===s&&(l=!1):c===\'"\'||c==="\'"?(l=!0,s=c):c==="("?a+=1:c===")"?a>0&&(a-=1):a===0&&t.includes(c)&&(o=!0),o?(i!==""&&r.push(i.trim()),i="",o=!1):i+=c;return(n||i!=="")&&r.push(i.trim()),r}};xc.exports=Xn;Xn.default=Xn});var ri=ae((NA,vc)=>{"use strict";var yc=gt(),B0=ua(),Qt=class extends yc{get selectors(){return B0.comma(this.selector)}set selectors(t){let n=this.selector?this.selector.match(/,\\s*/):null,r=n?n[0]:","+this.raw("between","beforeOpen");this.selector=t.join(r)}constructor(t){super(t),this.type="rule",this.nodes||(this.nodes=[])}};vc.exports=Qt;Qt.default=Qt;yc.registerRule(Qt)});var Ac=ae((LA,Sc)=>{"use strict";var U0=Qr(),W0=qn(),V0=jn(),z0=Yn(),q0=ia(),$0=Jt(),j0=ri();function Jn(e,t){if(Array.isArray(e))return e.map(i=>Jn(i));let{inputs:n,...r}=e;if(n){t=[];for(let i of n){let o={...i,__proto__:z0.prototype};o.map&&(o.map={...o.map,__proto__:q0.prototype}),t.push(o)}}if(r.nodes&&(r.nodes=e.nodes.map(i=>Jn(i,t))),r.source){let{inputId:i,...o}=r.source;r.source=o,i!=null&&(r.source.input=t[i])}if(r.type==="root")return new $0(r);if(r.type==="decl")return new V0(r);if(r.type==="rule")return new j0(r);if(r.type==="comment")return new W0(r);if(r.type==="atrule")return new U0(r);throw new Error("Unknown node type: "+e.type)}Sc.exports=Jn;Jn.default=Jn});var da=ae((DA,Rc)=>{"use strict";var{dirname:ii,relative:wc,resolve:Cc,sep:_c}=ei(),{SourceMapConsumer:Tc,SourceMapGenerator:oi}=ti(),{pathToFileURL:Ec}=na(),K0=Yn(),Y0=!!(Tc&&oi),X0=!!(ii&&Cc&&wc&&_c),ca=class{constructor(t,n,r,i){this.stringify=t,this.mapOpts=r.map||{},this.root=n,this.opts=r,this.css=i,this.originalCSS=i,this.usesFileUrls=!this.mapOpts.from&&this.mapOpts.absolute,this.memoizedFileURLs=new Map,this.memoizedPaths=new Map,this.memoizedURLs=new Map}addAnnotation(){let t;this.isInline()?t="data:application/json;base64,"+this.toBase64(this.map.toString()):typeof this.mapOpts.annotation=="string"?t=this.mapOpts.annotation:typeof this.mapOpts.annotation=="function"?t=this.mapOpts.annotation(this.opts.to,this.root):t=this.outputFile()+".map";let n=`\n`;this.css.includes(`\\r\n`)&&(n=`\\r\n`),this.css+=n+"/*# sourceMappingURL="+t+" */"}applyPrevMaps(){for(let t of this.previous()){let n=this.toUrl(this.path(t.file)),r=t.root||ii(t.file),i;this.mapOpts.sourcesContent===!1?(i=new Tc(t.text),i.sourcesContent&&(i.sourcesContent=null)):i=t.consumer(),this.map.applySourceMap(i,n,this.toUrl(this.path(r)))}}clearAnnotation(){if(this.mapOpts.annotation!==!1){if(this.root){let t;for(let n=this.root.nodes.length-1;n>=0;n--)t=this.root.nodes[n],t.type==="comment"&&t.text.startsWith("# sourceMappingURL=")&&this.root.removeChild(n)}else if(this.css){let t;for(;(t=this.css.lastIndexOf("/*#"))!==-1;){let n=this.css.indexOf("*/",t+3);if(n===-1)break;for(;t>0&&this.css[t-1]===`\n`;)t--;this.css=this.css.slice(0,t)+this.css.slice(n+2)}}}}generate(){if(this.clearAnnotation(),X0&&Y0&&this.isMap())return this.generateMap();{let t="";return this.stringify(this.root,n=>{t+=n}),[t]}}generateMap(){if(this.root)this.generateString();else if(this.previous().length===1){let t=this.previous()[0].consumer();t.file=this.outputFile(),this.map=oi.fromSourceMap(t,{ignoreInvalidMapping:!0})}else this.map=new oi({file:this.outputFile(),ignoreInvalidMapping:!0}),this.map.addMapping({generated:{column:0,line:1},original:{column:0,line:1},source:this.opts.from?this.toUrl(this.path(this.opts.from)):""});return this.isSourcesContent()&&this.setSourcesContent(),this.root&&this.previous().length>0&&this.applyPrevMaps(),this.isAnnotation()&&this.addAnnotation(),this.isInline()?[this.css]:[this.css,this.map]}generateString(){this.css="",this.map=new oi({file:this.outputFile(),ignoreInvalidMapping:!0});let t=1,n=1,r="",i={generated:{column:0,line:0},original:{column:0,line:0},source:""},o,a;this.stringify(this.root,(l,s,u)=>{if(this.css+=l,s&&u!=="end"&&(i.generated.line=t,i.generated.column=n-1,s.source&&s.source.start?(i.source=this.sourcePath(s),i.original.line=s.source.start.line,i.original.column=s.source.start.column-1,this.map.addMapping(i)):(i.source=r,i.original.line=1,i.original.column=0,this.map.addMapping(i))),a=l.match(/\\n/g),a?(t+=a.length,o=l.lastIndexOf(`\n`),n=l.length-o):n+=l.length,s&&u!=="start"){let c=s.parent||{raws:{}};(!(s.type==="decl"||s.type==="atrule"&&!s.nodes)||s!==c.last||c.raws.semicolon)&&(s.source&&s.source.end?(i.source=this.sourcePath(s),i.original.line=s.source.end.line,i.original.column=s.source.end.column-1,i.generated.line=t,i.generated.column=n-2,this.map.addMapping(i)):(i.source=r,i.original.line=1,i.original.column=0,i.generated.line=t,i.generated.column=n-1,this.map.addMapping(i)))}})}isAnnotation(){return this.isInline()?!0:typeof this.mapOpts.annotation<"u"?this.mapOpts.annotation:this.previous().length?this.previous().some(t=>t.annotation):!0}isInline(){if(typeof this.mapOpts.inline<"u")return this.mapOpts.inline;let t=this.mapOpts.annotation;return typeof t<"u"&&t!==!0?!1:this.previous().length?this.previous().some(n=>n.inline):!0}isMap(){return typeof this.opts.map<"u"?!!this.opts.map:this.previous().length>0}isSourcesContent(){return typeof this.mapOpts.sourcesContent<"u"?this.mapOpts.sourcesContent:this.previous().length?this.previous().some(t=>t.withContent()):!0}outputFile(){return this.opts.to?this.path(this.opts.to):this.opts.from?this.path(this.opts.from):"to.css"}path(t){if(this.mapOpts.absolute||t.charCodeAt(0)===60||/^\\w+:\\/\\//.test(t))return t;let n=this.memoizedPaths.get(t);if(n)return n;let r=this.opts.to?ii(this.opts.to):".";typeof this.mapOpts.annotation=="string"&&(r=ii(Cc(r,this.mapOpts.annotation)));let i=wc(r,t);return this.memoizedPaths.set(t,i),i}previous(){if(!this.previousMaps)if(this.previousMaps=[],this.root)this.root.walk(t=>{if(t.source&&t.source.input.map){let n=t.source.input.map;this.previousMaps.includes(n)||this.previousMaps.push(n)}});else{let t=new K0(this.originalCSS,this.opts);t.map&&this.previousMaps.push(t.map)}return this.previousMaps}setSourcesContent(){let t={};if(this.root)this.root.walk(n=>{if(n.source){let r=n.source.input.from;if(r&&!t[r]){t[r]=!0;let i=this.usesFileUrls?this.toFileUrl(r):this.toUrl(this.path(r));this.map.setSourceContent(i,n.source.input.css)}}});else if(this.css){let n=this.opts.from?this.toUrl(this.path(this.opts.from)):"";this.map.setSourceContent(n,this.css)}}sourcePath(t){return this.mapOpts.from?this.toUrl(this.mapOpts.from):this.usesFileUrls?this.toFileUrl(t.source.input.from):this.toUrl(this.path(t.source.input.from))}toBase64(t){return Buffer?Buffer.from(t).toString("base64"):window.btoa(unescape(encodeURIComponent(t)))}toFileUrl(t){let n=this.memoizedFileURLs.get(t);if(n)return n;if(Ec){let r=Ec(t).toString();return this.memoizedFileURLs.set(t,r),r}else throw new Error("`map.absolute` option is not available in this PostCSS build")}toUrl(t){let n=this.memoizedURLs.get(t);if(n)return n;_c==="\\\\"&&(t=t.replace(/\\\\/g,"/"));let r=encodeURI(t).replace(/[#?]/g,encodeURIComponent);return this.memoizedURLs.set(t,r),r}};Rc.exports=ca});var Fc=ae((IA,Mc)=>{"use strict";var ai=/[\\t\\n\\f\\r "#\'()/;[\\\\\\]{}]/g,si=/[\\t\\n\\f\\r !"#\'():;@[\\\\\\]{}]|\\/(?=\\*)/g,J0=/.[\\r\\n"\'(/\\\\]/,kc=/[\\da-f]/i;Mc.exports=function(t,n={}){let r=t.css.valueOf(),i=n.ignoreErrors,o,a,l,s,u,c,f,m,p,b,v=r.length,x=0,_=[],R=[],T=-1;function M(){return x}function D(C){throw t.error("Unclosed "+C,x)}function E(){return R.length===0&&x>=v}function S(C){if(R.length)return R.pop();if(x>=v)return;let F=C?C.ignoreUnclosed:!1;switch(o=r.charCodeAt(x),o){case 10:case 32:case 9:case 13:case 12:{s=x;do s+=1,o=r.charCodeAt(s);while(o===32||o===10||o===9||o===13||o===12);c=["space",r.slice(x,s)],x=s-1;break}case 91:case 93:case 123:case 125:case 58:case 59:case 41:{let I=String.fromCharCode(o);c=[I,I,x];break}case 40:{if(b=_.length?_.pop()[1]:"",p=r.charCodeAt(x+1),b==="url"&&p!==39&&p!==34&&p!==32&&p!==10&&p!==9&&p!==12&&p!==13){s=x;do{if(f=!1,s=r.indexOf(")",s+1),s===-1)if(i||F){s=x;break}else D("bracket");for(m=s;r.charCodeAt(m-1)===92;)m-=1,f=!f}while(f);c=["brackets",r.slice(x,s+1),x,s],x=s}else x<=T?c=["(","(",x]:(s=r.indexOf(")",x+1),a=r.slice(x,s+1),s===-1||J0.test(a)?(T=s===-1?v:s,c=["(","(",x]):(c=["brackets",a,x,s],x=s));break}case 39:case 34:{u=o===39?"\'":\'"\',s=x;do{if(f=!1,s=r.indexOf(u,s+1),s===-1)if(i||F){s=x+1;break}else D("string");for(m=s;r.charCodeAt(m-1)===92;)m-=1,f=!f}while(f);c=["string",r.slice(x,s+1),x,s],x=s;break}case 64:{ai.lastIndex=x+1,ai.test(r),ai.lastIndex===0?s=r.length-1:s=ai.lastIndex-2,c=["at-word",r.slice(x,s+1),x,s],x=s;break}case 92:{for(s=x,l=!0;r.charCodeAt(s+1)===92;)s+=1,l=!l;if(o=r.charCodeAt(s+1),l&&o!==47&&o!==32&&o!==10&&o!==9&&o!==13&&o!==12&&(s+=1,kc.test(r.charAt(s)))){for(;kc.test(r.charAt(s+1));)s+=1;r.charCodeAt(s+1)===32&&(s+=1)}c=["word",r.slice(x,s+1),x,s],x=s;break}default:{o===47&&r.charCodeAt(x+1)===42?(s=r.indexOf("*/",x+2)+1,s===0&&(i||F?s=r.length:D("comment")),c=["comment",r.slice(x,s+1),x,s],x=s):(si.lastIndex=x+1,si.test(r),si.lastIndex===0?s=r.length-1:s=si.lastIndex-2,c=["word",r.slice(x,s+1),x,s],_.push(c),x=s);break}}return x++,c}function A(C){R.push(C)}return{back:A,endOfFile:E,nextToken:S,position:M}}});var Ic=ae((PA,Dc)=>{"use strict";var Q0=Qr(),Z0=qn(),eg=jn(),tg=Jt(),Nc=ri(),ng=Fc(),Lc={empty:!0,space:!0};function rg(e){for(let t=e.length-1;t>=0;t--){let n=e[t],r=n[3]||n[2];if(r)return r}}var fa=class{constructor(t){this.input=t,this.root=new tg,this.current=this.root,this.spaces="",this.semicolon=!1,this.createTokenizer(),this.root.source={input:t,start:{column:1,line:1,offset:0}}}atrule(t){let n=new Q0;n.name=t[1].slice(1),n.name===""&&this.unnamedAtrule(n,t),this.init(n,t[2]);let r,i,o,a=!1,l=!1,s=[],u=[];for(;!this.tokenizer.endOfFile();){if(t=this.tokenizer.nextToken(),r=t[0],r==="("||r==="["?u.push(r==="("?")":"]"):r==="{"&&u.length>0?u.push("}"):r===u[u.length-1]&&u.pop(),u.length===0)if(r===";"){n.source.end=this.getPosition(t[2]),n.source.end.offset++,this.semicolon=!0;break}else if(r==="{"){l=!0;break}else if(r==="}"){if(s.length>0){for(o=s.length-1,i=s[o];i&&i[0]==="space";)i=s[--o];i&&(n.source.end=this.getPosition(i[3]||i[2]),n.source.end.offset++)}this.end(t);break}else s.push(t);else s.push(t);if(this.tokenizer.endOfFile()){a=!0;break}}n.raws.between=this.spacesAndCommentsFromEnd(s),s.length?(n.raws.afterName=this.spacesAndCommentsFromStart(s),this.raw(n,"params",s),a&&(t=s[s.length-1],n.source.end=this.getPosition(t[3]||t[2]),n.source.end.offset++,this.spaces=n.raws.between,n.raws.between="")):(n.raws.afterName="",n.params=""),l&&(n.nodes=[],this.current=n)}checkMissedSemicolon(t){let n=this.colon(t);if(n===!1)return;let r=0,i;for(let o=n-1;o>=0&&(i=t[o],!(i[0]!=="space"&&(r+=1,r===2)));o--);throw this.input.error("Missed semicolon",i[0]==="word"?i[3]+1:i[2])}colon(t){let n=0,r,i,o;for(let[a,l]of t.entries()){if(i=l,o=i[0],o==="("&&(n+=1),o===")"&&(n-=1),n===0&&o===":")if(!r)this.doubleColon(i);else{if(r[0]==="word"&&r[1]==="progid")continue;return a}r=i}return!1}comment(t){let n=new Z0;this.init(n,t[2]),n.source.end=this.getPosition(t[3]||t[2]),n.source.end.offset++;let r=t[1].slice(2,-2);if(!r.trim())n.text="",n.raws.left=r,n.raws.right="";else{let i=r.match(/^(\\s*)([^]*\\S)(\\s*)$/);n.text=i[2],n.raws.left=i[1],n.raws.right=i[3]}}createTokenizer(){this.tokenizer=ng(this.input)}decl(t,n){let r=new eg;this.init(r,t[0][2]);let i=t[t.length-1];for(i[0]===";"&&(this.semicolon=!0,t.pop()),r.source.end=this.getPosition(i[3]||i[2]||rg(t)),r.source.end.offset++;t[0][0]!=="word";)t.length===1&&this.unknownWord(t),r.raws.before+=t.shift()[1];for(r.source.start=this.getPosition(t[0][2]),r.prop="";t.length;){let u=t[0][0];if(u===":"||u==="space"||u==="comment")break;r.prop+=t.shift()[1]}r.raws.between="";let o;for(;t.length;)if(o=t.shift(),o[0]===":"){r.raws.between+=o[1];break}else o[0]==="word"&&/\\w/.test(o[1])&&this.unknownWord([o]),r.raws.between+=o[1];(r.prop[0]==="_"||r.prop[0]==="*")&&(r.raws.before+=r.prop[0],r.prop=r.prop.slice(1));let a=[],l;for(;t.length&&(l=t[0][0],!(l!=="space"&&l!=="comment"));)a.push(t.shift());this.precheckMissedSemicolon(t);for(let u=t.length-1;u>=0;u--){if(o=t[u],o[1].toLowerCase()==="!important"){r.important=!0;let c=this.stringFrom(t,u);c=this.spacesFromEnd(t)+c,c!==" !important"&&(r.raws.important=c);break}else if(o[1].toLowerCase()==="important"){let c=t.slice(0),f="";for(let m=u;m>0;m--){let p=c[m][0];if(f.trim().startsWith("!")&&p!=="space")break;f=c.pop()[1]+f}f.trim().startsWith("!")&&(r.important=!0,r.raws.important=f,t=c)}if(o[0]!=="space"&&o[0]!=="comment")break}t.some(u=>u[0]!=="space"&&u[0]!=="comment")&&(r.raws.between+=a.map(u=>u[1]).join(""),a=[]),this.raw(r,"value",a.concat(t),n),r.value.includes(":")&&!n&&this.checkMissedSemicolon(t)}doubleColon(t){throw this.input.error("Double colon",{offset:t[2]},{offset:t[2]+t[1].length})}emptyRule(t){let n=new Nc;this.init(n,t[2]),n.selector="",n.raws.between="",this.current=n}end(t){this.current.nodes&&this.current.nodes.length&&(this.current.raws.semicolon=this.semicolon),this.semicolon=!1,this.current.raws.after=(this.current.raws.after||"")+this.spaces,this.spaces="",this.current.parent?(this.current.source.end=this.getPosition(t[2]),this.current.source.end.offset++,this.current=this.current.parent):this.unexpectedClose(t)}endFile(){this.current.parent&&this.unclosedBlock(),this.current.nodes&&this.current.nodes.length&&(this.current.raws.semicolon=this.semicolon),this.current.raws.after=(this.current.raws.after||"")+this.spaces,this.root.source.end=this.getPosition(this.tokenizer.position())}freeSemicolon(t){if(this.spaces+=t[1],this.current.nodes){let n=this.current.nodes[this.current.nodes.length-1];n&&n.type==="rule"&&!n.raws.ownSemicolon&&(n.raws.ownSemicolon=this.spaces,this.spaces="",n.source.end=this.getPosition(t[2]),n.source.end.offset+=n.raws.ownSemicolon.length)}}getPosition(t){let n=this.input.fromOffset(t);return{column:n.col,line:n.line,offset:t}}init(t,n){this.current.push(t),t.source={input:this.input,start:this.getPosition(n)},t.raws.before=this.spaces,this.spaces="",t.type!=="comment"&&(this.semicolon=!1)}other(t){let n=!1,r=null,i=!1,o=null,a=[],l=t[1].startsWith("--"),s=[],u=t;for(;u;){if(r=u[0],s.push(u),r==="("||r==="[")o||(o=u),a.push(r==="("?")":"]");else if(l&&i&&r==="{")o||(o=u),a.push("}");else if(a.length===0)if(r===";")if(i){this.decl(s,l);return}else break;else if(r==="{"){this.rule(s);return}else if(r==="}"){this.tokenizer.back(s.pop()),n=!0;break}else r===":"&&(i=!0);else r===a[a.length-1]&&(a.pop(),a.length===0&&(o=null));u=this.tokenizer.nextToken()}if(this.tokenizer.endOfFile()&&(n=!0),a.length>0&&this.unclosedBracket(o),n&&i){if(!l)for(;s.length&&(u=s[s.length-1][0],!(u!=="space"&&u!=="comment"));)this.tokenizer.back(s.pop());this.decl(s,l)}else this.unknownWord(s)}parse(){let t;for(;!this.tokenizer.endOfFile();)switch(t=this.tokenizer.nextToken(),t[0]){case"space":this.spaces+=t[1];break;case";":this.freeSemicolon(t);break;case"}":this.end(t);break;case"comment":this.comment(t);break;case"at-word":this.atrule(t);break;case"{":this.emptyRule(t);break;default:this.other(t);break}this.endFile()}precheckMissedSemicolon(){}raw(t,n,r,i){let o,a,l=r.length,s="",u=!0,c,f;for(let m=0;mp+b[1],"");t.raws[n]={raw:m,value:s}}t[n]=s}rule(t){t.pop();let n=new Nc;this.init(n,t[0][2]),n.raws.between=this.spacesAndCommentsFromEnd(t),this.raw(n,"selector",t),this.current=n}spacesAndCommentsFromEnd(t){let n,r="";for(;t.length&&(n=t[t.length-1][0],!(n!=="space"&&n!=="comment"));)r=t.pop()[1]+r;return r}spacesAndCommentsFromStart(t){let n,r="";for(;t.length&&(n=t[0][0],!(n!=="space"&&n!=="comment"));)r+=t.shift()[1];return r}spacesFromEnd(t){let n,r="";for(;t.length&&(n=t[t.length-1][0],n==="space");)r=t.pop()[1]+r;return r}stringFrom(t,n){let r="";for(let i=n;i{"use strict";var ig=gt(),og=Yn(),ag=Ic();function li(e,t){let n=new og(e,t),r=new ag(n);try{r.parse()}catch(i){throw i}return r.root}Pc.exports=li;li.default=li;ig.registerParse(li)});var ma=ae((HA,Oc)=>{"use strict";var Qn=class{constructor(t,n={}){if(this.type="warning",this.text=t,n.node&&n.node.source){let r=n.node.rangeBy(n);this.line=r.start.line,this.column=r.start.column,this.endLine=r.end.line,this.endColumn=r.end.column}for(let r in n)this[r]=n[r]}toString(){return this.node?this.node.error(this.text,{index:this.index,plugin:this.plugin,word:this.word}).message:this.plugin?this.plugin+": "+this.text:this.text}};Oc.exports=Qn;Qn.default=Qn});var ci=ae((GA,Hc)=>{"use strict";var sg=ma(),Zn=class{get content(){return this.css}constructor(t,n,r){this.processor=t,this.messages=[],this.root=n,this.opts=r,this.css="",this.map=void 0}toString(){return this.css}warn(t,n={}){n.plugin||this.lastPlugin&&this.lastPlugin.postcssPlugin&&(n.plugin=this.lastPlugin.postcssPlugin);let r=new sg(t,n);return this.messages.push(r),r}warnings(){return this.messages.filter(t=>t.type==="warning")}};Hc.exports=Zn;Zn.default=Zn});var pa=ae((BA,Bc)=>{"use strict";var Gc={};Bc.exports=function(t){Gc[t]||(Gc[t]=!0,typeof console<"u"&&console.warn&&console.warn(t))}});var ba=ae((WA,zc)=>{"use strict";var lg=gt(),ug=Zr(),cg=da(),dg=ui(),Uc=ci(),fg=Jt(),mg=Bn(),{isClean:Ke,my:pg}=Jr(),UA=pa(),hg={atrule:"AtRule",comment:"Comment",decl:"Declaration",document:"Document",root:"Root",rule:"Rule"},gg={AtRule:!0,AtRuleExit:!0,Comment:!0,CommentExit:!0,Declaration:!0,DeclarationExit:!0,Document:!0,DocumentExit:!0,Once:!0,OnceExit:!0,postcssPlugin:!0,prepare:!0,Root:!0,RootExit:!0,Rule:!0,RuleExit:!0},bg={Once:!0,postcssPlugin:!0,prepare:!0},Zt=0;function er(e){return typeof e=="object"&&typeof e.then=="function"}function Vc(e){let t=!1,n=hg[e.type];return e.type==="decl"?t=e.prop.toLowerCase():e.type==="atrule"&&(t=e.name.toLowerCase()),t&&e.append?[n,n+"-"+t,Zt,n+"Exit",n+"Exit-"+t]:t?[n,n+"-"+t,n+"Exit",n+"Exit-"+t]:e.append?[n,Zt,n+"Exit"]:[n,n+"Exit"]}function Wc(e){let t;return e.type==="document"?t=["Document",Zt,"DocumentExit"]:e.type==="root"?t=["Root",Zt,"RootExit"]:t=Vc(e),{eventIndex:0,events:t,iterator:0,node:e,visitorIndex:0,visitors:[]}}function ha(e){return e[Ke]=!1,e.nodes&&e.nodes.forEach(t=>ha(t)),e}var ga={},xt=class e{get content(){return this.stringify().content}get css(){return this.stringify().css}get map(){return this.stringify().map}get messages(){return this.sync().messages}get opts(){return this.result.opts}get processor(){return this.result.processor}get root(){return this.sync().root}get[Symbol.toStringTag](){return"LazyResult"}constructor(t,n,r){this.stringified=!1,this.processed=!1;let i;if(typeof n=="object"&&n!==null&&(n.type==="root"||n.type==="document"))i=ha(n);else if(n instanceof e||n instanceof Uc)i=ha(n.root),n.map&&(typeof r.map>"u"&&(r.map={}),r.map.inline||(r.map.inline=!1),r.map.prev=n.map);else{let o=dg;r.syntax&&(o=r.syntax.parse),r.parser&&(o=r.parser),o.parse&&(o=o.parse);try{i=o(n,r)}catch(a){this.processed=!0,this.error=a}i&&!i[pg]&&lg.rebuild(i)}this.result=new Uc(t,i,r),this.helpers={...ga,postcss:ga,result:this.result},this.plugins=this.processor.plugins.map(o=>typeof o=="object"&&o.prepare?{...o,...o.prepare(this.result)}:o)}async(){return this.error?Promise.reject(this.error):this.processed?Promise.resolve(this.result):(this.processing||(this.processing=this.runAsync()),this.processing)}catch(t){return this.async().catch(t)}finally(t){return this.async().then(t,t)}getAsyncError(){throw new Error("Use process(css).then(cb) to work with async plugins")}handleError(t,n){let r=this.result.lastPlugin;try{n&&n.addToError(t),this.error=t,t.name==="CssSyntaxError"&&!t.plugin?(t.plugin=r.postcssPlugin,t.setMessage()):r.postcssVersion}catch(i){console&&console.error&&console.error(i)}return t}prepareVisitors(){this.listeners={};let t=(n,r,i)=>{this.listeners[r]||(this.listeners[r]=[]),this.listeners[r].push([n,i])};for(let n of this.plugins)if(typeof n=="object")for(let r in n){if(!gg[r]&&/^[A-Z]/.test(r))throw new Error(`Unknown event ${r} in ${n.postcssPlugin}. Try to update PostCSS (${this.processor.version} now).`);if(!bg[r])if(typeof n[r]=="object")for(let i in n[r])i==="*"?t(n,r,n[r][i]):t(n,r+"-"+i.toLowerCase(),n[r][i]);else typeof n[r]=="function"&&t(n,r,n[r])}this.hasListener=Object.keys(this.listeners).length>0}async runAsync(){this.plugin=0;for(let t=0;t0;){let r=this.visitTick(n);if(er(r))try{await r}catch(i){let o=n[n.length-1].node;throw this.handleError(i,o)}}}if(this.listeners.OnceExit)for(let[n,r]of this.listeners.OnceExit){this.result.lastPlugin=n;try{if(t.type==="document"){let i=t.nodes.map(o=>r(o,this.helpers));await Promise.all(i)}else await r(t,this.helpers)}catch(i){throw this.handleError(i)}}}return this.processed=!0,this.stringify()}runOnRoot(t){this.result.lastPlugin=t;try{if(typeof t=="object"&&t.Once){if(this.result.root.type==="document"){let n=this.result.root.nodes.map(r=>t.Once(r,this.helpers));return er(n[0])?Promise.all(n):n}return t.Once(this.result.root,this.helpers)}else if(typeof t=="function")return t(this.result.root,this.result)}catch(n){throw this.handleError(n)}}stringify(){if(this.error)throw this.error;if(this.stringified)return this.result;this.stringified=!0,this.sync();let t=this.result.opts,n=mg;t.syntax&&(n=t.syntax.stringify),t.stringifier&&(n=t.stringifier),n.stringify&&(n=n.stringify);let r=this.result.root.source;if(t.map===void 0&&!(r&&r.input&&r.input.map)){let a="";return n(this.result.root,l=>{a+=l}),this.result.css=a,this.result}let o=new cg(n,this.result.root,this.result.opts).generate();return this.result.css=o[0],this.result.map=o[1],this.result}sync(){if(this.error)throw this.error;if(this.processed)return this.result;if(this.processed=!0,this.processing)throw this.getAsyncError();for(let t of this.plugins){let n=this.runOnRoot(t);if(er(n))throw this.getAsyncError()}if(this.prepareVisitors(),this.hasListener){let t=this.result.root;for(;!t[Ke];)t[Ke]=!0,this.walkSync(t);if(this.listeners.OnceExit)if(t.type==="document")for(let n of t.nodes)this.visitSync(this.listeners.OnceExit,n);else this.visitSync(this.listeners.OnceExit,t)}return this.result}then(t,n){return this.async().then(t,n)}toString(){return this.css}visitSync(t,n){for(let[r,i]of t){this.result.lastPlugin=r;let o;try{o=i(n,this.helpers)}catch(a){throw this.handleError(a,n.proxyOf)}if(n.type!=="root"&&n.type!=="document"&&!n.parent)return!0;if(er(o))throw this.getAsyncError()}}visitTick(t){let n=t[t.length-1],{node:r,visitors:i}=n;if(r.type!=="root"&&r.type!=="document"&&!r.parent){t.pop();return}if(i.length>0&&n.visitorIndex{i[Ke]||this.walkSync(i)});else{let i=this.listeners[r];if(i&&this.visitSync(i,t.toProxy()))return}}warnings(){return this.sync().warnings()}};xt.registerPostcss=e=>{ga=e};zc.exports=xt;xt.default=xt;fg.registerLazyResult(xt);ug.registerLazyResult(xt)});var $c=ae((zA,qc)=>{"use strict";var xg=da(),yg=ui(),vg=ci(),Sg=Bn(),VA=pa(),tr=class{get content(){return this.result.css}get css(){return this.result.css}get map(){return this.result.map}get messages(){return[]}get opts(){return this.result.opts}get processor(){return this.result.processor}get root(){if(this._root)return this._root;let t,n=yg;try{t=n(this._css,this._opts)}catch(r){this.error=r}if(this.error)throw this.error;return this._root=t,t}get[Symbol.toStringTag](){return"NoWorkResult"}constructor(t,n,r){n=n.toString(),this.stringified=!1,this._processor=t,this._css=n,this._opts=r,this._map=void 0;let i=Sg;this.result=new vg(this._processor,void 0,this._opts),this.result.css=n;let o=this;Object.defineProperty(this.result,"root",{get(){return o.root}});let a=new xg(i,void 0,this._opts,n);if(a.isMap()){let[l,s]=a.generate();l&&(this.result.css=l),s&&(this.result.map=s)}else a.clearAnnotation(),this.result.css=a.css}async(){return this.error?Promise.reject(this.error):Promise.resolve(this.result)}catch(t){return this.async().catch(t)}finally(t){return this.async().then(t,t)}sync(){if(this.error)throw this.error;return this.result}then(t,n){return this.async().then(t,n)}toString(){return this._css}warnings(){return[]}};qc.exports=tr;tr.default=tr});var Kc=ae((qA,jc)=>{"use strict";var Ag=Zr(),Eg=ba(),wg=$c(),Cg=Jt(),Mt=class{constructor(t=[]){this.version="8.5.14",this.plugins=this.normalize(t)}normalize(t){let n=[];for(let r of t)if(r.postcss===!0?r=r():r.postcss&&(r=r.postcss),typeof r=="object"&&Array.isArray(r.plugins))n=n.concat(r.plugins);else if(typeof r=="object"&&r.postcssPlugin)n.push(r);else if(typeof r=="function")n.push(r);else if(!(typeof r=="object"&&(r.parse||r.stringify)))throw new Error(r+" is not a PostCSS plugin");return n}process(t,n={}){return!this.plugins.length&&!n.parser&&!n.stringifier&&!n.syntax?new wg(this,t,n):new Eg(this,t,n)}use(t){return this.plugins=this.plugins.concat(this.normalize([t])),this}};jc.exports=Mt;Mt.default=Mt;Cg.registerProcessor(Mt);Ag.registerProcessor(Mt)});var nd=ae(($A,td)=>{"use strict";var Yc=Qr(),Xc=qn(),_g=gt(),Tg=Xr(),Jc=jn(),Qc=Zr(),Rg=Ac(),kg=Yn(),Mg=ba(),Fg=ua(),Ng=Vn(),Lg=ui(),xa=Kc(),Dg=ci(),Zc=Jt(),ed=ri(),Ig=Bn(),Pg=ma();function ce(...e){return e.length===1&&Array.isArray(e[0])&&(e=e[0]),new xa(e)}ce.plugin=function(t,n){let r=!1;function i(...a){console&&console.warn&&!r&&(r=!0,console.warn(t+`: postcss.plugin was deprecated. Migration guide:\nhttps://evilmartians.com/chronicles/postcss-8-plugin-migration`),process.env.LANG&&process.env.LANG.startsWith("cn")&&console.warn(t+`: \\u91CC\\u9762 postcss.plugin \\u88AB\\u5F03\\u7528. \\u8FC1\\u79FB\\u6307\\u5357:\nhttps://www.w3ctech.com/topic/2226`));let l=n(...a);return l.postcssPlugin=t,l.postcssVersion=new xa().version,l}let o;return Object.defineProperty(i,"postcss",{get(){return o||(o=i()),o}}),i.process=function(a,l,s){return ce([i(s)]).process(a,l)},i};ce.stringify=Ig;ce.parse=Lg;ce.fromJSON=Rg;ce.list=Fg;ce.comment=e=>new Xc(e);ce.atRule=e=>new Yc(e);ce.decl=e=>new Jc(e);ce.rule=e=>new ed(e);ce.root=e=>new Zc(e);ce.document=e=>new Qc(e);ce.CssSyntaxError=Tg;ce.Declaration=Jc;ce.Container=_g;ce.Processor=xa;ce.Document=Qc;ce.Comment=Xc;ce.Warning=Pg;ce.AtRule=Yc;ce.Result=Dg;ce.Input=kg;ce.Rule=ed;ce.Root=Zc;ce.Node=Ng;Mg.registerPostcss(ce);td.exports=ce;ce.default=ce});function Cr(){return globalThis}function L(e,t){if(typeof window>"u")return;let n=Cr(),r=n.__hf?.onSwallowed;if(r)try{r({label:e,error:t})}catch(i){}(n.__hfDebug||n.__HYPERFRAMES_DEBUG)&&console.debug(`[hyperframes] ${e} swallowed:`,t)}var Zm=["seconds-time","rational-fps","seek-keep-playing","composition-manifest-v1","runtime-data"];function ep(e,t){let n=Math.abs(e),r=Math.abs(t);for(;r!==0;){let i=n%r;n=r,r=i}return n||1}function tp(e){let t=Number.isFinite(e)&&e>0?e:30,n=Number.isInteger(t)?1:1e6,r=Math.round(t*n),i=ep(r,n);return{numerator:r/i,denominator:n/i}}function Ji(e){if(typeof e!="object"||e===null)return null;let t=e;return!Number.isFinite(t.numerator)||!Number.isFinite(t.denominator)||(t.numerator??0)<=0||(t.denominator??0)<=0?null:Number(t.numerator)/Number(t.denominator)}function _r(e){return{protocolVersion:1,capabilities:Zm,fps:tp(e)}}function np(e){return Array.isArray(e)&&e.every(t=>typeof t=="string")}function Hs(e,t=30){if(typeof e!="object"||e===null)return{status:"legacy",fps:t};let n=e;if(n.protocolVersion===void 0)return{status:"legacy",fps:t};if(n.protocolVersion!==1)return{status:"unsupported",code:"unsupported_protocol_version",receivedVersion:n.protocolVersion};let r=Ji(n.fps);return r===null||!np(n.capabilities)?{status:"unsupported",code:"invalid_protocol_metadata",receivedVersion:n.protocolVersion}:{status:"supported",fps:r,metadata:n}}var Gs=30;function Bs(e){Gs=Number.isFinite(e)&&e>0?e:30}function be(e){try{window.parent.postMessage({...e,..._r(Gs)},"*")}catch(t){L("bridge.postMessage",t)}}var rp={play:(e,t)=>t.onPlay(),pause:(e,t)=>t.onPause(),"stop-media":(e,t)=>t.onStopMedia(),seek:(e,t)=>t.onSeek(ip(e,t),e.seekMode??"commit"),tick:(e,t)=>t.onTick(),"set-muted":(e,t)=>t.onSetMuted(!!e.muted),"set-volume":(e,t)=>t.onSetVolume(Math.max(0,Math.min(1,Number(e.volume??1)))),"set-media-output-muted":(e,t)=>t.onSetMediaOutputMuted(!!e.muted),"set-native-media-sync-disabled":(e,t)=>t.onSetNativeMediaSyncDisabled(!!e.disabled),"set-web-audio-media-disabled":(e,t)=>t.onSetWebAudioMediaDisabled(!!e.disabled),"set-playback-rate":(e,t)=>t.onSetPlaybackRate(Number(e.playbackRate??1)),"set-root-duration":(e,t)=>t.onSetRootDuration(Number(e.durationSeconds??0)),"set-color-grading":(e,t)=>t.onSetColorGrading(e.target??null,e.grading??null),"set-color-grading-compare":(e,t)=>t.onSetColorGradingCompare(e.target??null,e.compare??null),"enable-pick-mode":(e,t)=>t.onEnablePickMode(),"disable-pick-mode":(e,t)=>t.onDisablePickMode(),"flash-elements":e=>ap(e),"set-runtime-data":(e,t)=>{typeof e.channel=="string"&&t.onSetRuntimeData?.(e.channel,e.payload,e.requestId)},"clear-runtime-data":(e,t)=>{typeof e.channel=="string"&&t.onClearRuntimeData?.(e.channel,e.requestId)}};function ip(e,t){let n=Number(e.timeSeconds);if(Number.isFinite(n))return Math.max(0,n);let i=Ji(e.fps)??t.getCanonicalFps();return Math.max(0,Number(e.frame??0))/i}function op(e){let t=Hs(e);return t.status!=="unsupported"?!1:(be({source:"hf-preview",type:"diagnostic",code:`runtime.protocol.${t.code}`,details:{receivedVersion:typeof t.receivedVersion=="string"||typeof t.receivedVersion=="number"?t.receivedVersion:null}}),!0)}function ap(e){let t=e.selectors,n=e.duration||800;t&&sp(t,n)}function Us(e){let t=n=>{let r=n.data;if(!r||r.source!=="hf-parent"||r.type!=="control"||op(r))return;let i=r.action;if(typeof i!="string")return;let o=rp[i];o&&o(r,e)};return window.addEventListener("message",t),be({source:"hf-preview",type:"ready"}),t}function sp(e,t){if(!document.getElementById("__hf-flash-styles")){let n=document.createElement("style");n.id="__hf-flash-styles",n.textContent=`\n .__hf-flash {\n outline: 2px solid rgba(59, 130, 246, 0.6) !important;\n outline-offset: 2px !important;\n animation: __hf-flash-pulse ${t}ms ease-out forwards !important;\n }\n @keyframes __hf-flash-pulse {\n 0% { outline-color: rgba(59, 130, 246, 0.8); }\n 100% { outline-color: transparent; }\n }\n `,document.head.appendChild(n)}for(let n of e)try{document.querySelectorAll(n).forEach(i=>{i.classList.add("__hf-flash"),setTimeout(()=>i.classList.remove("__hf-flash"),t)})}catch(r){L("bridge.flashElements.querySelector",r)}}var Qi=null;function Ws(e){Qi=e}function Ne(e,t){if(Qi)try{Qi({source:"hf-preview",type:"analytics",event:e,properties:t??{}})}catch(n){L("runtime.analytics.site1",n)}}function lp(e){let t=e.toLowerCase().replace(/[^a-z0-9]+/g,"-"),n=0,r=t.length;for(;nn&&t[r-1]==="-";)r--;let i=t.slice(n,r);return i.length>0?i:"node"}function Pt(e){return`--${lp(e)}`}function Vs(e){let t=new Map;for(let n of e){let r=Pt(n),i=t.get(r);i?i.includes(n)||i.push(n):t.set(r,[n])}return[...t.values()].filter(n=>n.length>1)}function qs(){if(typeof document>"u")return{};let e=new Set;document.documentElement?.hasAttribute("data-composition-variables")&&e.add(document.documentElement);for(let i of Array.from(document.querySelectorAll("[data-composition-variables]")))e.add(i);let t={};for(let i of e)Object.assign(t,bn(i));let n=Rr(),r={...t,...n};for(let i of e)eo(i,r);return r}var zs=new Set;function $s(e){let t=e?.getAttribute("data-composition-variables");if(!t)return[];let n;try{n=JSON.parse(t)}catch{return[]}return Array.isArray(n)?n.filter(r=>!!r&&typeof r=="object"):[]}function up(e,t){return t?.trim()||e.getAttribute("data-composition-id")?.trim()||e.querySelector("[data-composition-id]")?.getAttribute("data-composition-id")?.trim()||"composition"}function cp(e){return Array.isArray(e.options)?e.options.map(t=>t&&typeof t=="object"?t.value:t).filter(t=>typeof t=="string"||typeof t=="number"):[]}function dp(e,t){if(typeof e.id!="string")return null;let n=t[e.id];if(n==null||"default"in e&&String(n)===String(e.default))return null;let r=cp(e);return r.length===0||r.some(i=>String(i)===String(n))?null:{id:e.id,value:n,allowed:r}}function eo(e,t,n){if(!e)return;let r=$s(e);if(r.length===0)return;let i=up(e,n);for(let o of r){let a=dp(o,t);if(!a)continue;let l=`${i}|${a.id}|${String(a.value)}`;if(zs.has(l))continue;zs.add(l);let s="default"in o?JSON.stringify(o.default):"the composition default";console.warn(`[hyperframes] runtime_unknown_enum_value: ${i} variable "${a.id}" got ${JSON.stringify(a.value)}, which is not a declared option (${a.allowed.join(", ")}). Rendering ${s} instead.`)}}function bn(e){let t={};for(let n of $s(e))typeof n.id!="string"||!("default"in n)||(t[n.id]=n.default);return t}var Zi="data-hf-css-vars";function Tr(e){return"style"in e&&typeof e.style?.setProperty=="function"}function to(e,t){if(!Tr(e))return;let n=[];for(let[r,i]of Object.entries(t))if(typeof i=="string"&&i!==""||typeof i=="number"){let o=Pt(r);e.style.setProperty(o,String(i)),n.push(o)}n.length>0&&e.setAttribute(Zi,n.join(" "))}function js(e,t,n){let r={};for(let[i,o]of Object.entries(t)){let a=Pt(i);((Tr(e)?e.style.getPropertyValue(a):"")||(n?n.getComputedStyle(e).getPropertyValue(a):"")).trim()===""&&(r[i]=o)}return r}function Ks(e){if(!Tr(e))return;let t=e.getAttribute(Zi);if(t){for(let n of t.split(" "))n.startsWith("--")&&e.style.removeProperty(n);e.removeAttribute(Zi)}}function Ys(e){let t=new Set;e.documentElement?.hasAttribute("data-composition-variables")&&t.add(e.documentElement);for(let i of Array.from(e.querySelectorAll("[data-composition-variables]")))t.add(i);let n=Rr(),r=[];for(let i of t)r.push(...fp(i,n,e.defaultView));for(let i of Vs(r))console.warn(`composition variables ${i.join(", ")} collapse to the same CSS property ${Pt(i[0]??"")} \\u2014 rename one to avoid cross-talk`)}function fp(e,t,n){if(!Tr(e))return[];let r=bn(e),i={};for(let[o,a]of Object.entries(r)){if(o in t)continue;let l=Pt(o);(e.style.getPropertyValue(l)||(n?n.getComputedStyle(e).getPropertyValue(l):"")).trim()===""&&(i[o]=a)}for(let[o,a]of Object.entries(t))o in r&&(i[o]=a);return to(e,i),Object.keys(r)}function Xs(e){let t=e.getAttribute("data-variable-values");if(!t)return{};let n;try{n=JSON.parse(t)}catch{return{}}return!n||typeof n!="object"||Array.isArray(n)?{}:n}function Rr(){if(typeof window>"u")return{};let e=window.__hfVariables;return!e||typeof e!="object"||Array.isArray(e)?{}:e}function Js(e){let t=[],n=u=>{if(typeof u.getAnimations!="function")return[];try{return u.getAnimations()}catch{return[]}},r=u=>e?.resolveStartSeconds?e.resolveStartSeconds(u):Number.parseFloat(u.getAttribute("data-start")??"0")||0,i=(u,c)=>{let f=null;try{f=u.effect?.getComputedTiming?.()??null}catch(p){L("runtime.adapters.css.site5",p)}if(!f)return{};let m=Number(f.endTime);return Number.isFinite(m)?{endSeconds:c+m/1e3}:{unbounded:!0}},o=(u,c)=>{for(let f of u){try{f.currentTime=c}catch(m){L("runtime.adapters.css.site1",m)}try{f.pause()}catch(m){L("runtime.adapters.css.site2",m)}}},a=u=>{for(let c of u)try{c.play()}catch(f){L("runtime.adapters.css.site3",f)}},l=u=>{for(let c of u)try{c.pause()}catch(f){L("runtime.adapters.css.site4",f)}},s=u=>{u.baseDelay?u.el.style.animationDelay=u.baseDelay:u.el.style.removeProperty("animation-delay"),u.basePlayState?u.el.style.animationPlayState=u.basePlayState:u.el.style.removeProperty("animation-play-state")};return{name:"css",discover:()=>{t=[];let u=document.querySelectorAll("*");for(let c of u){if(!(c instanceof HTMLElement))continue;let f=window.getComputedStyle(c);!f.animationName||f.animationName==="none"||t.push({el:c,baseDelay:c.style.animationDelay||"",basePlayState:c.style.animationPlayState||"",animations:n(c)})}},getInferredDurationSeconds:()=>{let u=0;for(let c of t){if(!c.el.isConnected)continue;let f=r(c.el);for(let m of n(c.el)){let p=i(m,f);p.endSeconds!=null&&(u=Math.max(u,p.endSeconds))}}return u>0?u:null},seek:u=>{let c=Number(u.time)||0;for(let f of t){if(!f.el.isConnected)continue;let m=r(f.el),p=Math.max(0,c-m)*1e3,b=f.animations;if(b.length>0){o(b,p);continue}f.el.style.animationPlayState="paused",f.el.style.animationDelay=`-${(p/1e3).toFixed(3)}s`}},pause:()=>{for(let u of t){if(!u.el.isConnected)continue;let c=u.animations;c.length>0&&l(c),s(u)}},play:()=>{for(let u of t)u.el.isConnected&&(s(u),a(u.animations))},revert:()=>{t=[]}}}function Qs(e){return{name:"gsap",discover:()=>{},seek:t=>{let n=e.getTimeline();if(!n)return;n.pause();let r=Math.max(0,Number(t.time)||0),i=t.suppressEvents===!0;typeof n.totalTime=="function"?(n.totalTime(r+.001,!0),n.totalTime(r,i)):n.seek(r,i)},pause:()=>{let t=e.getTimeline();t&&t.pause()}}}function Zs(){return{name:"animejs",discover:()=>{try{let e=window.anime;if(!e||typeof e.running>"u")return;let t=e.running;if(!Array.isArray(t)||t.length===0)return;let n=window.__hfAnime??[],r=new Set(n);for(let i of t)r.has(i)||n.push(i);window.__hfAnime=n}catch(e){L("runtime.adapters.animejs.site1",e)}},seek:e=>{let t=Math.max(0,(Number(e.time)||0)*1e3),n=window.__hfAnime;if(!(!n||n.length===0))for(let r of n)try{typeof r.seek=="function"&&r.seek(t)}catch(i){L("runtime.adapters.animejs.site2",i)}},pause:()=>{let e=window.__hfAnime;if(!(!e||e.length===0))for(let t of e)try{typeof t.pause=="function"&&t.pause()}catch(n){L("runtime.adapters.animejs.site3",n)}},play:()=>{let e=window.__hfAnime;if(!(!e||e.length===0))for(let t of e)try{typeof t.play=="function"&&t.play()}catch(n){L("runtime.adapters.animejs.site4",n)}},revert:()=>{}}}function tl(){return{name:"lottie",discover:()=>{try{let e=window.lottie;if(e&&typeof e.getRegisteredAnimations=="function"){let t=e.getRegisteredAnimations();if(Array.isArray(t)&&t.length>0){let n=window.__hfLottie??[],r=new Set(n);for(let i of t)r.has(i)||n.push(i);window.__hfLottie=n}}}catch(e){L("runtime.adapters.lottie.site1",e)}},seek:e=>{let t=Math.max(0,Number(e.time)||0),n=window.__hfLottie;if(!(!n||n.length===0))for(let r of n)try{if(no(r))r.goToAndStop(t*1e3,!1);else if(ro(r)){if(typeof r.setCurrentRawFrameValue=="function"){let i=r.totalFrames??0,o=r.frameRate??30,a=t*o;i>0&&r.setCurrentRawFrameValue(Math.min(a,i-1))}else if(typeof r.seek=="function"){let i=r.duration??1,o=Math.min(100,t/i*100);r.seek(o)}}}catch(i){L("runtime.adapters.lottie.site2",i)}},pause:()=>{let e=window.__hfLottie;if(!(!e||e.length===0))for(let t of e)try{(no(t)||ro(t))&&t.pause()}catch(n){L("runtime.adapters.lottie.site3",n)}},revert:()=>{},getInferredDurationSeconds:()=>{let e=window.__hfLottie;if(!e||e.length===0)return null;let t=0,n=!1;for(let r of e){let i=null;try{i=mp(r)}catch(o){L("runtime.adapters.lottie.site4",o)}i!=null&&(n=!0,t=Math.max(t,i))}return n?t:null}}}function el(e,t){return!Number.isFinite(e)||!e||e<=0||!Number.isFinite(t)||!t||t<=0?null:e/t}function mp(e){return no(e)?el(e.totalFrames,e.frameRate):ro(e)?Number.isFinite(e.duration)&&(e.duration??0)>0?e.duration??null:el(e.totalFrames,e.frameRate):null}function no(e){return typeof e=="object"&&e!==null&&typeof e.goToAndStop=="function"}function ro(e){return typeof e=="object"&&e!==null&&typeof e.pause=="function"&&("totalFrames"in e||"duration"in e)}var io=-1,kr=new Set,Ot,oo=0;function nl(e){let t=[],n=!0,r={time:e,waitUntil:o=>{if(!n)throw new Error("hf-seek waitUntil() must be called synchronously from the event listener");t.push(o)}};try{window.dispatchEvent(new CustomEvent("hf-seek",{detail:r}))}catch(o){L("runtime.adapters.seek-dispatch.site1",o)}finally{n=!1}if(t.length===0)return;let i=Promise.all(t).then(()=>({status:"fulfilled"})).catch(o=>({status:"rejected",reason:o}));kr.add(i),i.then(o=>{kr.delete(i)&&o.status==="rejected"&&Ot===void 0&&(Ot={reason:o.reason})})}function Mr(e){e!==io&&(io=e,nl(e))}function Fr(e){io=e,nl(e)}function rl(){return oo>0}async function ao(){oo+=1;let e=Ot;try{for(await Promise.resolve();kr.size>0;){let r=(await Promise.all([...kr])).find(i=>i.status==="rejected");e===void 0&&r?.status==="rejected"&&(e={reason:r.reason})}let t=Ot;if(e===void 0&&(e=t),Ot===t&&(Ot=void 0),e)throw e.reason}finally{oo-=1}}function il(){let e=null,t=0,n=null,r=null,i=null,o=null,a=()=>{if(typeof window>"u")return null;let c=window.THREE?.DefaultLoadingManager;return!c||typeof c!="object"||typeof c.itemsLoaded!="number"||typeof c.itemsTotal!="number"?null:c},l=u=>{o||u.itemsTotal<=u.itemsLoaded||(o=new Promise(c=>{u.onLoad=function(){try{i?.call(this)}finally{o=null,u.onLoad=i??null,c()}}}))},s=u=>{n!==u&&(n=u,r=u.onStart??null,i=u.onLoad??null,u.onStart=function(c,f,m){try{r?.call(this,c,f,m)}finally{l(u)}})};return{name:"three",discover:()=>{let u=a();u&&(s(u),l(u))},seek:u=>{e=Math.max(0,Number(u.time)||0),t=e,window.__hfThreeTime=e,Mr(e)},pause:()=>{e==null&&(e=Math.max(0,t))},play:()=>{e=null},revert:()=>{e=null,t=0},getReadyPromise:()=>{let u=a();return!u||u.itemsTotal<=u.itemsLoaded?null:(o||l(u),o)}}}function qe(e){let t=null,n=new WeakSet;return{name:e.name,discover:()=>{},seek:()=>{},pause:()=>{},play:()=>{},revert:()=>{},getReadyPromise:()=>{let r=e.getInstances();if(r.length===0)return null;let i=r.filter(o=>!n.has(o));return i.length===0?null:t||(t=Promise.allSettled(i.map(o=>e.waitFor(o).then(()=>{n.add(o)}))).then(()=>{t=null}),t)}}}function ol(){return qe({name:"mapbox",getInstances:()=>{if(typeof window>"u")return[];let e=window.__hfMapbox;return Array.isArray(e)?e:[]},waitFor:e=>new Promise(t=>{if(e.loaded()){t();return}e.on("load",t)})})}function al(){return qe({name:"leaflet",getInstances:()=>{if(typeof window>"u")return[];let e=window.__hfLeaflet;return Array.isArray(e)?e:[]},waitFor:e=>new Promise(t=>e.whenReady(t))})}function sl(){return qe({name:"google-maps",getInstances:()=>{if(typeof window>"u")return[];let e=window.__hfGoogleMaps;return Array.isArray(e)?e:[]},waitFor:e=>new Promise(t=>{let n=e.addListener("tilesloaded",()=>{n.remove(),t()})})})}function ll(){return qe({name:"maplibre",getInstances:()=>{if(typeof window>"u")return[];let e=window.__hfMaplibre;return Array.isArray(e)?e:[]},waitFor:e=>new Promise(t=>{if(e.loaded()){t();return}e.on("load",t)})})}function ul(){return qe({name:"d3",getInstances:()=>{if(typeof window>"u")return[];let e=window.__hfD3;return Array.isArray(e)?e:[]},waitFor:e=>e.end()})}var pp=250;function cl(){let e=null,t=0,n=null,r=()=>{n!==null&&(window.clearInterval(n),n=null)},i=()=>{n===null&&document.querySelector("[data-composition-id][data-requires-webgpu]")&&(n=window.setInterval(()=>{e!==null&&(rl()||(window.__hfTypegpuTime=e,Fr(e)))},pp))};return{name:"typegpu",discover:()=>{},seek:o=>{e=Math.max(0,Number(o.time)||0),t=e,window.__hfTypegpuTime=e,Mr(e)},pause:()=>{e==null&&(e=Math.max(0,t)),i()},play:()=>{r(),e=null},revert:()=>{r(),e=null,t=0}}}var xn="data-hf-render-id",dl="data-hf-group-render-id";function hp(e){return e.getAttribute(xn)||e.id||null}var gp="__render_frame_",bp="__";function xp(e){return`${gp}${e}${bp}`}function yp(e){let t=hp(e);return t?xp(t):null}function ut(e){let t=yp(e);if(!t)return null;let n=document.getElementById(t);return n instanceof HTMLImageElement?n:null}function fl(e){let t=e.nextElementSibling;if(t instanceof HTMLImageElement&&t.classList.contains("__render_frame__")&&t.complete&&t.naturalWidth>0)return t;let n=ut(e);return n&&n.complete&&n.naturalWidth>0?n:null}function ml(){let e=globalThis.GPUQueue;if(!e?.prototype?.copyExternalImageToTexture)return;let t=e.prototype.copyExternalImageToTexture;e.prototype.copyExternalImageToTexture=function(n,r,i){if(n?.source instanceof HTMLVideoElement){let o=fl(n.source);if(o)return t.call(this,{...n,source:o},r,i)}return t.call(this,n,r,i)}}function pl(){let e=[globalThis.WebGL2RenderingContext,globalThis.WebGLRenderingContext],t=["texImage2D","texSubImage2D"];for(let n of e){let r=n?.prototype;if(r)for(let i of t){let o=r[i];if(typeof o!="function"||o.__hfVideoPatched)continue;let a=function(...l){let s=l.length-1,u=l[s];if(u instanceof HTMLVideoElement){let c=fl(u);c&&(l[s]=c)}return o.apply(this,l)};a.__hfVideoPatched=!0,r[i]=a}}}function hl(){let e=!1,t=0,n=!1,r,i,o,a=new Set,l=new WeakMap,s=()=>{if(!document.getAnimations)return[];try{return document.getAnimations()}catch{return[]}},u=x=>{let _=Number(x.currentTime);return Number.isFinite(_)&&_>0?_:0},c=(x,_)=>_<=0?x:x>=_?Math.max(0,x-_):x,f=(x,_)=>{let R=l.get(x);if(R)return R;let T={compositionTimeMs:_,animationTimeMs:e?c(u(x),_):u(x)};return l.set(x,T),T},m=(x,_)=>{if(!a.has(x)){a.add(x);let R=()=>{a.delete(x)};try{x.addEventListener("finish",R,{once:!0}),x.addEventListener("cancel",R,{once:!0})}catch(T){L("runtime.adapters.waapi.site4",T)}}f(x,_)},p=(x,_)=>{for(let R of x)m(R,_)},b=()=>{if(n||typeof Element>"u")return;let x=Element.prototype;if(typeof x.animate!="function"||x.__hfOriginalAnimate)return;let _=x.animate;try{Object.defineProperty(x,"__hfOriginalAnimate",{value:_,configurable:!0});let R=function(...T){let M=_.apply(this,T);return m(M,t),M};x.animate=R,r=x,i=_,o=R,n=!0}catch{}},v=x=>{let _=null;try{_=x.effect?.getComputedTiming?.()??null}catch(M){L("runtime.adapters.waapi.site4",M)}if(!_)return{};let R=Number(_.endTime);return Number.isFinite(R)?{endSeconds:(l.get(x)?.compositionTimeMs??0)/1e3+R/1e3}:{unbounded:!0}};return{name:"waapi",discover:()=>{e=!0,b(),p(s(),t)},seek:x=>{let _=Math.max(0,(Number(x.time)||0)*1e3);t=_,(!e||a.size>0)&&p(s(),e?_:0);for(let R of a){let T=e?f(R,_):f(R,0),M=T.animationTimeMs+Math.max(0,_-T.compositionTimeMs);try{R.currentTime=M}catch(D){L("runtime.adapters.waapi.site1",D)}try{R.pause()}catch(D){L("runtime.adapters.waapi.site2",D)}}},pause:()=>{e||p(s(),t);for(let x of a)try{x.pause()}catch(_){L("runtime.adapters.waapi.site3",_)}},revert:()=>{if(a.clear(),l=new WeakMap,e=!1,t=0,r&&i&&o&&r.animate===o)try{r.animate=i,r.__hfOriginalAnimate===i&&delete r.__hfOriginalAnimate}catch(x){L("runtime.adapters.waapi.site5",x)}r=void 0,i=void 0,o=void 0,n=!1},getInferredDurationSeconds:()=>{let x=0;for(let _ of s()){let R=v(_);R.endSeconds!=null&&(x=Math.max(x,R.endSeconds))}return x>0?x:null}}}var so=3.981071705534972;function Le(e){return Number.isFinite(e)?Math.max(0,Math.min(so,e)):1}function Nr(e){return Number.isFinite(e)?Math.max(0,Math.min(1,e)):1}function gl(e,t){let n=typeof HTMLMediaElement>"u"?void 0:Object.getOwnPropertyDescriptor(HTMLMediaElement.prototype,"volume"),r=n?.get,i=n?.set;if(!r||!i)return t();let o=Number(r.call(e));Object.defineProperty(e,"volume",{configurable:!0,get:()=>o,set:a=>{o=Number(a),i.call(e,Nr(o))}});try{return t()}finally{delete e.volume,i.call(e,Nr(o))}}var Ht=Object.freeze({start:"data-start",duration:"data-duration",trackIndex:"data-track-index",derivedEnd:"data-end",legacyTrack:"data-layer"}),yv=Object.freeze([Ht.start,Ht.duration,Ht.trackIndex]),vv=Object.freeze([Ht.derivedEnd]),Sv=Object.freeze([Ht.derivedEnd,Ht.legacyTrack]);function Gt(e){if(e==null||e.trim()==="")return null;let t=Number(e);return Number.isFinite(t)?t:null}var xl=/^[A-Za-z0-9_.:-]+$/;function yl(e,t){let n=e.charCodeAt(t);return n>=48&&n<=57}function bl(e,t){let n=t;for(;n>=0&&yl(e,n);)n--;return n}function vp(e,t){let n=t;for(;n>=0&&(e[n]??"").trim()==="";)n--;return n}function Sp(e){let t=e.length-1;if(!yl(e,t))return null;let n=bl(e,t);return e[n]==="."&&(n=bl(e,n-1)),n+1}function Ap(e){let t=Sp(e);if(t==null)return null;let n=vp(e,t-1),r=e[n];if(r!=="+"&&r!=="-")return null;let i=e.slice(0,n).trim();if(!xl.test(i))return null;let o=Number(e.slice(t));return Number.isFinite(o)?{refId:i,operator:r,magnitude:o}:null}function lo(e){let t=(e??"").trim();if(!t)return null;let n=Gt(t);if(n!=null)return{kind:"absolute",value:n};if(xl.test(t))return{kind:"reference",refId:t,offset:0};let r=Ap(t);return r?{kind:"reference",refId:r.refId,offset:r.operator==="-"?-r.magnitude:r.magnitude}:null}function vl(e){return Number.isFinite(e)&&e>0?Math.max(.1,Math.min(5,e)):1}function ve(e){return Gt(e)}function _e(e){let t=Number.parseFloat(e.getAttribute("data-playback-rate")??""),n=Number.isFinite(t)&&t>0?t:typeof HTMLMediaElement<"u"&&e instanceof HTMLMediaElement?e.defaultPlaybackRate:1;return vl(n)}function yn(e){let t=n=>{let r=ve(n);return r==null?null:Number.isFinite(r)&&r>=0?r:null};return t(e.getAttribute("data-playback-start"))??t(e.getAttribute("data-media-start"))??0}function Qe(e,t){return Ep(t,yn(e),_e(e))}function Ep(e,t,n){return Number.isFinite(e)?Math.max(0,e-t)/vl(n):null}function wp(e,t,n){let r=e.filter(o=>Number.isFinite(o.time)&&Number.isFinite(o.volume)).map(o=>({time:Math.max(0,o.time-t),volume:Le(o.volume)})).sort((o,a)=>o.time-a.time),i=[];for(let o of r){let a=i.at(-1);a&&Math.abs(a.time-o.time)<1e-9?a.volume=o.volume:i.push(o)}return i.length===0||i[0].time>0&&i.unshift({time:0,volume:Le(n)}),i}function Sl(e,t){if(e.length===0)return 1;let n=0;for(;n=e[n+1].time;)n+=1;let r=e[n],i=e[n+1]??r,o=i.time-r.time,a=o<=0?0:Math.min(1,Math.max(0,(t-r.time)/o));return r.volume+(i.volume-r.volume)*a}function Cp(e,t,n,r){let i=e.at(-1);!i||Math.abs(i.volume-n.volume)>1e-4?(i&&t&&t.time>i.time&&e.push(t),e.push(n)):r&&n.time>i.time&&e.push(n)}function _p(e){let t=Number.parseFloat(e??"");return Number.isFinite(t)?t:void 0}function Al(e,t){let n=ve(e.dataset.start)??0,r=ve(e.dataset.end)??void 0,i=ve(e.dataset.duration)??void 0,o=t;i!==void 0&&i>0?o=n+i:r!==void 0&&r>n&&(o=r);let a=_p(e.dataset.volume)??1;return{start:n,end:o,staticVolume:Le(a)}}function Tp(e,t,n,r){let{start:i,end:o,staticVolume:a}=Al(e,n),l=1/Math.min(60,Math.max(1,r)),s=Math.max(0,i),u=Math.min(n,o),c=gl(e,()=>{e.volume=a;let m=[],p;for(let b=s;b<=u+1e-6;b=Math.min(u,b+l)){t(b);let v=Number(e.volume);if(Number.isFinite(v)){let x={time:Number(b.toFixed(6)),volume:Number(Le(v).toFixed(6))};Cp(m,p,x,b===u),p=x}if(b===u)break}return m});return c.some(m=>Math.abs(m.volume-a)>1e-4)?c:null}function El(e,t,n,r,i={}){if(i.allowLiveTimelineSeek===!1||!t||!(e instanceof HTMLAudioElement)&&!(e instanceof HTMLVideoElement)||n<=0)return;let o=s=>{try{typeof t.totalTime=="function"?t.totalTime(s,!0):typeof t.seek=="function"&&t.seek(s,!0)}catch{}},a=typeof t.totalTime=="function"?Number(t.totalTime()):typeof t.seek=="function"?Number(t.seek()):0,l=Tp(e,o,n,60);if(Number.isFinite(a)&&o(a),l){let{start:s,staticVolume:u}=Al(e,n),c=wp(l,s,u);c.length>0&&r.set(e,c)}}var Tt="data-fx-chain",Fv=Tt.slice(5),wl=1,vn=(e="frequency",t="Frequency",n=1e3,r=20,i=2e4)=>({kind:"number",key:e,label:t,unit:"Hz",min:r,max:i,step:1,default:n,scale:"log",automatable:!0}),uo=(e=.707,t="Bandwidth \\u2014 higher is narrower.")=>({kind:"number",key:"q",label:"Q",unit:"",min:.1,max:20,step:.01,default:e,scale:"log",automatable:!0,hint:t}),Lr=(e=-40,t=40,n=0)=>({kind:"number",key:"gain",label:"Gain",unit:"dB",min:e,max:t,step:.1,default:n,automatable:!0}),Cl={kind:"enum",key:"poles",label:"Slope",options:[{value:"1",label:"6 dB/oct"},{value:"2",label:"12 dB/oct"}],default:"2",hint:"Two poles is the usual biquad; one pole is gentler."},Tl=[{id:"gain",label:"Gain",group:"dynamics",description:"Raise or lower the whole signal. Automate it to duck under something else.",params:[Lr(-60,12,0)],web:"gain-node"},{id:"peaking",label:"Peaking EQ",group:"filter",description:"Boost or cut a band, leaving everything either side alone.",params:[vn("frequency","Frequency",1e3),Lr(-40,40,0),uo(1)],web:"biquad-peaking"},{id:"lowshelf",label:"Low Shelf",group:"filter",description:"Lift or drop everything below the corner frequency.",params:[vn("frequency","Frequency",200,20,2e3),Lr(-40,40,0)],web:"biquad-lowshelf"},{id:"highshelf",label:"High Shelf",group:"filter",description:"Lift or drop everything above the corner frequency.",params:[vn("frequency","Frequency",4e3,500,2e4),Lr(-40,40,0)],web:"biquad-highshelf"},{id:"highpass",label:"High-pass",group:"filter",description:"Remove low frequencies \\u2014 the usual fix for rumble on a voice.",params:[vn("frequency","Cutoff",300,20,2e4),uo(.707),Cl],web:"biquad-highpass"},{id:"lowpass",label:"Low-pass",group:"filter",description:"Remove high frequencies \\u2014 darkens or muffles a track.",params:[vn("frequency","Cutoff",8e3,100,2e4),uo(.707),Cl],web:"biquad-lowpass"},{id:"compressor",label:"Compressor",group:"dynamics",description:"Pull loud parts down so the quiet ones can come up.",params:[{kind:"number",key:"threshold",label:"Threshold",unit:"dB",min:-60,max:0,step:.5,default:-24,hint:"Level above which the compressor starts working."},{kind:"number",key:"ratio",label:"Ratio",unit:":1",min:1,max:20,step:.1,default:4},{kind:"number",key:"attack",label:"Attack",unit:"ms",min:.01,max:2e3,step:.1,default:20,scale:"log"},{kind:"number",key:"release",label:"Release",unit:"ms",min:.01,max:9e3,step:1,default:250,scale:"log"},{kind:"number",key:"knee",label:"Knee",unit:"",min:1,max:8,step:.01,default:2.83,hint:"1 is a hard corner; higher eases into it."},{kind:"number",key:"makeup",label:"Makeup",unit:"dB",min:0,max:36,step:.1,default:0},{kind:"number",key:"mix",label:"Mix",unit:"",min:0,max:1,step:.01,default:1,hint:"Below 1 blends the dry signal back in."}],web:"worklet-compressor"},{id:"limiter",label:"Limiter",group:"dynamics",description:"Hard ceiling \\u2014 nothing gets past the limit.",params:[{kind:"number",key:"limit",label:"Ceiling",unit:"dB",min:-24,max:0,step:.1,default:-1},{kind:"number",key:"attack",label:"Attack",unit:"ms",min:.1,max:80,step:.1,default:5},{kind:"number",key:"release",label:"Release",unit:"ms",min:1,max:8e3,step:1,default:50,scale:"log"},{kind:"number",key:"level_out",label:"Output",unit:"dB",min:-24,max:24,step:.1,default:0}],web:"worklet-limiter"},{id:"gate",label:"Noise Gate",group:"dynamics",description:"Silence the track when it drops below the threshold.",params:[{kind:"number",key:"threshold",label:"Threshold",unit:"dB",min:-80,max:0,step:.5,default:-35},{kind:"number",key:"range",label:"Range",unit:"dB",min:-80,max:0,step:.5,default:-24,hint:"How far down the gate pulls when closed."},{kind:"number",key:"ratio",label:"Ratio",unit:":1",min:1,max:20,step:.1,default:10},{kind:"number",key:"attack",label:"Attack",unit:"ms",min:.01,max:9e3,step:.1,default:1,scale:"log"},{kind:"number",key:"release",label:"Release",unit:"ms",min:.01,max:9e3,step:1,default:100,scale:"log"},{kind:"number",key:"knee",label:"Knee",unit:"",min:1,max:8,step:.01,default:2.83}],web:"worklet-gate"},{id:"saturate",label:"Saturation",group:"nonlinear",description:"Soft-clip the waveform for warmth or outright distortion.",params:[{kind:"enum",key:"type",label:"Curve",options:[{value:"tanh",label:"Tanh"},{value:"atan",label:"Arctan"},{value:"cubic",label:"Cubic"},{value:"exp",label:"Exponential"},{value:"alg",label:"Algebraic"},{value:"quintic",label:"Quintic"},{value:"sin",label:"Sine"},{value:"erf",label:"Error function"},{value:"hard",label:"Hard clip"}],default:"tanh"},{kind:"number",key:"threshold",label:"Threshold",unit:"dB",min:-40,max:0,step:.1,default:-6},{kind:"number",key:"output",automatable:!0,label:"Output",unit:"dB",min:-24,max:24,step:.1,default:0},{kind:"number",key:"oversample",label:"Oversample",unit:"x",min:1,max:8,step:1,default:4,hint:"Higher costs more but keeps aliasing down."}],web:"waveshaper"},{id:"bitcrush",label:"Bitcrush",group:"nonlinear",description:"Drop bit depth and sample rate for a lo-fi, digital sound.",params:[{kind:"number",key:"bits",label:"Bit depth",unit:"bit",min:1,max:32,step:.1,default:8},{kind:"number",key:"samples",label:"Sample hold",unit:"x",min:1,max:250,step:1,default:1,hint:"Repeats each sample N times \\u2014 a crude downsample."},{kind:"number",key:"mix",label:"Mix",unit:"",min:0,max:1,step:.01,default:1}],web:"worklet-bitcrush"},{id:"pitchshift",label:"Pitch shift",group:"time",description:"Shifts pitch up or down without changing playback speed. Adds ~50 ms of latency.",params:[{kind:"number",key:"semitones",label:"Semitones",unit:"st",min:-12,max:12,step:1,default:0},{kind:"number",key:"mix",label:"Mix",unit:"",min:0,max:1,step:.01,default:1}],web:"worklet-pitchshift"},{id:"delay",label:"Delay",group:"time",description:"Repeating echoes behind the dry signal.",params:[{kind:"number",key:"time",automatable:!0,label:"Time",unit:"ms",min:1,max:5e3,step:1,default:250,scale:"log"},{kind:"number",key:"feedback",automatable:!0,label:"Feedback",unit:"",min:.01,max:.95,step:.01,default:.35},{kind:"number",key:"mix",automatable:!0,label:"Mix",unit:"",min:0,max:1,step:.01,default:.4}],web:"delay-feedback"},{id:"chorus",label:"Chorus",group:"time",description:"Detuned copies of the signal for width and thickness.",params:[{kind:"number",key:"delay",automatable:!0,label:"Delay",unit:"ms",min:1,max:100,step:.1,default:7},{kind:"number",key:"depth",automatable:!0,label:"Depth",unit:"ms",min:0,max:10,step:.01,default:2},{kind:"number",key:"speed",automatable:!0,label:"Rate",unit:"Hz",min:.01,max:10,step:.01,default:1},{kind:"number",key:"mix",automatable:!0,label:"Mix",unit:"",min:0,max:1,step:.01,default:.5}],web:"chorus-lfo"},{id:"phaser",label:"Phaser",group:"time",description:"Sweeping notches moving through the spectrum.",params:[{kind:"number",key:"in_gain",automatable:!0,label:"Input",unit:"",min:0,max:1,step:.01,default:.4},{kind:"number",key:"out_gain",automatable:!0,label:"Output",unit:"",min:0,max:2,step:.01,default:.74},{kind:"number",key:"delay",label:"Delay",unit:"ms",min:.1,max:5,step:.1,default:3},{kind:"number",key:"decay",label:"Decay",unit:"",min:0,max:.99,step:.01,default:.4},{kind:"number",key:"speed",automatable:!0,label:"Rate",unit:"Hz",min:.1,max:2,step:.01,default:.5},{kind:"enum",key:"type",label:"Waveform",options:[{value:"0",label:"Triangular"},{value:"1",label:"Sinusoidal"}],default:"0"}],web:"allpass-phaser"},{id:"reverb",label:"Reverb",group:"time",description:"Room tail. Both ends convolve the same generated impulse, so preview matches render.",params:[{kind:"number",key:"size",label:"Room size",unit:"",min:.05,max:1,step:.01,default:.7},{kind:"number",key:"damping",label:"Damping",unit:"",min:0,max:1,step:.01,default:.5,hint:"Higher rolls the top off the tail faster."},{kind:"number",key:"wet",automatable:!0,label:"Wet",unit:"",min:0,max:1,step:.01,default:.35},{kind:"number",key:"dry",automatable:!0,label:"Dry",unit:"",min:0,max:1,step:.01,default:.7}],web:"convolver"}],co=new Map(Tl.map(e=>[e.id,e]));function Sn(e){return co.get(e)}var Nv=Tl.map(e=>e.id);function An(e,t){let n=co.get(e);if(!n)return{};let r={};for(let i of n.params){let o=t?.[i.key];if(i.kind==="enum"){let l=i.options.some(s=>s.value===o);r[i.key]=l?o:i.default;continue}let a=typeof o=="number"?o:typeof o=="string"&&o.trim()!==""?Number(o):Number.NaN;r[i.key]=Number.isFinite(a)?Math.min(i.max,Math.max(i.min,a)):i.default}return r}var ct=class extends Error{constructor(t){super(t),this.name="AudioFxChainError"}};function Rl(e){let t;try{t=JSON.parse(e)}catch(i){throw new ct(`Chain file is not valid JSON: ${i.message}`)}if(typeof t!="object"||t===null)throw new ct("Chain file must be a JSON object.");let n=t;if(n.version!==wl)throw new ct(`Unsupported chain version: ${String(n.version)}`);if(!Array.isArray(n.nodes))throw new ct("Chain file is missing a `nodes` array.");let r=n.nodes.map(Rp);return{version:wl,nodes:r}}function En(e){return e.nodes.filter(t=>t.enabled!==!1)}function Rp(e,t){if(typeof e!="object"||e===null)throw new ct(`Node ${t} is not an object.`);let n=e;if(typeof n.type!="string"||!co.has(n.type))throw new ct(`Node ${t} has unknown effect type: ${String(n.type)}`);return Mp({type:n.type,id:Dr(n.id),fromCarve:_l(n.fromCarve),fromPreset:Dr(n.fromPreset),label:Dr(n.label),fromEq:Dr(n.fromEq),fromLeveller:_l(n.fromLeveller),presetAmount:kp(n.presetAmount),enabled:n.enabled!==!1,params:An(n.type,n.params??void 0)})}function Dr(e){return typeof e=="string"&&e?e:void 0}function _l(e){return e===!0?!0:void 0}function kp(e){if(!(typeof e!="number"||!Number.isFinite(e)))return Math.min(1,Math.max(0,e))}function Mp(e){for(let t of Object.keys(e))e[t]===void 0&&delete e[t];return e}var et="data-automation",Pv=et.slice(5),Ir=1,Fp=512,Ze=class extends Error{constructor(t){super(t),this.name="AudioAutomationError"}},Bt="volume";function Cn(e){if(e===Bt)return{kind:"volume"};let t=e.split(".");if(t.length===3&&t[0]==="fx"&&t[1]===Np){let i=t[2];return i?{kind:"preset",presetId:i}:null}if(t.length!==3||t[0]!=="fx")return null;let[,n,r]=t;return!n||!r?null:{kind:"fx",nodeId:n,param:r}}var Np="preset";var Lp={min:0,max:1,step:.01,unit:"",label:"Amount",scale:"linear",default:1},Pr={min:0,max:so,step:.01,unit:"",label:"Volume",scale:"linear",default:1};function fo(e,t){let n=Cn(e);if(!n)return null;if(n.kind==="volume")return Pr;if(n.kind==="preset")return t?.nodes.some(l=>l.fromPreset===n.presetId)?{...Lp,label:`${n.presetId} \\xB7 Amount`}:null;let r=t?.nodes.find(a=>a.id===n.nodeId);if(!r)return null;let i=Sn(r.type),o=i?.params.find(a=>a.key===n.param);return!o||o.kind!=="number"?null:{min:o.min,max:o.max,step:o.step,unit:o.unit,label:`${i?.label??r.type} \\xB7 ${o.label}`,scale:o.scale==="log"&&o.min>0?"log":"linear",default:o.default}}function wn(e){if(typeof e=="number")return Number.isFinite(e)?e:null;if(typeof e=="string"&&e.trim()!==""){let t=Number(e);return Number.isFinite(t)?t:null}return null}function Dp(e){let t=wn(e);return t===null||t===0?0:Math.min(1,Math.max(-1,t))}function kl(e,t){let n=wn(e),r=wn(t);if(n===null||r===null)return null;let i=l=>Math.min(.999,Math.max(.001,l)),o=i(n),a=i(r);return Math.abs(o-a)<1e-6?null:{x:o,y:a}}function Ip(e){let t=Dp(e?.curve),n=kl(e?.viaX,e?.viaY);return{...t?{curve:t}:{},...n?{viaX:n.x,viaY:n.y}:{}}}function Pp(e,t){let n=wn(e?.t),r=wn(e?.v);if(n===null||r===null)return null;let i=t?Math.min(t.max,Math.max(t.min,r)):r;return{t:Math.max(0,n),v:i,...Ip(e)}}function Ml(e,t){let n=e.map(i=>Pp(i,t)).filter(i=>i!==null).sort((i,o)=>i.t-o.t),r=[];for(let i of n)r.length>0&&r[r.length-1].t===i.t?r[r.length-1]=i:r.push(i);return r.slice(0,Fp)}function Op(e){let t=[];for(let n of e.lanes){if(!Cn(n.target))continue;let r=n.target===Bt?Pr:null,i=Ml(n.points??[],r);i.length>0&&t.push({target:n.target,points:i})}return{version:Ir,lanes:t}}function Fl(e,t){let n=[];for(let r of e.lanes){let i=fo(r.target,t);if(!i)continue;let o=Ml(r.points,i);o.length>0&&n.push({target:r.target,points:o})}return{version:Ir,lanes:n}}function Or(e){let t;try{t=JSON.parse(e)}catch(i){throw new Ze(`Automation is not valid JSON: ${i.message}`)}if(typeof t!="object"||t===null)throw new Ze("Automation must be a JSON object.");let n=t;if(n.version!==Ir)throw new Ze(`Unsupported automation version: ${String(n.version)}`);if(!Array.isArray(n.lanes))throw new Ze("Automation is missing a `lanes` array.");let r=n.lanes.map((i,o)=>{if(typeof i!="object"||i===null)throw new Ze(`Lane ${o} is not an object.`);let a=i;if(typeof a.target!="string"||!Cn(a.target))throw new Ze(`Lane ${o} has an unreadable target: ${String(a.target)}`);if(!Array.isArray(a.points))throw new Ze(`Lane ${o} is missing a \\`points\\` array.`);return{target:a.target,points:a.points}});return Op({version:Ir,lanes:r})}function Hp(e,t){return t?Math.pow(e,Math.pow(2,2*t)):e}function Gp(e,t){let n=e-.5,r=t-.5,i=.999,o=1e6,a=n>0?n/(i-e):n<0?-n/(e-(1-i)):0,l=r>0?r/(i-t):r<0?-r/(t-(1-i)):0,s=Math.min(o,Math.max(1,a,l));return{cx:e+n/s,cy:t+r/s,w:s}}function Bp(e,t,n){let{cx:r,cy:i,w:o}=Gp(t,n),a=2-2*o,l=e*a-1+2*o*r,s=-e*a-2*o*r,u=Up(l,s,e),c=1-u,f=c*c+2*o*u*c+u*u;return f>0?(2*o*i*u*c+u*u)/f:e}function Up(e,t,n){if(Math.abs(e)<1e-12)return Math.abs(t)<1e-12?n:-n/t;let r=Math.sqrt(Math.max(0,t*t-4*e*n)),i=(-t+r)/(2*e),o=(-t-r)/(2*e),a=l=>l>=-1e-9&&l<=1+1e-9;return a(i)?Math.min(1,Math.max(0,i)):a(o)?Math.min(1,Math.max(0,o)):n}function Wp(e,t){let n=kl(t.viaX,t.viaY);return n?Bp(Math.min(1,Math.max(0,e)),n.x,n.y):Hp(e,t.curve)}function Vp(e,t,n,r){return r==="log"&&e>0&&t>0?Math.exp(Math.log(e)+(Math.log(t)-Math.log(e))*n):e+(t-e)*n}function _n(e,t,n="linear"){let r=e.points;if(r.length===0)return 0;let i=r[0];if(t<=i.t)return i.v;let o=r[r.length-1];if(t>=o.t)return o.v;let a=0,l=r.length-1;for(;l-a>1;){let f=a+l>>1;r[f].t<=t?a=f:l=f}let s=r[a],u=r[l],c=u.t-s.t;return c<=0?u.v:Vp(s.v,u.v,Wp((t-s.t)/c,s),n)}function Nl(e){return e.points.length<=1||e.points.every(t=>t.v===e.points[0].v)}function Ll(e,t,n,r,i="linear"){let o=Math.max(2,Math.floor(r)),a=new Float32Array(o),l=n-t;for(let s=0;sr.target===Bt)??null}catch{n=null}return Hr.size>zp&&Hr.clear(),Hr.set(e,n),n}function Dl(e,t){let n=(typeof e.getAttribute=="function"?e.getAttribute(et):null)??"";if(!n)return null;let r=qp(n);return!r||r.points.length===0?null:_n(r,t)}var Ut="hf-audio-group",Gr="data-audio-group";function mo(e){let t=e?.getAttribute("data-volume"),n=t?parseFloat(t):1;return Number.isFinite(n)?n:1}function po(e,t){let n=Array.from(e?.querySelectorAll?.(`${Ut}[${xn}]`)??[]).find(i=>i.getAttribute(xn)===t);if(n)return n;let r=e?.getElementById(t)??null;return r&&r.tagName?.toLowerCase()===Ut?r:null}function Br(e,t){let n=t?.getAttribute?.(dl)??t?.getAttribute?.(Gr);return n?po(e,n)?.hasAttribute("data-hidden")??!1:!1}function Il(e){return typeof e.tagName!="string"||e.tagName.toLowerCase()!=="audio"||typeof e.getAttribute!="function"?null:e.getAttribute(Gr)||null}function Pl(e){let t="__hf-audio-group-inert";if(!e?.head||e.getElementById(t))return;let n=e.createElement("style");n.id=t,n.textContent=`${Ut}{display:none!important}`,e.head.appendChild(n)}function $e(e){return yn(e)}function Ol(e){let t=e.isVideo?e.explicitDuration??e.sourceDuration:e.sourceDuration,n=(e.isVideo?[t,e.hostRemaining]:[t,e.hostRemaining,e.explicitDuration]).filter(r=>r!=null&&Number.isFinite(r)&&r>=0);return n.length>0?Math.min(...n):null}function Hl(e){let t=Array.from(document.querySelectorAll("video, audio")),n=e?.shouldIncludeElement?t.filter(a=>e.shouldIncludeElement?.(a)):t.filter(a=>a.hasAttribute("data-start")),r=[],i=[],o=0;for(let a of n){let l=e?.resolveStartSeconds?e.resolveStartSeconds(a):Number.parseFloat(a.dataset.start??"0");if(!Number.isFinite(l))continue;let s=$e(a),u=_e(a),c=a.loop,f=Number.isFinite(a.duration)&&a.duration>0?a.duration:null,m=e?.resolveDurationSeconds?.(a)??Number.parseFloat(a.dataset.duration??"");(!Number.isFinite(m)||m<0)&&f!=null&&(m=Math.max(0,(f-s)/u));let p=Number.isFinite(m)&&m>=0,b=p?l+m:Number.POSITIVE_INFINITY,v=Number.parseFloat(a.dataset.volume??""),x={el:a,start:l,mediaStart:s,duration:p?m:Number.POSITIVE_INFINITY,end:b,volume:Number.isFinite(v)?v:null,playbackRate:u,loop:c,sourceDuration:f};r.push(x),a.tagName==="VIDEO"&&i.push(x),Number.isFinite(b)&&(o=Math.max(o,b))}return{timedMediaEls:n,mediaClips:r,videoClips:i,maxMediaEnd:o}}var go=new WeakMap,Ur=new WeakMap,Tn=new WeakMap,bo=new WeakSet,Wt=new WeakSet;function $p(e){if(Wt.has(e))return;Wt.add(e);let t=()=>Wt.delete(e);e.addEventListener("playing",t,{once:!0}),e.addEventListener("pause",t,{once:!0}),e.addEventListener("error",t,{once:!0})}var jp=3;function Kp(e){return e.error!=null||e.networkState===jp}var xo=new WeakMap;function ho(e){return Number.isFinite(e)?Math.max(0,Math.min(1,e)):1}function yo(e){go.delete(e),Ur.delete(e),Tn.delete(e),bo.delete(e),xo.delete(e)}function Gl(e){let t=!!(e.outputMuted||e.userMuted);for(let n of e.clips){let{el:r}=n;if(!r.isConnected)continue;let i=(e.timeSeconds-n.start)*n.playbackRate+n.mediaStart,o=r.tagName==="VIDEO"&&!n.loop,a=o&&n.sourceDuration!=null&&i>=n.sourceDuration&&e.timeSeconds>=n.start&&e.timeSeconds=n.mediaStart&&i=n.start&&e.timeSeconds=0&&(!r.ended||n.loop||a||u)){if(Ur.set(r,i),n.loop&&n.sourceDuration!=null&&n.sourceDuration>0){let H=n.sourceDuration-n.mediaStart;H>0&&i>=n.sourceDuration&&(i=n.mediaStart+(i-n.mediaStart)%H)}let m=ho(e.userVolume??1),p=Le(n.volume??1),b=xo.get(r),v=ho(r.volume),x,_=Dl(r,e.timeSeconds-n.start);if(_!==null)x=Le(_);else if(n.volumeKeyframes&&n.volumeKeyframes.length>0){let H=e.timeSeconds-n.start;x=Le(Sl(n.volumeKeyframes,H))}else e.isWebAudioRouted?.(r)?x=p:b===void 0?x=p>1?p:v:Math.abs(v-b)>1e-4?x=v:x=p;let T=r.closest("[data-hidden]")!==null||Br(r.ownerDocument,r)?0:ho(x*m);r.volume=T,xo.set(r,T),e.onElementVolume?.(r,T,x),(t||e.isWebAudioOwned?.(r))&&(r.muted=!0),r.preload!=="auto"&&(r.preload="auto");try{r.playbackRate=n.playbackRate*e.playbackRate}catch(H){L("runtime.media.site1",H)}let M=.04,D=2,E=r.currentTime||0,S=Math.abs(E-i),A=i-E,C=go.get(r);go.set(r,A);let F=C===void 0,I=!F&&Math.abs(A-C)>.5,q=S>3,W=r.tagName==="AUDIO"&&F&&E-i>M,Y=a&&S>.001||r.ended&&u&&S>.001||W||S>.5&&(F||I||q),k=r.tagName==="VIDEO"&&!r.paused,U=C!==void 0&&Math.abs(A-C)<.004,ie=!1;if(!k&&!Y&&!F&&U&&S>M){let H=(Tn.get(r)??0)+1;Tn.set(r,H),H>=D&&(ie=!0,Tn.set(r,0))}else S<=M&&Tn.set(r,0);let P=!k&&e.forceSync&&S>.02;if(Y||ie||P){if(!(r.tagName==="VIDEO"&&!!ut(r))){try{r.currentTime=i}catch(V){L("runtime.media.site2",V)}if(Math.abs(r.currentTime-i)>.5&&!bo.has(r)){bo.add(r),r.load();try{r.currentTime=i}catch(V){L("runtime.media.site3",V)}}}Wt.delete(r)}a?r.paused||r.pause():e.playing&&r.paused&&!Wt.has(r)&&!Kp(r)?($p(r),r.play().catch(H=>{Wt.delete(r),(H&&typeof H=="object"&&"name"in H?String(H.name??""):"")==="NotAllowedError"&&e.onAutoplayBlocked?.()})):!e.playing&&!r.paused&&r.pause();continue}let f=e.timeSeconds>=n.start&&e.timeSecondsn.length)&&(n=r);return n?t[n]??null:null}function Jp(e,t){let n=e.normalize("NFC").toLowerCase(),r=-1,i=null,o=!1;for(let[a,l]of Object.entries(t)){let s=a.normalize("NFC").toLowerCase();n.endsWith(s)&&(s.length>r?(r=s.length,i=l,o=!1):s.length===r&&(o=!0))}return o?null:i}function Ao(e,t){return t[e]??Xp(e,t)??Jp(e,t)}function Qp(e,t){let n=new URL(e,document.baseURI);return n.searchParams.set(Yp,t?t.hasAlpha?"vp8":"h264":"auto"),n.href}var Zp={cross_origin:"video reports zero decodable width but its source is cross-origin; no local proxy can be served for it",proxy_playback_failed:"the authoring proxy itself failed to decode; render output is unaffected",browser_safe_codec:"the file errored but its codec is browser-decodable; a proxy cannot help (the file itself is likely corrupt)",invalid_source_url:"the media source URL is malformed and cannot be proxied"};function Rt(e,t,n){if(Wl.has(e))return;Wl.add(e);let r=Zp[t];be({source:"hf-preview",type:"diagnostic",code:Ul,details:{asset:n,codecName:null,reason:t,note:r}}),console.info(`[hyperframes] ${Ul}: "${n}" (${t}): ${r}`)}function Eo(e,t=null,n="reactive"){if(Rn.has(e))return;let r=Wr(e),i;try{i=Qp(r,t)}catch(l){L("runtime.mediaProxy.swap",l),Rt(e,"invalid_source_url",r);return}Rn.add(e),yo(e),e.src=i,e.load();let o=t?.codecName??null;be({source:"hf-preview",type:"diagnostic",code:Bl,details:{asset:r,codecName:o,trigger:n,note:"render output is unaffected; only this preview element was swapped to an authoring proxy"}}),console.info(`[hyperframes] ${Bl}: "${r}" uses a codec (${o??"unknown"}) this browser can\'t decode; auto-swapped to an authoring proxy for this preview only. Render output is unaffected.`)}function Vl(e){if(vo(e)||!(e instanceof HTMLVideoElement)||Rn.has(e))return;let t=window.__HF_MEDIA_CODEC_MAP__;if(!t)return;let n=So(e);if(n===null)return;let r=Ao(n,t);if(!r||!r.browserHostile)return;let i=r.representativeMime?e.canPlayType(r.representativeMime):"";i==="probably"||i==="maybe"||Eo(e,r,"proactive")}function zl(e){if(vo(e)||!(e instanceof HTMLVideoElement)||e.videoWidth!==0)return;let t=Wr(e);if(Rn.has(e)){Rt(e,"proxy_playback_failed",t);return}let n=window.__HF_MEDIA_CODEC_MAP__;if(!n)return;let r=So(e);if(r===null){Rt(e,"cross_origin",t);return}let i=Ao(r,n);if(i&&!i.browserHostile){Rt(e,"browser_safe_codec",t);return}Eo(e,i,"reactive")}function ql(e){if(vo(e)||!(e instanceof HTMLVideoElement))return;let t=Wr(e);if(Rn.has(e)){Rt(e,"proxy_playback_failed",t);return}let n=window.__HF_MEDIA_CODEC_MAP__;if(!n)return;let r=So(e);if(r===null){Rt(e,"cross_origin",t);return}let i=Ao(r,n);if(i&&!i.browserHostile){Rt(e,"browser_safe_codec",t);return}Eo(e,i,"tertiary")}var Se=class extends Error{constructor(n,r=null){super(r==null?n:`${n} at line ${r}`);ge(this,"lineNumber");this.name="CubeLutParseError",this.lineNumber=r}},eh=[0,0,0],th=[1,1,1],Vr=64;function nh(e){let t=!1;for(let n=0;nn)throw new Se(`LUT_3D_SIZE ${l} exceeds max ${n}`,m);continue}if(!oh(v)){if(v.startsWith("LUT_"))throw new Se(`Unsupported cube keyword ${v}`,m);continue}if(!l)throw a?new Se("1D cube LUTs are not supported yet",m):new Se("LUT data appears before LUT_3D_SIZE",m);if(b.length!==3)throw new Se("LUT data rows must contain three numbers",m);s.push(dt(b[0],m),dt(b[1],m),dt(b[2],m))}if(a&&l)throw new Se("Mixed 1D and 3D cube LUTs are not supported yet");if(!l)throw a?new Se("1D cube LUTs are not supported yet"):new Se("Missing LUT_3D_SIZE");rh(i,o);let c=l*l*l;if(s.length!==c*3)throw new Se(`Expected ${c} LUT rows for size ${l}, found ${s.length/3}`);return{title:r,size:l,domainMin:i,domainMax:o,data:new Float32Array(s)}}function ah(e){return Number.isFinite(e)?Math.min(1,Math.max(0,e)):0}function kn(e){return Math.round(ah(e)*255)}function wo(e){let t=e.size,n=t*t,r=t,i=new Uint8Array(n*r*4);for(let o=0;o3*Math.abs(n)?3*n:i}function Ae(e,t){let n=e[t];if(n===void 0)throw new RangeError("Color curve points must be contiguous");return n}function sh(e){let t=[],n=[],r=Ae(e,0);for(let a of e.slice(1)){let l=a[0]-r[0];t.push(l),n.push((a[1]-r[1])/l),r=a}let i=Ae(n,0);if(e.length===2)return[i,i];let o=new Array(e.length);o[0]=nu(Ae(t,0),Ae(t,1),i,Ae(n,1)),o[o.length-1]=nu(Ae(t,t.length-1),Ae(t,t.length-2),Ae(n,n.length-1),Ae(n,n.length-2));for(let a=1;a=n)throw new RangeError("Curve output bounds must be finite and increasing");if(e.some(([,r])=>rn))throw new RangeError(`Curve outputs must be between ${t} and ${n}`)}function uh(e,t,n,r,i){let o=n[0]-t[0],a=Math.min(1,Math.max(0,(e-t[0])/o)),l=a*a,s=l*a;return(2*s-3*l+1)*t[1]+(s-2*l+a)*o*r+(-2*s+3*l)*n[1]+(s-l)*o*i}function iu(e,t,n,r,i){lh(e,r,i);let o=sh(e),a=new Float32Array(t),l=0;for(let s=0;sAe(e,l+1)[0];)l+=1;let c=Ae(e,l),f=Ae(e,l+1),m=uh(u,c,f,Ae(o,l),Ae(o,l+1));a[s]=Math.min(i,Math.max(r,m))}return a}function Vt(e,t=je){if(ru(e,t),e.length>Mn)throw new RangeError(`A color curve supports at most ${Mn} points`);if(e.some(([n])=>n<0||n>1))throw new RangeError("Color curve inputs must be between 0 and 1");if(e[0]?.[0]!==0||e[e.length-1]?.[0]!==1)throw new RangeError("Color curves must include input endpoints 0 and 1");return iu(e,t,n=>n/(t-1),0,1)}function _o(e,t,n,r=je){if(e.length<3)throw new RangeError("A hue curve requires at least three points");if(e.length>Mn)throw new RangeError(`A hue curve supports at most ${Mn} points`);let i=[...e].sort((s,u)=>s[0]-u[0]);for(let s=0;s=360)throw new RangeError("Hue curve inputs must be from 0 up to 360 degrees");if(s>0&&u[0]===i[s-1]?.[0])throw new RangeError("Hue curve inputs must be unique")}let o=i.slice(-2).map(([s,u])=>[s-360,u]),a=i.slice(0,2).map(([s,u])=>[s+360,u]),l=[...o,...i,...a];return ru(l,r),iu(l,r,s=>s/r*360,t,n)}var Fn="data-color-grading",Nn="data-hf-color-grading-source-hidden",$r="data-hf-authored-opacity",uu="__hf_color_grading_",dh=Yl,ko={exposure:0,contrast:0,highlights:0,shadows:0,whites:0,blacks:0,temperature:0,tint:0,vibrance:0,saturation:0},Mo={vignette:0,vignetteMidpoint:.5,vignetteRoundness:0,vignetteFeather:.65,grain:0,grainSize:.25,grainRoughness:.5},Fo={blur:0,pixelate:0,chromaBleed:0,tapeDamage:0,tapeTracking:0,tapeNoise:1,tapeSpeed:.5,filmArtifacts:0,halftone:0,halftoneSize:0,twoInkPrint:0,twoInkPrintSize:0,ascii:0,asciiSize:5/76,asciiInvert:0,asciiStyle:0,asciiColor:1,asciiRotation:0,dither:0,ditherSize:0,bloom:0,bloomRadius:8,monoScreen:0,monoScreenSize:0,monoScreenAngle:0,monoScreenSpread:0,monoScreenShape:0,monoScreenInvert:0,scanlines:0,scanlineCount:0,scanlineSoftness:0,chromaticAberration:0,chromaticAngle:0,crtCurvature:0,digitalGlitch:0,digitalGlitchColorSplit:0,digitalGlitchLineTear:0,digitalGlitchPixelate:0,digitalGlitchBlockAmount:0,digitalGlitchBlockDisplacement:0,digitalGlitchBlockOpacity:0,digitalGlitchSpeed:0,engraving:0,engravingSpacing:7/17,engravingMinThickness:.2,engravingMaxThickness:3.2/7,engravingAngle:.25,engravingContrast:7/15,engravingSharpness:.59,engravingWave:.2,engravingWaveFrequency:2/9,crosshatch:0,crosshatchSpacing:7/25,crosshatchThickness:.25,crosshatchAngle:.25,crosshatchContrast:1/3,crosshatchEdges:.5,crosshatchLineWeight:0,crosshatchWave:.33,crosshatchWaveFrequency:2/9,kuwahara:0,kuwaharaRadius:1/7,kuwaharaSharpness:5/16,kuwaharaSaturation:.5};var jr=Xl,cu=Jl,du=Ql,fu=Zl,Lo=eu,Do=tu,ou={exposure:.03,contrast:-.12,highlights:-.1,shadows:.16,whites:-.04,blacks:.08,temperature:.13,vibrance:-.08,saturation:-.08},au={vignette:.18};function Ee(e,t,n={},r={},i={},o=1){return{id:e,label:t,intensity:o,adjust:{...ko,...n},details:{...Mo,...r},effects:{...Fo,...i}}}var Io=[Ee("neutral","Neutral"),Ee("warm-daylight","Warm Daylight",{exposure:.06,contrast:.07,highlights:-.06,shadows:.08,temperature:.18,saturation:.08}),Ee("clean-studio","Clean Studio",{contrast:.08,highlights:-.08,shadows:.06,temperature:-.08,tint:.03,saturation:.04}),Ee("skin-soft","Skin Soft",{exposure:.04,contrast:-.03,highlights:-.12,shadows:.12,temperature:.08,tint:.02,saturation:.04}),Ee("food-pop","Food Pop",{exposure:.06,contrast:.1,shadows:.06,temperature:.14,vibrance:.1,saturation:.18}),Ee("night-lift","Night Lift",{exposure:.08,contrast:.08,highlights:-.18,shadows:.2,blacks:-.08,saturation:.04},{vignette:.12}),Ee("muted-editorial","Muted Editorial",{exposure:-.02,contrast:.08,highlights:-.08,shadows:.06,blacks:-.05,temperature:-.03,saturation:-.12},{vignette:.1}),Ee("vintage-wash","Vintage Wash",ou,au),Ee("mono-clean","Mono Clean",{contrast:.12,highlights:-.04,shadows:.04,blacks:-.08,saturation:-1}),Ee("mono-fade","Mono Fade",{contrast:-.04,highlights:-.06,shadows:.1,blacks:.12,saturation:-1},{vignette:.08}),Ee("soft-boost","Soft Boost",{exposure:.06,contrast:-.04,highlights:-.14,shadows:.16,vibrance:.08,saturation:.1}),Ee("bright-pop","Bright Pop",{exposure:.12,contrast:.12,whites:.08,blacks:-.04,vibrance:.08,saturation:.14}),Ee("deep-contrast","Deep Contrast",{exposure:-.03,contrast:.2,highlights:-.08,shadows:-.08,blacks:-.12,saturation:.06}),Ee("creator-camcorder","Creator Camcorder",{contrast:.08,highlights:-.05,shadows:.02,whites:.03,blacks:-.04,temperature:-.03,tint:-.015,vibrance:-.03,saturation:-.06},{vignette:.06,grain:.08,grainSize:.18,grainRoughness:.58},{chromaBleed:.55},.72),Ee("vhs-playback","VHS Playback",{contrast:-.04,saturation:-.08},{grain:.16,grainSize:.12,grainRoughness:.72},{tapeDamage:.82,tapeTracking:.85,tapeNoise:.3,tapeSpeed:.5,chromaBleed:.5,chromaticAberration:.18,scanlines:.35,scanlineCount:.17,scanlineSoftness:1,digitalGlitch:.32,digitalGlitchLineTear:.08,digitalGlitchSpeed:.5}),Ee("home-movie-8mm","8mm Home Movie",ou,{...au,vignette:.28,vignetteMidpoint:.54,vignetteFeather:.72,grain:.34,grainSize:.18,grainRoughness:.72},{filmArtifacts:.62},.72),Ee("editorial-halftone","Editorial Halftone",{contrast:.04,saturation:.04},{},{halftone:.94,halftoneSize:.36}),Ee("two-ink-print","Two-Ink Print",{contrast:.08,highlights:-.06,shadows:.04},{},{twoInkPrint:1,twoInkPrintSize:.42})],fh=new Map(Io.map(e=>[e.id,e])),mh=/^\\$(?:\\{([A-Za-z0-9_.:-]+)\\}|([A-Za-z0-9_.:-]+))$/,ph={exposure:{min:-2,max:2},contrast:{min:-1,max:1},highlights:{min:-1,max:1},shadows:{min:-1,max:1},whites:{min:-1,max:1},blacks:{min:-1,max:1},temperature:{min:-1,max:1},tint:{min:-1,max:1},vibrance:{min:-1,max:1},saturation:{min:-1,max:1}},zt={hue:0,amount:0,level:0},su={amount:me.unit,level:me.signedUnit},ft=[[0,0],[1,1]],qt=[],hh={hueVsHue:me.secondaryHueShift,hueVsSaturation:me.signedUnit,hueVsLuma:me.signedUnit},To={center:0,range:180,softness:0},Ro={min:0,max:1,softness:.05},gh={vignette:me.unit,vignetteMidpoint:me.unit,vignetteRoundness:me.signedUnit,vignetteFeather:me.unit,grain:me.unit,grainSize:me.unit,grainRoughness:me.unit},No=me.unit,bh=me.effects,mu=["blur","pixelate","chromaBleed","tapeDamage","filmArtifacts","halftone","twoInkPrint","ascii","dither","bloom","monoScreen","scanlines","chromaticAberration","crtCurvature","digitalGlitch","engraving","crosshatch","kuwahara"];var xh=Io.filter(e=>mu.some(t=>e.effects[t]>1e-4)),gS=Io.filter(e=>!xh.includes(e)),bS={blur:{blur:.45},pixelate:{pixelate:.55},bloom:{bloom:.55,bloomRadius:8},chromaBleed:{chromaBleed:.55},tapeDamage:{tapeDamage:.65,tapeTracking:.55,tapeNoise:.25,tapeSpeed:.5},filmArtifacts:{filmArtifacts:.55},scanlines:{scanlines:.35,scanlineCount:.17,scanlineSoftness:1},chromaticAberration:{chromaticAberration:.15,chromaticAngle:0},crtCurvature:{crtCurvature:.2},digitalGlitch:{digitalGlitch:.55,digitalGlitchColorSplit:.25,digitalGlitchLineTear:.25,digitalGlitchPixelate:.15,digitalGlitchBlockAmount:.5,digitalGlitchBlockDisplacement:.25,digitalGlitchBlockOpacity:0,digitalGlitchSpeed:.5},halftone:{halftone:.94,halftoneSize:.36},twoInkPrint:{twoInkPrint:1,twoInkPrintSize:.42},ascii:{ascii:1,asciiSize:5/76,asciiInvert:0,asciiStyle:0,asciiColor:1,asciiRotation:0},dither:{dither:1,ditherSize:.5},monoScreen:{monoScreen:1,monoScreenSize:.35,monoScreenAngle:.25,monoScreenSpread:.3,monoScreenShape:0,monoScreenInvert:0},engraving:{engraving:1,engravingSpacing:7/17,engravingMinThickness:.2,engravingMaxThickness:3.2/7,engravingAngle:.25,engravingContrast:7/15,engravingSharpness:.59,engravingWave:.2,engravingWaveFrequency:2/9},crosshatch:{crosshatch:1,crosshatchSpacing:7/25,crosshatchThickness:.25,crosshatchAngle:.25,crosshatchContrast:1/3,crosshatchEdges:.5,crosshatchLineWeight:0,crosshatchWave:.33,crosshatchWaveFrequency:2/9},kuwahara:{kuwahara:1,kuwaharaRadius:1/7,kuwaharaSharpness:5/16,kuwaharaSaturation:.5}},pu=[{path:"intensity",name:"--hf-color-grading-intensity",min:0,max:1},{path:"lut.intensity",name:"--hf-color-grading-lut-intensity",min:0,max:1},{path:"adjust.exposure",name:"--hf-color-grading-exposure",min:-2,max:2},{path:"effects.blur",name:"--hf-color-grading-blur",min:0,max:1},{path:"effects.bloom",name:"--hf-color-grading-bloom",min:0,max:3},{path:"effects.kuwahara",name:"--hf-color-grading-kuwahara",min:0,max:1},{path:"effects.pixelate",name:"--hf-color-grading-pixelate",min:0,max:1},{path:"effects.ascii",name:"--hf-color-grading-ascii",min:0,max:1},{path:"effects.dither",name:"--hf-color-grading-dither",min:0,max:1}];var yh=/^#[0-9a-f]{6}$/i;function vh(e){return!Array.isArray(e)||e.length<2||e.length>6||!e.every(t=>typeof t=="string"&&yh.test(t))?null:e.map(t=>t.toLowerCase())}function Te(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function qr(e,t,n){return Number.isFinite(e)?Math.min(n,Math.max(t,e)):0}function hu(e,t){let n=typeof e=="number"?e:Number(e);return Number.isFinite(n)?Math.min(1,Math.max(0,n)):t}function Re(e,t){let n=typeof e=="number"?e:Number(e);return Number.isFinite(n)?qr(n,t.min,t.max):0}function Po(e,t=0){let n=typeof e=="number"?e:Number(e);return Number.isFinite(n)?(n%360+360)%360:t}function Sh(e){let t=Te(e)?e:{};return cu.reduce((n,r)=>{let i=Te(t[r])?t[r]:{};return n[r]={hue:Po(i.hue,zt.hue),amount:Re(i.amount??zt.amount,su.amount),level:Re(i.level??zt.level,su.level)},n},{shadows:{...zt},midtones:{...zt},highlights:{...zt}})}function Ah(e){if(!Array.isArray(e)||e.length!==2)return null;let t=Number(e[0]),n=Number(e[1]);return Number.isFinite(t)&&Number.isFinite(n)?[qr(t,0,1),qr(n,0,1)]:null}function gu(e){return e.some((t,n)=>n>0&&t[0]===e[n-1]?.[0])}function Eh(e){(e[0]?.[0]??0)>0&&e.unshift([0,0]),(e.at(-1)?.[0]??1)<1&&e.push([1,1])}function wh(e){if(!Array.isArray(e)||e.length<2)return ft;let t=[];for(let n of e){let r=Ah(n);if(!r)return ft;t.push(r)}return t.sort((n,r)=>n[0]-r[0]),gu(t)||(Eh(t),t.length>16)?ft:t}function Ch(e){let t=Te(e)?e:{};return du.reduce((n,r)=>(n[r]=wh(t[r]),n),{master:ft,red:ft,green:ft,blue:ft})}function _h(e,t){if(!Array.isArray(e)||e.length!==2)return null;let n=Number(e[0]),r=Number(e[1]);return Number.isFinite(n)&&Number.isFinite(r)?[Po(n),qr(r,t.min,t.max)]:null}function Th(e,t){if(!Array.isArray(e)||e.length<3||e.length>16)return qt;let n=[];for(let r of e){let i=_h(r,t);if(!i)return qt;n.push(i)}return n.sort((r,i)=>r[0]-i[0]),gu(n)?qt:n}function Rh(e){let t=Te(e)?e:{};return fu.reduce((n,r)=>(n[r]=Th(t[r],hh[r]),n),{hueVsHue:qt,hueVsSaturation:qt,hueVsLuma:qt})}function lu(e){let t=Te(e)?e:{},n=Re(t.min??Ro.min,No),r=Re(t.max??Ro.max,No);return{min:Math.min(n,r),max:Math.max(n,r),softness:Re(t.softness??Ro.softness,me.secondarySoftRangeSoftness)}}function kh(e){let t=Te(e)?e:{},n=Re(t.range??To.range,me.secondaryHueRange);return{center:Po(t.center,To.center),range:n,softness:Re(t.softness??To.softness,{min:me.secondaryHueSoftness.min,max:me.secondaryHueCombinedMax-n})}}function Mh(e){return{hueShift:Re(e.hueShift??0,me.secondaryHueShift),saturation:Re(e.saturation??0,me.signedUnit),luma:Re(e.luma??0,me.signedUnit),temperature:Re(e.temperature??0,me.signedUnit),tint:Re(e.tint??0,me.signedUnit)}}function Fh(e){return!Te(e)||!Te(e.key)||!Te(e.correction)?null:{enabled:e.enabled!==!1,key:{hue:kh(e.key.hue),saturation:lu(e.key.saturation),luma:lu(e.key.luma)},correction:Mh(e.correction)}}function Nh(e){if(!Array.isArray(e))return[];let t=[];for(let n of e.slice(0,4)){let r=Fh(n);r&&t.push(r)}return t}function Lh(e){if(e==null)return null;let t=String(e).trim();return t||null}function Dh(e){if(e==null)return null;if(typeof e=="string"){let n=e.trim();return n?{src:n,intensity:1}:null}if(!Te(e))return null;let t=e.src;return typeof t!="string"||t.trim()===""?null:{src:t.trim(),intensity:hu(e.intensity,1)}}function Ih(e){if(typeof e=="string"){let t=e.trim();if(!t)return null;if(t.startsWith("{"))try{let n=JSON.parse(t);return Te(n)?n:null}catch{return null}return{preset:t}}return Te(e)?e:null}function Ph(e,t){let n=e.trim().match(mh);if(!n)return e;let r=n[1]??n[2]??"";return r&&Object.hasOwn(t,r)?t[r]:e}function zr(e,t){if(typeof e=="string"){let r=Ph(e,t);if(r!==e)return r;let i=e.trim();if(!i.startsWith("{"))return e;try{return zr(JSON.parse(i),t)}catch{return e}}if(Array.isArray(e))return e.map(r=>zr(r,t));if(!Te(e))return e;let n={};for(let[r,i]of Object.entries(e))n[r]=zr(i,t);return n}function Oh(e){return e?fh.get(e)??null:null}function Kr(e){let t=Ih(e);if(!t||t.enabled===!1)return null;let n=Lh(t.preset),r=Oh(n),i=r?.adjust??ko,o=r?.details??Mo,a=r?.effects??Fo,l=Te(t.adjust)?t.adjust:{},s=Te(t.details)?t.details:{},u=Te(t.effects)?t.effects:{},c=jr.reduce((p,b)=>(p[b]=Re(l[b]??i[b],ph[b]),p),{...ko}),f=Lo.reduce((p,b)=>(p[b]=Re(s[b]??o[b],gh[b]),p),{...Mo}),m=Do.reduce((p,b)=>(p[b]=Re(u[b]??a[b],bh[b]??No),p),{...Fo});return{enabled:!0,preset:n,intensity:hu(t.intensity,r?.intensity??1),adjust:c,wheels:Sh(t.wheels),curves:Ch(t.curves),hueCurves:Rh(t.hueCurves),secondaries:Nh(t.secondaries),details:f,effects:m,palette:vh(t.palette),lut:Dh(t.lut),colorSpace:typeof t.colorSpace=="string"&&t.colorSpace.trim()?t.colorSpace.trim():dh}}function bu(e,t){return Kr(zr(e,t))}function Hh(e){return cu.some(t=>Math.abs(e[t].amount)>1e-4||Math.abs(e[t].level)>1e-4)}function Oo(e){return du.some(t=>e[t].some(([n,r])=>Math.abs(n-r)>1e-4))}function Ho(e){return fu.some(t=>e[t].some(([,n])=>Math.abs(n)>1e-4))}function Go(e){return e.some(t=>t.enabled&&Object.values(t.correction).some(n=>Math.abs(n)>1e-4))}function xu(e){return e?.enabled?Math.abs(e.details.vignette)>1e-4||Math.abs(e.details.grain)>1e-4||mu.some(n=>Math.abs(e.effects[n])>1e-4)?!0:e.intensity===0?!1:e.lut&&e.lut.intensity!==0?!0:jr.some(n=>Math.abs(e.adjust[n])>1e-4)||(e.wheels?Hh(e.wheels):!1)||(e.curves?Oo(e.curves):!1)||(e.hueCurves?Ho(e.hueCurves):!1)||(e.secondaries?Go(e.secondaries):!1):!1}var Gh=["[data-hyperframes-ignore]","[data-hyperframes-picker-ignore]","[data-hf-ignore]","[data-no-inspect]","[data-no-pick]","[data-hyper-shader-loading]"].join(","),Bh=["[data-hyperframes-picker-block]","[data-hyper-shader-loading]"].join(",");function yu(e){let t=!1,n=null,r=null,i=null,o=null;function a(S,A){try{window.dispatchEvent(new CustomEvent(S,{detail:A}))}catch(C){L("runtime.picker.site1",C)}}function l(S){i=S,a("hyperframe:picker:hovered",{elementInfo:i,isPickMode:t,timestamp:Date.now()})}function s(S){o=S,a("hyperframe:picker:selected",{elementInfo:o,isPickMode:t,timestamp:Date.now()})}function u(S){let A=S.ownerDocument.defaultView;if(!A)return!1;let C=S;for(;C&&C!==document.body&&C!==document.documentElement;){let F=A.getComputedStyle(C);if(F.display==="none"||F.visibility==="hidden"||F.pointerEvents==="none")return!0;let I=Number.parseFloat(F.opacity);if(Number.isFinite(I)&&I<=.01&&!C.hasAttribute(Nn))return!0;C=C.parentElement}return!1}function c(S){if(!S||S===document.body||S===document.documentElement)return!1;let A=S.tagName.toLowerCase();return!(A==="script"||A==="style"||A==="link"||A==="meta"||S.classList.contains("__hf-pick-highlight")||S.closest(Gh)||u(S))}function f(S){return!!S?.closest(Bh)}function m(S){let A=S;if(A.id)return`#${CSS.escape(A.id)}`;let C=S.getAttribute("data-composition-id");if(C)return`[data-composition-id="${CSS.escape(C)}"]`;let F=S.getAttribute("data-composition-src");if(F)return`[data-composition-src="${CSS.escape(F)}"]`;let I=S.getAttribute("data-track-index");if(I)return`[data-track-index="${CSS.escape(I)}"]`;let q=S.tagName.toLowerCase(),W=S.parentElement;if(!W)return q;let Y=W.querySelectorAll(`:scope > ${q}`);if(Y.length===1)return q;for(let k=0;kI.length>q?`${I.slice(0,q-1)}\\u2026`:I;return A==="h1"||A==="h2"||A==="h3"?"Heading":A==="p"||A==="span"||A==="div"?C.length>0?F(C,56):"Text":A==="img"?"Image":A==="video"?"Video":A==="audio"?"Audio":A==="svg"?"Shape":S.getAttribute("data-composition-src")?"Composition":A==="section"?"Section":`${A.charAt(0).toUpperCase()}${A.slice(1)}`}function b(S,A,C){let F=typeof C=="number"&&C>0?C:8,I=[];if(document.elementsFromPoint)I=document.elementsFromPoint(S,A);else if(document.elementFromPoint){let Y=document.elementFromPoint(S,A);I=Y?[Y]:[]}if(f(I[0]??null))return[];let q={},W=[];for(let[Y,k]of I.entries()){if(!c(k))continue;let U=`${k.tagName}::${k.id||""}::${Y}`;if(!q[U]&&(q[U]=!0,W.push(k),W.length>=F))break}return W}function v(S){let A=S.getBoundingClientRect(),C={};for(let I of Array.from(S.attributes))I.name.startsWith("data-")&&(C[I.name]=I.value);return{id:S.id||null,tagName:S.tagName.toLowerCase(),selector:m(S),label:p(S),boundingBox:{x:A.left,y:A.top,width:A.width,height:A.height},textContent:S.textContent?S.textContent.trim().slice(0,200):null,src:S.getAttribute("src")||S.getAttribute("data-composition-src")||null,dataAttributes:C}}function x(S,A,C){return b(S,A,C).map(v)}function _(S){if(!t)return;let C=b(S.clientX,S.clientY,1)[0]??(S.target instanceof Element?S.target:null);if(!c(C)||n===C)return;n&&n.classList.remove("__hf-pick-highlight"),n=C,C.classList.add("__hf-pick-highlight");let F=v(C);l(F),e.postMessage({source:"hf-preview",type:"element-hovered",elementInfo:F})}function R(S){if(!t)return;S.preventDefault(),S.stopPropagation(),S.stopImmediatePropagation();let A=x(S.clientX,S.clientY,8);A.length!==0&&(l(A[0]??null),e.postMessage({source:"hf-preview",type:"element-pick-candidates",candidates:A,selectedIndex:0,point:{x:S.clientX,y:S.clientY}}))}function T(S){S.key==="Escape"&&(D(),e.postMessage({source:"hf-preview",type:"pick-mode-cancelled"}))}function M(){t||(t=!0,r=document.createElement("style"),r.textContent=[".__hf-pick-highlight { outline: 2px solid #4f8cf7 !important; outline-offset: 2px; cursor: crosshair !important; }",".__hf-pick-active * { cursor: crosshair !important; }"].join(`\n`),document.head.appendChild(r),document.body.classList.add("__hf-pick-active"),document.addEventListener("mousemove",_,!0),document.addEventListener("click",R,!0),document.addEventListener("keydown",T,!0),a("hyperframe:picker:mode",{isPickMode:!0,timestamp:Date.now()}))}function D(){t&&(t=!1,n&&(n.classList.remove("__hf-pick-highlight"),n=null),r&&(r.remove(),r=null),document.body.classList.remove("__hf-pick-active"),document.removeEventListener("mousemove",_,!0),document.removeEventListener("click",R,!0),document.removeEventListener("keydown",T,!0),a("hyperframe:picker:mode",{isPickMode:!1,timestamp:Date.now()}))}function E(){window.__HF_PICKER_API={enable:M,disable:D,isActive:()=>t,getHovered:()=>i,getSelected:()=>o,getCandidatesAtPoint:(S,A,C)=>Number.isFinite(S)&&Number.isFinite(A)?x(S,A,C):[],pickAtPoint:(S,A,C)=>{if(!Number.isFinite(S)||!Number.isFinite(A))return null;let F=x(S,A,8);if(!F.length)return null;let I=Math.max(0,Math.min(F.length-1,Number(C??0))),q=F[I]??null;return q?(s(q),e.postMessage({source:"hf-preview",type:"element-picked",elementInfo:q}),D(),q):null},pickManyAtPoint:(S,A,C)=>{if(!Number.isFinite(S)||!Number.isFinite(A))return[];let F=x(S,A,8);if(!F.length)return[];let I=[],q=Array.isArray(C)?C:[0];for(let W of q){let Y=Math.max(0,Math.min(F.length-1,Math.floor(Number(W)))),k=F[Y];if(!k)continue;I.some(ie=>ie.selector===k.selector&&ie.tagName===k.tagName)||I.push(k)}return I.length?(s(I[0]??null),e.postMessage({source:"hf-preview",type:"element-picked-many",elementInfos:I}),D(),I):[]}},a("hyperframe:picker:api-ready",{hasApi:!0,timestamp:Date.now()})}return{enablePickMode:M,disablePickMode:D,installPickerApi:E}}var Uh=["width","height","top","left","right","bottom","inset","object-fit","object-position","z-index","opacity","visibility","filter","mix-blend-mode","backdrop-filter","border-radius","overflow","clip-path","mask","mask-image","mask-size","mask-position","mask-repeat","transform","transform-origin","translate","rotate","scale","box-sizing"];function $t(e,t){let n=Number.isFinite(t)&&t>0?t:30,r=Number.isFinite(e)&&e>0?e:0;return Math.floor(r*n+1e-9)/n}function vu(e,t,n=Uh){for(let r of n){let i=t.getPropertyValue(r);i&&e.setProperty(r,i)}}function Ln(e,t,n){let r=e?.[t];return typeof r=="function"?Number(r.call(e))||n:typeof r=="number"&&Number.isFinite(r)?r:(r!=null&&L("runtime.player.nonConformantNum",{prop:t,actual:typeof r}),n)}function Ue(e,t){let n=e?.[t];if(typeof n=="function"){n.call(e);return}n!==void 0&&L("runtime.player.nonConformantVoid",{method:t,actual:typeof n})}function Dn(e,t,n){if(e){for(let r of Object.values(e))if(!(!r||r===t))try{n(r)}catch(i){L("runtime.player.site1",i)}}}function Su(e,t,n,r){let i=$t(t,n),o=r?.suppressEvents===!0;return Ue(e,"pause"),typeof e.totalTime=="function"?e.totalTime(i,o):typeof e.seek=="function"&&e.seek(i,o),i}function Wh(e,t,n,r,i){let o=[];Dn(e,t,a=>{Ue(a,"play"),o.push(a)});try{return Su(t,n,r,i)}finally{for(let a of o)try{Ue(a,"pause")}catch(l){L("runtime.player.site2",l)}}}function Vh(e,t){Dn(e,t,n=>{Ue(n,"play")})}function Au(e){let t=e.transport;return t?{_timeline:null,play:()=>t.play(),pause:()=>t.pause(),seek:(n,r)=>t.seek(n,r),renderSeek:(n,r)=>t.renderSeek(n,r),getTime:()=>t.getTime(),getDuration:()=>t.getDuration(),isPlaying:()=>t.isPlaying(),setPlaybackRate:n=>t.setPlaybackRate(n),getPlaybackRate:()=>t.getPlaybackRate()}:{_timeline:null,play:()=>{let n=e.getTimeline();if(!n||e.getIsPlaying())return;let r=Math.max(0,Number(e.getSafeDuration?.()??Ln(n,"duration",0))||0);r>0&&Math.max(0,Ln(n,"time",0))>=r&&(Ue(n,"pause"),typeof n.seek=="function"&&n.seek(0,!1),e.onDeterministicSeek(0),e.setIsPlaying(!1),e.onSyncMedia(0,!1),e.onRenderFrameSeek(0)),typeof n.timeScale=="function"&&n.timeScale(e.getPlaybackRate()),Ue(n,"play"),Dn(e.getTimelineRegistry?.(),n,i=>{typeof i.timeScale=="function"&&i.timeScale(e.getPlaybackRate()),Ue(i,"play")}),e.onDeterministicPlay(),e.setIsPlaying(!0),e.onShowNativeVideos(),e.onStatePost(!0)},pause:()=>{let n=e.getTimeline();if(!n)return;Ue(n,"pause"),Dn(e.getTimelineRegistry?.(),n,i=>{Ue(i,"pause")});let r=Math.max(0,Ln(n,"time",0));e.onDeterministicSeek(r),e.onDeterministicPause(),e.setIsPlaying(!1),e.onSyncMedia(r,!1),e.onRenderFrameSeek(r),e.onStatePost(!0)},seek:(n,r)=>{let i=e.getTimeline();if(!i)return;let o=Math.max(0,Number(n)||0),a=e.getIsPlaying(),l=Wh(e.getTimelineRegistry?.(),i,o,e.getCanonicalFps());e.onDeterministicSeek(l),r?.keepPlaying&&a?(typeof i.timeScale=="function"&&i.timeScale(e.getPlaybackRate()),Ue(i,"play"),Dn(e.getTimelineRegistry?.(),i,s=>{typeof s.timeScale=="function"&&s.timeScale(e.getPlaybackRate()),Ue(s,"play")}),e.onDeterministicPlay(),e.onShowNativeVideos(),e.onSyncMedia(l,!0)):(e.setIsPlaying(!1),e.onSyncMedia(l,!1)),e.onRenderFrameSeek(l),e.onStatePost(!0)},renderSeek:(n,r)=>{let i=e.getTimeline(),o=e.getCanonicalFps(),a=i?(Vh(e.getTimelineRegistry?.(),i),Su(i,n,o,r)):$t(Math.max(0,Number(n)||0),o);e.onDeterministicSeek(a,r),e.setIsPlaying(!1),e.onSyncMedia(a,!1),e.onRenderFrameSeek(a),e.onStatePost(!0)},getTime:()=>Ln(e.getTimeline(),"time",0),getDuration:()=>Ln(e.getTimeline(),"duration",0),isPlaying:()=>e.getIsPlaying(),setPlaybackRate:n=>e.setPlaybackRate(n),getPlaybackRate:()=>e.getPlaybackRate()}}function Eu(){return{capturedTimeline:null,isPlaying:!1,currentTime:0,deterministicAdapters:[],canonicalFps:30,bridgeMuted:!1,bridgeVolume:1,mediaOutputMuted:!1,nativeMediaSyncDisabled:!1,webAudioMediaDisabled:!1,mediaAutoplayBlockedPosted:!1,mediaForceSyncNextTick:!1,playbackRate:1,bridgeLastPostedFrame:-1,bridgeLastPostedAt:0,bridgeLastPostedPlaying:!1,bridgeLastPostedMuted:!1,bridgeMaxPostIntervalMs:80,controlBridgeHandler:null,beforeUnloadHandler:null,injectedCompStyles:[],injectedCompScripts:[],injectedCompLinks:[],cachedTimedMediaEls:[],cachedMediaClips:[],cachedVideoClips:[],cachedMediaTimelineDurationSeconds:0,tornDown:!1,transportClock:null,transportRafId:null}}var zh=new Set(["SCRIPT","STYLE","LINK","META","TEMPLATE","NOSCRIPT"]);function Bo(e){return e.id||e.getAttribute("data-hf-id")||null}function qh(e){return ve(e)}function $h(e,t){let n=e.getAttribute("data-composition-id");if(!n)return null;let r=Number(t[n]?.duration?.());return Number.isFinite(r)&&r>0?r:null}function jh(e){return!(e instanceof HTMLMediaElement)||!Number.isFinite(e.duration)?null:Qe(e,e.duration)}function Kh(e,t,n,r){let i=qh(e.getAttribute("data-duration"));return i!=null&&i>0?i:$h(e,t)??jh(e)??Math.max(0,n-r)}function Yh(e){for(let[t,n]of e){let r=t.parentElement;for(;r;){let i=e.get(r);if(i){n.parentId=i.id,i.children.push(n);break}r=r.parentElement}}}function wu(e){let{startResolver:t,timelineRegistry:n,rootDuration:r}=e,i=new Map,o=document.querySelector("[data-composition-id]"),a=0;for(let l of document.querySelectorAll("[data-start]")){if(l===o||zh.has(l.tagName))continue;let s=t.resolveStartForElement(l,0);if(Kh(l,n,r,s)<=0)continue;let u={id:Bo(l)??`__clip-${a++}`,element:l,parentId:null,children:[]};i.set(l,u)}return Yh(i),{roots:Array.from(i.values()).filter(l=>l.parentId===null)}}function In(e){if(e==null||typeof e=="string"&&e.trim()==="")return null;let t=typeof e=="number"?e:Number(e);return Number.isFinite(t)?t:null}function jt(e){let t=In(e.start);if(t==null)return null;let n=Math.max(0,t),r=In(e.duration),i=In(e.authoredDuration),o=r!=null&&r>0?r:i!=null&&i>0?i:null;if(o!=null)return{start:n,duration:o,end:n+o};let a=In(e.end),l=In(e.authoredEnd),s=a!=null&&a>n?a:l!=null&&l>n?l:null;return{start:n,duration:s==null?null:s-n,end:s}}var Uo="css:root",Cu=["backdrop-filter","clip-path","filter","mask","mask-border-source","mask-image","perspective","rotate","scale","transform","translate","-webkit-mask-image"],Xh=new Set([...Cu,"contain","isolation","mask-border","mix-blend-mode","opacity"]),Jh=new Set(["absolute","relative"]),Qh=new Set(["flex","inline-flex","grid","inline-grid"]),Zh=new Set(["layout","paint","strict","content"]),e0=new Set(["size","inline-size"]);function t0(e){return e.position==="fixed"||e.position==="sticky"}function n0(e,t){if(t.zIndex==="auto"||t.zIndex==="")return!1;if(Jh.has(t.position))return!0;let n=e.parentElement?e.ownerDocument.defaultView?.getComputedStyle(e.parentElement).display:null;return n!=null&&Qh.has(n)}function r0(e){let t=Number.parseFloat(e.opacity);if(Number.isFinite(t)&&t<1||e.getPropertyValue("isolation")==="isolate")return!0;let n=e.getPropertyValue("mix-blend-mode");return n&&n!=="normal"?!0:Cu.some(r=>{let i=e.getPropertyValue(r);return i!==""&&i!=="none"})}function i0(e){return e.getPropertyValue("contain").split(/\\s+/).some(n=>Zh.has(n))?!0:e0.has(e.getPropertyValue("container-type"))}function o0(e){return e.getPropertyValue("will-change").split(",").map(t=>t.trim()).some(t=>Xh.has(t))}function a0(e,t){return t0(t)||n0(e,t)||r0(t)||i0(t)?!0:o0(t)}function s0(e){let t=[],n=e;for(;n?.parentElement;)t.push(Array.prototype.indexOf.call(n.parentElement.children,n)),n=n.parentElement;return`css:${t.reverse().join(".")}`}function Yr(e){let t=e.ownerDocument.defaultView;if(!t)return Uo;let n=e.parentElement;for(;n&&n!==e.ownerDocument.documentElement;){try{if(a0(n,t.getComputedStyle(n)))return s0(n)}catch{return Uo}n=n.parentElement}return Uo}function mt(e){let t=e.timelineRegistry??{},n=e.includeAuthoredTimingAttrs??!1,r=e.documentRef??document,i=new WeakMap,o=new WeakMap,a=new Set,l=m=>{let p=r.getElementById(m);return p||(r.querySelector(`[data-composition-id="${CSS.escape(m)}"]`)??null)},s=m=>{let p=m.ownerDocument.defaultView?.HTMLMediaElement;return p?m instanceof p:typeof HTMLMediaElement<"u"&&m instanceof HTMLMediaElement},u=m=>{let p=o.get(m);if(p!==void 0)return p;let b=null,v=jt({start:0,duration:m.getAttribute("data-duration"),authoredDuration:n?m.getAttribute("data-hf-authored-duration"):null});if(v?.duration!=null&&v.duration>0&&(b=v.duration),b==null||b<=0){let x=f(m,0),_=jt({start:x,end:m.getAttribute("data-end"),authoredEnd:n?m.getAttribute("data-hf-authored-end"):null});_?.duration!=null&&_.duration>0&&(b=_.duration)}if((b==null||b<=0)&&s(m)){let x=yn(m);Number.isFinite(m.duration)&&m.duration>x&&(b=(m.duration-x)/_e(m))}if(b==null||b<=0){let x=m.getAttribute("data-composition-id");if(x){let _=t[x]??null;if(_&&typeof _.duration=="function")try{let R=Number(_.duration());Number.isFinite(R)&&R>0&&(b=R)}catch(R){L("runtime.startResolver.site1",R)}}}return b!=null&&Number.isFinite(b)&&b>0?(o.set(m,b),b):(o.set(m,null),null)},c=(m,p)=>{if(m.hasAttribute("data-composition-id")){let v=m.parentElement?.closest("[data-composition-id]");return v?f(v,p):0}let b=m.closest("[data-composition-id]");return b?f(b,p):0},f=(m,p)=>{let b=i.get(m);if(b!==void 0)return b??p;if(a.has(m))return p;a.add(m);try{let v=lo(m.getAttribute("data-start"));if(!v){if(m.hasAttribute("data-composition-id")){let M=m.parentElement;if(M&&(M.hasAttribute("data-composition-src")||M.hasAttribute("data-composition-id")||M.hasAttribute("data-composition-file"))){let D=f(M,p);return i.set(m,D),D}}return i.set(m,p),p}if(v.kind==="absolute"){let M=Math.max(0,v.value),D=Math.max(0,c(m,p)+M);return i.set(m,D),D}let x=l(v.refId);if(!x)return i.set(m,p),p;let _=f(x,0),R=u(x);if(R==null||R<=0){let M=Math.max(0,_+v.offset);return i.set(m,M),M}let T=Math.max(0,_+R+v.offset);return i.set(m,T),T}finally{a.delete(m)}};return{resolveStartForElement:(m,p=0)=>f(m,Math.max(0,p)),resolveDurationForElement:m=>u(m)}}function Wo(e){let t=e.trim().toLowerCase();return!(!t||t==="main"||t.includes("caption")||t.includes("ambient"))}function pt(e){return ve(e)}function Vo(e){let t=e.getAttribute("data-duration"),n=e.getAttribute("data-hf-authored-duration"),r=jt({start:0,duration:t,authoredDuration:n})?.duration;return r??([t,n].map(pt).some(o=>o!=null&&o<=0)?0:null)}function _u(e){return jt({start:0,end:e.getAttribute("data-end"),authoredEnd:e.getAttribute("data-hf-authored-end")})?.end??null}function zo(e){try{let t=e.style?.zIndex;if(t&&t!=="auto"){let n=parseInt(t,10);if(Number.isFinite(n))return n}return 0}catch{return 0}}function qo(...e){let t=e.filter(n=>Number.isFinite(n??null));return t.length===0?null:Math.max(...t)}function $o(e,t){let n=e.getAttribute("data-track-index")??e.getAttribute("data-track");if(n==null)return t;let r=Number.parseInt(n,10);return Number.isFinite(r)?r:t}function On(e){let t=String(e??"").trim();if(!t)return null;let n=t.toLowerCase();if(n.startsWith("data:")||n.startsWith("javascript:"))return null;try{return new URL(t,document.baseURI).toString()}catch{return t}}function Tu(e){let t=e.getAttribute("src")??e.getAttribute("data-src");if(t)return On(t);let n=e.getAttribute("data-composition-src");if(n)return On(n);let r=e.querySelector("img[src], video[src], audio[src], source[src]");return r?On(r.getAttribute("src")):null}function u0(e){let t=e.className;return typeof t!="string"?null:t.split(/\\s+/).map(n=>n.trim()).find(n=>n&&n!=="clip"&&!n.startsWith("__hf-"))??null}function c0(e){if(!e)return null;try{return new URL(e,document.baseURI).pathname.split("/").filter(Boolean).at(-1)??null}catch{return e.split(/[\\\\/]/).filter(Boolean).at(-1)??null}}function d0(e){let t=e.textContent?.replace(/\\s+/g," ").trim();return t?t.length>32?`${t.slice(0,31)}...`:t:null}function Pn(e){let t=e.replace(/\\.[^.]+$/i,"").replace(/[-_]+/g," ").replace(/\\s+/g," ").trim();return t?t.replace(/\\b\\w/g,n=>n.toUpperCase()):e}function f0(e,t,n){let r=e.getAttribute("data-timeline-label")??e.getAttribute("data-label")??e.getAttribute("aria-label")??null;if(r?.trim())return r.trim();let i=e.getAttribute("data-composition-id");if(i)return Pn(i);let o=e.id;if(o)return Pn(o);let a=u0(e);if(a)return Pn(a);let l=c0(Tu(e));if(l)return Pn(l);let s=d0(e);return s||`${Pn(t)} ${n+1}`}function Ru(e){let n=window.__timelines??{},r=mt({timelineRegistry:n,includeAuthoredTimingAttrs:!0}),i=z=>{if(!z)return null;let O=n[z]??null;if(!O||typeof O.duration!="function")return null;try{let B=Number(O.duration());return Number.isFinite(B)&&B>0?B:null}catch{return null}},o=z=>{let O=pt(z.getAttribute("data-duration"));return O!=null&&O>0?O:Number.isFinite(z.duration)?Qe(z,z.duration):null},a=()=>{let z=Array.from(document.querySelectorAll("video[data-start], audio[data-start]"));if(z.length===0)return null;let O=0;for(let B of z){let ee=B.hasAttribute("data-hf-auto-start")?r.resolveStartForElement(B,0):Math.max(0,Number(B.getAttribute("data-start")??0)||0);if(!Number.isFinite(ee))continue;let K=o(B);K==null||K<=0||(O=Math.max(O,Math.max(0,ee)+K))}return O>0?O:null},l=(z,O)=>{let B=[],ee=null,K=null,te=null,J=z.parentElement;for(;J;){let X=J.getAttribute("data-composition-id");X&&(B.push(X),!te&&J!==O&&(te=X),ee==null&&(ee=r.resolveStartForElement(J,0)),K==null&&(K=pt(J.getAttribute("data-duration"))??i(X)??null)),J=J.parentElement}return{parentCompositionId:te,compositionAncestors:B.reverse(),inheritedStart:ee,inheritedDuration:K}},s=document.querySelector("[data-composition-id]"),u=Array.from(document.querySelectorAll("[data-composition-id]")),c=s?.getAttribute("data-composition-id")??null,f=s?r.resolveStartForElement(s,0):0,m=a(),p=m!=null?Math.max(0,m-Math.max(0,f)):null,b=i(c),v=Vo(s??document.body),x=qo(...u.filter(z=>z!==s).map(z=>{let O=r.resolveStartForElement(z,0),B=r.resolveDurationForElement(z)??i(z.getAttribute("data-composition-id"))??null;return!Number.isFinite(O)||B==null||B<=0?null:Math.max(0,O)+B})),_=x!=null?Math.max(0,x-Math.max(0,f)):null,R=typeof b=="number"&&Number.isFinite(b)&&b>0?b:null,T=typeof v=="number"&&Number.isFinite(v)&&v>0?v:null,M=typeof p=="number"&&Number.isFinite(p)&&p>0?p:null,D=typeof _=="number"&&Number.isFinite(_)&&_>0?_:null,E=qo(M,D),S=R!=null&&E!=null&&R>E+1,C=T??(S?E:qo(R,M,D))??null,I=(C!=null?f+C:null)??(typeof m=="number"&&Number.isFinite(m)&&m>0?m:null),q=(z,O)=>!Number.isFinite(O)||O<=0?0:I==null||!Number.isFinite(I)?O:!Number.isFinite(z)||z>=I?0:Math.max(0,Math.min(O,I-z)),W=[],Y=[],k=Array.from(document.querySelectorAll("[data-start], [data-track-index], [data-composition-id], video, audio, img")),U=0;for(let[z,O]of k.entries()){if(O===s||["SCRIPT","STYLE","LINK","META","TEMPLATE","NOSCRIPT"].includes(O.tagName))continue;let B=l(O,s),ee=r.resolveStartForElement(O,B.inheritedStart??0),K=O.getAttribute("data-composition-id"),te=Vo(O);if(te==null&&K&&K!==c&&(te=i(K)),te==null&&O instanceof HTMLMediaElement&&Number.isFinite(O.duration)&&(te=Qe(O,O.duration)),te==null){let Fe=B.inheritedDuration;if(Fe!=null&&Fe>0){let Ce=(B.inheritedStart??0)+Fe;te=Math.max(0,Ce-ee)}}if(te==null||te<=0||(te=q(ee,te),te<=0))continue;let J=ee+te;U=Math.max(U,J);let X=O.tagName.toLowerCase(),Pe=K&&K!==c?"composition":X==="video"?"video":X==="audio"?"audio":X==="img"?"image":"element";W.push({id:Bo(O)??K??null,label:f0(O,Pe,W.length),start:ee,duration:te,track:$o(O,z),zIndex:zo(O),stackingContextId:Yr(O),kind:Pe,tagName:X,compositionId:O.getAttribute("data-composition-id"),compositionAncestors:B.compositionAncestors,parentCompositionId:B.parentCompositionId,nodePath:null,compositionSrc:On(O.getAttribute("data-composition-src")),playbackStart:$e(O),playbackRate:_e(O),assetUrl:Tu(O),timelineRole:O.getAttribute("data-timeline-role"),timelineLabel:O.getAttribute("data-timeline-label"),timelineGroup:O.getAttribute("data-timeline-group"),timelinePriority:pt(O.getAttribute("data-timeline-priority"))})}let ie=new Set(W.map(z=>z.id)),P=s?.getAttribute("data-composition-id")??null,H=P?n[P]??null:null;if(H&&s){let z=H;if(typeof z.getChildren=="function")try{let O=z.getChildren(!0,!0,!1)??[],B=new Map;for(let te of s.children){let J=te;if(!J.id)continue;let X=J.tagName.toLowerCase();X==="script"||X==="style"||X==="link"||B.set(J,{id:J.id,start:1/0,end:-1/0})}let ee=te=>{let J=te;for(;J;){if(B.has(J))return J;if(J===s)return null;J=J.parentElement}return null};for(let te of O){if(typeof te.targets!="function"||typeof te.startTime!="function"||typeof te.duration!="function")continue;let J=te.startTime(),X=te.parent;for(;X&&X!==H&&typeof X.startTime=="function";)J+=X.startTime(),X=X.parent;let Pe=J+te.duration();if(!(!Number.isFinite(J)||!Number.isFinite(Pe)))for(let Fe of te.targets()){if(!(Fe instanceof Element))continue;let cn=ee(Fe);if(!cn)continue;let Ce=B.get(cn);Ce&&(Ce.start=Math.min(Ce.start,J),Ce.end=Math.max(Ce.end,Pe))}}let K=W.length>0?Math.max(...W.map(te=>te.track))+1:0;for(let[te,J]of B){if(J.start===1/0||J.end===-1/0)continue;let X=te;if(ie.has(X.id))continue;let Pe=Math.max(0,J.end-J.start);if(Pe<=0)continue;let Fe=q(J.start,Pe);Fe<=0||(U=Math.max(U,J.start+Fe),W.push({id:X.id,label:X.getAttribute("data-timeline-label")??X.getAttribute("data-label")??X.getAttribute("aria-label")??X.id,start:J.start,duration:Fe,track:$o(X,K),zIndex:zo(X),stackingContextId:Yr(X),kind:"element",tagName:X.tagName.toLowerCase(),compositionId:X.getAttribute("data-composition-id"),compositionAncestors:P?[P]:[],parentCompositionId:P,nodePath:null,compositionSrc:null,playbackStart:$e(X),playbackRate:_e(X),assetUrl:null,timelineRole:X.getAttribute("data-timeline-role"),timelineLabel:X.getAttribute("data-timeline-label"),timelineGroup:X.getAttribute("data-timeline-group"),timelinePriority:pt(X.getAttribute("data-timeline-priority"))}),ie.add(X.id))}}catch(O){L("runtime.timeline.site1",O)}}if(s&&C!=null&&C>0){let z=W.length>0?Math.max(...W.map(O=>O.track))+1:0;for(let O of s.children){let B=O;if(!B.id||ie.has(B.id))continue;let ee=B.getAttribute("data-timeline-role");if(ee!=="overlay"&&ee!=="persistent-overlay")continue;let K=B.tagName.toLowerCase();if(K==="script"||K==="style"||K==="link"||K==="meta"||window.getComputedStyle(B).display==="none")continue;let J=q(0,C);J<=0||(U=Math.max(U,J),W.push({id:B.id,label:B.getAttribute("data-timeline-label")??B.getAttribute("data-label")??B.getAttribute("aria-label")??B.id,start:0,duration:J,track:$o(B,z),zIndex:zo(B),stackingContextId:Yr(B),kind:"element",tagName:K,compositionId:B.getAttribute("data-composition-id"),compositionAncestors:P?[P]:[],parentCompositionId:P,nodePath:null,compositionSrc:null,playbackStart:$e(B),playbackRate:_e(B),assetUrl:null,timelineRole:ee,timelineLabel:B.getAttribute("data-timeline-label"),timelineGroup:B.getAttribute("data-timeline-group"),timelinePriority:pt(B.getAttribute("data-timeline-priority"))}),ie.add(B.id))}}for(let z of u){if(z===s)continue;let O=z.getAttribute("data-composition-id");if(!O||!Wo(O))continue;let B=r.resolveStartForElement(z,0),ee=Vo(z);if((ee==null||ee<=0)&&_u(z)!=null){let X=_u(z);ee=Math.max(0,X-B)}let K=i(O),te=ee&&ee>0?ee:K;if(te==null||te<=0)continue;let J=q(B,te);J<=0||Y.push({id:O,label:z.getAttribute("data-label")??O,start:B,duration:J,thumbnailUrl:On(z.getAttribute("data-thumbnail-url")),avatarName:null})}let V=Math.max(1,U||1,C??0),j=S&&T==null,we=j?Number.POSITIVE_INFINITY:Math.max(1,Math.ceil(V*Math.max(1,e.canonicalFps)));return{..._r(e.canonicalFps),source:"hf-preview",type:"timeline",compositionContractVersion:1,durationSeconds:j?Number.POSITIVE_INFINITY:V,durationInFrames:we,clips:W,scenes:Y,compositionWidth:pt(s?.getAttribute("data-width"))??1920,compositionHeight:pt(s?.getAttribute("data-height"))??1080}}var jo="data-composition-id",m0="data-composition-src",p0=`[${jo}]`,iA=`[${m0}]`,ku="style",Mu="script",h0=\'link[rel="stylesheet"], link[rel="preconnect"]\';function Kt(e){return e?Array.from(e):[]}function Fu(e){let{contentNode:t,head:n,documentElement:r,hasTemplate:i,compositionId:o}=e,a=Kt(t.querySelectorAll(p0)),l=o?a.find(c=>c.getAttribute(jo)===o)??null:a[0]??null,s=(l??a[0])?.getAttribute(jo)?.trim()||"",u=i?null:n??null;return{innerRoot:l,authoredCompositionId:o||s||null,scriptCompositionId:s||o||null,authoredRootId:l?.getAttribute("id")?.trim()||null,styleSources:[...Kt(u?.querySelectorAll(ku)),...Kt(t.querySelectorAll(ku))],scriptSources:[...Kt(u?.querySelectorAll(Mu)),...Kt(t.querySelectorAll(Mu))],linkSources:Kt(n?.querySelectorAll(h0)),variableDefaultCarriers:[r,l].filter(c=>c!=null)}}var pe=Qm(nd(),1),rd=pe.default,jA=pe.default.stringify,KA=pe.default.fromJSON,YA=pe.default.plugin,XA=pe.default.parse,JA=pe.default.list,QA=pe.default.document,ZA=pe.default.comment,eE=pe.default.atRule,tE=pe.default.rule,nE=pe.default.decl,rE=pe.default.root,iE=pe.default.CssSyntaxError,oE=pe.default.Declaration,aE=pe.default.Container,sE=pe.default.Processor,lE=pe.default.Document,uE=pe.default.Comment,cE=pe.default.Warning,dE=pe.default.AtRule,fE=pe.default.Result,mE=pe.default.Input,pE=pe.default.Rule,hE=pe.default.Root,gE=pe.default.Node;var ya="data-hf-authored-id",id="data-hf-inner-root";function va(e){return e.replace(/[.*+?^${}()|[\\]\\\\]/g,"\\\\$&")}function Sa(e){return e.replace(/\\\\/g,"\\\\\\\\").replace(/"/g,\'\\\\"\')}function Og(e){return e&&e.replace(/[^a-zA-Z0-9_-]/g,n=>`\\\\${n}`).replace(/^-?\\d/,n=>`\\\\${n}`)}function ad(e){let t=e.trim();return t?Array.from(new Set([t,Og(t)])).filter(Boolean):[]}function Hg(e){return!!e&&/[\\w-]/.test(e)}function Gg(e,t,n){let r=ad(t).sort((l,s)=>s.length-l.length);if(r.length===0)return e;let i="",o=0,a=null;for(let l=0;l0?e[l-1]:"";if(a){i+=s,s===a&&u!=="\\\\"&&(a=null);continue}if(s===\'"\'||s==="\'"){a=s,i+=s;continue}if(s==="["){o+=1,i+=s;continue}if(s==="]"){o=Math.max(0,o-1),i+=s;continue}if(s==="#"&&o===0){let c=r.find(f=>e.startsWith(f,l+1));if(c){let f=e[l+1+c.length];if(!Hg(f)){i+=n,l+=c.length;continue}}}i+=s}return i}function Bg(e,t){let n=t?.trim();return n?Gg(e,n,`[${ya}="${Sa(n)}"]`):e}function od(e){return`${e}:not(:has([${id}])), ${e} > [${id}]`}function Ug(e,t,n,r,i,o){let a=Bg(e,r),l=Wg(a,t,n),s=l.trim();if(!s||s==="*")return e;if(/^(html|body|:root)$/i.test(s))return o?od(t):e;let u=new RegExp(`\\\\[\\\\s*data-composition-id\\\\s*=\\\\s*(["\'])${va(n)}\\\\1\\\\s*\\\\]`,"g");if(u.test(s))return s.replace(u,"").trim()===""?od(t):l.replace(u,t);let c=l.match(/^\\s*/)?.[0]??"",f=l.match(/\\s*$/)?.[0]??"";if(i){let m=r?`[${ya}="${Sa(r)}"]`:null;if(m&&s.startsWith(m)){let p=s.slice(m.length);return`${c}${t}${m}${p}${f}`}}return`${c}${t} ${s}${f}`}function Wg(e,t,n){let r=va(n),i=String.raw`\\[\\s*data-composition-id\\s*=\\s*(?:"${r}"|\'${r}\')\\s*\\]`,o=String.raw`\\s*\\[\\s*data-(?:start|duration)\\s*=\\s*(?:"[^"]*"|\'[^\']*\')\\s*\\]`;return e.replace(new RegExp(`${i}(?:${o})+`,"g"),t).replace(new RegExp(`(?:${o})+${i}`,"g"),t)}var Vg=new Set(["keyframes","-webkit-keyframes","font-face"]);function zg(e){return e?.type==="atrule"}function qg(e){let t=e.parent;for(;t;){if(zg(t)&&Vg.has(t.name.toLowerCase()))return!0;t=t.parent}return!1}function $g(e){let t=e.parent;for(;t;){if(t.type==="rule")return!0;t=t.parent}return!1}function sd(e,t,n,r,i){let o=t.trim();if(!e||!o)return e;let a=n||`[data-composition-id="${Sa(o)}"]`,l=rd.parse(e);return l.walkRules(s=>{qg(s)||$g(s)||(s.selectors=s.selectors.map(u=>Ug(u,a,o,r,i?.compoundAuthoredRoot,i?.scopeRootSelectors)))}),l.toResult({map:!1}).css}function nt(e){return JSON.stringify(e).replace(/ 0 ? selector[index - 1] : "";\n if (quote) {\n result += char;\n if (char === quote && previousChar !== "\\\\\\\\") {\n quote = null;\n }\n continue;\n }\n if (char === \'"\' || char === "\'") {\n quote = char;\n result += char;\n continue;\n }\n if (char === "[") {\n bracketDepth += 1;\n result += char;\n continue;\n }\n if (char === "]") {\n bracketDepth = Math.max(0, bracketDepth - 1);\n result += char;\n continue;\n }\n if (char === "#" && bracketDepth === 0) {\n var matchedForm = null;\n for (var formIndex = 0; formIndex < __hfAuthoredRootIdForms.length; formIndex += 1) {\n var form = __hfAuthoredRootIdForms[formIndex];\n if (selector.slice(index + 1, index + 1 + form.length) === form) {\n matchedForm = form;\n break;\n }\n }\n if (matchedForm) {\n var nextChar = selector[index + 1 + matchedForm.length];\n if (!__hfIsSelectorNameChar(nextChar)) {\n result += __hfAuthoredRootSelector;\n index += matchedForm.length;\n continue;\n }\n }\n }\n result += char;\n }\n return result;\n };\n var __hfNormalizeSelector = function(selector) {\n if (!__hfCompId || typeof selector !== "string") return selector;\n var normalized = selector\n .replace(new RegExp(__hfRootSelectorPattern + \'(?:\' + __hfTimingSelectorPattern + \')+\', \'g\'), __hfRootSelector)\n .replace(new RegExp(\'(?:\' + __hfTimingSelectorPattern + \')+\' + __hfRootSelectorPattern, \'g\'), __hfRootSelector);\n if (__hfAuthoredRootSelector) {\n normalized = __hfReplaceAuthoredRootIdSelectors(normalized);\n }\n return normalized;\n };\n var __hfFindRoot = function() {\n if (!__hfRoot && __hfRootSelector) {\n __hfRoot = window.document.querySelector(__hfRootSelector);\n }\n return __hfRoot;\n };\n var __hfContains = function(node) {\n var root = __hfFindRoot();\n return !root || node === root || root.contains(node);\n };\n var __hfQueryAll = function(selector) {\n var root = __hfFindRoot();\n if (!root || typeof selector !== "string") {\n return window.document.querySelectorAll(selector);\n }\n return Array.prototype.filter.call(window.document.querySelectorAll(__hfNormalizeSelector(selector)), function(node) {\n return __hfContains(node);\n });\n };\n var __hfQueryOne = function(selector) {\n var matches = __hfQueryAll(selector);\n return matches[0] || null;\n };\n var __hfGetElementById = function(id) {\n var found = window.document.getElementById(id);\n if (found && __hfContains(found)) return found;\n var root = __hfFindRoot();\n if (!root) return found || null;\n var idValue = id + "";\n if (__hfAuthoredRootId && __hfAuthoredRootId === idValue && root.getAttribute && root.getAttribute(__hfAuthoredRootAttr) === idValue) {\n return root;\n }\n if (root.id === idValue) return root;\n if (typeof root.querySelector !== "function") return null;\n try {\n var authoredRootMatch = root.querySelector(\'[\' + __hfAuthoredRootAttr + \'="\' + __hfEscapeAttr(idValue) + \'"]\');\n if (authoredRootMatch) return authoredRootMatch;\n } catch {}\n if (typeof CSS !== "undefined" && CSS && typeof CSS.escape === "function") {\n try {\n return root.querySelector("#" + CSS.escape(idValue)) || null;\n } catch {}\n }\n try {\n return root.querySelector(\'[id="\' + __hfEscapeAttr(idValue) + \'"]\') || null;\n } catch {}\n return null;\n };\n var __hfScopedDocument = typeof Proxy === "function"\n ? new Proxy(window.document, {\n get: function(target, prop, receiver) {\n if (prop === "querySelector") return __hfQueryOne;\n if (prop === "querySelectorAll") return __hfQueryAll;\n if (prop === "getElementById") return __hfGetElementById;\n var value = Reflect.get(target, prop, target);\n return typeof value === "function" ? value.bind(target) : value;\n },\n })\n : window.document;\n var __hfTimelineRegistryProxy = null;\n var __hfGetTimelineRegistry = function() {\n window.__timelines = window.__timelines || {};\n if (!__hfCompId || __hfCompId === __hfTimelineCompId || typeof Proxy !== "function") {\n return window.__timelines;\n }\n if (!__hfTimelineRegistryProxy) {\n __hfTimelineRegistryProxy = new Proxy(window.__timelines, {\n get: function(target, prop, receiver) {\n if (prop !== __hfCompId) {\n return Reflect.get(target, prop, target);\n }\n var authoredValue = Reflect.get(target, prop, target);\n return authoredValue === undefined\n ? Reflect.get(target, __hfTimelineCompId, target)\n : authoredValue;\n },\n set: function(target, prop, value, receiver) {\n if (prop !== __hfCompId) {\n return Reflect.set(target, prop, value, target);\n }\n // The authored node remains in the compiled DOM when its local id\n // differs from the runtime mount id, so readiness legitimately sees\n // both compositions. Publish the same timeline under both identities\n // instead of replacing one with the other.\n var authoredSet = Reflect.set(target, __hfCompId, value, target);\n var runtimeSet = Reflect.set(target, __hfTimelineCompId, value, target);\n return authoredSet && runtimeSet;\n },\n });\n }\n return __hfTimelineRegistryProxy;\n };\n var __hfScopedWindow = typeof Proxy === "function"\n ? new Proxy(window, {\n get: function(target, prop, receiver) {\n if (prop === "__timelines") return __hfGetTimelineRegistry();\n // Inside a sub-composition, __hyperframes is passed as a bare script\n // param bound to the SCOPED variant (per-comp getVariables). But\n // authors routinely write the documented window.__hyperframes.\n // getVariables() form, which would otherwise fall through to the host\n // page\'s base __hyperframes and return the WRONG (or empty) variables\n // for this instance. Route it to the scoped variant too so both\n // spellings resolve to this composition\'s own variables.\n // (__hfScopedHyperframes is a hoisted var assigned below, before any\n // sub-comp script -- the only code that reads this -- runs.)\n if (prop === "__hyperframes") return __hfScopedHyperframes;\n // Native window methods must stay bound to the real window. Handed\n // back unbound, "this" at call time is this Proxy and Chrome rejects\n // it with "Illegal invocation", which broke window.addEventListener,\n // setTimeout, matchMedia and getComputedStyle inside every\n // sub-composition -- including the window.addEventListener("hf-seek",\n // ...) form the Three.js and TypeGPU adapters document. The sibling\n // document and gsap proxies here already bind.\n //\n // Only bind non-constructors. Function.prototype.bind drops static\n // members, so binding a class exposed on window (window.Texts and\n // friends) would silently strip its statics. Built-in methods have\n // no .prototype; classes and constructor functions do.\n var value = Reflect.get(target, prop, target);\n return typeof value === "function" && value.prototype === undefined\n ? value.bind(target)\n : value;\n },\n set: function(target, prop, value, receiver) {\n if (prop === "__timelines") {\n // Common authoring boilerplate assigns the registry back to\n // itself (window.__timelines = window.__timelines || {}). The\n // getter above returns our proxy; do not replace the canonical\n // registry with that proxy or later wrappers will stack proxies.\n if (value === __hfTimelineRegistryProxy) return true;\n target.__timelines = value || {};\n __hfTimelineRegistryProxy = null;\n return true;\n }\n return Reflect.set(target, prop, value, target);\n },\n })\n : window;\n var __hfResolveGsapTarget = function(target) {\n if (typeof target !== "string") return target;\n return __hfQueryAll(target);\n };\n var __hfScopeTimeline = function(timeline) {\n if (!timeline || timeline.__hfScopedCompositionRoot === __hfFindRoot()) return timeline;\n ["to", "from", "fromTo", "set"].forEach(function(method) {\n var original = timeline[method];\n if (typeof original !== "function") return;\n timeline[method] = function(target) {\n var args = Array.prototype.slice.call(arguments);\n args[0] = __hfResolveGsapTarget(target);\n return original.apply(timeline, args);\n };\n });\n try {\n Object.defineProperty(timeline, "__hfScopedCompositionRoot", {\n value: __hfFindRoot(),\n configurable: true,\n });\n } catch {\n // Best-effort: timelines coming from user code may have a frozen target\n // or a non-extensible defineProperty path. Swallow \\u2014 the scoped root\n // is an enrichment, not a correctness invariant for playback.\n }\n return timeline;\n };\n var __hfBaseGsap = typeof gsap === "undefined" ? window.gsap : gsap;\n var __hfScopedGsap = !__hfBaseGsap || typeof Proxy !== "function"\n ? __hfBaseGsap\n : new Proxy(__hfBaseGsap, {\n get: function(target, prop, receiver) {\n if (prop === "timeline") {\n return function() {\n return __hfScopeTimeline(target.timeline.apply(target, arguments));\n };\n }\n if (prop === "to" || prop === "from" || prop === "fromTo" || prop === "set") {\n return function(firstArg) {\n var args = Array.prototype.slice.call(arguments);\n args[0] = __hfResolveGsapTarget(firstArg);\n return target[prop].apply(target, args);\n };\n }\n if (prop === "utils" && target.utils && typeof Proxy === "function") {\n return new Proxy(target.utils, {\n get: function(utilsTarget, utilsProp, utilsReceiver) {\n if (utilsProp === "toArray") {\n return function(firstArg) {\n var args = Array.prototype.slice.call(arguments);\n args[0] = __hfResolveGsapTarget(firstArg);\n return utilsTarget.toArray.apply(utilsTarget, args);\n };\n }\n if (utilsProp === "selector") {\n return function(base) {\n var baseEl = typeof base === "string" ? __hfQueryOne(base) : base;\n var root = baseEl || __hfFindRoot();\n return function(selector) {\n if (!root || typeof selector !== "string") return [];\n return Array.prototype.filter.call(\n window.document.querySelectorAll(__hfNormalizeSelector(selector)),\n function(node) {\n return node === root || (typeof root.contains === "function" && root.contains(node));\n },\n );\n };\n };\n }\n var value = Reflect.get(utilsTarget, utilsProp, utilsTarget);\n return typeof value === "function" ? value.bind(utilsTarget) : value;\n },\n });\n }\n var value = Reflect.get(target, prop, target);\n return typeof value === "function" ? value.bind(target) : value;\n },\n });\n var __hfBaseHyperframes = window.__hyperframes;\n var __hfScopedHyperframes = !__hfBaseHyperframes\n ? __hfBaseHyperframes\n : Object.assign({}, __hfBaseHyperframes, {\n getVariables: function() {\n var byComp = window.__hfVariablesByComp;\n var scoped = byComp && __hfTimelineCompId ? byComp[__hfTimelineCompId] : null;\n return scoped ? Object.assign({}, scoped) : {};\n },\n });\n var __hfRun = function() {\n try {\n (function(document, gsap, window, __hyperframes) {\n${e.replace(/<\\/(script)/gi,"<\\\\/$1")}\n }).call(window, __hfScopedDocument, __hfScopedGsap, __hfScopedWindow, __hfScopedHyperframes);\n } catch (_err) {\n console.error(__hfErrorLabel, __hfCompId, _err);\n }\n };\n __hfFindRoot();\n __hfRun();\n})();`}var jg=["data-composition-id","data-composition-file","data-start","data-duration","data-end","data-track-index","data-track","data-composition-src","data-hf-authored-duration","data-hf-authored-end"];function ud(e){let t=e.getAttribute("id")?.trim();for(let n of jg)e.removeAttribute(n);t&&(e.removeAttribute("id"),e.setAttribute("data-hf-authored-id",t)),e.setAttribute("data-hf-inner-root","true")}var Kg=8e3,Yg=/^(?![a-zA-Z][a-zA-Z\\d+\\-.]*:)(?!\\/\\/)(?!\\/)(?!\\.\\.?\\/).+/,Xg=/\\burl\\(\\s*(["\']?)([^)"\']+)\\1\\s*\\)/g,Jg=["src","href"];function Qg(e){return!e||e.startsWith("http://")||e.startsWith("https://")||e.startsWith("//")||e.startsWith("data:")||e.startsWith("#")||e.startsWith("/")}function fd(e,t){if(!t)return e;let n=e.trim();if(Qg(n)||!n.startsWith("../")&&n!=="..")return e;try{return new URL(n,t).href}catch{return e}}function md(e,t){return!t||!e?e:e.replace(Xg,(n,r,i)=>{let o=fd(i||"",t);return o===i?n:`url(${r||""}${o}${r||""})`})}function Zg(e,t){for(let n of Array.from(e.querySelectorAll("[src], [href]")))for(let r of Jg){let i=n.getAttribute(r);if(i==null)continue;let o=fd(i,t);o!==i&&n.setAttribute(r,o)}}function eb(e,t){for(let n of Array.from(e.querySelectorAll("[style]"))){let r=n.getAttribute("style");if(r==null)continue;let i=md(r,t);i!==r&&n.setAttribute("style",i)}}function tb(e,t){for(let n of Array.from(e.querySelectorAll("style"))){let r=n.textContent||"",i=md(r,t);i!==r&&(n.textContent=i)}}function pd(e,t){if(t){Zg(e,t),eb(e,t),tb(e,t);for(let n of Array.from(e.querySelectorAll("template")))pd(n.content,t)}}function nb(e,t){return`${e}__hf${t}`}var rb=e=>new Promise(t=>{let n=!1,r=Date.now(),i=null,o=a=>{n||(n=!0,i!=null&&window.clearTimeout(i),t({status:a,elapsedMs:Math.max(0,Date.now()-r)}))};e.addEventListener("load",()=>o("load"),{once:!0}),e.addEventListener("error",()=>o("error"),{once:!0}),i=window.setTimeout(()=>o("timeout"),Kg)});function Aa(e){for(;e.firstChild;)e.removeChild(e.firstChild);e.textContent=""}function cd(e){for(let t of Array.from(e.querySelectorAll("style, script")))t.remove()}function ib(e){let t=document.importNode(e,!0);ud(t);let n=t.getAttribute("data-width"),r=t.getAttribute("data-height");return t.style.width=n?`${n}px`:"100%",t.style.height=r?`${r}px`:"100%",t}function ob(e,t){let n=e.trim();if(!n)return e;try{return Yg.test(n)&&!n.startsWith("#")&&!n.startsWith("?")?new URL(n,document.baseURI).toString():t?new URL(n,t).toString():new URL(n,document.baseURI).toString()}catch{return e}}function dd(e,t){try{let n=new URL(e),r=new URL(t);return n.search="",n.hash="",r.search="",r.hash="",n.href===r.href}catch{return!1}}function di(e){let t=(e.getAttribute("data-composition-id")||"").trim()||null;return{authoredCompositionId:(e.getAttribute("data-hf-original-composition-id")||t||"").trim()||null,runtimeCompositionId:t}}function ab(e){let t=new Map;for(let n of e){let r=di(n).authoredCompositionId||"";r&&t.set(r,(t.get(r)||0)+1)}return t}function hd(e){let t=di(e).authoredCompositionId;return t?!!document.querySelector(`template#${CSS.escape(t)}-template`):!1}function sb(e){return!!e.querySelector(\'[data-hf-inner-root="true"]\')}function lb(e){return e.hasAttribute("data-composition-src")?!0:hd(e)?e.children.length===0||e.hasAttribute("data-hf-original-composition-id")?!0:sb(e):!1}function wa(){return Array.from(document.querySelectorAll("[data-composition-src], [data-composition-id]")).filter(t=>t.hasAttribute("data-composition-src")?!0:hd(t))}function gd(){let e=window.__hfVariablesByComp;if(!e)return;let t=new Set(wa().map(n=>di(n).runtimeCompositionId).filter(n=>!!n));for(let n of Object.keys(e))t.has(n)||delete e[n]}function bd(e,t=ab(e)){let n=new Map,r=new Map;for(let i of e){let{authoredCompositionId:o,runtimeCompositionId:a}=di(i),l=lb(i);if(!o){r.set(i,{authoredCompositionId:null,runtimeCompositionId:a});continue}let s=(t.get(o)||0)>1,u=a||o;if(l){let c=s?(n.get(o)||0)+1:0;s&&n.set(o,c),u=s?nb(o,c):o,s?i.setAttribute("data-hf-original-composition-id",o):i.removeAttribute("data-hf-original-composition-id"),i.setAttribute("data-composition-id",u),a&&a!==u&&window.__hfVariablesByComp&&delete window.__hfVariablesByComp[a]}r.set(i,{authoredCompositionId:o,runtimeCompositionId:u})}return r}async function Ea(e){let t=Fu({contentNode:e.sourceNode,head:e.head,hasTemplate:e.hasTemplate,compositionId:e.authoredCompositionId}),n=t.innerRoot instanceof HTMLElement?t.innerRoot:null,r=n??e.sourceNode,i=t.authoredCompositionId,o=t.scriptCompositionId,a=e.runtimeCompositionId||null,l=t.authoredRootId,s=a?`[data-composition-id="${CSS.escape(a)}"]`:void 0;for(let m of t.linkSources){let p=(m.getAttribute("href")||"").trim();if(!p)continue;let b=e.compositionUrl?new URL(p,e.compositionUrl).href:p;if(e.compositionUrl&&dd(b,e.compositionUrl)||document.head.querySelector(`link[href="${CSS.escape(b)}"]`))continue;let v=m.cloneNode(!0);v instanceof HTMLLinkElement&&(v.href=b,document.head.appendChild(v),e.injectedLinks.push(v))}(m=>{for(let p of m){let b=p.cloneNode(!0);b instanceof HTMLStyleElement&&(i&&(b.textContent=sd(b.textContent||"",i,s,l,{scopeRootSelectors:!0})),document.head.appendChild(b),e.injectedStyles.push(b))}})(t.styleSources);let c=m=>{let p=m.getAttribute("type")?.trim()??"",b=m.getAttribute("src")?.trim()??"";if(b){let x=ob(b,e.compositionUrl);return e.compositionUrl&&dd(x,e.compositionUrl)?null:{kind:"external",src:x,type:p}}let v=m.textContent?.trim()??"";return v?{kind:"inline",content:v,type:p,scopeCompositionId:o}:null},f=t.scriptSources.map(c).filter(m=>m!==null);if(n){let m=n.getAttribute("data-width"),p=n.getAttribute("data-height"),b=e.parseDimensionPx(m),v=e.parseDimensionPx(p);m&&e.host.setAttribute("data-width",m),p&&e.host.setAttribute("data-height",p),b&&e.host instanceof HTMLElement&&(e.host.style.width=b),v&&e.host instanceof HTMLElement&&(e.host.style.height=v),n.hasAttribute("data-timeline-locked")&&e.host.setAttribute("data-timeline-locked","");let x=ib(n);!e.authoredCompositionId&&i&&x.setAttribute("data-composition-id",i),cd(x),e.host.appendChild(x)}else if(e.hasTemplate){let m=document.importNode(r,!0);cd(m),e.host.appendChild(m)}else e.host.innerHTML=e.fallbackBodyInnerHtml;a&&ub(e,r,a);for(let m of f){let p=document.createElement("script");if(m.type&&(p.type=m.type),p.async=!1,m.kind==="external"?p.src=m.src:m.type.toLowerCase()==="module"?p.textContent=m.content:m.scopeCompositionId?p.textContent=ld(m.content,m.scopeCompositionId,"[HyperFrames] composition script error:",s,a||m.scopeCompositionId,l):p.textContent=`(function(){${m.content}})();`,document.body.appendChild(p),e.injectedScripts.push(p),m.kind==="external"){let b=await rb(p);b.status!=="load"&&e.onDiagnostic?.({code:"external_composition_script_load_issue",details:{hostCompositionId:e.authoredCompositionId,runtimeCompositionId:e.runtimeCompositionId,hostCompositionSrc:e.hostCompositionSrc,resolvedScriptSrc:m.src,loadStatus:b.status,elapsedMs:b.elapsedMs}})}}}async function xd(e){let t=wa();if(gd(),t.length===0)return;let n=bd(t),r=t.filter(i=>{if(i.hasAttribute("data-composition-src")||i.children.length>0)return!1;let o=n.get(i)?.authoredCompositionId;return o?!!document.querySelector(`template#${CSS.escape(o)}-template`):!1});if(r.length!==0)for(let i of r){let o=n.get(i),a=o?.authoredCompositionId;if(!a)continue;let l=document.querySelector(`template#${CSS.escape(a)}-template`);Aa(i),await Ea({host:i,authoredCompositionId:a,runtimeCompositionId:o?.runtimeCompositionId||a,hostCompositionSrc:`template#${a}-template`,sourceNode:l.content,hasTemplate:!0,fallbackBodyInnerHtml:"",compositionUrl:null,injectedStyles:e.injectedStyles,injectedScripts:e.injectedScripts,injectedLinks:e.injectedLinks,parseDimensionPx:e.parseDimensionPx,onDiagnostic:e.onDiagnostic})}}async function yd(e){let t=wa();if(gd(),t.length===0)return;let n=bd(t),r=t.filter(i=>i.hasAttribute("data-composition-src"));r.length!==0&&await Promise.all(r.map(async i=>{let o=i.getAttribute("data-composition-src");if(!o)return;let a=n.get(i),l=a?.authoredCompositionId||null,s=a?.runtimeCompositionId||l||null,u=null;try{u=new URL(o,document.baseURI)}catch{u=null}Aa(i);try{let c=l!=null?document.querySelector(`template#${CSS.escape(l)}-template`):null;if(c){await Ea({host:i,authoredCompositionId:l,runtimeCompositionId:s,hostCompositionSrc:o,sourceNode:c.content,hasTemplate:!0,fallbackBodyInnerHtml:"",compositionUrl:u,injectedStyles:e.injectedStyles,injectedScripts:e.injectedScripts,injectedLinks:e.injectedLinks,parseDimensionPx:e.parseDimensionPx,onDiagnostic:e.onDiagnostic});return}let f=await fetch(o);if(!f.ok)throw new Error(`HTTP ${f.status}`);let m=await f.text(),b=new DOMParser().parseFromString(m,"text/html");pd(b,u);let v=(l?b.querySelector(`template#${CSS.escape(l)}-template`):null)??b.querySelector("template"),x=v?v.content:b.body;await Ea({host:i,authoredCompositionId:l,runtimeCompositionId:s,hostCompositionSrc:o,sourceNode:x,hasTemplate:!!v,fallbackBodyInnerHtml:b.body.innerHTML,compositionUrl:u,injectedStyles:e.injectedStyles,injectedScripts:e.injectedScripts,injectedLinks:e.injectedLinks,parseDimensionPx:e.parseDimensionPx,head:b.head,declaredVariableDefaults:bn(b.documentElement),variableDeclarer:b.documentElement,onDiagnostic:e.onDiagnostic})}catch(c){e.onDiagnostic?.({code:"external_composition_load_failed",details:{hostCompositionId:l,runtimeCompositionId:s,hostCompositionSrc:o,errorMessage:c instanceof Error?c.message:"unknown_error"}}),Aa(i)}}))}function ub(e,t,n){let i={...e.declaredVariableDefaults??(t instanceof Element?bn(t):{}),...Xs(e.host)};eo(e.variableDeclarer??(t instanceof Element?t:null),i,n),Ks(e.host),Object.keys(i).length>0?(window.__hfVariablesByComp||(window.__hfVariablesByComp={}),window.__hfVariablesByComp[n]=i,to(e.host,{...js(e.host,i,window),...Rr()})):window.__hfVariablesByComp&&delete window.__hfVariablesByComp[n]}function Ca(e){let n=e.vars.data?.captionState;return n==="dim"||n==="active"?n:void 0}function cb(e){return e instanceof HTMLElement?e.dataset.captionWrapper!=="true"?e:e.querySelector(":scope > span")??null:null}function db(){let e=[],t=document.querySelectorAll(".caption-group");for(let n of t)for(let r of n.children){if(!(r instanceof HTMLElement))continue;let i=r.dataset.captionWrapper==="true"?r.querySelector(":scope > span"):r.tagName==="SPAN"?r:null;i&&e.push(i)}return e}function fb(e){let t=e.parentElement;if(t?.dataset.captionWrapper==="true")return t;let n=document.createElement("span");return n.style.display="inline-block",n.dataset.captionWrapper="true",e.parentNode?.insertBefore(n,e),n.appendChild(e),n}function _a(){let e=window.gsap;e&&document.querySelectorAll(".caption-group").length!==0&&fetch("caption-overrides.json").then(t=>t.ok?t.json():null).then(t=>{if(!t||!Array.isArray(t)||t.length===0)return;let n=db();for(let r of t){let i=null;if(r.wordId&&(i=cb(document.getElementById(r.wordId))),!i&&r.wordIndex!==void 0&&(i=n[r.wordIndex]??null),!i)continue;let o={},a={};if(r.x!==void 0&&(o.x=r.x),r.y!==void 0&&(o.y=r.y),r.scale!==void 0&&(o.scale=r.scale),r.rotation!==void 0&&(o.rotation=r.rotation),r.opacity!==void 0&&(a.opacity=r.opacity),r.fontSize!==void 0&&(a.fontSize=`${r.fontSize}px`),r.fontWeight!==void 0&&(a.fontWeight=r.fontWeight),r.fontFamily!==void 0&&(a.fontFamily=r.fontFamily),r.activeColor||r.dimColor){let s=e.getTweensOf(i).filter(f=>f.vars.color!==void 0).sort((f,m)=>f.startTime()-m.startTime()),u=s.find(f=>Ca(f)==="dim")??s.find(f=>Ca(f)===void 0),c=u?String(u.vars.color):"";for(let f of s)(Ca(f)??(String(f.vars.color)===c?"dim":"active"))==="dim"?r.dimColor&&(f.vars.color=r.dimColor):r.activeColor&&(f.vars.color=r.activeColor);r.dimColor&&e.set(i,{color:r.dimColor})}if(Object.keys(a).length>0&&e.set(i,a),Object.keys(o).length>0){let l=fb(i);e.set(l,o)}}}).catch(()=>{})}var Ra="data-hf-edit-base-x",ka="data-hf-edit-base-y",en="data-hf-edit-original-translate",fi=e=>{let t=parseFloat(e??"");return Number.isFinite(t)?t:0},mb=e=>{let t=[],n=0,r="";for(let i of e.trim())i==="("&&(n+=1),i===")"&&(n=Math.max(0,n-1)),/\\s/.test(i)&&n===0?(r&&t.push(r),r=""):r+=i;return r&&t.push(r),t},vd=/^-?(?:\\d+(?:\\.\\d+)?|\\.\\d+)px$/,Ta=(e,t)=>vd.test(e)&&vd.test(t)?`${parseFloat(e)+parseFloat(t)}px`:`calc(${e} + ${t})`,pb=(e,t,n)=>{if(!e||e==="none")return`${t} ${n}`;let[r,i,o]=mb(e);if(r===void 0)return`${t} ${n}`;if(i===void 0)return`${Ta(r,t)} ${n}`;let a=o===void 0?"":` ${o}`;return`${Ta(r,t)} ${Ta(i,n)}${a}`},hb=e=>{try{e.ownerDocument.defaultView?.gsap?.getProperty?.(e,"x")}catch{}},gb=e=>{let t=e.style.getPropertyValue("translate").trim();if(t)return t==="none"?"":t;try{let n=e.ownerDocument.defaultView,r=n?n.getComputedStyle(e).getPropertyValue("translate").trim():"";return r==="none"?"":r}catch{return""}},Ma=new WeakMap;function bb(e,t){let n=Ma.get(e);if(!t?.force&&n!==void 0&&e.style.getPropertyValue("translate")!==n){Ne("position_edit_fold_skipped",{hfId:e.getAttribute("data-hf-id")});return}let r=fi(e.getAttribute("data-x"))-fi(e.getAttribute(Ra)),i=fi(e.getAttribute("data-y"))-fi(e.getAttribute(ka));e.hasAttribute(en)||e.setAttribute(en,gb(e)),n===void 0&&hb(e);let o=e.getAttribute(en)??"",a=pb(o,`${r}px`,`${i}px`);e.style.setProperty("translate",a),Ma.set(e,e.style.getPropertyValue("translate"))}function mi(e,t){let n=e.defaultView?.HTMLElement,r=e.defaultView?.SVGElement,i=s=>n||r?n!==void 0&&s instanceof n||r!==void 0&&s instanceof r:typeof s.style?.setProperty=="function",o=e.querySelectorAll(`[${en}]:not([${Ra}]):not([${ka}])`);for(let s=0;s{try{mi(t.document)}catch{}},r=f=>typeof f=="function"&&(Ad.has(f)||!!f[Sd]),i=f=>{Ad.add(f);try{Object.defineProperty(f,Sd,{value:!0})}catch{}},o=f=>{if(typeof f!="function"||r(f))return f;let m=function(...p){let b=f.apply(this,p);return n(),b};return i(m),m},a=(f,m)=>{let p=Ed.get(f);if(p?.has(m))return!0;let b=Object.getOwnPropertyDescriptor(f,m);if(b?.configurable===!1){let _=f[m];return typeof _=="function"&&(f[m]=o(_),n()),!1}let v=f[m],x=b?.set;return Object.defineProperty(f,m,{configurable:!0,enumerable:b?.enumerable??!0,get:()=>v,set:_=>{v=o(_),x?.call(f,_)}}),v=o(v),p??(p=new Set),p.add(m),Ed.set(f,p),n(),!0},l=(f,m)=>{let p=wd.get(t),b=Object.getOwnPropertyDescriptor(t,f);if(!p?.has(f)){if(b?.configurable===!1){let _=t[f];return _?a(_,m):!1}let x=t[f];Object.defineProperty(t,f,{configurable:!0,enumerable:b?.enumerable??!0,get:()=>x,set:_=>{x=_,x&&a(x,m)}}),p??(p=new Set),p.add(f),wd.set(t,p)}let v=t[f];return v?a(v,m):!1},s=()=>{let f=l("__hf","seek"),m=l("__player","renderSeek");return f&&m};if(s())return;let u=120,c=t.setInterval(()=>{if(s()){t.clearInterval(c);return}u-=1,u<=0&&t.clearInterval(c)},50)}function pi(e){let t=window,r=e.closest("[data-composition-id]")?.getAttribute("data-composition-id")?.trim()??"",i=r?t.__hfVariablesByComp?.[r]:void 0;if(i)return i;let o=t.__hyperframes?.getVariables?.();return o&&typeof o=="object"?o:t.__hfVariables??{}}function hi(e){return typeof e=="string"||typeof e=="number"||typeof e=="boolean"}function Fa(e){let t=e.replace(/[\\u0000-\\u0020]/g,""),n=/^([a-z][a-z0-9+.-]*):/i.exec(t);if(!n)return!0;let r=n[1]?.toLowerCase();return r?r==="https"||r==="http"||r==="blob"?!0:r==="data"?/^data:image\\//i.test(t):!1:!1}var _d=new Set(["img","video","audio","source"]);function xb(e){if(typeof e=="string"&&e.length>0)return e;if(e!==null&&typeof e=="object"){let t=e.url;if(typeof t=="string"&&t.length>0)return t}return null}function yb(e){return e.replace(/[;{}<>\\r\\n]/g,"")}function vb(e){if(hi(e))return String(e);if(e!==null&&typeof e=="object"){let t=e.name;if(typeof t=="string"&&t.length>0)return t}return null}function Na(e,t){let n=e.closest("[data-composition-id]"),r=t.get(n);if(r)return r;let i=pi(e);return t.set(n,i),i}function Sb(e,t){if(e.childElementCount===0){e.textContent=t;return}let n=!1;for(let r of Array.from(e.childNodes))r.nodeType===Node.TEXT_NODE&&(r.nodeValue=n?"":t,n=!0);n||e.insertBefore(e.ownerDocument.createTextNode(t),e.firstChild)}function Ab(e){return e.querySelector("[data-hf-root]")??e.getElementById("stage")??e.body?.firstElementChild??e.body}function Eb(e,t){let n=new Set,r=Ab(e);r&&n.add(r);for(let i of Array.from(e.querySelectorAll("[data-composition-id]")))n.add(i);for(let i of n){let o=Na(i,t);for(let[a,l]of Object.entries(o)){let s=vb(l);s!==null&&i instanceof HTMLElement&&i.style.setProperty(`--${a}`,yb(s))}}}function La(e){let t=new Map;Eb(e,t);for(let n of Array.from(e.querySelectorAll("[data-var-src]"))){let r=n.getAttribute("data-var-src")?.trim();if(!r)continue;if(!_d.has(n.tagName.toLowerCase())){console.warn(`[hyperframes] Ignoring data-var-src on <${n.tagName.toLowerCase()}>: variable-bound src is only allowed on ${Array.from(_d).join("/")}.`);continue}let i=xb(Na(n,t)[r]);if(i!==null){if(!Fa(i)){console.warn(`[hyperframes] Ignoring data-var-src="${r}": unsafe URL protocol.`);continue}n.setAttribute("src",i)}}for(let n of Array.from(e.querySelectorAll("[data-var-text]"))){let r=n.getAttribute("data-var-text")?.trim();if(!r)continue;let i=Na(n,t)[r];hi(i)&&Sb(n,String(i))}}var rt=new Map,wb="data-hf-color-grading-canvas",Cb="__hf_color_grading_canvas__";function Od(){if(typeof MutationObserver>"u"||typeof document>"u")return;let e=document.documentElement;if(!e)return;let t=r=>{r instanceof HTMLElement&&(r.hasAttribute($r)||r.setAttribute($r,r.style.opacity))},n=r=>{if(r instanceof Element){r.matches("video, img")&&t(r);for(let i of r.querySelectorAll("video, img"))t(i)}};n(e),new MutationObserver(r=>{for(let i of r)for(let o of i.addedNodes)n(o)}).observe(e,{childList:!0,subtree:!0})}var _b=16,Tb=4,nn={enabled:!1,position:.5,softness:0,lineWidth:2},Da=["#000000","#ffffff"],Rb=["#1a1a1a","#f5f5dc"],sr=3,kb=sr-1,Mb=5,Ia=`${je}.0`,Td=`${je-1}.0`,Fb=`${sr}.0`,Nb=`${(kb+.5)/sr}`;function gi(e){let t=e.getAttribute(Fn);return t==null?null:bu(t,pi(e))}var Lb=["attribute vec2 a_pos;","varying vec2 v_uv;","void main(){"," v_uv = a_pos * 0.5 + 0.5;"," gl_Position = vec4(a_pos, 0.0, 1.0);","}"].join(`\n`),Db=["#ifdef GL_FRAGMENT_PRECISION_HIGH","precision highp float;","#else","precision mediump float;","#endif","varying vec2 v_uv;","uniform sampler2D u_source;","uniform sampler2D u_blurSource;","uniform sampler2D u_bloomSource;","uniform sampler2D u_kuwaharaSource;","uniform sampler2D u_lut;","uniform sampler2D u_advanced;","uniform vec2 u_resolution;","uniform vec2 u_uvScale;","uniform vec2 u_uvOffset;","uniform float u_blurReady;","uniform float u_bloomReady;","uniform float u_kuwaharaReady;","uniform float u_lutEnabled;","uniform float u_lutSize;","uniform vec2 u_lutTextureSize;","uniform vec3 u_lutDomainMin;","uniform vec3 u_lutDomainMax;","uniform float u_lutIntensity;","uniform vec3 u_shadowWheel;","uniform vec3 u_midtoneWheel;","uniform vec3 u_highlightWheel;","uniform float u_rgbCurvesEnabled;","uniform float u_hueCurvesEnabled;","uniform float u_secondaryCount;","uniform float u_exposure;","uniform float u_contrast;","uniform float u_highlights;","uniform float u_shadows;","uniform float u_whites;","uniform float u_blacks;","uniform float u_temperature;","uniform float u_tint;","uniform float u_vibrance;","uniform float u_saturation;","uniform float u_vignette;","uniform float u_vignetteMidpoint;","uniform float u_vignetteRoundness;","uniform float u_vignetteFeather;","uniform float u_grain;","uniform float u_grainSize;","uniform float u_grainRoughness;","uniform float u_grainSeed;","uniform float u_effectTime;","uniform float u_blur;","uniform float u_bloom;","uniform float u_kuwahara;","uniform float u_pixelate;","uniform float u_chromaBleed;","uniform float u_tapeDamage;","uniform float u_tapeTracking;","uniform float u_tapeNoise;","uniform float u_tapeSpeed;","uniform float u_filmArtifacts;","uniform float u_halftone;","uniform float u_halftoneSize;","uniform float u_twoInkPrint;","uniform float u_twoInkPrintSize;","uniform float u_ascii;","uniform float u_asciiSize;","uniform float u_asciiInvert;","uniform float u_asciiStyle;","uniform float u_asciiColor;","uniform float u_asciiRotation;","uniform float u_dither;","uniform float u_ditherSize;","uniform float u_monoScreen;","uniform float u_monoScreenSize;","uniform float u_monoScreenAngle;","uniform float u_monoScreenSpread;","uniform float u_monoScreenShape;","uniform float u_monoScreenInvert;","uniform float u_scanlines;","uniform float u_scanlineCount;","uniform float u_scanlineSoftness;","uniform float u_chromaticAberration;","uniform float u_chromaticAngle;","uniform float u_crtCurvature;","uniform float u_digitalGlitch;","uniform float u_digitalGlitchColorSplit;","uniform float u_digitalGlitchLineTear;","uniform float u_digitalGlitchPixelate;","uniform float u_digitalGlitchBlockAmount;","uniform float u_digitalGlitchBlockDisplacement;","uniform float u_digitalGlitchBlockOpacity;","uniform float u_digitalGlitchSpeed;","uniform float u_engraving;","uniform float u_engravingSpacing;","uniform float u_engravingMinThickness;","uniform float u_engravingMaxThickness;","uniform float u_engravingAngle;","uniform float u_engravingContrast;","uniform float u_engravingSharpness;","uniform float u_engravingWave;","uniform float u_engravingWaveFrequency;","uniform float u_crosshatch;","uniform float u_crosshatchSpacing;","uniform float u_crosshatchThickness;","uniform float u_crosshatchAngle;","uniform float u_crosshatchContrast;","uniform float u_crosshatchEdges;","uniform float u_crosshatchLineWeight;","uniform float u_crosshatchWave;","uniform float u_crosshatchWaveFrequency;","uniform float u_paletteSize;","uniform vec3 u_palette0;","uniform vec3 u_palette1;","uniform vec3 u_palette2;","uniform vec3 u_palette3;","uniform vec3 u_palette4;","uniform vec3 u_palette5;","uniform float u_intensity;","uniform float u_compareEnabled;","uniform float u_comparePosition;","uniform float u_compareSoftness;","uniform float u_compareLineWidth;","const float PI = 3.14159265359;","float lumaOf(vec3 c){ return dot(c, vec3(0.2126, 0.7152, 0.0722)); }","float bt601Luma(vec3 c){ return dot(c, vec3(0.299, 0.587, 0.114)); }","float grainHash(vec2 p){ return fract(sin(dot(p, vec2(127.1, 311.7))) * 43758.5453123); }","float digitalHash(vec2 p){"," vec2 q = mod(floor(p), 251.0);"," float x = mod(q.x * q.x * 157.0 + q.x * 89.0, 251.0);"," float y = mod(q.y * q.y * 113.0 + q.y * 47.0, 251.0);"," float xy = mod(q.x * q.y * 71.0, 251.0);"," return mod(x + y + xy + 19.0, 251.0) / 251.0;","}","float colorSaturation(vec3 c){ return max(max(c.r, c.g), c.b) - min(min(c.r, c.g), c.b); }","vec2 clampUv(vec2 uv){ return clamp(uv, vec2(0.0), vec2(1.0)); }","vec2 applyCrtWarp(vec2 uv){"," vec2 centered = uv * 2.0 - 1.0;"," float curvature = clamp(u_crtCurvature, 0.0, 1.0) * 0.5;"," float dist = dot(centered, centered);"," centered *= 1.0 + curvature * dist;"," return centered * 0.5 + 0.5;","}","vec4 sampleSource(vec2 uv){ return texture2D(u_source, clampUv(uv)); }","vec4 sampleBlur(vec2 uv){ return texture2D(u_blurSource, clampUv(uv)); }","vec3 sampleBloom(vec2 uv){ return texture2D(u_bloomSource, clampUv(uv)).rgb; }","vec3 sampleKuwahara(vec2 uv){"," vec2 displayUv = uv * u_uvScale + u_uvOffset;"," return texture2D(u_kuwaharaSource, clampUv(displayUv)).rgb;","}","vec4 samplePrepared(vec2 uv){"," vec4 base = sampleSource(uv);"," float blur = clamp(u_blur, 0.0, 1.0);"," if (blur > 0.0 && u_blurReady > 0.5) base = mix(base, sampleBlur(uv), blur);"," float kuwahara = clamp(u_kuwahara, 0.0, 1.0);"," if (kuwahara > 0.0 && u_kuwaharaReady > 0.5) {"," base.rgb = mix(base.rgb, sampleKuwahara(uv), kuwahara);"," }"," return base;","}","float tapeTrackingBand(float y, float center, float width){"," float offset = fract(y - center + 0.5) - 0.5;"," float triangle = max(0.0, 1.0 - abs(offset) / max(width, 0.0001));"," return triangle * triangle * (3.0 - 2.0 * triangle);","}","vec4 sampleMedia(vec2 uv){"," float pixel = clamp(u_pixelate, 0.0, 1.0);"," vec2 sampleUv = uv;"," if (pixel > 0.0) {"," float blockSize = mix(1.0, 48.0, pixel);"," vec2 cells = max(u_resolution / blockSize, vec2(1.0));"," sampleUv = (floor(clamp(uv, vec2(0.0), vec2(0.999999)) * cells) + 0.5) / cells;"," }"," float tapeDamage = clamp(u_tapeDamage, 0.0, 1.0);"," float tapeTracking = clamp(u_tapeTracking, 0.0, 1.0);"," float tapeNoise = clamp(u_tapeNoise, 0.0, 1.0);"," float tapeTime = u_effectTime * mix(0.0, 2.0, clamp(u_tapeSpeed, 0.0, 1.0));"," float tapeFrame = floor(tapeTime * 60.0);"," float tapeLine = floor(sampleUv.y * u_resolution.y * 0.5);"," float lineJitter = (digitalHash(vec2(tapeLine, floor(tapeFrame * 0.5))) - 0.5) * 1.8 * tapeNoise;"," float slowWobble = sin(sampleUv.y * 32.0 + tapeTime * 2.6) * 0.55;"," float headSwitch = smoothstep(0.88, 1.0, sampleUv.y) * sin(sampleUv.y * 240.0 + tapeTime * 8.0) * 4.0;"," float trackingShift = tapeTrackingBand(sampleUv.y, fract(0.08 + tapeTime * 0.083), 0.035);"," trackingShift -= tapeTrackingBand(sampleUv.y, fract(0.28 + tapeTime * 0.061), 0.03) * 0.8;"," trackingShift += tapeTrackingBand(sampleUv.y, fract(0.5 + tapeTime * 0.047), 0.04) * 0.75;"," trackingShift -= tapeTrackingBand(sampleUv.y, fract(0.72 + tapeTime * 0.037), 0.028) * 0.65;"," trackingShift += tapeTrackingBand(sampleUv.y, fract(0.89 + tapeTime * 0.029), 0.032) * 0.55;"," trackingShift *= tapeTracking * 48.0;"," float tapeShift = (lineJitter + slowWobble + headSwitch + trackingShift) * tapeDamage;"," float texelX = 1.0 / max(u_resolution.x * max(u_uvScale.x, 0.00001), 1.0);"," vec2 tapeUv = sampleUv + vec2(tapeShift * texelX, 0.0);"," vec4 base = samplePrepared(tapeUv);"," if (tapeDamage > 0.0) {"," vec2 lumaStep = vec2(texelX * mix(1.0, 3.5, tapeDamage), 0.0);"," vec3 leftTape = samplePrepared(tapeUv - lumaStep).rgb;"," vec3 rightTape = samplePrepared(tapeUv + lumaStep).rgb;"," float tapeLuma = (bt601Luma(leftTape) + bt601Luma(base.rgb) * 2.0 + bt601Luma(rightTape)) * 0.25;"," vec3 centerChroma = base.rgb - vec3(bt601Luma(base.rgb));"," vec3 tapeColor = vec3(tapeLuma) + centerChroma;"," vec3 ghost = samplePrepared(tapeUv - vec2(texelX * 12.0, 0.0)).rgb;"," tapeColor = mix(tapeColor, ghost, 0.045 * tapeDamage);"," float fineNoise = digitalHash(floor(gl_FragCoord.xy) + vec2(tapeFrame * 17.0, tapeFrame * 3.0)) - 0.5;"," float band = digitalHash(vec2(floor(sampleUv.y * 92.0), floor(tapeFrame / 3.0)));"," float dropout = smoothstep(0.985, 1.0, band) * (digitalHash(vec2(floor(sampleUv.x * 18.0), tapeLine)) - 0.5);"," tapeColor += (fineNoise * 0.035 + dropout * 0.12) * tapeDamage * tapeNoise;"," base.rgb = mix(base.rgb, clamp(tapeColor, 0.0, 1.0), tapeDamage);"," }"," float chromaBleed = clamp(u_chromaBleed, 0.0, 1.0);"," if (chromaBleed > 0.0) {"," float radius = mix(1.0, 4.0, chromaBleed);"," vec2 stepUv = vec2(texelX * radius, 0.0);"," vec3 c0 = base.rgb;"," vec3 c1 = samplePrepared(tapeUv - stepUv).rgb;"," vec3 c2 = samplePrepared(tapeUv + stepUv).rgb;"," vec3 c3 = samplePrepared(tapeUv - stepUv * 2.0).rgb;"," vec3 c4 = samplePrepared(tapeUv + stepUv * 2.0).rgb;"," float centerLuma = lumaOf(base.rgb);"," vec3 blurredChroma = ((c0 - vec3(lumaOf(c0))) * 6.0 + (c1 - vec3(lumaOf(c1))) * 4.0 + (c2 - vec3(lumaOf(c2))) * 4.0 + (c3 - vec3(lumaOf(c3))) + (c4 - vec3(lumaOf(c4)))) / 16.0;"," base.rgb = mix(base.rgb, clamp(vec3(centerLuma) + blurredChroma, 0.0, 1.0), chromaBleed);"," }"," return base;","}","vec4 sampleChromaticMedia(vec2 uv, vec4 center){"," float amount = clamp(u_chromaticAberration, 0.0, 1.0);"," if (amount <= 0.0) return center;"," float angle = clamp(u_chromaticAngle, 0.0, 1.0) * PI * 2.0;"," vec2 offset = vec2(cos(angle), sin(angle)) * amount * 0.02;"," vec4 positive = sampleMedia(uv + offset);"," vec4 negative = sampleMedia(uv - offset);"," vec3 split = vec3(positive.r, center.g, negative.b);"," return vec4(split, center.a);","}","vec3 sampleDigitalSplit(vec2 uv, vec2 block, float time, float amount){"," float split = amount * 0.06;"," float direction = digitalHash(block * 0.4 + vec2(floor(time * 3.7), floor(time * 5.3)));"," vec2 axis = direction > 0.66 ? vec2(1.0, 0.0) : direction > 0.33 ? vec2(0.0, 1.0) : vec2(0.7071);"," vec4 center = sampleMedia(uv);"," return vec3(sampleMedia(uv + axis * split).r, center.g, sampleMedia(uv - axis * split).b);","}","vec3 applyDigitalGlitch(vec2 uv, vec3 source){"," float amount = clamp(u_digitalGlitch, 0.0, 1.0);"," if (amount <= 0.0) return source;"," float colorSplit = clamp(u_digitalGlitchColorSplit, 0.0, 1.0) * 2.0;"," float lineTear = clamp(u_digitalGlitchLineTear, 0.0, 1.0) * 2.0;"," float pixelate = clamp(u_digitalGlitchPixelate, 0.0, 1.0) * 2.0;"," float blockAmount = clamp(u_digitalGlitchBlockAmount, 0.0, 1.0);"," float blockDisplacement = clamp(u_digitalGlitchBlockDisplacement, 0.0, 1.0) * 2.0;"," float blockOpacity = clamp(u_digitalGlitchBlockOpacity, 0.0, 1.0);"," float speed = clamp(u_digitalGlitchSpeed, 0.0, 1.0) * 2.0;"," float time = u_effectTime * speed;"," float blockCount = 8.0 + blockAmount * 60.0;"," vec2 block = floor(uv * blockCount);"," float randomA = digitalHash(block + vec2(floor(time * 7.3), floor(time * 11.1)));"," float randomB = digitalHash(block * 0.7 + vec2(17.3 + floor(time * 6.6), 29.1));"," float randomC = digitalHash(block + vec2(floor(time * 5.7) * 13.0, 41.0));"," float randomD = digitalHash(block * 1.3 + vec2(7.0, floor(time * 3.2) * 7.0));"," vec2 displaced = uv;"," if (blockDisplacement > 0.0 && blockOpacity > 0.0) {"," float threshold = 1.0 - blockDisplacement * 0.4;"," if (randomA > threshold) {"," displaced += vec2((randomB - 0.5) * blockDisplacement * 0.5, (randomC - 0.5) * blockDisplacement * 0.3);"," }"," if (randomD > 0.92 && blockDisplacement > 0.5) {"," displaced.x += (digitalHash(vec2(block.y, floor(time * 8.0))) - 0.5) * blockDisplacement;"," }"," displaced = mix(uv, displaced, blockOpacity);"," }"," if (lineTear > 0.0) {"," float row = floor(uv.y * (50.0 + lineTear * 150.0));"," float tearA = digitalHash(vec2(row * 7.3 + floor(time * 12.0 + row * 0.1) * 3.7, 13.0));"," float tearB = digitalHash(vec2(row * 13.7 + floor(time * 8.3) * 5.1, 31.0));"," if (tearA > 1.0 - lineTear * 0.5) displaced.x += (tearB - 0.5) * lineTear * 0.4;"," if (tearB > 0.95 && lineTear > 0.3) displaced.x += (tearA - 0.5) * lineTear * 0.8;"," }"," if (pixelate > 0.0) {"," float pixelRandom = digitalHash(block * 0.5 + vec2(floor(time * 4.9), 53.0));"," if (pixelRandom > 1.0 - pixelate * 0.35) {"," float cells = 4.0 + (1.0 - pixelRandom) * pixelate * 40.0;"," displaced = (floor(clampUv(displaced) * cells) + 0.5) / cells;"," }"," }"," displaced = clampUv(displaced);"," vec3 glitch = sampleDigitalSplit(displaced, block, time, colorSplit);"," if (blockDisplacement > 0.2 && blockOpacity > 0.0) {"," float corruption = digitalHash(block * 1.1 + vec2(floor(time * 11.9), 67.0));"," vec3 changed = glitch;"," if (corruption > 0.9) changed = 1.0 - glitch;"," else if (corruption > 0.85) changed = corruption > 0.875 ? glitch.gbr : glitch.brg;"," else if (corruption > 0.8) {"," float channel = digitalHash(block + vec2(73.0));"," if (channel > 0.66) changed.r = min(changed.r * 2.0, 1.0);"," else if (channel > 0.33) changed.g = min(changed.g * 2.0, 1.0);"," else changed.b = min(changed.b * 2.0, 1.0);"," }"," glitch = mix(glitch, changed, blockOpacity);"," }"," if (blockOpacity > 0.0) {"," float flash = digitalHash(block * 0.8 + vec2(floor(time * 14.7), 83.0));"," vec3 flashed = flash > 0.97 ? min(glitch * 1.8, vec3(1.0)) : flash > 0.94 ? glitch * 0.3 : glitch;"," glitch = mix(glitch, flashed, blockOpacity * 0.6);"," }"," if (lineTear > 0.1) {"," float interference = pow(sin(uv.y * (300.0 + randomA * 200.0) + time * 30.0) * 0.5 + 0.5, 6.0);"," glitch -= interference * 0.08 * lineTear;"," }"," return mix(source, clamp(glitch, 0.0, 1.0), amount);","}","float dustMask(vec2 uv, float frameBucket){"," vec2 grid = vec2(128.0, 72.0);"," vec2 cell = floor(uv * grid);"," vec2 local = fract(uv * grid) - 0.5;"," float chance = grainHash(cell + frameBucket * 19.13);"," float radius = mix(0.05, 0.34, grainHash(cell + 7.1));"," return step(0.9975, chance) * (1.0 - smoothstep(radius, radius + 0.08, length(local)));","}","float screenDot(vec2 p, float ink, float angle, float sharpness){"," float c = cos(angle);"," float s = sin(angle);"," vec2 q = mat2(c, -s, s, c) * p;"," vec2 d = fract(q) - 0.5;"," float radius = sqrt(clamp(ink, 0.0, 1.0)) * 0.68;"," float edge = mix(0.16, 0.025, sharpness);"," return 1.0 - smoothstep(radius - edge, radius + edge, length(d));","}","vec3 paletteColor(float index);","float monoScreenMask(vec2 local, float radius, float shape, float softness){"," vec2 centered = local - 0.5;"," float distanceToInk = length(centered);"," if (shape > 0.5 && shape < 1.5) distanceToInk = max(abs(centered.x), abs(centered.y));"," if (shape > 1.5 && shape < 2.5) distanceToInk = abs(centered.x) + abs(centered.y);"," if (shape > 2.5 && shape < 3.5) distanceToInk = max(abs(centered.x) * 0.86 + centered.y * 0.5, -centered.y);"," if (shape > 3.5) distanceToInk = abs(centered.y);"," float shapeRadius = shape > 3.5 ? radius * 0.45 : radius;"," return 1.0 - smoothstep(shapeRadius, shapeRadius + softness, distanceToInk);","}","vec3 applyMonoScreen(vec3 source, float amount){"," if (amount <= 0.0) return source;"," float invert = step(0.5, u_monoScreenInvert);"," float coverage = mix(1.0 - lumaOf(source), lumaOf(source), invert);"," coverage = pow(clamp(coverage, 0.0, 1.0), mix(1.7, 0.58, clamp(u_monoScreenSpread, 0.0, 1.0)));"," float scale = max(min(u_resolution.x, u_resolution.y) / 540.0, 0.25);"," float cellPx = mix(4.0, 18.0, clamp(u_monoScreenSize, 0.0, 1.0)) * scale;"," float angle = clamp(u_monoScreenAngle, 0.0, 1.0) * PI * 0.5;"," float cosine = cos(angle);"," float sine = sin(angle);"," vec2 point = mat2(cosine, -sine, sine, cosine) * gl_FragCoord.xy / max(cellPx, 1.0);"," float radius = sqrt(coverage) * 0.68;"," float inkMask = monoScreenMask(fract(point), radius, floor(u_monoScreenShape + 0.5), 0.035);"," vec3 ink = paletteColor(0.0);"," vec3 paper = paletteColor(max(u_paletteSize - 1.0, 1.0));"," return mix(source, mix(paper, ink, inkMask), amount);","}","vec3 applyEngraving(vec3 source, float amount){"," if (amount <= 0.0) return source;"," float spacing = mix(3.0, 20.0, clamp(u_engravingSpacing, 0.0, 1.0));"," float minThickness = mix(0.0, 2.0, clamp(u_engravingMinThickness, 0.0, 1.0));"," float maxThickness = mix(1.0, 8.0, clamp(u_engravingMaxThickness, 0.0, 1.0));"," float angle = clamp(u_engravingAngle, 0.0, 1.0) * PI;"," vec2 alongAxis = vec2(cos(angle), sin(angle));"," vec2 acrossAxis = vec2(-alongAxis.y, alongAxis.x);"," float along = dot(gl_FragCoord.xy, alongAxis);"," float across = dot(gl_FragCoord.xy, acrossAxis);"," float frequency = mix(1.0, 10.0, clamp(u_engravingWaveFrequency, 0.0, 1.0));"," float wave = sin(along * frequency * 0.01);"," across += wave * clamp(u_engravingWave, 0.0, 1.0) * 3.0;"," float lineIndex = floor(across / max(spacing, 1.0));"," float lineDistance = abs(fract(across / max(spacing, 1.0)) - 0.5) * spacing;"," float contrast = mix(0.5, 2.0, clamp(u_engravingContrast, 0.0, 1.0));"," float darkness = 1.0 - pow(clamp(lumaOf(source), 0.0, 1.0), contrast);"," float variation = mix(0.88, 1.12, digitalHash(vec2(lineIndex, 73.0)));"," float thickness = mix(minThickness, maxThickness, darkness) * variation;"," float edge = mix(1.0, 0.3, clamp(u_engravingSharpness, 0.0, 1.0));"," float inkMask = 1.0 - smoothstep(max(thickness * 0.5 - edge, 0.0), thickness * 0.5 + edge, lineDistance);"," inkMask *= smoothstep(0.015, 0.12, darkness);"," vec3 ink = paletteColor(0.0);"," vec3 paper = paletteColor(max(u_paletteSize - 1.0, 1.0));"," return mix(source, mix(paper, ink, inkMask), amount);","}","float crosshatchLine(vec2 pixel, float angle, float spacing, float thickness, float seed){"," vec2 alongAxis = vec2(cos(angle), sin(angle));"," vec2 acrossAxis = vec2(-alongAxis.y, alongAxis.x);"," float along = dot(pixel, alongAxis);"," float across = dot(pixel, acrossAxis);"," float frequency = mix(1.0, 10.0, clamp(u_crosshatchWaveFrequency, 0.0, 1.0));"," across += sin(along * frequency * 0.02 + u_effectTime + seed) * clamp(u_crosshatchWave, 0.0, 1.0) * 5.0;"," float lineIndex = floor(across / max(spacing, 1.0));"," float distanceToLine = abs(fract(across / max(spacing, 1.0)) - 0.5) * spacing;"," float variation = mix(1.0, 0.5 + digitalHash(vec2(lineIndex, seed)), clamp(u_crosshatchLineWeight, 0.0, 1.0));"," float halfWidth = thickness * variation * 0.5;"," return 1.0 - smoothstep(max(halfWidth - 0.5, 0.0), halfWidth + 0.5, distanceToLine);","}","float crosshatchEdge(vec2 uv){"," vec2 texel = 1.0 / max(u_resolution * u_uvScale, vec2(1.0));"," float tl = lumaOf(sampleMedia(uv + texel * vec2(-1.0, -1.0)).rgb);"," float tc = lumaOf(sampleMedia(uv + texel * vec2( 0.0, -1.0)).rgb);"," float tr = lumaOf(sampleMedia(uv + texel * vec2( 1.0, -1.0)).rgb);"," float ml = lumaOf(sampleMedia(uv + texel * vec2(-1.0, 0.0)).rgb);"," float mr = lumaOf(sampleMedia(uv + texel * vec2( 1.0, 0.0)).rgb);"," float bl = lumaOf(sampleMedia(uv + texel * vec2(-1.0, 1.0)).rgb);"," float bc = lumaOf(sampleMedia(uv + texel * vec2( 0.0, 1.0)).rgb);"," float br = lumaOf(sampleMedia(uv + texel * vec2( 1.0, 1.0)).rgb);"," float gx = -tl - 2.0 * ml - bl + tr + 2.0 * mr + br;"," float gy = -tl - 2.0 * tc - tr + bl + 2.0 * bc + br;"," return length(vec2(gx, gy));","}","vec3 applyCrosshatch(vec2 uv, vec3 source, float amount){"," if (amount <= 0.0) return source;"," float spacing = mix(5.0, 30.0, clamp(u_crosshatchSpacing, 0.0, 1.0));"," float thickness = mix(1.0, 5.0, clamp(u_crosshatchThickness, 0.0, 1.0));"," float baseAngle = -clamp(u_crosshatchAngle, 0.0, 1.0) * PI;"," float contrast = mix(0.5, 2.0, clamp(u_crosshatchContrast, 0.0, 1.0));"," float darkness = 1.0 - pow(clamp(lumaOf(source), 0.0, 1.0), contrast);"," vec3 ink = paletteColor(0.0);"," vec3 paper = paletteColor(max(u_paletteSize - 1.0, 1.0));"," vec3 result = paper;"," float layer = crosshatchLine(gl_FragCoord.xy, baseAngle, spacing, thickness, 1.0) * smoothstep(0.2, 0.4, darkness);"," result = mix(result, ink, layer);"," layer = crosshatchLine(gl_FragCoord.xy, baseAngle + PI * 0.5, spacing * 0.95, thickness * 0.9, 2.0) * smoothstep(0.4, 0.6, darkness);"," result = mix(result, ink, layer);"," layer = crosshatchLine(gl_FragCoord.xy, baseAngle + PI * 0.25, spacing * 0.9, thickness * 0.8, 3.0) * smoothstep(0.6, 0.8, darkness);"," result = mix(result, ink, layer);"," layer = crosshatchLine(gl_FragCoord.xy, baseAngle - PI * 0.25, spacing * 0.85, thickness * 0.7, 4.0) * smoothstep(0.75, 0.9, darkness);"," result = mix(result, ink, layer);"," result = mix(result, ink, smoothstep(0.9, 1.0, darkness) * 0.8);"," float edgeStrength = mix(0.0, 2.0, clamp(u_crosshatchEdges, 0.0, 1.0));"," float edge = smoothstep(0.1, 0.3, crosshatchEdge(uv)) * edgeStrength;"," result = mix(result, ink, clamp(edge, 0.0, 1.0));"," return mix(source, result, amount);","}","vec3 applyHalftone(vec3 source, float amount){"," if (amount <= 0.0) return source;"," vec3 cmy = 1.0 - source;"," float k = min(cmy.r, min(cmy.g, cmy.b));"," vec3 inks = max(cmy - vec3(k * 0.72), 0.0);"," float scale = min(u_resolution.x, u_resolution.y) / 540.0;"," float cellPx = mix(5.0, 14.0, clamp(u_halftoneSize, 0.0, 1.0)) * max(scale, 0.25);"," vec2 p = gl_FragCoord.xy / max(cellPx, 1.0);"," float cyan = screenDot(p, inks.r, 0.261799, 0.78);"," float magenta = screenDot(p, inks.g, 1.308997, 0.78);"," float yellow = screenDot(p, inks.b, 0.0, 0.78);"," float blackInk = screenDot(p, k, 0.785398, 0.82);"," vec3 printColor = vec3(0.975, 0.962, 0.925);"," printColor *= mix(vec3(1.0), vec3(0.05, 0.79, 0.86), cyan);"," printColor *= mix(vec3(1.0), vec3(0.91, 0.08, 0.48), magenta);"," printColor *= mix(vec3(1.0), vec3(0.98, 0.83, 0.08), yellow);"," printColor *= mix(vec3(1.0), vec3(0.035), blackInk * 0.92);"," return mix(source, printColor, amount);","}","vec3 applyTwoInkPrint(vec3 source, float amount){"," if (amount <= 0.0) return source;"," float sourceLuma = lumaOf(source);"," float darkness = 1.0 - sourceLuma;"," float warmBias = clamp(source.r - (source.g + source.b) * 0.5, -0.35, 0.35);"," float coolBias = clamp((source.g + source.b) * 0.5 - source.r, -0.35, 0.35);"," float redTone = smoothstep(0.08, 0.72, darkness) * (1.0 - 0.68 * smoothstep(0.66, 1.0, darkness));"," float tealTone = smoothstep(0.30, 0.92, darkness);"," float redCoverage = clamp(redTone + warmBias * 1.35 - coolBias * 0.35, 0.0, 1.0);"," float tealCoverage = clamp(tealTone + coolBias * 1.1 - warmBias * 0.45, 0.0, 1.0);"," float scale = min(u_resolution.x, u_resolution.y) / 540.0;"," float cellPx = mix(4.5, 12.0, clamp(u_twoInkPrintSize, 0.0, 1.0)) * max(scale, 0.25);"," vec2 p = gl_FragCoord.xy / max(cellPx, 1.0);"," float redDot = screenDot(p, redCoverage, 0.261799, 0.84);"," float tealDot = screenDot(p + vec2(0.12, -0.08), tealCoverage, 1.308997, 0.84);"," float paperNoise = grainHash(floor(gl_FragCoord.xy * 0.5)) - 0.5;"," vec3 paper = vec3(0.955, 0.910, 0.795) + paperNoise * 0.018;"," vec3 vermilion = vec3(0.88, 0.13, 0.075);"," vec3 teal = vec3(0.035, 0.285, 0.355);"," vec3 overprint = vec3(0.045, 0.055, 0.052);"," vec3 printColor = paper * (1.0 - redDot) * (1.0 - tealDot);"," printColor += vermilion * redDot * (1.0 - tealDot);"," printColor += teal * (1.0 - redDot) * tealDot;"," printColor += overprint * redDot * tealDot;"," return mix(source, clamp(printColor, 0.0, 1.0), amount);","}","vec3 paletteColor(float index){"," if (index < 0.5) return u_palette0;"," if (index < 1.5) return u_palette1;"," if (index < 2.5) return u_palette2;"," if (index < 3.5) return u_palette3;"," if (index < 4.5) return u_palette4;"," return u_palette5;","}","float bayer4(vec2 point){"," vec2 cell = mod(floor(point), 4.0);"," if (cell.y < 0.5) {"," if (cell.x < 0.5) return 0.5 / 16.0;"," if (cell.x < 1.5) return 8.5 / 16.0;"," if (cell.x < 2.5) return 2.5 / 16.0;"," return 10.5 / 16.0;"," }"," if (cell.y < 1.5) {"," if (cell.x < 0.5) return 12.5 / 16.0;"," if (cell.x < 1.5) return 4.5 / 16.0;"," if (cell.x < 2.5) return 14.5 / 16.0;"," return 6.5 / 16.0;"," }"," if (cell.y < 2.5) {"," if (cell.x < 0.5) return 3.5 / 16.0;"," if (cell.x < 1.5) return 11.5 / 16.0;"," if (cell.x < 2.5) return 1.5 / 16.0;"," return 9.5 / 16.0;"," }"," if (cell.x < 0.5) return 15.5 / 16.0;"," if (cell.x < 1.5) return 7.5 / 16.0;"," if (cell.x < 2.5) return 13.5 / 16.0;"," return 5.5 / 16.0;","}","float standardAsciiSample(float brightness, vec2 grid){"," if (brightness < 0.1) return 0.0;"," if (brightness < 0.2) return grid.x == 2.0 && grid.y == 5.0 ? 1.0 : 0.0;"," if (brightness < 0.3) return grid.x == 2.0 && (grid.y == 2.0 || grid.y == 4.0) ? 1.0 : 0.0;"," if (brightness < 0.4) return (grid.y == 2.0 || grid.y == 4.0) && grid.x >= 1.0 && grid.x <= 3.0 ? 1.0 : 0.0;"," if (brightness < 0.5) {"," bool cross = (grid.x == 2.0 && grid.y >= 2.0 && grid.y <= 4.0) || (grid.y == 3.0 && grid.x >= 1.0 && grid.x <= 3.0);"," bool diagonals = (grid.x == 1.0 || grid.x == 3.0) && (grid.y == 2.0 || grid.y == 4.0);"," return cross || diagonals ? 1.0 : 0.0;"," }"," if (brightness < 0.6) {"," bool ring = ((grid.y == 2.0 || grid.y == 4.0) && grid.x >= 1.0 && grid.x <= 3.0) || ((grid.x == 1.0 || grid.x == 3.0) && grid.y == 3.0);"," return ring ? 1.0 : 0.0;"," }"," bool outline = ((grid.y == 1.0 || grid.y == 5.0) && grid.x >= 1.0 && grid.x <= 3.0) || ((grid.x == 0.0 || grid.x == 4.0) && grid.y >= 2.0 && grid.y <= 4.0) || ((grid.x == 1.0 || grid.x == 3.0) && grid.y >= 1.0 && grid.y <= 5.0);"," if (brightness < 0.7) return outline ? 1.0 : 0.0;"," if (brightness < 0.8) {"," bool slash = abs(grid.x - 2.0) == abs(grid.y - 3.0) && grid.x >= 1.0 && grid.x <= 3.0;"," return outline || slash ? 1.0 : 0.0;"," }"," if (brightness < 0.9) {"," bool loops = ((grid.y == 1.0 || grid.y == 3.0 || grid.y == 5.0) && grid.x >= 1.0 && grid.x <= 3.0) || ((grid.x == 1.0 || grid.x == 3.0) && (grid.y == 2.0 || grid.y == 4.0));"," return loops ? 1.0 : 0.0;"," }"," return 1.0;","}","float asciiStyleSample(float style, float brightness, vec2 uv){"," vec2 grid = floor(uv * vec2(5.0, 7.0));"," if (style < 0.5) return standardAsciiSample(brightness, grid);"," if (style < 1.5) {"," float checker = mod(grid.x + grid.y, 2.0);"," float ruled = mod(grid.x, 2.0) == 0.0 || mod(grid.y, 2.0) == 0.0 ? 1.0 : 0.0;"," if (brightness < 0.125) return 0.0;"," if (brightness < 0.25) return checker == 0.0 ? 0.5 : 0.0;"," if (brightness < 0.375) return ruled * 0.6;"," if (brightness < 0.5) return checker == 0.0 ? 1.0 : 0.0;"," if (brightness < 0.625) return ruled > 0.5 ? 1.0 : 0.3;"," if (brightness < 0.75) return checker == 0.0 ? 1.0 : 0.7;"," if (brightness < 0.875) return ruled > 0.5 ? 1.0 : 0.85;"," return 1.0;"," }"," if (style < 2.5) {"," if (brightness < 0.14) return 0.0;"," if (brightness < 0.28) return grid.x == 2.0 && grid.y == 1.0 ? 1.0 : 0.0;"," if (brightness < 0.42) return grid.x == 2.0 && grid.y == 5.0 ? 1.0 : 0.0;"," if (brightness < 0.56) return grid.y == 3.0 && grid.x >= 1.0 && grid.x <= 3.0 ? 1.0 : 0.0;"," if (brightness < 0.7) return (grid.x == 2.0 && grid.y >= 2.0 && grid.y <= 4.0) || (grid.y == 3.0 && grid.x >= 1.0 && grid.x <= 3.0) ? 1.0 : 0.0;"," if (brightness < 0.84) return abs(grid.x - 2.0) == abs(grid.y - 3.0) && grid.y >= 2.0 && grid.y <= 4.0 ? 1.0 : 0.0;"," return grid.x == 1.0 || grid.x == 3.0 || grid.y == 2.0 || grid.y == 4.0 ? 1.0 : 0.0;"," }"," if (style < 3.5) return grid.y >= 6.0 - brightness * 7.0 ? 1.0 : 0.0;"," if (style < 4.5) {"," vec2 dots = floor(uv * vec2(2.0, 4.0));"," if (brightness < 0.125) return 0.0;"," if (brightness < 0.25) return dots.y == 3.0 ? 1.0 : 0.0;"," if (brightness < 0.375) return dots.y >= 2.0 ? 1.0 : 0.0;"," if (brightness < 0.5) return dots.y >= 1.0 ? 1.0 : 0.0;"," if (brightness < 0.625) return dots.y >= 1.0 || dots.x == 1.0 ? 1.0 : 0.0;"," if (brightness < 0.75) return 1.0;"," if (brightness < 0.875) return mod(grid.x + grid.y, 2.0) < 1.5 ? 1.0 : 0.7;"," return 1.0;"," }"," if (style < 5.5) {"," if (brightness < 0.125) return 0.0;"," if (brightness < 0.25) return grid.x == 2.0 && grid.y == 3.0 ? 1.0 : 0.0;"," if (brightness < 0.375) return grid.y == 3.0 && grid.x >= 1.0 && grid.x <= 3.0 ? 1.0 : 0.0;"," if (brightness < 0.5) return grid.x + grid.y == 5.0 || grid.x + grid.y == 6.0 ? 1.0 : 0.0;"," if (brightness < 0.625) return grid.x == 2.0 ? 1.0 : 0.0;"," if (brightness < 0.75) return abs(grid.x - grid.y / 1.4) < 0.7 && grid.x >= 1.0 && grid.x <= 3.0 ? 1.0 : 0.0;"," if (brightness < 0.875) return grid.x == 2.0 || grid.y == 3.0 ? 1.0 : 0.0;"," return grid.x == 1.0 || grid.x == 3.0 || grid.y == 2.0 || grid.y == 4.0 ? 1.0 : 0.0;"," }"," if (style < 6.5) {"," bool top = grid.y == 0.0 && grid.x >= 1.0 && grid.x <= 3.0;"," bool topLeft = grid.x == 1.0 && grid.y <= 3.0;"," bool topRight = grid.x == 3.0 && grid.y <= 3.0;"," bool middle = grid.y == 3.0 && grid.x >= 1.0 && grid.x <= 3.0;"," bool bottomLeft = grid.x == 1.0 && grid.y >= 3.0;"," bool bottomRight = grid.x == 3.0 && grid.y >= 3.0;"," bool bottom = grid.y == 6.0 && grid.x >= 1.0 && grid.x <= 3.0;"," if (brightness < 0.1) return 0.0;"," if (brightness < 0.2) return topRight || bottomRight ? 1.0 : 0.0;"," if (brightness < 0.3) return top || topRight || middle || bottomLeft || bottom ? 1.0 : 0.0;"," if (brightness < 0.4) return top || topRight || middle || bottomRight || bottom ? 1.0 : 0.0;"," if (brightness < 0.5) return topLeft || middle || topRight || bottomRight ? 1.0 : 0.0;"," if (brightness < 0.6) return top || topLeft || middle || bottomRight || bottom ? 1.0 : 0.0;"," if (brightness < 0.7) return top || topLeft || middle || bottomLeft || bottomRight || bottom ? 1.0 : 0.0;"," if (brightness < 0.8) return top || topRight || bottomRight ? 1.0 : 0.0;"," if (brightness < 0.9) return top || topLeft || topRight || middle || bottomLeft || bottomRight || bottom ? 1.0 : 0.0;"," return top || topLeft || topRight || middle || bottomRight || bottom ? 1.0 : 0.0;"," }"," float slash = grid.x - grid.y;"," float backslash = grid.x + grid.y;"," if (brightness < 0.16) return 0.0;"," if (brightness < 0.33) return mod(slash, 3.0) < 0.5 ? 1.0 : 0.0;"," if (brightness < 0.5) return mod(slash, 2.0) < 0.5 ? 1.0 : 0.0;"," bool diagonalA = mod(slash, 2.0) < 0.5;"," bool diagonalB = mod(backslash, 2.0) < 0.5;"," if (brightness < 0.66) return diagonalA || diagonalB ? 1.0 : 0.0;"," if (brightness < 0.83) return mod(slash, 1.5) < 0.5 || mod(backslash, 1.5) < 0.5 ? 1.0 : 0.2;"," return mod(slash, 1.0) < 0.6 || mod(backslash, 1.0) < 0.6 ? 1.0 : 0.5;","}","vec3 rgbToHsv(vec3 color){"," float maximum = max(max(color.r, color.g), color.b);"," float minimum = min(min(color.r, color.g), color.b);"," float delta = maximum - minimum;"," float hue = 0.0;"," if (delta > 0.00001) {"," if (maximum == color.r) hue = mod((color.g - color.b) / delta, 6.0);"," else if (maximum == color.g) hue = (color.b - color.r) / delta + 2.0;"," else hue = (color.r - color.g) / delta + 4.0;"," hue = fract(hue / 6.0);"," }"," return vec3(hue, maximum > 0.00001 ? delta / maximum : 0.0, maximum);","}","vec3 hsvToRgb(vec3 color){"," vec3 bands = abs(fract(color.xxx + vec3(0.0, 0.6666667, 0.3333333)) * 6.0 - 3.0);"," return color.z * mix(vec3(1.0), clamp(bands - 1.0, 0.0, 1.0), color.y);","}","vec4 sampleAdvancedCurve(float coordinate, float row){",` float position = clamp(coordinate, 0.0, 1.0) * ${Td};`," float lower = floor(position);",` float upper = min(lower + 1.0, ${Td});`,` float y = (row + 0.5) / ${Fb};`,` vec4 before = texture2D(u_advanced, vec2((lower + 0.5) / ${Ia}, y));`,` vec4 after = texture2D(u_advanced, vec2((upper + 0.5) / ${Ia}, y));`," return mix(before, after, position - lower);","}","vec4 advancedConfig(float index){",` return texture2D(u_advanced, vec2((index + 0.5) / ${Ia}, ${Nb}));`,"}","vec3 wheelDirection(float hue){"," vec3 direction = hsvToRgb(vec3(fract(hue), 1.0, 1.0));"," direction -= vec3(lumaOf(direction));"," return direction / max(max(max(abs(direction.r), abs(direction.g)), abs(direction.b)), 0.0001);","}","vec3 applyTonalWheels(vec3 color){"," float luma = lumaOf(color);"," float shadows = 1.0 - smoothstep(0.0, 0.6, luma);"," float highlights = smoothstep(0.4, 1.0, luma);"," float midtones = max(0.0, 1.0 - shadows - highlights);"," float total = max(shadows + midtones + highlights, 0.0001);"," vec3 weights = vec3(shadows, midtones, highlights) / total;"," color += wheelDirection(u_shadowWheel.x) * u_shadowWheel.y * weights.x * 0.18;"," color += wheelDirection(u_midtoneWheel.x) * u_midtoneWheel.y * weights.y * 0.18;"," color += wheelDirection(u_highlightWheel.x) * u_highlightWheel.y * weights.z * 0.18;"," color += u_shadowWheel.z * weights.x * 0.25;"," color += u_midtoneWheel.z * weights.y * 0.25;"," color += u_highlightWheel.z * weights.z * 0.25;"," return color;","}","vec3 applyRgbCurves(vec3 color){"," if (u_rgbCurvesEnabled < 0.5) return color;"," vec3 master = vec3("," sampleAdvancedCurve(color.r, 0.0).a,"," sampleAdvancedCurve(color.g, 0.0).a,"," sampleAdvancedCurve(color.b, 0.0).a"," );"," return vec3("," sampleAdvancedCurve(master.r, 0.0).r,"," sampleAdvancedCurve(master.g, 0.0).g,"," sampleAdvancedCurve(master.b, 0.0).b"," );","}","float decodeSigned(float value){ return (value * 255.0 - 128.0) / 127.0; }","vec3 applyHueCurves(vec3 color){"," if (u_hueCurvesEnabled < 0.5) return color;"," vec3 hsv = rgbToHsv(clamp(color, 0.0, 1.0));"," vec3 curves = sampleAdvancedCurve(hsv.x, 1.0).rgb;"," float originalLuma = lumaOf(color);"," hsv.x = fract(hsv.x + decodeSigned(curves.r) * 0.5);"," hsv.y = clamp(hsv.y * max(0.0, 1.0 + decodeSigned(curves.g)), 0.0, 1.0);"," vec3 shifted = hsvToRgb(hsv);"," shifted += vec3(originalLuma - lumaOf(shifted) + decodeSigned(curves.b));"," return shifted;","}","float softRangeMask(float value, float minimum, float maximum, float softness){"," if (value < minimum) {"," if (softness <= 0.0) return 0.0;"," return smoothstep(minimum - softness, minimum, value);"," }"," if (value > maximum) {"," if (softness <= 0.0) return 0.0;"," return 1.0 - smoothstep(maximum, maximum + softness, value);"," }"," return 1.0;","}","float hueRangeMask(float hue, float saturation, vec3 key){"," float distance = abs(fract(hue - key.x + 0.5) - 0.5) * 360.0;"," float range = key.y * 180.0;"," float softness = key.z * 180.0;"," if (range < 179.999 && saturation < 0.001) return 0.0;"," if (distance <= range) return 1.0;"," if (softness <= 0.0) return 0.0;"," return 1.0 - smoothstep(range, range + softness, distance);","}","vec3 applySecondary(vec3 color, float index){"," float base = index * 5.0;"," vec4 hueKey = advancedConfig(base);"," vec4 saturationKey = advancedConfig(base + 1.0);"," vec4 lumaKey = advancedConfig(base + 2.0);"," vec4 correction = advancedConfig(base + 3.0);"," vec4 tintCorrection = advancedConfig(base + 4.0);"," vec3 hsv = rgbToHsv(clamp(color, 0.0, 1.0));"," float luma = lumaOf(color);"," float mask = hueRangeMask(hsv.x, hsv.y, hueKey.rgb);"," mask *= softRangeMask(hsv.y, saturationKey.x, saturationKey.y, saturationKey.z * 0.5);"," mask *= softRangeMask(luma, lumaKey.x, lumaKey.y, lumaKey.z * 0.5);"," if (mask <= 0.0) return color;"," hsv.x = fract(hsv.x + decodeSigned(correction.x) * 0.5);"," vec3 corrected = hsvToRgb(hsv);"," float correctedLuma = lumaOf(corrected);"," corrected = mix(vec3(correctedLuma), corrected, max(0.0, 1.0 + decodeSigned(correction.y)));"," corrected += vec3(decodeSigned(correction.z));"," float temperature = decodeSigned(correction.w);"," float tint = decodeSigned(tintCorrection.x);"," corrected.r += temperature * 0.08 + tint * 0.04;"," corrected.b -= temperature * 0.08 - tint * 0.04;"," corrected.g -= tint * 0.08;"," return mix(color, corrected, mask);","}","vec3 applyAdvancedGrade(vec3 color){"," color = applyTonalWheels(color);"," color = applyRgbCurves(color);"," color = applyHueCurves(color);"," if (u_secondaryCount > 0.5) color = applySecondary(color, 0.0);"," if (u_secondaryCount > 1.5) color = applySecondary(color, 1.0);"," if (u_secondaryCount > 2.5) color = applySecondary(color, 2.0);"," if (u_secondaryCount > 3.5) color = applySecondary(color, 3.0);"," return color;","}","vec3 sampleLut(float r, float g, float b){"," float size = max(u_lutSize, 2.0);"," float x = (r + b * size + 0.5) / max(u_lutTextureSize.x, 1.0);"," float y = (g + 0.5) / max(u_lutTextureSize.y, 1.0);"," return texture2D(u_lut, vec2(x, y)).rgb;","}","vec3 applyLut(vec3 color){"," if (u_lutEnabled < 0.5) return color;"," float size = max(u_lutSize, 2.0);"," vec3 span = max(u_lutDomainMax - u_lutDomainMin, vec3(0.00001));"," vec3 scaled = clamp((color - u_lutDomainMin) / span, 0.0, 1.0) * (size - 1.0);"," vec3 lo = floor(scaled);"," vec3 hi = min(lo + 1.0, vec3(size - 1.0));"," vec3 f = scaled - lo;"," vec3 c000 = sampleLut(lo.r, lo.g, lo.b);"," vec3 c100 = sampleLut(hi.r, lo.g, lo.b);"," vec3 c010 = sampleLut(lo.r, hi.g, lo.b);"," vec3 c110 = sampleLut(hi.r, hi.g, lo.b);"," vec3 c001 = sampleLut(lo.r, lo.g, hi.b);"," vec3 c101 = sampleLut(hi.r, lo.g, hi.b);"," vec3 c011 = sampleLut(lo.r, hi.g, hi.b);"," vec3 c111 = sampleLut(hi.r, hi.g, hi.b);"," vec3 c00 = mix(c000, c100, f.r);"," vec3 c10 = mix(c010, c110, f.r);"," vec3 c01 = mix(c001, c101, f.r);"," vec3 c11 = mix(c011, c111, f.r);"," vec3 c0 = mix(c00, c10, f.g);"," vec3 c1 = mix(c01, c11, f.g);"," vec3 lutColor = mix(c0, c1, f.b);"," return mix(color, lutColor, clamp(u_lutIntensity, 0.0, 1.0));","}","vec3 applyPrimaryGrade(vec3 color){"," color *= pow(2.0, u_exposure);"," float y = lumaOf(color);"," float shadowMask = 1.0 - smoothstep(0.0, 0.65, y);"," float highlightMask = smoothstep(0.35, 1.0, y);"," color += u_shadows * 0.35 * shadowMask;"," color += u_highlights * 0.35 * highlightMask;"," float blackPoint = clamp(u_blacks * 0.18, -0.18, 0.18);"," float whitePoint = clamp(1.0 - u_whites * 0.18, 0.82, 1.18);"," color = (color - blackPoint) / max(whitePoint - blackPoint, 0.2);"," color.r += u_temperature * 0.08 + u_tint * 0.04;"," color.b -= u_temperature * 0.08 - u_tint * 0.04;"," color.g -= u_tint * 0.08;"," color = (color - 0.5) * max(0.0, 1.0 + u_contrast) + 0.5;"," float satLuma = lumaOf(color);"," float currentSat = clamp(colorSaturation(color), 0.0, 1.0);"," float skinLike = smoothstep(0.02, 0.18, color.r - color.g) * smoothstep(0.0, 0.16, color.g - color.b) * smoothstep(0.18, 0.82, satLuma);"," float vibranceWeight = (1.0 - currentSat * 0.72) * mix(1.0, 0.55, skinLike);"," color = mix(vec3(satLuma), color, max(0.0, 1.0 + u_vibrance * vibranceWeight));"," color = mix(vec3(satLuma), color, max(0.0, 1.0 + u_saturation));"," return color;","}","vec3 applyColorGrade(vec3 color){"," color = applyPrimaryGrade(color);"," color = applyAdvancedGrade(color);"," return clamp(applyLut(clamp(color, 0.0, 1.0)), 0.0, 1.0);","}","vec3 applyDither(vec3 source, float amount){"," if (amount <= 0.0) return source;"," float scale = max(min(u_resolution.x, u_resolution.y) / 540.0, 0.25);"," float pixelSize = mix(1.0, 5.0, clamp(u_ditherSize, 0.0, 1.0)) * scale;"," vec2 block = floor(gl_FragCoord.xy / max(pixelSize, 1.0));"," float levels = clamp(u_paletteSize, 2.0, 6.0);"," float index = floor(clamp(lumaOf(source) * (levels - 1.0) + bayer4(block), 0.0, levels - 1.0));"," return mix(source, paletteColor(index), amount);","}","vec2 asciiEdgeDirection(vec2 uv, vec2 stepUv){"," float topLeft = bt601Luma(sampleMedia(uv + vec2(-stepUv.x, -stepUv.y)).rgb);"," float top = bt601Luma(sampleMedia(uv + vec2(0.0, -stepUv.y)).rgb);"," float topRight = bt601Luma(sampleMedia(uv + vec2(stepUv.x, -stepUv.y)).rgb);"," float left = bt601Luma(sampleMedia(uv + vec2(-stepUv.x, 0.0)).rgb);"," float right = bt601Luma(sampleMedia(uv + vec2(stepUv.x, 0.0)).rgb);"," float bottomLeft = bt601Luma(sampleMedia(uv + vec2(-stepUv.x, stepUv.y)).rgb);"," float bottom = bt601Luma(sampleMedia(uv + vec2(0.0, stepUv.y)).rgb);"," float bottomRight = bt601Luma(sampleMedia(uv + stepUv).rgb);"," float x = -topLeft - 2.0 * left - bottomLeft + topRight + 2.0 * right + bottomRight;"," float y = -topLeft - 2.0 * top - topRight + bottomLeft + 2.0 * bottom + bottomRight;"," return vec2(x, y);","}","vec2 rotateAsciiUv(vec2 uv, float angle){"," float cosine = cos(angle);"," float sine = sin(angle);"," vec2 centered = uv - 0.5;"," return vec2(centered.x * cosine - centered.y * sine, centered.x * sine + centered.y * cosine) + 0.5;","}","vec3 applyAscii(vec3 source, float amount){"," if (amount <= 0.0) return source;"," float scale = max(min(u_resolution.x, u_resolution.y) / 540.0, 0.25);"," float cellHeight = mix(4.0, 80.0, clamp(u_asciiSize, 0.0, 1.0)) * scale;"," vec2 cellSize = vec2(cellHeight);"," vec2 cell = floor(gl_FragCoord.xy / cellSize);"," vec2 cellVuv = (cell + 0.5) * cellSize / max(u_resolution, vec2(1.0));"," vec2 cellUv = (cellVuv - u_uvOffset) / u_uvScale;"," cellUv = applyCrtWarp(cellUv);"," vec3 cellColor = applyColorGrade(sampleMedia(cellUv).rgb);"," float brightness = bt601Luma(cellColor);"," float invert = step(0.5, u_asciiInvert);"," brightness = mix(brightness, 1.0 - brightness, invert);"," vec2 glyphUv = fract(gl_FragCoord.xy / cellSize);"," float rotation = clamp(u_asciiRotation, 0.0, 1.0);"," if (rotation > 0.0) {"," vec2 cellStepUv = cellSize / max(u_resolution * u_uvScale, vec2(1.0));"," vec2 edge = asciiEdgeDirection(cellUv, cellStepUv);"," if (length(edge) > 0.1) glyphUv = mix(glyphUv, rotateAsciiUv(glyphUv, atan(edge.y, edge.x)), rotation);"," }"," float ink = asciiStyleSample(floor(u_asciiStyle + 0.5), brightness, glyphUv);"," vec3 background = paletteColor(0.0);"," vec3 inkColor = mix(paletteColor(max(u_paletteSize - 1.0, 1.0)), cellColor, clamp(u_asciiColor, 0.0, 1.0));"," vec3 asciiColor = mix(background, inkColor, ink);"," return mix(source, asciiColor, amount);","}","vec3 applyScanlines(vec3 source, float amount){"," if (amount <= 0.0) return source;"," float count = mix(50.0, 500.0, clamp(u_scanlineCount, 0.0, 1.0));"," float softness = clamp(u_scanlineSoftness, 0.0, 1.0);"," float wave = 0.5 + 0.5 * sin(v_uv.y * count * PI);"," float line = mix(1.0 - wave, pow(1.0 - wave, 2.2), softness);"," return source * (1.0 - line * amount);","}","void main(){"," vec2 uv = (v_uv - u_uvOffset) / u_uvScale;"," if (uv.x < 0.0 || uv.y < 0.0 || uv.x > 1.0 || uv.y > 1.0) {"," gl_FragColor = vec4(0.0);"," return;"," }"," vec4 originalSample = sampleSource(uv);"," uv = applyCrtWarp(uv);"," vec2 displayEdge = smoothstep(vec2(0.0), vec2(0.006), uv) * (1.0 - smoothstep(vec2(0.994), vec2(1.0), uv));"," float displayMask = displayEdge.x * displayEdge.y;"," vec4 sampleColor = sampleMedia(uv);"," sampleColor = sampleChromaticMedia(uv, sampleColor);"," sampleColor.rgb = applyDigitalGlitch(uv, sampleColor.rgb);"," vec3 original = originalSample.rgb;"," vec3 color = mix(sampleColor.rgb, applyColorGrade(sampleColor.rgb), u_intensity);"," float grainAmount = clamp(u_grain, 0.0, 1.0);"," if (grainAmount > 0.0) {"," float grainPixelSize = mix(1.0, 6.0, clamp(u_grainSize, 0.0, 1.0));"," vec2 grainCoord = floor(gl_FragCoord.xy / grainPixelSize) + vec2(u_grainSeed, u_grainSeed * 1.37);"," float grainBase = grainHash(grainCoord) - grainHash(grainCoord + vec2(19.19, 73.31));"," float grainFine = grainHash(gl_FragCoord.xy + vec2(u_grainSeed * 2.11, u_grainSeed * 0.71)) - 0.5;"," float grain = mix(grainBase * 0.7, grainBase + grainFine * 0.35, clamp(u_grainRoughness, 0.0, 1.0));"," float grainLuma = lumaOf(color);"," float grainMask = smoothstep(0.02, 0.55, grainLuma) * (1.0 - smoothstep(0.88, 1.0, grainLuma));"," color += grain * grainAmount * mix(0.025, 0.08, grainMask);"," }"," float filmArtifacts = clamp(u_filmArtifacts, 0.0, 1.0);"," if (filmArtifacts > 0.0) {"," float filmFrame = floor(u_grainSeed);"," float dust = dustMask(v_uv, floor(filmFrame / 3.0));"," float dustTone = grainHash(vec2(floor(filmFrame / 3.0), 8.0));"," color = mix(color, vec3(dustTone > 0.5 ? 0.95 : 0.02), dust * 0.72 * filmArtifacts);"," float scratchBucket = floor(filmFrame / 12.0);"," float scratchX = grainHash(vec2(scratchBucket, 4.2));"," float scratchLife = step(0.78, grainHash(vec2(scratchBucket, 8.4)));"," float scratch = (1.0 - smoothstep(0.0, 1.4 / max(u_resolution.x, 1.0), abs(v_uv.x - scratchX))) * scratchLife;"," color = mix(color, vec3(0.94, 0.88, 0.76), scratch * 0.28 * filmArtifacts);"," }"," color = applyMonoScreen(clamp(color, 0.0, 1.0), clamp(u_monoScreen, 0.0, 1.0));"," color = applyEngraving(clamp(color, 0.0, 1.0), clamp(u_engraving, 0.0, 1.0));"," color = applyCrosshatch(uv, clamp(color, 0.0, 1.0), clamp(u_crosshatch, 0.0, 1.0));"," color = applyHalftone(clamp(color, 0.0, 1.0), clamp(u_halftone, 0.0, 1.0));"," color = applyTwoInkPrint(clamp(color, 0.0, 1.0), clamp(u_twoInkPrint, 0.0, 1.0));"," color = applyDither(clamp(color, 0.0, 1.0), clamp(u_dither, 0.0, 1.0));"," color = applyAscii(clamp(color, 0.0, 1.0), clamp(u_ascii, 0.0, 1.0));"," if (u_bloomReady > 0.5 && u_bloom > 0.0) color += sampleBloom(uv) * u_bloom;"," color = applyScanlines(clamp(color, 0.0, 1.0), clamp(u_scanlines, 0.0, 1.0));"," vec2 vignetteAspect = u_resolution.x > u_resolution.y"," ? vec2(u_resolution.x / max(u_resolution.y, 1.0), 1.0)"," : vec2(1.0, u_resolution.y / max(u_resolution.x, 1.0));"," vec2 vignetteUv = abs((v_uv - vec2(0.5)) * 2.0) * vignetteAspect;"," float vignettePower = mix(8.0, 1.8, clamp(u_vignetteRoundness * 0.5 + 0.5, 0.0, 1.0));"," float vignetteDistance = pow(pow(vignetteUv.x, vignettePower) + pow(vignetteUv.y, vignettePower), 1.0 / vignettePower);"," float vignetteMidpoint = mix(0.22, 1.08, clamp(u_vignetteMidpoint, 0.0, 1.0));"," float vignetteFeather = mix(0.08, 0.72, clamp(u_vignetteFeather, 0.0, 1.0));"," float vignetteMask = smoothstep(vignetteMidpoint, vignetteMidpoint + vignetteFeather, vignetteDistance);"," color *= 1.0 - vignetteMask * clamp(u_vignette, 0.0, 1.0) * 0.75;"," float warpActive = step(0.0001, u_crtCurvature);"," color *= mix(1.0, displayMask, warpActive);"," vec3 graded = clamp(color, 0.0, 1.0);"," if (u_compareEnabled > 0.5) {"," float pos = clamp(u_comparePosition, 0.0, 1.0);"," float softness = max(u_compareSoftness, 0.00001);"," float afterMask = smoothstep(pos - softness, pos + softness, v_uv.x);"," vec3 splitColor = mix(original, graded, afterMask);"," float lineMask = 0.0;"," if (u_compareLineWidth > 0.0) {"," float lineWidth = max(u_compareLineWidth / max(u_resolution.x, 1.0), 0.00001);"," lineMask = 1.0 - smoothstep(lineWidth, lineWidth * 1.8, abs(v_uv.x - pos));"," }"," gl_FragColor = vec4(mix(splitColor, vec3(1.0), lineMask * 0.82), sampleColor.a);"," return;"," }"," gl_FragColor = vec4(graded, sampleColor.a);","}"].join(`\n`),Ib=["#ifdef GL_FRAGMENT_PRECISION_HIGH","precision highp float;","#else","precision mediump float;","#endif","varying vec2 v_uv;","uniform sampler2D u_source;","uniform vec2 u_resolution;","uniform vec2 u_direction;","uniform float u_radius;","uniform float u_bloomPass;","uniform float u_threshold;","vec4 readSource(vec2 uv){"," vec4 color = texture2D(u_source, clamp(uv, vec2(0.0), vec2(1.0)));"," if (u_bloomPass > 0.5) {"," float luminance = dot(color.rgb, vec3(0.299, 0.587, 0.114));"," if (u_threshold >= 0.0 && luminance <= u_threshold) color.rgb = vec3(0.0);"," return vec4(color.rgb, 1.0);"," }"," color.rgb *= color.a;"," return color;","}","void main(){"," if (u_bloomPass > 0.5) {"," vec2 stepUv = u_direction * max(u_radius, 0.0) / max(u_resolution, vec2(1.0)) * 0.5;"," vec4 bloom = readSource(v_uv) * 0.227027;"," bloom += readSource(v_uv + stepUv) * 0.1945946;"," bloom += readSource(v_uv - stepUv) * 0.1945946;"," bloom += readSource(v_uv + stepUv * 2.0) * 0.1216216;"," bloom += readSource(v_uv - stepUv * 2.0) * 0.1216216;"," bloom += readSource(v_uv + stepUv * 3.0) * 0.054054;"," bloom += readSource(v_uv - stepUv * 3.0) * 0.054054;"," bloom += readSource(v_uv + stepUv * 4.0) * 0.016216;"," bloom += readSource(v_uv - stepUv * 4.0) * 0.016216;"," gl_FragColor = bloom;"," return;"," }"," vec2 stepUv = u_direction * max(u_radius, 0.0) / max(u_resolution, vec2(1.0)) / 12.0;"," vec4 color = readSource(v_uv) * 0.08077993;"," color += readSource(v_uv + stepUv * 1.0) * 0.07918038;"," color += readSource(v_uv - stepUv * 1.0) * 0.07918038;"," color += readSource(v_uv + stepUv * 2.0) * 0.07456928;"," color += readSource(v_uv - stepUv * 2.0) * 0.07456928;"," color += readSource(v_uv + stepUv * 3.0) * 0.06747307;"," color += readSource(v_uv - stepUv * 3.0) * 0.06747307;"," color += readSource(v_uv + stepUv * 4.0) * 0.05865827;"," color += readSource(v_uv - stepUv * 4.0) * 0.05865827;"," color += readSource(v_uv + stepUv * 5.0) * 0.04899551;"," color += readSource(v_uv - stepUv * 5.0) * 0.04899551;"," color += readSource(v_uv + stepUv * 6.0) * 0.03931982;"," color += readSource(v_uv - stepUv * 6.0) * 0.03931982;"," color += readSource(v_uv + stepUv * 7.0) * 0.03031761;"," color += readSource(v_uv - stepUv * 7.0) * 0.03031761;"," color += readSource(v_uv + stepUv * 8.0) * 0.02245983;"," color += readSource(v_uv - stepUv * 8.0) * 0.02245983;"," color += readSource(v_uv + stepUv * 9.0) * 0.01598624;"," color += readSource(v_uv - stepUv * 9.0) * 0.01598624;"," color += readSource(v_uv + stepUv * 10.0) * 0.01093238;"," color += readSource(v_uv - stepUv * 10.0) * 0.01093238;"," color += readSource(v_uv + stepUv * 11.0) * 0.00718308;"," color += readSource(v_uv - stepUv * 11.0) * 0.00718308;"," color += readSource(v_uv + stepUv * 12.0) * 0.00453456;"," color += readSource(v_uv - stepUv * 12.0) * 0.00453456;"," if (color.a > 0.0001) color.rgb /= color.a;"," gl_FragColor = color;","}"].join(`\n`),Pb=["#ifdef GL_FRAGMENT_PRECISION_HIGH","precision highp float;","#else","precision mediump float;","#endif","varying vec2 v_uv;","uniform sampler2D u_source;","uniform sampler2D u_blurSource;","uniform vec2 u_texel;","uniform vec2 u_uvScale;","uniform vec2 u_uvOffset;","uniform float u_blurReady;","uniform float u_blur;","uniform float u_kuwaharaRadius;","vec3 readPrepared(vec2 displayUv){"," vec2 uv = (displayUv - u_uvOffset) / u_uvScale;"," vec3 color = texture2D(u_source, clamp(uv, vec2(0.0), vec2(1.0))).rgb;"," if (u_blurReady > 0.5 && u_blur > 0.0) {"," vec3 blurred = texture2D(u_blurSource, clamp(uv, vec2(0.0), vec2(1.0))).rgb;"," color = mix(color, blurred, clamp(u_blur, 0.0, 1.0));"," }"," return color;","}","void main(){"," float radius = floor(mix(2.0, 16.0, clamp(u_kuwaharaRadius, 0.0, 1.0)) + 0.5);"," vec3 sum = vec3(0.0);"," float sumSquares = 0.0;"," float count = 0.0;"," for (int offset = 0; offset <= 16; offset++) {"," if (float(offset) > radius) continue;"," vec3 color = readPrepared(v_uv + vec2(float(offset), 0.0) * u_texel);"," sum += color;"," sumSquares += dot(color, color) / 3.0;"," count += 1.0;"," }"," gl_FragColor = vec4(sum / count, sumSquares / count);","}"].join(`\n`),Ob=["#ifdef GL_FRAGMENT_PRECISION_HIGH","precision highp float;","#else","precision mediump float;","#endif","varying vec2 v_uv;","uniform sampler2D u_kuwaharaMoments;","uniform vec2 u_texel;","uniform float u_kuwaharaRadius;","uniform float u_kuwaharaSharpness;","uniform float u_kuwaharaSaturation;","void main(){"," float radius = floor(mix(2.0, 16.0, clamp(u_kuwaharaRadius, 0.0, 1.0)) + 0.5);"," vec2 origins[4];"," origins[0] = vec2(-radius, -radius);"," origins[1] = vec2(0.0, -radius);"," origins[2] = vec2(-radius, 0.0);"," origins[3] = vec2(0.0, 0.0);"," vec3 means[4];"," float variances[4];"," float minVariance = 1.0;"," for (int quadrant = 0; quadrant < 4; quadrant++) {"," vec4 moment = vec4(0.0);"," float count = 0.0;"," for (int offset = 0; offset <= 16; offset++) {"," if (float(offset) > radius) continue;"," vec2 sampleOffset = origins[quadrant] + vec2(0.0, float(offset));"," moment += texture2D(u_kuwaharaMoments, clamp(v_uv + sampleOffset * u_texel, vec2(0.0), vec2(1.0)));"," count += 1.0;"," }"," moment /= count;"," vec3 mean = moment.rgb;"," float meanSquare = moment.a * 3.0;"," float variance = max(meanSquare - dot(mean, mean), 0.0);"," means[quadrant] = mean;"," variances[quadrant] = variance;"," minVariance = min(minVariance, variance);"," }"," float exponent = 1.0 + clamp(u_kuwaharaSharpness, 0.0, 1.0) * 8.0;"," vec3 result = vec3(0.0);"," float totalWeight = 0.0;"," for (int quadrant = 0; quadrant < 4; quadrant++) {"," float weight = pow((minVariance + 0.0001) / (variances[quadrant] + 0.0001), exponent);"," result += means[quadrant] * weight;"," totalWeight += weight;"," }"," result /= max(totalWeight, 0.0001);"," float luma = dot(result, vec3(0.2126, 0.7152, 0.0722));"," float saturation = clamp(u_kuwaharaSaturation, 0.0, 1.0) * 2.0;"," gl_FragColor = vec4(clamp(mix(vec3(luma), result, saturation), 0.0, 1.0), 1.0);","}"].join(`\n`);function Nt(e){return e instanceof HTMLVideoElement||e instanceof HTMLImageElement}function Rd(e){let t=window.getComputedStyle(e);return t.display!=="none"&&t.visibility!=="hidden"}function kd(e,t,n){let r=e.createShader(n);return r?(e.shaderSource(r,t),e.compileShader(r),e.getShaderParameter(r,e.COMPILE_STATUS)?r:(L("runtime.colorGrading.compileShader",e.getShaderInfoLog(r)),e.deleteShader(r),null)):null}function Si(e,t=Db){let n=kd(e,Lb,e.VERTEX_SHADER),r=kd(e,t,e.FRAGMENT_SHADER);if(!n||!r)return n&&e.deleteShader(n),r&&e.deleteShader(r),null;let i=e.createProgram();return i?(e.attachShader(i,n),e.attachShader(i,r),e.linkProgram(i),e.deleteShader(n),e.deleteShader(r),e.getProgramParameter(i,e.LINK_STATUS)?i:(L("runtime.colorGrading.linkProgram",e.getProgramInfoLog(i)),e.deleteProgram(i),null)):null}function bi(e,t=e.LINEAR,n=e.UNSIGNED_BYTE){let r=e.createTexture();return r?(e.bindTexture(e.TEXTURE_2D,r),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,t),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,t),e.texImage2D(e.TEXTURE_2D,0,e.RGBA,1,1,0,e.RGBA,n,null),r):null}function Hb(e,t){let n=Si(e,Ib);return n?{program:n,quad:t,position:e.getAttribLocation(n,"a_pos"),source:e.getUniformLocation(n,"u_source"),resolution:e.getUniformLocation(n,"u_resolution"),direction:e.getUniformLocation(n,"u_direction"),radius:e.getUniformLocation(n,"u_radius"),bloomPass:e.getUniformLocation(n,"u_bloomPass"),threshold:e.getUniformLocation(n,"u_threshold")}:null}function Gb(e,t){let n=Si(e,Pb);return n?{program:n,quad:t,position:e.getAttribLocation(n,"a_pos"),source:e.getUniformLocation(n,"u_source"),blurSource:e.getUniformLocation(n,"u_blurSource"),texel:e.getUniformLocation(n,"u_texel"),uvScale:e.getUniformLocation(n,"u_uvScale"),uvOffset:e.getUniformLocation(n,"u_uvOffset"),blurReady:e.getUniformLocation(n,"u_blurReady"),blur:e.getUniformLocation(n,"u_blur"),radius:e.getUniformLocation(n,"u_kuwaharaRadius")}:null}function Bb(e,t){let n=Si(e,Ob);return n?{program:n,quad:t,position:e.getAttribLocation(n,"a_pos"),moments:e.getUniformLocation(n,"u_kuwaharaMoments"),texel:e.getUniformLocation(n,"u_texel"),radius:e.getUniformLocation(n,"u_kuwaharaRadius"),sharpness:e.getUniformLocation(n,"u_kuwaharaSharpness"),saturation:e.getUniformLocation(n,"u_kuwaharaSaturation")}:null}function ir(e,t=e.UNSIGNED_BYTE,n=e.LINEAR){let r=bi(e,n,t),i=e.createFramebuffer();if(!r||!i)return r&&e.deleteTexture(r),i&&e.deleteFramebuffer(i),null;e.bindFramebuffer(e.FRAMEBUFFER,i),e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,r,0);let o=e.checkFramebufferStatus(e.FRAMEBUFFER);return e.bindFramebuffer(e.FRAMEBUFFER,null),o!==e.FRAMEBUFFER_COMPLETE?(e.deleteTexture(r),e.deleteFramebuffer(i),null):{texture:r,framebuffer:i,type:t,width:1,height:1}}function yi(e,t,n,r){t.width===n&&t.height===r||(t.width=n,t.height=r,e.bindTexture(e.TEXTURE_2D,t.texture),e.texImage2D(e.TEXTURE_2D,0,e.RGBA,n,r,0,e.RGBA,t.type,null))}function Pa(e,t,n){let r=[];for(let i of n){let o=e.getUniformLocation(t,`u_${i}`);o!==null&&r.push([i,o])}return r}function Md(e,t,n){t&&e.deleteProgram(t);for(let r of n)r&&e.deleteTexture(r)}function Ba(e){let t=e.getContext("webgl",{alpha:!0,premultipliedAlpha:!1});if(!t)return null;let n=Si(t),r=bi(t),i=bi(t,t.NEAREST),o=bi(t,t.NEAREST);if(!n||!r||!i||!o)return Md(t,n,[r,i,o]),null;let a=t.createBuffer();return a?(t.bindBuffer(t.ARRAY_BUFFER,a),t.bufferData(t.ARRAY_BUFFER,new Float32Array([-1,-1,1,-1,-1,1,1,1]),t.STATIC_DRAW),{gl:t,program:{program:n,texture:r,lutTexture:i,advancedTexture:o,advancedSignature:null,quad:a,position:t.getAttribLocation(n,"a_pos"),source:t.getUniformLocation(n,"u_source"),blurSource:t.getUniformLocation(n,"u_blurSource"),bloomSource:t.getUniformLocation(n,"u_bloomSource"),kuwaharaSource:t.getUniformLocation(n,"u_kuwaharaSource"),lut:t.getUniformLocation(n,"u_lut"),advanced:t.getUniformLocation(n,"u_advanced"),resolution:t.getUniformLocation(n,"u_resolution"),uvScale:t.getUniformLocation(n,"u_uvScale"),uvOffset:t.getUniformLocation(n,"u_uvOffset"),blurReady:t.getUniformLocation(n,"u_blurReady"),bloomReady:t.getUniformLocation(n,"u_bloomReady"),kuwaharaReady:t.getUniformLocation(n,"u_kuwaharaReady"),lutEnabled:t.getUniformLocation(n,"u_lutEnabled"),lutSize:t.getUniformLocation(n,"u_lutSize"),lutTextureSize:t.getUniformLocation(n,"u_lutTextureSize"),lutDomainMin:t.getUniformLocation(n,"u_lutDomainMin"),lutDomainMax:t.getUniformLocation(n,"u_lutDomainMax"),lutIntensity:t.getUniformLocation(n,"u_lutIntensity"),shadowWheel:t.getUniformLocation(n,"u_shadowWheel"),midtoneWheel:t.getUniformLocation(n,"u_midtoneWheel"),highlightWheel:t.getUniformLocation(n,"u_highlightWheel"),rgbCurvesEnabled:t.getUniformLocation(n,"u_rgbCurvesEnabled"),hueCurvesEnabled:t.getUniformLocation(n,"u_hueCurvesEnabled"),secondaryCount:t.getUniformLocation(n,"u_secondaryCount"),adjustUniforms:Pa(t,n,jr),detailUniforms:Pa(t,n,Lo),effectUniforms:Pa(t,n,Do),grainSeed:t.getUniformLocation(n,"u_grainSeed"),effectTime:t.getUniformLocation(n,"u_effectTime"),paletteSize:t.getUniformLocation(n,"u_paletteSize"),palette0:t.getUniformLocation(n,"u_palette0"),palette1:t.getUniformLocation(n,"u_palette1"),palette2:t.getUniformLocation(n,"u_palette2"),palette3:t.getUniformLocation(n,"u_palette3"),palette4:t.getUniformLocation(n,"u_palette4"),palette5:t.getUniformLocation(n,"u_palette5"),intensity:t.getUniformLocation(n,"u_intensity"),compareEnabled:t.getUniformLocation(n,"u_compareEnabled"),comparePosition:t.getUniformLocation(n,"u_comparePosition"),compareSoftness:t.getUniformLocation(n,"u_compareSoftness"),compareLineWidth:t.getUniformLocation(n,"u_compareLineWidth")}}):(Md(t,n,[r,i,o]),null)}function Ub(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function Wb(e){if(!Ub(e))return{...nn};let t=(n,r,i,o)=>{let a=typeof n=="number"?n:Number(n);return Math.min(o,Math.max(i,Number.isFinite(a)?a:r))};return{enabled:e.enabled===!0,position:t(e.position,nn.position,0,1),softness:t(e.softness,nn.softness,0,.25),lineWidth:t(e.lineWidth,nn.lineWidth,0,12)}}function Hd(e){try{let t=new URL(e,document.baseURI);return t.protocol==="data:"?{href:t.href}:t.protocol!=="http:"&&t.protocol!=="https:"?{error:"LUT must be project-local or a data URL"}:t.origin!==window.location.origin?{error:"Remote LUT URLs are not supported"}:{href:t.href}}catch{return{error:"Invalid LUT URL"}}}function Ai(e){return e instanceof Error?e.message:"LUT failed to load"}function Vb(e){let t=2166136261;for(let n=0;n>>0)%1e4}function Gd(e){let t=e.id||e.currentSrc||e.getAttribute("src")||`${e.tagName}:${Array.prototype.indexOf.call(e.parentNode?.children??[],e)}`;return Vb(t)}function Ua(e){let t=Hd(e);if("error"in t)return{state:"error",message:t.error};let n=rt.get(t.href);if(n)return n;let r=fetch(t.href,{credentials:"same-origin"}).then(o=>{if(!o.ok)throw new Error(`Failed to load LUT (${o.status})`);return o.text()}).then(o=>Kl(o,{maxSize:Vr})),i={state:"pending",promise:r};for(;rt.size>=_b;){let o=rt.keys().next().value;if(!o)break;rt.delete(o)}return rt.set(t.href,i),r.then(o=>{rt.get(t.href)===i&&rt.set(t.href,{state:"ready",lut:o})},o=>{rt.get(t.href)===i&&rt.set(t.href,{state:"error",message:Ai(o)})}),i}function Fd(e,t,n){if(e.lut?.src===t)return e.lut;let r=wo(n),{gl:i,program:o}=e;try{return Bd(i,o.lutTexture,r),e.lut={src:t,size:n.size,domainMin:n.domainMin,domainMax:n.domainMax,textureWidth:r.width,textureHeight:r.height},e.lutError=null,e.lutLoadingSrc=null,e.lut}catch(a){return e.lut=null,e.lutError=Ai(a),e.lutLoadingSrc=null,L("runtime.colorGrading.uploadLut",a),null}}async function zb(e){let t=Ua(e);if(t.state==="ready")return t.lut;if(t.state==="pending")return t.promise;throw new Error(t.message)}function Bd(e,t,n){e.activeTexture(e.TEXTURE2),e.bindTexture(e.TEXTURE_2D,t),e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,!1),e.texImage2D(e.TEXTURE_2D,0,e.RGBA,n.width,n.height,0,e.RGBA,e.UNSIGNED_BYTE,n.data)}function qb(e,t,n){let r=wo(n),{gl:i,program:o}=e;return Bd(i,o.lutTexture,r),{src:t,size:n.size,domainMin:n.domainMin,domainMax:n.domainMax,textureWidth:r.width,textureHeight:r.height}}function Xe(e,t){e.deleteTexture(t.texture),e.deleteFramebuffer(t.framebuffer)}function Wa(e){let t=e.effectTargets;t&&(e.gl.deleteProgram(t.blurProgram.program),Xe(e.gl,t.scratch),Xe(e.gl,t.blur),t.bloom&&Xe(e.gl,t.bloom),e.effectTargets=null)}function Va(e){let t=e.kuwaharaTargets;t&&(e.gl.deleteProgram(t.horizontalProgram.program),e.gl.deleteProgram(t.resolveProgram.program),Xe(e.gl,t.moments),Xe(e.gl,t.output),e.kuwaharaTargets=null)}function xi(e,t=!1){Wa(e),Va(e),$b(e.gl,e.program),t&&e.gl.getExtension("WEBGL_lose_context")?.loseContext()}function $b(e,t){e.deleteTexture(t.texture),e.deleteTexture(t.lutTexture),e.deleteTexture(t.advancedTexture),e.deleteBuffer(t.quad),e.deleteProgram(t.program)}function jb(e){let t=Ba(e.canvas);return t?(xi(e),e.gl=t.gl,e.program=t.program,e.lut=null,e.lutLoadingSrc=null,e.lutError=null,e.effectError=null,!0):!1}function Ga(e){if(!e.sourceHidden)return;e.element.removeAttribute(Nn);let t=e.element.style.getPropertyValue("opacity"),n=e.element.style.getPropertyPriority("opacity");t==="0"&&n==="important"&&(e.sourceInlineOpacity===null?e.element.style.removeProperty("opacity"):e.element.style.setProperty("opacity",e.sourceInlineOpacity,e.sourceInlineOpacityPriority)),e.sourceHidden=!1}function Kb(e){if(e.effectTargets)return e.effectTargets;let{gl:t}=e,n=Hb(t,e.program.quad),r=ir(t),i=ir(t);return!n||!r||!i?(n&&t.deleteProgram(n.program),r&&Xe(t,r),i&&Xe(t,i),e.effectError="Framebuffer effects unavailable",null):(e.effectError=null,e.effectTargets={blurProgram:n,scratch:r,blur:i,bloom:null},e.effectTargets)}function Yb(e,t){return t.bloom||(t.bloom=ir(e.gl),e.effectError=t.bloom?null:"Framebuffer effects unavailable"),t.bloom}function Nd(e){let t=e.effectTargets;t?.bloom&&(Xe(e.gl,t.bloom),t.bloom=null)}function Xb(e){if(e.kuwaharaTargets)return e.kuwaharaTargets;let{gl:t}=e,n=t.getExtension("OES_texture_half_float"),r=t.getExtension("EXT_color_buffer_half_float");if(!n||!r)return e.effectError="Kuwahara requires half-float framebuffer support",null;let i=Gb(t,e.program.quad),o=Bb(t,e.program.quad),a=ir(t,n.HALF_FLOAT_OES,t.NEAREST),l=ir(t);return!i||!o||!a||!l?(Jb(t,i,o,a,l),e.effectError="Kuwahara framebuffer effects unavailable",null):(e.kuwaharaTargets={horizontalProgram:i,resolveProgram:o,moments:a,output:l},e.kuwaharaTargets)}function Jb(e,t,n,r,i){t&&e.deleteProgram(t.program),n&&e.deleteProgram(n.program),r&&Xe(e,r),i&&Xe(e,i)}function Ud(e,t,n,r,i){let o=Math.max(1,Math.ceil(r)),a=Math.max(1,Math.ceil(i));return yi(e,t,o,a),yi(e,n,o,a),{width:o,height:a}}function vi(e,t,n,r,i,o,a,l=!1,s=-1){e.bindFramebuffer(e.FRAMEBUFFER,r.framebuffer),e.viewport(0,0,i.width,i.height),e.useProgram(t.program),e.activeTexture(e.TEXTURE0),e.bindTexture(e.TEXTURE_2D,n),e.uniform1i(t.source,0),e.uniform2f(t.resolution,i.width,i.height),e.uniform2f(t.direction,o.x,o.y),e.uniform1f(t.radius,a),e.uniform1f(t.bloomPass,l?1:0),e.uniform1f(t.threshold,s),or(e,t)}function Qb(e,t,n,r,i,o,a){let l=Ud(e,t.scratch,r,i/2,o/2),s=a/2;vi(e,t.blurProgram,n,t.scratch,l,{x:1,y:0},s,!0,.5),vi(e,t.blurProgram,t.scratch.texture,r,l,{x:0,y:1},s,!0)}function Zb(e,t,n,r,i,o,a){let l=n;for(let s=0;s.55?3:2),!0}function nx(e,t,n,r,i,o){if(n<=0)return Nd(e),null;o||Nd(e);let a=o?Yb(e,t):t.blur;return a?(Qb(e.gl,t,e.program.texture,a,i.width,i.height,r),a.texture):null}function rx(e,t,n,r){let{program:i}=e,o=t.effects.blur,a=t.effects.bloom;if(o<=0&&a<=0)return e.effectTargets&&r&&Wa(e),{blurReady:!1,bloomReady:!1,blurTexture:i.texture,bloomTexture:i.texture};let l=Kb(e);if(!l)return{blurReady:!1,bloomReady:!1,blurTexture:i.texture,bloomTexture:i.texture};let s=tx(e,l,o,n),u=nx(e,l,a,t.effects.bloomRadius,n,s);return{blurReady:s,bloomReady:u!==null,blurTexture:l.blur.texture,bloomTexture:u??i.texture}}function ix(e,t,n,r,i,o,a){let l=t.effects.kuwahara;if(l<=0&&!o)return e.kuwaharaTargets&&a&&Va(e),{kuwaharaReady:!1,kuwaharaTexture:e.program.texture};let s=Xb(e);return!s||l<=0?{kuwaharaReady:!1,kuwaharaTexture:s?.output.texture??e.program.texture}:(ex(e.gl,s,e.program.texture,e.effectTargets?.blur.texture??e.program.texture,n,r,i,t.effects),{kuwaharaReady:!0,kuwaharaTexture:s.output.texture})}function Wd(e,t,n,r,i={}){let o=i.releaseIdleTargets??!0;e.effectError=null;let a=rx(e,t,n,o),l=ix(e,t,n,r,a.blurReady,i.preserveKuwahara??!1,o);return{...a,...l}}function ox(e){let t=e.grading.lut?.src.trim()??"",n=e.grading.lut?.intensity??1;if(!t||n<=0)return e.lut=null,e.lutLoadingSrc=null,e.lutError=null,null;let r=Hd(t);if("error"in r)return e.lut=null,e.lutLoadingSrc=null,e.lutError=r.error,null;if(e.lut?.src===r.href)return e.lut;e.lut=null;let i=Ua(t);return i.state==="ready"?Fd(e,r.href,i.lut):i.state==="error"?(e.lutError=i.message,e.lutLoadingSrc=null,null):(e.lutLoadingSrc!==r.href&&(e.lutLoadingSrc=r.href,e.lutError=null,i.promise.then(o=>{e.destroyed||e.grading.lut?.src.trim()!==t||(Fd(e,r.href,o),De(e))},o=>{e.destroyed||e.grading.lut?.src.trim()!==t||(e.lut=null,e.lutError=Ai(o),e.lutLoadingSrc=null,De(e))})),null)}function nr(e){if(!e)return null;if(typeof e=="string"){let t=e.trim();if(!t)return null;let n=document.getElementById(t.replace(/^#/,""));if(n&&Nt(n))return n;try{let r=document.querySelector(t);return r&&Nt(r)?r:null}catch{return null}}if(e.hfId){let t=document.querySelector(`[data-hf-id="${CSS.escape(e.hfId)}"]`);if(t&&Nt(t))return t}if(e.id){let t=document.getElementById(e.id);if(t&&Nt(t))return t}if(!e.selector)return null;try{let t=Array.from(document.querySelectorAll(e.selector)),n=Math.max(0,Math.floor(Number(e.selectorIndex??0)||0)),r=t[n]??null;return r&&Nt(r)?r:null}catch{return null}}function Vd(e){return e instanceof HTMLVideoElement?e.videoWidth>0&&e.videoHeight>0?{width:e.videoWidth,height:e.videoHeight}:null:e instanceof HTMLImageElement&&e.naturalWidth>0&&e.naturalHeight>0?{width:e.naturalWidth,height:e.naturalHeight}:null}function zd(e){return e instanceof HTMLVideoElement?e.readyState>=HTMLMediaElement.HAVE_CURRENT_DATA&&e.videoWidth>0&&e.videoHeight>0:e instanceof HTMLImageElement?e.complete&&e.naturalWidth>0&&e.naturalHeight>0:!1}function qd(e){let t=ut(e);return t&&zd(t)?t:null}function Ld(e){if(!(e instanceof HTMLVideoElement))return!1;let t=qd(e);if(!t)return!1;let n=window.getComputedStyle(t);return n.display!=="none"&&n.visibility!=="hidden"}function ax(e){return e instanceof HTMLImageElement&&e.classList.contains("__render_frame__")}function sx(e,t){t.parentNode&&t.nextSibling!==e.canvas&&t.parentNode.insertBefore(e.canvas,t.nextSibling)}function $d(e){if(e instanceof HTMLVideoElement){let t=qd(e);if(t)return t}return zd(e)?e:null}function Dd(e,t){let n=e.toLowerCase();if(n==="center")return .5;if(t==="x"){if(n==="left")return 0;if(n==="right")return 1}else{if(n==="top")return 0;if(n==="bottom")return 1}if(n.endsWith("%")){let r=Number.parseFloat(n);return Number.isFinite(r)?r/100:null}return null}function lx(e){let t=e.trim().split(/\\s+/).filter(Boolean),n=.5,r=.5;for(let i=0;i0)){r=l;continue}}return{x:n,y:r}}function jd(e,t,n,r,i,o){if(e<=0||t<=0||n<=0||r<=0)return{scaleX:1,scaleY:1,offsetX:0,offsetY:0};let a=i||"fill",l=e,s=t;if(a==="contain"||a==="cover"||a==="scale-down"){let m=a==="cover"?Math.max(e/n,t/r):Math.min(e/n,t/r);l=n*m,s=r*m,a==="scale-down"&&l>n&&s>r&&(l=n,s=r)}else a==="none"&&(l=n,s=r);let u=lx(o||"center"),c=(e-l)*u.x/e,f=(t-s)*u.y/t;return{scaleX:l/e,scaleY:s/t,offsetX:c,offsetY:f}}function ux(e,t){window.getComputedStyle(t).position==="static"&&(e.touchedParent||(e.touchedParent=t,e.parentInlinePosition=t.style.position||null),t.style.position="relative")}function Id(e,t){return Math.max(0,Math.round(e>0?e:t))}function cx(e,t){let{element:n,canvas:r}=e,i=n.parentElement;i&&ux(e,i);let o=window.getComputedStyle(t);vu(r.style,o),r.style.pointerEvents="none",r.style.position="absolute",r.style.inset="auto",r.style.left=`${n.offsetLeft}px`,r.style.top=`${n.offsetTop}px`,r.style.right="auto",r.style.bottom="auto",r.style.width=`${n.offsetWidth}px`,r.style.height=`${n.offsetHeight}px`,r.style.display="block",r.style.opacity=e.sourceOpacityForCanvas,r.style.visibility=e.sourceVisibleForCanvas?"visible":"hidden";let a=n.getBoundingClientRect(),l=Id(n.offsetWidth,a.width),s=Id(n.offsetHeight,a.height);if(l<=0||s<=0)return r.style.display="none",null;let u=Math.max(1,window.devicePixelRatio||1),c=Math.round(l*u),f=Math.round(s*u);return r.width!==c&&(r.width=c),r.height!==f&&(r.height=f),{width:c,height:f}}function tn(e,t,n){e.uniform3f(t,Number.parseInt(n.slice(1,3),16)/255,Number.parseInt(n.slice(3,5),16)/255,Number.parseInt(n.slice(5,7),16)/255)}function Lt(e,t,n,r){e.set(r,(t*je+n)*4)}function yt(e,t){return Math.min(1,Math.max(1/255,(e*(127/t)+128)/255))}function Oa(e,t,n){return e.length>=3?_o(e,t,n):new Float32Array(je)}function Ft(e,t){return e[t]??0}function dx(e,t,n){let r=Vt(t.red),i=Vt(t.green),o=Vt(t.blue),a=Vt(t.master),l=Oa(n.hueVsHue,-180,180),s=Oa(n.hueVsSaturation,-1,1),u=Oa(n.hueVsLuma,-1,1);for(let c=0;cM+Number(D.enabled),0):0;(v||x||_>0)&&hx(e,t,n,b),Ha(e,t.shadowWheel,n.wheels.shadows),Ha(e,t.midtoneWheel,n.wheels.midtones),Ha(e,t.highlightWheel,n.wheels.highlights),e.uniform1f(t.rgbCurvesEnabled,v?1:0),e.uniform1f(t.hueCurvesEnabled,x?1:0),e.uniform1f(t.secondaryCount,_);for(let[M,D]of t.adjustUniforms)e.uniform1f(D,n.adjust[M]);for(let[M,D]of t.detailUniforms)e.uniform1f(D,n.details[M]);e.uniform1f(t.grainSeed,c),e.uniform1f(t.effectTime,f);for(let[M,D]of t.effectUniforms)e.uniform1f(D,n.effects[M]);let R=n.palette??(n.effects.engraving>0||n.effects.crosshatch>0?Rb:Da),T=R[R.length-1]??Da[1];e.uniform1f(t.paletteSize,R.length),tn(e,t.palette0,R[0]??Da[0]),tn(e,t.palette1,R[1]??T),tn(e,t.palette2,R[2]??T),tn(e,t.palette3,R[3]??T),tn(e,t.palette4,R[4]??T),tn(e,t.palette5,R[5]??T),e.uniform1f(t.intensity,n.intensity),e.uniform1f(t.compareEnabled,l.enabled?1:0),e.uniform1f(t.comparePosition,l.position),e.uniform1f(t.compareSoftness,l.softness),e.uniform1f(t.compareLineWidth,l.lineWidth)}function gx(e){if(!e.sourceHidden){let t=e.element.getAttribute($r);t!==null?(e.sourceInlineOpacity=t===""?null:t,e.sourceInlineOpacityPriority=""):(e.sourceInlineOpacity=e.element.style.getPropertyValue("opacity")||null,e.sourceInlineOpacityPriority=e.element.style.getPropertyPriority("opacity"))}e.element.setAttribute(Nn,"true"),e.element.style.setProperty("opacity","0","important"),e.sourceHidden=!0}function it(e){let t=pu.find(n=>n.path===e);if(!t)throw new Error(`Missing color-grading animation property: ${e}`);return t}var Yd=it("intensity"),Xd=it("lut.intensity"),Jd=it("adjust.exposure"),Qd=it("effects.kuwahara"),Zd=[["blur",it("effects.blur")],["bloom",it("effects.bloom")],["kuwahara",Qd],["pixelate",it("effects.pixelate")],["ascii",it("effects.ascii")],["dither",it("effects.dither")]],ef=[Yd,Xd,Jd,...Zd.map(([,e])=>e)];function Dt(e,t){let n=e.style.getPropertyValue(t.name);if(!n)return null;let r=Number(n);return Number.isFinite(r)?Math.min(t.max,Math.max(t.min,r)):null}function rr(e,t){return t!==null&&(xu(t)||ef.some(n=>Dt(e,n)!==null))}function bx(e,t){let n=null;for(let[r,i]of Zd){let o=Dt(e,i);o!==null&&(n??(n={...t.effects}),n[r]=o)}return n}function xx(e){let{element:t,grading:n}=e,r=Dt(t,Yd),i=Dt(t,Xd),o=Dt(t,Jd),a=bx(t,n);if(![r,i,o].some(u=>u!==null)&&a===null)return n;let s={...n,adjust:o===null?n.adjust:{...n.adjust,exposure:o},effects:a??n.effects};return r!==null&&(s.intensity=r),n.lut&&i!==null&&(s.lut={...n.lut,intensity:i}),s}function tf(e,t,n){e.activeTexture(e.TEXTURE0),e.bindTexture(e.TEXTURE_2D,t),e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,!0),e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,n)}function nf(e,t,n){let r=[t.texture,n.blurTexture,t.lutTexture,n.kuwaharaTexture,n.bloomTexture,t.advancedTexture];for(let[i,o]of r.entries())e.activeTexture(e.TEXTURE0+i),e.bindTexture(e.TEXTURE_2D,o)}function De(e){if(e.destroyed||e.contextLost)return!1;let t=$d(e.element);if(!t)return e.hasDrawn||(e.canvas.style.display="none"),!1;let n=Vd(t);if(!n)return!1;let r=t instanceof HTMLElement?t:e.element,i=e.element.style.getPropertyValue("opacity"),o=e.element.style.getPropertyPriority("opacity"),a=e.sourceHidden&&i==="0"&&o==="important",l=e.element.style.getPropertyValue("visibility"),s=ax(t);s&&sx(e,t),a&&!s&&(e.sourceInlineOpacity!==null?e.element.style.setProperty("opacity",e.sourceInlineOpacity,e.sourceInlineOpacityPriority||""):e.element.style.removeProperty("opacity"));let u=window.getComputedStyle(s?t:e.element);e.sourceOpacityForCanvas=u.opacity||"1",a&&!s&&e.element.style.setProperty("opacity","0","important"),e.sourceVisibleForCanvas=(s||l!=="hidden")&&u.visibility!=="hidden";let c=cx(e,r);if(!c)return!1;let f=window.getComputedStyle(r),m=jd(c.width,c.height,n.width,n.height,f.objectFit,f.objectPosition),{gl:p,program:b}=e;try{let v=xx(e),x=ox(e);tf(p,b.texture,t);let _=Dt(e.element,Qd)!==null,R=Wd(e,v,c,m,{preserveKuwahara:_});p.bindFramebuffer(p.FRAMEBUFFER,null),p.viewport(0,0,c.width,c.height),p.useProgram(b.program),nf(p,b,R);let T=window.__player?.getTime?.(),M=typeof T=="number"&&Number.isFinite(T)?Math.max(0,T):e.element instanceof HTMLVideoElement?Math.max(0,e.element.currentTime):0,D=e.grainSeed+Math.floor(M*60);return Kd(p,b,v,x,R.blurReady,R.bloomReady,R.kuwaharaReady,e.compare,c,m,D,M),or(p,b),gx(e),e.hasDrawn=!0,e.drawError=null,!0}catch(v){return e.drawError=v instanceof Error?v.message:"Shader draw failed",L("runtime.colorGrading.drawEntry",v),!1}}function yx(e,t,n){let r=e.getBoundingClientRect(),i=e.offsetWidth||r.width||t.width,o=e.offsetHeight||r.height||t.height,a=Math.min(320,Math.max(64,Math.round(n??160))),l=i>0&&o>0?i/o:t.width/t.height;return l>=1?{width:a,height:Math.max(1,Math.round(a/l))}:{width:Math.max(1,Math.round(a*l)),height:a}}function vx(){let e=document.createElement("canvas"),t=Ba(e);return t?{canvas:e,...t,lut:null,effectTargets:null,kuwaharaTargets:null,effectError:null}:null}function Sx(e,t){let n=t?void 0:window.__player?.getTime?.();return typeof n=="number"&&Number.isFinite(n)?Math.max(0,n):e instanceof HTMLVideoElement?Math.max(0,e.currentTime):0}function Ax(e,t,n,r){let i=$d(t);if(!i)return null;let o=Vd(i);if(!o)return null;let a=yx(t,o,n);e.canvas.width=a.width,e.canvas.height=a.height;let l=i instanceof HTMLElement?i:t,s=window.getComputedStyle(l),u=jd(a.width,a.height,o.width,o.height,s.objectFit,s.objectPosition);return tf(e.gl,e.program.texture,i),{dimensions:a,uv:u,effectTime:Sx(t,r),grainSeed:Gd(t)+(t instanceof HTMLVideoElement?Math.floor(t.currentTime*60):0)}}async function Ex(e,t,n,r,i=!1){let o=Ax(e,t,r,i);if(!o)return null;let{dimensions:a,uv:l,grainSeed:s,effectTime:u}=o,c=[];for(let f of n.slice(0,32)){let m=Kr(f.grading);if(!m){c.push({id:f.id,dataUrl:null,error:"Invalid grading"});continue}let p=null;try{m.lut&&(e.lut?.src!==m.lut.src&&(e.lut=qb(e,m.lut.src,await zb(m.lut.src))),p=e.lut),c.push({id:f.id,dataUrl:wx(e,m,p,a,l,s,u)})}catch(b){c.push({id:f.id,dataUrl:null,error:Ai(b)})}}return{...a,images:c}}function wx(e,t,n,r,i,o,a){let{canvas:l,gl:s,program:u}=e,c=Wd(e,t,r,i,{releaseIdleTargets:!1});return s.bindFramebuffer(s.FRAMEBUFFER,null),s.viewport(0,0,r.width,r.height),s.useProgram(u.program),nf(s,u,c),n||(e.lut=null),Kd(s,u,t,n,c.blurReady,c.bloomReady,c.kuwaharaReady,nn,r,i,o,a),or(s,u),l.toDataURL("image/png")}function Ye(e,t,n,r){t.addEventListener(n,r),e.cleanup.push(()=>t.removeEventListener(n,r))}function Cx(e){e.animationFrame!==null&&(window.cancelAnimationFrame(e.animationFrame),e.animationFrame=null),e.videoFrameHandle!==null&&e.element instanceof HTMLVideoElement&&(e.element.cancelVideoFrameCallback?.(e.videoFrameHandle),e.videoFrameHandle=null)}function ar(e){if(e.destroyed||!(e.element instanceof HTMLVideoElement)||e.videoFrameHandle!==null||e.animationFrame!==null)return;let t=e.element,n=t;if(typeof n.requestVideoFrameCallback=="function"){e.videoFrameHandle=n.requestVideoFrameCallback(()=>{e.videoFrameHandle=null,De(e),!e.destroyed&&!t.paused&&!t.ended&&ar(e)});return}e.animationFrame=window.requestAnimationFrame(()=>{e.animationFrame=null,De(e),!e.destroyed&&!t.paused&&!t.ended&&ar(e)})}function _x(e){let t=()=>{De(e)};if(Ye(e,e.element,"load",t),Ye(e,e.element,"loadedmetadata",t),Ye(e,e.element,"loadeddata",t),Ye(e,e.element,"seeked",t),Ye(e,e.element,"timeupdate",t),Ye(e,window,"resize",t),e.element instanceof HTMLVideoElement&&(Ye(e,e.element,"play",()=>ar(e)),Ye(e,e.element,"pause",t)),Ye(e,e.canvas,"webglcontextlost",n=>{n.preventDefault(),e.contextLost=!0,e.drawError="WebGL context lost",e.canvas.style.display="none",Ga(e)}),Ye(e,e.canvas,"webglcontextrestored",()=>{if(e.contextLost=!1,!jb(e)){e.contextLost=!0,e.drawError="WebGL context restore failed",Ga(e);return}e.drawError=null,De(e)}),typeof ResizeObserver<"u"&&(e.resizeObserver=new ResizeObserver(t),e.resizeObserver.observe(e.element)),typeof MutationObserver<"u"){let n=()=>{let a=e.element.style;return`${a.transform}|${a.translate}|${a.rotate}|${a.scale}|${a.left}|${a.top}|${a.width}|${a.height}`},r=n(),i=!1,o=new MutationObserver(()=>{i||n()!==r&&(i=!0,requestAnimationFrame(()=>{i=!1,r=n(),De(e)}))});o.observe(e.element,{attributes:!0,attributeFilter:["style"]}),e.cleanup.push(()=>o.disconnect())}}function Tx(e){if(e.destroyed)return null;e.destroyed=!0,Cx(e),e.resizeObserver?.disconnect();for(let t of e.cleanup)t();return e.cleanup.length=0,e.canvas.remove(),Wa(e),Va(e),Ga(e),e.touchedParent&&(e.parentInlinePosition===null?e.touchedParent.style.removeProperty("position"):e.touchedParent.style.position=e.parentInlinePosition),{canvas:e.canvas,gl:e.gl,program:e.program,effectTargets:null,kuwaharaTargets:null,effectError:null}}function rf(e,t){return e.removeAttribute("style"),t.id?e.id=`${uu}${t.id}`:e.removeAttribute("id"),e.className=Cb,e.setAttribute(wb,"true"),e.setAttribute("data-hyperframes-ignore",""),e.setAttribute("data-hyperframes-picker-ignore",""),e.setAttribute("data-hf-ignore",""),e.setAttribute("aria-hidden","true"),e.style.pointerEvents="none",e.style.display="none",t.parentNode?.insertBefore(e,t.nextSibling),e}function Rx(e){return rf(document.createElement("canvas"),e)}function of(){let e=new WeakMap,t=new Set,n=[],r=null,i=null,o=Promise.resolve(),a=!1,l=(E,S,A)=>{let C=e.get(E);if(C)return C.grading=S,C.source=A,De(C),E instanceof HTMLVideoElement&&!E.paused&&ar(C),!0;let F=n.pop();if(F)rf(F.canvas,E);else{let q=Rx(E),W=Ba(q);if(!W)return q.remove(),!1;F={canvas:q,gl:W.gl,program:W.program,effectTargets:null,kuwaharaTargets:null,effectError:null}}let I={element:E,...F,grading:S,compare:{...nn},lut:null,lutLoadingSrc:null,lutError:null,drawError:null,effectTargets:null,kuwaharaTargets:null,effectError:null,source:A,animationFrame:null,videoFrameHandle:null,resizeObserver:null,cleanup:[],touchedParent:null,parentInlinePosition:null,sourceHidden:!1,sourceInlineOpacity:null,sourceInlineOpacityPriority:"",sourceOpacityForCanvas:window.getComputedStyle(E).opacity||"1",sourceVisibleForCanvas:window.getComputedStyle(E).visibility!=="hidden",hasDrawn:!1,contextLost:!1,grainSeed:Gd(E),destroyed:!1};return e.set(E,I),t.add(E),_x(I),De(I),E instanceof HTMLVideoElement&&!E.paused&&ar(I),!0},s=(E,S)=>{if(a)return!1;let A=nr(E);if(!A)return!1;let C=e.get(A);if(!C){let F=gi(A);if(!rr(A,F)||!l(A,F,"attribute"))return!1;C=e.get(A)}return C?(C.compare=Wb(S),De(C),!0):!1},u=E=>{let S=e.get(E);if(!S)return;let A=Tx(S);A&&(S.contextLost||n.length>=Tb?xi(A,!0):n.push(A)),e.delete(E),t.delete(E)},c=()=>{if(a)return 0;let E=new Set;document.querySelectorAll(`video[${Fn}], img[${Fn}]`).forEach(A=>{if(!Nt(A))return;E.add(A);let C=gi(A);rr(A,C)&&(Rd(A)||Ld(A))?l(A,C,"attribute"):u(A)});for(let A of t){let C=e.get(A);C&&(!A.isConnected||C.source==="attribute"&&!E.has(A))&&u(A)}return t.size},f=()=>{if(a)return 0;let E=0;for(let S of t){let A=e.get(S);A&&De(A)&&(E+=1)}return E},m=async()=>{let E=new Set;for(let S of t){let A=e.get(S)?.grading.lut;if(!A?.src.trim()||(A.intensity??1)<=0)continue;let C=Ua(A.src);C.state==="pending"&&E.add(C.promise)}return E.size>0&&await Promise.allSettled(E),f(),E.size},p=()=>{if(a)return 0;let E=0;for(let S of t){let A=e.get(S);!A||!ef.some(F=>Dt(S,F)!==null)||S instanceof HTMLVideoElement&&!S.paused&&!S.ended||De(A)&&(E+=1)}return E},b=(E,S)=>{if(a)return!1;let A=nr(E);if(!A)return!1;let C=Kr(S);return rr(A,C)?l(A,C,"live"):(u(A),!0)},v=(E,S)=>{if(!Nt(E))return!1;let A=e.get(E);if(!A){if(!S)return!1;let C=gi(E);return rr(E,C)&&l(E,C,"attribute")}return A.sourceVisibleForCanvas=S,!S&&A.source==="attribute"&&u(E),!0},x=E=>{let S=nr(E);if(!S)return{state:"missing",message:"Media not found"};let A=e.get(S);if(A)return A.effectError?{state:"unavailable",message:A.effectError}:A.drawError?{state:"unavailable",message:A.drawError}:A.lutError?{state:"unavailable",message:`LUT error: ${A.lutError}`}:A.grading.lut&&A.lutLoadingSrc?{state:"pending",message:"Loading LUT"}:A.canvas.style.display==="none"?{state:"pending",message:"Waiting for media frame"}:{state:"active",message:A.lut?"Shader + LUT active":"Shader active"};let C=gi(S);return rr(S,C)?!Rd(S)&&!Ld(S)?{state:"pending",message:"Waiting for visible media"}:{state:"unavailable",message:"WebGL unavailable"}:{state:"inactive",message:"No grading applied"}},_=async(E,S,A)=>{let C=async()=>{if(a||S.length===0)return null;let I=nr(E);return!I||(i??(i=vx()),!i)?null:Ex(i,I,S,A?.maxDimension,A?.useMediaTime)},F=o.then(C,C);return o=F.then(()=>{},()=>{}),F},R=E=>{let S=nr(E);if(!(S instanceof HTMLVideoElement))return null;if(!S.paused)return()=>{};let A=S.currentTime,C=S.loop,F=S.muted;return S.loop=!0,S.muted=!0,(S.ended||Number.isFinite(S.duration)&&A>=S.duration)&&(S.currentTime=0),S.play().catch(()=>{}),()=>{S.pause(),S.loop=C,S.muted=F,S.currentTime=A}},T=()=>{if(!a){a=!0,r?.disconnect(),r=null;for(let E of t)u(E);for(let E of n)xi(E,!0);n.length=0,i&&(xi(i,!0),i=null)}};document.body&&(r=new MutationObserver(()=>c()),r.observe(document.body,{childList:!0,subtree:!0,attributes:!0,attributeFilter:[Fn]}));let M={refresh:c,redraw:f,redrawAnimated:p,waitForActiveLuts:m,setGrading:b,setCompare:s,setSourceVisibility:v,getStatus:x,renderPreviews:_,startPreviewPlayback:R,destroy:T},D=window;return D.__hf=D.__hf||{},D.__hf.colorGrading=M,c(),M}var Ei=class{constructor(t){ge(this,"_baseTime",0);ge(this,"_playStartMs",null);ge(this,"_rate",1);ge(this,"_duration",1/0);ge(this,"_nowMs");ge(this,"_audioSource",null);this._baseTime=t?.initialTime??0,this._rate=t?.rate??1,this._duration=t?.duration??1/0,this._nowMs=t?.nowMs??(()=>performance.now())}now(){if(this._playStartMs===null)return this._baseTime;if(this._audioSource){let r=null;if("currentTimeSeconds"in this._audioSource)r=this._audioSource.currentTimeSeconds;else{let{el:i,compositionStart:o,mediaStart:a}=this._audioSource;!i.paused&&Number.isFinite(i.currentTime)&&(r=(i.currentTime-a)/(i.playbackRate>0?i.playbackRate:1)*this._rate+o)}if(r!==null)return Number.isFinite(this._duration)&&r>=this._duration?this._duration:Math.max(0,r)}let t=(this._nowMs()-this._playStartMs)/1e3,n=this._baseTime+t*this._rate;return Number.isFinite(this._duration)&&n>=this._duration?this._duration:Math.max(0,n)}play(){return this._playStartMs!==null||Number.isFinite(this._duration)&&this._baseTime>=this._duration?!1:(this._playStartMs=this._nowMs(),!0)}pause(){return this._playStartMs===null?!1:(this._baseTime=this.now(),this._playStartMs=null,!0)}seek(t){let n=Number.isFinite(this._duration)?Math.max(0,Math.min(t,this._duration)):Math.max(0,t);this._baseTime=n,this._playStartMs!==null&&(this._playStartMs=this._nowMs())}isPlaying(){return this._playStartMs!==null}setRate(t){let n=Number.isFinite(t)&&t>0?Math.max(.1,Math.min(5,t)):1;this._playStartMs!==null&&(this._baseTime=this.now(),this._playStartMs=this._nowMs()),this._rate=n}getRate(){return this._rate}setDuration(t){this._duration=Number.isFinite(t)&&t>0?t:1/0,this._baseTime>this._duration&&(this._baseTime=this._duration)}getDuration(){return this._duration}attachAudioSource(t){this._audioSource=t}detachAudioSource(){this._audioSource&&this._playStartMs!==null&&(this._baseTime=this.now(),this._playStartMs=this._nowMs()),this._audioSource=null}hasAudioSource(){return this._audioSource!==null}getSource(){if(this._audioSource&&this._playStartMs!==null){if("currentTimeSeconds"in this._audioSource)return"audio";let{el:t}=this._audioSource;if(!t.paused&&Number.isFinite(t.currentTime))return"audio"}return"monotonic"}snapshot(){return{time:this.now(),playing:this.isPlaying(),rate:this._rate,duration:this._duration,source:this.getSource()}}reachedEnd(){return Number.isFinite(this._duration)&&this.now()>=this._duration}};var kx=100,Mx=8,Fx=4096,za=e=>e;function Nx(e,t,n){return!(!!e.curve||e.viaX!==void 0&&e.viaY!==void 0)&&t==="linear"&&!n}function Lx(e){let t=Math.ceil(e*kx);return Math.min(Fx,Math.max(Mx,t))}function Dx(e,t,n,r,i){let{scheduledAt:o,elapsed:a,rate:l}=r,s=i??za,u=R=>o+(R-a)/l,c=e.points[t],f=e.points[t+1],m=u(f.t);if(m<=o)return null;let p=Math.max(o,u(c.t)),b=m-p;if(b<=0)return null;if(Nx(c,n,i))return{kind:"ramp",time:m,value:s(f.v)};let v=Lx(b),x=Ll(e,Math.max(c.t,a),f.t,v,n),_=new Float32Array(v);for(let R=0;Rl.id).map(l=>[l.id,l.handle])),a=[];for(let l of e.lanes){let s=Cn(l.target);if(!s)continue;let u=s.kind==="preset"?i?.[s.presetId]:s.kind==="fx"?o.get(s.nodeId)?.automation?.[s.param]:void 0;if(!u||u.length===0)continue;let c=fo(l.target,t);c&&(qa(u,l,c.scale,r),a.push(...u))}return a}function sf(e){return e.lanes.find(t=>t.target===Bt)??null}var Ox=`\nconst dbToLin = (db) => Math.pow(10, db / 20);\n\n/**\n * One-pole envelope followers, one per channel.\n *\n * Per channel matters: the followers advance once per sample, so a single shared\n * follower stepped once per channel per sample. On stereo that ran a 20 ms attack\n * as 10 ms, and gave the right channel a gain computed from an envelope that had\n * already traversed the left \\u2014 so the two channels ducked by different amounts\n * from the same input and the image pumped.\n */\nclass EnvBank {\n constructor(attackMs, releaseMs) { this.set(attackMs, releaseMs); this.values = []; }\n set(attackMs, releaseMs) {\n this.a = Math.exp(-1 / (sampleRate * Math.max(1e-5, attackMs / 1000)));\n this.r = Math.exp(-1 / (sampleRate * Math.max(1e-5, releaseMs / 1000)));\n }\n push(ch, x) {\n const prev = this.values[ch] ?? 0;\n const m = Math.abs(x);\n const c = m > prev ? this.a : this.r;\n const next = m + c * (prev - m);\n this.values[ch] = next;\n return next;\n }\n}\n\n/** Soft-knee gain computer in dB, matching acompressor\'s shape. */\nfunction kneeGain(envDb, thresholdDb, ratio, kneeDb) {\n const over = envDb - thresholdDb;\n if (kneeDb > 0 && over > -kneeDb && over < kneeDb) {\n const t = (over + kneeDb) / (2 * kneeDb);\n return -((1 - 1 / ratio) * kneeDb * t * t);\n }\n return over > 0 ? -(over * (1 - 1 / ratio)) : 0;\n}\n\n// log10/exp per sample is the single most expensive thing a dynamics processor\n// can do on the audio thread, and every sample below the knee needs neither:\n// its gain is exactly unity. Comparing envelopes in the linear domain lets the\n// quiet majority of samples skip the transcendentals entirely.\nconst LN10_OVER_20 = Math.LN10 / 20;\nconst dbToLinFast = (db) => Math.exp(db * LN10_OVER_20);\n\nclass HfCompressor extends AudioWorkletProcessor {\n constructor(o) {\n super();\n this.p = o.processorOptions || {};\n this.env = new EnvBank(this.p.attack ?? 20, this.p.release ?? 250);\n this.port.onmessage = (e) => {\n if (e.data && e.data.__hfDispose) { this.dead = true; return; }\n this.p = { ...this.p, ...e.data };\n this.env.set(this.p.attack ?? 20, this.p.release ?? 250);\n };\n }\n process(inputs, outputs) {\n if (this.dead) return false;\n const i = inputs[0], o = outputs[0];\n if (!i || !i.length) return true;\n const p = this.p;\n const makeup = dbToLin(p.makeup ?? 0);\n const mix = p.mix ?? 1;\n // Knee is expressed as a ratio in FFmpeg; convert to dB width.\n const kneeDb = 20 * Math.log10(Math.max(1.0001, p.knee ?? 2.83));\n const thresholdDb = p.threshold ?? -24;\n const ratio = p.ratio ?? 4;\n // Below this the gain computer returns unity, so the sample needs no\n // logarithm at all.\n const kneeStartLin = dbToLin(thresholdDb - kneeDb);\n const dry = 1 - mix;\n for (let ch = 0; ch < i.length; ch++) {\n const inp = i[ch], out = o[ch];\n for (let n = 0; n < inp.length; n++) {\n const x = inp[n];\n // Per-channel follower, and the sub-knee shortcut: below the knee the\n // gain is exactly unity, so the sample needs no logarithm at all.\n const env = this.env.push(ch, x);\n if (env <= kneeStartLin) {\n out[n] = x * makeup * mix + x * dry;\n continue;\n }\n const envDb = 20 * Math.log10(env);\n const g = dbToLinFast(kneeGain(envDb, thresholdDb, ratio, kneeDb));\n out[n] = x * g * makeup * mix + x * dry;\n }\n }\n return true;\n }\n}\nregisterProcessor("hf-compressor", HfCompressor);\n\nclass HfLimiter extends AudioWorkletProcessor {\n constructor(o) {\n super();\n this.p = o.processorOptions || {};\n this.env = new EnvBank(this.p.attack ?? 5, this.p.release ?? 50);\n this.port.onmessage = (e) => {\n if (e.data && e.data.__hfDispose) { this.dead = true; return; }\n this.p = { ...this.p, ...e.data };\n this.env.set(this.p.attack ?? 5, this.p.release ?? 50);\n };\n }\n process(inputs, outputs) {\n if (this.dead) return false;\n const i = inputs[0], o = outputs[0];\n if (!i || !i.length) return true;\n const ceiling = dbToLin(this.p.limit ?? -1);\n const outGain = dbToLin(this.p.level_out ?? 0);\n for (let ch = 0; ch < i.length; ch++) {\n const inp = i[ch], out = o[ch];\n for (let n = 0; n < inp.length; n++) {\n const x = inp[n];\n const env = this.env.push(ch, x);\n // Only ever attenuate: a limiter that can raise level is a compressor.\n const g = env > ceiling ? ceiling / env : 1;\n out[n] = x * g * outGain;\n }\n }\n return true;\n }\n}\nregisterProcessor("hf-limiter", HfLimiter);\n\nclass HfGate extends AudioWorkletProcessor {\n constructor(o) {\n super();\n this.p = o.processorOptions || {};\n this.env = new EnvBank(this.p.attack ?? 1, this.p.release ?? 100);\n this.gains = [];\n this.port.onmessage = (e) => {\n if (e.data && e.data.__hfDispose) { this.dead = true; return; }\n this.p = { ...this.p, ...e.data };\n this.env.set(this.p.attack ?? 1, this.p.release ?? 100);\n };\n }\n process(inputs, outputs) {\n if (this.dead) return false;\n const i = inputs[0], o = outputs[0];\n if (!i || !i.length) return true;\n const p = this.p;\n const threshold = dbToLin(p.threshold ?? -35);\n const floor = dbToLin(p.range ?? -24);\n const ratio = p.ratio ?? 10;\n // Knee is declared in the registry as a ratio, like the compressor\'s; a\n // hard threshold ignored it and chattered on material sitting right at the\n // gate point.\n const kneeDb = 20 * Math.log10(Math.max(1.0001, p.knee ?? 2.83));\n const kneeLin = dbToLin((p.threshold ?? -35) + kneeDb);\n for (let ch = 0; ch < i.length; ch++) {\n const inp = i[ch], out = o[ch];\n for (let n = 0; n < inp.length; n++) {\n const x = inp[n];\n const env = this.env.push(ch, x);\n let target = 1;\n // Above the threshold the gate is fully open; skip the pow entirely.\n if (env < threshold) {\n const under = env > 1e-9 ? threshold / env : 1e9;\n target = Math.max(floor, 1 / Math.pow(under, ratio - 1));\n if (!isFinite(target)) target = floor;\n }\n // Smooth toward the target so the gate does not click on every sample.\n const held = this.gains[ch] ?? 1;\n const c = target < held ? this.env.r : this.env.a;\n const smoothed = target + c * (held - target);\n this.gains[ch] = smoothed;\n out[n] = x * smoothed;\n }\n }\n return true;\n }\n}\nregisterProcessor("hf-gate", HfGate);\n\nclass HfBitcrush extends AudioWorkletProcessor {\n constructor(o) {\n super();\n this.p = o.processorOptions || {};\n this.holds = [];\n this.held = [];\n this.port.onmessage = (e) => {\n if (e.data && e.data.__hfDispose) { this.dead = true; return; }\n this.p = { ...this.p, ...e.data };\n };\n }\n process(inputs, outputs) {\n if (this.dead) return false;\n const i = inputs[0], o = outputs[0];\n if (!i || !i.length) return true;\n const p = this.p;\n const levels = Math.pow(2, (p.bits ?? 8) - 1);\n const step = Math.max(1, Math.round(p.samples ?? 1));\n const mix = p.mix ?? 1;\n for (let ch = 0; ch < i.length; ch++) {\n const inp = i[ch], out = o[ch];\n if (this.held[ch] === undefined) this.held[ch] = 0;\n if (this.holds[ch] === undefined) this.holds[ch] = 0;\n for (let n = 0; n < inp.length; n++) {\n // Per channel: advancing one shared counter only on the last channel\n // left every earlier channel either unheld or frozen for a whole\n // 128-sample quantum, clicking once a block.\n if (this.holds[ch] === 0) this.held[ch] = Math.round(inp[n] * levels) / levels;\n out[n] = this.held[ch] * mix + inp[n] * (1 - mix);\n this.holds[ch] = (this.holds[ch] + 1) % step;\n }\n }\n return true;\n }\n}\nregisterProcessor("hf-bitcrush", HfBitcrush);\n\n/** Linear-interpolated read, \\`delaySamples\\` behind the write head. */\nfunction readTap(ring, write, delaySamples) {\n const len = ring.length;\n const pos = (write - 1 - delaySamples + len) % len;\n const i0 = Math.floor(pos);\n const frac = pos - i0;\n const i1 = (i0 + 1) % len;\n return ring[i0] * (1 - frac) + ring[i1] * frac;\n}\n\n/** Equal-power-ish crossfade, zero at a tap\'s reset point \\u2014 hides the splice. */\nfunction xfade(phase) {\n return Math.sin(Math.PI * phase);\n}\n\n/**\n * Dual-tap granular delay line: two read taps 180\\xB0 apart in a 100 ms grain,\n * each sweeping at a speed relative to the write head that shifts pitch\n * without changing duration. One tap is always fading in as the other fades\n * out, which hides the splice each tap makes when it wraps.\n *\n * write/phase are block-level state, advanced once per SAMPLE across all\n * channels together (not once per channel) \\u2014 advancing them inside the\n * per-channel loop would move the tap 2x/4x too fast on a stereo/quad input.\n */\nclass HfPitchshift extends AudioWorkletProcessor {\n constructor(o) {\n super();\n this.p = o.processorOptions || {};\n this.grain = Math.round(sampleRate * 0.1);\n this.buf = [];\n this.write = 0;\n this.phase = 0;\n // Samples written so far, capped at one grain. The taps read up to a grain\n // behind the write head, so until this fills they would read the ring\'s\n // zeros \\u2014 the head of every clip came out attenuated or silent.\n this.filled = 0;\n // How much of the wet (pitch-shifted) path is currently in the output, and\n // where it is heading. Crossing between dry and wet is a ~50 ms jump in the\n // signal, so it is RAMPED rather than switched: a hard swap either way is a\n // click. Ramping in both directions is also what lets a node return to true\n // bypass at semitones 0 \\u2014 a one-way latch left preview stuck with the delay\n // that the render, building a fresh node from the attribute, does not have.\n this.wet = 0;\n this.wetTarget = 0;\n // ~15 ms one-pole, short enough to feel immediate on a slider drag and long\n // enough that the splice is inaudible.\n this.wetCoef = Math.exp(-1 / (sampleRate * 0.015));\n this.port.onmessage = (e) => {\n if (e.data && e.data.__hfDispose) { this.dead = true; return; }\n this.p = { ...this.p, ...e.data };\n };\n }\n process(inputs, outputs) {\n if (this.dead) return false;\n const i = inputs[0], o = outputs[0];\n if (!i || !i.length) return true;\n const p = this.p;\n const semitones = Math.max(-12, Math.min(12, p.semitones ?? 0));\n const mix = Math.max(0, Math.min(1, p.mix ?? 1));\n const grain = this.grain;\n const ringLen = grain * 2;\n const n = i[0] ? i[0].length : 0;\n for (let ch = 0; ch < i.length; ch++) {\n if (!this.buf[ch]) this.buf[ch] = new Float32Array(ringLen);\n }\n\n // Nothing to shift, or mixed fully out. The grain delay is ~grain/2\n // whatever the ratio, so at semitones=0 this degenerated into a pure 50 ms\n // delay of the signal \\u2014 while the copy for that exact setting reads\n // "Unchanged pitch".\n this.wetTarget = semitones === 0 ? 0 : mix;\n\n // Fully dry AND settled: take the cheap transparent path. The ring keeps\n // filling, so a later shift does not start cold.\n if (this.wetTarget === 0 && this.wet < 1e-4) {\n this.wet = 0;\n let w = this.write;\n for (let s = 0; s < n; s++) {\n for (let ch = 0; ch < i.length; ch++) {\n const x = i[ch][s];\n this.buf[ch][w] = x;\n o[ch][s] = x;\n }\n w = (w + 1) % ringLen;\n }\n this.write = w;\n this.filled = Math.min(grain, this.filled + n);\n return true;\n }\n\n const ratio = Math.pow(2, semitones / 12);\n const inc = (1 - ratio) / grain;\n let write = this.write, phase = this.phase, filled = this.filled, wetNow = this.wet;\n const target = this.wetTarget, coef = this.wetCoef;\n for (let s = 0; s < n; s++) {\n phase += inc;\n phase -= Math.floor(phase);\n const phaseB = (phase + 0.5) % 1;\n const gA = xfade(phase), gB = xfade(phaseB);\n // Ramp the wet path in as the ring fills rather than reading zeros:\n // 100 ms of unshifted audio at the head of a clip beats 50 ms of silence.\n const warm = filled >= grain ? 1 : filled / grain;\n wetNow = target + coef * (wetNow - target);\n const wetMix = wetNow * warm;\n for (let ch = 0; ch < i.length; ch++) {\n const ring = this.buf[ch];\n const inp = i[ch], out = o[ch];\n const x = inp[s];\n ring[write] = x;\n const wet =\n readTap(ring, write, phase * grain) * gA + readTap(ring, write, phaseB * grain) * gB;\n out[s] = x * (1 - wetMix) + wet * wetMix;\n }\n write = (write + 1) % ringLen;\n if (filled < grain) filled++;\n }\n this.write = write;\n this.phase = phase;\n this.filled = filled;\n this.wet = wetNow;\n return true;\n }\n}\nregisterProcessor("hf-pitchshift", HfPitchshift);\n`,$a=new WeakMap;function ja(e){return lf.has(e)}var lf=new WeakSet;function Ka(e){let t=$a.get(e);return t||(t=(async()=>{if(!e.audioWorklet)throw new Error("AudioWorklet is unavailable \\u2014 the page needs a secure context (https, localhost or file://)");let n=`data:text/javascript;base64,${btoa(String.fromCharCode(...new TextEncoder().encode(Ox)))}`;await e.audioWorklet.addModule(n),lf.add(e)})().catch(n=>{throw $a.delete(e),n}),$a.set(e,t)),t}function Hx(e,t,n){let r=.6+Math.max(0,Math.min(1,t))*2.6,i=Math.max(1,Math.floor(e*r)),o=new Float32Array(i),a=Math.round(t*1e3)*2654435761+Math.round(n*1e3)*40503>>>0,l=()=>(a=a*1664525+1013904223>>>0,a/4294967295*2-1),s=Math.max(.001,1-Math.max(0,Math.min(1,n))),u=0,c=0;for(let m=0;m0)for(let m=0;mtypeof e=="number"?e:Number(e??0),Ya=e=>e/1e3;function ff(e,t,n,r){let i=Math.max(1,Math.round(e.sampleRate)),o=e.createBuffer(1,i,e.sampleRate),a=o.getChannelData(0);for(let u=0;u1-n}]}function pf(e,t,n){e.gain.value=n,t.gain.value=1-n}function Ja(e,t,n){return{input:e,output:e,update:t,automation:n,dispose:()=>e.disconnect()}}var Gx=new Set(["peaking","highpass","lowpass"]),uf=e=>Math.pow(10,e/20),Bx=(e,t)=>{let n=e.createGain(),r=i=>{n.gain.value=uf(de(i.gain))};return r(t),Ja(n,r,{gain:[{param:n.gain,map:uf}]})};function ur(e,t){return(n,r)=>{let i=n.createBiquadFilter();i.type=e;let o=a=>{i.frequency.value=de(a.frequency),a.q!==void 0&&(i.Q.value=de(a.q)),t&&(i.gain.value=de(a.gain))};return o(r),Ja(i,o,{frequency:[{param:i.frequency}],...Gx.has(e)?{q:[{param:i.Q}]}:{},...t?{gain:[{param:i.gain}]}:{}})}}function Ux(e){return(t,n)=>{let r=Math.tan(Math.PI*de(n.frequency)/t.sampleRate),i=e==="highpass"?t.createIIRFilter([1/(1+r),-1/(1+r)],[1,(r-1)/(r+1)]):t.createIIRFilter([r/(1+r),r/(1+r)],[1,(r-1)/(r+1)]);return Ja(i,()=>{})}}function cr(e){return(t,n)=>{let r=new AudioWorkletNode(t,e,{processorOptions:{...n}});return{input:r,output:r,update:i=>r.port.postMessage({...i}),dispose:()=>{r.port.postMessage({__hfDispose:!0}),r.disconnect()}}}}var Wx={tanh:Math.tanh,atan:e=>2/Math.PI*Math.atan(Math.PI/2*e),cubic:e=>Math.abs(e)>=1?Math.sign(e):e-e**3/3,exp:e=>Math.sign(e)*(1-Math.exp(-Math.abs(e))),alg:e=>e/Math.sqrt(1+e*e),quintic:e=>Math.abs(e)>=1?Math.sign(e):e-e**5/5,sin:e=>Math.abs(e)>=1?Math.sign(e):Math.sin(Math.PI/2*e),erf:e=>Math.tanh(1.20211*e),hard:e=>Math.max(-1,Math.min(1,e))},Vx=(e,t)=>{let n=e.createWaveShaper(),r=e.createGain(),i=e.createGain();r.connect(n).connect(i);let o=a=>{let l=Wx[String(a.type)]??Math.tanh,s=Math.pow(10,de(a.threshold)/20),u=8192,c=new Float32Array(u);for(let f=0;f=4?"4x":de(a.oversample)>=2?"2x":"none",i.gain.value=Math.pow(10,de(a.output)/20)};return o(t),{input:r,output:i,update:o,automation:{output:[{param:i.gain,map:a=>Math.pow(10,a/20)}]},dispose:()=>{r.disconnect(),n.disconnect(),i.disconnect()}}},zx=(e,t)=>{let n=e.createGain(),r=e.createGain(),i=e.createDelay(5),o=e.createGain(),a=e.createGain(),l=e.createGain();n.connect(i),i.connect(o),o.connect(i),i.connect(a).connect(r),n.connect(l).connect(r);let s=u=>{i.delayTime.value=Math.min(5,de(u.time)/1e3),o.gain.value=de(u.feedback),pf(a,l,de(u.mix))};return s(t),{input:n,output:r,update:s,automation:{time:[{param:i.delayTime,map:u=>Math.min(5,Ya(u))}],feedback:[{param:o.gain}],mix:Xa(a.gain,l.gain)},dispose:()=>[n,r,i,o,a,l].forEach(u=>u.disconnect())}},qx=(e,t,n)=>{let r=e.createGain(),i=e.createGain(),o=e.createDelay(.5),a=ff(e,"sine",de(t.speed),n),l=e.createGain(),s=e.createGain(),u=e.createGain();a.connect(l).connect(o.delayTime),r.connect(o).connect(s).connect(i),r.connect(u).connect(i);let c=f=>{o.delayTime.value=de(f.delay)/1e3,l.gain.value=de(f.depth)/1e3,a.playbackRate.value=de(f.speed),pf(s,u,de(f.mix))};return c(t),{input:r,output:i,update:c,automation:{delay:[{param:o.delayTime,map:Ya}],depth:[{param:l.gain,map:Ya}],speed:[{param:a.playbackRate}],mix:Xa(s.gain,u.gain)},dispose:()=>{mf(a),[r,i,o,l,s,u].forEach(f=>f.disconnect())}}},$x=6,jx=(e,t,n)=>{let r=e.createGain(),i=e.createGain(),o=e.createGain(),a=e.createGain(),l=ff(e,String(t.type)==="1"?"sine":"triangle",de(t.speed),n),s=e.createGain(),u=e.createGain(),c=e.createGain(),f=[];r.connect(o);let m=o;for(let b=0;b<$x;b++){let v=e.createBiquadFilter();v.type="allpass",v.Q.value=.7071,s.connect(v.frequency),m.connect(v),m=v,f.push(v)}l.connect(s),m.connect(u).connect(a),o.connect(c).connect(a),a.connect(i);let p=b=>{let v=1e3/Math.max(.1,de(b.delay));for(let x of f)x.frequency.value=v;s.gain.value=v*de(b.decay),l.playbackRate.value=de(b.speed),o.gain.value=de(b.in_gain),a.gain.value=de(b.out_gain),u.gain.value=1,c.gain.value=1};return p(t),{input:r,output:i,update:p,automation:{speed:[{param:l.playbackRate}],in_gain:[{param:o.gain}],out_gain:[{param:a.gain}]},dispose:()=>{mf(l),[r,i,o,a,s,u,c,...f].forEach(b=>b.disconnect())}}},Kx=(e,t)=>{let n=e.createGain(),r=e.createGain(),i=e.createConvolver(),o=e.createGain(),a=e.createGain();i.normalize=!1,n.connect(i).connect(o).connect(r),n.connect(a).connect(r);let l="",s=u=>{let c=`${de(u.size)}:${de(u.damping)}`;if(c!==l){let f=Hx(e.sampleRate,de(u.size),de(u.damping)),m=e.createBuffer(1,f.length,e.sampleRate);m.getChannelData(0).set(f),i.buffer=m,l=c}o.gain.value=de(u.wet),a.gain.value=de(u.dry)};return s(t),{input:n,output:r,update:s,automation:{wet:[{param:o.gain}],dry:[{param:a.gain}]},dispose:()=>[n,r,i,o,a].forEach(u=>u.disconnect())}},Yx={"gain-node":Bx,"biquad-peaking":ur("peaking",!0),"biquad-lowshelf":ur("lowshelf",!0),"biquad-highshelf":ur("highshelf",!0),"biquad-highpass":ur("highpass",!1),"biquad-lowpass":ur("lowpass",!1),"worklet-compressor":cr("hf-compressor"),"worklet-limiter":cr("hf-limiter"),"worklet-gate":cr("hf-gate"),"worklet-bitcrush":cr("hf-bitcrush"),"worklet-pitchshift":cr("hf-pitchshift"),waveshaper:Vx,"delay-feedback":zx,"chorus-lfo":qx,"allpass-phaser":jx,convolver:Kx};function hf(e){return e.nodes.some(t=>Sn(t.type)?.web.startsWith("worklet-")??!1)}function Xx(e,t,n,r=0){let i=Sn(t);if(!i)throw new Error(`Unknown effect type: ${t}`);let o=An(t,n);if((t==="highpass"||t==="lowpass")&&String(o.poles)==="1")return Ux(t)(e,o,r);let a=Yx[i.web];if(!a)throw new Error(`No Web Audio builder for ${i.web}`);return a(e,o,r)}function cf(e){let t=[];for(let n of e){let r=n.fromPreset,i=t.at(-1);if(i&&i.preset===r)i.nodes.push(n);else{let o=typeof n.presetAmount=="number"?n.presetAmount:1;t.push({...r?{preset:r}:{},amount:Math.min(1,Math.max(0,o)),nodes:[n]})}}return t}function df(e){return En(e).map(t=>{let n=An(t.type,t.params),r=n.poles!==void 0?`:${n.poles}`:"",i=String(n.poles)==="1"?`@${n.frequency}`:"",o=t.type==="phaser"?`~${n.type}`:"",a=t.fromPreset?`%${t.fromPreset}`:"";return`${t.type}${r}${i}${o}${a}`}).join("|")}function gf(e,t,n=0){var f;let r=e.createGain(),i=e.createGain(),o=[],a=[],l=cf(En(t)),s=r;for(let m of l){let p=null;if(m.preset){let b=e.createGain(),v=e.createGain(),x=e.createGain(),_=e.createGain();x.gain.value=m.amount,v.gain.value=1-m.amount,s.connect(b),b.connect(v).connect(_),p={entry:b,wet:x,dry:v,join:_},s=b}for(let b of m.nodes){let v=Xx(e,b.type,b.params??{},n);s.connect(v.input),s=v.output,o.push({...b.id?{id:b.id}:{},type:b.type,handle:v})}p&&m.preset&&(s.connect(p.wet).connect(p.join),a.push({id:m.preset,...p}),s=p.join)}s.connect(i);let u=df(t),c={};for(let m of a)(c[f=m.id]??(c[f]=[])).push(...Xa(m.wet.gain,m.dry.gain));return{input:r,output:i,presets:c,nodes:o,update(m){if(df(m)!==u)return!1;En(m).forEach((b,v)=>{let x=o[v];x&&(x.handle.update(An(b.type,b.params)),b.id===void 0?delete x.id:x.id=b.id)});let p=0;for(let b of cf(En(m))){if(!b.preset)continue;let v=a[p++];!v||v.id!==b.preset||(v.wet.gain.value=b.amount,v.dry.gain.value=1-b.amount)}return!0},dispose(){for(let{handle:m}of o)m.dispose();for(let{entry:m,wet:p,dry:b,join:v}of a)m.disconnect(),p.disconnect(),b.disconnect(),v.disconnect();r.disconnect(),i.disconnect()}}}var bf={version:1,nodes:[]},xf={version:1,lanes:[]};function yf(e,t){let n=(typeof e.getAttribute=="function"?e.getAttribute(et):null)??"";if(!n)return xf;try{return Fl(Or(n),t)}catch{return xf}}function on(e){let t=(typeof e.getAttribute=="function"?e.getAttribute(Tt):null)??"";if(!t)return{chain:bf,raw:""};try{return{chain:Rl(t),raw:t}}catch{return{chain:bf,raw:""}}}function vf(e){return yf(e,on(e).chain)}function wi(e,t,n,r,i){let{chain:o}=on(t),a=null,l=[],s=!1,u=0,c=()=>{try{a?(n.disconnect(a.input),a.output.disconnect(r),a.dispose()):n.disconnect(r)}catch{}a=null},f=(T,M)=>{if(T.nodes.length===0){n.connect(r);return}if(hf(T)&&!ja(e)){n.connect(r);let D=++u;Ka(e).then(()=>{s||D!==u||x(on(t).chain)}).catch(()=>{});return}try{let D=gf(e,T,M);n.connect(D.input),D.output.connect(r),a=D}catch{n.connect(r)}},m=(T,M)=>{l=M&&a?af(yf(t,T),T,a.nodes,M,a.presets):[]},p=i?{...i}:null;f(o,p?.elapsed??0),m(o,p);let b=()=>{if(!p)return null;let T=typeof e.currentTime=="number"?e.currentTime:p.scheduledAt;return{scheduledAt:T,elapsed:p.elapsed+(T-p.scheduledAt)*p.rate,rate:p.rate}},v=T=>{let M=b();M&&(rn(l,M.scheduledAt),m(T,M))},x=T=>{let M=b();rn(l,M?.scheduledAt??0),c(),f(T,M?.elapsed??0),m(T,M)},_=null,R=t;return typeof MutationObserver<"u"&&typeof R?.nodeType=="number"&&(_=new MutationObserver(()=>{let T=on(t);l.length>0&&lr(l),!a||!a.update(T.chain)?x(T.chain):v(T.chain)}),_.observe(R,{attributes:!0,attributeFilter:[Tt,et]})),{reanchor:T=>{if(s)return;let M=b();M&&rn(l,M.scheduledAt),p={...T},m(on(t).chain,p)},setRate:T=>{let M=b();s||!M||!Number.isFinite(T)||T<=0||T===M.rate||(p={...M,rate:T},rn(l,M.scheduledAt),m(on(t).chain,p))},dispose:()=>{s=!0,_?.disconnect(),l.length>0&&rn(l,typeof e.currentTime=="number"?e.currentTime:0),a?.dispose()}}}var Sf="runtime_web_audio_bypass";function Qa(e,t){return typeof e.getAttribute=="function"?e.getAttribute(t):null}function dr(e,t){return Qa(e,t)!==null}function Jx(e){return dr(e,"crossorigin")?!0:e.crossOrigin!=null}function Qx(e){return typeof e.baseURI=="string"&&e.baseURI?e.baseURI:typeof document<"u"?document.baseURI:""}function Zx(e){let t=typeof e.currentSrc=="string"?e.currentSrc:"";if(t)return[t];let n=Qa(e,"src");if(n)return[n];if(typeof e.querySelectorAll!="function")return[];let r=[];for(let i of Array.from(e.querySelectorAll("source"))){let o=i.getAttribute("src");o&&r.push(o)}return r}function ey(e,t){if(typeof window>"u")return!1;let n;try{n=new URL(e,Qx(t))}catch{return!1}return n.protocol!=="http:"&&n.protocol!=="https:"||n.origin===window.location.origin?!1:!Jx(t)}function Ef(e){return(typeof e.currentSrc=="string"?e.currentSrc:"")?!0:dr(e,"src")}function an(e){for(let t of Zx(e))if(ey(t,e))return{kind:"decode-only",reason:"cross_origin_no_cors",asset:t};return{kind:"web-audio"}}function ty(e){let t=[];dr(e,Tt)&&t.push("fx-chain"),dr(e,et)&&t.push("automation"),dr(e,Gr)&&t.push("audio-group");let n=Number.parseFloat(Qa(e,"data-volume")??"");return Number.isFinite(n)&&n>1&&t.push("above-unity-gain"),t}function ny(){return typeof window<"u"&&!!window.__HF_EXPORT_RENDER_SEEK_CONFIG}var Af=new WeakSet;function sn(e,t){if(t.kind==="web-audio"||ny()||Af.has(e))return;let n=ty(e);Af.add(e);let r={asset:t.asset,reason:t.reason,lostProcessing:n,note:"cross-origin media without a `crossorigin` opt-in is silent through createMediaElementSource (Web Audio spec); using native playback instead"};be({source:"hf-preview",type:"diagnostic",code:Sf,details:r});let i=n.length>0?` Native playback cannot reproduce: ${n.join(", ")} \\u2014 proxy or download the asset to a same-origin URL to keep it.`:"";console.info(`[hyperframes] ${Sf}: "${t.asset}" (${t.reason}): Web Audio capture withheld; the track plays through native HTMLMediaElement output.${i}`)}function Za(e){return!Number.isFinite(e)||e<=0?1:e}function wf(e){return Le(e)}function ry(e,t){t||e.paused||!Cr().__hfDebug||console.debug("[hyperframes] webAudioTransport claimed fallback-playing element:",e.currentSrc||e.getAttribute("src")||"")}function iy(e,t){let{elapsed:n,mediaStart:r,scheduledAt:i,globalRate:o,mediaRate:a,clipDuration:l}=t,s=Number.isFinite(l)&&l>0,u=l*a;if(n>=0){let f=n*a,m=u-f;return s&&m<=0?!1:(s?e.start(0,f+r,m):e.start(0,f+r),!0)}let c=-n/o;return s?e.start(i+c,r,u):e.start(i+c,r),!0}function Ci(e,t,n){let r=sf(vf(e));r&&qa([{param:t.gain}],r,Pr.scale,n)}function fr(e){return e.sourceKind==="buffer"}var _i=class{constructor(){ge(this,"_ctx",null);ge(this,"_bufferCache",new Map);ge(this,"_failedSrcs",new Set);ge(this,"_mediaElementSources",new WeakMap);ge(this,"_activeSources",[]);ge(this,"_masterGain",null);ge(this,"_masterVolume",1);ge(this,"_masterMuted",!1);ge(this,"_groups",new Map);ge(this,"_rateAnchorCtx",0);ge(this,"_rateAnchorComp",0);ge(this,"_rate",1);ge(this,"_paused",!0);ge(this,"_playGeneration",0)}async init(){try{return this._ctx=new AudioContext,this._masterGain=this._ctx.createGain(),this._masterGain.connect(this._ctx.destination),this.applyMasterGain(),!0}catch{return!1}}get context(){return this._ctx}getTime(){return!this._ctx||this._paused?-1:this._rateAnchorComp+(this._ctx.currentTime-this._rateAnchorCtx)*this._rate}async decodeAudioElement(t){let n=t.currentSrc||t.getAttribute("src");if(!n)return null;if(this._bufferCache.has(n))return this._bufferCache.get(n);if(this._failedSrcs.has(n)||!this._ctx)return null;let r;try{let i=await fetch(n,{cache:"no-store"});if(!i.ok)return L("webAudioTransport.fetch",new Error(`${i.status} ${n}`)),null;r=await i.arrayBuffer()}catch(i){return L("webAudioTransport.fetch",i),null}try{let i=await this._ctx.decodeAudioData(r);return this._bufferCache.set(n,i),i}catch(i){return this._failedSrcs.add(n),L("webAudioTransport.decode",i),null}}startGeneration(){return this._playGeneration+=1,this._playGeneration}currentGeneration(){return this._playGeneration}acquireMediaElementSource(t){let n=this._mediaElementSources.get(t);if(n){let o=an(t);if(o.kind!=="web-audio"){try{n.disconnect()}catch{}return this._mediaElementSources.delete(t),sn(t,o),null}return n}if(!this._ctx)return null;let r=an(t);if(r.kind!=="web-audio")return sn(t,r),null;let i=this._ctx.createMediaElementSource(t);return this._mediaElementSources.set(t,i),i}async scheduleMediaElementPlayback(t,n,r,i,o,a,l=1){if(!this._ctx||!this._masterGain||a!==this._playGeneration)return null;try{if(this._ctx.state==="suspended"&&await this._ctx.resume(),a!==this._playGeneration)return null;let s=this.acquireMediaElementSource(t);if(!s)return null;let u=Za(l),c=this._ctx.createGain();c.gain.value=o;let f=this._ctx.currentTime,m=i-n,p={scheduledAt:f,elapsed:m,rate:u},b=wi(this._ctx,t,s,c,p);c.connect(this.resolveDestination(t,f,i,u)??this._masterGain),Ci(t,c,p),this._rate=u,this._rateAnchorCtx=f,this._rateAnchorComp=i;let v={fx:b,el:t,sourceNode:s,sourceKind:"media-element",gainNode:c,compositionStart:n,mediaStart:r,scheduledAt:f,priorMuted:t.muted,priorVolume:t.volume,mediaPlaybackRate:_e(t),bounded:!1};return t.volume=1,this._activeSources.push(v),this._paused=!1,v}catch(s){return L("webAudioTransport.mediaElementSource",s),null}}groupInput(t,n,r){let i=this._groups.get(t);if(i){if(i.generation!==this._playGeneration)try{i.reanchor(r),i.generation=this._playGeneration}catch(m){L("webAudioTransport.groupReanchor",m)}return i.input}if(!this._ctx||!this._masterGain)return null;let o=this._ctx.createGain(),a=this._ctx.createGain();a.connect(this._masterGain);let l=()=>po(n,t),s=l(),u=this._ctx.createGain();u.gain.value=s?.hasAttribute("data-hidden")?0:1,u.connect(a);let c=this._ctx.createGain();c.gain.value=wf(mo(s)),c.connect(u);let f=wi(this._ctx,s??{getAttribute:()=>null},o,c,r);return s&&Ci(s,c,r),this._groups.set(t,{input:o,fader:c,muteGain:u,fx:f,generation:this._playGeneration,reanchor:m=>{lr([{param:c.gain}]);let p=l();c.gain.value=wf(mo(p)),u.gain.value=p?.hasAttribute("data-hidden")?0:1,f?.reanchor(m),p&&Ci(p,c,m)},dispose:()=>{try{f?.dispose(),o.disconnect(),c.disconnect(),u.disconnect(),a.disconnect()}catch{}}}),o}setGroupMuted(t,n){let r=this._groups.get(t);if(r)try{r.muteGain.gain.value=n?0:1}catch(i){L("webAudioTransport.setGroupMuted",i)}}resolveDestination(t,n,r,i){if(!this._masterGain)return null;let o=Il(t);if(!o)return this._masterGain;let a={scheduledAt:n,elapsed:r,rate:i};return this.groupInput(o,t.ownerDocument,a)??this._masterGain}handleSourceEnded(t,n,r,i){let o=this._activeSources.indexOf(n);if(o!==-1){this._activeSources.splice(o,1),r.muted=i;try{t.disconnect(),n.fx?.dispose(),n.gainNode.disconnect()}catch{}this._activeSources.length===0&&(this._paused=!0)}}async schedulePlayback(t,n,r,i,o,a,l,s=1,u=Number.POSITIVE_INFINITY){if(!this._ctx||!this._masterGain||l!==this._playGeneration)return null;try{if(this._ctx.state==="suspended"&&await this._ctx.resume(),l!==this._playGeneration)return null;let c=Za(s),f=_e(t),m=c*f,p=this._ctx.createBufferSource();p.buffer=n,p.playbackRate.value=m;let b=this._ctx.createGain();b.gain.value=a;let v=o-r,x=this._ctx.currentTime,_={scheduledAt:x,elapsed:v,rate:c},R=wi(this._ctx,t,p,b,_);if(b.connect(this.resolveDestination(t,x,o,c)??this._masterGain),Ci(t,b,_),this._rate=c,this._rateAnchorCtx=x,this._rateAnchorComp=o,!iy(p,{elapsed:v,mediaStart:i,scheduledAt:x,globalRate:c,mediaRate:f,clipDuration:u}))return p.disconnect(),R?.dispose(),b.disconnect(),null;let T=t.muted;t.muted=!0,ry(t,T);let M={fx:R,el:t,sourceNode:p,sourceKind:"buffer",gainNode:b,compositionStart:r,mediaStart:i,scheduledAt:x,priorMuted:T,priorVolume:t.volume,mediaPlaybackRate:f,bounded:Number.isFinite(u)&&u>0};return this._activeSources.push(M),this._paused=!1,p.addEventListener("ended",()=>this.handleSourceEnded(p,M,t,T)),M}catch(c){return L("webAudioTransport.schedule",c),null}}setRate(t){let n=Za(t);if(n===this._rate)return!1;this._ctx&&!this._paused&&(this._rateAnchorComp=this.getTime(),this._rateAnchorCtx=this._ctx.currentTime),this._rate=n;for(let r of this._activeSources)try{fr(r)&&(r.sourceNode.playbackRate.value=n*r.mediaPlaybackRate),r.fx?.setRate(n)}catch(i){L("webAudioTransport.setRate",i)}for(let r of this._groups.values())try{r.fx?.setRate(n)}catch(i){L("webAudioTransport.setRate.group",i)}return!0}hasBoundedActiveSources(){return this._activeSources.some(t=>fr(t)&&t.bounded)}stopAll(){for(let t of this._activeSources){try{fr(t)&&t.sourceNode.stop(),t.sourceNode.disconnect(),t.fx?.dispose(),t.gainNode.disconnect()}catch{}fr(t)?t.el.muted=t.priorMuted:t.el.volume=t.priorVolume}this._activeSources=[],this._paused=!0}setVolume(t){this._masterVolume=Math.max(0,Math.min(1,t)),this.applyMasterGain()}setElementVolume(t,n){let r=Le(n);for(let i of this._activeSources)if(i.el===t)try{i.sourceKind==="media-element"&&(i.el.volume=1),i.gainNode.gain.value=r}catch(o){L("webAudioTransport.setElementVolume",o)}}setMuted(t){this._masterMuted=t,this.applyMasterGain()}applyMasterGain(){this._masterGain&&(this._masterGain.gain.value=this._masterMuted?0:this._masterVolume)}isActive(){return this._activeSources.length>0&&!this._paused}ownsElement(t){return!this._paused&&this._activeSources.some(n=>n.el===t&&fr(n))}routesElement(t){return!this._paused&&this._activeSources.some(n=>n.el===t)}destroy(){this.stopAll();for(let t of this._groups.values())t.dispose();if(this._groups.clear(),this._bufferCache.clear(),this._failedSrcs.clear(),this._mediaElementSources=new WeakMap,this._ctx)try{this._ctx.close()}catch{}this._ctx=null,this._masterGain=null,this._masterVolume=1,this._masterMuted=!1}};var Cf="data-hf-studio-manual-edit-gesture";function _f(e){return!Number.isInteger(e.tick)||e.tick<=0||e.tick%60!==0?!1:!(e.isPlaying&&e.hasCapturedTimeline&&e.currentTimeSeconds<2)}var oy=/^\\s*spring\\(\\s*([+-]?(?:\\d+(?:\\.\\d*)?|\\.\\d+))\\s*\\)\\s*$/;function Tf(e){return Math.max(0,Math.min(1,e))}function Rf(e){let t=oy.exec(e);if(!t)return null;let n=Number(t[1]);return Number.isFinite(n)?Tf(n):null}function kf(e,t){if(!Number.isFinite(e))return e;if(e<=0)return 0;if(e>=1)return 1;let n=Tf(t),r=12-n*6,i=Math.PI*2*(1+n*1.5),o=1-Math.exp(-r)*Math.cos(i);return(1-Math.exp(-r*e)*Math.cos(i*e))/o}var ay=/^\\s*wiggle\\(\\s*(\\d+)\\s*,\\s*(easeOut|easeInOut|anticipate|uniform)\\s*(?:,\\s*([+-]?(?:\\d+(?:\\.\\d*)?|\\.\\d+)(?:[eE][+-]?\\d+)?)\\s*)?\\)\\s*$/,sy=Math.PI*2;function ly(e){let t=ay.exec(e);if(!t)return null;let n=Number(t[1]);if(!Number.isSafeInteger(n)||n<1)return null;let r=t[2];if(r!=="easeOut"&&r!=="easeInOut"&&r!=="anticipate"&&r!=="uniform")return null;if(t[3]===void 0)return{wiggles:n,type:r};let i=Number(t[3]);return!Number.isFinite(i)||i<0||i>1?null:{wiggles:n,type:r,amplitude:i}}function uy(e,t,n,r){if(!Number.isFinite(e))return e;if(e<=0)return 0;if(e>=1)return 1;let i=r??(n==="easeInOut"?.08:n==="uniform"?.14:n==="anticipate"?.12:.16),o=n==="easeInOut"?i*Math.sin(Math.PI*e):n==="uniform"?i:i*(1-e);return e+(n==="anticipate"?-1:1)*o*Math.sin(sy*t*e)}function Mf(e,t){let n=ly(e);if(!n)return null;let r=`${n.wiggles}:${n.type}:${n.amplitude??"default"}`,i=t?.get(r);if(i)return i;let o=a=>uy(a,n.wiggles,n.type,n.amplitude);return t?.set(r,o),o}var cy=24,Ff=e=>e>=1?1:0,dy=e=>e,Ti=String.raw`([+-]?(?:\\d+(?:\\.\\d*)?|\\.\\d+)(?:e[+-]?\\d+)?)`,fy=new RegExp(String.raw`^\\s*M\\s*0\\s*,\\s*0\\s+C\\s*${Ti}\\s*,\\s*${Ti}\\s+${Ti}\\s*,\\s*${Ti}\\s+1\\s*,\\s*1\\s*$`,"i");function Nf(e,t,n){let r=1-e;return 3*r*r*e*t+3*r*e*e*n+e*e*e}function my(e,t,n,r,i){if(!Number.isFinite(e))return e;if(e<=0)return 0;if(e>=1)return 1;let o=0,a=1;for(let l=0;l1?null:a=>my(a,n,r,i,o)}function hy(e,t){if(!e.startsWith("spring("))return null;let n=Rf(e);if(n===null)return null;let r=t.get(n);if(r)return r;let i=o=>kf(o,n);return t.set(n,i),i}function gy(e,t){if(!e.startsWith("custom(")||!e.endsWith(")"))return null;let n=e.slice(7,-1),r=t.get(n);if(r)return r;let i=py(n);return i&&t.set(n,i),i}function Lf(e){if(e.__hfCustomEaseInstalled)return!0;let t=e.parseEase;if(!t)return!1;let n=new Map,r=new Map,i=new Map,o=s=>typeof s!="string"?null:s==="hold"?Ff:Mf(s,i)??hy(s,r)??gy(s,n),a=(s,u,c=[])=>{let f=o(s);return f||(typeof s=="string"&&/^(?:hold|spring|wiggle|custom)(?:\\(|$)/.test(s.trim())&&Ne("custom_ease_parse_failed",{ease:s}),t.call(u,s,...c)??dy)};e.parseEase=function(u,...c){return a(u,this,c)};let l=e.registerEase;if(typeof l=="function"){l("hold",Ff);let s=u=>{let c=f=>f;c.config=(...f)=>a(`${u}(${f.join(",")})`,e),l(u,c)};s("spring"),s("wiggle"),s("custom")}return e.__hfCustomEaseInstalled=!0,!0}var ns=new Map,mr=new Map,es=new Map,ts=()=>{},If=()=>{},Df=0;function rs(e){return/^[a-z][a-z0-9-]{0,63}$/.test(e)}function Pf(e){let t=(es.get(e)??0)+1;return es.set(e,t),t}function Of(e){return typeof e=="number"&&Number.isSafeInteger(e)&&e>0?e:(Df-=1,Df)}function is(e,t){let n=mr.get(e);if(!n)return;let r=()=>es.get(e)===t.generation&&mr.get(e)===n;try{Promise.resolve(n(t.payload)).then(()=>{r()&&If(e,t.requestId)},i=>{r()&&ts(e,t.requestId,i)})}catch(i){r()&&ts(e,t.requestId,i)}}function Hf(e){ts=e}function Gf(e){If=e}function Ri(e,t,n){if(!rs(e))return;let r={payload:t,requestId:Of(n),generation:Pf(e)};ns.set(e,r),is(e,r)}function ki(e,t){rs(e)&&(ns.delete(e),is(e,{payload:void 0,requestId:Of(t),generation:Pf(e)}))}function Bf(e,t){if(!rs(e))throw new Error(`Invalid HyperFrames runtime-data channel: ${e}`);mr.set(e,t);let n=ns.get(e);return n&&is(e,n),()=>{mr.get(e)===t&&mr.delete(e)}}var os="data-hf-authored-duration",as="data-hf-authored-end",Uf=!1;function ot(e){if(e){if(typeof e.pause!="function"){Uf||(Uf=!0,Ne("timeline_missing_pause",{}));return}try{e.pause()}catch(t){L("runtime.timeline.pause",t)}}}function by(){let e=window.__HF_EXPORT_RENDER_SEEK_CONFIG,t=e?.fps,n=e?.fpsSource,r=Number(t);return!e||t==null?{fps:null,source:"default",rawFpsSource:n,rawFps:t,fallbackReason:"missing"}:!Number.isFinite(r)||r<=0?{fps:null,source:"default",rawFpsSource:n,rawFps:t,fallbackReason:"invalid"}:{fps:r,source:n==="render-options"||n==="default"?n:"unknown",rawFpsSource:n,rawFps:t,fallbackReason:e.fpsFallbackReason}}function Wf(){let e=Eu(),t=()=>{};Ws(be),Hf((d,g,h)=>{be({source:"hf-preview",type:"runtime-data-error",channel:d,requestId:g,message:h instanceof Error?h.message:String(h)})}),Gf((d,g)=>{try{t()}catch(h){be({source:"hf-preview",type:"runtime-data-error",channel:d,requestId:g,message:h instanceof Error?h.message:String(h)});return}be({source:"hf-preview",type:"runtime-data-applied",channel:d,requestId:g})}),mi(document),La(document),Pl(document);let n=by();e.canonicalFps=n.fps??e.canonicalFps,Bs(e.canonicalFps),window.__HF_EXPORT_RENDER_SEEK_CONFIG&&console.info("[hyperframes] render runtime fps",{canonicalFps:e.canonicalFps,source:n.source,rawFpsSource:n.rawFpsSource,rawFps:n.rawFps,fallbackReason:n.fallbackReason});let r=null,i=null,o=null,a=[],l=new Set,s=null,u=new Set,c=(d,g,h)=>{u.has(d)||(u.add(d),Ne(g,h))};if(typeof window.__hfRuntimeTeardown=="function")try{window.__hfRuntimeTeardown()}catch(d){L("runtime.init.site1",d)}let f=new Ei;e.transportClock=f;let m=new _i,p=!1;m.init().then(d=>{p=d}),window.__hf=window.__hf||{};let b=d=>d.closest("[data-hidden]")!==null||Br(d.ownerDocument,d),v=()=>{let d=window.gsap,g=window;if(!(!d?.registerPlugin||g.__hfAutoNoopRegistered))try{d.registerPlugin({name:"_auto",init:()=>!1}),g.__hfAutoNoopRegistered=!0}catch(h){c("auto_marker_install_failed","auto_marker_install_failed",{reason:"threw"}),L("runtime.autoMarker.install",h)}},x=()=>{let d=window.gsap;if(!d){c("custom_ease_missing_gsap","custom_ease_install_failed",{reason:"missing_gsap"});return}try{Lf(d)||c("custom_ease_no_parse_ease","custom_ease_install_failed",{reason:"no_parseEase"})}catch(g){c("custom_ease_install_threw","custom_ease_install_failed",{reason:"threw"}),L("runtime.customEase.install",g)}};v(),x(),document.documentElement&&(document.documentElement.style.margin="0",document.documentElement.style.padding="0",document.documentElement.style.overflow="hidden"),document.body&&(document.body.style.margin="0",document.body.style.padding="0",document.body.style.overflow="hidden");try{Ys(document)}catch(d){L("runtime.init.cssVariables",d)}window.__timelines=window.__timelines||{};let _=()=>{let d=document.querySelector(\'[data-composition-id][data-root="true"]\');if(d instanceof HTMLElement)return d;let g=Array.from(document.querySelectorAll("[data-composition-id]"));return g.find(h=>!h.parentElement?.closest("[data-composition-id]"))??g[0]??null};if(Array.isArray(window.__timelines)){let d=window.__timelines,g=_()?.getAttribute("data-composition-id")??"root",h={};if(d.length===1)h[g]=d[0];else for(let y=0;y{a.push(d)},M=(d,g,h)=>{let y=h??`${d}:${JSON.stringify(g)}`;l.has(y)||(l.add(y),be({source:"hf-preview",type:"diagnostic",code:d,details:g}))},D=d=>{let g={scale:1,focusX:960,focusY:540},h=[],y=[],w={time:d.getTime(),duration:d.getDuration(),isPlaying:d.isPlaying(),renderMode:!1,timelineDirty:!1};return{play:d.play,pause:d.pause,seek:d.seek,getTime:d.getTime,getDuration:d.getDuration,isPlaying:d.isPlaying,getMainTimeline:()=>null,getElementBounds:()=>{},getElementsAtPoint:()=>{},setElementPosition:()=>{},previewElementPosition:()=>{},setElementKeyframes:()=>{},setElementScale:()=>{},setElementFontSize:()=>{},setElementTextContent:()=>{},setElementTextColor:()=>{},setElementTextShadow:()=>{},setElementTextFontWeight:()=>{},setElementTextFontFamily:()=>{},setElementTextOutline:()=>{},setElementTextHighlight:()=>{},setElementVolume:()=>{},setStageZoom:()=>{},getStageZoom:()=>g,setStageZoomKeyframes:()=>{},getStageZoomKeyframes:()=>h,addElement:()=>!1,removeElement:()=>!1,updateElementTiming:()=>!1,setElementTiming:()=>{},updateElementSrc:()=>!1,updateElementLayer:()=>!1,updateElementBasePosition:()=>!1,markTimelineDirty:()=>{},isTimelineDirty:()=>!1,rebuildTimeline:()=>{},ensureTimeline:()=>{},enableRenderMode:()=>{},disableRenderMode:()=>{},renderSeek:d.renderSeek,getElementVisibility:()=>({visible:!1}),getVisibleElements:()=>y,getRenderState:()=>({...w,time:d.getTime(),duration:d.getDuration(),isPlaying:d.isPlaying()})}},E=1/60,S=.75,A=.05,C=100,F=240,I=d=>{if(d instanceof Error)return d.message||String(d);if(typeof d=="string")return d;try{return JSON.stringify(d)}catch{return String(d??"")}},q=d=>{let g=d.toLowerCase();return g.includes("cannot read properties of null")||g.includes("cannot set properties of null")?{code:"runtime_null_dom_access",category:"dom-null-access"}:g.includes("failed to execute \'queryselector\'")?{code:"runtime_invalid_selector",category:"selector-invalid"}:g.includes("is not defined")?{code:"runtime_reference_missing",category:"reference-missing"}:{code:"runtime_script_error",category:"script-error"}},W=d=>{if(d==null||d.trim()==="")return null;let g=Number.parseFloat(d);return!Number.isFinite(g)||g<=0?null:`${g}px`},Y=()=>_(),k=()=>{let d=Y();if(!d)return;let g=W(d.getAttribute("data-width")),h=W(d.getAttribute("data-height"));g&&(d.style.width=g),h&&(d.style.height=h),g&&d.style.setProperty("--comp-width",g),h&&d.style.setProperty("--comp-height",h)},U=()=>{let d=Y(),g=Array.from(document.querySelectorAll("[data-composition-id]")).filter(h=>h.hasAttribute("data-duration")||h.hasAttribute("data-end"));for(let h of g){if(d&&h===d)continue;let y=h.getAttribute("data-duration"),w=h.getAttribute("data-end");y!=null&&!h.hasAttribute(os)&&h.setAttribute(os,y),w!=null&&!h.hasAttribute(as)&&h.setAttribute(as,w),h.removeAttribute("data-duration"),h.removeAttribute("data-end")}},ie=()=>{let d=Y();if(!d)return;d.style.position||(d.style.position="relative"),d.style.overflow="hidden";let g=W(d.getAttribute("data-width")),h=W(d.getAttribute("data-height"));g&&(d.style.width=g),h&&(d.style.height=h);let y=Array.from(d.children);for(let w of y){let N=w.tagName.toLowerCase();if(N==="script"||N==="style"||N==="link"||N==="meta"||!w.hasAttribute("data-start")||w.hasAttribute("data-hf-autostamped"))continue;let G=(w.style.top==="0px"||w.style.top==="0")&&(w.style.left==="0px"||w.style.left==="0")&&w.style.width==="100%"&&w.style.height==="100%",re=/translate\\(\\s*-50%\\s*,\\s*-50%\\s*\\)/.test(w.style.transform);if(G&&re&&!w.hasAttribute("data-width")&&!w.hasAttribute("data-height")){let ne=w.style.top,_t=w.style.left,ye=w.style.width,gn=w.style.height;w.style.top="",w.style.left="",w.style.width="",w.style.height="";let se=window.getComputedStyle(w);se.top!=="auto"||se.bottom!=="auto"||se.left!=="auto"||se.right!=="auto"||se.width!=="0px"||se.height!=="0px"||(w.style.top=ne,w.style.left=_t,w.style.width=ye,w.style.height=gn)}let $=window.getComputedStyle(w),le=$.position;if(le!=="absolute"&&le!=="fixed"&&(w.style.position="absolute"),!!w.style.top||!!w.style.bottom||$.top!=="auto"||$.bottom!=="auto"||(w.style.top="0"),!!w.style.left||!!w.style.right||$.left!=="auto"||$.right!=="auto"||(w.style.left="0"),N!=="audio"){let ne=W(w.getAttribute("data-width")),_t=W(w.getAttribute("data-height")),ye=$.width!=="0px"&&$.width!=="auto",gn=$.height!=="0px"&&$.height!=="auto";ne?!w.style.width&&!ye&&(w.style.width=ne):!w.style.width&&$.width==="0px"&&(w.style.width="100%"),_t?!w.style.height&&!gn&&(w.style.height=_t):!w.style.height&&$.height==="0px"&&(w.style.height="100%")}}},P=(d,g=0,h)=>mt({timelineRegistry:window.__timelines??{},includeAuthoredTimingAttrs:h?.includeAuthoredTimingAttrs??!0}).resolveStartForElement(d,g),H=(d,g)=>mt({timelineRegistry:window.__timelines??{},includeAuthoredTimingAttrs:g?.includeAuthoredTimingAttrs??!0}).resolveDurationForElement(d),V=d=>{let g=d.closest("[data-composition-id]"),h=g?P(g,0):null,y=g?H(g,{includeAuthoredTimingAttrs:!0}):null;return{compositionRoot:g,inheritedStart:h,inheritedDuration:y}},j=d=>{let g=V(d),h=g.inheritedStart??0,y=Gt(d.getAttribute("data-start"));if(d.hasAttribute("data-hf-auto-start")||y==null||h<=0)return P(d,h);let w=g.inheritedDuration,N=w!=null&&w>0?h+w:null;return y>=h&&(N==null||y{window.__hfResolveMediaStartSeconds===j&&delete window.__hfResolveMediaStartSeconds});let we=(d,g)=>{let h=d.tagName.toLowerCase();if(h==="script"||h==="style"||h==="link"||h==="meta")return!1;let w=h==="video"||h==="audio"?j(d):P(d,0),N=H(d),G=d.getAttribute("data-composition-id");if(G){let $=(window.__timelines??{})[G],le=null;if($&&typeof $.duration=="function"){let Me=Number($.duration());Number.isFinite(Me)&&Me>0&&(le=Me)}!(d.hasAttribute("data-duration")||d.hasAttribute("data-end")||d.hasAttribute(os)||d.hasAttribute(as))&&(N==null||N<=0)&&le!=null&&(N=le)}let re=N!=null&&N>0?w+N:Number.POSITIVE_INFINITY;return g>=w&&(Number.isFinite(re)?g{if(!d||typeof d.duration!="function")return null;try{let g=Number(d.duration());return Number.isFinite(g)?Math.max(0,g):null}catch{return null}},K=d=>typeof d=="number"&&Number.isFinite(d)&&d>E,te=d=>{let g=ve(d.getAttribute("data-duration"));return g!=null&&g>0?g:Number.isFinite(d.duration)?Qe(d,d.duration):null},J=()=>{let d=Array.from(document.querySelectorAll("video[data-start], audio[data-start]"));if(d.length===0)return null;let g=0;for(let h of d){let y=j(h);if(!Number.isFinite(y))continue;let w=te(h);w==null||w<=E||(g=Math.max(g,Math.max(0,y)+w))}return g>E?g:null},X=()=>{let d=Y();if(!d)return null;let g=window.__timelines??{},h=mt({timelineRegistry:g,includeAuthoredTimingAttrs:!0}),y=0,w=ve(d.getAttribute("data-duration"));w!=null&&w>0&&(y=w);let N=Array.from(d.querySelectorAll("[data-composition-id][data-start]"));for(let G of N){if(!(G instanceof Element)||G.parentElement?.closest("[data-composition-id]")!==d)continue;let $=h.resolveStartForElement(G,0),le=h.resolveDurationForElement(G);!Number.isFinite($)||le==null||le<=0||(y=Math.max(y,Math.max(0,$)+le))}return y>E?y:null},Pe=()=>{let d=J();return typeof d!="number"||!Number.isFinite(d)||d<=E?null:d},Fe=d=>K(d)?Math.max(E,d*S):E,cn=()=>{let d=0;for(let g of e.deterministicAdapters){let h=g.getInferredDurationSeconds;if(typeof h!="function")continue;let y=null;try{y=h()}catch(w){L("runtime.init.adapterDuration",w)}typeof y=="number"&&Number.isFinite(y)&&y>0&&(d=Math.max(d,y))}return d>E?d:null},Ce=(d,g=0)=>{let h=ee(d),y=Pe(),w=X(),N=cn(),G=Math.max(y??0,w??0,N??0,window.__crocoPlannedPreviewDuration?.()||0),re=Number.isFinite(g)&&g>E?g:0,$=0;return K(h)?$=Math.max(h,G,re):K(G)?$=Math.max(G,re):$=re,$>0?Math.max(0,$):0},Oi=()=>{let d=window.__timelines??{},g=se=>{let oe=Object.entries(d).filter(ue=>!!ue[1]&&typeof ue[1].play=="function"&&typeof ue[1].pause=="function");if(oe.length!==1)return{timeline:null};let he=oe[0];if(!he)return{timeline:null};let[xe,fe]=he;return{timeline:fe,selectedTimelineIds:[xe],selectedDurationSeconds:ee(fe),diagnostics:{code:"root_timeline_sole_registered_fallback",details:{reason:se,soleTimelineId:xe}}}},h=mt({timelineRegistry:d,includeAuthoredTimingAttrs:!0}),y=Pe(),w=X(),N=Math.max(y??0,w??0)||null,G=Fe(N),re=se=>{let oe=document.querySelector(`[data-composition-id="${CSS.escape(se)}"]`);return oe?h.resolveStartForElement(oe,0):0},$=se=>{let oe=window.gsap;if(!oe||typeof oe.timeline!="function")return null;let he=oe.timeline({paused:!0});for(let xe of se)he.add(xe.timeline,re(xe.compositionId));return he},le=(se,oe)=>{if(!K(se))return null;let he=window.gsap;if(!he||typeof he.timeline!="function")return null;let xe=he.timeline({paused:!0});if(oe)try{xe.add(oe,0)}catch(ue){L("runtime.init.site2",ue)}let fe=xe;if(typeof fe.to=="function")try{fe.to({},{duration:se})}catch(ue){L("runtime.init.site3",ue)}return xe},Be=(se,oe)=>{let he=se;if(typeof he.getChildren!="function")return[];try{let xe=he.getChildren(!0,!0,!0)??[];if(!Array.isArray(xe))return[];let fe=[];for(let ue of oe)if(!xe.some(Je=>Je===ue.timeline))try{let Je=re(ue.compositionId);se.add(ue.timeline,Je),fe.push(ue.compositionId)}catch(Je){L("runtime.init.site4",Je)}return fe}catch{return[]}},Me=Y(),Q=Me?.getAttribute("data-composition-id")??null;if(!Q)return g("root_missing_composition_id");let ne=d[Q]??null,ye=(()=>{if(!Me)return[];let se=new Set,oe=Array.from(Me.querySelectorAll("[data-composition-id]")),he=[];for(let xe of oe){let fe=xe.getAttribute("data-composition-id");if(!fe||fe===Q||se.has(fe))continue;se.add(fe);let ue=d[fe]??null;if(!ue||typeof ue.play!="function"||typeof ue.pause!="function")continue;let lt=ee(ue);he.push({compositionId:fe,timeline:ue,durationSeconds:lt??0})}return he})(),gn=se=>{for(let oe of se){let he=oe.timeline;if(typeof he.paused=="function")try{he.paused(!1)}catch(xe){L("runtime.init.site5",xe)}}};if(ye.length>0&&gn(ye),ne){let se=ye.length>0?Be(ne,ye):[];if((ye.length>0||!document.querySelector("[data-composition-id]:not([data-composition-id=\'"+Q+"\'])"))&&(gr=!0),se.length>0)try{let fe=ne.time();ne.seek(fe,!1)}catch{}let oe=ee(ne);if(!K(oe)&&ye.length>0){let fe=ye.map(zm=>zm.compositionId),ue=$(ye),lt=ee(ue);if(ue&&K(lt))return{timeline:ue,selectedTimelineIds:fe,selectedDurationSeconds:lt,mediaDurationFloorSeconds:y,diagnostics:{code:"root_timeline_unusable_fallback",details:{rootCompositionId:Q,rootDurationSeconds:oe,fallbackKind:"composite_by_root_children",minCandidateDurationSeconds:G,selectedDurationSeconds:lt,mediaDurationFloorSeconds:y,authoredCompositionDurationFloorSeconds:w,selectedTimelineIds:fe,autoNestedChildren:se}}};let Je=le(N??0,ne),Yi=ee(Je);if(Je&&K(Yi))return{timeline:Je,selectedTimelineIds:[Q],selectedDurationSeconds:Yi,mediaDurationFloorSeconds:y,diagnostics:{code:"root_timeline_unusable_media_floor_fallback",details:{rootCompositionId:Q,rootDurationSeconds:oe,fallbackKind:"media_duration_floor",mediaDurationFloorSeconds:y,authoredCompositionDurationFloorSeconds:w,selectedDurationSeconds:Yi,selectedTimelineIds:[Q],autoNestedChildren:se}}}}if(!K(oe)&&ye.length===0){let fe=le(N??0,ne),ue=ee(fe);if(fe&&K(ue))return{timeline:fe,selectedTimelineIds:[Q],selectedDurationSeconds:ue,mediaDurationFloorSeconds:y,diagnostics:{code:"root_timeline_unusable_media_floor_fallback",details:{rootCompositionId:Q,rootDurationSeconds:oe,fallbackKind:"media_duration_floor",mediaDurationFloorSeconds:y,authoredCompositionDurationFloorSeconds:w,selectedDurationSeconds:ue,selectedTimelineIds:[Q]}}}}let he=ve(Me?.getAttribute("data-duration")),xe=Math.max(K(he)?he:0,w??0);if(xe>0&&K(xe)&&K(oe)&&xe>=oe+.5){let fe=ne;if(typeof fe.to=="function")try{fe.to({},{duration:0},xe)}catch(lt){L("runtime.init.site6",lt)}let ue=ee(ne);if(K(ue))return{timeline:ne,selectedTimelineIds:[Q],selectedDurationSeconds:ue,mediaDurationFloorSeconds:y,diagnostics:{code:"root_timeline_padded_to_declared_duration",details:{rootCompositionId:Q,rootDurationSeconds:oe,rootDeclaredDur:he,authoredCompositionDurationFloorSeconds:w,newDur:ue}}}}return{timeline:ne,selectedTimelineIds:[Q],selectedDurationSeconds:oe,mediaDurationFloorSeconds:y,diagnostics:se.length>0?{code:"root_timeline_auto_nested_children",details:{rootCompositionId:Q,selectedDurationSeconds:oe,autoNestedChildren:se}}:void 0}}if(ye.length>0){let se=ye.map(xe=>xe.compositionId),oe=$(ye),he=ee(oe);if(oe)return{timeline:oe,selectedTimelineIds:se,selectedDurationSeconds:he,mediaDurationFloorSeconds:y,diagnostics:{code:"root_timeline_missing_fallback",details:{rootCompositionId:Q,fallbackKind:"composite_by_root_children",minCandidateDurationSeconds:G,selectedDurationSeconds:he,mediaDurationFloorSeconds:y,selectedTimelineIds:se}}}}return g("root_composition_id_unmatched_in_registry")},gr=!1,Em=d=>{let g=window.gsap,h=d;if(!(!h||typeof h.getChildren!="function"||!g||typeof g.parseEase!="function"))for(let y of h.getChildren(!0,!0,!0)){let w=y,N=w.timeline;if(!N||!("_ease"in N)||typeof N._ease=="function")continue;let G=w.vars?.keyframes,$=(G&&!Array.isArray(G)?G.ease:void 0)??w.vars?.ease??"none";try{let le=g.parseEase($);typeof le=="function"&&(N._ease=le)}catch(le){Ne("keyframe_ease_repair_failed",{ease:typeof $=="string"?$:String($)}),L("runtime.keyframeEase.repair",le)}}},dn=()=>{if(x(),!B)return!1;let d=e.capturedTimeline,g=ee(d),h=K(g);if(d&&h&&gr)return!1;let y=Oi();if(!y.timeline)return!1;if(d&&d===y.timeline)return typeof d.timeScale=="function"&&d.timeScale(e.playbackRate),!1;e.capturedTimeline=y.timeline,typeof e.capturedTimeline.timeScale=="function"&&e.capturedTimeline.timeScale(e.playbackRate),Em(e.capturedTimeline);let w=Ce(e.capturedTimeline,0);if(w<=0&&typeof e.capturedTimeline.progress=="function"&&(e.capturedTimeline.progress(1,!0),e.capturedTimeline.progress(0,!1),ot(e.capturedTimeline)),w>0){try{f.setDuration(w)}catch{}if(typeof e.capturedTimeline.totalTime=="function"){typeof e.capturedTimeline.progress=="function"&&e.capturedTimeline.progress(1e-4,!0);let G=Math.max(0,e.currentTime||0);e.capturedTimeline.totalTime(G,!1),ot(e.capturedTimeline)}let N=window.__hfStudioManualEditsApply;typeof N=="function"&&N(),mi(document)}if(y.diagnostics&&be({source:"hf-preview",type:"diagnostic",code:y.diagnostics.code,details:y.diagnostics.details}),be({source:"hf-preview",type:"diagnostic",code:"timeline_bound",details:{selectedTimelineIds:y.selectedTimelineIds??[],selectedDurationSeconds:y.selectedDurationSeconds??null,mediaDurationFloorSeconds:y.mediaDurationFloorSeconds??null}}),window.parent!==window){let N=Y(),G=w>0?w:0,re=String(G>0?G:1),$=new Set,le=Q=>Q.tagName.toLowerCase()===Ut,Be=new Set(document.querySelectorAll("[data-start]")),Me=Q=>{let ne=Q.parentElement;for(;ne&&ne!==N;){if(Be.has(ne))return!0;ne=ne.parentElement}return!1};if(e.capturedTimeline.getChildren)try{for(let Q of e.capturedTimeline.getChildren(!0))if(typeof Q.targets=="function")for(let ne of Q.targets())ne instanceof HTMLElement&&ne!==N&&(le(ne)||ne.hasAttribute("data-start")||Me(ne)||$.has(ne)||($.add(ne),ne.setAttribute("data-start","0"),ne.setAttribute("data-duration",re),ne.setAttribute("data-hf-autostamped","1")))}catch{}if(N instanceof HTMLElement)for(let Q of N.querySelectorAll("[id]"))Q instanceof HTMLElement&&Q!==N&&(Q.hasAttribute("data-start")||Me(Q)||$.has(Q)||Q.tagName==="SCRIPT"||Q.tagName==="STYLE"||Q.tagName==="LINK"||le(Q)||($.add(Q),Q.setAttribute("data-start","0"),Q.setAttribute("data-duration",re),Q.setAttribute("data-hf-autostamped","1")))}for(let N of fn)br.delete(N),Es(N);return!0},gs=()=>{if(e.tornDown)return;let d=Oi();if(!d.timeline){e.capturedTimeline=null,gr=!1,f.setDuration(0),Ar(e.currentTime);return}e.capturedTimeline!==d.timeline&&(gr=!1,dn()),Ar(e.currentTime)};t=()=>{gs(),st()},window.__hfForceTimelineRebind=gs;let wm=()=>{let d=Y();if(!(d instanceof HTMLElement))return;let g=d.getBoundingClientRect(),h=Number(d.getAttribute("data-width")),y=Number(d.getAttribute("data-height")),w=window.getComputedStyle(d),N=Number.isFinite(h)&&h>0&&Number.isFinite(y)&&y>0,G=g.width<=0||g.height<=0||d.clientWidth<=0||d.clientHeight<=0;!N||!G||M("root_stage_layout_zero",{compositionId:d.getAttribute("data-composition-id")??null,declaredWidth:h,declaredHeight:y,rectWidth:Math.round(g.width),rectHeight:Math.round(g.height),clientWidth:d.clientWidth,clientHeight:d.clientHeight,display:w.display,visibility:w.visibility,overflow:w.overflow},`root-stage-layout-zero:${d.getAttribute("data-composition-id")??"unknown"}`)},Cm=()=>{e.tornDown||(s!=null&&window.cancelAnimationFrame(s),s=window.requestAnimationFrame(()=>{s=null,wm()}))},_m=()=>{i=d=>{let g=I(d.error??d.message).slice(0,F);if(!g)return;let h=q(g);be({source:"hf-preview",type:"diagnostic",code:h.code,details:{category:h.category,message:g,filename:d.filename||null,line:Number.isFinite(d.lineno)?d.lineno:null,column:Number.isFinite(d.colno)?d.colno:null}})},o=d=>{let g=I(d.reason).slice(0,F);if(!g)return;let h=q(g);be({source:"hf-preview",type:"diagnostic",code:`${h.code}_unhandled_rejection`,details:{category:`${h.category}-unhandled-rejection`,message:g}})},window.addEventListener("error",i),window.addEventListener("unhandledrejection",o)},Tm=()=>{let d=Array.from(document.querySelectorAll("img, video, audio, source, link[rel=\'stylesheet\']"));for(let h of d){let y=()=>{if(!(h instanceof Element))return;let w=h.tagName.toLowerCase(),N=h.getAttribute("src")??h.getAttribute("href")??h.getAttribute("poster")??null,G=w==="link"?"runtime_stylesheet_load_failed":"runtime_asset_load_failed";M(G,{tagName:w,assetUrl:N,currentSrc:(h instanceof HTMLImageElement||h instanceof HTMLMediaElement)&&h.currentSrc||null,readyState:h instanceof HTMLMediaElement?h.readyState:null,networkState:h instanceof HTMLMediaElement?h.networkState:null},`${G}:${w}:${N??"unknown"}`)};h.addEventListener("error",y),T(()=>{h.removeEventListener("error",y)})}let g=document.fonts;g&&g.ready.then(()=>{if(e.tornDown)return;let h=Array.from(g).filter(y=>y.status==="error").map(y=>y.family).filter(y=>!!y).slice(0,10);h.length!==0&&M("runtime_font_load_issue",{failedFamilies:h,totalFaces:Array.from(g).length},`runtime-font-load-issue:${h.join("|")}`)}).catch(()=>{})},Rm=(d,g)=>{if(!d.timeline)return!1;let h=e.capturedTimeline;if(h&&h===d.timeline)return!1;let y=Math.max(0,e.currentTime||0),w=e.isPlaying;e.capturedTimeline=d.timeline,typeof e.capturedTimeline.timeScale=="function"&&e.capturedTimeline.timeScale(e.playbackRate);try{ot(e.capturedTimeline),typeof e.capturedTimeline.seek=="function"&&e.capturedTimeline.seek(y,!1),w&&typeof e.capturedTimeline.play=="function"&&e.capturedTimeline.play()}catch(N){L("runtime.init.site7",N)}return be({source:"hf-preview",type:"diagnostic",code:"timeline_loop_guard_rebind",details:{reason:g,previousTime:y,selectedTimelineIds:d.selectedTimelineIds??[],selectedDurationSeconds:d.selectedDurationSeconds??null,mediaDurationFloorSeconds:d.mediaDurationFloorSeconds??null}}),!0},Et=null,bs=!1,xs=!1,fn=new Set,br=new WeakMap,xr=()=>{e.tornDown||(Et!=null&&window.clearTimeout(Et),Et=window.setTimeout(()=>{if(e.tornDown||(Et=null,xs&&window.__HF_EXPORT_RENDER_SEEK_CONFIG))return;let d=Oi();if(!d.timeline||!K(d.mediaDurationFloorSeconds??null))return;if(!e.capturedTimeline){dn()&&(st(),ke(!0));return}if(bs)return;let h=ee(e.capturedTimeline),y=d.selectedDurationSeconds??ee(d.timeline);K(y)&&(!K(h)||y>=h+A)&&Rm(d,"manual")&&(bs=!0,be({source:"hf-preview",type:"diagnostic",code:"timeline_rebind_after_media_metadata",details:{previousDurationSeconds:h??null,selectedDurationSeconds:y??null,selectedTimelineIds:d.selectedTimelineIds??[],mediaDurationFloorSeconds:d.mediaDurationFloorSeconds??null}}),st(),ke(!0))},C))},ys=d=>{d.currentTarget instanceof HTMLMediaElement&&zl(d.currentTarget)},vs=d=>{d.currentTarget instanceof HTMLMediaElement&&ql(d.currentTarget)},Ss=d=>{d instanceof HTMLAudioElement&&Ef(d)&&sn(d,an(d))},As=d=>{let g=d.currentTarget;g instanceof HTMLMediaElement&&Ss(g)},km=()=>{for(let d of fn)d.removeEventListener("loadedmetadata",xr),d.removeEventListener("durationchange",xr),d.removeEventListener("loadedmetadata",ys),d.removeEventListener("loadedmetadata",As),d.removeEventListener("error",vs);fn.clear()},Hi=()=>{if(e.tornDown)return;let d=Array.from(document.querySelectorAll("video, audio"));for(let g of d){if(fn.has(g))continue;fn.add(g);let h=Number.parseFloat(g.dataset.volume??"");Number.isFinite(h)&&(g.volume=Math.max(0,Math.min(1,h))),g.addEventListener("loadedmetadata",xr),g.addEventListener("durationchange",xr),g.addEventListener("loadedmetadata",As),Ss(g),g.addEventListener("loadedmetadata",ys),g.addEventListener("error",vs),Vl(g),g.preload!=="auto"&&(g.preload="auto"),g.readyState{br.has(d)||El(d,e.capturedTimeline,Ce(e.capturedTimeline,0),br,{allowLiveTimelineSeek:!window.__HF_RENDER_CAPTURE_MODE})},Gi=new WeakMap,ws=d=>{let g=Gi.get(d);if(g!==void 0)return g;let h=window.getComputedStyle(d).position,y=h==="static"||h==="relative"||h==="sticky";return Gi.set(d,y),y},Bi=new WeakMap,Mm=d=>{let g=Bi.get(d);if(g!==void 0)return g;let h=d.querySelector("[data-start]")===null;return Bi.set(d,h),h},Fm=()=>{Gi=new WeakMap,Bi=new WeakMap},Ui=new WeakMap,yr=new WeakSet,vr=!1,Cs=d=>d.matches("audio[data-start]")||d.querySelector("audio[data-start]")!==null,_s=new WeakMap,Sr=!0,Nm=()=>{if(Sr){Sr=!1;for(let d of document.querySelectorAll(Ut)){let g=d.hasAttribute("data-hidden");_s.get(d)!==g&&(_s.set(d,g),d.id&&m.setGroupMuted(d.id,g))}}},Ar=(d,g=Array.from(document.querySelectorAll("[data-start]")))=>{let h=Y();for(let y of g){if((y.nodeType!==1||y.namespaceURI!=="http://www.w3.org/1999/xhtml"))continue;if(y.hasAttribute("data-hidden")){yr.has(y)||(Ui.set(y,y.style.getPropertyValue("display")),yr.add(y),Cs(y)&&(vr=!0),Sr=!0),y.style.display="none",(y.tagName==="VIDEO"||y.tagName==="IMG")&&r?.setSourceVisibility(y,!1);continue}if(yr.has(y)){let N=Ui.get(y);N?y.style.display=N:y.style.removeProperty("display"),Ui.delete(y),yr.delete(y),Cs(y)&&(vr=!0),Sr=!0}let w=we(y,d);if(w){let N=y.parentElement;for(;N&&N!==h;){if(N.nodeType===1&&N.namespaceURI==="http://www.w3.org/1999/xhtml"&&N.hasAttribute("data-start")&&!we(N,d)){w=!1;break}N=N.parentElement}}y.style.visibility=w?"visible":"hidden",(y.tagName==="VIDEO"||y.tagName==="IMG")&&r?.setSourceVisibility(y,w),w?ws(y)&&y.style.removeProperty("display"):ws(y)&&Mm(y)&&(y.style.display="none")}vr&&f.isPlaying()&&(m.stopAll(),ji()),vr=!1,Nm()},Oe=()=>{let d=Hl({shouldIncludeElement:h=>h.hasAttribute("data-start")||!!V(h).compositionRoot,resolveStartSeconds:h=>j(h),resolveDurationSeconds:h=>{let y=V(h),w=j(h),N=y.inheritedStart!=null&&y.inheritedDuration!=null&&y.inheritedDuration>0?Math.max(0,y.inheritedStart+y.inheritedDuration-w):null,G=Number.isFinite(h.duration)?Qe(h,h.duration):null,re=ve(h.dataset.duration),$=re!=null&&re>0?re:null;return Ol({isVideo:h.tagName==="VIDEO",sourceDuration:G,hostRemaining:N,explicitDuration:$})}});for(let h of d.mediaClips){let y=br.get(h.el);y&&(h.volumeKeyframes=y)}let g=e.mediaForceSyncNextTick;g&&(e.mediaForceSyncNextTick=!1),e.nativeMediaSyncDisabled||Gl({clips:d.mediaClips,timeSeconds:e.currentTime,playing:e.isPlaying,playbackRate:e.playbackRate,outputMuted:e.mediaOutputMuted,userMuted:e.bridgeMuted,userVolume:e.bridgeVolume,forceSync:g,onElementVolume:(h,y,w)=>m.setElementVolume(h,w),isWebAudioOwned:h=>m.ownsElement(h),isWebAudioRouted:h=>m.routesElement(h),onAutoplayBlocked:()=>{e.mediaAutoplayBlockedPosted||(e.mediaAutoplayBlockedPosted=!0,be({source:"hf-preview",type:"media-autoplay-blocked"}))}}),Ar(e.currentTime)},ke=d=>{let g=Math.max(0,Math.round((e.currentTime||0)*e.canonicalFps)),h=Date.now();(d||g!==e.bridgeLastPostedFrame||e.isPlaying!==e.bridgeLastPostedPlaying||e.bridgeMuted!==e.bridgeLastPostedMuted||h-e.bridgeLastPostedAt>=e.bridgeMaxPostIntervalMs)&&(e.bridgeLastPostedFrame=g,e.bridgeLastPostedPlaying=e.isPlaying,e.bridgeLastPostedMuted=e.bridgeMuted,e.bridgeLastPostedAt=h,be({source:"hf-preview",type:"state",frame:g,isPlaying:e.isPlaying,muted:e.bridgeMuted,playbackRate:e.playbackRate}))},Wi="",Ts=0,Lm=()=>{let d="";for(let g of document.querySelectorAll("[data-start]"))d+=`${g.id}:${g.tagName}|`;return d},st=()=>{U(),k(),ie();let d=Y();if(d){let y=W(d.getAttribute("data-width")),w=W(d.getAttribute("data-height")),N=y?parseInt(y,10):0,G=w?parseInt(w,10):0;N>0&&G>0&&be({source:"hf-preview",type:"stage-size",width:N,height:G})}dn();let g=Ru({canonicalFps:e.canonicalFps});window.__clipManifest=g;let h=Lm();if(Wi!==h&&Fm(),!window.__clipTree||Wi!==h){let y=window;window.__clipTree=wu({startResolver:mt({timelineRegistry:y.__timelines??{},includeAuthoredTimingAttrs:!0}),timelineRegistry:y.__timelines??{},rootDuration:g.durationInFrames/e.canonicalFps}),Wi=h}be(g),Cm()},Vi=d=>typeof d=="number"&&Number.isFinite(d)&&d>0?d:0,Dm=d=>{let g=Vi(Number(d));if(g<=0)return;let h=Y(),y=Vi(ve(h?.getAttribute("data-duration"))),w=Math.max(Ts,Vi(f.getDuration()),y);g<=w||(Ts=g,h?.setAttribute("data-duration",String(g)),f.setDuration(g),st(),ke(!0))},He=(d,g=0)=>{for(let h of e.deterministicAdapters){try{d==="discover"&&h.discover(),d==="pause"&&h.pause(),d==="play"&&h.play&&h.play()}catch(y){L("runtime.init.site8",y)}if(d==="discover")try{h.seek({time:g,suppressEvents:!0})}catch(y){L("runtime.init.site9",y)}}},wt=()=>{window.__renderReady=!1},mn=null,pn=!0,Im=()=>{let d=[];for(let g of e.deterministicAdapters){let h=g.getReadyPromise;if(typeof h=="function")try{let y=h();y&&d.push(y)}catch(y){L("runtime.init.adapterReady",y)}}return d},Pm=()=>{let d=Im();if(d.length===0)return mn=null,pn=!0,!0;let g=d[0];if(!g)return!0;let h=d.length===1?g:Promise.all(d);return h!==mn&&(mn=h,pn=!1,Promise.resolve(h).then(()=>{mn===h&&(pn=!0,wt())},y=>{mn===h&&(pn=!0,L("runtime.init.adapterReady",y),wt())})),pn};if(B)_a();else{let d={injectedStyles:e.injectedCompStyles,injectedScripts:e.injectedCompScripts,injectedLinks:e.injectedCompLinks,parseDimensionPx:W,onDiagnostic:({code:g,details:h})=>{be({source:"hf-preview",type:"diagnostic",code:g,details:h})}};yd(d).then(()=>xd(d)).finally(()=>{B=!0,Hi(),Tm(),_a(),La(document),wt()})}let Er=yu({postMessage:d=>be(d)});Er.installPickerApi(),Ar(e.currentTime,Array.from(document.querySelectorAll("video[data-start], img[data-start]")));let ze=of();r=ze,T(()=>{ze.destroy(),r=null});let zi=d=>{let g=Number(d);!Number.isFinite(g)||g<=0?e.playbackRate=1:e.playbackRate=Math.max(.1,Math.min(5,g)),e.mediaForceSyncNextTick=!0,e.capturedTimeline&&typeof e.capturedTimeline.timeScale=="function"&&e.capturedTimeline.timeScale(e.playbackRate);let h=document.querySelectorAll("video, audio");for(let y of h)if(y instanceof HTMLMediaElement)try{y.playbackRate=e.playbackRate}catch(w){L("runtime.init.site10",w)}},Rs={play:()=>{let d=e.capturedTimeline;if(f.isPlaying())return;let g=Ce(d,0);if(g>0)f.setDuration(g),f.reachedEnd()&&(f.seek(0),e.currentTime=0,Ct(0));else{let h=Y(),y=Number(h?.getAttribute("data-duration")??0);y>0&&f.setDuration(y)}ot(d),f.play()&&(e.isPlaying=!0,e.mediaForceSyncNextTick=!0,Ps(f.now()),p&&!e.nativeMediaSyncDisabled&&!e.webAudioMediaDisabled&&ji(),He("play"),Oe(),ze.redraw(),ke(!0))},pause:()=>{if(!f.isPlaying())return;m.stopAll(),f.detachAudioSource(),f.pause(),e.isPlaying=!1,e.currentTime=f.now(),e.mediaForceSyncNextTick=!0,Ps(e.currentTime);let d=e.capturedTimeline;ot(d),He("pause"),Oe(),ze.redraw(),ke(!0)},seek:(d,g)=>{let h=$t(Math.max(0,Number(d)||0),e.canonicalFps);m.stopAll(),f.detachAudioSource();let y=f.isPlaying();y&&f.pause(),f.seek(h),e.currentTime=f.now(),e.isPlaying=!1,e.mediaForceSyncNextTick=!0;let w=e.capturedTimeline;if(ot(w),Ct(e.currentTime),He("pause"),g?.keepPlaying&&y){Rs.play();return}Oe(),ze.redraw(),ke(!0)},renderSeek:(d,g)=>{xs=!0;let h=$t(Math.max(0,Number(d)||0),e.canonicalFps);m.stopAll(),f.detachAudioSource(),f.isPlaying()&&f.pause(),f.seek(h),e.currentTime=f.now(),e.isPlaying=!1,e.mediaForceSyncNextTick=!0,Ct(e.currentTime,{activateChildren:!0,suppressEvents:g?.suppressEvents}),He("pause"),Oe(),ze.redraw(),ke(!0)},getTime:()=>f.now(),getDuration:()=>{if(window.__crocoPlannedPreviewDuration){let g=Ce(e.capturedTimeline,0);g>0&&f.setDuration(g)}let d=f.getDuration();return Number.isFinite(d)?d:0},isPlaying:()=>f.isPlaying(),setPlaybackRate:d=>{zi(d),f.setRate(e.playbackRate),Os()},getPlaybackRate:()=>e.playbackRate},ks=Ce(e.capturedTimeline,0);ks>0&&f.setDuration(ks);let Ge=Au({getTimeline:()=>e.capturedTimeline,setTimeline:d=>{e.capturedTimeline=d},getTimelineRegistry:()=>window.__timelines??{},getIsPlaying:()=>e.isPlaying,setIsPlaying:d=>{e.isPlaying!==d&&(e.mediaForceSyncNextTick=!0),e.isPlaying=d},getPlaybackRate:()=>e.playbackRate,setPlaybackRate:zi,getCanonicalFps:()=>e.canonicalFps,onSyncMedia:(d,g)=>{e.currentTime=Math.max(0,Number(d)||0),e.isPlaying!==g&&(e.mediaForceSyncNextTick=!0),e.isPlaying=g,Oe()},onStatePost:ke,onDeterministicSeek:(d,g)=>{for(let h of e.deterministicAdapters)if(!(h.name==="gsap"&&e.capturedTimeline))try{h.seek({time:Number(d)||0,suppressEvents:g?.suppressEvents})}catch(y){L("runtime.init.site11",y)}},onDeterministicPause:()=>He("pause"),onDeterministicPlay:()=>He("play"),onRenderFrameSeek:()=>{ze.redraw()},onShowNativeVideos:()=>{},getSafeDuration:()=>Ce(e.capturedTimeline,0),transport:Rs});window.__player=D(Ge),window.__playerReady=!0,Ne("composition_loaded",{duration:Ge.getDuration(),compositionId:document.querySelector("[data-composition-id]")?.getAttribute("data-composition-id")??null}),e.deterministicAdapters=[hl(),Js({resolveStartSeconds:d=>P(d,0)}),Zs(),tl(),il(),ol(),al(),sl(),ll(),ul(),cl(),Qs({getTimeline:()=>e.capturedTimeline})],ml(),pl(),window.__hfReseekGpu=d=>{let g=Math.max(0,Number(d)||0);window.__hfThreeTime=g,window.__hfTypegpuTime=g,Fr(g)},window.__hfWaitForSeekCompletion=ao,a.push(()=>{window.__hfWaitForSeekCompletion===ao&&delete window.__hfWaitForSeekCompletion}),_m(),Hi(),He("discover");let Om=()=>{let d=e.capturedTimeline,g=dn();e.capturedTimeline&&(g||e.capturedTimeline!==d||!Ge._timeline)&&(Ge._timeline=e.capturedTimeline);let h=Ce(e.capturedTimeline,0);if(h>0&&f.setDuration(h),He("discover",e.currentTime),!e.capturedTimeline){let y=window.__timelines??{},w=Object.keys(y).filter(N=>y[N]);if(w.length>0){let G=Y()?.getAttribute("data-composition-id")??null;M("root_timeline_unbound_registry_present",{reason:G?"root data-composition-id has no matching key in window.__timelines":"root composition element has no data-composition-id attribute",rootCompositionId:G,registeredTimelineKeys:w},"root_timeline_unbound_registry_present"),console.warn("[hyperframes] Root timeline not bound \\u2014 render will freeze at t=0. "+(G?`Root data-composition-id is "${G}" but window.__timelines has no such key. `:"Root composition element has no data-composition-id. ")+`Registered timeline keys: [${w.join(", ")}]. Register the root timeline under its data-composition-id (window.__timelines["${G??""}"] = tl).`)}}window.__renderReady=!0,st(),ke(!0)},It=null,Hm=()=>{if(It)return;let d=()=>{window.removeEventListener("hf-timelines-built",d),It=null,wt()};It=d,window.addEventListener("hf-timelines-built",d)};T(()=>{It&&(window.removeEventListener("hf-timelines-built",It),It=null)}),wt=()=>{if(!B){window.__renderReady=!1;return}if(window.__hfTimelinesBuilding){window.__renderReady=!1,Hm();return}if(He("discover",e.currentTime),!Pm()){window.__renderReady=!1;return}Om()},wt(),B&&setTimeout(()=>{wt()},0);let wr=0,qi=!1,Ms=Number.NaN,Fs=null,$i=!1,Gm=(d,g,h,y)=>{try{let w=y?.suppressEvents===!0;ot(d),typeof d.totalTime=="function"?d.totalTime(g,w):d.seek(g,w)}catch(w){L(h,w)}},Bm=(d,g)=>{let h=window.__timelines??{},y=Y()?.getAttribute("data-composition-id")??null;for(let[w,N]of Object.entries(h)){if(!N||w===y)continue;let G=document.querySelector(`[data-composition-id="${CSS.escape(w)}"]`);if(!G)continue;let re=P(G,0);if(!Number.isFinite(re))continue;let $=ee(N),le=$e(G)+Math.max(0,d-re)*_e(G),Be=Math.max(0,$!=null&&$>0?Math.min($,le):le);Gm(N,Be,"runtime.init.transport.childTimeline",g)}},Ns=d=>{let g=window.__timelines??{};for(let h of Object.values(g))if(!(!h||h===d))try{h.play()}catch(y){L("runtime.init.activateSiblings",y)}},Ls=d=>typeof d=="object"&&d!==null,hn=new WeakMap,Um=["onStart","onUpdate","onComplete","onReverseComplete","onRepeat"],Ds=(d,g)=>{let h=d[g];if(typeof h!="function")return null;try{let y=Number(h.call(d));return Number.isFinite(y)?y:null}catch(y){return L("runtime.init.gsapCallbackDuration",y),null}},Wm=d=>{let g=hn.get(d);if(g!=null)return g;if(!("getChildren"in d)||typeof d.getChildren!="function")return!1;let h;try{h=d.getChildren(!0,!0,!0)}catch(y){return L("runtime.init.gsapCallbackChildren",y),hn.set(d,!1),!1}if(!Array.isArray(h))return hn.set(d,!1),!1;for(let y of h){if(!Ls(y))continue;let w=y.vars;if(!Ls(w)||!Um.some($=>typeof w[$]=="function"))continue;let re=Ds(y,"totalDuration")??Ds(y,"duration");if(re!=null&&re<=1e-6)return hn.set(d,!0),!0}return hn.set(d,!1),!1};function Ct(d,g){let h=e.capturedTimeline,y=g?.suppressEvents===!0;if(h){g?.activateChildren&&Ns(h);let w=h,N=d;if(typeof w.totalDuration=="function")try{let G=Number(w.totalDuration());Number.isFinite(G)&&G>0&&d>G&&(N=G)}catch(G){L("runtime.init.transport.clampDuration",G)}try{typeof h.totalTime=="function"?(h.totalTime(N,y),!y&&!Wm(h)&&(h.totalTime(N+.001,!0),h.totalTime(N,!0))):h.seek(N,y)}catch(G){L("runtime.init.transport.seek",G)}}Bm(d,g),h&&g?.activateChildren&&Ns(h);for(let w of e.deterministicAdapters)if(!(w.name==="gsap"&&h))try{w.seek({time:d,suppressEvents:y})}catch(N){L("runtime.init.transport.adapter",N)}}let Vm=()=>{try{return document.querySelector(`[${Cf}]`)!=null}catch{return!1}},Is=()=>{if(!(e.tornDown||qi)){qi=!0;try{if(e.transportRafId=window.requestAnimationFrame(Is),wr+=1,_f({tick:wr,isPlaying:f.isPlaying(),hasCapturedTimeline:e.capturedTimeline!=null,currentTimeSeconds:f.now()})){let y=e.capturedTimeline;if(dn()){e.capturedTimeline&&!Ge._timeline&&(Ge._timeline=e.capturedTimeline),e.capturedTimeline&&e.capturedTimeline!==y&&ot(e.capturedTimeline);let w=Ce(e.capturedTimeline,0);w>0&&f.setDuration(w),st()}}if(wr%20===0&&st(),wr%30===0&&Hi(),e.capturedTimeline){let y=Ce(e.capturedTimeline,0);y>0&&(!f.isPlaying()||y>=f.getDuration())&&f.setDuration(y)}if(f.isPlaying()&&!e.mediaOutputMuted)if(!e.nativeMediaSyncDisabled&&!e.webAudioMediaDisabled&&m.isActive()&&m.context){let y=m.getTime();y>=0&&f.attachAudioSource({currentTimeSeconds:y})}else{let y=document.querySelectorAll("audio[data-start]"),w=!1;for(let N of y){if(!(N instanceof HTMLMediaElement)||!N.isConnected||b(N))continue;let G=Number.parseFloat(N.dataset.start??""),re=ve(N.dataset.duration),$=re!=null&&re>0?G+re:1/0,le=$e(N);if(Number.isFinite(G)&&e.currentTime>=G&&e.currentTime<$){N.paused?!N.error&&N.readyState{let g=document.querySelectorAll("video, audio");for(let h of g){if(!(h instanceof HTMLMediaElement)||!h.isConnected)continue;let y=Number.parseFloat(h.dataset.start??"");if(!Number.isFinite(y))continue;let w=ve(h.dataset.duration),N=w!=null&&w>0?y+w:1/0;if(d=N)continue;let G=$e(h),re=d-y+G;if(re>=0)try{h.currentTime=re}catch{}}},ji=()=>{if(e.nativeMediaSyncDisabled||e.webAudioMediaDisabled)return;let d=m.startGeneration(),g=document.querySelectorAll("audio[data-start]");for(let h of g){if(!(h instanceof HTMLMediaElement)||!h.isConnected||b(h))continue;let y=Number.parseFloat(h.dataset.start??"");if(!Number.isFinite(y))continue;let w=$e(h),N=Number.parseFloat(h.dataset.volume??""),G=Number.isFinite(N)?N:1,re=ve(h.dataset.duration),$=re!=null&&re>0?re:Number.POSITIVE_INFINITY,le=h.closest("[data-composition-id]");if(le){let Q=P(le,0),ne=H(le,{includeAuthoredTimingAttrs:!0});ne!=null&&ne>0&&($=Math.min($,Math.max(0,Q+ne-y)))}let Be=an(h);sn(h,Be),(Be.kind==="web-audio"?m.scheduleMediaElementPlayback(h,y,w,f.now(),G,d,e.playbackRate):Promise.resolve(null)).then(Q=>{if(Q||!f.isPlaying())return;let ne=e.playbackRate*_e(h),_t=h.hasAttribute("data-fx-chain")||h.hasAttribute("data-automation");if(Math.abs(ne-1)>1e-9){Be.kind==="web-audio"&&_t&&(h.muted=!0);return}m.decodeAudioElement(h).then(ye=>{!ye||!f.isPlaying()||m.schedulePlayback(h,ye,y,w,f.now(),G,d,e.playbackRate,$)})})}};function Os(){m.setRate(e.playbackRate)&&!e.nativeMediaSyncDisabled&&!e.webAudioMediaDisabled&&p&&f.isPlaying()&&m.hasBoundedActiveSources()&&(m.stopAll(),ji())}if(e.capturedTimeline){let d=Ce(e.capturedTimeline,0);d>0&&f.setDuration(d),ot(e.capturedTimeline)}Cd(window),e.transportRafId=window.requestAnimationFrame(Is),st(),ke(!0),e.controlBridgeHandler=Us({onPlay:()=>{Ge.play(),Ne("composition_played",{time:Ge.getTime()})},onPause:()=>{Ge.pause(),Ne("composition_paused",{time:Ge.getTime()})},onStopMedia:()=>{m.stopAll();let d=document.querySelectorAll("video, audio");for(let g of d)g instanceof HTMLMediaElement&&!g.paused&&g.pause()},onSeek:(d,g)=>{Ge.seek(d),Ne("composition_seeked",{time:d})},onSetMuted:d=>{e.bridgeMuted=d;let g=d||e.mediaOutputMuted;m.setMuted(g);let h=document.querySelectorAll("video, audio");for(let y of h)y instanceof HTMLMediaElement&&(y.muted=g||y.defaultMuted)},onSetVolume:d=>{e.bridgeVolume=d,m.setVolume(d);let g=document.querySelectorAll("video, audio");for(let h of g){if(!(h instanceof HTMLMediaElement))continue;let y=parseFloat(h.dataset.volume??""),w=Number.isFinite(y)?y:1;h.volume=Nr(w*d)}},onSetMediaOutputMuted:d=>{e.mediaOutputMuted=d;let g=d||e.bridgeMuted;m.setMuted(g);let h=document.querySelectorAll("video, audio");for(let y of h)y instanceof HTMLMediaElement&&(y.muted=g||y.defaultMuted)},onSetNativeMediaSyncDisabled:d=>{e.nativeMediaSyncDisabled!==d&&(e.nativeMediaSyncDisabled=d,e.mediaForceSyncNextTick=!0,d?(m.stopAll(),f.detachAudioSource()):Oe())},onSetWebAudioMediaDisabled:d=>{e.webAudioMediaDisabled!==d&&(e.webAudioMediaDisabled=d,e.mediaForceSyncNextTick=!0,d&&(m.stopAll(),f.detachAudioSource()),Oe())},onSetPlaybackRate:d=>{zi(d),e.transportClock&&e.transportClock.setRate(e.playbackRate),Os()},onSetRootDuration:Dm,onSetColorGrading:(d,g)=>{ze.setGrading(d,g)},onSetColorGradingCompare:(d,g)=>{ze.setCompare(d,g)},onTick:()=>{if(e.tornDown||!f.isPlaying())return;let d=f.now();if(e.currentTime=d,Ct(d),f.reachedEnd()){m.stopAll(),f.detachAudioSource(),f.pause(),e.isPlaying=!1;let g=f.getDuration();Number.isFinite(g)&&(f.seek(g),e.currentTime=g,Ct(g)),He("pause"),Oe(),ke(!0)}},onEnablePickMode:()=>Er.enablePickMode(),onDisablePickMode:()=>Er.disablePickMode(),onSetRuntimeData:Ri,onClearRuntimeData:ki,getCanonicalFps:()=>e.canonicalFps});let Ki=()=>{if(!e.tornDown){e.tornDown=!0,e.transportRafId!=null&&(window.cancelAnimationFrame(e.transportRafId),e.transportRafId=null),e.transportClock=null,m.destroy(),Et!=null&&(window.clearTimeout(Et),Et=null),s!=null&&(window.cancelAnimationFrame(s),s=null),km(),e.controlBridgeHandler&&(window.removeEventListener("message",e.controlBridgeHandler),e.controlBridgeHandler=null),i&&(window.removeEventListener("error",i),i=null),o&&(window.removeEventListener("unhandledrejection",o),o=null),e.beforeUnloadHandler&&(window.removeEventListener("beforeunload",e.beforeUnloadHandler),e.beforeUnloadHandler=null),Er.disablePickMode();for(let d of e.deterministicAdapters)if(!(!d||typeof d.revert!="function"))try{d.revert()}catch(g){L("runtime.init.site12",g)}e.deterministicAdapters=[];for(let d of a.splice(0))try{d()}catch(g){L("runtime.init.site13",g)}for(let d of e.injectedCompStyles)try{d.remove()}catch(g){L("runtime.init.site14",g)}e.injectedCompStyles=[];for(let d of e.injectedCompLinks)try{d.remove()}catch(g){L("runtime.init.site15",g)}e.injectedCompLinks=[];for(let d of e.injectedCompScripts)try{d.remove()}catch(g){L("runtime.init.site16",g)}e.injectedCompScripts=[],e.capturedTimeline=null,t=()=>{},window.__hfRuntimeTeardown===Ki&&(window.__hfRuntimeTeardown=null)}};window.__hfRuntimeTeardown=Ki,e.beforeUnloadHandler=Ki,window.addEventListener("beforeunload",e.beforeUnloadHandler)}var Vf=["BN","BN","BN","BN","BN","BN","BN","BN","BN","S","B","S","WS","B","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","B","B","B","S","WS","ON","ON","ET","ET","ET","ON","ON","ON","ON","ON","ES","CS","ES","CS","CS","EN","EN","EN","EN","EN","EN","EN","EN","EN","EN","CS","ON","ON","ON","ON","ON","ON","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","ON","ON","ON","ON","ON","ON","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","ON","ON","ON","ON","BN","BN","BN","BN","BN","BN","B","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","CS","ON","ET","ET","ET","ET","ON","ON","ON","ON","L","ON","ON","BN","ON","ON","ET","ET","EN","EN","ON","L","ON","ON","ON","EN","L","ON","ON","ON","ON","ON","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","ON","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","ON","L","L","L","L","L","L","L","L"],ss=[[697,698,"ON"],[706,719,"ON"],[722,735,"ON"],[741,749,"ON"],[751,767,"ON"],[768,879,"NSM"],[884,885,"ON"],[894,894,"ON"],[900,901,"ON"],[903,903,"ON"],[1014,1014,"ON"],[1155,1161,"NSM"],[1418,1418,"ON"],[1421,1422,"ON"],[1423,1423,"ET"],[1424,1424,"R"],[1425,1469,"NSM"],[1470,1470,"R"],[1471,1471,"NSM"],[1472,1472,"R"],[1473,1474,"NSM"],[1475,1475,"R"],[1476,1477,"NSM"],[1478,1478,"R"],[1479,1479,"NSM"],[1480,1535,"R"],[1536,1541,"AN"],[1542,1543,"ON"],[1544,1544,"AL"],[1545,1546,"ET"],[1547,1547,"AL"],[1548,1548,"CS"],[1549,1549,"AL"],[1550,1551,"ON"],[1552,1562,"NSM"],[1563,1610,"AL"],[1611,1631,"NSM"],[1632,1641,"AN"],[1642,1642,"ET"],[1643,1644,"AN"],[1645,1647,"AL"],[1648,1648,"NSM"],[1649,1749,"AL"],[1750,1756,"NSM"],[1757,1757,"AN"],[1758,1758,"ON"],[1759,1764,"NSM"],[1765,1766,"AL"],[1767,1768,"NSM"],[1769,1769,"ON"],[1770,1773,"NSM"],[1774,1775,"AL"],[1776,1785,"EN"],[1786,1808,"AL"],[1809,1809,"NSM"],[1810,1839,"AL"],[1840,1866,"NSM"],[1867,1957,"AL"],[1958,1968,"NSM"],[1969,1983,"AL"],[1984,2026,"R"],[2027,2035,"NSM"],[2036,2037,"R"],[2038,2041,"ON"],[2042,2044,"R"],[2045,2045,"NSM"],[2046,2069,"R"],[2070,2073,"NSM"],[2074,2074,"R"],[2075,2083,"NSM"],[2084,2084,"R"],[2085,2087,"NSM"],[2088,2088,"R"],[2089,2093,"NSM"],[2094,2136,"R"],[2137,2139,"NSM"],[2140,2143,"R"],[2144,2191,"AL"],[2192,2193,"AN"],[2194,2198,"AL"],[2199,2207,"NSM"],[2208,2249,"AL"],[2250,2273,"NSM"],[2274,2274,"AN"],[2275,2306,"NSM"],[2362,2362,"NSM"],[2364,2364,"NSM"],[2369,2376,"NSM"],[2381,2381,"NSM"],[2385,2391,"NSM"],[2402,2403,"NSM"],[2433,2433,"NSM"],[2492,2492,"NSM"],[2497,2500,"NSM"],[2509,2509,"NSM"],[2530,2531,"NSM"],[2546,2547,"ET"],[2555,2555,"ET"],[2558,2558,"NSM"],[2561,2562,"NSM"],[2620,2620,"NSM"],[2625,2626,"NSM"],[2631,2632,"NSM"],[2635,2637,"NSM"],[2641,2641,"NSM"],[2672,2673,"NSM"],[2677,2677,"NSM"],[2689,2690,"NSM"],[2748,2748,"NSM"],[2753,2757,"NSM"],[2759,2760,"NSM"],[2765,2765,"NSM"],[2786,2787,"NSM"],[2801,2801,"ET"],[2810,2815,"NSM"],[2817,2817,"NSM"],[2876,2876,"NSM"],[2879,2879,"NSM"],[2881,2884,"NSM"],[2893,2893,"NSM"],[2901,2902,"NSM"],[2914,2915,"NSM"],[2946,2946,"NSM"],[3008,3008,"NSM"],[3021,3021,"NSM"],[3059,3064,"ON"],[3065,3065,"ET"],[3066,3066,"ON"],[3072,3072,"NSM"],[3076,3076,"NSM"],[3132,3132,"NSM"],[3134,3136,"NSM"],[3142,3144,"NSM"],[3146,3149,"NSM"],[3157,3158,"NSM"],[3170,3171,"NSM"],[3192,3198,"ON"],[3201,3201,"NSM"],[3260,3260,"NSM"],[3276,3277,"NSM"],[3298,3299,"NSM"],[3328,3329,"NSM"],[3387,3388,"NSM"],[3393,3396,"NSM"],[3405,3405,"NSM"],[3426,3427,"NSM"],[3457,3457,"NSM"],[3530,3530,"NSM"],[3538,3540,"NSM"],[3542,3542,"NSM"],[3633,3633,"NSM"],[3636,3642,"NSM"],[3647,3647,"ET"],[3655,3662,"NSM"],[3761,3761,"NSM"],[3764,3772,"NSM"],[3784,3790,"NSM"],[3864,3865,"NSM"],[3893,3893,"NSM"],[3895,3895,"NSM"],[3897,3897,"NSM"],[3898,3901,"ON"],[3953,3966,"NSM"],[3968,3972,"NSM"],[3974,3975,"NSM"],[3981,3991,"NSM"],[3993,4028,"NSM"],[4038,4038,"NSM"],[4141,4144,"NSM"],[4146,4151,"NSM"],[4153,4154,"NSM"],[4157,4158,"NSM"],[4184,4185,"NSM"],[4190,4192,"NSM"],[4209,4212,"NSM"],[4226,4226,"NSM"],[4229,4230,"NSM"],[4237,4237,"NSM"],[4253,4253,"NSM"],[4957,4959,"NSM"],[5008,5017,"ON"],[5120,5120,"ON"],[5760,5760,"WS"],[5787,5788,"ON"],[5906,5908,"NSM"],[5938,5939,"NSM"],[5970,5971,"NSM"],[6002,6003,"NSM"],[6068,6069,"NSM"],[6071,6077,"NSM"],[6086,6086,"NSM"],[6089,6099,"NSM"],[6107,6107,"ET"],[6109,6109,"NSM"],[6128,6137,"ON"],[6144,6154,"ON"],[6155,6157,"NSM"],[6158,6158,"BN"],[6159,6159,"NSM"],[6277,6278,"NSM"],[6313,6313,"NSM"],[6432,6434,"NSM"],[6439,6440,"NSM"],[6450,6450,"NSM"],[6457,6459,"NSM"],[6464,6464,"ON"],[6468,6469,"ON"],[6622,6655,"ON"],[6679,6680,"NSM"],[6683,6683,"NSM"],[6742,6742,"NSM"],[6744,6750,"NSM"],[6752,6752,"NSM"],[6754,6754,"NSM"],[6757,6764,"NSM"],[6771,6780,"NSM"],[6783,6783,"NSM"],[6832,6877,"NSM"],[6880,6891,"NSM"],[6912,6915,"NSM"],[6964,6964,"NSM"],[6966,6970,"NSM"],[6972,6972,"NSM"],[6978,6978,"NSM"],[7019,7027,"NSM"],[7040,7041,"NSM"],[7074,7077,"NSM"],[7080,7081,"NSM"],[7083,7085,"NSM"],[7142,7142,"NSM"],[7144,7145,"NSM"],[7149,7149,"NSM"],[7151,7153,"NSM"],[7212,7219,"NSM"],[7222,7223,"NSM"],[7376,7378,"NSM"],[7380,7392,"NSM"],[7394,7400,"NSM"],[7405,7405,"NSM"],[7412,7412,"NSM"],[7416,7417,"NSM"],[7616,7679,"NSM"],[8125,8125,"ON"],[8127,8129,"ON"],[8141,8143,"ON"],[8157,8159,"ON"],[8173,8175,"ON"],[8189,8190,"ON"],[8192,8202,"WS"],[8203,8205,"BN"],[8207,8207,"R"],[8208,8231,"ON"],[8232,8232,"WS"],[8233,8233,"B"],[8234,8238,"BN"],[8239,8239,"CS"],[8240,8244,"ET"],[8245,8259,"ON"],[8260,8260,"CS"],[8261,8286,"ON"],[8287,8287,"WS"],[8288,8303,"BN"],[8304,8304,"EN"],[8308,8313,"EN"],[8314,8315,"ES"],[8316,8318,"ON"],[8320,8329,"EN"],[8330,8331,"ES"],[8332,8334,"ON"],[8352,8399,"ET"],[8400,8432,"NSM"],[8448,8449,"ON"],[8451,8454,"ON"],[8456,8457,"ON"],[8468,8468,"ON"],[8470,8472,"ON"],[8478,8483,"ON"],[8485,8485,"ON"],[8487,8487,"ON"],[8489,8489,"ON"],[8494,8494,"ET"],[8506,8507,"ON"],[8512,8516,"ON"],[8522,8525,"ON"],[8528,8543,"ON"],[8585,8587,"ON"],[8592,8721,"ON"],[8722,8722,"ES"],[8723,8723,"ET"],[8724,9013,"ON"],[9083,9108,"ON"],[9110,9257,"ON"],[9280,9290,"ON"],[9312,9351,"ON"],[9352,9371,"EN"],[9450,9899,"ON"],[9901,10239,"ON"],[10496,11123,"ON"],[11126,11263,"ON"],[11493,11498,"ON"],[11503,11505,"NSM"],[11513,11519,"ON"],[11647,11647,"NSM"],[11744,11775,"NSM"],[11776,11869,"ON"],[11904,11929,"ON"],[11931,12019,"ON"],[12032,12245,"ON"],[12272,12287,"ON"],[12288,12288,"WS"],[12289,12292,"ON"],[12296,12320,"ON"],[12330,12333,"NSM"],[12336,12336,"ON"],[12342,12343,"ON"],[12349,12351,"ON"],[12441,12442,"NSM"],[12443,12444,"ON"],[12448,12448,"ON"],[12539,12539,"ON"],[12736,12773,"ON"],[12783,12783,"ON"],[12829,12830,"ON"],[12880,12895,"ON"],[12924,12926,"ON"],[12977,12991,"ON"],[13004,13007,"ON"],[13175,13178,"ON"],[13278,13279,"ON"],[13311,13311,"ON"],[19904,19967,"ON"],[42128,42182,"ON"],[42509,42511,"ON"],[42607,42610,"NSM"],[42611,42611,"ON"],[42612,42621,"NSM"],[42622,42623,"ON"],[42654,42655,"NSM"],[42736,42737,"NSM"],[42752,42785,"ON"],[42888,42888,"ON"],[43010,43010,"NSM"],[43014,43014,"NSM"],[43019,43019,"NSM"],[43045,43046,"NSM"],[43048,43051,"ON"],[43052,43052,"NSM"],[43064,43065,"ET"],[43124,43127,"ON"],[43204,43205,"NSM"],[43232,43249,"NSM"],[43263,43263,"NSM"],[43302,43309,"NSM"],[43335,43345,"NSM"],[43392,43394,"NSM"],[43443,43443,"NSM"],[43446,43449,"NSM"],[43452,43453,"NSM"],[43493,43493,"NSM"],[43561,43566,"NSM"],[43569,43570,"NSM"],[43573,43574,"NSM"],[43587,43587,"NSM"],[43596,43596,"NSM"],[43644,43644,"NSM"],[43696,43696,"NSM"],[43698,43700,"NSM"],[43703,43704,"NSM"],[43710,43711,"NSM"],[43713,43713,"NSM"],[43756,43757,"NSM"],[43766,43766,"NSM"],[43882,43883,"ON"],[44005,44005,"NSM"],[44008,44008,"NSM"],[44013,44013,"NSM"],[64285,64285,"R"],[64286,64286,"NSM"],[64287,64296,"R"],[64297,64297,"ES"],[64298,64335,"R"],[64336,64450,"AL"],[64451,64466,"ON"],[64467,64829,"AL"],[64830,64847,"ON"],[64848,64911,"AL"],[64912,64913,"ON"],[64914,64967,"AL"],[64968,64975,"ON"],[64976,65007,"BN"],[65008,65020,"AL"],[65021,65023,"ON"],[65024,65039,"NSM"],[65040,65049,"ON"],[65056,65071,"NSM"],[65072,65103,"ON"],[65104,65104,"CS"],[65105,65105,"ON"],[65106,65106,"CS"],[65108,65108,"ON"],[65109,65109,"CS"],[65110,65118,"ON"],[65119,65119,"ET"],[65120,65121,"ON"],[65122,65123,"ES"],[65124,65126,"ON"],[65128,65128,"ON"],[65129,65130,"ET"],[65131,65131,"ON"],[65136,65278,"AL"],[65279,65279,"BN"],[65281,65282,"ON"],[65283,65285,"ET"],[65286,65290,"ON"],[65291,65291,"ES"],[65292,65292,"CS"],[65293,65293,"ES"],[65294,65295,"CS"],[65296,65305,"EN"],[65306,65306,"CS"],[65307,65312,"ON"],[65339,65344,"ON"],[65371,65381,"ON"],[65504,65505,"ET"],[65506,65508,"ON"],[65509,65510,"ET"],[65512,65518,"ON"],[65520,65528,"BN"],[65529,65533,"ON"],[65534,65535,"BN"],[65793,65793,"ON"],[65856,65932,"ON"],[65936,65948,"ON"],[65952,65952,"ON"],[66045,66045,"NSM"],[66272,66272,"NSM"],[66273,66299,"EN"],[66422,66426,"NSM"],[67584,67870,"R"],[67871,67871,"ON"],[67872,68096,"R"],[68097,68099,"NSM"],[68100,68100,"R"],[68101,68102,"NSM"],[68103,68107,"R"],[68108,68111,"NSM"],[68112,68151,"R"],[68152,68154,"NSM"],[68155,68158,"R"],[68159,68159,"NSM"],[68160,68324,"R"],[68325,68326,"NSM"],[68327,68408,"R"],[68409,68415,"ON"],[68416,68863,"R"],[68864,68899,"AL"],[68900,68903,"NSM"],[68904,68911,"AL"],[68912,68921,"AN"],[68922,68927,"AL"],[68928,68937,"AN"],[68938,68968,"R"],[68969,68973,"NSM"],[68974,68974,"ON"],[68975,69215,"R"],[69216,69246,"AN"],[69247,69290,"R"],[69291,69292,"NSM"],[69293,69311,"R"],[69312,69327,"AL"],[69328,69336,"ON"],[69337,69369,"AL"],[69370,69375,"NSM"],[69376,69423,"R"],[69424,69445,"AL"],[69446,69456,"NSM"],[69457,69487,"AL"],[69488,69505,"R"],[69506,69509,"NSM"],[69510,69631,"R"],[69633,69633,"NSM"],[69688,69702,"NSM"],[69714,69733,"ON"],[69744,69744,"NSM"],[69747,69748,"NSM"],[69759,69761,"NSM"],[69811,69814,"NSM"],[69817,69818,"NSM"],[69826,69826,"NSM"],[69888,69890,"NSM"],[69927,69931,"NSM"],[69933,69940,"NSM"],[70003,70003,"NSM"],[70016,70017,"NSM"],[70070,70078,"NSM"],[70089,70092,"NSM"],[70095,70095,"NSM"],[70191,70193,"NSM"],[70196,70196,"NSM"],[70198,70199,"NSM"],[70206,70206,"NSM"],[70209,70209,"NSM"],[70367,70367,"NSM"],[70371,70378,"NSM"],[70400,70401,"NSM"],[70459,70460,"NSM"],[70464,70464,"NSM"],[70502,70508,"NSM"],[70512,70516,"NSM"],[70587,70592,"NSM"],[70606,70606,"NSM"],[70608,70608,"NSM"],[70610,70610,"NSM"],[70625,70626,"NSM"],[70712,70719,"NSM"],[70722,70724,"NSM"],[70726,70726,"NSM"],[70750,70750,"NSM"],[70835,70840,"NSM"],[70842,70842,"NSM"],[70847,70848,"NSM"],[70850,70851,"NSM"],[71090,71093,"NSM"],[71100,71101,"NSM"],[71103,71104,"NSM"],[71132,71133,"NSM"],[71219,71226,"NSM"],[71229,71229,"NSM"],[71231,71232,"NSM"],[71264,71276,"ON"],[71339,71339,"NSM"],[71341,71341,"NSM"],[71344,71349,"NSM"],[71351,71351,"NSM"],[71453,71453,"NSM"],[71455,71455,"NSM"],[71458,71461,"NSM"],[71463,71467,"NSM"],[71727,71735,"NSM"],[71737,71738,"NSM"],[71995,71996,"NSM"],[71998,71998,"NSM"],[72003,72003,"NSM"],[72148,72151,"NSM"],[72154,72155,"NSM"],[72160,72160,"NSM"],[72193,72198,"NSM"],[72201,72202,"NSM"],[72243,72248,"NSM"],[72251,72254,"NSM"],[72263,72263,"NSM"],[72273,72278,"NSM"],[72281,72283,"NSM"],[72330,72342,"NSM"],[72344,72345,"NSM"],[72544,72544,"NSM"],[72546,72548,"NSM"],[72550,72550,"NSM"],[72752,72758,"NSM"],[72760,72765,"NSM"],[72850,72871,"NSM"],[72874,72880,"NSM"],[72882,72883,"NSM"],[72885,72886,"NSM"],[73009,73014,"NSM"],[73018,73018,"NSM"],[73020,73021,"NSM"],[73023,73029,"NSM"],[73031,73031,"NSM"],[73104,73105,"NSM"],[73109,73109,"NSM"],[73111,73111,"NSM"],[73459,73460,"NSM"],[73472,73473,"NSM"],[73526,73530,"NSM"],[73536,73536,"NSM"],[73538,73538,"NSM"],[73562,73562,"NSM"],[73685,73692,"ON"],[73693,73696,"ET"],[73697,73713,"ON"],[78912,78912,"NSM"],[78919,78933,"NSM"],[90398,90409,"NSM"],[90413,90415,"NSM"],[92912,92916,"NSM"],[92976,92982,"NSM"],[94031,94031,"NSM"],[94095,94098,"NSM"],[94178,94178,"ON"],[94180,94180,"NSM"],[113821,113822,"NSM"],[113824,113827,"BN"],[117760,117973,"ON"],[118e3,118009,"EN"],[118010,118012,"ON"],[118016,118451,"ON"],[118458,118480,"ON"],[118496,118512,"ON"],[118528,118573,"NSM"],[118576,118598,"NSM"],[119143,119145,"NSM"],[119155,119162,"BN"],[119163,119170,"NSM"],[119173,119179,"NSM"],[119210,119213,"NSM"],[119273,119274,"ON"],[119296,119361,"ON"],[119362,119364,"NSM"],[119365,119365,"ON"],[119552,119638,"ON"],[120513,120513,"ON"],[120539,120539,"ON"],[120571,120571,"ON"],[120597,120597,"ON"],[120629,120629,"ON"],[120655,120655,"ON"],[120687,120687,"ON"],[120713,120713,"ON"],[120745,120745,"ON"],[120771,120771,"ON"],[120782,120831,"EN"],[121344,121398,"NSM"],[121403,121452,"NSM"],[121461,121461,"NSM"],[121476,121476,"NSM"],[121499,121503,"NSM"],[121505,121519,"NSM"],[122880,122886,"NSM"],[122888,122904,"NSM"],[122907,122913,"NSM"],[122915,122916,"NSM"],[122918,122922,"NSM"],[123023,123023,"NSM"],[123184,123190,"NSM"],[123566,123566,"NSM"],[123628,123631,"NSM"],[123647,123647,"ET"],[124140,124143,"NSM"],[124398,124399,"NSM"],[124643,124643,"NSM"],[124646,124646,"NSM"],[124654,124655,"NSM"],[124661,124661,"NSM"],[124928,125135,"R"],[125136,125142,"NSM"],[125143,125251,"R"],[125252,125258,"NSM"],[125259,126063,"R"],[126064,126143,"AL"],[126144,126207,"R"],[126208,126287,"AL"],[126288,126463,"R"],[126464,126703,"AL"],[126704,126705,"ON"],[126706,126719,"AL"],[126720,126975,"R"],[126976,127019,"ON"],[127024,127123,"ON"],[127136,127150,"ON"],[127153,127167,"ON"],[127169,127183,"ON"],[127185,127221,"ON"],[127232,127242,"EN"],[127243,127247,"ON"],[127279,127279,"ON"],[127338,127343,"ON"],[127405,127405,"ON"],[127584,127589,"ON"],[127744,128728,"ON"],[128732,128748,"ON"],[128752,128764,"ON"],[128768,128985,"ON"],[128992,129003,"ON"],[129008,129008,"ON"],[129024,129035,"ON"],[129040,129095,"ON"],[129104,129113,"ON"],[129120,129159,"ON"],[129168,129197,"ON"],[129200,129211,"ON"],[129216,129217,"ON"],[129232,129240,"ON"],[129280,129623,"ON"],[129632,129645,"ON"],[129648,129660,"ON"],[129664,129674,"ON"],[129678,129734,"ON"],[129736,129736,"ON"],[129741,129756,"ON"],[129759,129770,"ON"],[129775,129784,"ON"],[129792,129938,"ON"],[129940,130031,"ON"],[130032,130041,"EN"],[130042,130042,"ON"],[131070,131071,"BN"],[196606,196607,"BN"],[262142,262143,"BN"],[327678,327679,"BN"],[393214,393215,"BN"],[458750,458751,"BN"],[524286,524287,"BN"],[589822,589823,"BN"],[655358,655359,"BN"],[720894,720895,"BN"],[786430,786431,"BN"],[851966,851967,"BN"],[917502,917759,"BN"],[917760,917999,"NSM"],[918e3,921599,"BN"],[983038,983039,"BN"],[1048574,1048575,"BN"],[1114110,1114111,"BN"]];function xy(e){if(e<=255)return Vf[e];let t=0,n=ss.length-1;for(;t<=n;){let r=t+n>>1,i=ss[r];if(ei[1]){t=r+1;continue}return i[2]}return"L"}function yy(e){let t=e.length;if(t===0)return null;let n=new Array(t),r=!1;for(let u=0;u=55296&&c<=56319&&u+1=56320&&b<=57343&&(f=(c-55296<<10)+(b-56320)+65536,m=2)}let p=xy(f);(p==="R"||p==="AL"||p==="AN")&&(r=!0);for(let b=0;b=0&&n[c]==="ET";c--)n[c]="EN";for(c=u+1;c0?n[u-1]:l,m=c0&&t.charCodeAt(t.length-1)===32&&(t=t.slice(0,-1)),t}function wy(e){return/[\\r\\f]/.test(e)?e.replace(/\\r\\n/g,`\n`).replace(/[\\r\\f]/g,`\n`):e.replace(/\\r\\n/g,`\n`)}var ls=null,Cy;function _y(){return ls===null&&(ls=new Intl.Segmenter(Cy,{granularity:"word"})),ls}var Ty=/\\p{Script=Arabic}/u,Mi=/\\p{M}/u,Qf=/\\p{Nd}/u;function qf(e){return Ty.test(e)}function $f(e){return e>=19968&&e<=40959||e>=13312&&e<=19903||e>=131072&&e<=173791||e>=173824&&e<=177983||e>=177984&&e<=178207||e>=178208&&e<=183983||e>=183984&&e<=191471||e>=191472&&e<=192093||e>=194560&&e<=195103||e>=196608&&e<=201551||e>=201552&&e<=205743||e>=205744&&e<=210041||e>=63744&&e<=64255||e>=12288&&e<=12351||e>=12352&&e<=12447||e>=12448&&e<=12543||e>=44032&&e<=55215||e>=65280&&e<=65519}function Ve(e){for(let t=0;t=55296&&n<=56319&&t+1=56320&&r<=57343){let i=(n-55296<<10)+(r-56320)+65536;if($f(i))return!0;t++;continue}}if($f(n))return!0}}return!1}function Ry(e){let t=Li(e);return t!==null&&(Ni.has(t)||vt.has(t))}var ky=new Set(["\\xA0","\\u202F","\\u2060","\\uFEFF"]);function My(e){return Ve(e)}function Fy(e){let t=Li(e);return t!==null&&ky.has(t)}function Fi(e){return!Ry(e)&&!Fy(e)}var Ni=new Set(["\\uFF0C","\\uFF0E","\\uFF01","\\uFF1A","\\uFF1B","\\uFF1F","\\u3001","\\u3002","\\u30FB","\\uFF09","\\u3015","\\u3009","\\u300B","\\u300D","\\u300F","\\u3011","\\u3017","\\u3019","\\u301B","\\u30FC","\\u3005","\\u303B","\\u309D","\\u309E","\\u30FD","\\u30FE"]),hr=new Set([\'"\',"(","[","{","\\u201C","\\u2018","\\xAB","\\u2039","\\uFF08","\\u3014","\\u3008","\\u300A","\\u300C","\\u300E","\\u3010","\\u3016","\\u3018","\\u301A"]),cs=new Set(["\'","\\u2019"]),vt=new Set([".",",","!","?",":",";","\\u060C","\\u061B","\\u061F","\\u0964","\\u0965","\\u104A","\\u104B","\\u104C","\\u104D","\\u104F",")","]","}","%",\'"\',"\\u201D","\\u2019","\\xBB","\\u203A","\\u2026"]),Ny=new Set([":",".","\\u060C","\\u061B"]),Ly=new Set(["\\u104F"]),Dy=new Set(["\\u201D","\\u2019","\\xBB","\\u203A","\\u300D","\\u300F","\\u3011","\\u300B","\\u3009","\\u3015","\\uFF09"]);function Iy(e){if(ds(e))return!0;let t=!1;for(let n of e){if(vt.has(n)){t=!0;continue}if(!(t&&Mi.test(n)))return!1}return t}function Py(e){for(let t of e)if(!Ni.has(t)&&!vt.has(t))return!1;return e.length>0}function Oy(e){if(ds(e))return!0;for(let t of e)if(!hr.has(t)&&!cs.has(t)&&!Mi.test(t))return!1;return e.length>0}function ds(e){let t=!1;for(let n of e)if(!(n==="\\\\"||Mi.test(n))){if(hr.has(n)||vt.has(n)||cs.has(n)){t=!0;continue}return!1}return t}function Zf(e,t){let n=t-1;if(n<=0)return Math.max(n,0);let r=e.charCodeAt(n);if(r<56320||r>57343)return n;let i=n-1;if(i<0)return n;let o=e.charCodeAt(i);return o>=55296&&o<=56319?i:n}function Li(e){if(e.length===0)return null;let t=Zf(e,e.length);return e.slice(t)}function Hy(e){let t=Array.from(e),n=t.length;for(;n>0;){let r=t[n-1];if(Mi.test(r)){n--;continue}if(hr.has(r)||cs.has(r)){n--;continue}break}return n<=0||n===t.length?null:{head:t.slice(0,n).join(""),tail:t.slice(n).join("")}}function Gy(e,t,n){return n==="text"&&!t&&e.length===1&&e!=="-"&&e!=="\\u2014"?e:null}function jf(e,t,n,r){let i=t[r],o=e[r];if(i==null)return o;let a=n[r];if(o.length===a)return o;let l=i.repeat(a);return e[r]=l,l}function Kf(e,t){return e&&t!==null&&Ny.has(t)}function By(e){let t=Li(e);return t!==null&&Ly.has(t)}function Uy(e){if(e.length<2||e[0]!==" ")return null;let t=e.slice(1);return/^\\p{M}+$/u.test(t)?{space:" ",marks:t}:null}function Di(e){let t=e.length;for(;t>0;){let n=Zf(e,t),r=e.slice(n,t);if(Dy.has(r))return!0;if(!vt.has(r))return!1;t=n}return!1}function Wy(e,t){if(t.preserveOrdinarySpaces||t.preserveHardBreaks){if(e===" ")return"preserved-space";if(e===" ")return"tab";if(t.preserveHardBreaks&&e===`\n`)return"hard-break"}return e===" "?"space":e==="\\xA0"||e==="\\u202F"||e==="\\u2060"||e==="\\uFEFF"?"glue":e==="\\u200B"?"zero-width-break":e==="\\xAD"?"soft-hyphen":"text"}var Vy=/[\\x20\\t\\n\\xA0\\xAD\\u200B\\u202F\\u2060\\uFEFF]/;function Ie(e){return e.length===1?e[0]:e.join("")}function zy(e,t){let n=[];for(let r=e.length-1;r>=0;r--)n.push(e[r]);return n.push(t),Ie(n)}function qy(e,t,n,r){if(!Vy.test(e))return[{text:e,isWordLike:t,kind:"text",start:n}];let i=[],o=null,a=[],l=n,s=!1,u=0;for(let c of e){let f=Wy(c,r),m=f==="text"&&t;if(o!==null&&f===o&&m===s){a.push(c),u+=c.length;continue}o!==null&&i.push({text:Ie(a),isWordLike:s,kind:o,start:l}),o=f,a=[c],l=n+u,s=m,u+=c.length}return o!==null&&i.push({text:Ie(a),isWordLike:s,kind:o,start:l}),i}function us(e){return e==="space"||e==="preserved-space"||e==="zero-width-break"||e==="hard-break"}var $y=/^[A-Za-z][A-Za-z0-9+.-]*:$/;function jy(e,t){let n=e.texts[t];return n.startsWith("www.")?!0:$y.test(n)&&t+1=e.len||us(e.kinds[l]))continue;let s=[],u=e.starts[l],c=l;for(;c0&&(t.push(Ie(s)),n.push(!0),r.push("text"),i.push(u),o=c-1)}return{len:t.length,texts:t,isWordLike:n,kinds:r,starts:i}}var Jy=new Set([":","-","/","\\xD7",",",".","+","\\u2013","\\u2014"]),Yf=/^[A-Za-z0-9_]+[,:;]*$/,Xf=/[,:;]+$/;function em(e){for(let t of e)if(Qf.test(t))return!0;return!1}function pr(e){if(e.length===0)return!1;for(let t of e)if(!(Qf.test(t)||Jy.has(t)))return!1;return!0}function Qy(e){let t=[],n=[],r=[],i=[];for(let o=0;o1;for(let u=0;u0&&s[k]==="text"&&F&&m[k]&&b[k]||A&&i>0&&s[k]==="text"&&Py(S.text)&&m[k]||A&&i>0&&s[k]==="text"&&v[k]?U():A&&i>0&&s[k]==="text"&&S.isWordLike&&I&&x[k]?(U(),l[k]=!0):C!==null&&i>0&&s[k]==="text"&&c[k]===C?f[k]=(f[k]??1)+1:A&&!S.isWordLike&&i>0&&s[k]==="text"&&(Iy(S.text)||S.text==="-"&&l[k])?U():(o[i]=S.text,a[i]=[S.text],l[i]=S.isWordLike,s[i]=S.kind,u[i]=S.start,c[i]=C,f[i]=C===null?0:1,m[i]=F,p[i]=I,b[i]=W,v[i]=Y,x[i]=Kf(I,q),i++)}for(let E=0;Enull),R=-1;for(let E=i-1;E>=0;E--){let S=o[E];if(S.length!==0){if(s[E]==="text"&&!l[E]&&Oy(S)&&R>=0&&s[R]==="text"){let A=_[R]??[];A.push(S),_[R]=A,u[R]=u[E],o[E]="";continue}R=E}}for(let E=0;E"u")return un={lineFitEpsilon:.005,carryCJKAfterClosingQuote:!1,preferPrefixWidthsForBreakableRuns:!1,preferEarlySoftHyphenBreak:!1},un;let e=navigator.userAgent,n=navigator.vendor==="Apple Computer, Inc."&&e.includes("Safari/")&&!e.includes("Chrome/")&&!e.includes("Chromium/")&&!e.includes("CriOS/")&&!e.includes("FxiOS/")&&!e.includes("EdgiOS/"),r=e.includes("Chrome/")||e.includes("Chromium/")||e.includes("CriOS/")||e.includes("Edg/");return un={lineFitEpsilon:n?1/64:.005,carryCJKAfterClosingQuote:r,preferPrefixWidthsForBreakableRuns:n,preferEarlySoftHyphenBreak:n},un}function u1(e){let t=e.match(/(\\d+(?:\\.\\d+)?)\\s*px/);return t?parseFloat(t[1]):16}function im(){return fs===null&&(fs=new Intl.Segmenter(void 0,{granularity:"grapheme"})),fs}function c1(e){return a1.test(e)||e.includes("\\uFE0F")}function om(e){return s1.test(e)}function d1(e,t){let n=rm.get(e);if(n!==void 0)return n;let r=ms();r.font=e;let i=r.measureText("\\u{1F600}").width;if(n=0,i>t+.5&&typeof document<"u"&&document.body!==null){let o=document.createElement("span");o.style.font=e,o.style.display="inline-block",o.style.visibility="hidden",o.style.position="absolute",o.textContent="\\u{1F600}",document.body.appendChild(o);let a=o.getBoundingClientRect().width;document.body.removeChild(o),i-a>.5&&(n=i-a)}return rm.set(e,n),n}function f1(e){let t=0,n=im();for(let r of n.segment(e))c1(r.segment)&&t++;return t}function m1(e,t){return t.emojiCount===void 0&&(t.emojiCount=f1(e)),t.emojiCount}function St(e,t,n){return n===0?t.width:t.width-m1(e,t)*n}function am(e,t,n,r,i){if(t.breakableFitAdvances!==void 0)return t.breakableFitAdvances;let o=im(),a=[];for(let c of o.segment(e))a.push(c.segment);if(a.length<=1)return t.breakableFitAdvances=null,t.breakableFitAdvances;if(i==="sum-graphemes"){let c=[];for(let f of a){let m=at(f,n);c.push(St(f,m,r))}return t.breakableFitAdvances=c,t.breakableFitAdvances}if(i==="pair-context"||a.length>o1){let c=[],f=null,m=0;for(let p of a){let b=at(p,n),v=St(p,b,r);if(f===null)c.push(v);else{let x=f+p,_=at(x,n);c.push(St(x,_,r)-m)}f=p,m=v}return t.breakableFitAdvances=c,t.breakableFitAdvances}let l=[],s="",u=0;for(let c of a){s+=c;let f=at(s,n),m=St(s,f,r);l.push(m-u),u=m}return t.breakableFitAdvances=l,t.breakableFitAdvances}function sm(e,t){let n=ms();n.font=e;let r=l1(e),i=u1(e),o=t?d1(e,i):0;return{cache:r,fontSize:i,emojiCorrection:o}}function p1(e,t){for(;tn+r)break;a=l,o++}return{fitCount:o,fittedWidth:a}}function h1(e,t){let n=0,r=e.chunks.length;for(;n0)return t;let i=e.chunks[t];if(i.startSegmentIndex===i.endSegmentIndex&&r===i.startSegmentIndex)return n.segmentIndex=r,n.graphemeIndex=0,t;for(r=e.widths.length?-1:(n.segmentIndex=i.consumedEndSegmentIndex,n.graphemeIndex=0,t+1)}function dm(e,t){if(t.segmentIndex>=e.widths.length)return-1;let n=h1(e,t.segmentIndex);return n<0?-1:cm(e,n,t)}function g1(e,t,n){if(n.segmentIndex>=e.widths.length)return-1;let r=t;for(;r=e.chunks[r].consumedEndSegmentIndex;)r++;return r>=e.chunks.length?-1:cm(e,r,n)}function fm(e,t){return e.simpleLineWalkFastPath?mm(e,t):ps(e,t)}function mm(e,t,n){let{widths:r,kinds:i,breakableFitAdvances:o}=e;if(r.length===0)return 0;let l=At().lineFitEpsilon,s=t+l,u=0,c=0,f=!1,m=0,p=0,b=0,v=0,x=-1,_=0;function R(){x=-1,_=0}function T(C=b,F=v,I=c){u++,n?.({startSegmentIndex:m,startGraphemeIndex:p,endSegmentIndex:C,endGraphemeIndex:F,width:I}),c=0,f=!1,R()}function M(C,F){f=!0,m=C,p=0,b=C+1,v=0,c=F}function D(C,F,I){f=!0,m=C,p=F,b=C,v=F+1,c=I}function E(C,F){if(!f){M(C,F);return}c+=F,b=C+1,v=0}function S(C,F){let I=o[C];for(let q=F;qs?(T(),D(C,q,W)):(c+=W,b=C,v=q+1):D(C,q,W)}f&&b===C&&v===I.length&&(b=C+1,v=0)}let A=0;for(;A=r.length));){let C=r[A],F=i[A],I=F==="space"||F==="preserved-space"||F==="tab"||F==="zero-width-break"||F==="soft-hyphen";if(!f){C>t&&o[A]!==null?S(A,0):M(A,C),I&&(x=A+1,_=c-C),A++;continue}if(c+C>s){if(I){E(A,C),T(A+1,0,c-C),A++;continue}if(x>=0){if(b>x||b===x&&v>0){T();continue}T(x,0,_);continue}if(C>t&&o[A]!==null){T(),S(A,0),A++;continue}T();continue}E(A,C),I&&(x=A+1,_=c-C),A++}return f&&T(),u}function ps(e,t,n){if(e.simpleLineWalkFastPath)return mm(e,t,n);let{widths:r,lineEndFitAdvances:i,lineEndPaintAdvances:o,kinds:a,breakableFitAdvances:l,discretionaryHyphenWidth:s,tabStopAdvance:u,chunks:c}=e;if(r.length===0||c.length===0)return 0;let f=At(),m=f.lineFitEpsilon,p=t+m,b=0,v=0,x=!1,_=0,R=0,T=0,M=0,D=-1,E=0,S=0,A=null;function C(){D=-1,E=0,S=0,A=null}function F(P=T,H=M,V=v){b++,n?.({startSegmentIndex:_,startGraphemeIndex:R,endSegmentIndex:P,endGraphemeIndex:H,width:V}),v=0,x=!1,C()}function I(P,H){x=!0,_=P,R=0,T=P+1,M=0,v=H}function q(P,H,V){x=!0,_=P,R=H,T=P,M=H+1,v=V}function W(P,H){if(!x){I(P,H);return}v+=H,T=P+1,M=0}function Y(P,H,V,j){if(!H)return;let we=P==="tab"?0:i[V],z=P==="tab"?j:o[V];D=V+1,E=v-j+we,S=v-j+z,A=P}function k(P,H){let V=l[P];for(let j=H;jp?(F(),q(P,j,we)):(v+=we,T=P,M=j+1):q(P,j,we)}x&&T===P&&M===V.length&&(T=P+1,M=0)}function U(P){if(A!=="soft-hyphen")return!1;let H=l[P];if(H==null)return!1;let{fitCount:V,fittedWidth:j}=um(H,v,t,m,s);return V===0?!1:(v=j,T=P,M=V,C(),V===H.length?(T=P+1,M=0,!0):(F(P,V,j+s),k(P,V),!0))}function ie(P){b++,n?.({startSegmentIndex:P.startSegmentIndex,startGraphemeIndex:0,endSegmentIndex:P.consumedEndSegmentIndex,endGraphemeIndex:0,width:0}),C()}for(let P=0;Pt&&l[V]!==null?k(V,0):I(V,z),Y(j,we,V,z),V++;continue}if(v+z>p){let B=v+(j==="tab"?0:i[V]),ee=v+(j==="tab"?z:o[V]);if(A==="soft-hyphen"&&f.preferEarlySoftHyphenBreak&&E<=p){F(D,0,S);continue}if(A==="soft-hyphen"&&U(V)){V++;continue}if(we&&B<=p){W(V,z),F(V+1,0,ee),V++;continue}if(D>=0&&E<=p){if(T>D||T===D&&M>0){F();continue}let K=D;F(K,0,S),V=K;continue}if(z>t&&l[V]!==null){F(),k(V,0),V++;continue}F();continue}W(V,z),Y(j,we,V,z),V++}if(x){let j=D===H.consumedEndSegmentIndex?S:v;F(H.consumedEndSegmentIndex,0,j)}}return b}function pm(e,t,n,r){let i=e.chunks[n];if(i.startSegmentIndex===i.endSegmentIndex)return t.segmentIndex=i.consumedEndSegmentIndex,t.graphemeIndex=0,0;let{widths:o,lineEndFitAdvances:a,lineEndPaintAdvances:l,kinds:s,breakableFitAdvances:u,discretionaryHyphenWidth:c,tabStopAdvance:f}=e,m=At(),p=m.lineFitEpsilon,b=r+p,v=0,x=!1,_=t.segmentIndex,R=t.graphemeIndex,T=-1,M=0,D=0,E=null;function S(){T=-1,M=0,D=0,E=null}function A(k=_,U=R,ie=v){return x?(t.segmentIndex=k,t.graphemeIndex=U,ie):null}function C(k,U){x=!0,_=k+1,R=0,v=U}function F(k,U,ie){x=!0,_=k,R=U+1,v=ie}function I(k,U){if(!x){C(k,U);return}v+=U,_=k+1,R=0}function q(k,U,ie,P){if(!U)return;let H=k==="tab"?0:a[ie],V=k==="tab"?P:l[ie];T=ie+1,M=v-P+H,D=v-P+V,E=k}function W(k,U){let ie=u[k];for(let P=U;Pb)return A();v+=H,_=k,R=P+1}}return x&&_===k&&R===ie.length&&(_=k+1,R=0),null}function Y(k){if(E!=="soft-hyphen"||T<0)return null;let U=u[k]??null;if(U!==null){let{fitCount:ie,fittedWidth:P}=um(U,v,r,p,c);if(ie===U.length)return v=P,_=k+1,R=0,S(),null;if(ie>0)return A(k,ie,P+c)}return M<=b?A(T,0,D):null}for(let k=t.segmentIndex;k0){let j=W(k,P);if(j!==null)return j}else if(H>r&&u[k]!==null){let j=W(k,0);if(j!==null)return j}else C(k,H);q(U,ie,k,H);continue}if(v+H>b){let j=v+(U==="tab"?0:a[k]),we=v+(U==="tab"?H:l[k]);if(E==="soft-hyphen"&&m.preferEarlySoftHyphenBreak&&M<=b)return A(T,0,D);let z=Y(k);if(z!==null)return z;if(ie&&j<=b)return I(k,H),A(k+1,0,we);if(T>=0&&M<=b)return _>T||_===T&&R>0?A():A(T,0,D);if(H>r&&u[k]!==null){let O=A();if(O!==null)return O;let B=W(k,0);if(B!==null)return B}return A()}I(k,H),q(U,ie,k,H)}return T===i.consumedEndSegmentIndex&&R===0?A(i.consumedEndSegmentIndex,0,D):A(i.consumedEndSegmentIndex,0,v)}function b1(e,t,n){let{widths:r,kinds:i,breakableFitAdvances:o}=e,l=At().lineFitEpsilon,s=n+l,u=0,c=!1,f=t.segmentIndex,m=t.graphemeIndex,p=-1,b=0;for(let v=t.segmentIndex;v0||x>n&&M!==null){let D=M,E=D[T];c=!0,u=E,f=v,m=T+1;for(let S=T+1;Ss)return t.segmentIndex=f,t.graphemeIndex=m,u;u+=A,f=v,m=S+1}f===v&&m===D.length&&(f=v+1,m=0)}else c=!0,u=x,f=v+1,m=0;R&&(p=v+1,b=u-x);continue}if(u+x>s)return R?(t.segmentIndex=v+1,t.graphemeIndex=0,u):p>=0?f>p||f===p&&m>0?(t.segmentIndex=f,t.graphemeIndex=m,u):(t.segmentIndex=p,t.graphemeIndex=0,b):(t.segmentIndex=f,t.graphemeIndex=m,u);u+=x,f=v+1,m=0,R&&(p=v+1,b=u-x)}return c?(t.segmentIndex=f,t.graphemeIndex=m,u):null}function x1(e,t,n){let r=dm(e,t);return r<0?null:e.simpleLineWalkFastPath?b1(e,t,n):pm(e,t,r,n)}function hm(e,t){if(e.widths.length===0)return{lineCount:0,maxLineWidth:0};let n={segmentIndex:0,graphemeIndex:0},r=0,i=0;if(!e.simpleLineWalkFastPath){let o=dm(e,n);for(;o>=0;){let a=pm(e,n,o,t);if(a===null)return{lineCount:r,maxLineWidth:i};r++,a>i&&(i=a),o=g1(e,o,n)}return{lineCount:r,maxLineWidth:i}}for(;;){let o=x1(e,n,t);if(o===null)return{lineCount:r,maxLineWidth:i};r++,o>i&&(i=o)}}var hs=null;function y1(){return hs===null&&(hs=new Intl.Segmenter(void 0,{granularity:"grapheme"})),hs}function v1(e){return e?{widths:[],lineEndFitAdvances:[],lineEndPaintAdvances:[],kinds:[],simpleLineWalkFastPath:!0,segLevels:null,breakableFitAdvances:[],discretionaryHyphenWidth:0,tabStopAdvance:0,chunks:[],segments:[]}:{widths:[],lineEndFitAdvances:[],lineEndPaintAdvances:[],kinds:[],simpleLineWalkFastPath:!0,segLevels:null,breakableFitAdvances:[],discretionaryHyphenWidth:0,tabStopAdvance:0,chunks:[]}}function S1(e,t){let n=[],r=[],i=0,o=!1,a=!1,l=!1;function s(){r.length!==0&&(n.push({text:r.length===1?r[0]:r.join(""),start:i}),r=[],o=!1,a=!1,l=!1)}function u(f,m,p){r=[f],i=m,o=p,a=Di(f),l=hr.has(f)}function c(f,m){r.push(f),o=o||m;let p=Di(f);f.length===1&&vt.has(f)?a=a||p:a=p,l=!1}for(let f of y1().segment(e)){let m=f.segment,p=Ve(m);if(r.length===0){u(m,f.index,p);continue}if(l||Ni.has(m)||vt.has(m)||t.carryCJKAfterClosingQuote&&p&&a){c(m,p);continue}if(!o&&!p){c(m,p);continue}s(),u(m,f.index,p)}return s(),n}function A1(e){if(e.length<=1)return e;let t=[],n=[e[0].text],r=e[0].start,i=Ve(e[0].text),o=Fi(e[0].text);function a(){t.push({text:n.length===1?n[0]:n.join(""),start:r})}for(let l=1;l1){let U="sum-graphemes";pr(S)?U="pair-context":i.preferPrefixWidthsForBreakableRuns&&(U="segment-prefixes");let ie=am(S,q,o,a,U);T(S,W,Y,k,A,C,ie);return}T(S,W,Y,k,A,C,null)}for(let S=0;S{n(C1(r))})}function xm(e,t){return hm(e,t)}function ym(e){let t=0;return _1(e,Number.POSITIVE_INFINITY,n=>{n.width>t&&(t=n.width)}),t}var T1={maxWidth:1600,baseFontSize:78,minFontSize:42,fontWeight:900,fontFamily:"Outfit",step:2};function vm(e,t){let n={...T1,...t},r=1.2;for(let i=n.baseFontSize;i>=n.minFontSize;i-=n.step){let o=`${n.fontWeight} ${i}px ${n.fontFamily}`,a=Ii(e,o),{lineCount:l}=Pi(a,n.maxWidth,i*r);if(l<=1)return{fontSize:i,fits:!0}}return{fontSize:n.minFontSize,fits:!1}}var Sm={prepare:Ii,layout:Pi,prepareWithSegments:bm,measureLineStats:xm,measureNaturalWidth:ym};window.__timelines=window.__timelines||{};Od();window.__hyperframes={fitTextFontSize:vm,getVariables:qs,pretext:Sm,registerRuntimeDataHandler:Bf,setRuntimeData:Ri,clearRuntimeData:ki};function Am(){let e=window;e.__hyperframeRuntimeBootstrapped||(e.__hyperframeRuntimeBootstrapped=!0,Wf())}document.readyState==="loading"?document.addEventListener("DOMContentLoaded",Am,{once:!0}):Am();})();\n'; } }); @@ -109952,6 +109952,7 @@ function affectsProjectSignature(projectDir, changedPath) { return false; } const segments = relativePath.split(sep7); + if (segments[0] === ".croco") return false; if (STUDIO_SIGNATURE_MANIFEST_PATHS.includes(segments.join("/"))) return true; return !segments.some((segment) => SIGNATURE_EXCLUDED_DIRS.has(segment)); } @@ -109970,6 +109971,7 @@ function collectProjectSignatureFiles(projectDir, dir, files) { return; } for (const entry of entries2) { + if (dir === projectDir && entry === ".croco") continue; if (SIGNATURE_EXCLUDED_DIRS.has(entry)) continue; const file = resolve22(dir, entry); if (!isPathWithin(projectDir, file)) continue; @@ -114622,13 +114624,24 @@ import { join as join35 } from "path"; function shouldWatchProjectFile(filename) { if (!filename) return false; const parts = filename.split(/[\\/]+/); + if (parts[0] === ".croco") return false; return !parts.some((part) => WATCHER_EXCLUDED_DIRS.has(part)); } function createProjectWatcher(projectDir) { const listeners = /* @__PURE__ */ new Set(); const pendingPaths = /* @__PURE__ */ new Set(); let debounceTimer = null; + let flushHandle = null; let watcher = null; + const flushNext = () => { + flushHandle = null; + if (!watcher) return; + const nextPath = pendingPaths.values().next(); + if (nextPath.done) return; + pendingPaths.delete(nextPath.value); + for (const fn of listeners) fn(nextPath.value); + if (pendingPaths.size) flushHandle = setImmediate(flushNext); + }; try { watcher = watch(projectDir, { recursive: true }, (_event, filename) => { if (!filename) return; @@ -114637,16 +114650,11 @@ function createProjectWatcher(projectDir) { return; } pendingPaths.add(relativePath); + if (flushHandle !== null) return; if (debounceTimer) clearTimeout(debounceTimer); debounceTimer = setTimeout(() => { - const changedPaths = [...pendingPaths]; - pendingPaths.clear(); debounceTimer = null; - for (const changedPath of changedPaths) { - for (const fn of listeners) { - fn(changedPath); - } - } + flushNext(); }, DEBOUNCE_MS); }); watcher.on("error", () => { @@ -114664,8 +114672,10 @@ function createProjectWatcher(projectDir) { }, close() { if (debounceTimer) clearTimeout(debounceTimer); + if (flushHandle !== null) clearImmediate(flushHandle); pendingPaths.clear(); watcher?.close(); + watcher = null; listeners.clear(); } }; @@ -116899,6 +116909,13 @@ function projectBrowserEndToCompositionTimeline(existingStart, browserStart, bro return browserEnd + (existingStart - browserStart); } function resolveDeviceScaleFactor(input2) { + if (process.env.CROCO_EXPORT_CAPTURE_SCALE !== void 0) { + const scale = Number(process.env.CROCO_EXPORT_CAPTURE_SCALE); + if (!Number.isInteger(scale) || scale < 1 || scale > 8 || input2.outputResolution || input2.hdrRequested) { + throw new Error("Invalid Croco export capture scale or incompatible render mode"); + } + return scale; + } if (!input2.outputResolution) return 1; const compat = checkOutputResolutionCompatibility({ compositionWidth: input2.compositionWidth, @@ -137089,6 +137106,28 @@ function rewriteWrittenToHostViewport(projectDir, written) { writeFileSync27(absPath, content, "utf-8"); } } +function createStudioFileChangeReader(projectDir) { + let cached = null; + return { + invalidate() { cached = null; }, + read(changedPath) { + if (cached?.path === changedPath) return cached.data; + const absPath = resolve38(projectDir, changedPath); + let receipt = null; + try { + const stat = lstatSync4(absPath); + if (stat.isFile() && !stat.isSymbolicLink() && isTextContentEligible(absPath, stat.size)) { + receipt = consumeFileWriteReceipt(absPath, fileContentVersion(readFileSync43(absPath, "utf-8"))); + } + } catch { + // Removed or unreadable files still invalidate the browser's resource list. + } + const data = JSON.stringify(receipt ?? { path: changedPath }); + cached = { path: changedPath, data }; + return data; + } + }; +} function createStudioServer(options) { const { projectDir, projectName } = options; const projectId = projectName || basename11(projectDir); @@ -137096,9 +137135,11 @@ function createStudioServer(options) { const studioDir = resolveDistDir(); const runtimePath = resolveRuntimePath(); const watcher = createProjectWatcher(projectDir); + const fileChanges = createStudioFileChangeReader(projectDir); const project = { id: projectId, dir: projectDir, title: projectId }; let cachedProjectSignature = null; watcher.addListener((changedPath) => { + fileChanges.invalidate(); if (affectsProjectSignature(projectDir, join80(projectDir, changedPath))) { cachedProjectSignature = null; } @@ -137414,22 +137455,25 @@ function createStudioServer(options) { }); app.get("/api/events", (c3) => { return streamSSE4(c3, async (stream) => { - const listener = (path2) => { - const absPath = resolve38(projectDir, path2); - let version2 = null; - try { - version2 = fileContentVersion(readFileSync43(absPath, "utf-8")); - } catch { - } - const receipt = version2 ? consumeFileWriteReceipt(absPath, version2) : null; - stream.writeSSE({ event: "file-change", data: JSON.stringify(receipt ?? { path: path2 }) }).catch(() => { - }); + let resolveClosed; + const closed = new Promise((resolve) => { resolveClosed = resolve; }); + const cleanup = () => { + watcher.removeListener(listener); + resolveClosed(); }; - watcher.addListener((changedPath) => { - if (shouldWatchProjectFile(changedPath)) listener(changedPath); - }); - while (true) { - await stream.sleep(3e4); + const listener = (changedPath) => { + if (stream.aborted) return cleanup(); + if (!shouldWatchProjectFile(changedPath)) return; + stream.writeSSE({ event: "file-change", data: fileChanges.read(changedPath) }).catch(cleanup); + }; + stream.onAbort(cleanup); + try { + if (!stream.aborted) { + watcher.addListener(listener); + await closed; + } + } finally { + cleanup(); } }); }); diff --git a/dist/hyperframe-runtime.js b/dist/hyperframe-runtime.js index d3b084c4768ab07fb79dbd03e720ff77c6744126..0a337c2c4641c81559e1a756f85f69b8b6208f6f 100644 --- a/dist/hyperframe-runtime.js +++ b/dist/hyperframe-runtime.js @@ -701,7 +701,7 @@ class HfPitchshift extends AudioWorkletProcessor { } } registerProcessor("hf-pitchshift", HfPitchshift); -`,$a=new WeakMap;function ja(e){return lf.has(e)}var lf=new WeakSet;function Ka(e){let t=$a.get(e);return t||(t=(async()=>{if(!e.audioWorklet)throw new Error("AudioWorklet is unavailable \u2014 the page needs a secure context (https, localhost or file://)");let n=`data:text/javascript;base64,${btoa(String.fromCharCode(...new TextEncoder().encode(Ox)))}`;await e.audioWorklet.addModule(n),lf.add(e)})().catch(n=>{throw $a.delete(e),n}),$a.set(e,t)),t}function Hx(e,t,n){let r=.6+Math.max(0,Math.min(1,t))*2.6,i=Math.max(1,Math.floor(e*r)),o=new Float32Array(i),a=Math.round(t*1e3)*2654435761+Math.round(n*1e3)*40503>>>0,l=()=>(a=a*1664525+1013904223>>>0,a/4294967295*2-1),s=Math.max(.001,1-Math.max(0,Math.min(1,n))),u=0,c=0;for(let m=0;m0)for(let m=0;mtypeof e=="number"?e:Number(e??0),Ya=e=>e/1e3;function ff(e,t,n,r){let i=Math.max(1,Math.round(e.sampleRate)),o=e.createBuffer(1,i,e.sampleRate),a=o.getChannelData(0);for(let u=0;u1-n}]}function pf(e,t,n){e.gain.value=n,t.gain.value=1-n}function Ja(e,t,n){return{input:e,output:e,update:t,automation:n,dispose:()=>e.disconnect()}}var Gx=new Set(["peaking","highpass","lowpass"]),uf=e=>Math.pow(10,e/20),Bx=(e,t)=>{let n=e.createGain(),r=i=>{n.gain.value=uf(de(i.gain))};return r(t),Ja(n,r,{gain:[{param:n.gain,map:uf}]})};function ur(e,t){return(n,r)=>{let i=n.createBiquadFilter();i.type=e;let o=a=>{i.frequency.value=de(a.frequency),a.q!==void 0&&(i.Q.value=de(a.q)),t&&(i.gain.value=de(a.gain))};return o(r),Ja(i,o,{frequency:[{param:i.frequency}],...Gx.has(e)?{q:[{param:i.Q}]}:{},...t?{gain:[{param:i.gain}]}:{}})}}function Ux(e){return(t,n)=>{let r=Math.tan(Math.PI*de(n.frequency)/t.sampleRate),i=e==="highpass"?t.createIIRFilter([1/(1+r),-1/(1+r)],[1,(r-1)/(r+1)]):t.createIIRFilter([r/(1+r),r/(1+r)],[1,(r-1)/(r+1)]);return Ja(i,()=>{})}}function cr(e){return(t,n)=>{let r=new AudioWorkletNode(t,e,{processorOptions:{...n}});return{input:r,output:r,update:i=>r.port.postMessage({...i}),dispose:()=>{r.port.postMessage({__hfDispose:!0}),r.disconnect()}}}}var Wx={tanh:Math.tanh,atan:e=>2/Math.PI*Math.atan(Math.PI/2*e),cubic:e=>Math.abs(e)>=1?Math.sign(e):e-e**3/3,exp:e=>Math.sign(e)*(1-Math.exp(-Math.abs(e))),alg:e=>e/Math.sqrt(1+e*e),quintic:e=>Math.abs(e)>=1?Math.sign(e):e-e**5/5,sin:e=>Math.abs(e)>=1?Math.sign(e):Math.sin(Math.PI/2*e),erf:e=>Math.tanh(1.20211*e),hard:e=>Math.max(-1,Math.min(1,e))},Vx=(e,t)=>{let n=e.createWaveShaper(),r=e.createGain(),i=e.createGain();r.connect(n).connect(i);let o=a=>{let l=Wx[String(a.type)]??Math.tanh,s=Math.pow(10,de(a.threshold)/20),u=8192,c=new Float32Array(u);for(let f=0;f=4?"4x":de(a.oversample)>=2?"2x":"none",i.gain.value=Math.pow(10,de(a.output)/20)};return o(t),{input:r,output:i,update:o,automation:{output:[{param:i.gain,map:a=>Math.pow(10,a/20)}]},dispose:()=>{r.disconnect(),n.disconnect(),i.disconnect()}}},zx=(e,t)=>{let n=e.createGain(),r=e.createGain(),i=e.createDelay(5),o=e.createGain(),a=e.createGain(),l=e.createGain();n.connect(i),i.connect(o),o.connect(i),i.connect(a).connect(r),n.connect(l).connect(r);let s=u=>{i.delayTime.value=Math.min(5,de(u.time)/1e3),o.gain.value=de(u.feedback),pf(a,l,de(u.mix))};return s(t),{input:n,output:r,update:s,automation:{time:[{param:i.delayTime,map:u=>Math.min(5,Ya(u))}],feedback:[{param:o.gain}],mix:Xa(a.gain,l.gain)},dispose:()=>[n,r,i,o,a,l].forEach(u=>u.disconnect())}},qx=(e,t,n)=>{let r=e.createGain(),i=e.createGain(),o=e.createDelay(.5),a=ff(e,"sine",de(t.speed),n),l=e.createGain(),s=e.createGain(),u=e.createGain();a.connect(l).connect(o.delayTime),r.connect(o).connect(s).connect(i),r.connect(u).connect(i);let c=f=>{o.delayTime.value=de(f.delay)/1e3,l.gain.value=de(f.depth)/1e3,a.playbackRate.value=de(f.speed),pf(s,u,de(f.mix))};return c(t),{input:r,output:i,update:c,automation:{delay:[{param:o.delayTime,map:Ya}],depth:[{param:l.gain,map:Ya}],speed:[{param:a.playbackRate}],mix:Xa(s.gain,u.gain)},dispose:()=>{mf(a),[r,i,o,l,s,u].forEach(f=>f.disconnect())}}},$x=6,jx=(e,t,n)=>{let r=e.createGain(),i=e.createGain(),o=e.createGain(),a=e.createGain(),l=ff(e,String(t.type)==="1"?"sine":"triangle",de(t.speed),n),s=e.createGain(),u=e.createGain(),c=e.createGain(),f=[];r.connect(o);let m=o;for(let b=0;b<$x;b++){let v=e.createBiquadFilter();v.type="allpass",v.Q.value=.7071,s.connect(v.frequency),m.connect(v),m=v,f.push(v)}l.connect(s),m.connect(u).connect(a),o.connect(c).connect(a),a.connect(i);let p=b=>{let v=1e3/Math.max(.1,de(b.delay));for(let x of f)x.frequency.value=v;s.gain.value=v*de(b.decay),l.playbackRate.value=de(b.speed),o.gain.value=de(b.in_gain),a.gain.value=de(b.out_gain),u.gain.value=1,c.gain.value=1};return p(t),{input:r,output:i,update:p,automation:{speed:[{param:l.playbackRate}],in_gain:[{param:o.gain}],out_gain:[{param:a.gain}]},dispose:()=>{mf(l),[r,i,o,a,s,u,c,...f].forEach(b=>b.disconnect())}}},Kx=(e,t)=>{let n=e.createGain(),r=e.createGain(),i=e.createConvolver(),o=e.createGain(),a=e.createGain();i.normalize=!1,n.connect(i).connect(o).connect(r),n.connect(a).connect(r);let l="",s=u=>{let c=`${de(u.size)}:${de(u.damping)}`;if(c!==l){let f=Hx(e.sampleRate,de(u.size),de(u.damping)),m=e.createBuffer(1,f.length,e.sampleRate);m.getChannelData(0).set(f),i.buffer=m,l=c}o.gain.value=de(u.wet),a.gain.value=de(u.dry)};return s(t),{input:n,output:r,update:s,automation:{wet:[{param:o.gain}],dry:[{param:a.gain}]},dispose:()=>[n,r,i,o,a].forEach(u=>u.disconnect())}},Yx={"gain-node":Bx,"biquad-peaking":ur("peaking",!0),"biquad-lowshelf":ur("lowshelf",!0),"biquad-highshelf":ur("highshelf",!0),"biquad-highpass":ur("highpass",!1),"biquad-lowpass":ur("lowpass",!1),"worklet-compressor":cr("hf-compressor"),"worklet-limiter":cr("hf-limiter"),"worklet-gate":cr("hf-gate"),"worklet-bitcrush":cr("hf-bitcrush"),"worklet-pitchshift":cr("hf-pitchshift"),waveshaper:Vx,"delay-feedback":zx,"chorus-lfo":qx,"allpass-phaser":jx,convolver:Kx};function hf(e){return e.nodes.some(t=>Sn(t.type)?.web.startsWith("worklet-")??!1)}function Xx(e,t,n,r=0){let i=Sn(t);if(!i)throw new Error(`Unknown effect type: ${t}`);let o=An(t,n);if((t==="highpass"||t==="lowpass")&&String(o.poles)==="1")return Ux(t)(e,o,r);let a=Yx[i.web];if(!a)throw new Error(`No Web Audio builder for ${i.web}`);return a(e,o,r)}function cf(e){let t=[];for(let n of e){let r=n.fromPreset,i=t.at(-1);if(i&&i.preset===r)i.nodes.push(n);else{let o=typeof n.presetAmount=="number"?n.presetAmount:1;t.push({...r?{preset:r}:{},amount:Math.min(1,Math.max(0,o)),nodes:[n]})}}return t}function df(e){return En(e).map(t=>{let n=An(t.type,t.params),r=n.poles!==void 0?`:${n.poles}`:"",i=String(n.poles)==="1"?`@${n.frequency}`:"",o=t.type==="phaser"?`~${n.type}`:"",a=t.fromPreset?`%${t.fromPreset}`:"";return`${t.type}${r}${i}${o}${a}`}).join("|")}function gf(e,t,n=0){var f;let r=e.createGain(),i=e.createGain(),o=[],a=[],l=cf(En(t)),s=r;for(let m of l){let p=null;if(m.preset){let b=e.createGain(),v=e.createGain(),x=e.createGain(),_=e.createGain();x.gain.value=m.amount,v.gain.value=1-m.amount,s.connect(b),b.connect(v).connect(_),p={entry:b,wet:x,dry:v,join:_},s=b}for(let b of m.nodes){let v=Xx(e,b.type,b.params??{},n);s.connect(v.input),s=v.output,o.push({...b.id?{id:b.id}:{},type:b.type,handle:v})}p&&m.preset&&(s.connect(p.wet).connect(p.join),a.push({id:m.preset,...p}),s=p.join)}s.connect(i);let u=df(t),c={};for(let m of a)(c[f=m.id]??(c[f]=[])).push(...Xa(m.wet.gain,m.dry.gain));return{input:r,output:i,presets:c,nodes:o,update(m){if(df(m)!==u)return!1;En(m).forEach((b,v)=>{let x=o[v];x&&(x.handle.update(An(b.type,b.params)),b.id===void 0?delete x.id:x.id=b.id)});let p=0;for(let b of cf(En(m))){if(!b.preset)continue;let v=a[p++];!v||v.id!==b.preset||(v.wet.gain.value=b.amount,v.dry.gain.value=1-b.amount)}return!0},dispose(){for(let{handle:m}of o)m.dispose();for(let{entry:m,wet:p,dry:b,join:v}of a)m.disconnect(),p.disconnect(),b.disconnect(),v.disconnect();r.disconnect(),i.disconnect()}}}var bf={version:1,nodes:[]},xf={version:1,lanes:[]};function yf(e,t){let n=(typeof e.getAttribute=="function"?e.getAttribute(et):null)??"";if(!n)return xf;try{return Fl(Or(n),t)}catch{return xf}}function on(e){let t=(typeof e.getAttribute=="function"?e.getAttribute(Tt):null)??"";if(!t)return{chain:bf,raw:""};try{return{chain:Rl(t),raw:t}}catch{return{chain:bf,raw:""}}}function vf(e){return yf(e,on(e).chain)}function wi(e,t,n,r,i){let{chain:o}=on(t),a=null,l=[],s=!1,u=0,c=()=>{try{a?(n.disconnect(a.input),a.output.disconnect(r),a.dispose()):n.disconnect(r)}catch{}a=null},f=(T,M)=>{if(T.nodes.length===0){n.connect(r);return}if(hf(T)&&!ja(e)){n.connect(r);let D=++u;Ka(e).then(()=>{s||D!==u||x(on(t).chain)}).catch(()=>{});return}try{let D=gf(e,T,M);n.connect(D.input),D.output.connect(r),a=D}catch{n.connect(r)}},m=(T,M)=>{l=M&&a?af(yf(t,T),T,a.nodes,M,a.presets):[]},p=i?{...i}:null;f(o,p?.elapsed??0),m(o,p);let b=()=>{if(!p)return null;let T=typeof e.currentTime=="number"?e.currentTime:p.scheduledAt;return{scheduledAt:T,elapsed:p.elapsed+(T-p.scheduledAt)*p.rate,rate:p.rate}},v=T=>{let M=b();M&&(rn(l,M.scheduledAt),m(T,M))},x=T=>{let M=b();rn(l,M?.scheduledAt??0),c(),f(T,M?.elapsed??0),m(T,M)},_=null,R=t;return typeof MutationObserver<"u"&&typeof R?.nodeType=="number"&&(_=new MutationObserver(()=>{let T=on(t);l.length>0&&lr(l),!a||!a.update(T.chain)?x(T.chain):v(T.chain)}),_.observe(R,{attributes:!0,attributeFilter:[Tt,et]})),{reanchor:T=>{if(s)return;let M=b();M&&rn(l,M.scheduledAt),p={...T},m(on(t).chain,p)},setRate:T=>{let M=b();s||!M||!Number.isFinite(T)||T<=0||T===M.rate||(p={...M,rate:T},rn(l,M.scheduledAt),m(on(t).chain,p))},dispose:()=>{s=!0,_?.disconnect(),l.length>0&&rn(l,typeof e.currentTime=="number"?e.currentTime:0),a?.dispose()}}}var Sf="runtime_web_audio_bypass";function Qa(e,t){return typeof e.getAttribute=="function"?e.getAttribute(t):null}function dr(e,t){return Qa(e,t)!==null}function Jx(e){return dr(e,"crossorigin")?!0:e.crossOrigin!=null}function Qx(e){return typeof e.baseURI=="string"&&e.baseURI?e.baseURI:typeof document<"u"?document.baseURI:""}function Zx(e){let t=typeof e.currentSrc=="string"?e.currentSrc:"";if(t)return[t];let n=Qa(e,"src");if(n)return[n];if(typeof e.querySelectorAll!="function")return[];let r=[];for(let i of Array.from(e.querySelectorAll("source"))){let o=i.getAttribute("src");o&&r.push(o)}return r}function ey(e,t){if(typeof window>"u")return!1;let n;try{n=new URL(e,Qx(t))}catch{return!1}return n.protocol!=="http:"&&n.protocol!=="https:"||n.origin===window.location.origin?!1:!Jx(t)}function Ef(e){return(typeof e.currentSrc=="string"?e.currentSrc:"")?!0:dr(e,"src")}function an(e){for(let t of Zx(e))if(ey(t,e))return{kind:"decode-only",reason:"cross_origin_no_cors",asset:t};return{kind:"web-audio"}}function ty(e){let t=[];dr(e,Tt)&&t.push("fx-chain"),dr(e,et)&&t.push("automation"),dr(e,Gr)&&t.push("audio-group");let n=Number.parseFloat(Qa(e,"data-volume")??"");return Number.isFinite(n)&&n>1&&t.push("above-unity-gain"),t}function ny(){return typeof window<"u"&&!!window.__HF_EXPORT_RENDER_SEEK_CONFIG}var Af=new WeakSet;function sn(e,t){if(t.kind==="web-audio"||ny()||Af.has(e))return;let n=ty(e);Af.add(e);let r={asset:t.asset,reason:t.reason,lostProcessing:n,note:"cross-origin media without a `crossorigin` opt-in is silent through createMediaElementSource (Web Audio spec); using native playback instead"};be({source:"hf-preview",type:"diagnostic",code:Sf,details:r});let i=n.length>0?` Native playback cannot reproduce: ${n.join(", ")} \u2014 proxy or download the asset to a same-origin URL to keep it.`:"";console.info(`[hyperframes] ${Sf}: "${t.asset}" (${t.reason}): Web Audio capture withheld; the track plays through native HTMLMediaElement output.${i}`)}function Za(e){return!Number.isFinite(e)||e<=0?1:e}function wf(e){return Le(e)}function ry(e,t){t||e.paused||!Cr().__hfDebug||console.debug("[hyperframes] webAudioTransport claimed fallback-playing element:",e.currentSrc||e.getAttribute("src")||"")}function iy(e,t){let{elapsed:n,mediaStart:r,scheduledAt:i,globalRate:o,mediaRate:a,clipDuration:l}=t,s=Number.isFinite(l)&&l>0,u=l*a;if(n>=0){let f=n*a,m=u-f;return s&&m<=0?!1:(s?e.start(0,f+r,m):e.start(0,f+r),!0)}let c=-n/o;return s?e.start(i+c,r,u):e.start(i+c,r),!0}function Ci(e,t,n){let r=sf(vf(e));r&&qa([{param:t.gain}],r,Pr.scale,n)}function fr(e){return e.sourceKind==="buffer"}var _i=class{constructor(){ge(this,"_ctx",null);ge(this,"_bufferCache",new Map);ge(this,"_failedSrcs",new Set);ge(this,"_mediaElementSources",new WeakMap);ge(this,"_activeSources",[]);ge(this,"_masterGain",null);ge(this,"_masterVolume",1);ge(this,"_masterMuted",!1);ge(this,"_groups",new Map);ge(this,"_rateAnchorCtx",0);ge(this,"_rateAnchorComp",0);ge(this,"_rate",1);ge(this,"_paused",!0);ge(this,"_playGeneration",0)}async init(){try{return this._ctx=new AudioContext,this._masterGain=this._ctx.createGain(),this._masterGain.connect(this._ctx.destination),this.applyMasterGain(),!0}catch{return!1}}get context(){return this._ctx}getTime(){return!this._ctx||this._paused?-1:this._rateAnchorComp+(this._ctx.currentTime-this._rateAnchorCtx)*this._rate}async decodeAudioElement(t){let n=t.currentSrc||t.getAttribute("src");if(!n)return null;if(this._bufferCache.has(n))return this._bufferCache.get(n);if(this._failedSrcs.has(n)||!this._ctx)return null;let r;try{let i=await fetch(n,{cache:"no-store"});if(!i.ok)return L("webAudioTransport.fetch",new Error(`${i.status} ${n}`)),null;r=await i.arrayBuffer()}catch(i){return L("webAudioTransport.fetch",i),null}try{let i=await this._ctx.decodeAudioData(r);return this._bufferCache.set(n,i),i}catch(i){return this._failedSrcs.add(n),L("webAudioTransport.decode",i),null}}startGeneration(){return this._playGeneration+=1,this._playGeneration}currentGeneration(){return this._playGeneration}acquireMediaElementSource(t){let n=this._mediaElementSources.get(t);if(n){let o=an(t);if(o.kind!=="web-audio"){try{n.disconnect()}catch{}return this._mediaElementSources.delete(t),sn(t,o),null}return n}if(!this._ctx)return null;let r=an(t);if(r.kind!=="web-audio")return sn(t,r),null;let i=this._ctx.createMediaElementSource(t);return this._mediaElementSources.set(t,i),i}async scheduleMediaElementPlayback(t,n,r,i,o,a,l=1){if(!this._ctx||!this._masterGain||a!==this._playGeneration)return null;try{if(this._ctx.state==="suspended"&&await this._ctx.resume(),a!==this._playGeneration)return null;let s=this.acquireMediaElementSource(t);if(!s)return null;let u=Za(l),c=this._ctx.createGain();c.gain.value=o;let f=this._ctx.currentTime,m=i-n,p={scheduledAt:f,elapsed:m,rate:u},b=wi(this._ctx,t,s,c,p);c.connect(this.resolveDestination(t,f,i,u)??this._masterGain),Ci(t,c,p),this._rate=u,this._rateAnchorCtx=f,this._rateAnchorComp=i;let v={fx:b,el:t,sourceNode:s,sourceKind:"media-element",gainNode:c,compositionStart:n,mediaStart:r,scheduledAt:f,priorMuted:t.muted,priorVolume:t.volume,mediaPlaybackRate:_e(t),bounded:!1};return t.volume=1,this._activeSources.push(v),this._paused=!1,v}catch(s){return L("webAudioTransport.mediaElementSource",s),null}}groupInput(t,n,r){let i=this._groups.get(t);if(i){if(i.generation!==this._playGeneration)try{i.reanchor(r),i.generation=this._playGeneration}catch(m){L("webAudioTransport.groupReanchor",m)}return i.input}if(!this._ctx||!this._masterGain)return null;let o=this._ctx.createGain(),a=this._ctx.createGain();a.connect(this._masterGain);let l=()=>po(n,t),s=l(),u=this._ctx.createGain();u.gain.value=s?.hasAttribute("data-hidden")?0:1,u.connect(a);let c=this._ctx.createGain();c.gain.value=wf(mo(s)),c.connect(u);let f=wi(this._ctx,s??{getAttribute:()=>null},o,c,r);return s&&Ci(s,c,r),this._groups.set(t,{input:o,fader:c,muteGain:u,fx:f,generation:this._playGeneration,reanchor:m=>{lr([{param:c.gain}]);let p=l();c.gain.value=wf(mo(p)),u.gain.value=p?.hasAttribute("data-hidden")?0:1,f?.reanchor(m),p&&Ci(p,c,m)},dispose:()=>{try{f?.dispose(),o.disconnect(),c.disconnect(),u.disconnect(),a.disconnect()}catch{}}}),o}setGroupMuted(t,n){let r=this._groups.get(t);if(r)try{r.muteGain.gain.value=n?0:1}catch(i){L("webAudioTransport.setGroupMuted",i)}}resolveDestination(t,n,r,i){if(!this._masterGain)return null;let o=Il(t);if(!o)return this._masterGain;let a={scheduledAt:n,elapsed:r,rate:i};return this.groupInput(o,t.ownerDocument,a)??this._masterGain}handleSourceEnded(t,n,r,i){let o=this._activeSources.indexOf(n);if(o!==-1){this._activeSources.splice(o,1),r.muted=i;try{t.disconnect(),n.fx?.dispose(),n.gainNode.disconnect()}catch{}this._activeSources.length===0&&(this._paused=!0)}}async schedulePlayback(t,n,r,i,o,a,l,s=1,u=Number.POSITIVE_INFINITY){if(!this._ctx||!this._masterGain||l!==this._playGeneration)return null;try{if(this._ctx.state==="suspended"&&await this._ctx.resume(),l!==this._playGeneration)return null;let c=Za(s),f=_e(t),m=c*f,p=this._ctx.createBufferSource();p.buffer=n,p.playbackRate.value=m;let b=this._ctx.createGain();b.gain.value=a;let v=o-r,x=this._ctx.currentTime,_={scheduledAt:x,elapsed:v,rate:c},R=wi(this._ctx,t,p,b,_);if(b.connect(this.resolveDestination(t,x,o,c)??this._masterGain),Ci(t,b,_),this._rate=c,this._rateAnchorCtx=x,this._rateAnchorComp=o,!iy(p,{elapsed:v,mediaStart:i,scheduledAt:x,globalRate:c,mediaRate:f,clipDuration:u}))return p.disconnect(),R?.dispose(),b.disconnect(),null;let T=t.muted;t.muted=!0,ry(t,T);let M={fx:R,el:t,sourceNode:p,sourceKind:"buffer",gainNode:b,compositionStart:r,mediaStart:i,scheduledAt:x,priorMuted:T,priorVolume:t.volume,mediaPlaybackRate:f,bounded:Number.isFinite(u)&&u>0};return this._activeSources.push(M),this._paused=!1,p.addEventListener("ended",()=>this.handleSourceEnded(p,M,t,T)),M}catch(c){return L("webAudioTransport.schedule",c),null}}setRate(t){let n=Za(t);if(n===this._rate)return!1;this._ctx&&!this._paused&&(this._rateAnchorComp=this.getTime(),this._rateAnchorCtx=this._ctx.currentTime),this._rate=n;for(let r of this._activeSources)try{fr(r)&&(r.sourceNode.playbackRate.value=n*r.mediaPlaybackRate),r.fx?.setRate(n)}catch(i){L("webAudioTransport.setRate",i)}for(let r of this._groups.values())try{r.fx?.setRate(n)}catch(i){L("webAudioTransport.setRate.group",i)}return!0}hasBoundedActiveSources(){return this._activeSources.some(t=>fr(t)&&t.bounded)}stopAll(){for(let t of this._activeSources){try{fr(t)&&t.sourceNode.stop(),t.sourceNode.disconnect(),t.fx?.dispose(),t.gainNode.disconnect()}catch{}fr(t)?t.el.muted=t.priorMuted:t.el.volume=t.priorVolume}this._activeSources=[],this._paused=!0}setVolume(t){this._masterVolume=Math.max(0,Math.min(1,t)),this.applyMasterGain()}setElementVolume(t,n){let r=Le(n);for(let i of this._activeSources)if(i.el===t)try{i.sourceKind==="media-element"&&(i.el.volume=1),i.gainNode.gain.value=r}catch(o){L("webAudioTransport.setElementVolume",o)}}setMuted(t){this._masterMuted=t,this.applyMasterGain()}applyMasterGain(){this._masterGain&&(this._masterGain.gain.value=this._masterMuted?0:this._masterVolume)}isActive(){return this._activeSources.length>0&&!this._paused}ownsElement(t){return!this._paused&&this._activeSources.some(n=>n.el===t&&fr(n))}routesElement(t){return!this._paused&&this._activeSources.some(n=>n.el===t)}destroy(){this.stopAll();for(let t of this._groups.values())t.dispose();if(this._groups.clear(),this._bufferCache.clear(),this._failedSrcs.clear(),this._mediaElementSources=new WeakMap,this._ctx)try{this._ctx.close()}catch{}this._ctx=null,this._masterGain=null,this._masterVolume=1,this._masterMuted=!1}};var Cf="data-hf-studio-manual-edit-gesture";function _f(e){return!Number.isInteger(e.tick)||e.tick<=0||e.tick%60!==0?!1:!(e.isPlaying&&e.hasCapturedTimeline&&e.currentTimeSeconds<2)}var oy=/^\s*spring\(\s*([+-]?(?:\d+(?:\.\d*)?|\.\d+))\s*\)\s*$/;function Tf(e){return Math.max(0,Math.min(1,e))}function Rf(e){let t=oy.exec(e);if(!t)return null;let n=Number(t[1]);return Number.isFinite(n)?Tf(n):null}function kf(e,t){if(!Number.isFinite(e))return e;if(e<=0)return 0;if(e>=1)return 1;let n=Tf(t),r=12-n*6,i=Math.PI*2*(1+n*1.5),o=1-Math.exp(-r)*Math.cos(i);return(1-Math.exp(-r*e)*Math.cos(i*e))/o}var ay=/^\s*wiggle\(\s*(\d+)\s*,\s*(easeOut|easeInOut|anticipate|uniform)\s*(?:,\s*([+-]?(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+)?)\s*)?\)\s*$/,sy=Math.PI*2;function ly(e){let t=ay.exec(e);if(!t)return null;let n=Number(t[1]);if(!Number.isSafeInteger(n)||n<1)return null;let r=t[2];if(r!=="easeOut"&&r!=="easeInOut"&&r!=="anticipate"&&r!=="uniform")return null;if(t[3]===void 0)return{wiggles:n,type:r};let i=Number(t[3]);return!Number.isFinite(i)||i<0||i>1?null:{wiggles:n,type:r,amplitude:i}}function uy(e,t,n,r){if(!Number.isFinite(e))return e;if(e<=0)return 0;if(e>=1)return 1;let i=r??(n==="easeInOut"?.08:n==="uniform"?.14:n==="anticipate"?.12:.16),o=n==="easeInOut"?i*Math.sin(Math.PI*e):n==="uniform"?i:i*(1-e);return e+(n==="anticipate"?-1:1)*o*Math.sin(sy*t*e)}function Mf(e,t){let n=ly(e);if(!n)return null;let r=`${n.wiggles}:${n.type}:${n.amplitude??"default"}`,i=t?.get(r);if(i)return i;let o=a=>uy(a,n.wiggles,n.type,n.amplitude);return t?.set(r,o),o}var cy=24,Ff=e=>e>=1?1:0,dy=e=>e,Ti=String.raw`([+-]?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?)`,fy=new RegExp(String.raw`^\s*M\s*0\s*,\s*0\s+C\s*${Ti}\s*,\s*${Ti}\s+${Ti}\s*,\s*${Ti}\s+1\s*,\s*1\s*$`,"i");function Nf(e,t,n){let r=1-e;return 3*r*r*e*t+3*r*e*e*n+e*e*e}function my(e,t,n,r,i){if(!Number.isFinite(e))return e;if(e<=0)return 0;if(e>=1)return 1;let o=0,a=1;for(let l=0;l1?null:a=>my(a,n,r,i,o)}function hy(e,t){if(!e.startsWith("spring("))return null;let n=Rf(e);if(n===null)return null;let r=t.get(n);if(r)return r;let i=o=>kf(o,n);return t.set(n,i),i}function gy(e,t){if(!e.startsWith("custom(")||!e.endsWith(")"))return null;let n=e.slice(7,-1),r=t.get(n);if(r)return r;let i=py(n);return i&&t.set(n,i),i}function Lf(e){if(e.__hfCustomEaseInstalled)return!0;let t=e.parseEase;if(!t)return!1;let n=new Map,r=new Map,i=new Map,o=s=>typeof s!="string"?null:s==="hold"?Ff:Mf(s,i)??hy(s,r)??gy(s,n),a=(s,u,c=[])=>{let f=o(s);return f||(typeof s=="string"&&/^(?:hold|spring|wiggle|custom)(?:\(|$)/.test(s.trim())&&Ne("custom_ease_parse_failed",{ease:s}),t.call(u,s,...c)??dy)};e.parseEase=function(u,...c){return a(u,this,c)};let l=e.registerEase;if(typeof l=="function"){l("hold",Ff);let s=u=>{let c=f=>f;c.config=(...f)=>a(`${u}(${f.join(",")})`,e),l(u,c)};s("spring"),s("wiggle"),s("custom")}return e.__hfCustomEaseInstalled=!0,!0}var ns=new Map,mr=new Map,es=new Map,ts=()=>{},If=()=>{},Df=0;function rs(e){return/^[a-z][a-z0-9-]{0,63}$/.test(e)}function Pf(e){let t=(es.get(e)??0)+1;return es.set(e,t),t}function Of(e){return typeof e=="number"&&Number.isSafeInteger(e)&&e>0?e:(Df-=1,Df)}function is(e,t){let n=mr.get(e);if(!n)return;let r=()=>es.get(e)===t.generation&&mr.get(e)===n;try{Promise.resolve(n(t.payload)).then(()=>{r()&&If(e,t.requestId)},i=>{r()&&ts(e,t.requestId,i)})}catch(i){r()&&ts(e,t.requestId,i)}}function Hf(e){ts=e}function Gf(e){If=e}function Ri(e,t,n){if(!rs(e))return;let r={payload:t,requestId:Of(n),generation:Pf(e)};ns.set(e,r),is(e,r)}function ki(e,t){rs(e)&&(ns.delete(e),is(e,{payload:void 0,requestId:Of(t),generation:Pf(e)}))}function Bf(e,t){if(!rs(e))throw new Error(`Invalid HyperFrames runtime-data channel: ${e}`);mr.set(e,t);let n=ns.get(e);return n&&is(e,n),()=>{mr.get(e)===t&&mr.delete(e)}}var os="data-hf-authored-duration",as="data-hf-authored-end",Uf=!1;function ot(e){if(e){if(typeof e.pause!="function"){Uf||(Uf=!0,Ne("timeline_missing_pause",{}));return}try{e.pause()}catch(t){L("runtime.timeline.pause",t)}}}function by(){let e=window.__HF_EXPORT_RENDER_SEEK_CONFIG,t=e?.fps,n=e?.fpsSource,r=Number(t);return!e||t==null?{fps:null,source:"default",rawFpsSource:n,rawFps:t,fallbackReason:"missing"}:!Number.isFinite(r)||r<=0?{fps:null,source:"default",rawFpsSource:n,rawFps:t,fallbackReason:"invalid"}:{fps:r,source:n==="render-options"||n==="default"?n:"unknown",rawFpsSource:n,rawFps:t,fallbackReason:e.fpsFallbackReason}}function Wf(){let e=Eu(),t=()=>{};Ws(be),Hf((d,g,h)=>{be({source:"hf-preview",type:"runtime-data-error",channel:d,requestId:g,message:h instanceof Error?h.message:String(h)})}),Gf((d,g)=>{try{t()}catch(h){be({source:"hf-preview",type:"runtime-data-error",channel:d,requestId:g,message:h instanceof Error?h.message:String(h)});return}be({source:"hf-preview",type:"runtime-data-applied",channel:d,requestId:g})}),mi(document),La(document),Pl(document);let n=by();e.canonicalFps=n.fps??e.canonicalFps,Bs(e.canonicalFps),window.__HF_EXPORT_RENDER_SEEK_CONFIG&&console.info("[hyperframes] render runtime fps",{canonicalFps:e.canonicalFps,source:n.source,rawFpsSource:n.rawFpsSource,rawFps:n.rawFps,fallbackReason:n.fallbackReason});let r=null,i=null,o=null,a=[],l=new Set,s=null,u=new Set,c=(d,g,h)=>{u.has(d)||(u.add(d),Ne(g,h))};if(typeof window.__hfRuntimeTeardown=="function")try{window.__hfRuntimeTeardown()}catch(d){L("runtime.init.site1",d)}let f=new Ei;e.transportClock=f;let m=new _i,p=!1;m.init().then(d=>{p=d}),window.__hf=window.__hf||{};let b=d=>d.closest("[data-hidden]")!==null||Br(d.ownerDocument,d),v=()=>{let d=window.gsap,g=window;if(!(!d?.registerPlugin||g.__hfAutoNoopRegistered))try{d.registerPlugin({name:"_auto",init:()=>!1}),g.__hfAutoNoopRegistered=!0}catch(h){c("auto_marker_install_failed","auto_marker_install_failed",{reason:"threw"}),L("runtime.autoMarker.install",h)}},x=()=>{let d=window.gsap;if(!d){c("custom_ease_missing_gsap","custom_ease_install_failed",{reason:"missing_gsap"});return}try{Lf(d)||c("custom_ease_no_parse_ease","custom_ease_install_failed",{reason:"no_parseEase"})}catch(g){c("custom_ease_install_threw","custom_ease_install_failed",{reason:"threw"}),L("runtime.customEase.install",g)}};v(),x(),document.documentElement&&(document.documentElement.style.margin="0",document.documentElement.style.padding="0",document.documentElement.style.overflow="hidden"),document.body&&(document.body.style.margin="0",document.body.style.padding="0",document.body.style.overflow="hidden");try{Ys(document)}catch(d){L("runtime.init.cssVariables",d)}window.__timelines=window.__timelines||{};let _=()=>{let d=document.querySelector('[data-composition-id][data-root="true"]');if(d instanceof HTMLElement)return d;let g=Array.from(document.querySelectorAll("[data-composition-id]"));return g.find(h=>!h.parentElement?.closest("[data-composition-id]"))??g[0]??null};if(Array.isArray(window.__timelines)){let d=window.__timelines,g=_()?.getAttribute("data-composition-id")??"root",h={};if(d.length===1)h[g]=d[0];else for(let y=0;y{a.push(d)},M=(d,g,h)=>{let y=h??`${d}:${JSON.stringify(g)}`;l.has(y)||(l.add(y),be({source:"hf-preview",type:"diagnostic",code:d,details:g}))},D=d=>{let g={scale:1,focusX:960,focusY:540},h=[],y=[],w={time:d.getTime(),duration:d.getDuration(),isPlaying:d.isPlaying(),renderMode:!1,timelineDirty:!1};return{play:d.play,pause:d.pause,seek:d.seek,getTime:d.getTime,getDuration:d.getDuration,isPlaying:d.isPlaying,getMainTimeline:()=>null,getElementBounds:()=>{},getElementsAtPoint:()=>{},setElementPosition:()=>{},previewElementPosition:()=>{},setElementKeyframes:()=>{},setElementScale:()=>{},setElementFontSize:()=>{},setElementTextContent:()=>{},setElementTextColor:()=>{},setElementTextShadow:()=>{},setElementTextFontWeight:()=>{},setElementTextFontFamily:()=>{},setElementTextOutline:()=>{},setElementTextHighlight:()=>{},setElementVolume:()=>{},setStageZoom:()=>{},getStageZoom:()=>g,setStageZoomKeyframes:()=>{},getStageZoomKeyframes:()=>h,addElement:()=>!1,removeElement:()=>!1,updateElementTiming:()=>!1,setElementTiming:()=>{},updateElementSrc:()=>!1,updateElementLayer:()=>!1,updateElementBasePosition:()=>!1,markTimelineDirty:()=>{},isTimelineDirty:()=>!1,rebuildTimeline:()=>{},ensureTimeline:()=>{},enableRenderMode:()=>{},disableRenderMode:()=>{},renderSeek:d.renderSeek,getElementVisibility:()=>({visible:!1}),getVisibleElements:()=>y,getRenderState:()=>({...w,time:d.getTime(),duration:d.getDuration(),isPlaying:d.isPlaying()})}},E=1/60,S=.75,A=.05,C=100,F=240,I=d=>{if(d instanceof Error)return d.message||String(d);if(typeof d=="string")return d;try{return JSON.stringify(d)}catch{return String(d??"")}},q=d=>{let g=d.toLowerCase();return g.includes("cannot read properties of null")||g.includes("cannot set properties of null")?{code:"runtime_null_dom_access",category:"dom-null-access"}:g.includes("failed to execute 'queryselector'")?{code:"runtime_invalid_selector",category:"selector-invalid"}:g.includes("is not defined")?{code:"runtime_reference_missing",category:"reference-missing"}:{code:"runtime_script_error",category:"script-error"}},W=d=>{if(d==null||d.trim()==="")return null;let g=Number.parseFloat(d);return!Number.isFinite(g)||g<=0?null:`${g}px`},Y=()=>_(),k=()=>{let d=Y();if(!d)return;let g=W(d.getAttribute("data-width")),h=W(d.getAttribute("data-height"));g&&(d.style.width=g),h&&(d.style.height=h),g&&d.style.setProperty("--comp-width",g),h&&d.style.setProperty("--comp-height",h)},U=()=>{let d=Y(),g=Array.from(document.querySelectorAll("[data-composition-id]")).filter(h=>h.hasAttribute("data-duration")||h.hasAttribute("data-end"));for(let h of g){if(d&&h===d)continue;let y=h.getAttribute("data-duration"),w=h.getAttribute("data-end");y!=null&&!h.hasAttribute(os)&&h.setAttribute(os,y),w!=null&&!h.hasAttribute(as)&&h.setAttribute(as,w),h.removeAttribute("data-duration"),h.removeAttribute("data-end")}},ie=()=>{let d=Y();if(!d)return;d.style.position||(d.style.position="relative"),d.style.overflow="hidden";let g=W(d.getAttribute("data-width")),h=W(d.getAttribute("data-height"));g&&(d.style.width=g),h&&(d.style.height=h);let y=Array.from(d.children);for(let w of y){let N=w.tagName.toLowerCase();if(N==="script"||N==="style"||N==="link"||N==="meta"||!w.hasAttribute("data-start")||w.hasAttribute("data-hf-autostamped"))continue;let G=(w.style.top==="0px"||w.style.top==="0")&&(w.style.left==="0px"||w.style.left==="0")&&w.style.width==="100%"&&w.style.height==="100%",re=/translate\(\s*-50%\s*,\s*-50%\s*\)/.test(w.style.transform);if(G&&re&&!w.hasAttribute("data-width")&&!w.hasAttribute("data-height")){let ne=w.style.top,_t=w.style.left,ye=w.style.width,gn=w.style.height;w.style.top="",w.style.left="",w.style.width="",w.style.height="";let se=window.getComputedStyle(w);se.top!=="auto"||se.bottom!=="auto"||se.left!=="auto"||se.right!=="auto"||se.width!=="0px"||se.height!=="0px"||(w.style.top=ne,w.style.left=_t,w.style.width=ye,w.style.height=gn)}let $=window.getComputedStyle(w),le=$.position;if(le!=="absolute"&&le!=="fixed"&&(w.style.position="absolute"),!!w.style.top||!!w.style.bottom||$.top!=="auto"||$.bottom!=="auto"||(w.style.top="0"),!!w.style.left||!!w.style.right||$.left!=="auto"||$.right!=="auto"||(w.style.left="0"),N!=="audio"){let ne=W(w.getAttribute("data-width")),_t=W(w.getAttribute("data-height")),ye=$.width!=="0px"&&$.width!=="auto",gn=$.height!=="0px"&&$.height!=="auto";ne?!w.style.width&&!ye&&(w.style.width=ne):!w.style.width&&$.width==="0px"&&(w.style.width="100%"),_t?!w.style.height&&!gn&&(w.style.height=_t):!w.style.height&&$.height==="0px"&&(w.style.height="100%")}}},P=(d,g=0,h)=>mt({timelineRegistry:window.__timelines??{},includeAuthoredTimingAttrs:h?.includeAuthoredTimingAttrs??!0}).resolveStartForElement(d,g),H=(d,g)=>mt({timelineRegistry:window.__timelines??{},includeAuthoredTimingAttrs:g?.includeAuthoredTimingAttrs??!0}).resolveDurationForElement(d),V=d=>{let g=d.closest("[data-composition-id]"),h=g?P(g,0):null,y=g?H(g,{includeAuthoredTimingAttrs:!0}):null;return{compositionRoot:g,inheritedStart:h,inheritedDuration:y}},j=d=>{let g=V(d),h=g.inheritedStart??0,y=Gt(d.getAttribute("data-start"));if(d.hasAttribute("data-hf-auto-start")||y==null||h<=0)return P(d,h);let w=g.inheritedDuration,N=w!=null&&w>0?h+w:null;return y>=h&&(N==null||y{window.__hfResolveMediaStartSeconds===j&&delete window.__hfResolveMediaStartSeconds});let we=(d,g)=>{let h=d.tagName.toLowerCase();if(h==="script"||h==="style"||h==="link"||h==="meta")return!1;let w=h==="video"||h==="audio"?j(d):P(d,0),N=H(d),G=d.getAttribute("data-composition-id");if(G){let $=(window.__timelines??{})[G],le=null;if($&&typeof $.duration=="function"){let Me=Number($.duration());Number.isFinite(Me)&&Me>0&&(le=Me)}!(d.hasAttribute("data-duration")||d.hasAttribute("data-end")||d.hasAttribute(os)||d.hasAttribute(as))&&(N==null||N<=0)&&le!=null&&(N=le)}let re=N!=null&&N>0?w+N:Number.POSITIVE_INFINITY;return g>=w&&(Number.isFinite(re)?g{if(!d||typeof d.duration!="function")return null;try{let g=Number(d.duration());return Number.isFinite(g)?Math.max(0,g):null}catch{return null}},K=d=>typeof d=="number"&&Number.isFinite(d)&&d>E,te=d=>{let g=ve(d.getAttribute("data-duration"));return g!=null&&g>0?g:Number.isFinite(d.duration)?Qe(d,d.duration):null},J=()=>{let d=Array.from(document.querySelectorAll("video[data-start], audio[data-start]"));if(d.length===0)return null;let g=0;for(let h of d){let y=j(h);if(!Number.isFinite(y))continue;let w=te(h);w==null||w<=E||(g=Math.max(g,Math.max(0,y)+w))}return g>E?g:null},X=()=>{let d=Y();if(!d)return null;let g=window.__timelines??{},h=mt({timelineRegistry:g,includeAuthoredTimingAttrs:!0}),y=0,w=ve(d.getAttribute("data-duration"));w!=null&&w>0&&(y=w);let N=Array.from(d.querySelectorAll("[data-composition-id][data-start]"));for(let G of N){if(!(G instanceof Element)||G.parentElement?.closest("[data-composition-id]")!==d)continue;let $=h.resolveStartForElement(G,0),le=h.resolveDurationForElement(G);!Number.isFinite($)||le==null||le<=0||(y=Math.max(y,Math.max(0,$)+le))}return y>E?y:null},Pe=()=>{let d=J();return typeof d!="number"||!Number.isFinite(d)||d<=E?null:d},Fe=d=>K(d)?Math.max(E,d*S):E,cn=()=>{let d=0;for(let g of e.deterministicAdapters){let h=g.getInferredDurationSeconds;if(typeof h!="function")continue;let y=null;try{y=h()}catch(w){L("runtime.init.adapterDuration",w)}typeof y=="number"&&Number.isFinite(y)&&y>0&&(d=Math.max(d,y))}return d>E?d:null},Ce=(d,g=0)=>{let h=ee(d),y=Pe(),w=X(),N=cn(),G=Math.max(y??0,w??0,N??0),re=Number.isFinite(g)&&g>E?g:0,$=0;return K(h)?$=Math.max(h,G,re):K(G)?$=Math.max(G,re):$=re,$>0?Math.max(0,$):0},Oi=()=>{let d=window.__timelines??{},g=se=>{let oe=Object.entries(d).filter(ue=>!!ue[1]&&typeof ue[1].play=="function"&&typeof ue[1].pause=="function");if(oe.length!==1)return{timeline:null};let he=oe[0];if(!he)return{timeline:null};let[xe,fe]=he;return{timeline:fe,selectedTimelineIds:[xe],selectedDurationSeconds:ee(fe),diagnostics:{code:"root_timeline_sole_registered_fallback",details:{reason:se,soleTimelineId:xe}}}},h=mt({timelineRegistry:d,includeAuthoredTimingAttrs:!0}),y=Pe(),w=X(),N=Math.max(y??0,w??0)||null,G=Fe(N),re=se=>{let oe=document.querySelector(`[data-composition-id="${CSS.escape(se)}"]`);return oe?h.resolveStartForElement(oe,0):0},$=se=>{let oe=window.gsap;if(!oe||typeof oe.timeline!="function")return null;let he=oe.timeline({paused:!0});for(let xe of se)he.add(xe.timeline,re(xe.compositionId));return he},le=(se,oe)=>{if(!K(se))return null;let he=window.gsap;if(!he||typeof he.timeline!="function")return null;let xe=he.timeline({paused:!0});if(oe)try{xe.add(oe,0)}catch(ue){L("runtime.init.site2",ue)}let fe=xe;if(typeof fe.to=="function")try{fe.to({},{duration:se})}catch(ue){L("runtime.init.site3",ue)}return xe},Be=(se,oe)=>{let he=se;if(typeof he.getChildren!="function")return[];try{let xe=he.getChildren(!0,!0,!0)??[];if(!Array.isArray(xe))return[];let fe=[];for(let ue of oe)if(!xe.some(Je=>Je===ue.timeline))try{let Je=re(ue.compositionId);se.add(ue.timeline,Je),fe.push(ue.compositionId)}catch(Je){L("runtime.init.site4",Je)}return fe}catch{return[]}},Me=Y(),Q=Me?.getAttribute("data-composition-id")??null;if(!Q)return g("root_missing_composition_id");let ne=d[Q]??null,ye=(()=>{if(!Me)return[];let se=new Set,oe=Array.from(Me.querySelectorAll("[data-composition-id]")),he=[];for(let xe of oe){let fe=xe.getAttribute("data-composition-id");if(!fe||fe===Q||se.has(fe))continue;se.add(fe);let ue=d[fe]??null;if(!ue||typeof ue.play!="function"||typeof ue.pause!="function")continue;let lt=ee(ue);he.push({compositionId:fe,timeline:ue,durationSeconds:lt??0})}return he})(),gn=se=>{for(let oe of se){let he=oe.timeline;if(typeof he.paused=="function")try{he.paused(!1)}catch(xe){L("runtime.init.site5",xe)}}};if(ye.length>0&&gn(ye),ne){let se=ye.length>0?Be(ne,ye):[];if((ye.length>0||!document.querySelector("[data-composition-id]:not([data-composition-id='"+Q+"'])"))&&(gr=!0),se.length>0)try{let fe=ne.time();ne.seek(fe,!1)}catch{}let oe=ee(ne);if(!K(oe)&&ye.length>0){let fe=ye.map(zm=>zm.compositionId),ue=$(ye),lt=ee(ue);if(ue&&K(lt))return{timeline:ue,selectedTimelineIds:fe,selectedDurationSeconds:lt,mediaDurationFloorSeconds:y,diagnostics:{code:"root_timeline_unusable_fallback",details:{rootCompositionId:Q,rootDurationSeconds:oe,fallbackKind:"composite_by_root_children",minCandidateDurationSeconds:G,selectedDurationSeconds:lt,mediaDurationFloorSeconds:y,authoredCompositionDurationFloorSeconds:w,selectedTimelineIds:fe,autoNestedChildren:se}}};let Je=le(N??0,ne),Yi=ee(Je);if(Je&&K(Yi))return{timeline:Je,selectedTimelineIds:[Q],selectedDurationSeconds:Yi,mediaDurationFloorSeconds:y,diagnostics:{code:"root_timeline_unusable_media_floor_fallback",details:{rootCompositionId:Q,rootDurationSeconds:oe,fallbackKind:"media_duration_floor",mediaDurationFloorSeconds:y,authoredCompositionDurationFloorSeconds:w,selectedDurationSeconds:Yi,selectedTimelineIds:[Q],autoNestedChildren:se}}}}if(!K(oe)&&ye.length===0){let fe=le(N??0,ne),ue=ee(fe);if(fe&&K(ue))return{timeline:fe,selectedTimelineIds:[Q],selectedDurationSeconds:ue,mediaDurationFloorSeconds:y,diagnostics:{code:"root_timeline_unusable_media_floor_fallback",details:{rootCompositionId:Q,rootDurationSeconds:oe,fallbackKind:"media_duration_floor",mediaDurationFloorSeconds:y,authoredCompositionDurationFloorSeconds:w,selectedDurationSeconds:ue,selectedTimelineIds:[Q]}}}}let he=ve(Me?.getAttribute("data-duration")),xe=Math.max(K(he)?he:0,w??0);if(xe>0&&K(xe)&&K(oe)&&xe>=oe+.5){let fe=ne;if(typeof fe.to=="function")try{fe.to({},{duration:0},xe)}catch(lt){L("runtime.init.site6",lt)}let ue=ee(ne);if(K(ue))return{timeline:ne,selectedTimelineIds:[Q],selectedDurationSeconds:ue,mediaDurationFloorSeconds:y,diagnostics:{code:"root_timeline_padded_to_declared_duration",details:{rootCompositionId:Q,rootDurationSeconds:oe,rootDeclaredDur:he,authoredCompositionDurationFloorSeconds:w,newDur:ue}}}}return{timeline:ne,selectedTimelineIds:[Q],selectedDurationSeconds:oe,mediaDurationFloorSeconds:y,diagnostics:se.length>0?{code:"root_timeline_auto_nested_children",details:{rootCompositionId:Q,selectedDurationSeconds:oe,autoNestedChildren:se}}:void 0}}if(ye.length>0){let se=ye.map(xe=>xe.compositionId),oe=$(ye),he=ee(oe);if(oe)return{timeline:oe,selectedTimelineIds:se,selectedDurationSeconds:he,mediaDurationFloorSeconds:y,diagnostics:{code:"root_timeline_missing_fallback",details:{rootCompositionId:Q,fallbackKind:"composite_by_root_children",minCandidateDurationSeconds:G,selectedDurationSeconds:he,mediaDurationFloorSeconds:y,selectedTimelineIds:se}}}}return g("root_composition_id_unmatched_in_registry")},gr=!1,Em=d=>{let g=window.gsap,h=d;if(!(!h||typeof h.getChildren!="function"||!g||typeof g.parseEase!="function"))for(let y of h.getChildren(!0,!0,!0)){let w=y,N=w.timeline;if(!N||!("_ease"in N)||typeof N._ease=="function")continue;let G=w.vars?.keyframes,$=(G&&!Array.isArray(G)?G.ease:void 0)??w.vars?.ease??"none";try{let le=g.parseEase($);typeof le=="function"&&(N._ease=le)}catch(le){Ne("keyframe_ease_repair_failed",{ease:typeof $=="string"?$:String($)}),L("runtime.keyframeEase.repair",le)}}},dn=()=>{if(x(),!B)return!1;let d=e.capturedTimeline,g=ee(d),h=K(g);if(d&&h&&gr)return!1;let y=Oi();if(!y.timeline)return!1;if(d&&d===y.timeline)return typeof d.timeScale=="function"&&d.timeScale(e.playbackRate),!1;e.capturedTimeline=y.timeline,typeof e.capturedTimeline.timeScale=="function"&&e.capturedTimeline.timeScale(e.playbackRate),Em(e.capturedTimeline);let w=Ce(e.capturedTimeline,0);if(w<=0&&typeof e.capturedTimeline.progress=="function"&&(e.capturedTimeline.progress(1,!0),e.capturedTimeline.progress(0,!1),ot(e.capturedTimeline)),w>0){try{f.setDuration(w)}catch{}if(typeof e.capturedTimeline.totalTime=="function"){typeof e.capturedTimeline.progress=="function"&&e.capturedTimeline.progress(1e-4,!0);let G=Math.max(0,e.currentTime||0);e.capturedTimeline.totalTime(G,!1),ot(e.capturedTimeline)}let N=window.__hfStudioManualEditsApply;typeof N=="function"&&N(),mi(document)}if(y.diagnostics&&be({source:"hf-preview",type:"diagnostic",code:y.diagnostics.code,details:y.diagnostics.details}),be({source:"hf-preview",type:"diagnostic",code:"timeline_bound",details:{selectedTimelineIds:y.selectedTimelineIds??[],selectedDurationSeconds:y.selectedDurationSeconds??null,mediaDurationFloorSeconds:y.mediaDurationFloorSeconds??null}}),window.parent!==window){let N=Y(),G=w>0?w:0,re=String(G>0?G:1),$=new Set,le=Q=>Q.tagName.toLowerCase()===Ut,Be=new Set(document.querySelectorAll("[data-start]")),Me=Q=>{let ne=Q.parentElement;for(;ne&&ne!==N;){if(Be.has(ne))return!0;ne=ne.parentElement}return!1};if(e.capturedTimeline.getChildren)try{for(let Q of e.capturedTimeline.getChildren(!0))if(typeof Q.targets=="function")for(let ne of Q.targets())ne instanceof HTMLElement&&ne!==N&&(le(ne)||ne.hasAttribute("data-start")||Me(ne)||$.has(ne)||($.add(ne),ne.setAttribute("data-start","0"),ne.setAttribute("data-duration",re),ne.setAttribute("data-hf-autostamped","1")))}catch{}if(N instanceof HTMLElement)for(let Q of N.querySelectorAll("[id]"))Q instanceof HTMLElement&&Q!==N&&(Q.hasAttribute("data-start")||Me(Q)||$.has(Q)||Q.tagName==="SCRIPT"||Q.tagName==="STYLE"||Q.tagName==="LINK"||le(Q)||($.add(Q),Q.setAttribute("data-start","0"),Q.setAttribute("data-duration",re),Q.setAttribute("data-hf-autostamped","1")))}for(let N of fn)br.delete(N),Es(N);return!0},gs=()=>{if(e.tornDown)return;let d=Oi();if(!d.timeline){e.capturedTimeline=null,gr=!1,f.setDuration(0),Ar(e.currentTime);return}e.capturedTimeline!==d.timeline&&(gr=!1,dn()),Ar(e.currentTime)};t=()=>{gs(),st()},window.__hfForceTimelineRebind=gs;let wm=()=>{let d=Y();if(!(d instanceof HTMLElement))return;let g=d.getBoundingClientRect(),h=Number(d.getAttribute("data-width")),y=Number(d.getAttribute("data-height")),w=window.getComputedStyle(d),N=Number.isFinite(h)&&h>0&&Number.isFinite(y)&&y>0,G=g.width<=0||g.height<=0||d.clientWidth<=0||d.clientHeight<=0;!N||!G||M("root_stage_layout_zero",{compositionId:d.getAttribute("data-composition-id")??null,declaredWidth:h,declaredHeight:y,rectWidth:Math.round(g.width),rectHeight:Math.round(g.height),clientWidth:d.clientWidth,clientHeight:d.clientHeight,display:w.display,visibility:w.visibility,overflow:w.overflow},`root-stage-layout-zero:${d.getAttribute("data-composition-id")??"unknown"}`)},Cm=()=>{e.tornDown||(s!=null&&window.cancelAnimationFrame(s),s=window.requestAnimationFrame(()=>{s=null,wm()}))},_m=()=>{i=d=>{let g=I(d.error??d.message).slice(0,F);if(!g)return;let h=q(g);be({source:"hf-preview",type:"diagnostic",code:h.code,details:{category:h.category,message:g,filename:d.filename||null,line:Number.isFinite(d.lineno)?d.lineno:null,column:Number.isFinite(d.colno)?d.colno:null}})},o=d=>{let g=I(d.reason).slice(0,F);if(!g)return;let h=q(g);be({source:"hf-preview",type:"diagnostic",code:`${h.code}_unhandled_rejection`,details:{category:`${h.category}-unhandled-rejection`,message:g}})},window.addEventListener("error",i),window.addEventListener("unhandledrejection",o)},Tm=()=>{let d=Array.from(document.querySelectorAll("img, video, audio, source, link[rel='stylesheet']"));for(let h of d){let y=()=>{if(!(h instanceof Element))return;let w=h.tagName.toLowerCase(),N=h.getAttribute("src")??h.getAttribute("href")??h.getAttribute("poster")??null,G=w==="link"?"runtime_stylesheet_load_failed":"runtime_asset_load_failed";M(G,{tagName:w,assetUrl:N,currentSrc:(h instanceof HTMLImageElement||h instanceof HTMLMediaElement)&&h.currentSrc||null,readyState:h instanceof HTMLMediaElement?h.readyState:null,networkState:h instanceof HTMLMediaElement?h.networkState:null},`${G}:${w}:${N??"unknown"}`)};h.addEventListener("error",y),T(()=>{h.removeEventListener("error",y)})}let g=document.fonts;g&&g.ready.then(()=>{if(e.tornDown)return;let h=Array.from(g).filter(y=>y.status==="error").map(y=>y.family).filter(y=>!!y).slice(0,10);h.length!==0&&M("runtime_font_load_issue",{failedFamilies:h,totalFaces:Array.from(g).length},`runtime-font-load-issue:${h.join("|")}`)}).catch(()=>{})},Rm=(d,g)=>{if(!d.timeline)return!1;let h=e.capturedTimeline;if(h&&h===d.timeline)return!1;let y=Math.max(0,e.currentTime||0),w=e.isPlaying;e.capturedTimeline=d.timeline,typeof e.capturedTimeline.timeScale=="function"&&e.capturedTimeline.timeScale(e.playbackRate);try{ot(e.capturedTimeline),typeof e.capturedTimeline.seek=="function"&&e.capturedTimeline.seek(y,!1),w&&typeof e.capturedTimeline.play=="function"&&e.capturedTimeline.play()}catch(N){L("runtime.init.site7",N)}return be({source:"hf-preview",type:"diagnostic",code:"timeline_loop_guard_rebind",details:{reason:g,previousTime:y,selectedTimelineIds:d.selectedTimelineIds??[],selectedDurationSeconds:d.selectedDurationSeconds??null,mediaDurationFloorSeconds:d.mediaDurationFloorSeconds??null}}),!0},Et=null,bs=!1,xs=!1,fn=new Set,br=new WeakMap,xr=()=>{e.tornDown||(Et!=null&&window.clearTimeout(Et),Et=window.setTimeout(()=>{if(e.tornDown||(Et=null,xs&&window.__HF_EXPORT_RENDER_SEEK_CONFIG))return;let d=Oi();if(!d.timeline||!K(d.mediaDurationFloorSeconds??null))return;if(!e.capturedTimeline){dn()&&(st(),ke(!0));return}if(bs)return;let h=ee(e.capturedTimeline),y=d.selectedDurationSeconds??ee(d.timeline);K(y)&&(!K(h)||y>=h+A)&&Rm(d,"manual")&&(bs=!0,be({source:"hf-preview",type:"diagnostic",code:"timeline_rebind_after_media_metadata",details:{previousDurationSeconds:h??null,selectedDurationSeconds:y??null,selectedTimelineIds:d.selectedTimelineIds??[],mediaDurationFloorSeconds:d.mediaDurationFloorSeconds??null}}),st(),ke(!0))},C))},ys=d=>{d.currentTarget instanceof HTMLMediaElement&&zl(d.currentTarget)},vs=d=>{d.currentTarget instanceof HTMLMediaElement&&ql(d.currentTarget)},Ss=d=>{d instanceof HTMLAudioElement&&Ef(d)&&sn(d,an(d))},As=d=>{let g=d.currentTarget;g instanceof HTMLMediaElement&&Ss(g)},km=()=>{for(let d of fn)d.removeEventListener("loadedmetadata",xr),d.removeEventListener("durationchange",xr),d.removeEventListener("loadedmetadata",ys),d.removeEventListener("loadedmetadata",As),d.removeEventListener("error",vs);fn.clear()},Hi=()=>{if(e.tornDown)return;let d=Array.from(document.querySelectorAll("video, audio"));for(let g of d){if(fn.has(g))continue;fn.add(g);let h=Number.parseFloat(g.dataset.volume??"");Number.isFinite(h)&&(g.volume=Math.max(0,Math.min(1,h))),g.addEventListener("loadedmetadata",xr),g.addEventListener("durationchange",xr),g.addEventListener("loadedmetadata",As),Ss(g),g.addEventListener("loadedmetadata",ys),g.addEventListener("error",vs),Vl(g),g.preload!=="auto"&&(g.preload="auto"),g.readyState{br.has(d)||El(d,e.capturedTimeline,Ce(e.capturedTimeline,0),br,{allowLiveTimelineSeek:!window.__HF_RENDER_CAPTURE_MODE})},Gi=new WeakMap,ws=d=>{let g=Gi.get(d);if(g!==void 0)return g;let h=window.getComputedStyle(d).position,y=h==="static"||h==="relative"||h==="sticky";return Gi.set(d,y),y},Bi=new WeakMap,Mm=d=>{let g=Bi.get(d);if(g!==void 0)return g;let h=d.querySelector("[data-start]")===null;return Bi.set(d,h),h},Fm=()=>{Gi=new WeakMap,Bi=new WeakMap},Ui=new WeakMap,yr=new WeakSet,vr=!1,Cs=d=>d.matches("audio[data-start]")||d.querySelector("audio[data-start]")!==null,_s=new WeakMap,Sr=!0,Nm=()=>{if(Sr){Sr=!1;for(let d of document.querySelectorAll(Ut)){let g=d.hasAttribute("data-hidden");_s.get(d)!==g&&(_s.set(d,g),d.id&&m.setGroupMuted(d.id,g))}}},Ar=(d,g=Array.from(document.querySelectorAll("[data-start]")))=>{let h=Y();for(let y of g){if(!(y instanceof HTMLElement))continue;if(y.hasAttribute("data-hidden")){yr.has(y)||(Ui.set(y,y.style.getPropertyValue("display")),yr.add(y),Cs(y)&&(vr=!0),Sr=!0),y.style.display="none",(y instanceof HTMLVideoElement||y instanceof HTMLImageElement)&&r?.setSourceVisibility(y,!1);continue}if(yr.has(y)){let N=Ui.get(y);N?y.style.display=N:y.style.removeProperty("display"),Ui.delete(y),yr.delete(y),Cs(y)&&(vr=!0),Sr=!0}let w=we(y,d);if(w){let N=y.parentElement;for(;N&&N!==h;){if(N instanceof HTMLElement&&N.hasAttribute("data-start")&&!we(N,d)){w=!1;break}N=N.parentElement}}y.style.visibility=w?"visible":"hidden",(y instanceof HTMLVideoElement||y instanceof HTMLImageElement)&&r?.setSourceVisibility(y,w),w?ws(y)&&y.style.removeProperty("display"):ws(y)&&Mm(y)&&(y.style.display="none")}vr&&f.isPlaying()&&(m.stopAll(),ji()),vr=!1,Nm()},Oe=()=>{let d=Hl({shouldIncludeElement:h=>h.hasAttribute("data-start")||!!V(h).compositionRoot,resolveStartSeconds:h=>j(h),resolveDurationSeconds:h=>{let y=V(h),w=j(h),N=y.inheritedStart!=null&&y.inheritedDuration!=null&&y.inheritedDuration>0?Math.max(0,y.inheritedStart+y.inheritedDuration-w):null,G=Number.isFinite(h.duration)?Qe(h,h.duration):null,re=ve(h.dataset.duration),$=re!=null&&re>0?re:null;return Ol({isVideo:h.tagName==="VIDEO",sourceDuration:G,hostRemaining:N,explicitDuration:$})}});for(let h of d.mediaClips){let y=br.get(h.el);y&&(h.volumeKeyframes=y)}let g=e.mediaForceSyncNextTick;g&&(e.mediaForceSyncNextTick=!1),e.nativeMediaSyncDisabled||Gl({clips:d.mediaClips,timeSeconds:e.currentTime,playing:e.isPlaying,playbackRate:e.playbackRate,outputMuted:e.mediaOutputMuted,userMuted:e.bridgeMuted,userVolume:e.bridgeVolume,forceSync:g,onElementVolume:(h,y,w)=>m.setElementVolume(h,w),isWebAudioOwned:h=>m.ownsElement(h),isWebAudioRouted:h=>m.routesElement(h),onAutoplayBlocked:()=>{e.mediaAutoplayBlockedPosted||(e.mediaAutoplayBlockedPosted=!0,be({source:"hf-preview",type:"media-autoplay-blocked"}))}}),Ar(e.currentTime)},ke=d=>{let g=Math.max(0,Math.round((e.currentTime||0)*e.canonicalFps)),h=Date.now();(d||g!==e.bridgeLastPostedFrame||e.isPlaying!==e.bridgeLastPostedPlaying||e.bridgeMuted!==e.bridgeLastPostedMuted||h-e.bridgeLastPostedAt>=e.bridgeMaxPostIntervalMs)&&(e.bridgeLastPostedFrame=g,e.bridgeLastPostedPlaying=e.isPlaying,e.bridgeLastPostedMuted=e.bridgeMuted,e.bridgeLastPostedAt=h,be({source:"hf-preview",type:"state",frame:g,isPlaying:e.isPlaying,muted:e.bridgeMuted,playbackRate:e.playbackRate}))},Wi="",Ts=0,Lm=()=>{let d="";for(let g of document.querySelectorAll("[data-start]"))d+=`${g.id}:${g.tagName}|`;return d},st=()=>{U(),k(),ie();let d=Y();if(d){let y=W(d.getAttribute("data-width")),w=W(d.getAttribute("data-height")),N=y?parseInt(y,10):0,G=w?parseInt(w,10):0;N>0&&G>0&&be({source:"hf-preview",type:"stage-size",width:N,height:G})}dn();let g=Ru({canonicalFps:e.canonicalFps});window.__clipManifest=g;let h=Lm();if(Wi!==h&&Fm(),!window.__clipTree||Wi!==h){let y=window;window.__clipTree=wu({startResolver:mt({timelineRegistry:y.__timelines??{},includeAuthoredTimingAttrs:!0}),timelineRegistry:y.__timelines??{},rootDuration:g.durationInFrames/e.canonicalFps}),Wi=h}be(g),Cm()},Vi=d=>typeof d=="number"&&Number.isFinite(d)&&d>0?d:0,Dm=d=>{let g=Vi(Number(d));if(g<=0)return;let h=Y(),y=Vi(ve(h?.getAttribute("data-duration"))),w=Math.max(Ts,Vi(f.getDuration()),y);g<=w||(Ts=g,h?.setAttribute("data-duration",String(g)),f.setDuration(g),st(),ke(!0))},He=(d,g=0)=>{for(let h of e.deterministicAdapters){try{d==="discover"&&h.discover(),d==="pause"&&h.pause(),d==="play"&&h.play&&h.play()}catch(y){L("runtime.init.site8",y)}if(d==="discover")try{h.seek({time:g,suppressEvents:!0})}catch(y){L("runtime.init.site9",y)}}},wt=()=>{window.__renderReady=!1},mn=null,pn=!0,Im=()=>{let d=[];for(let g of e.deterministicAdapters){let h=g.getReadyPromise;if(typeof h=="function")try{let y=h();y&&d.push(y)}catch(y){L("runtime.init.adapterReady",y)}}return d},Pm=()=>{let d=Im();if(d.length===0)return mn=null,pn=!0,!0;let g=d[0];if(!g)return!0;let h=d.length===1?g:Promise.all(d);return h!==mn&&(mn=h,pn=!1,Promise.resolve(h).then(()=>{mn===h&&(pn=!0,wt())},y=>{mn===h&&(pn=!0,L("runtime.init.adapterReady",y),wt())})),pn};if(B)_a();else{let d={injectedStyles:e.injectedCompStyles,injectedScripts:e.injectedCompScripts,injectedLinks:e.injectedCompLinks,parseDimensionPx:W,onDiagnostic:({code:g,details:h})=>{be({source:"hf-preview",type:"diagnostic",code:g,details:h})}};yd(d).then(()=>xd(d)).finally(()=>{B=!0,Hi(),Tm(),_a(),La(document),wt()})}let Er=yu({postMessage:d=>be(d)});Er.installPickerApi(),Ar(e.currentTime,Array.from(document.querySelectorAll("video[data-start], img[data-start]")));let ze=of();r=ze,T(()=>{ze.destroy(),r=null});let zi=d=>{let g=Number(d);!Number.isFinite(g)||g<=0?e.playbackRate=1:e.playbackRate=Math.max(.1,Math.min(5,g)),e.mediaForceSyncNextTick=!0,e.capturedTimeline&&typeof e.capturedTimeline.timeScale=="function"&&e.capturedTimeline.timeScale(e.playbackRate);let h=document.querySelectorAll("video, audio");for(let y of h)if(y instanceof HTMLMediaElement)try{y.playbackRate=e.playbackRate}catch(w){L("runtime.init.site10",w)}},Rs={play:()=>{let d=e.capturedTimeline;if(f.isPlaying())return;let g=Ce(d,0);if(g>0)f.setDuration(g),f.reachedEnd()&&(f.seek(0),e.currentTime=0,Ct(0));else{let h=Y(),y=Number(h?.getAttribute("data-duration")??0);y>0&&f.setDuration(y)}ot(d),f.play()&&(e.isPlaying=!0,e.mediaForceSyncNextTick=!0,Ps(f.now()),p&&!e.nativeMediaSyncDisabled&&!e.webAudioMediaDisabled&&ji(),He("play"),Oe(),ze.redraw(),ke(!0))},pause:()=>{if(!f.isPlaying())return;m.stopAll(),f.detachAudioSource(),f.pause(),e.isPlaying=!1,e.currentTime=f.now(),e.mediaForceSyncNextTick=!0,Ps(e.currentTime);let d=e.capturedTimeline;ot(d),He("pause"),Oe(),ze.redraw(),ke(!0)},seek:(d,g)=>{let h=$t(Math.max(0,Number(d)||0),e.canonicalFps);m.stopAll(),f.detachAudioSource();let y=f.isPlaying();y&&f.pause(),f.seek(h),e.currentTime=f.now(),e.isPlaying=!1,e.mediaForceSyncNextTick=!0;let w=e.capturedTimeline;if(ot(w),Ct(e.currentTime),He("pause"),g?.keepPlaying&&y){Rs.play();return}Oe(),ze.redraw(),ke(!0)},renderSeek:(d,g)=>{xs=!0;let h=$t(Math.max(0,Number(d)||0),e.canonicalFps);m.stopAll(),f.detachAudioSource(),f.isPlaying()&&f.pause(),f.seek(h),e.currentTime=f.now(),e.isPlaying=!1,e.mediaForceSyncNextTick=!0,Ct(e.currentTime,{activateChildren:!0,suppressEvents:g?.suppressEvents}),He("pause"),Oe(),ze.redraw(),ke(!0)},getTime:()=>f.now(),getDuration:()=>{let d=f.getDuration();return Number.isFinite(d)?d:0},isPlaying:()=>f.isPlaying(),setPlaybackRate:d=>{zi(d),f.setRate(e.playbackRate),Os()},getPlaybackRate:()=>e.playbackRate},ks=Ce(e.capturedTimeline,0);ks>0&&f.setDuration(ks);let Ge=Au({getTimeline:()=>e.capturedTimeline,setTimeline:d=>{e.capturedTimeline=d},getTimelineRegistry:()=>window.__timelines??{},getIsPlaying:()=>e.isPlaying,setIsPlaying:d=>{e.isPlaying!==d&&(e.mediaForceSyncNextTick=!0),e.isPlaying=d},getPlaybackRate:()=>e.playbackRate,setPlaybackRate:zi,getCanonicalFps:()=>e.canonicalFps,onSyncMedia:(d,g)=>{e.currentTime=Math.max(0,Number(d)||0),e.isPlaying!==g&&(e.mediaForceSyncNextTick=!0),e.isPlaying=g,Oe()},onStatePost:ke,onDeterministicSeek:(d,g)=>{for(let h of e.deterministicAdapters)if(!(h.name==="gsap"&&e.capturedTimeline))try{h.seek({time:Number(d)||0,suppressEvents:g?.suppressEvents})}catch(y){L("runtime.init.site11",y)}},onDeterministicPause:()=>He("pause"),onDeterministicPlay:()=>He("play"),onRenderFrameSeek:()=>{ze.redraw()},onShowNativeVideos:()=>{},getSafeDuration:()=>Ce(e.capturedTimeline,0),transport:Rs});window.__player=D(Ge),window.__playerReady=!0,Ne("composition_loaded",{duration:Ge.getDuration(),compositionId:document.querySelector("[data-composition-id]")?.getAttribute("data-composition-id")??null}),e.deterministicAdapters=[hl(),Js({resolveStartSeconds:d=>P(d,0)}),Zs(),tl(),il(),ol(),al(),sl(),ll(),ul(),cl(),Qs({getTimeline:()=>e.capturedTimeline})],ml(),pl(),window.__hfReseekGpu=d=>{let g=Math.max(0,Number(d)||0);window.__hfThreeTime=g,window.__hfTypegpuTime=g,Fr(g)},window.__hfWaitForSeekCompletion=ao,a.push(()=>{window.__hfWaitForSeekCompletion===ao&&delete window.__hfWaitForSeekCompletion}),_m(),Hi(),He("discover");let Om=()=>{let d=e.capturedTimeline,g=dn();e.capturedTimeline&&(g||e.capturedTimeline!==d||!Ge._timeline)&&(Ge._timeline=e.capturedTimeline);let h=Ce(e.capturedTimeline,0);if(h>0&&f.setDuration(h),He("discover",e.currentTime),!e.capturedTimeline){let y=window.__timelines??{},w=Object.keys(y).filter(N=>y[N]);if(w.length>0){let G=Y()?.getAttribute("data-composition-id")??null;M("root_timeline_unbound_registry_present",{reason:G?"root data-composition-id has no matching key in window.__timelines":"root composition element has no data-composition-id attribute",rootCompositionId:G,registeredTimelineKeys:w},"root_timeline_unbound_registry_present"),console.warn("[hyperframes] Root timeline not bound \u2014 render will freeze at t=0. "+(G?`Root data-composition-id is "${G}" but window.__timelines has no such key. `:"Root composition element has no data-composition-id. ")+`Registered timeline keys: [${w.join(", ")}]. Register the root timeline under its data-composition-id (window.__timelines["${G??""}"] = tl).`)}}window.__renderReady=!0,st(),ke(!0)},It=null,Hm=()=>{if(It)return;let d=()=>{window.removeEventListener("hf-timelines-built",d),It=null,wt()};It=d,window.addEventListener("hf-timelines-built",d)};T(()=>{It&&(window.removeEventListener("hf-timelines-built",It),It=null)}),wt=()=>{if(!B){window.__renderReady=!1;return}if(window.__hfTimelinesBuilding){window.__renderReady=!1,Hm();return}if(He("discover",e.currentTime),!Pm()){window.__renderReady=!1;return}Om()},wt(),B&&setTimeout(()=>{wt()},0);let wr=0,qi=!1,Ms=Number.NaN,Fs=null,$i=!1,Gm=(d,g,h,y)=>{try{let w=y?.suppressEvents===!0;ot(d),typeof d.totalTime=="function"?d.totalTime(g,w):d.seek(g,w)}catch(w){L(h,w)}},Bm=(d,g)=>{let h=window.__timelines??{},y=Y()?.getAttribute("data-composition-id")??null;for(let[w,N]of Object.entries(h)){if(!N||w===y)continue;let G=document.querySelector(`[data-composition-id="${CSS.escape(w)}"]`);if(!G)continue;let re=P(G,0);if(!Number.isFinite(re))continue;let $=ee(N),le=$e(G)+Math.max(0,d-re)*_e(G),Be=Math.max(0,$!=null&&$>0?Math.min($,le):le);Gm(N,Be,"runtime.init.transport.childTimeline",g)}},Ns=d=>{let g=window.__timelines??{};for(let h of Object.values(g))if(!(!h||h===d))try{h.play()}catch(y){L("runtime.init.activateSiblings",y)}},Ls=d=>typeof d=="object"&&d!==null,hn=new WeakMap,Um=["onStart","onUpdate","onComplete","onReverseComplete","onRepeat"],Ds=(d,g)=>{let h=d[g];if(typeof h!="function")return null;try{let y=Number(h.call(d));return Number.isFinite(y)?y:null}catch(y){return L("runtime.init.gsapCallbackDuration",y),null}},Wm=d=>{let g=hn.get(d);if(g!=null)return g;if(!("getChildren"in d)||typeof d.getChildren!="function")return!1;let h;try{h=d.getChildren(!0,!0,!0)}catch(y){return L("runtime.init.gsapCallbackChildren",y),hn.set(d,!1),!1}if(!Array.isArray(h))return hn.set(d,!1),!1;for(let y of h){if(!Ls(y))continue;let w=y.vars;if(!Ls(w)||!Um.some($=>typeof w[$]=="function"))continue;let re=Ds(y,"totalDuration")??Ds(y,"duration");if(re!=null&&re<=1e-6)return hn.set(d,!0),!0}return hn.set(d,!1),!1};function Ct(d,g){let h=e.capturedTimeline,y=g?.suppressEvents===!0;if(h){g?.activateChildren&&Ns(h);let w=h,N=d;if(typeof w.totalDuration=="function")try{let G=Number(w.totalDuration());Number.isFinite(G)&&G>0&&d>G&&(N=G)}catch(G){L("runtime.init.transport.clampDuration",G)}try{typeof h.totalTime=="function"?(h.totalTime(N,y),!y&&!Wm(h)&&(h.totalTime(N+.001,!0),h.totalTime(N,!0))):h.seek(N,y)}catch(G){L("runtime.init.transport.seek",G)}}Bm(d,g),h&&g?.activateChildren&&Ns(h);for(let w of e.deterministicAdapters)if(!(w.name==="gsap"&&h))try{w.seek({time:d,suppressEvents:y})}catch(N){L("runtime.init.transport.adapter",N)}}let Vm=()=>{try{return document.querySelector(`[${Cf}]`)!=null}catch{return!1}},Is=()=>{if(!(e.tornDown||qi)){qi=!0;try{if(e.transportRafId=window.requestAnimationFrame(Is),wr+=1,_f({tick:wr,isPlaying:f.isPlaying(),hasCapturedTimeline:e.capturedTimeline!=null,currentTimeSeconds:f.now()})){let y=e.capturedTimeline;if(dn()){e.capturedTimeline&&!Ge._timeline&&(Ge._timeline=e.capturedTimeline),e.capturedTimeline&&e.capturedTimeline!==y&&ot(e.capturedTimeline);let w=Ce(e.capturedTimeline,0);w>0&&f.setDuration(w),st()}}if(wr%20===0&&st(),wr%30===0&&Hi(),e.capturedTimeline){let y=Ce(e.capturedTimeline,0);y>0&&(!f.isPlaying()||y>=f.getDuration())&&f.setDuration(y)}if(f.isPlaying()&&!e.mediaOutputMuted)if(!e.nativeMediaSyncDisabled&&!e.webAudioMediaDisabled&&m.isActive()&&m.context){let y=m.getTime();y>=0&&f.attachAudioSource({currentTimeSeconds:y})}else{let y=document.querySelectorAll("audio[data-start]"),w=!1;for(let N of y){if(!(N instanceof HTMLMediaElement)||!N.isConnected||b(N))continue;let G=Number.parseFloat(N.dataset.start??""),re=ve(N.dataset.duration),$=re!=null&&re>0?G+re:1/0,le=$e(N);if(Number.isFinite(G)&&e.currentTime>=G&&e.currentTime<$){N.paused?!N.error&&N.readyState{let g=document.querySelectorAll("video, audio");for(let h of g){if(!(h instanceof HTMLMediaElement)||!h.isConnected)continue;let y=Number.parseFloat(h.dataset.start??"");if(!Number.isFinite(y))continue;let w=ve(h.dataset.duration),N=w!=null&&w>0?y+w:1/0;if(d=N)continue;let G=$e(h),re=d-y+G;if(re>=0)try{h.currentTime=re}catch{}}},ji=()=>{if(e.nativeMediaSyncDisabled||e.webAudioMediaDisabled)return;let d=m.startGeneration(),g=document.querySelectorAll("audio[data-start]");for(let h of g){if(!(h instanceof HTMLMediaElement)||!h.isConnected||b(h))continue;let y=Number.parseFloat(h.dataset.start??"");if(!Number.isFinite(y))continue;let w=$e(h),N=Number.parseFloat(h.dataset.volume??""),G=Number.isFinite(N)?N:1,re=ve(h.dataset.duration),$=re!=null&&re>0?re:Number.POSITIVE_INFINITY,le=h.closest("[data-composition-id]");if(le){let Q=P(le,0),ne=H(le,{includeAuthoredTimingAttrs:!0});ne!=null&&ne>0&&($=Math.min($,Math.max(0,Q+ne-y)))}let Be=an(h);sn(h,Be),(Be.kind==="web-audio"?m.scheduleMediaElementPlayback(h,y,w,f.now(),G,d,e.playbackRate):Promise.resolve(null)).then(Q=>{if(Q||!f.isPlaying())return;let ne=e.playbackRate*_e(h),_t=h.hasAttribute("data-fx-chain")||h.hasAttribute("data-automation");if(Math.abs(ne-1)>1e-9){Be.kind==="web-audio"&&_t&&(h.muted=!0);return}m.decodeAudioElement(h).then(ye=>{!ye||!f.isPlaying()||m.schedulePlayback(h,ye,y,w,f.now(),G,d,e.playbackRate,$)})})}};function Os(){m.setRate(e.playbackRate)&&!e.nativeMediaSyncDisabled&&!e.webAudioMediaDisabled&&p&&f.isPlaying()&&m.hasBoundedActiveSources()&&(m.stopAll(),ji())}if(e.capturedTimeline){let d=Ce(e.capturedTimeline,0);d>0&&f.setDuration(d),ot(e.capturedTimeline)}Cd(window),e.transportRafId=window.requestAnimationFrame(Is),st(),ke(!0),e.controlBridgeHandler=Us({onPlay:()=>{Ge.play(),Ne("composition_played",{time:Ge.getTime()})},onPause:()=>{Ge.pause(),Ne("composition_paused",{time:Ge.getTime()})},onStopMedia:()=>{m.stopAll();let d=document.querySelectorAll("video, audio");for(let g of d)g instanceof HTMLMediaElement&&!g.paused&&g.pause()},onSeek:(d,g)=>{Ge.seek(d),Ne("composition_seeked",{time:d})},onSetMuted:d=>{e.bridgeMuted=d;let g=d||e.mediaOutputMuted;m.setMuted(g);let h=document.querySelectorAll("video, audio");for(let y of h)y instanceof HTMLMediaElement&&(y.muted=g||y.defaultMuted)},onSetVolume:d=>{e.bridgeVolume=d,m.setVolume(d);let g=document.querySelectorAll("video, audio");for(let h of g){if(!(h instanceof HTMLMediaElement))continue;let y=parseFloat(h.dataset.volume??""),w=Number.isFinite(y)?y:1;h.volume=Nr(w*d)}},onSetMediaOutputMuted:d=>{e.mediaOutputMuted=d;let g=d||e.bridgeMuted;m.setMuted(g);let h=document.querySelectorAll("video, audio");for(let y of h)y instanceof HTMLMediaElement&&(y.muted=g||y.defaultMuted)},onSetNativeMediaSyncDisabled:d=>{e.nativeMediaSyncDisabled!==d&&(e.nativeMediaSyncDisabled=d,e.mediaForceSyncNextTick=!0,d?(m.stopAll(),f.detachAudioSource()):Oe())},onSetWebAudioMediaDisabled:d=>{e.webAudioMediaDisabled!==d&&(e.webAudioMediaDisabled=d,e.mediaForceSyncNextTick=!0,d&&(m.stopAll(),f.detachAudioSource()),Oe())},onSetPlaybackRate:d=>{zi(d),e.transportClock&&e.transportClock.setRate(e.playbackRate),Os()},onSetRootDuration:Dm,onSetColorGrading:(d,g)=>{ze.setGrading(d,g)},onSetColorGradingCompare:(d,g)=>{ze.setCompare(d,g)},onTick:()=>{if(e.tornDown||!f.isPlaying())return;let d=f.now();if(e.currentTime=d,Ct(d),f.reachedEnd()){m.stopAll(),f.detachAudioSource(),f.pause(),e.isPlaying=!1;let g=f.getDuration();Number.isFinite(g)&&(f.seek(g),e.currentTime=g,Ct(g)),He("pause"),Oe(),ke(!0)}},onEnablePickMode:()=>Er.enablePickMode(),onDisablePickMode:()=>Er.disablePickMode(),onSetRuntimeData:Ri,onClearRuntimeData:ki,getCanonicalFps:()=>e.canonicalFps});let Ki=()=>{if(!e.tornDown){e.tornDown=!0,e.transportRafId!=null&&(window.cancelAnimationFrame(e.transportRafId),e.transportRafId=null),e.transportClock=null,m.destroy(),Et!=null&&(window.clearTimeout(Et),Et=null),s!=null&&(window.cancelAnimationFrame(s),s=null),km(),e.controlBridgeHandler&&(window.removeEventListener("message",e.controlBridgeHandler),e.controlBridgeHandler=null),i&&(window.removeEventListener("error",i),i=null),o&&(window.removeEventListener("unhandledrejection",o),o=null),e.beforeUnloadHandler&&(window.removeEventListener("beforeunload",e.beforeUnloadHandler),e.beforeUnloadHandler=null),Er.disablePickMode();for(let d of e.deterministicAdapters)if(!(!d||typeof d.revert!="function"))try{d.revert()}catch(g){L("runtime.init.site12",g)}e.deterministicAdapters=[];for(let d of a.splice(0))try{d()}catch(g){L("runtime.init.site13",g)}for(let d of e.injectedCompStyles)try{d.remove()}catch(g){L("runtime.init.site14",g)}e.injectedCompStyles=[];for(let d of e.injectedCompLinks)try{d.remove()}catch(g){L("runtime.init.site15",g)}e.injectedCompLinks=[];for(let d of e.injectedCompScripts)try{d.remove()}catch(g){L("runtime.init.site16",g)}e.injectedCompScripts=[],e.capturedTimeline=null,t=()=>{},window.__hfRuntimeTeardown===Ki&&(window.__hfRuntimeTeardown=null)}};window.__hfRuntimeTeardown=Ki,e.beforeUnloadHandler=Ki,window.addEventListener("beforeunload",e.beforeUnloadHandler)}var Vf=["BN","BN","BN","BN","BN","BN","BN","BN","BN","S","B","S","WS","B","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","B","B","B","S","WS","ON","ON","ET","ET","ET","ON","ON","ON","ON","ON","ES","CS","ES","CS","CS","EN","EN","EN","EN","EN","EN","EN","EN","EN","EN","CS","ON","ON","ON","ON","ON","ON","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","ON","ON","ON","ON","ON","ON","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","ON","ON","ON","ON","BN","BN","BN","BN","BN","BN","B","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","CS","ON","ET","ET","ET","ET","ON","ON","ON","ON","L","ON","ON","BN","ON","ON","ET","ET","EN","EN","ON","L","ON","ON","ON","EN","L","ON","ON","ON","ON","ON","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","ON","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","ON","L","L","L","L","L","L","L","L"],ss=[[697,698,"ON"],[706,719,"ON"],[722,735,"ON"],[741,749,"ON"],[751,767,"ON"],[768,879,"NSM"],[884,885,"ON"],[894,894,"ON"],[900,901,"ON"],[903,903,"ON"],[1014,1014,"ON"],[1155,1161,"NSM"],[1418,1418,"ON"],[1421,1422,"ON"],[1423,1423,"ET"],[1424,1424,"R"],[1425,1469,"NSM"],[1470,1470,"R"],[1471,1471,"NSM"],[1472,1472,"R"],[1473,1474,"NSM"],[1475,1475,"R"],[1476,1477,"NSM"],[1478,1478,"R"],[1479,1479,"NSM"],[1480,1535,"R"],[1536,1541,"AN"],[1542,1543,"ON"],[1544,1544,"AL"],[1545,1546,"ET"],[1547,1547,"AL"],[1548,1548,"CS"],[1549,1549,"AL"],[1550,1551,"ON"],[1552,1562,"NSM"],[1563,1610,"AL"],[1611,1631,"NSM"],[1632,1641,"AN"],[1642,1642,"ET"],[1643,1644,"AN"],[1645,1647,"AL"],[1648,1648,"NSM"],[1649,1749,"AL"],[1750,1756,"NSM"],[1757,1757,"AN"],[1758,1758,"ON"],[1759,1764,"NSM"],[1765,1766,"AL"],[1767,1768,"NSM"],[1769,1769,"ON"],[1770,1773,"NSM"],[1774,1775,"AL"],[1776,1785,"EN"],[1786,1808,"AL"],[1809,1809,"NSM"],[1810,1839,"AL"],[1840,1866,"NSM"],[1867,1957,"AL"],[1958,1968,"NSM"],[1969,1983,"AL"],[1984,2026,"R"],[2027,2035,"NSM"],[2036,2037,"R"],[2038,2041,"ON"],[2042,2044,"R"],[2045,2045,"NSM"],[2046,2069,"R"],[2070,2073,"NSM"],[2074,2074,"R"],[2075,2083,"NSM"],[2084,2084,"R"],[2085,2087,"NSM"],[2088,2088,"R"],[2089,2093,"NSM"],[2094,2136,"R"],[2137,2139,"NSM"],[2140,2143,"R"],[2144,2191,"AL"],[2192,2193,"AN"],[2194,2198,"AL"],[2199,2207,"NSM"],[2208,2249,"AL"],[2250,2273,"NSM"],[2274,2274,"AN"],[2275,2306,"NSM"],[2362,2362,"NSM"],[2364,2364,"NSM"],[2369,2376,"NSM"],[2381,2381,"NSM"],[2385,2391,"NSM"],[2402,2403,"NSM"],[2433,2433,"NSM"],[2492,2492,"NSM"],[2497,2500,"NSM"],[2509,2509,"NSM"],[2530,2531,"NSM"],[2546,2547,"ET"],[2555,2555,"ET"],[2558,2558,"NSM"],[2561,2562,"NSM"],[2620,2620,"NSM"],[2625,2626,"NSM"],[2631,2632,"NSM"],[2635,2637,"NSM"],[2641,2641,"NSM"],[2672,2673,"NSM"],[2677,2677,"NSM"],[2689,2690,"NSM"],[2748,2748,"NSM"],[2753,2757,"NSM"],[2759,2760,"NSM"],[2765,2765,"NSM"],[2786,2787,"NSM"],[2801,2801,"ET"],[2810,2815,"NSM"],[2817,2817,"NSM"],[2876,2876,"NSM"],[2879,2879,"NSM"],[2881,2884,"NSM"],[2893,2893,"NSM"],[2901,2902,"NSM"],[2914,2915,"NSM"],[2946,2946,"NSM"],[3008,3008,"NSM"],[3021,3021,"NSM"],[3059,3064,"ON"],[3065,3065,"ET"],[3066,3066,"ON"],[3072,3072,"NSM"],[3076,3076,"NSM"],[3132,3132,"NSM"],[3134,3136,"NSM"],[3142,3144,"NSM"],[3146,3149,"NSM"],[3157,3158,"NSM"],[3170,3171,"NSM"],[3192,3198,"ON"],[3201,3201,"NSM"],[3260,3260,"NSM"],[3276,3277,"NSM"],[3298,3299,"NSM"],[3328,3329,"NSM"],[3387,3388,"NSM"],[3393,3396,"NSM"],[3405,3405,"NSM"],[3426,3427,"NSM"],[3457,3457,"NSM"],[3530,3530,"NSM"],[3538,3540,"NSM"],[3542,3542,"NSM"],[3633,3633,"NSM"],[3636,3642,"NSM"],[3647,3647,"ET"],[3655,3662,"NSM"],[3761,3761,"NSM"],[3764,3772,"NSM"],[3784,3790,"NSM"],[3864,3865,"NSM"],[3893,3893,"NSM"],[3895,3895,"NSM"],[3897,3897,"NSM"],[3898,3901,"ON"],[3953,3966,"NSM"],[3968,3972,"NSM"],[3974,3975,"NSM"],[3981,3991,"NSM"],[3993,4028,"NSM"],[4038,4038,"NSM"],[4141,4144,"NSM"],[4146,4151,"NSM"],[4153,4154,"NSM"],[4157,4158,"NSM"],[4184,4185,"NSM"],[4190,4192,"NSM"],[4209,4212,"NSM"],[4226,4226,"NSM"],[4229,4230,"NSM"],[4237,4237,"NSM"],[4253,4253,"NSM"],[4957,4959,"NSM"],[5008,5017,"ON"],[5120,5120,"ON"],[5760,5760,"WS"],[5787,5788,"ON"],[5906,5908,"NSM"],[5938,5939,"NSM"],[5970,5971,"NSM"],[6002,6003,"NSM"],[6068,6069,"NSM"],[6071,6077,"NSM"],[6086,6086,"NSM"],[6089,6099,"NSM"],[6107,6107,"ET"],[6109,6109,"NSM"],[6128,6137,"ON"],[6144,6154,"ON"],[6155,6157,"NSM"],[6158,6158,"BN"],[6159,6159,"NSM"],[6277,6278,"NSM"],[6313,6313,"NSM"],[6432,6434,"NSM"],[6439,6440,"NSM"],[6450,6450,"NSM"],[6457,6459,"NSM"],[6464,6464,"ON"],[6468,6469,"ON"],[6622,6655,"ON"],[6679,6680,"NSM"],[6683,6683,"NSM"],[6742,6742,"NSM"],[6744,6750,"NSM"],[6752,6752,"NSM"],[6754,6754,"NSM"],[6757,6764,"NSM"],[6771,6780,"NSM"],[6783,6783,"NSM"],[6832,6877,"NSM"],[6880,6891,"NSM"],[6912,6915,"NSM"],[6964,6964,"NSM"],[6966,6970,"NSM"],[6972,6972,"NSM"],[6978,6978,"NSM"],[7019,7027,"NSM"],[7040,7041,"NSM"],[7074,7077,"NSM"],[7080,7081,"NSM"],[7083,7085,"NSM"],[7142,7142,"NSM"],[7144,7145,"NSM"],[7149,7149,"NSM"],[7151,7153,"NSM"],[7212,7219,"NSM"],[7222,7223,"NSM"],[7376,7378,"NSM"],[7380,7392,"NSM"],[7394,7400,"NSM"],[7405,7405,"NSM"],[7412,7412,"NSM"],[7416,7417,"NSM"],[7616,7679,"NSM"],[8125,8125,"ON"],[8127,8129,"ON"],[8141,8143,"ON"],[8157,8159,"ON"],[8173,8175,"ON"],[8189,8190,"ON"],[8192,8202,"WS"],[8203,8205,"BN"],[8207,8207,"R"],[8208,8231,"ON"],[8232,8232,"WS"],[8233,8233,"B"],[8234,8238,"BN"],[8239,8239,"CS"],[8240,8244,"ET"],[8245,8259,"ON"],[8260,8260,"CS"],[8261,8286,"ON"],[8287,8287,"WS"],[8288,8303,"BN"],[8304,8304,"EN"],[8308,8313,"EN"],[8314,8315,"ES"],[8316,8318,"ON"],[8320,8329,"EN"],[8330,8331,"ES"],[8332,8334,"ON"],[8352,8399,"ET"],[8400,8432,"NSM"],[8448,8449,"ON"],[8451,8454,"ON"],[8456,8457,"ON"],[8468,8468,"ON"],[8470,8472,"ON"],[8478,8483,"ON"],[8485,8485,"ON"],[8487,8487,"ON"],[8489,8489,"ON"],[8494,8494,"ET"],[8506,8507,"ON"],[8512,8516,"ON"],[8522,8525,"ON"],[8528,8543,"ON"],[8585,8587,"ON"],[8592,8721,"ON"],[8722,8722,"ES"],[8723,8723,"ET"],[8724,9013,"ON"],[9083,9108,"ON"],[9110,9257,"ON"],[9280,9290,"ON"],[9312,9351,"ON"],[9352,9371,"EN"],[9450,9899,"ON"],[9901,10239,"ON"],[10496,11123,"ON"],[11126,11263,"ON"],[11493,11498,"ON"],[11503,11505,"NSM"],[11513,11519,"ON"],[11647,11647,"NSM"],[11744,11775,"NSM"],[11776,11869,"ON"],[11904,11929,"ON"],[11931,12019,"ON"],[12032,12245,"ON"],[12272,12287,"ON"],[12288,12288,"WS"],[12289,12292,"ON"],[12296,12320,"ON"],[12330,12333,"NSM"],[12336,12336,"ON"],[12342,12343,"ON"],[12349,12351,"ON"],[12441,12442,"NSM"],[12443,12444,"ON"],[12448,12448,"ON"],[12539,12539,"ON"],[12736,12773,"ON"],[12783,12783,"ON"],[12829,12830,"ON"],[12880,12895,"ON"],[12924,12926,"ON"],[12977,12991,"ON"],[13004,13007,"ON"],[13175,13178,"ON"],[13278,13279,"ON"],[13311,13311,"ON"],[19904,19967,"ON"],[42128,42182,"ON"],[42509,42511,"ON"],[42607,42610,"NSM"],[42611,42611,"ON"],[42612,42621,"NSM"],[42622,42623,"ON"],[42654,42655,"NSM"],[42736,42737,"NSM"],[42752,42785,"ON"],[42888,42888,"ON"],[43010,43010,"NSM"],[43014,43014,"NSM"],[43019,43019,"NSM"],[43045,43046,"NSM"],[43048,43051,"ON"],[43052,43052,"NSM"],[43064,43065,"ET"],[43124,43127,"ON"],[43204,43205,"NSM"],[43232,43249,"NSM"],[43263,43263,"NSM"],[43302,43309,"NSM"],[43335,43345,"NSM"],[43392,43394,"NSM"],[43443,43443,"NSM"],[43446,43449,"NSM"],[43452,43453,"NSM"],[43493,43493,"NSM"],[43561,43566,"NSM"],[43569,43570,"NSM"],[43573,43574,"NSM"],[43587,43587,"NSM"],[43596,43596,"NSM"],[43644,43644,"NSM"],[43696,43696,"NSM"],[43698,43700,"NSM"],[43703,43704,"NSM"],[43710,43711,"NSM"],[43713,43713,"NSM"],[43756,43757,"NSM"],[43766,43766,"NSM"],[43882,43883,"ON"],[44005,44005,"NSM"],[44008,44008,"NSM"],[44013,44013,"NSM"],[64285,64285,"R"],[64286,64286,"NSM"],[64287,64296,"R"],[64297,64297,"ES"],[64298,64335,"R"],[64336,64450,"AL"],[64451,64466,"ON"],[64467,64829,"AL"],[64830,64847,"ON"],[64848,64911,"AL"],[64912,64913,"ON"],[64914,64967,"AL"],[64968,64975,"ON"],[64976,65007,"BN"],[65008,65020,"AL"],[65021,65023,"ON"],[65024,65039,"NSM"],[65040,65049,"ON"],[65056,65071,"NSM"],[65072,65103,"ON"],[65104,65104,"CS"],[65105,65105,"ON"],[65106,65106,"CS"],[65108,65108,"ON"],[65109,65109,"CS"],[65110,65118,"ON"],[65119,65119,"ET"],[65120,65121,"ON"],[65122,65123,"ES"],[65124,65126,"ON"],[65128,65128,"ON"],[65129,65130,"ET"],[65131,65131,"ON"],[65136,65278,"AL"],[65279,65279,"BN"],[65281,65282,"ON"],[65283,65285,"ET"],[65286,65290,"ON"],[65291,65291,"ES"],[65292,65292,"CS"],[65293,65293,"ES"],[65294,65295,"CS"],[65296,65305,"EN"],[65306,65306,"CS"],[65307,65312,"ON"],[65339,65344,"ON"],[65371,65381,"ON"],[65504,65505,"ET"],[65506,65508,"ON"],[65509,65510,"ET"],[65512,65518,"ON"],[65520,65528,"BN"],[65529,65533,"ON"],[65534,65535,"BN"],[65793,65793,"ON"],[65856,65932,"ON"],[65936,65948,"ON"],[65952,65952,"ON"],[66045,66045,"NSM"],[66272,66272,"NSM"],[66273,66299,"EN"],[66422,66426,"NSM"],[67584,67870,"R"],[67871,67871,"ON"],[67872,68096,"R"],[68097,68099,"NSM"],[68100,68100,"R"],[68101,68102,"NSM"],[68103,68107,"R"],[68108,68111,"NSM"],[68112,68151,"R"],[68152,68154,"NSM"],[68155,68158,"R"],[68159,68159,"NSM"],[68160,68324,"R"],[68325,68326,"NSM"],[68327,68408,"R"],[68409,68415,"ON"],[68416,68863,"R"],[68864,68899,"AL"],[68900,68903,"NSM"],[68904,68911,"AL"],[68912,68921,"AN"],[68922,68927,"AL"],[68928,68937,"AN"],[68938,68968,"R"],[68969,68973,"NSM"],[68974,68974,"ON"],[68975,69215,"R"],[69216,69246,"AN"],[69247,69290,"R"],[69291,69292,"NSM"],[69293,69311,"R"],[69312,69327,"AL"],[69328,69336,"ON"],[69337,69369,"AL"],[69370,69375,"NSM"],[69376,69423,"R"],[69424,69445,"AL"],[69446,69456,"NSM"],[69457,69487,"AL"],[69488,69505,"R"],[69506,69509,"NSM"],[69510,69631,"R"],[69633,69633,"NSM"],[69688,69702,"NSM"],[69714,69733,"ON"],[69744,69744,"NSM"],[69747,69748,"NSM"],[69759,69761,"NSM"],[69811,69814,"NSM"],[69817,69818,"NSM"],[69826,69826,"NSM"],[69888,69890,"NSM"],[69927,69931,"NSM"],[69933,69940,"NSM"],[70003,70003,"NSM"],[70016,70017,"NSM"],[70070,70078,"NSM"],[70089,70092,"NSM"],[70095,70095,"NSM"],[70191,70193,"NSM"],[70196,70196,"NSM"],[70198,70199,"NSM"],[70206,70206,"NSM"],[70209,70209,"NSM"],[70367,70367,"NSM"],[70371,70378,"NSM"],[70400,70401,"NSM"],[70459,70460,"NSM"],[70464,70464,"NSM"],[70502,70508,"NSM"],[70512,70516,"NSM"],[70587,70592,"NSM"],[70606,70606,"NSM"],[70608,70608,"NSM"],[70610,70610,"NSM"],[70625,70626,"NSM"],[70712,70719,"NSM"],[70722,70724,"NSM"],[70726,70726,"NSM"],[70750,70750,"NSM"],[70835,70840,"NSM"],[70842,70842,"NSM"],[70847,70848,"NSM"],[70850,70851,"NSM"],[71090,71093,"NSM"],[71100,71101,"NSM"],[71103,71104,"NSM"],[71132,71133,"NSM"],[71219,71226,"NSM"],[71229,71229,"NSM"],[71231,71232,"NSM"],[71264,71276,"ON"],[71339,71339,"NSM"],[71341,71341,"NSM"],[71344,71349,"NSM"],[71351,71351,"NSM"],[71453,71453,"NSM"],[71455,71455,"NSM"],[71458,71461,"NSM"],[71463,71467,"NSM"],[71727,71735,"NSM"],[71737,71738,"NSM"],[71995,71996,"NSM"],[71998,71998,"NSM"],[72003,72003,"NSM"],[72148,72151,"NSM"],[72154,72155,"NSM"],[72160,72160,"NSM"],[72193,72198,"NSM"],[72201,72202,"NSM"],[72243,72248,"NSM"],[72251,72254,"NSM"],[72263,72263,"NSM"],[72273,72278,"NSM"],[72281,72283,"NSM"],[72330,72342,"NSM"],[72344,72345,"NSM"],[72544,72544,"NSM"],[72546,72548,"NSM"],[72550,72550,"NSM"],[72752,72758,"NSM"],[72760,72765,"NSM"],[72850,72871,"NSM"],[72874,72880,"NSM"],[72882,72883,"NSM"],[72885,72886,"NSM"],[73009,73014,"NSM"],[73018,73018,"NSM"],[73020,73021,"NSM"],[73023,73029,"NSM"],[73031,73031,"NSM"],[73104,73105,"NSM"],[73109,73109,"NSM"],[73111,73111,"NSM"],[73459,73460,"NSM"],[73472,73473,"NSM"],[73526,73530,"NSM"],[73536,73536,"NSM"],[73538,73538,"NSM"],[73562,73562,"NSM"],[73685,73692,"ON"],[73693,73696,"ET"],[73697,73713,"ON"],[78912,78912,"NSM"],[78919,78933,"NSM"],[90398,90409,"NSM"],[90413,90415,"NSM"],[92912,92916,"NSM"],[92976,92982,"NSM"],[94031,94031,"NSM"],[94095,94098,"NSM"],[94178,94178,"ON"],[94180,94180,"NSM"],[113821,113822,"NSM"],[113824,113827,"BN"],[117760,117973,"ON"],[118e3,118009,"EN"],[118010,118012,"ON"],[118016,118451,"ON"],[118458,118480,"ON"],[118496,118512,"ON"],[118528,118573,"NSM"],[118576,118598,"NSM"],[119143,119145,"NSM"],[119155,119162,"BN"],[119163,119170,"NSM"],[119173,119179,"NSM"],[119210,119213,"NSM"],[119273,119274,"ON"],[119296,119361,"ON"],[119362,119364,"NSM"],[119365,119365,"ON"],[119552,119638,"ON"],[120513,120513,"ON"],[120539,120539,"ON"],[120571,120571,"ON"],[120597,120597,"ON"],[120629,120629,"ON"],[120655,120655,"ON"],[120687,120687,"ON"],[120713,120713,"ON"],[120745,120745,"ON"],[120771,120771,"ON"],[120782,120831,"EN"],[121344,121398,"NSM"],[121403,121452,"NSM"],[121461,121461,"NSM"],[121476,121476,"NSM"],[121499,121503,"NSM"],[121505,121519,"NSM"],[122880,122886,"NSM"],[122888,122904,"NSM"],[122907,122913,"NSM"],[122915,122916,"NSM"],[122918,122922,"NSM"],[123023,123023,"NSM"],[123184,123190,"NSM"],[123566,123566,"NSM"],[123628,123631,"NSM"],[123647,123647,"ET"],[124140,124143,"NSM"],[124398,124399,"NSM"],[124643,124643,"NSM"],[124646,124646,"NSM"],[124654,124655,"NSM"],[124661,124661,"NSM"],[124928,125135,"R"],[125136,125142,"NSM"],[125143,125251,"R"],[125252,125258,"NSM"],[125259,126063,"R"],[126064,126143,"AL"],[126144,126207,"R"],[126208,126287,"AL"],[126288,126463,"R"],[126464,126703,"AL"],[126704,126705,"ON"],[126706,126719,"AL"],[126720,126975,"R"],[126976,127019,"ON"],[127024,127123,"ON"],[127136,127150,"ON"],[127153,127167,"ON"],[127169,127183,"ON"],[127185,127221,"ON"],[127232,127242,"EN"],[127243,127247,"ON"],[127279,127279,"ON"],[127338,127343,"ON"],[127405,127405,"ON"],[127584,127589,"ON"],[127744,128728,"ON"],[128732,128748,"ON"],[128752,128764,"ON"],[128768,128985,"ON"],[128992,129003,"ON"],[129008,129008,"ON"],[129024,129035,"ON"],[129040,129095,"ON"],[129104,129113,"ON"],[129120,129159,"ON"],[129168,129197,"ON"],[129200,129211,"ON"],[129216,129217,"ON"],[129232,129240,"ON"],[129280,129623,"ON"],[129632,129645,"ON"],[129648,129660,"ON"],[129664,129674,"ON"],[129678,129734,"ON"],[129736,129736,"ON"],[129741,129756,"ON"],[129759,129770,"ON"],[129775,129784,"ON"],[129792,129938,"ON"],[129940,130031,"ON"],[130032,130041,"EN"],[130042,130042,"ON"],[131070,131071,"BN"],[196606,196607,"BN"],[262142,262143,"BN"],[327678,327679,"BN"],[393214,393215,"BN"],[458750,458751,"BN"],[524286,524287,"BN"],[589822,589823,"BN"],[655358,655359,"BN"],[720894,720895,"BN"],[786430,786431,"BN"],[851966,851967,"BN"],[917502,917759,"BN"],[917760,917999,"NSM"],[918e3,921599,"BN"],[983038,983039,"BN"],[1048574,1048575,"BN"],[1114110,1114111,"BN"]];function xy(e){if(e<=255)return Vf[e];let t=0,n=ss.length-1;for(;t<=n;){let r=t+n>>1,i=ss[r];if(ei[1]){t=r+1;continue}return i[2]}return"L"}function yy(e){let t=e.length;if(t===0)return null;let n=new Array(t),r=!1;for(let u=0;u=55296&&c<=56319&&u+1=56320&&b<=57343&&(f=(c-55296<<10)+(b-56320)+65536,m=2)}let p=xy(f);(p==="R"||p==="AL"||p==="AN")&&(r=!0);for(let b=0;b=0&&n[c]==="ET";c--)n[c]="EN";for(c=u+1;c0?n[u-1]:l,m=c0&&t.charCodeAt(t.length-1)===32&&(t=t.slice(0,-1)),t}function wy(e){return/[\r\f]/.test(e)?e.replace(/\r\n/g,` +`,$a=new WeakMap;function ja(e){return lf.has(e)}var lf=new WeakSet;function Ka(e){let t=$a.get(e);return t||(t=(async()=>{if(!e.audioWorklet)throw new Error("AudioWorklet is unavailable \u2014 the page needs a secure context (https, localhost or file://)");let n=`data:text/javascript;base64,${btoa(String.fromCharCode(...new TextEncoder().encode(Ox)))}`;await e.audioWorklet.addModule(n),lf.add(e)})().catch(n=>{throw $a.delete(e),n}),$a.set(e,t)),t}function Hx(e,t,n){let r=.6+Math.max(0,Math.min(1,t))*2.6,i=Math.max(1,Math.floor(e*r)),o=new Float32Array(i),a=Math.round(t*1e3)*2654435761+Math.round(n*1e3)*40503>>>0,l=()=>(a=a*1664525+1013904223>>>0,a/4294967295*2-1),s=Math.max(.001,1-Math.max(0,Math.min(1,n))),u=0,c=0;for(let m=0;m0)for(let m=0;mtypeof e=="number"?e:Number(e??0),Ya=e=>e/1e3;function ff(e,t,n,r){let i=Math.max(1,Math.round(e.sampleRate)),o=e.createBuffer(1,i,e.sampleRate),a=o.getChannelData(0);for(let u=0;u1-n}]}function pf(e,t,n){e.gain.value=n,t.gain.value=1-n}function Ja(e,t,n){return{input:e,output:e,update:t,automation:n,dispose:()=>e.disconnect()}}var Gx=new Set(["peaking","highpass","lowpass"]),uf=e=>Math.pow(10,e/20),Bx=(e,t)=>{let n=e.createGain(),r=i=>{n.gain.value=uf(de(i.gain))};return r(t),Ja(n,r,{gain:[{param:n.gain,map:uf}]})};function ur(e,t){return(n,r)=>{let i=n.createBiquadFilter();i.type=e;let o=a=>{i.frequency.value=de(a.frequency),a.q!==void 0&&(i.Q.value=de(a.q)),t&&(i.gain.value=de(a.gain))};return o(r),Ja(i,o,{frequency:[{param:i.frequency}],...Gx.has(e)?{q:[{param:i.Q}]}:{},...t?{gain:[{param:i.gain}]}:{}})}}function Ux(e){return(t,n)=>{let r=Math.tan(Math.PI*de(n.frequency)/t.sampleRate),i=e==="highpass"?t.createIIRFilter([1/(1+r),-1/(1+r)],[1,(r-1)/(r+1)]):t.createIIRFilter([r/(1+r),r/(1+r)],[1,(r-1)/(r+1)]);return Ja(i,()=>{})}}function cr(e){return(t,n)=>{let r=new AudioWorkletNode(t,e,{processorOptions:{...n}});return{input:r,output:r,update:i=>r.port.postMessage({...i}),dispose:()=>{r.port.postMessage({__hfDispose:!0}),r.disconnect()}}}}var Wx={tanh:Math.tanh,atan:e=>2/Math.PI*Math.atan(Math.PI/2*e),cubic:e=>Math.abs(e)>=1?Math.sign(e):e-e**3/3,exp:e=>Math.sign(e)*(1-Math.exp(-Math.abs(e))),alg:e=>e/Math.sqrt(1+e*e),quintic:e=>Math.abs(e)>=1?Math.sign(e):e-e**5/5,sin:e=>Math.abs(e)>=1?Math.sign(e):Math.sin(Math.PI/2*e),erf:e=>Math.tanh(1.20211*e),hard:e=>Math.max(-1,Math.min(1,e))},Vx=(e,t)=>{let n=e.createWaveShaper(),r=e.createGain(),i=e.createGain();r.connect(n).connect(i);let o=a=>{let l=Wx[String(a.type)]??Math.tanh,s=Math.pow(10,de(a.threshold)/20),u=8192,c=new Float32Array(u);for(let f=0;f=4?"4x":de(a.oversample)>=2?"2x":"none",i.gain.value=Math.pow(10,de(a.output)/20)};return o(t),{input:r,output:i,update:o,automation:{output:[{param:i.gain,map:a=>Math.pow(10,a/20)}]},dispose:()=>{r.disconnect(),n.disconnect(),i.disconnect()}}},zx=(e,t)=>{let n=e.createGain(),r=e.createGain(),i=e.createDelay(5),o=e.createGain(),a=e.createGain(),l=e.createGain();n.connect(i),i.connect(o),o.connect(i),i.connect(a).connect(r),n.connect(l).connect(r);let s=u=>{i.delayTime.value=Math.min(5,de(u.time)/1e3),o.gain.value=de(u.feedback),pf(a,l,de(u.mix))};return s(t),{input:n,output:r,update:s,automation:{time:[{param:i.delayTime,map:u=>Math.min(5,Ya(u))}],feedback:[{param:o.gain}],mix:Xa(a.gain,l.gain)},dispose:()=>[n,r,i,o,a,l].forEach(u=>u.disconnect())}},qx=(e,t,n)=>{let r=e.createGain(),i=e.createGain(),o=e.createDelay(.5),a=ff(e,"sine",de(t.speed),n),l=e.createGain(),s=e.createGain(),u=e.createGain();a.connect(l).connect(o.delayTime),r.connect(o).connect(s).connect(i),r.connect(u).connect(i);let c=f=>{o.delayTime.value=de(f.delay)/1e3,l.gain.value=de(f.depth)/1e3,a.playbackRate.value=de(f.speed),pf(s,u,de(f.mix))};return c(t),{input:r,output:i,update:c,automation:{delay:[{param:o.delayTime,map:Ya}],depth:[{param:l.gain,map:Ya}],speed:[{param:a.playbackRate}],mix:Xa(s.gain,u.gain)},dispose:()=>{mf(a),[r,i,o,l,s,u].forEach(f=>f.disconnect())}}},$x=6,jx=(e,t,n)=>{let r=e.createGain(),i=e.createGain(),o=e.createGain(),a=e.createGain(),l=ff(e,String(t.type)==="1"?"sine":"triangle",de(t.speed),n),s=e.createGain(),u=e.createGain(),c=e.createGain(),f=[];r.connect(o);let m=o;for(let b=0;b<$x;b++){let v=e.createBiquadFilter();v.type="allpass",v.Q.value=.7071,s.connect(v.frequency),m.connect(v),m=v,f.push(v)}l.connect(s),m.connect(u).connect(a),o.connect(c).connect(a),a.connect(i);let p=b=>{let v=1e3/Math.max(.1,de(b.delay));for(let x of f)x.frequency.value=v;s.gain.value=v*de(b.decay),l.playbackRate.value=de(b.speed),o.gain.value=de(b.in_gain),a.gain.value=de(b.out_gain),u.gain.value=1,c.gain.value=1};return p(t),{input:r,output:i,update:p,automation:{speed:[{param:l.playbackRate}],in_gain:[{param:o.gain}],out_gain:[{param:a.gain}]},dispose:()=>{mf(l),[r,i,o,a,s,u,c,...f].forEach(b=>b.disconnect())}}},Kx=(e,t)=>{let n=e.createGain(),r=e.createGain(),i=e.createConvolver(),o=e.createGain(),a=e.createGain();i.normalize=!1,n.connect(i).connect(o).connect(r),n.connect(a).connect(r);let l="",s=u=>{let c=`${de(u.size)}:${de(u.damping)}`;if(c!==l){let f=Hx(e.sampleRate,de(u.size),de(u.damping)),m=e.createBuffer(1,f.length,e.sampleRate);m.getChannelData(0).set(f),i.buffer=m,l=c}o.gain.value=de(u.wet),a.gain.value=de(u.dry)};return s(t),{input:n,output:r,update:s,automation:{wet:[{param:o.gain}],dry:[{param:a.gain}]},dispose:()=>[n,r,i,o,a].forEach(u=>u.disconnect())}},Yx={"gain-node":Bx,"biquad-peaking":ur("peaking",!0),"biquad-lowshelf":ur("lowshelf",!0),"biquad-highshelf":ur("highshelf",!0),"biquad-highpass":ur("highpass",!1),"biquad-lowpass":ur("lowpass",!1),"worklet-compressor":cr("hf-compressor"),"worklet-limiter":cr("hf-limiter"),"worklet-gate":cr("hf-gate"),"worklet-bitcrush":cr("hf-bitcrush"),"worklet-pitchshift":cr("hf-pitchshift"),waveshaper:Vx,"delay-feedback":zx,"chorus-lfo":qx,"allpass-phaser":jx,convolver:Kx};function hf(e){return e.nodes.some(t=>Sn(t.type)?.web.startsWith("worklet-")??!1)}function Xx(e,t,n,r=0){let i=Sn(t);if(!i)throw new Error(`Unknown effect type: ${t}`);let o=An(t,n);if((t==="highpass"||t==="lowpass")&&String(o.poles)==="1")return Ux(t)(e,o,r);let a=Yx[i.web];if(!a)throw new Error(`No Web Audio builder for ${i.web}`);return a(e,o,r)}function cf(e){let t=[];for(let n of e){let r=n.fromPreset,i=t.at(-1);if(i&&i.preset===r)i.nodes.push(n);else{let o=typeof n.presetAmount=="number"?n.presetAmount:1;t.push({...r?{preset:r}:{},amount:Math.min(1,Math.max(0,o)),nodes:[n]})}}return t}function df(e){return En(e).map(t=>{let n=An(t.type,t.params),r=n.poles!==void 0?`:${n.poles}`:"",i=String(n.poles)==="1"?`@${n.frequency}`:"",o=t.type==="phaser"?`~${n.type}`:"",a=t.fromPreset?`%${t.fromPreset}`:"";return`${t.type}${r}${i}${o}${a}`}).join("|")}function gf(e,t,n=0){var f;let r=e.createGain(),i=e.createGain(),o=[],a=[],l=cf(En(t)),s=r;for(let m of l){let p=null;if(m.preset){let b=e.createGain(),v=e.createGain(),x=e.createGain(),_=e.createGain();x.gain.value=m.amount,v.gain.value=1-m.amount,s.connect(b),b.connect(v).connect(_),p={entry:b,wet:x,dry:v,join:_},s=b}for(let b of m.nodes){let v=Xx(e,b.type,b.params??{},n);s.connect(v.input),s=v.output,o.push({...b.id?{id:b.id}:{},type:b.type,handle:v})}p&&m.preset&&(s.connect(p.wet).connect(p.join),a.push({id:m.preset,...p}),s=p.join)}s.connect(i);let u=df(t),c={};for(let m of a)(c[f=m.id]??(c[f]=[])).push(...Xa(m.wet.gain,m.dry.gain));return{input:r,output:i,presets:c,nodes:o,update(m){if(df(m)!==u)return!1;En(m).forEach((b,v)=>{let x=o[v];x&&(x.handle.update(An(b.type,b.params)),b.id===void 0?delete x.id:x.id=b.id)});let p=0;for(let b of cf(En(m))){if(!b.preset)continue;let v=a[p++];!v||v.id!==b.preset||(v.wet.gain.value=b.amount,v.dry.gain.value=1-b.amount)}return!0},dispose(){for(let{handle:m}of o)m.dispose();for(let{entry:m,wet:p,dry:b,join:v}of a)m.disconnect(),p.disconnect(),b.disconnect(),v.disconnect();r.disconnect(),i.disconnect()}}}var bf={version:1,nodes:[]},xf={version:1,lanes:[]};function yf(e,t){let n=(typeof e.getAttribute=="function"?e.getAttribute(et):null)??"";if(!n)return xf;try{return Fl(Or(n),t)}catch{return xf}}function on(e){let t=(typeof e.getAttribute=="function"?e.getAttribute(Tt):null)??"";if(!t)return{chain:bf,raw:""};try{return{chain:Rl(t),raw:t}}catch{return{chain:bf,raw:""}}}function vf(e){return yf(e,on(e).chain)}function wi(e,t,n,r,i){let{chain:o}=on(t),a=null,l=[],s=!1,u=0,c=()=>{try{a?(n.disconnect(a.input),a.output.disconnect(r),a.dispose()):n.disconnect(r)}catch{}a=null},f=(T,M)=>{if(T.nodes.length===0){n.connect(r);return}if(hf(T)&&!ja(e)){n.connect(r);let D=++u;Ka(e).then(()=>{s||D!==u||x(on(t).chain)}).catch(()=>{});return}try{let D=gf(e,T,M);n.connect(D.input),D.output.connect(r),a=D}catch{n.connect(r)}},m=(T,M)=>{l=M&&a?af(yf(t,T),T,a.nodes,M,a.presets):[]},p=i?{...i}:null;f(o,p?.elapsed??0),m(o,p);let b=()=>{if(!p)return null;let T=typeof e.currentTime=="number"?e.currentTime:p.scheduledAt;return{scheduledAt:T,elapsed:p.elapsed+(T-p.scheduledAt)*p.rate,rate:p.rate}},v=T=>{let M=b();M&&(rn(l,M.scheduledAt),m(T,M))},x=T=>{let M=b();rn(l,M?.scheduledAt??0),c(),f(T,M?.elapsed??0),m(T,M)},_=null,R=t;return typeof MutationObserver<"u"&&typeof R?.nodeType=="number"&&(_=new MutationObserver(()=>{let T=on(t);l.length>0&&lr(l),!a||!a.update(T.chain)?x(T.chain):v(T.chain)}),_.observe(R,{attributes:!0,attributeFilter:[Tt,et]})),{reanchor:T=>{if(s)return;let M=b();M&&rn(l,M.scheduledAt),p={...T},m(on(t).chain,p)},setRate:T=>{let M=b();s||!M||!Number.isFinite(T)||T<=0||T===M.rate||(p={...M,rate:T},rn(l,M.scheduledAt),m(on(t).chain,p))},dispose:()=>{s=!0,_?.disconnect(),l.length>0&&rn(l,typeof e.currentTime=="number"?e.currentTime:0),a?.dispose()}}}var Sf="runtime_web_audio_bypass";function Qa(e,t){return typeof e.getAttribute=="function"?e.getAttribute(t):null}function dr(e,t){return Qa(e,t)!==null}function Jx(e){return dr(e,"crossorigin")?!0:e.crossOrigin!=null}function Qx(e){return typeof e.baseURI=="string"&&e.baseURI?e.baseURI:typeof document<"u"?document.baseURI:""}function Zx(e){let t=typeof e.currentSrc=="string"?e.currentSrc:"";if(t)return[t];let n=Qa(e,"src");if(n)return[n];if(typeof e.querySelectorAll!="function")return[];let r=[];for(let i of Array.from(e.querySelectorAll("source"))){let o=i.getAttribute("src");o&&r.push(o)}return r}function ey(e,t){if(typeof window>"u")return!1;let n;try{n=new URL(e,Qx(t))}catch{return!1}return n.protocol!=="http:"&&n.protocol!=="https:"||n.origin===window.location.origin?!1:!Jx(t)}function Ef(e){return(typeof e.currentSrc=="string"?e.currentSrc:"")?!0:dr(e,"src")}function an(e){for(let t of Zx(e))if(ey(t,e))return{kind:"decode-only",reason:"cross_origin_no_cors",asset:t};return{kind:"web-audio"}}function ty(e){let t=[];dr(e,Tt)&&t.push("fx-chain"),dr(e,et)&&t.push("automation"),dr(e,Gr)&&t.push("audio-group");let n=Number.parseFloat(Qa(e,"data-volume")??"");return Number.isFinite(n)&&n>1&&t.push("above-unity-gain"),t}function ny(){return typeof window<"u"&&!!window.__HF_EXPORT_RENDER_SEEK_CONFIG}var Af=new WeakSet;function sn(e,t){if(t.kind==="web-audio"||ny()||Af.has(e))return;let n=ty(e);Af.add(e);let r={asset:t.asset,reason:t.reason,lostProcessing:n,note:"cross-origin media without a `crossorigin` opt-in is silent through createMediaElementSource (Web Audio spec); using native playback instead"};be({source:"hf-preview",type:"diagnostic",code:Sf,details:r});let i=n.length>0?` Native playback cannot reproduce: ${n.join(", ")} \u2014 proxy or download the asset to a same-origin URL to keep it.`:"";console.info(`[hyperframes] ${Sf}: "${t.asset}" (${t.reason}): Web Audio capture withheld; the track plays through native HTMLMediaElement output.${i}`)}function Za(e){return!Number.isFinite(e)||e<=0?1:e}function wf(e){return Le(e)}function ry(e,t){t||e.paused||!Cr().__hfDebug||console.debug("[hyperframes] webAudioTransport claimed fallback-playing element:",e.currentSrc||e.getAttribute("src")||"")}function iy(e,t){let{elapsed:n,mediaStart:r,scheduledAt:i,globalRate:o,mediaRate:a,clipDuration:l}=t,s=Number.isFinite(l)&&l>0,u=l*a;if(n>=0){let f=n*a,m=u-f;return s&&m<=0?!1:(s?e.start(0,f+r,m):e.start(0,f+r),!0)}let c=-n/o;return s?e.start(i+c,r,u):e.start(i+c,r),!0}function Ci(e,t,n){let r=sf(vf(e));r&&qa([{param:t.gain}],r,Pr.scale,n)}function fr(e){return e.sourceKind==="buffer"}var _i=class{constructor(){ge(this,"_ctx",null);ge(this,"_bufferCache",new Map);ge(this,"_failedSrcs",new Set);ge(this,"_mediaElementSources",new WeakMap);ge(this,"_activeSources",[]);ge(this,"_masterGain",null);ge(this,"_masterVolume",1);ge(this,"_masterMuted",!1);ge(this,"_groups",new Map);ge(this,"_rateAnchorCtx",0);ge(this,"_rateAnchorComp",0);ge(this,"_rate",1);ge(this,"_paused",!0);ge(this,"_playGeneration",0)}async init(){try{return this._ctx=new AudioContext,this._masterGain=this._ctx.createGain(),this._masterGain.connect(this._ctx.destination),this.applyMasterGain(),!0}catch{return!1}}get context(){return this._ctx}getTime(){return!this._ctx||this._paused?-1:this._rateAnchorComp+(this._ctx.currentTime-this._rateAnchorCtx)*this._rate}async decodeAudioElement(t){let n=t.currentSrc||t.getAttribute("src");if(!n)return null;if(this._bufferCache.has(n))return this._bufferCache.get(n);if(this._failedSrcs.has(n)||!this._ctx)return null;let r;try{let i=await fetch(n,{cache:"no-store"});if(!i.ok)return L("webAudioTransport.fetch",new Error(`${i.status} ${n}`)),null;r=await i.arrayBuffer()}catch(i){return L("webAudioTransport.fetch",i),null}try{let i=await this._ctx.decodeAudioData(r);return this._bufferCache.set(n,i),i}catch(i){return this._failedSrcs.add(n),L("webAudioTransport.decode",i),null}}startGeneration(){return this._playGeneration+=1,this._playGeneration}currentGeneration(){return this._playGeneration}acquireMediaElementSource(t){let n=this._mediaElementSources.get(t);if(n){let o=an(t);if(o.kind!=="web-audio"){try{n.disconnect()}catch{}return this._mediaElementSources.delete(t),sn(t,o),null}return n}if(!this._ctx)return null;let r=an(t);if(r.kind!=="web-audio")return sn(t,r),null;let i=this._ctx.createMediaElementSource(t);return this._mediaElementSources.set(t,i),i}async scheduleMediaElementPlayback(t,n,r,i,o,a,l=1){if(!this._ctx||!this._masterGain||a!==this._playGeneration)return null;try{if(this._ctx.state==="suspended"&&await this._ctx.resume(),a!==this._playGeneration)return null;let s=this.acquireMediaElementSource(t);if(!s)return null;let u=Za(l),c=this._ctx.createGain();c.gain.value=o;let f=this._ctx.currentTime,m=i-n,p={scheduledAt:f,elapsed:m,rate:u},b=wi(this._ctx,t,s,c,p);c.connect(this.resolveDestination(t,f,i,u)??this._masterGain),Ci(t,c,p),this._rate=u,this._rateAnchorCtx=f,this._rateAnchorComp=i;let v={fx:b,el:t,sourceNode:s,sourceKind:"media-element",gainNode:c,compositionStart:n,mediaStart:r,scheduledAt:f,priorMuted:t.muted,priorVolume:t.volume,mediaPlaybackRate:_e(t),bounded:!1};return t.volume=1,this._activeSources.push(v),this._paused=!1,v}catch(s){return L("webAudioTransport.mediaElementSource",s),null}}groupInput(t,n,r){let i=this._groups.get(t);if(i){if(i.generation!==this._playGeneration)try{i.reanchor(r),i.generation=this._playGeneration}catch(m){L("webAudioTransport.groupReanchor",m)}return i.input}if(!this._ctx||!this._masterGain)return null;let o=this._ctx.createGain(),a=this._ctx.createGain();a.connect(this._masterGain);let l=()=>po(n,t),s=l(),u=this._ctx.createGain();u.gain.value=s?.hasAttribute("data-hidden")?0:1,u.connect(a);let c=this._ctx.createGain();c.gain.value=wf(mo(s)),c.connect(u);let f=wi(this._ctx,s??{getAttribute:()=>null},o,c,r);return s&&Ci(s,c,r),this._groups.set(t,{input:o,fader:c,muteGain:u,fx:f,generation:this._playGeneration,reanchor:m=>{lr([{param:c.gain}]);let p=l();c.gain.value=wf(mo(p)),u.gain.value=p?.hasAttribute("data-hidden")?0:1,f?.reanchor(m),p&&Ci(p,c,m)},dispose:()=>{try{f?.dispose(),o.disconnect(),c.disconnect(),u.disconnect(),a.disconnect()}catch{}}}),o}setGroupMuted(t,n){let r=this._groups.get(t);if(r)try{r.muteGain.gain.value=n?0:1}catch(i){L("webAudioTransport.setGroupMuted",i)}}resolveDestination(t,n,r,i){if(!this._masterGain)return null;let o=Il(t);if(!o)return this._masterGain;let a={scheduledAt:n,elapsed:r,rate:i};return this.groupInput(o,t.ownerDocument,a)??this._masterGain}handleSourceEnded(t,n,r,i){let o=this._activeSources.indexOf(n);if(o!==-1){this._activeSources.splice(o,1),r.muted=i;try{t.disconnect(),n.fx?.dispose(),n.gainNode.disconnect()}catch{}this._activeSources.length===0&&(this._paused=!0)}}async schedulePlayback(t,n,r,i,o,a,l,s=1,u=Number.POSITIVE_INFINITY){if(!this._ctx||!this._masterGain||l!==this._playGeneration)return null;try{if(this._ctx.state==="suspended"&&await this._ctx.resume(),l!==this._playGeneration)return null;let c=Za(s),f=_e(t),m=c*f,p=this._ctx.createBufferSource();p.buffer=n,p.playbackRate.value=m;let b=this._ctx.createGain();b.gain.value=a;let v=o-r,x=this._ctx.currentTime,_={scheduledAt:x,elapsed:v,rate:c},R=wi(this._ctx,t,p,b,_);if(b.connect(this.resolveDestination(t,x,o,c)??this._masterGain),Ci(t,b,_),this._rate=c,this._rateAnchorCtx=x,this._rateAnchorComp=o,!iy(p,{elapsed:v,mediaStart:i,scheduledAt:x,globalRate:c,mediaRate:f,clipDuration:u}))return p.disconnect(),R?.dispose(),b.disconnect(),null;let T=t.muted;t.muted=!0,ry(t,T);let M={fx:R,el:t,sourceNode:p,sourceKind:"buffer",gainNode:b,compositionStart:r,mediaStart:i,scheduledAt:x,priorMuted:T,priorVolume:t.volume,mediaPlaybackRate:f,bounded:Number.isFinite(u)&&u>0};return this._activeSources.push(M),this._paused=!1,p.addEventListener("ended",()=>this.handleSourceEnded(p,M,t,T)),M}catch(c){return L("webAudioTransport.schedule",c),null}}setRate(t){let n=Za(t);if(n===this._rate)return!1;this._ctx&&!this._paused&&(this._rateAnchorComp=this.getTime(),this._rateAnchorCtx=this._ctx.currentTime),this._rate=n;for(let r of this._activeSources)try{fr(r)&&(r.sourceNode.playbackRate.value=n*r.mediaPlaybackRate),r.fx?.setRate(n)}catch(i){L("webAudioTransport.setRate",i)}for(let r of this._groups.values())try{r.fx?.setRate(n)}catch(i){L("webAudioTransport.setRate.group",i)}return!0}hasBoundedActiveSources(){return this._activeSources.some(t=>fr(t)&&t.bounded)}stopAll(){for(let t of this._activeSources){try{fr(t)&&t.sourceNode.stop(),t.sourceNode.disconnect(),t.fx?.dispose(),t.gainNode.disconnect()}catch{}fr(t)?t.el.muted=t.priorMuted:t.el.volume=t.priorVolume}this._activeSources=[],this._paused=!0}setVolume(t){this._masterVolume=Math.max(0,Math.min(1,t)),this.applyMasterGain()}setElementVolume(t,n){let r=Le(n);for(let i of this._activeSources)if(i.el===t)try{i.sourceKind==="media-element"&&(i.el.volume=1),i.gainNode.gain.value=r}catch(o){L("webAudioTransport.setElementVolume",o)}}setMuted(t){this._masterMuted=t,this.applyMasterGain()}applyMasterGain(){this._masterGain&&(this._masterGain.gain.value=this._masterMuted?0:this._masterVolume)}isActive(){return this._activeSources.length>0&&!this._paused}ownsElement(t){return!this._paused&&this._activeSources.some(n=>n.el===t&&fr(n))}routesElement(t){return!this._paused&&this._activeSources.some(n=>n.el===t)}destroy(){this.stopAll();for(let t of this._groups.values())t.dispose();if(this._groups.clear(),this._bufferCache.clear(),this._failedSrcs.clear(),this._mediaElementSources=new WeakMap,this._ctx)try{this._ctx.close()}catch{}this._ctx=null,this._masterGain=null,this._masterVolume=1,this._masterMuted=!1}};var Cf="data-hf-studio-manual-edit-gesture";function _f(e){return!Number.isInteger(e.tick)||e.tick<=0||e.tick%60!==0?!1:!(e.isPlaying&&e.hasCapturedTimeline&&e.currentTimeSeconds<2)}var oy=/^\s*spring\(\s*([+-]?(?:\d+(?:\.\d*)?|\.\d+))\s*\)\s*$/;function Tf(e){return Math.max(0,Math.min(1,e))}function Rf(e){let t=oy.exec(e);if(!t)return null;let n=Number(t[1]);return Number.isFinite(n)?Tf(n):null}function kf(e,t){if(!Number.isFinite(e))return e;if(e<=0)return 0;if(e>=1)return 1;let n=Tf(t),r=12-n*6,i=Math.PI*2*(1+n*1.5),o=1-Math.exp(-r)*Math.cos(i);return(1-Math.exp(-r*e)*Math.cos(i*e))/o}var ay=/^\s*wiggle\(\s*(\d+)\s*,\s*(easeOut|easeInOut|anticipate|uniform)\s*(?:,\s*([+-]?(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+)?)\s*)?\)\s*$/,sy=Math.PI*2;function ly(e){let t=ay.exec(e);if(!t)return null;let n=Number(t[1]);if(!Number.isSafeInteger(n)||n<1)return null;let r=t[2];if(r!=="easeOut"&&r!=="easeInOut"&&r!=="anticipate"&&r!=="uniform")return null;if(t[3]===void 0)return{wiggles:n,type:r};let i=Number(t[3]);return!Number.isFinite(i)||i<0||i>1?null:{wiggles:n,type:r,amplitude:i}}function uy(e,t,n,r){if(!Number.isFinite(e))return e;if(e<=0)return 0;if(e>=1)return 1;let i=r??(n==="easeInOut"?.08:n==="uniform"?.14:n==="anticipate"?.12:.16),o=n==="easeInOut"?i*Math.sin(Math.PI*e):n==="uniform"?i:i*(1-e);return e+(n==="anticipate"?-1:1)*o*Math.sin(sy*t*e)}function Mf(e,t){let n=ly(e);if(!n)return null;let r=`${n.wiggles}:${n.type}:${n.amplitude??"default"}`,i=t?.get(r);if(i)return i;let o=a=>uy(a,n.wiggles,n.type,n.amplitude);return t?.set(r,o),o}var cy=24,Ff=e=>e>=1?1:0,dy=e=>e,Ti=String.raw`([+-]?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?)`,fy=new RegExp(String.raw`^\s*M\s*0\s*,\s*0\s+C\s*${Ti}\s*,\s*${Ti}\s+${Ti}\s*,\s*${Ti}\s+1\s*,\s*1\s*$`,"i");function Nf(e,t,n){let r=1-e;return 3*r*r*e*t+3*r*e*e*n+e*e*e}function my(e,t,n,r,i){if(!Number.isFinite(e))return e;if(e<=0)return 0;if(e>=1)return 1;let o=0,a=1;for(let l=0;l1?null:a=>my(a,n,r,i,o)}function hy(e,t){if(!e.startsWith("spring("))return null;let n=Rf(e);if(n===null)return null;let r=t.get(n);if(r)return r;let i=o=>kf(o,n);return t.set(n,i),i}function gy(e,t){if(!e.startsWith("custom(")||!e.endsWith(")"))return null;let n=e.slice(7,-1),r=t.get(n);if(r)return r;let i=py(n);return i&&t.set(n,i),i}function Lf(e){if(e.__hfCustomEaseInstalled)return!0;let t=e.parseEase;if(!t)return!1;let n=new Map,r=new Map,i=new Map,o=s=>typeof s!="string"?null:s==="hold"?Ff:Mf(s,i)??hy(s,r)??gy(s,n),a=(s,u,c=[])=>{let f=o(s);return f||(typeof s=="string"&&/^(?:hold|spring|wiggle|custom)(?:\(|$)/.test(s.trim())&&Ne("custom_ease_parse_failed",{ease:s}),t.call(u,s,...c)??dy)};e.parseEase=function(u,...c){return a(u,this,c)};let l=e.registerEase;if(typeof l=="function"){l("hold",Ff);let s=u=>{let c=f=>f;c.config=(...f)=>a(`${u}(${f.join(",")})`,e),l(u,c)};s("spring"),s("wiggle"),s("custom")}return e.__hfCustomEaseInstalled=!0,!0}var ns=new Map,mr=new Map,es=new Map,ts=()=>{},If=()=>{},Df=0;function rs(e){return/^[a-z][a-z0-9-]{0,63}$/.test(e)}function Pf(e){let t=(es.get(e)??0)+1;return es.set(e,t),t}function Of(e){return typeof e=="number"&&Number.isSafeInteger(e)&&e>0?e:(Df-=1,Df)}function is(e,t){let n=mr.get(e);if(!n)return;let r=()=>es.get(e)===t.generation&&mr.get(e)===n;try{Promise.resolve(n(t.payload)).then(()=>{r()&&If(e,t.requestId)},i=>{r()&&ts(e,t.requestId,i)})}catch(i){r()&&ts(e,t.requestId,i)}}function Hf(e){ts=e}function Gf(e){If=e}function Ri(e,t,n){if(!rs(e))return;let r={payload:t,requestId:Of(n),generation:Pf(e)};ns.set(e,r),is(e,r)}function ki(e,t){rs(e)&&(ns.delete(e),is(e,{payload:void 0,requestId:Of(t),generation:Pf(e)}))}function Bf(e,t){if(!rs(e))throw new Error(`Invalid HyperFrames runtime-data channel: ${e}`);mr.set(e,t);let n=ns.get(e);return n&&is(e,n),()=>{mr.get(e)===t&&mr.delete(e)}}var os="data-hf-authored-duration",as="data-hf-authored-end",Uf=!1;function ot(e){if(e){if(typeof e.pause!="function"){Uf||(Uf=!0,Ne("timeline_missing_pause",{}));return}try{e.pause()}catch(t){L("runtime.timeline.pause",t)}}}function by(){let e=window.__HF_EXPORT_RENDER_SEEK_CONFIG,t=e?.fps,n=e?.fpsSource,r=Number(t);return!e||t==null?{fps:null,source:"default",rawFpsSource:n,rawFps:t,fallbackReason:"missing"}:!Number.isFinite(r)||r<=0?{fps:null,source:"default",rawFpsSource:n,rawFps:t,fallbackReason:"invalid"}:{fps:r,source:n==="render-options"||n==="default"?n:"unknown",rawFpsSource:n,rawFps:t,fallbackReason:e.fpsFallbackReason}}function Wf(){let e=Eu(),t=()=>{};Ws(be),Hf((d,g,h)=>{be({source:"hf-preview",type:"runtime-data-error",channel:d,requestId:g,message:h instanceof Error?h.message:String(h)})}),Gf((d,g)=>{try{t()}catch(h){be({source:"hf-preview",type:"runtime-data-error",channel:d,requestId:g,message:h instanceof Error?h.message:String(h)});return}be({source:"hf-preview",type:"runtime-data-applied",channel:d,requestId:g})}),mi(document),La(document),Pl(document);let n=by();e.canonicalFps=n.fps??e.canonicalFps,Bs(e.canonicalFps),window.__HF_EXPORT_RENDER_SEEK_CONFIG&&console.info("[hyperframes] render runtime fps",{canonicalFps:e.canonicalFps,source:n.source,rawFpsSource:n.rawFpsSource,rawFps:n.rawFps,fallbackReason:n.fallbackReason});let r=null,i=null,o=null,a=[],l=new Set,s=null,u=new Set,c=(d,g,h)=>{u.has(d)||(u.add(d),Ne(g,h))};if(typeof window.__hfRuntimeTeardown=="function")try{window.__hfRuntimeTeardown()}catch(d){L("runtime.init.site1",d)}let f=new Ei;e.transportClock=f;let m=new _i,p=!1;m.init().then(d=>{p=d}),window.__hf=window.__hf||{};let b=d=>d.closest("[data-hidden]")!==null||Br(d.ownerDocument,d),v=()=>{let d=window.gsap,g=window;if(!(!d?.registerPlugin||g.__hfAutoNoopRegistered))try{d.registerPlugin({name:"_auto",init:()=>!1}),g.__hfAutoNoopRegistered=!0}catch(h){c("auto_marker_install_failed","auto_marker_install_failed",{reason:"threw"}),L("runtime.autoMarker.install",h)}},x=()=>{let d=window.gsap;if(!d){c("custom_ease_missing_gsap","custom_ease_install_failed",{reason:"missing_gsap"});return}try{Lf(d)||c("custom_ease_no_parse_ease","custom_ease_install_failed",{reason:"no_parseEase"})}catch(g){c("custom_ease_install_threw","custom_ease_install_failed",{reason:"threw"}),L("runtime.customEase.install",g)}};v(),x(),document.documentElement&&(document.documentElement.style.margin="0",document.documentElement.style.padding="0",document.documentElement.style.overflow="hidden"),document.body&&(document.body.style.margin="0",document.body.style.padding="0",document.body.style.overflow="hidden");try{Ys(document)}catch(d){L("runtime.init.cssVariables",d)}window.__timelines=window.__timelines||{};let _=()=>{let d=document.querySelector('[data-composition-id][data-root="true"]');if(d instanceof HTMLElement)return d;let g=Array.from(document.querySelectorAll("[data-composition-id]"));return g.find(h=>!h.parentElement?.closest("[data-composition-id]"))??g[0]??null};if(Array.isArray(window.__timelines)){let d=window.__timelines,g=_()?.getAttribute("data-composition-id")??"root",h={};if(d.length===1)h[g]=d[0];else for(let y=0;y{a.push(d)},M=(d,g,h)=>{let y=h??`${d}:${JSON.stringify(g)}`;l.has(y)||(l.add(y),be({source:"hf-preview",type:"diagnostic",code:d,details:g}))},D=d=>{let g={scale:1,focusX:960,focusY:540},h=[],y=[],w={time:d.getTime(),duration:d.getDuration(),isPlaying:d.isPlaying(),renderMode:!1,timelineDirty:!1};return{play:d.play,pause:d.pause,seek:d.seek,getTime:d.getTime,getDuration:d.getDuration,isPlaying:d.isPlaying,getMainTimeline:()=>null,getElementBounds:()=>{},getElementsAtPoint:()=>{},setElementPosition:()=>{},previewElementPosition:()=>{},setElementKeyframes:()=>{},setElementScale:()=>{},setElementFontSize:()=>{},setElementTextContent:()=>{},setElementTextColor:()=>{},setElementTextShadow:()=>{},setElementTextFontWeight:()=>{},setElementTextFontFamily:()=>{},setElementTextOutline:()=>{},setElementTextHighlight:()=>{},setElementVolume:()=>{},setStageZoom:()=>{},getStageZoom:()=>g,setStageZoomKeyframes:()=>{},getStageZoomKeyframes:()=>h,addElement:()=>!1,removeElement:()=>!1,updateElementTiming:()=>!1,setElementTiming:()=>{},updateElementSrc:()=>!1,updateElementLayer:()=>!1,updateElementBasePosition:()=>!1,markTimelineDirty:()=>{},isTimelineDirty:()=>!1,rebuildTimeline:()=>{},ensureTimeline:()=>{},enableRenderMode:()=>{},disableRenderMode:()=>{},renderSeek:d.renderSeek,getElementVisibility:()=>({visible:!1}),getVisibleElements:()=>y,getRenderState:()=>({...w,time:d.getTime(),duration:d.getDuration(),isPlaying:d.isPlaying()})}},E=1/60,S=.75,A=.05,C=100,F=240,I=d=>{if(d instanceof Error)return d.message||String(d);if(typeof d=="string")return d;try{return JSON.stringify(d)}catch{return String(d??"")}},q=d=>{let g=d.toLowerCase();return g.includes("cannot read properties of null")||g.includes("cannot set properties of null")?{code:"runtime_null_dom_access",category:"dom-null-access"}:g.includes("failed to execute 'queryselector'")?{code:"runtime_invalid_selector",category:"selector-invalid"}:g.includes("is not defined")?{code:"runtime_reference_missing",category:"reference-missing"}:{code:"runtime_script_error",category:"script-error"}},W=d=>{if(d==null||d.trim()==="")return null;let g=Number.parseFloat(d);return!Number.isFinite(g)||g<=0?null:`${g}px`},Y=()=>_(),k=()=>{let d=Y();if(!d)return;let g=W(d.getAttribute("data-width")),h=W(d.getAttribute("data-height"));g&&(d.style.width=g),h&&(d.style.height=h),g&&d.style.setProperty("--comp-width",g),h&&d.style.setProperty("--comp-height",h)},U=()=>{let d=Y(),g=Array.from(document.querySelectorAll("[data-composition-id]")).filter(h=>h.hasAttribute("data-duration")||h.hasAttribute("data-end"));for(let h of g){if(d&&h===d)continue;let y=h.getAttribute("data-duration"),w=h.getAttribute("data-end");y!=null&&!h.hasAttribute(os)&&h.setAttribute(os,y),w!=null&&!h.hasAttribute(as)&&h.setAttribute(as,w),h.removeAttribute("data-duration"),h.removeAttribute("data-end")}},ie=()=>{let d=Y();if(!d)return;d.style.position||(d.style.position="relative"),d.style.overflow="hidden";let g=W(d.getAttribute("data-width")),h=W(d.getAttribute("data-height"));g&&(d.style.width=g),h&&(d.style.height=h);let y=Array.from(d.children);for(let w of y){let N=w.tagName.toLowerCase();if(N==="script"||N==="style"||N==="link"||N==="meta"||!w.hasAttribute("data-start")||w.hasAttribute("data-hf-autostamped"))continue;let G=(w.style.top==="0px"||w.style.top==="0")&&(w.style.left==="0px"||w.style.left==="0")&&w.style.width==="100%"&&w.style.height==="100%",re=/translate\(\s*-50%\s*,\s*-50%\s*\)/.test(w.style.transform);if(G&&re&&!w.hasAttribute("data-width")&&!w.hasAttribute("data-height")){let ne=w.style.top,_t=w.style.left,ye=w.style.width,gn=w.style.height;w.style.top="",w.style.left="",w.style.width="",w.style.height="";let se=window.getComputedStyle(w);se.top!=="auto"||se.bottom!=="auto"||se.left!=="auto"||se.right!=="auto"||se.width!=="0px"||se.height!=="0px"||(w.style.top=ne,w.style.left=_t,w.style.width=ye,w.style.height=gn)}let $=window.getComputedStyle(w),le=$.position;if(le!=="absolute"&&le!=="fixed"&&(w.style.position="absolute"),!!w.style.top||!!w.style.bottom||$.top!=="auto"||$.bottom!=="auto"||(w.style.top="0"),!!w.style.left||!!w.style.right||$.left!=="auto"||$.right!=="auto"||(w.style.left="0"),N!=="audio"){let ne=W(w.getAttribute("data-width")),_t=W(w.getAttribute("data-height")),ye=$.width!=="0px"&&$.width!=="auto",gn=$.height!=="0px"&&$.height!=="auto";ne?!w.style.width&&!ye&&(w.style.width=ne):!w.style.width&&$.width==="0px"&&(w.style.width="100%"),_t?!w.style.height&&!gn&&(w.style.height=_t):!w.style.height&&$.height==="0px"&&(w.style.height="100%")}}},P=(d,g=0,h)=>mt({timelineRegistry:window.__timelines??{},includeAuthoredTimingAttrs:h?.includeAuthoredTimingAttrs??!0}).resolveStartForElement(d,g),H=(d,g)=>mt({timelineRegistry:window.__timelines??{},includeAuthoredTimingAttrs:g?.includeAuthoredTimingAttrs??!0}).resolveDurationForElement(d),V=d=>{let g=d.closest("[data-composition-id]"),h=g?P(g,0):null,y=g?H(g,{includeAuthoredTimingAttrs:!0}):null;return{compositionRoot:g,inheritedStart:h,inheritedDuration:y}},j=d=>{let g=V(d),h=g.inheritedStart??0,y=Gt(d.getAttribute("data-start"));if(d.hasAttribute("data-hf-auto-start")||y==null||h<=0)return P(d,h);let w=g.inheritedDuration,N=w!=null&&w>0?h+w:null;return y>=h&&(N==null||y{window.__hfResolveMediaStartSeconds===j&&delete window.__hfResolveMediaStartSeconds});let we=(d,g)=>{let h=d.tagName.toLowerCase();if(h==="script"||h==="style"||h==="link"||h==="meta")return!1;let w=h==="video"||h==="audio"?j(d):P(d,0),N=H(d),G=d.getAttribute("data-composition-id");if(G){let $=(window.__timelines??{})[G],le=null;if($&&typeof $.duration=="function"){let Me=Number($.duration());Number.isFinite(Me)&&Me>0&&(le=Me)}!(d.hasAttribute("data-duration")||d.hasAttribute("data-end")||d.hasAttribute(os)||d.hasAttribute(as))&&(N==null||N<=0)&&le!=null&&(N=le)}let re=N!=null&&N>0?w+N:Number.POSITIVE_INFINITY;return g>=w&&(Number.isFinite(re)?g{if(!d||typeof d.duration!="function")return null;try{let g=Number(d.duration());return Number.isFinite(g)?Math.max(0,g):null}catch{return null}},K=d=>typeof d=="number"&&Number.isFinite(d)&&d>E,te=d=>{let g=ve(d.getAttribute("data-duration"));return g!=null&&g>0?g:Number.isFinite(d.duration)?Qe(d,d.duration):null},J=()=>{let d=Array.from(document.querySelectorAll("video[data-start], audio[data-start]"));if(d.length===0)return null;let g=0;for(let h of d){let y=j(h);if(!Number.isFinite(y))continue;let w=te(h);w==null||w<=E||(g=Math.max(g,Math.max(0,y)+w))}return g>E?g:null},X=()=>{let d=Y();if(!d)return null;let g=window.__timelines??{},h=mt({timelineRegistry:g,includeAuthoredTimingAttrs:!0}),y=0,w=ve(d.getAttribute("data-duration"));w!=null&&w>0&&(y=w);let N=Array.from(d.querySelectorAll("[data-composition-id][data-start]"));for(let G of N){if(!(G instanceof Element)||G.parentElement?.closest("[data-composition-id]")!==d)continue;let $=h.resolveStartForElement(G,0),le=h.resolveDurationForElement(G);!Number.isFinite($)||le==null||le<=0||(y=Math.max(y,Math.max(0,$)+le))}return y>E?y:null},Pe=()=>{let d=J();return typeof d!="number"||!Number.isFinite(d)||d<=E?null:d},Fe=d=>K(d)?Math.max(E,d*S):E,cn=()=>{let d=0;for(let g of e.deterministicAdapters){let h=g.getInferredDurationSeconds;if(typeof h!="function")continue;let y=null;try{y=h()}catch(w){L("runtime.init.adapterDuration",w)}typeof y=="number"&&Number.isFinite(y)&&y>0&&(d=Math.max(d,y))}return d>E?d:null},Ce=(d,g=0)=>{let h=ee(d),y=Pe(),w=X(),N=cn(),G=Math.max(y??0,w??0,N??0,window.__crocoPlannedPreviewDuration?.()||0),re=Number.isFinite(g)&&g>E?g:0,$=0;return K(h)?$=Math.max(h,G,re):K(G)?$=Math.max(G,re):$=re,$>0?Math.max(0,$):0},Oi=()=>{let d=window.__timelines??{},g=se=>{let oe=Object.entries(d).filter(ue=>!!ue[1]&&typeof ue[1].play=="function"&&typeof ue[1].pause=="function");if(oe.length!==1)return{timeline:null};let he=oe[0];if(!he)return{timeline:null};let[xe,fe]=he;return{timeline:fe,selectedTimelineIds:[xe],selectedDurationSeconds:ee(fe),diagnostics:{code:"root_timeline_sole_registered_fallback",details:{reason:se,soleTimelineId:xe}}}},h=mt({timelineRegistry:d,includeAuthoredTimingAttrs:!0}),y=Pe(),w=X(),N=Math.max(y??0,w??0)||null,G=Fe(N),re=se=>{let oe=document.querySelector(`[data-composition-id="${CSS.escape(se)}"]`);return oe?h.resolveStartForElement(oe,0):0},$=se=>{let oe=window.gsap;if(!oe||typeof oe.timeline!="function")return null;let he=oe.timeline({paused:!0});for(let xe of se)he.add(xe.timeline,re(xe.compositionId));return he},le=(se,oe)=>{if(!K(se))return null;let he=window.gsap;if(!he||typeof he.timeline!="function")return null;let xe=he.timeline({paused:!0});if(oe)try{xe.add(oe,0)}catch(ue){L("runtime.init.site2",ue)}let fe=xe;if(typeof fe.to=="function")try{fe.to({},{duration:se})}catch(ue){L("runtime.init.site3",ue)}return xe},Be=(se,oe)=>{let he=se;if(typeof he.getChildren!="function")return[];try{let xe=he.getChildren(!0,!0,!0)??[];if(!Array.isArray(xe))return[];let fe=[];for(let ue of oe)if(!xe.some(Je=>Je===ue.timeline))try{let Je=re(ue.compositionId);se.add(ue.timeline,Je),fe.push(ue.compositionId)}catch(Je){L("runtime.init.site4",Je)}return fe}catch{return[]}},Me=Y(),Q=Me?.getAttribute("data-composition-id")??null;if(!Q)return g("root_missing_composition_id");let ne=d[Q]??null,ye=(()=>{if(!Me)return[];let se=new Set,oe=Array.from(Me.querySelectorAll("[data-composition-id]")),he=[];for(let xe of oe){let fe=xe.getAttribute("data-composition-id");if(!fe||fe===Q||se.has(fe))continue;se.add(fe);let ue=d[fe]??null;if(!ue||typeof ue.play!="function"||typeof ue.pause!="function")continue;let lt=ee(ue);he.push({compositionId:fe,timeline:ue,durationSeconds:lt??0})}return he})(),gn=se=>{for(let oe of se){let he=oe.timeline;if(typeof he.paused=="function")try{he.paused(!1)}catch(xe){L("runtime.init.site5",xe)}}};if(ye.length>0&&gn(ye),ne){let se=ye.length>0?Be(ne,ye):[];if((ye.length>0||!document.querySelector("[data-composition-id]:not([data-composition-id='"+Q+"'])"))&&(gr=!0),se.length>0)try{let fe=ne.time();ne.seek(fe,!1)}catch{}let oe=ee(ne);if(!K(oe)&&ye.length>0){let fe=ye.map(zm=>zm.compositionId),ue=$(ye),lt=ee(ue);if(ue&&K(lt))return{timeline:ue,selectedTimelineIds:fe,selectedDurationSeconds:lt,mediaDurationFloorSeconds:y,diagnostics:{code:"root_timeline_unusable_fallback",details:{rootCompositionId:Q,rootDurationSeconds:oe,fallbackKind:"composite_by_root_children",minCandidateDurationSeconds:G,selectedDurationSeconds:lt,mediaDurationFloorSeconds:y,authoredCompositionDurationFloorSeconds:w,selectedTimelineIds:fe,autoNestedChildren:se}}};let Je=le(N??0,ne),Yi=ee(Je);if(Je&&K(Yi))return{timeline:Je,selectedTimelineIds:[Q],selectedDurationSeconds:Yi,mediaDurationFloorSeconds:y,diagnostics:{code:"root_timeline_unusable_media_floor_fallback",details:{rootCompositionId:Q,rootDurationSeconds:oe,fallbackKind:"media_duration_floor",mediaDurationFloorSeconds:y,authoredCompositionDurationFloorSeconds:w,selectedDurationSeconds:Yi,selectedTimelineIds:[Q],autoNestedChildren:se}}}}if(!K(oe)&&ye.length===0){let fe=le(N??0,ne),ue=ee(fe);if(fe&&K(ue))return{timeline:fe,selectedTimelineIds:[Q],selectedDurationSeconds:ue,mediaDurationFloorSeconds:y,diagnostics:{code:"root_timeline_unusable_media_floor_fallback",details:{rootCompositionId:Q,rootDurationSeconds:oe,fallbackKind:"media_duration_floor",mediaDurationFloorSeconds:y,authoredCompositionDurationFloorSeconds:w,selectedDurationSeconds:ue,selectedTimelineIds:[Q]}}}}let he=ve(Me?.getAttribute("data-duration")),xe=Math.max(K(he)?he:0,w??0);if(xe>0&&K(xe)&&K(oe)&&xe>=oe+.5){let fe=ne;if(typeof fe.to=="function")try{fe.to({},{duration:0},xe)}catch(lt){L("runtime.init.site6",lt)}let ue=ee(ne);if(K(ue))return{timeline:ne,selectedTimelineIds:[Q],selectedDurationSeconds:ue,mediaDurationFloorSeconds:y,diagnostics:{code:"root_timeline_padded_to_declared_duration",details:{rootCompositionId:Q,rootDurationSeconds:oe,rootDeclaredDur:he,authoredCompositionDurationFloorSeconds:w,newDur:ue}}}}return{timeline:ne,selectedTimelineIds:[Q],selectedDurationSeconds:oe,mediaDurationFloorSeconds:y,diagnostics:se.length>0?{code:"root_timeline_auto_nested_children",details:{rootCompositionId:Q,selectedDurationSeconds:oe,autoNestedChildren:se}}:void 0}}if(ye.length>0){let se=ye.map(xe=>xe.compositionId),oe=$(ye),he=ee(oe);if(oe)return{timeline:oe,selectedTimelineIds:se,selectedDurationSeconds:he,mediaDurationFloorSeconds:y,diagnostics:{code:"root_timeline_missing_fallback",details:{rootCompositionId:Q,fallbackKind:"composite_by_root_children",minCandidateDurationSeconds:G,selectedDurationSeconds:he,mediaDurationFloorSeconds:y,selectedTimelineIds:se}}}}return g("root_composition_id_unmatched_in_registry")},gr=!1,Em=d=>{let g=window.gsap,h=d;if(!(!h||typeof h.getChildren!="function"||!g||typeof g.parseEase!="function"))for(let y of h.getChildren(!0,!0,!0)){let w=y,N=w.timeline;if(!N||!("_ease"in N)||typeof N._ease=="function")continue;let G=w.vars?.keyframes,$=(G&&!Array.isArray(G)?G.ease:void 0)??w.vars?.ease??"none";try{let le=g.parseEase($);typeof le=="function"&&(N._ease=le)}catch(le){Ne("keyframe_ease_repair_failed",{ease:typeof $=="string"?$:String($)}),L("runtime.keyframeEase.repair",le)}}},dn=()=>{if(x(),!B)return!1;let d=e.capturedTimeline,g=ee(d),h=K(g);if(d&&h&&gr)return!1;let y=Oi();if(!y.timeline)return!1;if(d&&d===y.timeline)return typeof d.timeScale=="function"&&d.timeScale(e.playbackRate),!1;e.capturedTimeline=y.timeline,typeof e.capturedTimeline.timeScale=="function"&&e.capturedTimeline.timeScale(e.playbackRate),Em(e.capturedTimeline);let w=Ce(e.capturedTimeline,0);if(w<=0&&typeof e.capturedTimeline.progress=="function"&&(e.capturedTimeline.progress(1,!0),e.capturedTimeline.progress(0,!1),ot(e.capturedTimeline)),w>0){try{f.setDuration(w)}catch{}if(typeof e.capturedTimeline.totalTime=="function"){typeof e.capturedTimeline.progress=="function"&&e.capturedTimeline.progress(1e-4,!0);let G=Math.max(0,e.currentTime||0);e.capturedTimeline.totalTime(G,!1),ot(e.capturedTimeline)}let N=window.__hfStudioManualEditsApply;typeof N=="function"&&N(),mi(document)}if(y.diagnostics&&be({source:"hf-preview",type:"diagnostic",code:y.diagnostics.code,details:y.diagnostics.details}),be({source:"hf-preview",type:"diagnostic",code:"timeline_bound",details:{selectedTimelineIds:y.selectedTimelineIds??[],selectedDurationSeconds:y.selectedDurationSeconds??null,mediaDurationFloorSeconds:y.mediaDurationFloorSeconds??null}}),window.parent!==window){let N=Y(),G=w>0?w:0,re=String(G>0?G:1),$=new Set,le=Q=>Q.tagName.toLowerCase()===Ut,Be=new Set(document.querySelectorAll("[data-start]")),Me=Q=>{let ne=Q.parentElement;for(;ne&&ne!==N;){if(Be.has(ne))return!0;ne=ne.parentElement}return!1};if(e.capturedTimeline.getChildren)try{for(let Q of e.capturedTimeline.getChildren(!0))if(typeof Q.targets=="function")for(let ne of Q.targets())ne instanceof HTMLElement&&ne!==N&&(le(ne)||ne.hasAttribute("data-start")||Me(ne)||$.has(ne)||($.add(ne),ne.setAttribute("data-start","0"),ne.setAttribute("data-duration",re),ne.setAttribute("data-hf-autostamped","1")))}catch{}if(N instanceof HTMLElement)for(let Q of N.querySelectorAll("[id]"))Q instanceof HTMLElement&&Q!==N&&(Q.hasAttribute("data-start")||Me(Q)||$.has(Q)||Q.tagName==="SCRIPT"||Q.tagName==="STYLE"||Q.tagName==="LINK"||le(Q)||($.add(Q),Q.setAttribute("data-start","0"),Q.setAttribute("data-duration",re),Q.setAttribute("data-hf-autostamped","1")))}for(let N of fn)br.delete(N),Es(N);return!0},gs=()=>{if(e.tornDown)return;let d=Oi();if(!d.timeline){e.capturedTimeline=null,gr=!1,f.setDuration(0),Ar(e.currentTime);return}e.capturedTimeline!==d.timeline&&(gr=!1,dn()),Ar(e.currentTime)};t=()=>{gs(),st()},window.__hfForceTimelineRebind=gs;let wm=()=>{let d=Y();if(!(d instanceof HTMLElement))return;let g=d.getBoundingClientRect(),h=Number(d.getAttribute("data-width")),y=Number(d.getAttribute("data-height")),w=window.getComputedStyle(d),N=Number.isFinite(h)&&h>0&&Number.isFinite(y)&&y>0,G=g.width<=0||g.height<=0||d.clientWidth<=0||d.clientHeight<=0;!N||!G||M("root_stage_layout_zero",{compositionId:d.getAttribute("data-composition-id")??null,declaredWidth:h,declaredHeight:y,rectWidth:Math.round(g.width),rectHeight:Math.round(g.height),clientWidth:d.clientWidth,clientHeight:d.clientHeight,display:w.display,visibility:w.visibility,overflow:w.overflow},`root-stage-layout-zero:${d.getAttribute("data-composition-id")??"unknown"}`)},Cm=()=>{e.tornDown||(s!=null&&window.cancelAnimationFrame(s),s=window.requestAnimationFrame(()=>{s=null,wm()}))},_m=()=>{i=d=>{let g=I(d.error??d.message).slice(0,F);if(!g)return;let h=q(g);be({source:"hf-preview",type:"diagnostic",code:h.code,details:{category:h.category,message:g,filename:d.filename||null,line:Number.isFinite(d.lineno)?d.lineno:null,column:Number.isFinite(d.colno)?d.colno:null}})},o=d=>{let g=I(d.reason).slice(0,F);if(!g)return;let h=q(g);be({source:"hf-preview",type:"diagnostic",code:`${h.code}_unhandled_rejection`,details:{category:`${h.category}-unhandled-rejection`,message:g}})},window.addEventListener("error",i),window.addEventListener("unhandledrejection",o)},Tm=()=>{let d=Array.from(document.querySelectorAll("img, video, audio, source, link[rel='stylesheet']"));for(let h of d){let y=()=>{if(!(h instanceof Element))return;let w=h.tagName.toLowerCase(),N=h.getAttribute("src")??h.getAttribute("href")??h.getAttribute("poster")??null,G=w==="link"?"runtime_stylesheet_load_failed":"runtime_asset_load_failed";M(G,{tagName:w,assetUrl:N,currentSrc:(h instanceof HTMLImageElement||h instanceof HTMLMediaElement)&&h.currentSrc||null,readyState:h instanceof HTMLMediaElement?h.readyState:null,networkState:h instanceof HTMLMediaElement?h.networkState:null},`${G}:${w}:${N??"unknown"}`)};h.addEventListener("error",y),T(()=>{h.removeEventListener("error",y)})}let g=document.fonts;g&&g.ready.then(()=>{if(e.tornDown)return;let h=Array.from(g).filter(y=>y.status==="error").map(y=>y.family).filter(y=>!!y).slice(0,10);h.length!==0&&M("runtime_font_load_issue",{failedFamilies:h,totalFaces:Array.from(g).length},`runtime-font-load-issue:${h.join("|")}`)}).catch(()=>{})},Rm=(d,g)=>{if(!d.timeline)return!1;let h=e.capturedTimeline;if(h&&h===d.timeline)return!1;let y=Math.max(0,e.currentTime||0),w=e.isPlaying;e.capturedTimeline=d.timeline,typeof e.capturedTimeline.timeScale=="function"&&e.capturedTimeline.timeScale(e.playbackRate);try{ot(e.capturedTimeline),typeof e.capturedTimeline.seek=="function"&&e.capturedTimeline.seek(y,!1),w&&typeof e.capturedTimeline.play=="function"&&e.capturedTimeline.play()}catch(N){L("runtime.init.site7",N)}return be({source:"hf-preview",type:"diagnostic",code:"timeline_loop_guard_rebind",details:{reason:g,previousTime:y,selectedTimelineIds:d.selectedTimelineIds??[],selectedDurationSeconds:d.selectedDurationSeconds??null,mediaDurationFloorSeconds:d.mediaDurationFloorSeconds??null}}),!0},Et=null,bs=!1,xs=!1,fn=new Set,br=new WeakMap,xr=()=>{e.tornDown||(Et!=null&&window.clearTimeout(Et),Et=window.setTimeout(()=>{if(e.tornDown||(Et=null,xs&&window.__HF_EXPORT_RENDER_SEEK_CONFIG))return;let d=Oi();if(!d.timeline||!K(d.mediaDurationFloorSeconds??null))return;if(!e.capturedTimeline){dn()&&(st(),ke(!0));return}if(bs)return;let h=ee(e.capturedTimeline),y=d.selectedDurationSeconds??ee(d.timeline);K(y)&&(!K(h)||y>=h+A)&&Rm(d,"manual")&&(bs=!0,be({source:"hf-preview",type:"diagnostic",code:"timeline_rebind_after_media_metadata",details:{previousDurationSeconds:h??null,selectedDurationSeconds:y??null,selectedTimelineIds:d.selectedTimelineIds??[],mediaDurationFloorSeconds:d.mediaDurationFloorSeconds??null}}),st(),ke(!0))},C))},ys=d=>{d.currentTarget instanceof HTMLMediaElement&&zl(d.currentTarget)},vs=d=>{d.currentTarget instanceof HTMLMediaElement&&ql(d.currentTarget)},Ss=d=>{d instanceof HTMLAudioElement&&Ef(d)&&sn(d,an(d))},As=d=>{let g=d.currentTarget;g instanceof HTMLMediaElement&&Ss(g)},km=()=>{for(let d of fn)d.removeEventListener("loadedmetadata",xr),d.removeEventListener("durationchange",xr),d.removeEventListener("loadedmetadata",ys),d.removeEventListener("loadedmetadata",As),d.removeEventListener("error",vs);fn.clear()},Hi=()=>{if(e.tornDown)return;let d=Array.from(document.querySelectorAll("video, audio"));for(let g of d){if(fn.has(g))continue;fn.add(g);let h=Number.parseFloat(g.dataset.volume??"");Number.isFinite(h)&&(g.volume=Math.max(0,Math.min(1,h))),g.addEventListener("loadedmetadata",xr),g.addEventListener("durationchange",xr),g.addEventListener("loadedmetadata",As),Ss(g),g.addEventListener("loadedmetadata",ys),g.addEventListener("error",vs),Vl(g),g.preload!=="auto"&&(g.preload="auto"),g.readyState{br.has(d)||El(d,e.capturedTimeline,Ce(e.capturedTimeline,0),br,{allowLiveTimelineSeek:!window.__HF_RENDER_CAPTURE_MODE})},Gi=new WeakMap,ws=d=>{let g=Gi.get(d);if(g!==void 0)return g;let h=window.getComputedStyle(d).position,y=h==="static"||h==="relative"||h==="sticky";return Gi.set(d,y),y},Bi=new WeakMap,Mm=d=>{let g=Bi.get(d);if(g!==void 0)return g;let h=d.querySelector("[data-start]")===null;return Bi.set(d,h),h},Fm=()=>{Gi=new WeakMap,Bi=new WeakMap},Ui=new WeakMap,yr=new WeakSet,vr=!1,Cs=d=>d.matches("audio[data-start]")||d.querySelector("audio[data-start]")!==null,_s=new WeakMap,Sr=!0,Nm=()=>{if(Sr){Sr=!1;for(let d of document.querySelectorAll(Ut)){let g=d.hasAttribute("data-hidden");_s.get(d)!==g&&(_s.set(d,g),d.id&&m.setGroupMuted(d.id,g))}}},Ar=(d,g=Array.from(document.querySelectorAll("[data-start]")))=>{let h=Y();for(let y of g){if((y.nodeType!==1||y.namespaceURI!=="http://www.w3.org/1999/xhtml"))continue;if(y.hasAttribute("data-hidden")){yr.has(y)||(Ui.set(y,y.style.getPropertyValue("display")),yr.add(y),Cs(y)&&(vr=!0),Sr=!0),y.style.display="none",(y.tagName==="VIDEO"||y.tagName==="IMG")&&r?.setSourceVisibility(y,!1);continue}if(yr.has(y)){let N=Ui.get(y);N?y.style.display=N:y.style.removeProperty("display"),Ui.delete(y),yr.delete(y),Cs(y)&&(vr=!0),Sr=!0}let w=we(y,d);if(w){let N=y.parentElement;for(;N&&N!==h;){if(N.nodeType===1&&N.namespaceURI==="http://www.w3.org/1999/xhtml"&&N.hasAttribute("data-start")&&!we(N,d)){w=!1;break}N=N.parentElement}}y.style.visibility=w?"visible":"hidden",(y.tagName==="VIDEO"||y.tagName==="IMG")&&r?.setSourceVisibility(y,w),w?ws(y)&&y.style.removeProperty("display"):ws(y)&&Mm(y)&&(y.style.display="none")}vr&&f.isPlaying()&&(m.stopAll(),ji()),vr=!1,Nm()},Oe=()=>{let d=Hl({shouldIncludeElement:h=>h.hasAttribute("data-start")||!!V(h).compositionRoot,resolveStartSeconds:h=>j(h),resolveDurationSeconds:h=>{let y=V(h),w=j(h),N=y.inheritedStart!=null&&y.inheritedDuration!=null&&y.inheritedDuration>0?Math.max(0,y.inheritedStart+y.inheritedDuration-w):null,G=Number.isFinite(h.duration)?Qe(h,h.duration):null,re=ve(h.dataset.duration),$=re!=null&&re>0?re:null;return Ol({isVideo:h.tagName==="VIDEO",sourceDuration:G,hostRemaining:N,explicitDuration:$})}});for(let h of d.mediaClips){let y=br.get(h.el);y&&(h.volumeKeyframes=y)}let g=e.mediaForceSyncNextTick;g&&(e.mediaForceSyncNextTick=!1),e.nativeMediaSyncDisabled||Gl({clips:d.mediaClips,timeSeconds:e.currentTime,playing:e.isPlaying,playbackRate:e.playbackRate,outputMuted:e.mediaOutputMuted,userMuted:e.bridgeMuted,userVolume:e.bridgeVolume,forceSync:g,onElementVolume:(h,y,w)=>m.setElementVolume(h,w),isWebAudioOwned:h=>m.ownsElement(h),isWebAudioRouted:h=>m.routesElement(h),onAutoplayBlocked:()=>{e.mediaAutoplayBlockedPosted||(e.mediaAutoplayBlockedPosted=!0,be({source:"hf-preview",type:"media-autoplay-blocked"}))}}),Ar(e.currentTime)},ke=d=>{let g=Math.max(0,Math.round((e.currentTime||0)*e.canonicalFps)),h=Date.now();(d||g!==e.bridgeLastPostedFrame||e.isPlaying!==e.bridgeLastPostedPlaying||e.bridgeMuted!==e.bridgeLastPostedMuted||h-e.bridgeLastPostedAt>=e.bridgeMaxPostIntervalMs)&&(e.bridgeLastPostedFrame=g,e.bridgeLastPostedPlaying=e.isPlaying,e.bridgeLastPostedMuted=e.bridgeMuted,e.bridgeLastPostedAt=h,be({source:"hf-preview",type:"state",frame:g,isPlaying:e.isPlaying,muted:e.bridgeMuted,playbackRate:e.playbackRate}))},Wi="",Ts=0,Lm=()=>{let d="";for(let g of document.querySelectorAll("[data-start]"))d+=`${g.id}:${g.tagName}|`;return d},st=()=>{U(),k(),ie();let d=Y();if(d){let y=W(d.getAttribute("data-width")),w=W(d.getAttribute("data-height")),N=y?parseInt(y,10):0,G=w?parseInt(w,10):0;N>0&&G>0&&be({source:"hf-preview",type:"stage-size",width:N,height:G})}dn();let g=Ru({canonicalFps:e.canonicalFps});window.__clipManifest=g;let h=Lm();if(Wi!==h&&Fm(),!window.__clipTree||Wi!==h){let y=window;window.__clipTree=wu({startResolver:mt({timelineRegistry:y.__timelines??{},includeAuthoredTimingAttrs:!0}),timelineRegistry:y.__timelines??{},rootDuration:g.durationInFrames/e.canonicalFps}),Wi=h}be(g),Cm()},Vi=d=>typeof d=="number"&&Number.isFinite(d)&&d>0?d:0,Dm=d=>{let g=Vi(Number(d));if(g<=0)return;let h=Y(),y=Vi(ve(h?.getAttribute("data-duration"))),w=Math.max(Ts,Vi(f.getDuration()),y);g<=w||(Ts=g,h?.setAttribute("data-duration",String(g)),f.setDuration(g),st(),ke(!0))},He=(d,g=0)=>{for(let h of e.deterministicAdapters){try{d==="discover"&&h.discover(),d==="pause"&&h.pause(),d==="play"&&h.play&&h.play()}catch(y){L("runtime.init.site8",y)}if(d==="discover")try{h.seek({time:g,suppressEvents:!0})}catch(y){L("runtime.init.site9",y)}}},wt=()=>{window.__renderReady=!1},mn=null,pn=!0,Im=()=>{let d=[];for(let g of e.deterministicAdapters){let h=g.getReadyPromise;if(typeof h=="function")try{let y=h();y&&d.push(y)}catch(y){L("runtime.init.adapterReady",y)}}return d},Pm=()=>{let d=Im();if(d.length===0)return mn=null,pn=!0,!0;let g=d[0];if(!g)return!0;let h=d.length===1?g:Promise.all(d);return h!==mn&&(mn=h,pn=!1,Promise.resolve(h).then(()=>{mn===h&&(pn=!0,wt())},y=>{mn===h&&(pn=!0,L("runtime.init.adapterReady",y),wt())})),pn};if(B)_a();else{let d={injectedStyles:e.injectedCompStyles,injectedScripts:e.injectedCompScripts,injectedLinks:e.injectedCompLinks,parseDimensionPx:W,onDiagnostic:({code:g,details:h})=>{be({source:"hf-preview",type:"diagnostic",code:g,details:h})}};yd(d).then(()=>xd(d)).finally(()=>{B=!0,Hi(),Tm(),_a(),La(document),wt()})}let Er=yu({postMessage:d=>be(d)});Er.installPickerApi(),Ar(e.currentTime,Array.from(document.querySelectorAll("video[data-start], img[data-start]")));let ze=of();r=ze,T(()=>{ze.destroy(),r=null});let zi=d=>{let g=Number(d);!Number.isFinite(g)||g<=0?e.playbackRate=1:e.playbackRate=Math.max(.1,Math.min(5,g)),e.mediaForceSyncNextTick=!0,e.capturedTimeline&&typeof e.capturedTimeline.timeScale=="function"&&e.capturedTimeline.timeScale(e.playbackRate);let h=document.querySelectorAll("video, audio");for(let y of h)if(y instanceof HTMLMediaElement)try{y.playbackRate=e.playbackRate}catch(w){L("runtime.init.site10",w)}},Rs={play:()=>{let d=e.capturedTimeline;if(f.isPlaying())return;let g=Ce(d,0);if(g>0)f.setDuration(g),f.reachedEnd()&&(f.seek(0),e.currentTime=0,Ct(0));else{let h=Y(),y=Number(h?.getAttribute("data-duration")??0);y>0&&f.setDuration(y)}ot(d),f.play()&&(e.isPlaying=!0,e.mediaForceSyncNextTick=!0,Ps(f.now()),p&&!e.nativeMediaSyncDisabled&&!e.webAudioMediaDisabled&&ji(),He("play"),Oe(),ze.redraw(),ke(!0))},pause:()=>{if(!f.isPlaying())return;m.stopAll(),f.detachAudioSource(),f.pause(),e.isPlaying=!1,e.currentTime=f.now(),e.mediaForceSyncNextTick=!0,Ps(e.currentTime);let d=e.capturedTimeline;ot(d),He("pause"),Oe(),ze.redraw(),ke(!0)},seek:(d,g)=>{let h=$t(Math.max(0,Number(d)||0),e.canonicalFps);m.stopAll(),f.detachAudioSource();let y=f.isPlaying();y&&f.pause(),f.seek(h),e.currentTime=f.now(),e.isPlaying=!1,e.mediaForceSyncNextTick=!0;let w=e.capturedTimeline;if(ot(w),Ct(e.currentTime),He("pause"),g?.keepPlaying&&y){Rs.play();return}Oe(),ze.redraw(),ke(!0)},renderSeek:(d,g)=>{xs=!0;let h=$t(Math.max(0,Number(d)||0),e.canonicalFps);m.stopAll(),f.detachAudioSource(),f.isPlaying()&&f.pause(),f.seek(h),e.currentTime=f.now(),e.isPlaying=!1,e.mediaForceSyncNextTick=!0,Ct(e.currentTime,{activateChildren:!0,suppressEvents:g?.suppressEvents}),He("pause"),Oe(),ze.redraw(),ke(!0)},getTime:()=>f.now(),getDuration:()=>{if(window.__crocoPlannedPreviewDuration){let g=Ce(e.capturedTimeline,0);g>0&&f.setDuration(g)}let d=f.getDuration();return Number.isFinite(d)?d:0},isPlaying:()=>f.isPlaying(),setPlaybackRate:d=>{zi(d),f.setRate(e.playbackRate),Os()},getPlaybackRate:()=>e.playbackRate},ks=Ce(e.capturedTimeline,0);ks>0&&f.setDuration(ks);let Ge=Au({getTimeline:()=>e.capturedTimeline,setTimeline:d=>{e.capturedTimeline=d},getTimelineRegistry:()=>window.__timelines??{},getIsPlaying:()=>e.isPlaying,setIsPlaying:d=>{e.isPlaying!==d&&(e.mediaForceSyncNextTick=!0),e.isPlaying=d},getPlaybackRate:()=>e.playbackRate,setPlaybackRate:zi,getCanonicalFps:()=>e.canonicalFps,onSyncMedia:(d,g)=>{e.currentTime=Math.max(0,Number(d)||0),e.isPlaying!==g&&(e.mediaForceSyncNextTick=!0),e.isPlaying=g,Oe()},onStatePost:ke,onDeterministicSeek:(d,g)=>{for(let h of e.deterministicAdapters)if(!(h.name==="gsap"&&e.capturedTimeline))try{h.seek({time:Number(d)||0,suppressEvents:g?.suppressEvents})}catch(y){L("runtime.init.site11",y)}},onDeterministicPause:()=>He("pause"),onDeterministicPlay:()=>He("play"),onRenderFrameSeek:()=>{ze.redraw()},onShowNativeVideos:()=>{},getSafeDuration:()=>Ce(e.capturedTimeline,0),transport:Rs});window.__player=D(Ge),window.__playerReady=!0,Ne("composition_loaded",{duration:Ge.getDuration(),compositionId:document.querySelector("[data-composition-id]")?.getAttribute("data-composition-id")??null}),e.deterministicAdapters=[hl(),Js({resolveStartSeconds:d=>P(d,0)}),Zs(),tl(),il(),ol(),al(),sl(),ll(),ul(),cl(),Qs({getTimeline:()=>e.capturedTimeline})],ml(),pl(),window.__hfReseekGpu=d=>{let g=Math.max(0,Number(d)||0);window.__hfThreeTime=g,window.__hfTypegpuTime=g,Fr(g)},window.__hfWaitForSeekCompletion=ao,a.push(()=>{window.__hfWaitForSeekCompletion===ao&&delete window.__hfWaitForSeekCompletion}),_m(),Hi(),He("discover");let Om=()=>{let d=e.capturedTimeline,g=dn();e.capturedTimeline&&(g||e.capturedTimeline!==d||!Ge._timeline)&&(Ge._timeline=e.capturedTimeline);let h=Ce(e.capturedTimeline,0);if(h>0&&f.setDuration(h),He("discover",e.currentTime),!e.capturedTimeline){let y=window.__timelines??{},w=Object.keys(y).filter(N=>y[N]);if(w.length>0){let G=Y()?.getAttribute("data-composition-id")??null;M("root_timeline_unbound_registry_present",{reason:G?"root data-composition-id has no matching key in window.__timelines":"root composition element has no data-composition-id attribute",rootCompositionId:G,registeredTimelineKeys:w},"root_timeline_unbound_registry_present"),console.warn("[hyperframes] Root timeline not bound \u2014 render will freeze at t=0. "+(G?`Root data-composition-id is "${G}" but window.__timelines has no such key. `:"Root composition element has no data-composition-id. ")+`Registered timeline keys: [${w.join(", ")}]. Register the root timeline under its data-composition-id (window.__timelines["${G??""}"] = tl).`)}}window.__renderReady=!0,st(),ke(!0)},It=null,Hm=()=>{if(It)return;let d=()=>{window.removeEventListener("hf-timelines-built",d),It=null,wt()};It=d,window.addEventListener("hf-timelines-built",d)};T(()=>{It&&(window.removeEventListener("hf-timelines-built",It),It=null)}),wt=()=>{if(!B){window.__renderReady=!1;return}if(window.__hfTimelinesBuilding){window.__renderReady=!1,Hm();return}if(He("discover",e.currentTime),!Pm()){window.__renderReady=!1;return}Om()},wt(),B&&setTimeout(()=>{wt()},0);let wr=0,qi=!1,Ms=Number.NaN,Fs=null,$i=!1,Gm=(d,g,h,y)=>{try{let w=y?.suppressEvents===!0;ot(d),typeof d.totalTime=="function"?d.totalTime(g,w):d.seek(g,w)}catch(w){L(h,w)}},Bm=(d,g)=>{let h=window.__timelines??{},y=Y()?.getAttribute("data-composition-id")??null;for(let[w,N]of Object.entries(h)){if(!N||w===y)continue;let G=document.querySelector(`[data-composition-id="${CSS.escape(w)}"]`);if(!G)continue;let re=P(G,0);if(!Number.isFinite(re))continue;let $=ee(N),le=$e(G)+Math.max(0,d-re)*_e(G),Be=Math.max(0,$!=null&&$>0?Math.min($,le):le);Gm(N,Be,"runtime.init.transport.childTimeline",g)}},Ns=d=>{let g=window.__timelines??{};for(let h of Object.values(g))if(!(!h||h===d))try{h.play()}catch(y){L("runtime.init.activateSiblings",y)}},Ls=d=>typeof d=="object"&&d!==null,hn=new WeakMap,Um=["onStart","onUpdate","onComplete","onReverseComplete","onRepeat"],Ds=(d,g)=>{let h=d[g];if(typeof h!="function")return null;try{let y=Number(h.call(d));return Number.isFinite(y)?y:null}catch(y){return L("runtime.init.gsapCallbackDuration",y),null}},Wm=d=>{let g=hn.get(d);if(g!=null)return g;if(!("getChildren"in d)||typeof d.getChildren!="function")return!1;let h;try{h=d.getChildren(!0,!0,!0)}catch(y){return L("runtime.init.gsapCallbackChildren",y),hn.set(d,!1),!1}if(!Array.isArray(h))return hn.set(d,!1),!1;for(let y of h){if(!Ls(y))continue;let w=y.vars;if(!Ls(w)||!Um.some($=>typeof w[$]=="function"))continue;let re=Ds(y,"totalDuration")??Ds(y,"duration");if(re!=null&&re<=1e-6)return hn.set(d,!0),!0}return hn.set(d,!1),!1};function Ct(d,g){let h=e.capturedTimeline,y=g?.suppressEvents===!0;if(h){g?.activateChildren&&Ns(h);let w=h,N=d;if(typeof w.totalDuration=="function")try{let G=Number(w.totalDuration());Number.isFinite(G)&&G>0&&d>G&&(N=G)}catch(G){L("runtime.init.transport.clampDuration",G)}try{typeof h.totalTime=="function"?(h.totalTime(N,y),!y&&!Wm(h)&&(h.totalTime(N+.001,!0),h.totalTime(N,!0))):h.seek(N,y)}catch(G){L("runtime.init.transport.seek",G)}}Bm(d,g),h&&g?.activateChildren&&Ns(h);for(let w of e.deterministicAdapters)if(!(w.name==="gsap"&&h))try{w.seek({time:d,suppressEvents:y})}catch(N){L("runtime.init.transport.adapter",N)}}let Vm=()=>{try{return document.querySelector(`[${Cf}]`)!=null}catch{return!1}},Is=()=>{if(!(e.tornDown||qi)){qi=!0;try{if(e.transportRafId=window.requestAnimationFrame(Is),wr+=1,_f({tick:wr,isPlaying:f.isPlaying(),hasCapturedTimeline:e.capturedTimeline!=null,currentTimeSeconds:f.now()})){let y=e.capturedTimeline;if(dn()){e.capturedTimeline&&!Ge._timeline&&(Ge._timeline=e.capturedTimeline),e.capturedTimeline&&e.capturedTimeline!==y&&ot(e.capturedTimeline);let w=Ce(e.capturedTimeline,0);w>0&&f.setDuration(w),st()}}if(wr%20===0&&st(),wr%30===0&&Hi(),e.capturedTimeline){let y=Ce(e.capturedTimeline,0);y>0&&(!f.isPlaying()||y>=f.getDuration())&&f.setDuration(y)}if(f.isPlaying()&&!e.mediaOutputMuted)if(!e.nativeMediaSyncDisabled&&!e.webAudioMediaDisabled&&m.isActive()&&m.context){let y=m.getTime();y>=0&&f.attachAudioSource({currentTimeSeconds:y})}else{let y=document.querySelectorAll("audio[data-start]"),w=!1;for(let N of y){if(!(N instanceof HTMLMediaElement)||!N.isConnected||b(N))continue;let G=Number.parseFloat(N.dataset.start??""),re=ve(N.dataset.duration),$=re!=null&&re>0?G+re:1/0,le=$e(N);if(Number.isFinite(G)&&e.currentTime>=G&&e.currentTime<$){N.paused?!N.error&&N.readyState{let g=document.querySelectorAll("video, audio");for(let h of g){if(!(h instanceof HTMLMediaElement)||!h.isConnected)continue;let y=Number.parseFloat(h.dataset.start??"");if(!Number.isFinite(y))continue;let w=ve(h.dataset.duration),N=w!=null&&w>0?y+w:1/0;if(d=N)continue;let G=$e(h),re=d-y+G;if(re>=0)try{h.currentTime=re}catch{}}},ji=()=>{if(e.nativeMediaSyncDisabled||e.webAudioMediaDisabled)return;let d=m.startGeneration(),g=document.querySelectorAll("audio[data-start]");for(let h of g){if(!(h instanceof HTMLMediaElement)||!h.isConnected||b(h))continue;let y=Number.parseFloat(h.dataset.start??"");if(!Number.isFinite(y))continue;let w=$e(h),N=Number.parseFloat(h.dataset.volume??""),G=Number.isFinite(N)?N:1,re=ve(h.dataset.duration),$=re!=null&&re>0?re:Number.POSITIVE_INFINITY,le=h.closest("[data-composition-id]");if(le){let Q=P(le,0),ne=H(le,{includeAuthoredTimingAttrs:!0});ne!=null&&ne>0&&($=Math.min($,Math.max(0,Q+ne-y)))}let Be=an(h);sn(h,Be),(Be.kind==="web-audio"?m.scheduleMediaElementPlayback(h,y,w,f.now(),G,d,e.playbackRate):Promise.resolve(null)).then(Q=>{if(Q||!f.isPlaying())return;let ne=e.playbackRate*_e(h),_t=h.hasAttribute("data-fx-chain")||h.hasAttribute("data-automation");if(Math.abs(ne-1)>1e-9){Be.kind==="web-audio"&&_t&&(h.muted=!0);return}m.decodeAudioElement(h).then(ye=>{!ye||!f.isPlaying()||m.schedulePlayback(h,ye,y,w,f.now(),G,d,e.playbackRate,$)})})}};function Os(){m.setRate(e.playbackRate)&&!e.nativeMediaSyncDisabled&&!e.webAudioMediaDisabled&&p&&f.isPlaying()&&m.hasBoundedActiveSources()&&(m.stopAll(),ji())}if(e.capturedTimeline){let d=Ce(e.capturedTimeline,0);d>0&&f.setDuration(d),ot(e.capturedTimeline)}Cd(window),e.transportRafId=window.requestAnimationFrame(Is),st(),ke(!0),e.controlBridgeHandler=Us({onPlay:()=>{Ge.play(),Ne("composition_played",{time:Ge.getTime()})},onPause:()=>{Ge.pause(),Ne("composition_paused",{time:Ge.getTime()})},onStopMedia:()=>{m.stopAll();let d=document.querySelectorAll("video, audio");for(let g of d)g instanceof HTMLMediaElement&&!g.paused&&g.pause()},onSeek:(d,g)=>{Ge.seek(d),Ne("composition_seeked",{time:d})},onSetMuted:d=>{e.bridgeMuted=d;let g=d||e.mediaOutputMuted;m.setMuted(g);let h=document.querySelectorAll("video, audio");for(let y of h)y instanceof HTMLMediaElement&&(y.muted=g||y.defaultMuted)},onSetVolume:d=>{e.bridgeVolume=d,m.setVolume(d);let g=document.querySelectorAll("video, audio");for(let h of g){if(!(h instanceof HTMLMediaElement))continue;let y=parseFloat(h.dataset.volume??""),w=Number.isFinite(y)?y:1;h.volume=Nr(w*d)}},onSetMediaOutputMuted:d=>{e.mediaOutputMuted=d;let g=d||e.bridgeMuted;m.setMuted(g);let h=document.querySelectorAll("video, audio");for(let y of h)y instanceof HTMLMediaElement&&(y.muted=g||y.defaultMuted)},onSetNativeMediaSyncDisabled:d=>{e.nativeMediaSyncDisabled!==d&&(e.nativeMediaSyncDisabled=d,e.mediaForceSyncNextTick=!0,d?(m.stopAll(),f.detachAudioSource()):Oe())},onSetWebAudioMediaDisabled:d=>{e.webAudioMediaDisabled!==d&&(e.webAudioMediaDisabled=d,e.mediaForceSyncNextTick=!0,d&&(m.stopAll(),f.detachAudioSource()),Oe())},onSetPlaybackRate:d=>{zi(d),e.transportClock&&e.transportClock.setRate(e.playbackRate),Os()},onSetRootDuration:Dm,onSetColorGrading:(d,g)=>{ze.setGrading(d,g)},onSetColorGradingCompare:(d,g)=>{ze.setCompare(d,g)},onTick:()=>{if(e.tornDown||!f.isPlaying())return;let d=f.now();if(e.currentTime=d,Ct(d),f.reachedEnd()){m.stopAll(),f.detachAudioSource(),f.pause(),e.isPlaying=!1;let g=f.getDuration();Number.isFinite(g)&&(f.seek(g),e.currentTime=g,Ct(g)),He("pause"),Oe(),ke(!0)}},onEnablePickMode:()=>Er.enablePickMode(),onDisablePickMode:()=>Er.disablePickMode(),onSetRuntimeData:Ri,onClearRuntimeData:ki,getCanonicalFps:()=>e.canonicalFps});let Ki=()=>{if(!e.tornDown){e.tornDown=!0,e.transportRafId!=null&&(window.cancelAnimationFrame(e.transportRafId),e.transportRafId=null),e.transportClock=null,m.destroy(),Et!=null&&(window.clearTimeout(Et),Et=null),s!=null&&(window.cancelAnimationFrame(s),s=null),km(),e.controlBridgeHandler&&(window.removeEventListener("message",e.controlBridgeHandler),e.controlBridgeHandler=null),i&&(window.removeEventListener("error",i),i=null),o&&(window.removeEventListener("unhandledrejection",o),o=null),e.beforeUnloadHandler&&(window.removeEventListener("beforeunload",e.beforeUnloadHandler),e.beforeUnloadHandler=null),Er.disablePickMode();for(let d of e.deterministicAdapters)if(!(!d||typeof d.revert!="function"))try{d.revert()}catch(g){L("runtime.init.site12",g)}e.deterministicAdapters=[];for(let d of a.splice(0))try{d()}catch(g){L("runtime.init.site13",g)}for(let d of e.injectedCompStyles)try{d.remove()}catch(g){L("runtime.init.site14",g)}e.injectedCompStyles=[];for(let d of e.injectedCompLinks)try{d.remove()}catch(g){L("runtime.init.site15",g)}e.injectedCompLinks=[];for(let d of e.injectedCompScripts)try{d.remove()}catch(g){L("runtime.init.site16",g)}e.injectedCompScripts=[],e.capturedTimeline=null,t=()=>{},window.__hfRuntimeTeardown===Ki&&(window.__hfRuntimeTeardown=null)}};window.__hfRuntimeTeardown=Ki,e.beforeUnloadHandler=Ki,window.addEventListener("beforeunload",e.beforeUnloadHandler)}var Vf=["BN","BN","BN","BN","BN","BN","BN","BN","BN","S","B","S","WS","B","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","B","B","B","S","WS","ON","ON","ET","ET","ET","ON","ON","ON","ON","ON","ES","CS","ES","CS","CS","EN","EN","EN","EN","EN","EN","EN","EN","EN","EN","CS","ON","ON","ON","ON","ON","ON","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","ON","ON","ON","ON","ON","ON","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","ON","ON","ON","ON","BN","BN","BN","BN","BN","BN","B","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","CS","ON","ET","ET","ET","ET","ON","ON","ON","ON","L","ON","ON","BN","ON","ON","ET","ET","EN","EN","ON","L","ON","ON","ON","EN","L","ON","ON","ON","ON","ON","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","ON","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","ON","L","L","L","L","L","L","L","L"],ss=[[697,698,"ON"],[706,719,"ON"],[722,735,"ON"],[741,749,"ON"],[751,767,"ON"],[768,879,"NSM"],[884,885,"ON"],[894,894,"ON"],[900,901,"ON"],[903,903,"ON"],[1014,1014,"ON"],[1155,1161,"NSM"],[1418,1418,"ON"],[1421,1422,"ON"],[1423,1423,"ET"],[1424,1424,"R"],[1425,1469,"NSM"],[1470,1470,"R"],[1471,1471,"NSM"],[1472,1472,"R"],[1473,1474,"NSM"],[1475,1475,"R"],[1476,1477,"NSM"],[1478,1478,"R"],[1479,1479,"NSM"],[1480,1535,"R"],[1536,1541,"AN"],[1542,1543,"ON"],[1544,1544,"AL"],[1545,1546,"ET"],[1547,1547,"AL"],[1548,1548,"CS"],[1549,1549,"AL"],[1550,1551,"ON"],[1552,1562,"NSM"],[1563,1610,"AL"],[1611,1631,"NSM"],[1632,1641,"AN"],[1642,1642,"ET"],[1643,1644,"AN"],[1645,1647,"AL"],[1648,1648,"NSM"],[1649,1749,"AL"],[1750,1756,"NSM"],[1757,1757,"AN"],[1758,1758,"ON"],[1759,1764,"NSM"],[1765,1766,"AL"],[1767,1768,"NSM"],[1769,1769,"ON"],[1770,1773,"NSM"],[1774,1775,"AL"],[1776,1785,"EN"],[1786,1808,"AL"],[1809,1809,"NSM"],[1810,1839,"AL"],[1840,1866,"NSM"],[1867,1957,"AL"],[1958,1968,"NSM"],[1969,1983,"AL"],[1984,2026,"R"],[2027,2035,"NSM"],[2036,2037,"R"],[2038,2041,"ON"],[2042,2044,"R"],[2045,2045,"NSM"],[2046,2069,"R"],[2070,2073,"NSM"],[2074,2074,"R"],[2075,2083,"NSM"],[2084,2084,"R"],[2085,2087,"NSM"],[2088,2088,"R"],[2089,2093,"NSM"],[2094,2136,"R"],[2137,2139,"NSM"],[2140,2143,"R"],[2144,2191,"AL"],[2192,2193,"AN"],[2194,2198,"AL"],[2199,2207,"NSM"],[2208,2249,"AL"],[2250,2273,"NSM"],[2274,2274,"AN"],[2275,2306,"NSM"],[2362,2362,"NSM"],[2364,2364,"NSM"],[2369,2376,"NSM"],[2381,2381,"NSM"],[2385,2391,"NSM"],[2402,2403,"NSM"],[2433,2433,"NSM"],[2492,2492,"NSM"],[2497,2500,"NSM"],[2509,2509,"NSM"],[2530,2531,"NSM"],[2546,2547,"ET"],[2555,2555,"ET"],[2558,2558,"NSM"],[2561,2562,"NSM"],[2620,2620,"NSM"],[2625,2626,"NSM"],[2631,2632,"NSM"],[2635,2637,"NSM"],[2641,2641,"NSM"],[2672,2673,"NSM"],[2677,2677,"NSM"],[2689,2690,"NSM"],[2748,2748,"NSM"],[2753,2757,"NSM"],[2759,2760,"NSM"],[2765,2765,"NSM"],[2786,2787,"NSM"],[2801,2801,"ET"],[2810,2815,"NSM"],[2817,2817,"NSM"],[2876,2876,"NSM"],[2879,2879,"NSM"],[2881,2884,"NSM"],[2893,2893,"NSM"],[2901,2902,"NSM"],[2914,2915,"NSM"],[2946,2946,"NSM"],[3008,3008,"NSM"],[3021,3021,"NSM"],[3059,3064,"ON"],[3065,3065,"ET"],[3066,3066,"ON"],[3072,3072,"NSM"],[3076,3076,"NSM"],[3132,3132,"NSM"],[3134,3136,"NSM"],[3142,3144,"NSM"],[3146,3149,"NSM"],[3157,3158,"NSM"],[3170,3171,"NSM"],[3192,3198,"ON"],[3201,3201,"NSM"],[3260,3260,"NSM"],[3276,3277,"NSM"],[3298,3299,"NSM"],[3328,3329,"NSM"],[3387,3388,"NSM"],[3393,3396,"NSM"],[3405,3405,"NSM"],[3426,3427,"NSM"],[3457,3457,"NSM"],[3530,3530,"NSM"],[3538,3540,"NSM"],[3542,3542,"NSM"],[3633,3633,"NSM"],[3636,3642,"NSM"],[3647,3647,"ET"],[3655,3662,"NSM"],[3761,3761,"NSM"],[3764,3772,"NSM"],[3784,3790,"NSM"],[3864,3865,"NSM"],[3893,3893,"NSM"],[3895,3895,"NSM"],[3897,3897,"NSM"],[3898,3901,"ON"],[3953,3966,"NSM"],[3968,3972,"NSM"],[3974,3975,"NSM"],[3981,3991,"NSM"],[3993,4028,"NSM"],[4038,4038,"NSM"],[4141,4144,"NSM"],[4146,4151,"NSM"],[4153,4154,"NSM"],[4157,4158,"NSM"],[4184,4185,"NSM"],[4190,4192,"NSM"],[4209,4212,"NSM"],[4226,4226,"NSM"],[4229,4230,"NSM"],[4237,4237,"NSM"],[4253,4253,"NSM"],[4957,4959,"NSM"],[5008,5017,"ON"],[5120,5120,"ON"],[5760,5760,"WS"],[5787,5788,"ON"],[5906,5908,"NSM"],[5938,5939,"NSM"],[5970,5971,"NSM"],[6002,6003,"NSM"],[6068,6069,"NSM"],[6071,6077,"NSM"],[6086,6086,"NSM"],[6089,6099,"NSM"],[6107,6107,"ET"],[6109,6109,"NSM"],[6128,6137,"ON"],[6144,6154,"ON"],[6155,6157,"NSM"],[6158,6158,"BN"],[6159,6159,"NSM"],[6277,6278,"NSM"],[6313,6313,"NSM"],[6432,6434,"NSM"],[6439,6440,"NSM"],[6450,6450,"NSM"],[6457,6459,"NSM"],[6464,6464,"ON"],[6468,6469,"ON"],[6622,6655,"ON"],[6679,6680,"NSM"],[6683,6683,"NSM"],[6742,6742,"NSM"],[6744,6750,"NSM"],[6752,6752,"NSM"],[6754,6754,"NSM"],[6757,6764,"NSM"],[6771,6780,"NSM"],[6783,6783,"NSM"],[6832,6877,"NSM"],[6880,6891,"NSM"],[6912,6915,"NSM"],[6964,6964,"NSM"],[6966,6970,"NSM"],[6972,6972,"NSM"],[6978,6978,"NSM"],[7019,7027,"NSM"],[7040,7041,"NSM"],[7074,7077,"NSM"],[7080,7081,"NSM"],[7083,7085,"NSM"],[7142,7142,"NSM"],[7144,7145,"NSM"],[7149,7149,"NSM"],[7151,7153,"NSM"],[7212,7219,"NSM"],[7222,7223,"NSM"],[7376,7378,"NSM"],[7380,7392,"NSM"],[7394,7400,"NSM"],[7405,7405,"NSM"],[7412,7412,"NSM"],[7416,7417,"NSM"],[7616,7679,"NSM"],[8125,8125,"ON"],[8127,8129,"ON"],[8141,8143,"ON"],[8157,8159,"ON"],[8173,8175,"ON"],[8189,8190,"ON"],[8192,8202,"WS"],[8203,8205,"BN"],[8207,8207,"R"],[8208,8231,"ON"],[8232,8232,"WS"],[8233,8233,"B"],[8234,8238,"BN"],[8239,8239,"CS"],[8240,8244,"ET"],[8245,8259,"ON"],[8260,8260,"CS"],[8261,8286,"ON"],[8287,8287,"WS"],[8288,8303,"BN"],[8304,8304,"EN"],[8308,8313,"EN"],[8314,8315,"ES"],[8316,8318,"ON"],[8320,8329,"EN"],[8330,8331,"ES"],[8332,8334,"ON"],[8352,8399,"ET"],[8400,8432,"NSM"],[8448,8449,"ON"],[8451,8454,"ON"],[8456,8457,"ON"],[8468,8468,"ON"],[8470,8472,"ON"],[8478,8483,"ON"],[8485,8485,"ON"],[8487,8487,"ON"],[8489,8489,"ON"],[8494,8494,"ET"],[8506,8507,"ON"],[8512,8516,"ON"],[8522,8525,"ON"],[8528,8543,"ON"],[8585,8587,"ON"],[8592,8721,"ON"],[8722,8722,"ES"],[8723,8723,"ET"],[8724,9013,"ON"],[9083,9108,"ON"],[9110,9257,"ON"],[9280,9290,"ON"],[9312,9351,"ON"],[9352,9371,"EN"],[9450,9899,"ON"],[9901,10239,"ON"],[10496,11123,"ON"],[11126,11263,"ON"],[11493,11498,"ON"],[11503,11505,"NSM"],[11513,11519,"ON"],[11647,11647,"NSM"],[11744,11775,"NSM"],[11776,11869,"ON"],[11904,11929,"ON"],[11931,12019,"ON"],[12032,12245,"ON"],[12272,12287,"ON"],[12288,12288,"WS"],[12289,12292,"ON"],[12296,12320,"ON"],[12330,12333,"NSM"],[12336,12336,"ON"],[12342,12343,"ON"],[12349,12351,"ON"],[12441,12442,"NSM"],[12443,12444,"ON"],[12448,12448,"ON"],[12539,12539,"ON"],[12736,12773,"ON"],[12783,12783,"ON"],[12829,12830,"ON"],[12880,12895,"ON"],[12924,12926,"ON"],[12977,12991,"ON"],[13004,13007,"ON"],[13175,13178,"ON"],[13278,13279,"ON"],[13311,13311,"ON"],[19904,19967,"ON"],[42128,42182,"ON"],[42509,42511,"ON"],[42607,42610,"NSM"],[42611,42611,"ON"],[42612,42621,"NSM"],[42622,42623,"ON"],[42654,42655,"NSM"],[42736,42737,"NSM"],[42752,42785,"ON"],[42888,42888,"ON"],[43010,43010,"NSM"],[43014,43014,"NSM"],[43019,43019,"NSM"],[43045,43046,"NSM"],[43048,43051,"ON"],[43052,43052,"NSM"],[43064,43065,"ET"],[43124,43127,"ON"],[43204,43205,"NSM"],[43232,43249,"NSM"],[43263,43263,"NSM"],[43302,43309,"NSM"],[43335,43345,"NSM"],[43392,43394,"NSM"],[43443,43443,"NSM"],[43446,43449,"NSM"],[43452,43453,"NSM"],[43493,43493,"NSM"],[43561,43566,"NSM"],[43569,43570,"NSM"],[43573,43574,"NSM"],[43587,43587,"NSM"],[43596,43596,"NSM"],[43644,43644,"NSM"],[43696,43696,"NSM"],[43698,43700,"NSM"],[43703,43704,"NSM"],[43710,43711,"NSM"],[43713,43713,"NSM"],[43756,43757,"NSM"],[43766,43766,"NSM"],[43882,43883,"ON"],[44005,44005,"NSM"],[44008,44008,"NSM"],[44013,44013,"NSM"],[64285,64285,"R"],[64286,64286,"NSM"],[64287,64296,"R"],[64297,64297,"ES"],[64298,64335,"R"],[64336,64450,"AL"],[64451,64466,"ON"],[64467,64829,"AL"],[64830,64847,"ON"],[64848,64911,"AL"],[64912,64913,"ON"],[64914,64967,"AL"],[64968,64975,"ON"],[64976,65007,"BN"],[65008,65020,"AL"],[65021,65023,"ON"],[65024,65039,"NSM"],[65040,65049,"ON"],[65056,65071,"NSM"],[65072,65103,"ON"],[65104,65104,"CS"],[65105,65105,"ON"],[65106,65106,"CS"],[65108,65108,"ON"],[65109,65109,"CS"],[65110,65118,"ON"],[65119,65119,"ET"],[65120,65121,"ON"],[65122,65123,"ES"],[65124,65126,"ON"],[65128,65128,"ON"],[65129,65130,"ET"],[65131,65131,"ON"],[65136,65278,"AL"],[65279,65279,"BN"],[65281,65282,"ON"],[65283,65285,"ET"],[65286,65290,"ON"],[65291,65291,"ES"],[65292,65292,"CS"],[65293,65293,"ES"],[65294,65295,"CS"],[65296,65305,"EN"],[65306,65306,"CS"],[65307,65312,"ON"],[65339,65344,"ON"],[65371,65381,"ON"],[65504,65505,"ET"],[65506,65508,"ON"],[65509,65510,"ET"],[65512,65518,"ON"],[65520,65528,"BN"],[65529,65533,"ON"],[65534,65535,"BN"],[65793,65793,"ON"],[65856,65932,"ON"],[65936,65948,"ON"],[65952,65952,"ON"],[66045,66045,"NSM"],[66272,66272,"NSM"],[66273,66299,"EN"],[66422,66426,"NSM"],[67584,67870,"R"],[67871,67871,"ON"],[67872,68096,"R"],[68097,68099,"NSM"],[68100,68100,"R"],[68101,68102,"NSM"],[68103,68107,"R"],[68108,68111,"NSM"],[68112,68151,"R"],[68152,68154,"NSM"],[68155,68158,"R"],[68159,68159,"NSM"],[68160,68324,"R"],[68325,68326,"NSM"],[68327,68408,"R"],[68409,68415,"ON"],[68416,68863,"R"],[68864,68899,"AL"],[68900,68903,"NSM"],[68904,68911,"AL"],[68912,68921,"AN"],[68922,68927,"AL"],[68928,68937,"AN"],[68938,68968,"R"],[68969,68973,"NSM"],[68974,68974,"ON"],[68975,69215,"R"],[69216,69246,"AN"],[69247,69290,"R"],[69291,69292,"NSM"],[69293,69311,"R"],[69312,69327,"AL"],[69328,69336,"ON"],[69337,69369,"AL"],[69370,69375,"NSM"],[69376,69423,"R"],[69424,69445,"AL"],[69446,69456,"NSM"],[69457,69487,"AL"],[69488,69505,"R"],[69506,69509,"NSM"],[69510,69631,"R"],[69633,69633,"NSM"],[69688,69702,"NSM"],[69714,69733,"ON"],[69744,69744,"NSM"],[69747,69748,"NSM"],[69759,69761,"NSM"],[69811,69814,"NSM"],[69817,69818,"NSM"],[69826,69826,"NSM"],[69888,69890,"NSM"],[69927,69931,"NSM"],[69933,69940,"NSM"],[70003,70003,"NSM"],[70016,70017,"NSM"],[70070,70078,"NSM"],[70089,70092,"NSM"],[70095,70095,"NSM"],[70191,70193,"NSM"],[70196,70196,"NSM"],[70198,70199,"NSM"],[70206,70206,"NSM"],[70209,70209,"NSM"],[70367,70367,"NSM"],[70371,70378,"NSM"],[70400,70401,"NSM"],[70459,70460,"NSM"],[70464,70464,"NSM"],[70502,70508,"NSM"],[70512,70516,"NSM"],[70587,70592,"NSM"],[70606,70606,"NSM"],[70608,70608,"NSM"],[70610,70610,"NSM"],[70625,70626,"NSM"],[70712,70719,"NSM"],[70722,70724,"NSM"],[70726,70726,"NSM"],[70750,70750,"NSM"],[70835,70840,"NSM"],[70842,70842,"NSM"],[70847,70848,"NSM"],[70850,70851,"NSM"],[71090,71093,"NSM"],[71100,71101,"NSM"],[71103,71104,"NSM"],[71132,71133,"NSM"],[71219,71226,"NSM"],[71229,71229,"NSM"],[71231,71232,"NSM"],[71264,71276,"ON"],[71339,71339,"NSM"],[71341,71341,"NSM"],[71344,71349,"NSM"],[71351,71351,"NSM"],[71453,71453,"NSM"],[71455,71455,"NSM"],[71458,71461,"NSM"],[71463,71467,"NSM"],[71727,71735,"NSM"],[71737,71738,"NSM"],[71995,71996,"NSM"],[71998,71998,"NSM"],[72003,72003,"NSM"],[72148,72151,"NSM"],[72154,72155,"NSM"],[72160,72160,"NSM"],[72193,72198,"NSM"],[72201,72202,"NSM"],[72243,72248,"NSM"],[72251,72254,"NSM"],[72263,72263,"NSM"],[72273,72278,"NSM"],[72281,72283,"NSM"],[72330,72342,"NSM"],[72344,72345,"NSM"],[72544,72544,"NSM"],[72546,72548,"NSM"],[72550,72550,"NSM"],[72752,72758,"NSM"],[72760,72765,"NSM"],[72850,72871,"NSM"],[72874,72880,"NSM"],[72882,72883,"NSM"],[72885,72886,"NSM"],[73009,73014,"NSM"],[73018,73018,"NSM"],[73020,73021,"NSM"],[73023,73029,"NSM"],[73031,73031,"NSM"],[73104,73105,"NSM"],[73109,73109,"NSM"],[73111,73111,"NSM"],[73459,73460,"NSM"],[73472,73473,"NSM"],[73526,73530,"NSM"],[73536,73536,"NSM"],[73538,73538,"NSM"],[73562,73562,"NSM"],[73685,73692,"ON"],[73693,73696,"ET"],[73697,73713,"ON"],[78912,78912,"NSM"],[78919,78933,"NSM"],[90398,90409,"NSM"],[90413,90415,"NSM"],[92912,92916,"NSM"],[92976,92982,"NSM"],[94031,94031,"NSM"],[94095,94098,"NSM"],[94178,94178,"ON"],[94180,94180,"NSM"],[113821,113822,"NSM"],[113824,113827,"BN"],[117760,117973,"ON"],[118e3,118009,"EN"],[118010,118012,"ON"],[118016,118451,"ON"],[118458,118480,"ON"],[118496,118512,"ON"],[118528,118573,"NSM"],[118576,118598,"NSM"],[119143,119145,"NSM"],[119155,119162,"BN"],[119163,119170,"NSM"],[119173,119179,"NSM"],[119210,119213,"NSM"],[119273,119274,"ON"],[119296,119361,"ON"],[119362,119364,"NSM"],[119365,119365,"ON"],[119552,119638,"ON"],[120513,120513,"ON"],[120539,120539,"ON"],[120571,120571,"ON"],[120597,120597,"ON"],[120629,120629,"ON"],[120655,120655,"ON"],[120687,120687,"ON"],[120713,120713,"ON"],[120745,120745,"ON"],[120771,120771,"ON"],[120782,120831,"EN"],[121344,121398,"NSM"],[121403,121452,"NSM"],[121461,121461,"NSM"],[121476,121476,"NSM"],[121499,121503,"NSM"],[121505,121519,"NSM"],[122880,122886,"NSM"],[122888,122904,"NSM"],[122907,122913,"NSM"],[122915,122916,"NSM"],[122918,122922,"NSM"],[123023,123023,"NSM"],[123184,123190,"NSM"],[123566,123566,"NSM"],[123628,123631,"NSM"],[123647,123647,"ET"],[124140,124143,"NSM"],[124398,124399,"NSM"],[124643,124643,"NSM"],[124646,124646,"NSM"],[124654,124655,"NSM"],[124661,124661,"NSM"],[124928,125135,"R"],[125136,125142,"NSM"],[125143,125251,"R"],[125252,125258,"NSM"],[125259,126063,"R"],[126064,126143,"AL"],[126144,126207,"R"],[126208,126287,"AL"],[126288,126463,"R"],[126464,126703,"AL"],[126704,126705,"ON"],[126706,126719,"AL"],[126720,126975,"R"],[126976,127019,"ON"],[127024,127123,"ON"],[127136,127150,"ON"],[127153,127167,"ON"],[127169,127183,"ON"],[127185,127221,"ON"],[127232,127242,"EN"],[127243,127247,"ON"],[127279,127279,"ON"],[127338,127343,"ON"],[127405,127405,"ON"],[127584,127589,"ON"],[127744,128728,"ON"],[128732,128748,"ON"],[128752,128764,"ON"],[128768,128985,"ON"],[128992,129003,"ON"],[129008,129008,"ON"],[129024,129035,"ON"],[129040,129095,"ON"],[129104,129113,"ON"],[129120,129159,"ON"],[129168,129197,"ON"],[129200,129211,"ON"],[129216,129217,"ON"],[129232,129240,"ON"],[129280,129623,"ON"],[129632,129645,"ON"],[129648,129660,"ON"],[129664,129674,"ON"],[129678,129734,"ON"],[129736,129736,"ON"],[129741,129756,"ON"],[129759,129770,"ON"],[129775,129784,"ON"],[129792,129938,"ON"],[129940,130031,"ON"],[130032,130041,"EN"],[130042,130042,"ON"],[131070,131071,"BN"],[196606,196607,"BN"],[262142,262143,"BN"],[327678,327679,"BN"],[393214,393215,"BN"],[458750,458751,"BN"],[524286,524287,"BN"],[589822,589823,"BN"],[655358,655359,"BN"],[720894,720895,"BN"],[786430,786431,"BN"],[851966,851967,"BN"],[917502,917759,"BN"],[917760,917999,"NSM"],[918e3,921599,"BN"],[983038,983039,"BN"],[1048574,1048575,"BN"],[1114110,1114111,"BN"]];function xy(e){if(e<=255)return Vf[e];let t=0,n=ss.length-1;for(;t<=n;){let r=t+n>>1,i=ss[r];if(ei[1]){t=r+1;continue}return i[2]}return"L"}function yy(e){let t=e.length;if(t===0)return null;let n=new Array(t),r=!1;for(let u=0;u=55296&&c<=56319&&u+1=56320&&b<=57343&&(f=(c-55296<<10)+(b-56320)+65536,m=2)}let p=xy(f);(p==="R"||p==="AL"||p==="AN")&&(r=!0);for(let b=0;b=0&&n[c]==="ET";c--)n[c]="EN";for(c=u+1;c0?n[u-1]:l,m=c0&&t.charCodeAt(t.length-1)===32&&(t=t.slice(0,-1)),t}function wy(e){return/[\r\f]/.test(e)?e.replace(/\r\n/g,` `).replace(/[\r\f]/g,` `):e.replace(/\r\n/g,` `)}var ls=null,Cy;function _y(){return ls===null&&(ls=new Intl.Segmenter(Cy,{granularity:"word"})),ls}var Ty=/\p{Script=Arabic}/u,Mi=/\p{M}/u,Qf=/\p{Nd}/u;function qf(e){return Ty.test(e)}function $f(e){return e>=19968&&e<=40959||e>=13312&&e<=19903||e>=131072&&e<=173791||e>=173824&&e<=177983||e>=177984&&e<=178207||e>=178208&&e<=183983||e>=183984&&e<=191471||e>=191472&&e<=192093||e>=194560&&e<=195103||e>=196608&&e<=201551||e>=201552&&e<=205743||e>=205744&&e<=210041||e>=63744&&e<=64255||e>=12288&&e<=12351||e>=12352&&e<=12447||e>=12448&&e<=12543||e>=44032&&e<=55215||e>=65280&&e<=65519}function Ve(e){for(let t=0;t=55296&&n<=56319&&t+1=56320&&r<=57343){let i=(n-55296<<10)+(r-56320)+65536;if($f(i))return!0;t++;continue}}if($f(n))return!0}}return!1}function Ry(e){let t=Li(e);return t!==null&&(Ni.has(t)||vt.has(t))}var ky=new Set(["\xA0","\u202F","\u2060","\uFEFF"]);function My(e){return Ve(e)}function Fy(e){let t=Li(e);return t!==null&&ky.has(t)}function Fi(e){return!Ry(e)&&!Fy(e)}var Ni=new Set(["\uFF0C","\uFF0E","\uFF01","\uFF1A","\uFF1B","\uFF1F","\u3001","\u3002","\u30FB","\uFF09","\u3015","\u3009","\u300B","\u300D","\u300F","\u3011","\u3017","\u3019","\u301B","\u30FC","\u3005","\u303B","\u309D","\u309E","\u30FD","\u30FE"]),hr=new Set(['"',"(","[","{","\u201C","\u2018","\xAB","\u2039","\uFF08","\u3014","\u3008","\u300A","\u300C","\u300E","\u3010","\u3016","\u3018","\u301A"]),cs=new Set(["'","\u2019"]),vt=new Set([".",",","!","?",":",";","\u060C","\u061B","\u061F","\u0964","\u0965","\u104A","\u104B","\u104C","\u104D","\u104F",")","]","}","%",'"',"\u201D","\u2019","\xBB","\u203A","\u2026"]),Ny=new Set([":",".","\u060C","\u061B"]),Ly=new Set(["\u104F"]),Dy=new Set(["\u201D","\u2019","\xBB","\u203A","\u300D","\u300F","\u3011","\u300B","\u3009","\u3015","\uFF09"]);function Iy(e){if(ds(e))return!0;let t=!1;for(let n of e){if(vt.has(n)){t=!0;continue}if(!(t&&Mi.test(n)))return!1}return t}function Py(e){for(let t of e)if(!Ni.has(t)&&!vt.has(t))return!1;return e.length>0}function Oy(e){if(ds(e))return!0;for(let t of e)if(!hr.has(t)&&!cs.has(t)&&!Mi.test(t))return!1;return e.length>0}function ds(e){let t=!1;for(let n of e)if(!(n==="\\"||Mi.test(n))){if(hr.has(n)||vt.has(n)||cs.has(n)){t=!0;continue}return!1}return t}function Zf(e,t){let n=t-1;if(n<=0)return Math.max(n,0);let r=e.charCodeAt(n);if(r<56320||r>57343)return n;let i=n-1;if(i<0)return n;let o=e.charCodeAt(i);return o>=55296&&o<=56319?i:n}function Li(e){if(e.length===0)return null;let t=Zf(e,e.length);return e.slice(t)}function Hy(e){let t=Array.from(e),n=t.length;for(;n>0;){let r=t[n-1];if(Mi.test(r)){n--;continue}if(hr.has(r)||cs.has(r)){n--;continue}break}return n<=0||n===t.length?null:{head:t.slice(0,n).join(""),tail:t.slice(n).join("")}}function Gy(e,t,n){return n==="text"&&!t&&e.length===1&&e!=="-"&&e!=="\u2014"?e:null}function jf(e,t,n,r){let i=t[r],o=e[r];if(i==null)return o;let a=n[r];if(o.length===a)return o;let l=i.repeat(a);return e[r]=l,l}function Kf(e,t){return e&&t!==null&&Ny.has(t)}function By(e){let t=Li(e);return t!==null&&Ly.has(t)}function Uy(e){if(e.length<2||e[0]!==" ")return null;let t=e.slice(1);return/^\p{M}+$/u.test(t)?{space:" ",marks:t}:null}function Di(e){let t=e.length;for(;t>0;){let n=Zf(e,t),r=e.slice(n,t);if(Dy.has(r))return!0;if(!vt.has(r))return!1;t=n}return!1}function Wy(e,t){if(t.preserveOrdinarySpaces||t.preserveHardBreaks){if(e===" ")return"preserved-space";if(e===" ")return"tab";if(t.preserveHardBreaks&&e===` diff --git a/dist/hyperframe.manifest.json b/dist/hyperframe.manifest.json index dc6cbc02be524d13958b47daaad9443c9984edf6..f454eaa745f47cdd9a31332d6fec1d2d79538dba 100644 --- a/dist/hyperframe.manifest.json +++ b/dist/hyperframe.manifest.json @@ -1,7 +1,7 @@ { "version": "0.1.0", "buildId": "dev", - "sha256": "3879d9512120d1e2de8d00aefc19070a29901d027d85c24250ef4b5712f7ed65", + "sha256": "6a2542a51e85a5c1bf89952695b5e81fb990dc8b683417dabb291008733dc851", "artifacts": { "iife": "hyperframe.runtime.iife.js", "esm": "hyperframe.runtime.mjs" diff --git a/dist/hyperframe.runtime.iife.js b/dist/hyperframe.runtime.iife.js index d3b084c4768ab07fb79dbd03e720ff77c6744126..0a337c2c4641c81559e1a756f85f69b8b6208f6f 100644 --- a/dist/hyperframe.runtime.iife.js +++ b/dist/hyperframe.runtime.iife.js @@ -701,7 +701,7 @@ class HfPitchshift extends AudioWorkletProcessor { } } registerProcessor("hf-pitchshift", HfPitchshift); -`,$a=new WeakMap;function ja(e){return lf.has(e)}var lf=new WeakSet;function Ka(e){let t=$a.get(e);return t||(t=(async()=>{if(!e.audioWorklet)throw new Error("AudioWorklet is unavailable \u2014 the page needs a secure context (https, localhost or file://)");let n=`data:text/javascript;base64,${btoa(String.fromCharCode(...new TextEncoder().encode(Ox)))}`;await e.audioWorklet.addModule(n),lf.add(e)})().catch(n=>{throw $a.delete(e),n}),$a.set(e,t)),t}function Hx(e,t,n){let r=.6+Math.max(0,Math.min(1,t))*2.6,i=Math.max(1,Math.floor(e*r)),o=new Float32Array(i),a=Math.round(t*1e3)*2654435761+Math.round(n*1e3)*40503>>>0,l=()=>(a=a*1664525+1013904223>>>0,a/4294967295*2-1),s=Math.max(.001,1-Math.max(0,Math.min(1,n))),u=0,c=0;for(let m=0;m0)for(let m=0;mtypeof e=="number"?e:Number(e??0),Ya=e=>e/1e3;function ff(e,t,n,r){let i=Math.max(1,Math.round(e.sampleRate)),o=e.createBuffer(1,i,e.sampleRate),a=o.getChannelData(0);for(let u=0;u1-n}]}function pf(e,t,n){e.gain.value=n,t.gain.value=1-n}function Ja(e,t,n){return{input:e,output:e,update:t,automation:n,dispose:()=>e.disconnect()}}var Gx=new Set(["peaking","highpass","lowpass"]),uf=e=>Math.pow(10,e/20),Bx=(e,t)=>{let n=e.createGain(),r=i=>{n.gain.value=uf(de(i.gain))};return r(t),Ja(n,r,{gain:[{param:n.gain,map:uf}]})};function ur(e,t){return(n,r)=>{let i=n.createBiquadFilter();i.type=e;let o=a=>{i.frequency.value=de(a.frequency),a.q!==void 0&&(i.Q.value=de(a.q)),t&&(i.gain.value=de(a.gain))};return o(r),Ja(i,o,{frequency:[{param:i.frequency}],...Gx.has(e)?{q:[{param:i.Q}]}:{},...t?{gain:[{param:i.gain}]}:{}})}}function Ux(e){return(t,n)=>{let r=Math.tan(Math.PI*de(n.frequency)/t.sampleRate),i=e==="highpass"?t.createIIRFilter([1/(1+r),-1/(1+r)],[1,(r-1)/(r+1)]):t.createIIRFilter([r/(1+r),r/(1+r)],[1,(r-1)/(r+1)]);return Ja(i,()=>{})}}function cr(e){return(t,n)=>{let r=new AudioWorkletNode(t,e,{processorOptions:{...n}});return{input:r,output:r,update:i=>r.port.postMessage({...i}),dispose:()=>{r.port.postMessage({__hfDispose:!0}),r.disconnect()}}}}var Wx={tanh:Math.tanh,atan:e=>2/Math.PI*Math.atan(Math.PI/2*e),cubic:e=>Math.abs(e)>=1?Math.sign(e):e-e**3/3,exp:e=>Math.sign(e)*(1-Math.exp(-Math.abs(e))),alg:e=>e/Math.sqrt(1+e*e),quintic:e=>Math.abs(e)>=1?Math.sign(e):e-e**5/5,sin:e=>Math.abs(e)>=1?Math.sign(e):Math.sin(Math.PI/2*e),erf:e=>Math.tanh(1.20211*e),hard:e=>Math.max(-1,Math.min(1,e))},Vx=(e,t)=>{let n=e.createWaveShaper(),r=e.createGain(),i=e.createGain();r.connect(n).connect(i);let o=a=>{let l=Wx[String(a.type)]??Math.tanh,s=Math.pow(10,de(a.threshold)/20),u=8192,c=new Float32Array(u);for(let f=0;f=4?"4x":de(a.oversample)>=2?"2x":"none",i.gain.value=Math.pow(10,de(a.output)/20)};return o(t),{input:r,output:i,update:o,automation:{output:[{param:i.gain,map:a=>Math.pow(10,a/20)}]},dispose:()=>{r.disconnect(),n.disconnect(),i.disconnect()}}},zx=(e,t)=>{let n=e.createGain(),r=e.createGain(),i=e.createDelay(5),o=e.createGain(),a=e.createGain(),l=e.createGain();n.connect(i),i.connect(o),o.connect(i),i.connect(a).connect(r),n.connect(l).connect(r);let s=u=>{i.delayTime.value=Math.min(5,de(u.time)/1e3),o.gain.value=de(u.feedback),pf(a,l,de(u.mix))};return s(t),{input:n,output:r,update:s,automation:{time:[{param:i.delayTime,map:u=>Math.min(5,Ya(u))}],feedback:[{param:o.gain}],mix:Xa(a.gain,l.gain)},dispose:()=>[n,r,i,o,a,l].forEach(u=>u.disconnect())}},qx=(e,t,n)=>{let r=e.createGain(),i=e.createGain(),o=e.createDelay(.5),a=ff(e,"sine",de(t.speed),n),l=e.createGain(),s=e.createGain(),u=e.createGain();a.connect(l).connect(o.delayTime),r.connect(o).connect(s).connect(i),r.connect(u).connect(i);let c=f=>{o.delayTime.value=de(f.delay)/1e3,l.gain.value=de(f.depth)/1e3,a.playbackRate.value=de(f.speed),pf(s,u,de(f.mix))};return c(t),{input:r,output:i,update:c,automation:{delay:[{param:o.delayTime,map:Ya}],depth:[{param:l.gain,map:Ya}],speed:[{param:a.playbackRate}],mix:Xa(s.gain,u.gain)},dispose:()=>{mf(a),[r,i,o,l,s,u].forEach(f=>f.disconnect())}}},$x=6,jx=(e,t,n)=>{let r=e.createGain(),i=e.createGain(),o=e.createGain(),a=e.createGain(),l=ff(e,String(t.type)==="1"?"sine":"triangle",de(t.speed),n),s=e.createGain(),u=e.createGain(),c=e.createGain(),f=[];r.connect(o);let m=o;for(let b=0;b<$x;b++){let v=e.createBiquadFilter();v.type="allpass",v.Q.value=.7071,s.connect(v.frequency),m.connect(v),m=v,f.push(v)}l.connect(s),m.connect(u).connect(a),o.connect(c).connect(a),a.connect(i);let p=b=>{let v=1e3/Math.max(.1,de(b.delay));for(let x of f)x.frequency.value=v;s.gain.value=v*de(b.decay),l.playbackRate.value=de(b.speed),o.gain.value=de(b.in_gain),a.gain.value=de(b.out_gain),u.gain.value=1,c.gain.value=1};return p(t),{input:r,output:i,update:p,automation:{speed:[{param:l.playbackRate}],in_gain:[{param:o.gain}],out_gain:[{param:a.gain}]},dispose:()=>{mf(l),[r,i,o,a,s,u,c,...f].forEach(b=>b.disconnect())}}},Kx=(e,t)=>{let n=e.createGain(),r=e.createGain(),i=e.createConvolver(),o=e.createGain(),a=e.createGain();i.normalize=!1,n.connect(i).connect(o).connect(r),n.connect(a).connect(r);let l="",s=u=>{let c=`${de(u.size)}:${de(u.damping)}`;if(c!==l){let f=Hx(e.sampleRate,de(u.size),de(u.damping)),m=e.createBuffer(1,f.length,e.sampleRate);m.getChannelData(0).set(f),i.buffer=m,l=c}o.gain.value=de(u.wet),a.gain.value=de(u.dry)};return s(t),{input:n,output:r,update:s,automation:{wet:[{param:o.gain}],dry:[{param:a.gain}]},dispose:()=>[n,r,i,o,a].forEach(u=>u.disconnect())}},Yx={"gain-node":Bx,"biquad-peaking":ur("peaking",!0),"biquad-lowshelf":ur("lowshelf",!0),"biquad-highshelf":ur("highshelf",!0),"biquad-highpass":ur("highpass",!1),"biquad-lowpass":ur("lowpass",!1),"worklet-compressor":cr("hf-compressor"),"worklet-limiter":cr("hf-limiter"),"worklet-gate":cr("hf-gate"),"worklet-bitcrush":cr("hf-bitcrush"),"worklet-pitchshift":cr("hf-pitchshift"),waveshaper:Vx,"delay-feedback":zx,"chorus-lfo":qx,"allpass-phaser":jx,convolver:Kx};function hf(e){return e.nodes.some(t=>Sn(t.type)?.web.startsWith("worklet-")??!1)}function Xx(e,t,n,r=0){let i=Sn(t);if(!i)throw new Error(`Unknown effect type: ${t}`);let o=An(t,n);if((t==="highpass"||t==="lowpass")&&String(o.poles)==="1")return Ux(t)(e,o,r);let a=Yx[i.web];if(!a)throw new Error(`No Web Audio builder for ${i.web}`);return a(e,o,r)}function cf(e){let t=[];for(let n of e){let r=n.fromPreset,i=t.at(-1);if(i&&i.preset===r)i.nodes.push(n);else{let o=typeof n.presetAmount=="number"?n.presetAmount:1;t.push({...r?{preset:r}:{},amount:Math.min(1,Math.max(0,o)),nodes:[n]})}}return t}function df(e){return En(e).map(t=>{let n=An(t.type,t.params),r=n.poles!==void 0?`:${n.poles}`:"",i=String(n.poles)==="1"?`@${n.frequency}`:"",o=t.type==="phaser"?`~${n.type}`:"",a=t.fromPreset?`%${t.fromPreset}`:"";return`${t.type}${r}${i}${o}${a}`}).join("|")}function gf(e,t,n=0){var f;let r=e.createGain(),i=e.createGain(),o=[],a=[],l=cf(En(t)),s=r;for(let m of l){let p=null;if(m.preset){let b=e.createGain(),v=e.createGain(),x=e.createGain(),_=e.createGain();x.gain.value=m.amount,v.gain.value=1-m.amount,s.connect(b),b.connect(v).connect(_),p={entry:b,wet:x,dry:v,join:_},s=b}for(let b of m.nodes){let v=Xx(e,b.type,b.params??{},n);s.connect(v.input),s=v.output,o.push({...b.id?{id:b.id}:{},type:b.type,handle:v})}p&&m.preset&&(s.connect(p.wet).connect(p.join),a.push({id:m.preset,...p}),s=p.join)}s.connect(i);let u=df(t),c={};for(let m of a)(c[f=m.id]??(c[f]=[])).push(...Xa(m.wet.gain,m.dry.gain));return{input:r,output:i,presets:c,nodes:o,update(m){if(df(m)!==u)return!1;En(m).forEach((b,v)=>{let x=o[v];x&&(x.handle.update(An(b.type,b.params)),b.id===void 0?delete x.id:x.id=b.id)});let p=0;for(let b of cf(En(m))){if(!b.preset)continue;let v=a[p++];!v||v.id!==b.preset||(v.wet.gain.value=b.amount,v.dry.gain.value=1-b.amount)}return!0},dispose(){for(let{handle:m}of o)m.dispose();for(let{entry:m,wet:p,dry:b,join:v}of a)m.disconnect(),p.disconnect(),b.disconnect(),v.disconnect();r.disconnect(),i.disconnect()}}}var bf={version:1,nodes:[]},xf={version:1,lanes:[]};function yf(e,t){let n=(typeof e.getAttribute=="function"?e.getAttribute(et):null)??"";if(!n)return xf;try{return Fl(Or(n),t)}catch{return xf}}function on(e){let t=(typeof e.getAttribute=="function"?e.getAttribute(Tt):null)??"";if(!t)return{chain:bf,raw:""};try{return{chain:Rl(t),raw:t}}catch{return{chain:bf,raw:""}}}function vf(e){return yf(e,on(e).chain)}function wi(e,t,n,r,i){let{chain:o}=on(t),a=null,l=[],s=!1,u=0,c=()=>{try{a?(n.disconnect(a.input),a.output.disconnect(r),a.dispose()):n.disconnect(r)}catch{}a=null},f=(T,M)=>{if(T.nodes.length===0){n.connect(r);return}if(hf(T)&&!ja(e)){n.connect(r);let D=++u;Ka(e).then(()=>{s||D!==u||x(on(t).chain)}).catch(()=>{});return}try{let D=gf(e,T,M);n.connect(D.input),D.output.connect(r),a=D}catch{n.connect(r)}},m=(T,M)=>{l=M&&a?af(yf(t,T),T,a.nodes,M,a.presets):[]},p=i?{...i}:null;f(o,p?.elapsed??0),m(o,p);let b=()=>{if(!p)return null;let T=typeof e.currentTime=="number"?e.currentTime:p.scheduledAt;return{scheduledAt:T,elapsed:p.elapsed+(T-p.scheduledAt)*p.rate,rate:p.rate}},v=T=>{let M=b();M&&(rn(l,M.scheduledAt),m(T,M))},x=T=>{let M=b();rn(l,M?.scheduledAt??0),c(),f(T,M?.elapsed??0),m(T,M)},_=null,R=t;return typeof MutationObserver<"u"&&typeof R?.nodeType=="number"&&(_=new MutationObserver(()=>{let T=on(t);l.length>0&&lr(l),!a||!a.update(T.chain)?x(T.chain):v(T.chain)}),_.observe(R,{attributes:!0,attributeFilter:[Tt,et]})),{reanchor:T=>{if(s)return;let M=b();M&&rn(l,M.scheduledAt),p={...T},m(on(t).chain,p)},setRate:T=>{let M=b();s||!M||!Number.isFinite(T)||T<=0||T===M.rate||(p={...M,rate:T},rn(l,M.scheduledAt),m(on(t).chain,p))},dispose:()=>{s=!0,_?.disconnect(),l.length>0&&rn(l,typeof e.currentTime=="number"?e.currentTime:0),a?.dispose()}}}var Sf="runtime_web_audio_bypass";function Qa(e,t){return typeof e.getAttribute=="function"?e.getAttribute(t):null}function dr(e,t){return Qa(e,t)!==null}function Jx(e){return dr(e,"crossorigin")?!0:e.crossOrigin!=null}function Qx(e){return typeof e.baseURI=="string"&&e.baseURI?e.baseURI:typeof document<"u"?document.baseURI:""}function Zx(e){let t=typeof e.currentSrc=="string"?e.currentSrc:"";if(t)return[t];let n=Qa(e,"src");if(n)return[n];if(typeof e.querySelectorAll!="function")return[];let r=[];for(let i of Array.from(e.querySelectorAll("source"))){let o=i.getAttribute("src");o&&r.push(o)}return r}function ey(e,t){if(typeof window>"u")return!1;let n;try{n=new URL(e,Qx(t))}catch{return!1}return n.protocol!=="http:"&&n.protocol!=="https:"||n.origin===window.location.origin?!1:!Jx(t)}function Ef(e){return(typeof e.currentSrc=="string"?e.currentSrc:"")?!0:dr(e,"src")}function an(e){for(let t of Zx(e))if(ey(t,e))return{kind:"decode-only",reason:"cross_origin_no_cors",asset:t};return{kind:"web-audio"}}function ty(e){let t=[];dr(e,Tt)&&t.push("fx-chain"),dr(e,et)&&t.push("automation"),dr(e,Gr)&&t.push("audio-group");let n=Number.parseFloat(Qa(e,"data-volume")??"");return Number.isFinite(n)&&n>1&&t.push("above-unity-gain"),t}function ny(){return typeof window<"u"&&!!window.__HF_EXPORT_RENDER_SEEK_CONFIG}var Af=new WeakSet;function sn(e,t){if(t.kind==="web-audio"||ny()||Af.has(e))return;let n=ty(e);Af.add(e);let r={asset:t.asset,reason:t.reason,lostProcessing:n,note:"cross-origin media without a `crossorigin` opt-in is silent through createMediaElementSource (Web Audio spec); using native playback instead"};be({source:"hf-preview",type:"diagnostic",code:Sf,details:r});let i=n.length>0?` Native playback cannot reproduce: ${n.join(", ")} \u2014 proxy or download the asset to a same-origin URL to keep it.`:"";console.info(`[hyperframes] ${Sf}: "${t.asset}" (${t.reason}): Web Audio capture withheld; the track plays through native HTMLMediaElement output.${i}`)}function Za(e){return!Number.isFinite(e)||e<=0?1:e}function wf(e){return Le(e)}function ry(e,t){t||e.paused||!Cr().__hfDebug||console.debug("[hyperframes] webAudioTransport claimed fallback-playing element:",e.currentSrc||e.getAttribute("src")||"")}function iy(e,t){let{elapsed:n,mediaStart:r,scheduledAt:i,globalRate:o,mediaRate:a,clipDuration:l}=t,s=Number.isFinite(l)&&l>0,u=l*a;if(n>=0){let f=n*a,m=u-f;return s&&m<=0?!1:(s?e.start(0,f+r,m):e.start(0,f+r),!0)}let c=-n/o;return s?e.start(i+c,r,u):e.start(i+c,r),!0}function Ci(e,t,n){let r=sf(vf(e));r&&qa([{param:t.gain}],r,Pr.scale,n)}function fr(e){return e.sourceKind==="buffer"}var _i=class{constructor(){ge(this,"_ctx",null);ge(this,"_bufferCache",new Map);ge(this,"_failedSrcs",new Set);ge(this,"_mediaElementSources",new WeakMap);ge(this,"_activeSources",[]);ge(this,"_masterGain",null);ge(this,"_masterVolume",1);ge(this,"_masterMuted",!1);ge(this,"_groups",new Map);ge(this,"_rateAnchorCtx",0);ge(this,"_rateAnchorComp",0);ge(this,"_rate",1);ge(this,"_paused",!0);ge(this,"_playGeneration",0)}async init(){try{return this._ctx=new AudioContext,this._masterGain=this._ctx.createGain(),this._masterGain.connect(this._ctx.destination),this.applyMasterGain(),!0}catch{return!1}}get context(){return this._ctx}getTime(){return!this._ctx||this._paused?-1:this._rateAnchorComp+(this._ctx.currentTime-this._rateAnchorCtx)*this._rate}async decodeAudioElement(t){let n=t.currentSrc||t.getAttribute("src");if(!n)return null;if(this._bufferCache.has(n))return this._bufferCache.get(n);if(this._failedSrcs.has(n)||!this._ctx)return null;let r;try{let i=await fetch(n,{cache:"no-store"});if(!i.ok)return L("webAudioTransport.fetch",new Error(`${i.status} ${n}`)),null;r=await i.arrayBuffer()}catch(i){return L("webAudioTransport.fetch",i),null}try{let i=await this._ctx.decodeAudioData(r);return this._bufferCache.set(n,i),i}catch(i){return this._failedSrcs.add(n),L("webAudioTransport.decode",i),null}}startGeneration(){return this._playGeneration+=1,this._playGeneration}currentGeneration(){return this._playGeneration}acquireMediaElementSource(t){let n=this._mediaElementSources.get(t);if(n){let o=an(t);if(o.kind!=="web-audio"){try{n.disconnect()}catch{}return this._mediaElementSources.delete(t),sn(t,o),null}return n}if(!this._ctx)return null;let r=an(t);if(r.kind!=="web-audio")return sn(t,r),null;let i=this._ctx.createMediaElementSource(t);return this._mediaElementSources.set(t,i),i}async scheduleMediaElementPlayback(t,n,r,i,o,a,l=1){if(!this._ctx||!this._masterGain||a!==this._playGeneration)return null;try{if(this._ctx.state==="suspended"&&await this._ctx.resume(),a!==this._playGeneration)return null;let s=this.acquireMediaElementSource(t);if(!s)return null;let u=Za(l),c=this._ctx.createGain();c.gain.value=o;let f=this._ctx.currentTime,m=i-n,p={scheduledAt:f,elapsed:m,rate:u},b=wi(this._ctx,t,s,c,p);c.connect(this.resolveDestination(t,f,i,u)??this._masterGain),Ci(t,c,p),this._rate=u,this._rateAnchorCtx=f,this._rateAnchorComp=i;let v={fx:b,el:t,sourceNode:s,sourceKind:"media-element",gainNode:c,compositionStart:n,mediaStart:r,scheduledAt:f,priorMuted:t.muted,priorVolume:t.volume,mediaPlaybackRate:_e(t),bounded:!1};return t.volume=1,this._activeSources.push(v),this._paused=!1,v}catch(s){return L("webAudioTransport.mediaElementSource",s),null}}groupInput(t,n,r){let i=this._groups.get(t);if(i){if(i.generation!==this._playGeneration)try{i.reanchor(r),i.generation=this._playGeneration}catch(m){L("webAudioTransport.groupReanchor",m)}return i.input}if(!this._ctx||!this._masterGain)return null;let o=this._ctx.createGain(),a=this._ctx.createGain();a.connect(this._masterGain);let l=()=>po(n,t),s=l(),u=this._ctx.createGain();u.gain.value=s?.hasAttribute("data-hidden")?0:1,u.connect(a);let c=this._ctx.createGain();c.gain.value=wf(mo(s)),c.connect(u);let f=wi(this._ctx,s??{getAttribute:()=>null},o,c,r);return s&&Ci(s,c,r),this._groups.set(t,{input:o,fader:c,muteGain:u,fx:f,generation:this._playGeneration,reanchor:m=>{lr([{param:c.gain}]);let p=l();c.gain.value=wf(mo(p)),u.gain.value=p?.hasAttribute("data-hidden")?0:1,f?.reanchor(m),p&&Ci(p,c,m)},dispose:()=>{try{f?.dispose(),o.disconnect(),c.disconnect(),u.disconnect(),a.disconnect()}catch{}}}),o}setGroupMuted(t,n){let r=this._groups.get(t);if(r)try{r.muteGain.gain.value=n?0:1}catch(i){L("webAudioTransport.setGroupMuted",i)}}resolveDestination(t,n,r,i){if(!this._masterGain)return null;let o=Il(t);if(!o)return this._masterGain;let a={scheduledAt:n,elapsed:r,rate:i};return this.groupInput(o,t.ownerDocument,a)??this._masterGain}handleSourceEnded(t,n,r,i){let o=this._activeSources.indexOf(n);if(o!==-1){this._activeSources.splice(o,1),r.muted=i;try{t.disconnect(),n.fx?.dispose(),n.gainNode.disconnect()}catch{}this._activeSources.length===0&&(this._paused=!0)}}async schedulePlayback(t,n,r,i,o,a,l,s=1,u=Number.POSITIVE_INFINITY){if(!this._ctx||!this._masterGain||l!==this._playGeneration)return null;try{if(this._ctx.state==="suspended"&&await this._ctx.resume(),l!==this._playGeneration)return null;let c=Za(s),f=_e(t),m=c*f,p=this._ctx.createBufferSource();p.buffer=n,p.playbackRate.value=m;let b=this._ctx.createGain();b.gain.value=a;let v=o-r,x=this._ctx.currentTime,_={scheduledAt:x,elapsed:v,rate:c},R=wi(this._ctx,t,p,b,_);if(b.connect(this.resolveDestination(t,x,o,c)??this._masterGain),Ci(t,b,_),this._rate=c,this._rateAnchorCtx=x,this._rateAnchorComp=o,!iy(p,{elapsed:v,mediaStart:i,scheduledAt:x,globalRate:c,mediaRate:f,clipDuration:u}))return p.disconnect(),R?.dispose(),b.disconnect(),null;let T=t.muted;t.muted=!0,ry(t,T);let M={fx:R,el:t,sourceNode:p,sourceKind:"buffer",gainNode:b,compositionStart:r,mediaStart:i,scheduledAt:x,priorMuted:T,priorVolume:t.volume,mediaPlaybackRate:f,bounded:Number.isFinite(u)&&u>0};return this._activeSources.push(M),this._paused=!1,p.addEventListener("ended",()=>this.handleSourceEnded(p,M,t,T)),M}catch(c){return L("webAudioTransport.schedule",c),null}}setRate(t){let n=Za(t);if(n===this._rate)return!1;this._ctx&&!this._paused&&(this._rateAnchorComp=this.getTime(),this._rateAnchorCtx=this._ctx.currentTime),this._rate=n;for(let r of this._activeSources)try{fr(r)&&(r.sourceNode.playbackRate.value=n*r.mediaPlaybackRate),r.fx?.setRate(n)}catch(i){L("webAudioTransport.setRate",i)}for(let r of this._groups.values())try{r.fx?.setRate(n)}catch(i){L("webAudioTransport.setRate.group",i)}return!0}hasBoundedActiveSources(){return this._activeSources.some(t=>fr(t)&&t.bounded)}stopAll(){for(let t of this._activeSources){try{fr(t)&&t.sourceNode.stop(),t.sourceNode.disconnect(),t.fx?.dispose(),t.gainNode.disconnect()}catch{}fr(t)?t.el.muted=t.priorMuted:t.el.volume=t.priorVolume}this._activeSources=[],this._paused=!0}setVolume(t){this._masterVolume=Math.max(0,Math.min(1,t)),this.applyMasterGain()}setElementVolume(t,n){let r=Le(n);for(let i of this._activeSources)if(i.el===t)try{i.sourceKind==="media-element"&&(i.el.volume=1),i.gainNode.gain.value=r}catch(o){L("webAudioTransport.setElementVolume",o)}}setMuted(t){this._masterMuted=t,this.applyMasterGain()}applyMasterGain(){this._masterGain&&(this._masterGain.gain.value=this._masterMuted?0:this._masterVolume)}isActive(){return this._activeSources.length>0&&!this._paused}ownsElement(t){return!this._paused&&this._activeSources.some(n=>n.el===t&&fr(n))}routesElement(t){return!this._paused&&this._activeSources.some(n=>n.el===t)}destroy(){this.stopAll();for(let t of this._groups.values())t.dispose();if(this._groups.clear(),this._bufferCache.clear(),this._failedSrcs.clear(),this._mediaElementSources=new WeakMap,this._ctx)try{this._ctx.close()}catch{}this._ctx=null,this._masterGain=null,this._masterVolume=1,this._masterMuted=!1}};var Cf="data-hf-studio-manual-edit-gesture";function _f(e){return!Number.isInteger(e.tick)||e.tick<=0||e.tick%60!==0?!1:!(e.isPlaying&&e.hasCapturedTimeline&&e.currentTimeSeconds<2)}var oy=/^\s*spring\(\s*([+-]?(?:\d+(?:\.\d*)?|\.\d+))\s*\)\s*$/;function Tf(e){return Math.max(0,Math.min(1,e))}function Rf(e){let t=oy.exec(e);if(!t)return null;let n=Number(t[1]);return Number.isFinite(n)?Tf(n):null}function kf(e,t){if(!Number.isFinite(e))return e;if(e<=0)return 0;if(e>=1)return 1;let n=Tf(t),r=12-n*6,i=Math.PI*2*(1+n*1.5),o=1-Math.exp(-r)*Math.cos(i);return(1-Math.exp(-r*e)*Math.cos(i*e))/o}var ay=/^\s*wiggle\(\s*(\d+)\s*,\s*(easeOut|easeInOut|anticipate|uniform)\s*(?:,\s*([+-]?(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+)?)\s*)?\)\s*$/,sy=Math.PI*2;function ly(e){let t=ay.exec(e);if(!t)return null;let n=Number(t[1]);if(!Number.isSafeInteger(n)||n<1)return null;let r=t[2];if(r!=="easeOut"&&r!=="easeInOut"&&r!=="anticipate"&&r!=="uniform")return null;if(t[3]===void 0)return{wiggles:n,type:r};let i=Number(t[3]);return!Number.isFinite(i)||i<0||i>1?null:{wiggles:n,type:r,amplitude:i}}function uy(e,t,n,r){if(!Number.isFinite(e))return e;if(e<=0)return 0;if(e>=1)return 1;let i=r??(n==="easeInOut"?.08:n==="uniform"?.14:n==="anticipate"?.12:.16),o=n==="easeInOut"?i*Math.sin(Math.PI*e):n==="uniform"?i:i*(1-e);return e+(n==="anticipate"?-1:1)*o*Math.sin(sy*t*e)}function Mf(e,t){let n=ly(e);if(!n)return null;let r=`${n.wiggles}:${n.type}:${n.amplitude??"default"}`,i=t?.get(r);if(i)return i;let o=a=>uy(a,n.wiggles,n.type,n.amplitude);return t?.set(r,o),o}var cy=24,Ff=e=>e>=1?1:0,dy=e=>e,Ti=String.raw`([+-]?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?)`,fy=new RegExp(String.raw`^\s*M\s*0\s*,\s*0\s+C\s*${Ti}\s*,\s*${Ti}\s+${Ti}\s*,\s*${Ti}\s+1\s*,\s*1\s*$`,"i");function Nf(e,t,n){let r=1-e;return 3*r*r*e*t+3*r*e*e*n+e*e*e}function my(e,t,n,r,i){if(!Number.isFinite(e))return e;if(e<=0)return 0;if(e>=1)return 1;let o=0,a=1;for(let l=0;l1?null:a=>my(a,n,r,i,o)}function hy(e,t){if(!e.startsWith("spring("))return null;let n=Rf(e);if(n===null)return null;let r=t.get(n);if(r)return r;let i=o=>kf(o,n);return t.set(n,i),i}function gy(e,t){if(!e.startsWith("custom(")||!e.endsWith(")"))return null;let n=e.slice(7,-1),r=t.get(n);if(r)return r;let i=py(n);return i&&t.set(n,i),i}function Lf(e){if(e.__hfCustomEaseInstalled)return!0;let t=e.parseEase;if(!t)return!1;let n=new Map,r=new Map,i=new Map,o=s=>typeof s!="string"?null:s==="hold"?Ff:Mf(s,i)??hy(s,r)??gy(s,n),a=(s,u,c=[])=>{let f=o(s);return f||(typeof s=="string"&&/^(?:hold|spring|wiggle|custom)(?:\(|$)/.test(s.trim())&&Ne("custom_ease_parse_failed",{ease:s}),t.call(u,s,...c)??dy)};e.parseEase=function(u,...c){return a(u,this,c)};let l=e.registerEase;if(typeof l=="function"){l("hold",Ff);let s=u=>{let c=f=>f;c.config=(...f)=>a(`${u}(${f.join(",")})`,e),l(u,c)};s("spring"),s("wiggle"),s("custom")}return e.__hfCustomEaseInstalled=!0,!0}var ns=new Map,mr=new Map,es=new Map,ts=()=>{},If=()=>{},Df=0;function rs(e){return/^[a-z][a-z0-9-]{0,63}$/.test(e)}function Pf(e){let t=(es.get(e)??0)+1;return es.set(e,t),t}function Of(e){return typeof e=="number"&&Number.isSafeInteger(e)&&e>0?e:(Df-=1,Df)}function is(e,t){let n=mr.get(e);if(!n)return;let r=()=>es.get(e)===t.generation&&mr.get(e)===n;try{Promise.resolve(n(t.payload)).then(()=>{r()&&If(e,t.requestId)},i=>{r()&&ts(e,t.requestId,i)})}catch(i){r()&&ts(e,t.requestId,i)}}function Hf(e){ts=e}function Gf(e){If=e}function Ri(e,t,n){if(!rs(e))return;let r={payload:t,requestId:Of(n),generation:Pf(e)};ns.set(e,r),is(e,r)}function ki(e,t){rs(e)&&(ns.delete(e),is(e,{payload:void 0,requestId:Of(t),generation:Pf(e)}))}function Bf(e,t){if(!rs(e))throw new Error(`Invalid HyperFrames runtime-data channel: ${e}`);mr.set(e,t);let n=ns.get(e);return n&&is(e,n),()=>{mr.get(e)===t&&mr.delete(e)}}var os="data-hf-authored-duration",as="data-hf-authored-end",Uf=!1;function ot(e){if(e){if(typeof e.pause!="function"){Uf||(Uf=!0,Ne("timeline_missing_pause",{}));return}try{e.pause()}catch(t){L("runtime.timeline.pause",t)}}}function by(){let e=window.__HF_EXPORT_RENDER_SEEK_CONFIG,t=e?.fps,n=e?.fpsSource,r=Number(t);return!e||t==null?{fps:null,source:"default",rawFpsSource:n,rawFps:t,fallbackReason:"missing"}:!Number.isFinite(r)||r<=0?{fps:null,source:"default",rawFpsSource:n,rawFps:t,fallbackReason:"invalid"}:{fps:r,source:n==="render-options"||n==="default"?n:"unknown",rawFpsSource:n,rawFps:t,fallbackReason:e.fpsFallbackReason}}function Wf(){let e=Eu(),t=()=>{};Ws(be),Hf((d,g,h)=>{be({source:"hf-preview",type:"runtime-data-error",channel:d,requestId:g,message:h instanceof Error?h.message:String(h)})}),Gf((d,g)=>{try{t()}catch(h){be({source:"hf-preview",type:"runtime-data-error",channel:d,requestId:g,message:h instanceof Error?h.message:String(h)});return}be({source:"hf-preview",type:"runtime-data-applied",channel:d,requestId:g})}),mi(document),La(document),Pl(document);let n=by();e.canonicalFps=n.fps??e.canonicalFps,Bs(e.canonicalFps),window.__HF_EXPORT_RENDER_SEEK_CONFIG&&console.info("[hyperframes] render runtime fps",{canonicalFps:e.canonicalFps,source:n.source,rawFpsSource:n.rawFpsSource,rawFps:n.rawFps,fallbackReason:n.fallbackReason});let r=null,i=null,o=null,a=[],l=new Set,s=null,u=new Set,c=(d,g,h)=>{u.has(d)||(u.add(d),Ne(g,h))};if(typeof window.__hfRuntimeTeardown=="function")try{window.__hfRuntimeTeardown()}catch(d){L("runtime.init.site1",d)}let f=new Ei;e.transportClock=f;let m=new _i,p=!1;m.init().then(d=>{p=d}),window.__hf=window.__hf||{};let b=d=>d.closest("[data-hidden]")!==null||Br(d.ownerDocument,d),v=()=>{let d=window.gsap,g=window;if(!(!d?.registerPlugin||g.__hfAutoNoopRegistered))try{d.registerPlugin({name:"_auto",init:()=>!1}),g.__hfAutoNoopRegistered=!0}catch(h){c("auto_marker_install_failed","auto_marker_install_failed",{reason:"threw"}),L("runtime.autoMarker.install",h)}},x=()=>{let d=window.gsap;if(!d){c("custom_ease_missing_gsap","custom_ease_install_failed",{reason:"missing_gsap"});return}try{Lf(d)||c("custom_ease_no_parse_ease","custom_ease_install_failed",{reason:"no_parseEase"})}catch(g){c("custom_ease_install_threw","custom_ease_install_failed",{reason:"threw"}),L("runtime.customEase.install",g)}};v(),x(),document.documentElement&&(document.documentElement.style.margin="0",document.documentElement.style.padding="0",document.documentElement.style.overflow="hidden"),document.body&&(document.body.style.margin="0",document.body.style.padding="0",document.body.style.overflow="hidden");try{Ys(document)}catch(d){L("runtime.init.cssVariables",d)}window.__timelines=window.__timelines||{};let _=()=>{let d=document.querySelector('[data-composition-id][data-root="true"]');if(d instanceof HTMLElement)return d;let g=Array.from(document.querySelectorAll("[data-composition-id]"));return g.find(h=>!h.parentElement?.closest("[data-composition-id]"))??g[0]??null};if(Array.isArray(window.__timelines)){let d=window.__timelines,g=_()?.getAttribute("data-composition-id")??"root",h={};if(d.length===1)h[g]=d[0];else for(let y=0;y{a.push(d)},M=(d,g,h)=>{let y=h??`${d}:${JSON.stringify(g)}`;l.has(y)||(l.add(y),be({source:"hf-preview",type:"diagnostic",code:d,details:g}))},D=d=>{let g={scale:1,focusX:960,focusY:540},h=[],y=[],w={time:d.getTime(),duration:d.getDuration(),isPlaying:d.isPlaying(),renderMode:!1,timelineDirty:!1};return{play:d.play,pause:d.pause,seek:d.seek,getTime:d.getTime,getDuration:d.getDuration,isPlaying:d.isPlaying,getMainTimeline:()=>null,getElementBounds:()=>{},getElementsAtPoint:()=>{},setElementPosition:()=>{},previewElementPosition:()=>{},setElementKeyframes:()=>{},setElementScale:()=>{},setElementFontSize:()=>{},setElementTextContent:()=>{},setElementTextColor:()=>{},setElementTextShadow:()=>{},setElementTextFontWeight:()=>{},setElementTextFontFamily:()=>{},setElementTextOutline:()=>{},setElementTextHighlight:()=>{},setElementVolume:()=>{},setStageZoom:()=>{},getStageZoom:()=>g,setStageZoomKeyframes:()=>{},getStageZoomKeyframes:()=>h,addElement:()=>!1,removeElement:()=>!1,updateElementTiming:()=>!1,setElementTiming:()=>{},updateElementSrc:()=>!1,updateElementLayer:()=>!1,updateElementBasePosition:()=>!1,markTimelineDirty:()=>{},isTimelineDirty:()=>!1,rebuildTimeline:()=>{},ensureTimeline:()=>{},enableRenderMode:()=>{},disableRenderMode:()=>{},renderSeek:d.renderSeek,getElementVisibility:()=>({visible:!1}),getVisibleElements:()=>y,getRenderState:()=>({...w,time:d.getTime(),duration:d.getDuration(),isPlaying:d.isPlaying()})}},E=1/60,S=.75,A=.05,C=100,F=240,I=d=>{if(d instanceof Error)return d.message||String(d);if(typeof d=="string")return d;try{return JSON.stringify(d)}catch{return String(d??"")}},q=d=>{let g=d.toLowerCase();return g.includes("cannot read properties of null")||g.includes("cannot set properties of null")?{code:"runtime_null_dom_access",category:"dom-null-access"}:g.includes("failed to execute 'queryselector'")?{code:"runtime_invalid_selector",category:"selector-invalid"}:g.includes("is not defined")?{code:"runtime_reference_missing",category:"reference-missing"}:{code:"runtime_script_error",category:"script-error"}},W=d=>{if(d==null||d.trim()==="")return null;let g=Number.parseFloat(d);return!Number.isFinite(g)||g<=0?null:`${g}px`},Y=()=>_(),k=()=>{let d=Y();if(!d)return;let g=W(d.getAttribute("data-width")),h=W(d.getAttribute("data-height"));g&&(d.style.width=g),h&&(d.style.height=h),g&&d.style.setProperty("--comp-width",g),h&&d.style.setProperty("--comp-height",h)},U=()=>{let d=Y(),g=Array.from(document.querySelectorAll("[data-composition-id]")).filter(h=>h.hasAttribute("data-duration")||h.hasAttribute("data-end"));for(let h of g){if(d&&h===d)continue;let y=h.getAttribute("data-duration"),w=h.getAttribute("data-end");y!=null&&!h.hasAttribute(os)&&h.setAttribute(os,y),w!=null&&!h.hasAttribute(as)&&h.setAttribute(as,w),h.removeAttribute("data-duration"),h.removeAttribute("data-end")}},ie=()=>{let d=Y();if(!d)return;d.style.position||(d.style.position="relative"),d.style.overflow="hidden";let g=W(d.getAttribute("data-width")),h=W(d.getAttribute("data-height"));g&&(d.style.width=g),h&&(d.style.height=h);let y=Array.from(d.children);for(let w of y){let N=w.tagName.toLowerCase();if(N==="script"||N==="style"||N==="link"||N==="meta"||!w.hasAttribute("data-start")||w.hasAttribute("data-hf-autostamped"))continue;let G=(w.style.top==="0px"||w.style.top==="0")&&(w.style.left==="0px"||w.style.left==="0")&&w.style.width==="100%"&&w.style.height==="100%",re=/translate\(\s*-50%\s*,\s*-50%\s*\)/.test(w.style.transform);if(G&&re&&!w.hasAttribute("data-width")&&!w.hasAttribute("data-height")){let ne=w.style.top,_t=w.style.left,ye=w.style.width,gn=w.style.height;w.style.top="",w.style.left="",w.style.width="",w.style.height="";let se=window.getComputedStyle(w);se.top!=="auto"||se.bottom!=="auto"||se.left!=="auto"||se.right!=="auto"||se.width!=="0px"||se.height!=="0px"||(w.style.top=ne,w.style.left=_t,w.style.width=ye,w.style.height=gn)}let $=window.getComputedStyle(w),le=$.position;if(le!=="absolute"&&le!=="fixed"&&(w.style.position="absolute"),!!w.style.top||!!w.style.bottom||$.top!=="auto"||$.bottom!=="auto"||(w.style.top="0"),!!w.style.left||!!w.style.right||$.left!=="auto"||$.right!=="auto"||(w.style.left="0"),N!=="audio"){let ne=W(w.getAttribute("data-width")),_t=W(w.getAttribute("data-height")),ye=$.width!=="0px"&&$.width!=="auto",gn=$.height!=="0px"&&$.height!=="auto";ne?!w.style.width&&!ye&&(w.style.width=ne):!w.style.width&&$.width==="0px"&&(w.style.width="100%"),_t?!w.style.height&&!gn&&(w.style.height=_t):!w.style.height&&$.height==="0px"&&(w.style.height="100%")}}},P=(d,g=0,h)=>mt({timelineRegistry:window.__timelines??{},includeAuthoredTimingAttrs:h?.includeAuthoredTimingAttrs??!0}).resolveStartForElement(d,g),H=(d,g)=>mt({timelineRegistry:window.__timelines??{},includeAuthoredTimingAttrs:g?.includeAuthoredTimingAttrs??!0}).resolveDurationForElement(d),V=d=>{let g=d.closest("[data-composition-id]"),h=g?P(g,0):null,y=g?H(g,{includeAuthoredTimingAttrs:!0}):null;return{compositionRoot:g,inheritedStart:h,inheritedDuration:y}},j=d=>{let g=V(d),h=g.inheritedStart??0,y=Gt(d.getAttribute("data-start"));if(d.hasAttribute("data-hf-auto-start")||y==null||h<=0)return P(d,h);let w=g.inheritedDuration,N=w!=null&&w>0?h+w:null;return y>=h&&(N==null||y{window.__hfResolveMediaStartSeconds===j&&delete window.__hfResolveMediaStartSeconds});let we=(d,g)=>{let h=d.tagName.toLowerCase();if(h==="script"||h==="style"||h==="link"||h==="meta")return!1;let w=h==="video"||h==="audio"?j(d):P(d,0),N=H(d),G=d.getAttribute("data-composition-id");if(G){let $=(window.__timelines??{})[G],le=null;if($&&typeof $.duration=="function"){let Me=Number($.duration());Number.isFinite(Me)&&Me>0&&(le=Me)}!(d.hasAttribute("data-duration")||d.hasAttribute("data-end")||d.hasAttribute(os)||d.hasAttribute(as))&&(N==null||N<=0)&&le!=null&&(N=le)}let re=N!=null&&N>0?w+N:Number.POSITIVE_INFINITY;return g>=w&&(Number.isFinite(re)?g{if(!d||typeof d.duration!="function")return null;try{let g=Number(d.duration());return Number.isFinite(g)?Math.max(0,g):null}catch{return null}},K=d=>typeof d=="number"&&Number.isFinite(d)&&d>E,te=d=>{let g=ve(d.getAttribute("data-duration"));return g!=null&&g>0?g:Number.isFinite(d.duration)?Qe(d,d.duration):null},J=()=>{let d=Array.from(document.querySelectorAll("video[data-start], audio[data-start]"));if(d.length===0)return null;let g=0;for(let h of d){let y=j(h);if(!Number.isFinite(y))continue;let w=te(h);w==null||w<=E||(g=Math.max(g,Math.max(0,y)+w))}return g>E?g:null},X=()=>{let d=Y();if(!d)return null;let g=window.__timelines??{},h=mt({timelineRegistry:g,includeAuthoredTimingAttrs:!0}),y=0,w=ve(d.getAttribute("data-duration"));w!=null&&w>0&&(y=w);let N=Array.from(d.querySelectorAll("[data-composition-id][data-start]"));for(let G of N){if(!(G instanceof Element)||G.parentElement?.closest("[data-composition-id]")!==d)continue;let $=h.resolveStartForElement(G,0),le=h.resolveDurationForElement(G);!Number.isFinite($)||le==null||le<=0||(y=Math.max(y,Math.max(0,$)+le))}return y>E?y:null},Pe=()=>{let d=J();return typeof d!="number"||!Number.isFinite(d)||d<=E?null:d},Fe=d=>K(d)?Math.max(E,d*S):E,cn=()=>{let d=0;for(let g of e.deterministicAdapters){let h=g.getInferredDurationSeconds;if(typeof h!="function")continue;let y=null;try{y=h()}catch(w){L("runtime.init.adapterDuration",w)}typeof y=="number"&&Number.isFinite(y)&&y>0&&(d=Math.max(d,y))}return d>E?d:null},Ce=(d,g=0)=>{let h=ee(d),y=Pe(),w=X(),N=cn(),G=Math.max(y??0,w??0,N??0),re=Number.isFinite(g)&&g>E?g:0,$=0;return K(h)?$=Math.max(h,G,re):K(G)?$=Math.max(G,re):$=re,$>0?Math.max(0,$):0},Oi=()=>{let d=window.__timelines??{},g=se=>{let oe=Object.entries(d).filter(ue=>!!ue[1]&&typeof ue[1].play=="function"&&typeof ue[1].pause=="function");if(oe.length!==1)return{timeline:null};let he=oe[0];if(!he)return{timeline:null};let[xe,fe]=he;return{timeline:fe,selectedTimelineIds:[xe],selectedDurationSeconds:ee(fe),diagnostics:{code:"root_timeline_sole_registered_fallback",details:{reason:se,soleTimelineId:xe}}}},h=mt({timelineRegistry:d,includeAuthoredTimingAttrs:!0}),y=Pe(),w=X(),N=Math.max(y??0,w??0)||null,G=Fe(N),re=se=>{let oe=document.querySelector(`[data-composition-id="${CSS.escape(se)}"]`);return oe?h.resolveStartForElement(oe,0):0},$=se=>{let oe=window.gsap;if(!oe||typeof oe.timeline!="function")return null;let he=oe.timeline({paused:!0});for(let xe of se)he.add(xe.timeline,re(xe.compositionId));return he},le=(se,oe)=>{if(!K(se))return null;let he=window.gsap;if(!he||typeof he.timeline!="function")return null;let xe=he.timeline({paused:!0});if(oe)try{xe.add(oe,0)}catch(ue){L("runtime.init.site2",ue)}let fe=xe;if(typeof fe.to=="function")try{fe.to({},{duration:se})}catch(ue){L("runtime.init.site3",ue)}return xe},Be=(se,oe)=>{let he=se;if(typeof he.getChildren!="function")return[];try{let xe=he.getChildren(!0,!0,!0)??[];if(!Array.isArray(xe))return[];let fe=[];for(let ue of oe)if(!xe.some(Je=>Je===ue.timeline))try{let Je=re(ue.compositionId);se.add(ue.timeline,Je),fe.push(ue.compositionId)}catch(Je){L("runtime.init.site4",Je)}return fe}catch{return[]}},Me=Y(),Q=Me?.getAttribute("data-composition-id")??null;if(!Q)return g("root_missing_composition_id");let ne=d[Q]??null,ye=(()=>{if(!Me)return[];let se=new Set,oe=Array.from(Me.querySelectorAll("[data-composition-id]")),he=[];for(let xe of oe){let fe=xe.getAttribute("data-composition-id");if(!fe||fe===Q||se.has(fe))continue;se.add(fe);let ue=d[fe]??null;if(!ue||typeof ue.play!="function"||typeof ue.pause!="function")continue;let lt=ee(ue);he.push({compositionId:fe,timeline:ue,durationSeconds:lt??0})}return he})(),gn=se=>{for(let oe of se){let he=oe.timeline;if(typeof he.paused=="function")try{he.paused(!1)}catch(xe){L("runtime.init.site5",xe)}}};if(ye.length>0&&gn(ye),ne){let se=ye.length>0?Be(ne,ye):[];if((ye.length>0||!document.querySelector("[data-composition-id]:not([data-composition-id='"+Q+"'])"))&&(gr=!0),se.length>0)try{let fe=ne.time();ne.seek(fe,!1)}catch{}let oe=ee(ne);if(!K(oe)&&ye.length>0){let fe=ye.map(zm=>zm.compositionId),ue=$(ye),lt=ee(ue);if(ue&&K(lt))return{timeline:ue,selectedTimelineIds:fe,selectedDurationSeconds:lt,mediaDurationFloorSeconds:y,diagnostics:{code:"root_timeline_unusable_fallback",details:{rootCompositionId:Q,rootDurationSeconds:oe,fallbackKind:"composite_by_root_children",minCandidateDurationSeconds:G,selectedDurationSeconds:lt,mediaDurationFloorSeconds:y,authoredCompositionDurationFloorSeconds:w,selectedTimelineIds:fe,autoNestedChildren:se}}};let Je=le(N??0,ne),Yi=ee(Je);if(Je&&K(Yi))return{timeline:Je,selectedTimelineIds:[Q],selectedDurationSeconds:Yi,mediaDurationFloorSeconds:y,diagnostics:{code:"root_timeline_unusable_media_floor_fallback",details:{rootCompositionId:Q,rootDurationSeconds:oe,fallbackKind:"media_duration_floor",mediaDurationFloorSeconds:y,authoredCompositionDurationFloorSeconds:w,selectedDurationSeconds:Yi,selectedTimelineIds:[Q],autoNestedChildren:se}}}}if(!K(oe)&&ye.length===0){let fe=le(N??0,ne),ue=ee(fe);if(fe&&K(ue))return{timeline:fe,selectedTimelineIds:[Q],selectedDurationSeconds:ue,mediaDurationFloorSeconds:y,diagnostics:{code:"root_timeline_unusable_media_floor_fallback",details:{rootCompositionId:Q,rootDurationSeconds:oe,fallbackKind:"media_duration_floor",mediaDurationFloorSeconds:y,authoredCompositionDurationFloorSeconds:w,selectedDurationSeconds:ue,selectedTimelineIds:[Q]}}}}let he=ve(Me?.getAttribute("data-duration")),xe=Math.max(K(he)?he:0,w??0);if(xe>0&&K(xe)&&K(oe)&&xe>=oe+.5){let fe=ne;if(typeof fe.to=="function")try{fe.to({},{duration:0},xe)}catch(lt){L("runtime.init.site6",lt)}let ue=ee(ne);if(K(ue))return{timeline:ne,selectedTimelineIds:[Q],selectedDurationSeconds:ue,mediaDurationFloorSeconds:y,diagnostics:{code:"root_timeline_padded_to_declared_duration",details:{rootCompositionId:Q,rootDurationSeconds:oe,rootDeclaredDur:he,authoredCompositionDurationFloorSeconds:w,newDur:ue}}}}return{timeline:ne,selectedTimelineIds:[Q],selectedDurationSeconds:oe,mediaDurationFloorSeconds:y,diagnostics:se.length>0?{code:"root_timeline_auto_nested_children",details:{rootCompositionId:Q,selectedDurationSeconds:oe,autoNestedChildren:se}}:void 0}}if(ye.length>0){let se=ye.map(xe=>xe.compositionId),oe=$(ye),he=ee(oe);if(oe)return{timeline:oe,selectedTimelineIds:se,selectedDurationSeconds:he,mediaDurationFloorSeconds:y,diagnostics:{code:"root_timeline_missing_fallback",details:{rootCompositionId:Q,fallbackKind:"composite_by_root_children",minCandidateDurationSeconds:G,selectedDurationSeconds:he,mediaDurationFloorSeconds:y,selectedTimelineIds:se}}}}return g("root_composition_id_unmatched_in_registry")},gr=!1,Em=d=>{let g=window.gsap,h=d;if(!(!h||typeof h.getChildren!="function"||!g||typeof g.parseEase!="function"))for(let y of h.getChildren(!0,!0,!0)){let w=y,N=w.timeline;if(!N||!("_ease"in N)||typeof N._ease=="function")continue;let G=w.vars?.keyframes,$=(G&&!Array.isArray(G)?G.ease:void 0)??w.vars?.ease??"none";try{let le=g.parseEase($);typeof le=="function"&&(N._ease=le)}catch(le){Ne("keyframe_ease_repair_failed",{ease:typeof $=="string"?$:String($)}),L("runtime.keyframeEase.repair",le)}}},dn=()=>{if(x(),!B)return!1;let d=e.capturedTimeline,g=ee(d),h=K(g);if(d&&h&&gr)return!1;let y=Oi();if(!y.timeline)return!1;if(d&&d===y.timeline)return typeof d.timeScale=="function"&&d.timeScale(e.playbackRate),!1;e.capturedTimeline=y.timeline,typeof e.capturedTimeline.timeScale=="function"&&e.capturedTimeline.timeScale(e.playbackRate),Em(e.capturedTimeline);let w=Ce(e.capturedTimeline,0);if(w<=0&&typeof e.capturedTimeline.progress=="function"&&(e.capturedTimeline.progress(1,!0),e.capturedTimeline.progress(0,!1),ot(e.capturedTimeline)),w>0){try{f.setDuration(w)}catch{}if(typeof e.capturedTimeline.totalTime=="function"){typeof e.capturedTimeline.progress=="function"&&e.capturedTimeline.progress(1e-4,!0);let G=Math.max(0,e.currentTime||0);e.capturedTimeline.totalTime(G,!1),ot(e.capturedTimeline)}let N=window.__hfStudioManualEditsApply;typeof N=="function"&&N(),mi(document)}if(y.diagnostics&&be({source:"hf-preview",type:"diagnostic",code:y.diagnostics.code,details:y.diagnostics.details}),be({source:"hf-preview",type:"diagnostic",code:"timeline_bound",details:{selectedTimelineIds:y.selectedTimelineIds??[],selectedDurationSeconds:y.selectedDurationSeconds??null,mediaDurationFloorSeconds:y.mediaDurationFloorSeconds??null}}),window.parent!==window){let N=Y(),G=w>0?w:0,re=String(G>0?G:1),$=new Set,le=Q=>Q.tagName.toLowerCase()===Ut,Be=new Set(document.querySelectorAll("[data-start]")),Me=Q=>{let ne=Q.parentElement;for(;ne&&ne!==N;){if(Be.has(ne))return!0;ne=ne.parentElement}return!1};if(e.capturedTimeline.getChildren)try{for(let Q of e.capturedTimeline.getChildren(!0))if(typeof Q.targets=="function")for(let ne of Q.targets())ne instanceof HTMLElement&&ne!==N&&(le(ne)||ne.hasAttribute("data-start")||Me(ne)||$.has(ne)||($.add(ne),ne.setAttribute("data-start","0"),ne.setAttribute("data-duration",re),ne.setAttribute("data-hf-autostamped","1")))}catch{}if(N instanceof HTMLElement)for(let Q of N.querySelectorAll("[id]"))Q instanceof HTMLElement&&Q!==N&&(Q.hasAttribute("data-start")||Me(Q)||$.has(Q)||Q.tagName==="SCRIPT"||Q.tagName==="STYLE"||Q.tagName==="LINK"||le(Q)||($.add(Q),Q.setAttribute("data-start","0"),Q.setAttribute("data-duration",re),Q.setAttribute("data-hf-autostamped","1")))}for(let N of fn)br.delete(N),Es(N);return!0},gs=()=>{if(e.tornDown)return;let d=Oi();if(!d.timeline){e.capturedTimeline=null,gr=!1,f.setDuration(0),Ar(e.currentTime);return}e.capturedTimeline!==d.timeline&&(gr=!1,dn()),Ar(e.currentTime)};t=()=>{gs(),st()},window.__hfForceTimelineRebind=gs;let wm=()=>{let d=Y();if(!(d instanceof HTMLElement))return;let g=d.getBoundingClientRect(),h=Number(d.getAttribute("data-width")),y=Number(d.getAttribute("data-height")),w=window.getComputedStyle(d),N=Number.isFinite(h)&&h>0&&Number.isFinite(y)&&y>0,G=g.width<=0||g.height<=0||d.clientWidth<=0||d.clientHeight<=0;!N||!G||M("root_stage_layout_zero",{compositionId:d.getAttribute("data-composition-id")??null,declaredWidth:h,declaredHeight:y,rectWidth:Math.round(g.width),rectHeight:Math.round(g.height),clientWidth:d.clientWidth,clientHeight:d.clientHeight,display:w.display,visibility:w.visibility,overflow:w.overflow},`root-stage-layout-zero:${d.getAttribute("data-composition-id")??"unknown"}`)},Cm=()=>{e.tornDown||(s!=null&&window.cancelAnimationFrame(s),s=window.requestAnimationFrame(()=>{s=null,wm()}))},_m=()=>{i=d=>{let g=I(d.error??d.message).slice(0,F);if(!g)return;let h=q(g);be({source:"hf-preview",type:"diagnostic",code:h.code,details:{category:h.category,message:g,filename:d.filename||null,line:Number.isFinite(d.lineno)?d.lineno:null,column:Number.isFinite(d.colno)?d.colno:null}})},o=d=>{let g=I(d.reason).slice(0,F);if(!g)return;let h=q(g);be({source:"hf-preview",type:"diagnostic",code:`${h.code}_unhandled_rejection`,details:{category:`${h.category}-unhandled-rejection`,message:g}})},window.addEventListener("error",i),window.addEventListener("unhandledrejection",o)},Tm=()=>{let d=Array.from(document.querySelectorAll("img, video, audio, source, link[rel='stylesheet']"));for(let h of d){let y=()=>{if(!(h instanceof Element))return;let w=h.tagName.toLowerCase(),N=h.getAttribute("src")??h.getAttribute("href")??h.getAttribute("poster")??null,G=w==="link"?"runtime_stylesheet_load_failed":"runtime_asset_load_failed";M(G,{tagName:w,assetUrl:N,currentSrc:(h instanceof HTMLImageElement||h instanceof HTMLMediaElement)&&h.currentSrc||null,readyState:h instanceof HTMLMediaElement?h.readyState:null,networkState:h instanceof HTMLMediaElement?h.networkState:null},`${G}:${w}:${N??"unknown"}`)};h.addEventListener("error",y),T(()=>{h.removeEventListener("error",y)})}let g=document.fonts;g&&g.ready.then(()=>{if(e.tornDown)return;let h=Array.from(g).filter(y=>y.status==="error").map(y=>y.family).filter(y=>!!y).slice(0,10);h.length!==0&&M("runtime_font_load_issue",{failedFamilies:h,totalFaces:Array.from(g).length},`runtime-font-load-issue:${h.join("|")}`)}).catch(()=>{})},Rm=(d,g)=>{if(!d.timeline)return!1;let h=e.capturedTimeline;if(h&&h===d.timeline)return!1;let y=Math.max(0,e.currentTime||0),w=e.isPlaying;e.capturedTimeline=d.timeline,typeof e.capturedTimeline.timeScale=="function"&&e.capturedTimeline.timeScale(e.playbackRate);try{ot(e.capturedTimeline),typeof e.capturedTimeline.seek=="function"&&e.capturedTimeline.seek(y,!1),w&&typeof e.capturedTimeline.play=="function"&&e.capturedTimeline.play()}catch(N){L("runtime.init.site7",N)}return be({source:"hf-preview",type:"diagnostic",code:"timeline_loop_guard_rebind",details:{reason:g,previousTime:y,selectedTimelineIds:d.selectedTimelineIds??[],selectedDurationSeconds:d.selectedDurationSeconds??null,mediaDurationFloorSeconds:d.mediaDurationFloorSeconds??null}}),!0},Et=null,bs=!1,xs=!1,fn=new Set,br=new WeakMap,xr=()=>{e.tornDown||(Et!=null&&window.clearTimeout(Et),Et=window.setTimeout(()=>{if(e.tornDown||(Et=null,xs&&window.__HF_EXPORT_RENDER_SEEK_CONFIG))return;let d=Oi();if(!d.timeline||!K(d.mediaDurationFloorSeconds??null))return;if(!e.capturedTimeline){dn()&&(st(),ke(!0));return}if(bs)return;let h=ee(e.capturedTimeline),y=d.selectedDurationSeconds??ee(d.timeline);K(y)&&(!K(h)||y>=h+A)&&Rm(d,"manual")&&(bs=!0,be({source:"hf-preview",type:"diagnostic",code:"timeline_rebind_after_media_metadata",details:{previousDurationSeconds:h??null,selectedDurationSeconds:y??null,selectedTimelineIds:d.selectedTimelineIds??[],mediaDurationFloorSeconds:d.mediaDurationFloorSeconds??null}}),st(),ke(!0))},C))},ys=d=>{d.currentTarget instanceof HTMLMediaElement&&zl(d.currentTarget)},vs=d=>{d.currentTarget instanceof HTMLMediaElement&&ql(d.currentTarget)},Ss=d=>{d instanceof HTMLAudioElement&&Ef(d)&&sn(d,an(d))},As=d=>{let g=d.currentTarget;g instanceof HTMLMediaElement&&Ss(g)},km=()=>{for(let d of fn)d.removeEventListener("loadedmetadata",xr),d.removeEventListener("durationchange",xr),d.removeEventListener("loadedmetadata",ys),d.removeEventListener("loadedmetadata",As),d.removeEventListener("error",vs);fn.clear()},Hi=()=>{if(e.tornDown)return;let d=Array.from(document.querySelectorAll("video, audio"));for(let g of d){if(fn.has(g))continue;fn.add(g);let h=Number.parseFloat(g.dataset.volume??"");Number.isFinite(h)&&(g.volume=Math.max(0,Math.min(1,h))),g.addEventListener("loadedmetadata",xr),g.addEventListener("durationchange",xr),g.addEventListener("loadedmetadata",As),Ss(g),g.addEventListener("loadedmetadata",ys),g.addEventListener("error",vs),Vl(g),g.preload!=="auto"&&(g.preload="auto"),g.readyState{br.has(d)||El(d,e.capturedTimeline,Ce(e.capturedTimeline,0),br,{allowLiveTimelineSeek:!window.__HF_RENDER_CAPTURE_MODE})},Gi=new WeakMap,ws=d=>{let g=Gi.get(d);if(g!==void 0)return g;let h=window.getComputedStyle(d).position,y=h==="static"||h==="relative"||h==="sticky";return Gi.set(d,y),y},Bi=new WeakMap,Mm=d=>{let g=Bi.get(d);if(g!==void 0)return g;let h=d.querySelector("[data-start]")===null;return Bi.set(d,h),h},Fm=()=>{Gi=new WeakMap,Bi=new WeakMap},Ui=new WeakMap,yr=new WeakSet,vr=!1,Cs=d=>d.matches("audio[data-start]")||d.querySelector("audio[data-start]")!==null,_s=new WeakMap,Sr=!0,Nm=()=>{if(Sr){Sr=!1;for(let d of document.querySelectorAll(Ut)){let g=d.hasAttribute("data-hidden");_s.get(d)!==g&&(_s.set(d,g),d.id&&m.setGroupMuted(d.id,g))}}},Ar=(d,g=Array.from(document.querySelectorAll("[data-start]")))=>{let h=Y();for(let y of g){if(!(y instanceof HTMLElement))continue;if(y.hasAttribute("data-hidden")){yr.has(y)||(Ui.set(y,y.style.getPropertyValue("display")),yr.add(y),Cs(y)&&(vr=!0),Sr=!0),y.style.display="none",(y instanceof HTMLVideoElement||y instanceof HTMLImageElement)&&r?.setSourceVisibility(y,!1);continue}if(yr.has(y)){let N=Ui.get(y);N?y.style.display=N:y.style.removeProperty("display"),Ui.delete(y),yr.delete(y),Cs(y)&&(vr=!0),Sr=!0}let w=we(y,d);if(w){let N=y.parentElement;for(;N&&N!==h;){if(N instanceof HTMLElement&&N.hasAttribute("data-start")&&!we(N,d)){w=!1;break}N=N.parentElement}}y.style.visibility=w?"visible":"hidden",(y instanceof HTMLVideoElement||y instanceof HTMLImageElement)&&r?.setSourceVisibility(y,w),w?ws(y)&&y.style.removeProperty("display"):ws(y)&&Mm(y)&&(y.style.display="none")}vr&&f.isPlaying()&&(m.stopAll(),ji()),vr=!1,Nm()},Oe=()=>{let d=Hl({shouldIncludeElement:h=>h.hasAttribute("data-start")||!!V(h).compositionRoot,resolveStartSeconds:h=>j(h),resolveDurationSeconds:h=>{let y=V(h),w=j(h),N=y.inheritedStart!=null&&y.inheritedDuration!=null&&y.inheritedDuration>0?Math.max(0,y.inheritedStart+y.inheritedDuration-w):null,G=Number.isFinite(h.duration)?Qe(h,h.duration):null,re=ve(h.dataset.duration),$=re!=null&&re>0?re:null;return Ol({isVideo:h.tagName==="VIDEO",sourceDuration:G,hostRemaining:N,explicitDuration:$})}});for(let h of d.mediaClips){let y=br.get(h.el);y&&(h.volumeKeyframes=y)}let g=e.mediaForceSyncNextTick;g&&(e.mediaForceSyncNextTick=!1),e.nativeMediaSyncDisabled||Gl({clips:d.mediaClips,timeSeconds:e.currentTime,playing:e.isPlaying,playbackRate:e.playbackRate,outputMuted:e.mediaOutputMuted,userMuted:e.bridgeMuted,userVolume:e.bridgeVolume,forceSync:g,onElementVolume:(h,y,w)=>m.setElementVolume(h,w),isWebAudioOwned:h=>m.ownsElement(h),isWebAudioRouted:h=>m.routesElement(h),onAutoplayBlocked:()=>{e.mediaAutoplayBlockedPosted||(e.mediaAutoplayBlockedPosted=!0,be({source:"hf-preview",type:"media-autoplay-blocked"}))}}),Ar(e.currentTime)},ke=d=>{let g=Math.max(0,Math.round((e.currentTime||0)*e.canonicalFps)),h=Date.now();(d||g!==e.bridgeLastPostedFrame||e.isPlaying!==e.bridgeLastPostedPlaying||e.bridgeMuted!==e.bridgeLastPostedMuted||h-e.bridgeLastPostedAt>=e.bridgeMaxPostIntervalMs)&&(e.bridgeLastPostedFrame=g,e.bridgeLastPostedPlaying=e.isPlaying,e.bridgeLastPostedMuted=e.bridgeMuted,e.bridgeLastPostedAt=h,be({source:"hf-preview",type:"state",frame:g,isPlaying:e.isPlaying,muted:e.bridgeMuted,playbackRate:e.playbackRate}))},Wi="",Ts=0,Lm=()=>{let d="";for(let g of document.querySelectorAll("[data-start]"))d+=`${g.id}:${g.tagName}|`;return d},st=()=>{U(),k(),ie();let d=Y();if(d){let y=W(d.getAttribute("data-width")),w=W(d.getAttribute("data-height")),N=y?parseInt(y,10):0,G=w?parseInt(w,10):0;N>0&&G>0&&be({source:"hf-preview",type:"stage-size",width:N,height:G})}dn();let g=Ru({canonicalFps:e.canonicalFps});window.__clipManifest=g;let h=Lm();if(Wi!==h&&Fm(),!window.__clipTree||Wi!==h){let y=window;window.__clipTree=wu({startResolver:mt({timelineRegistry:y.__timelines??{},includeAuthoredTimingAttrs:!0}),timelineRegistry:y.__timelines??{},rootDuration:g.durationInFrames/e.canonicalFps}),Wi=h}be(g),Cm()},Vi=d=>typeof d=="number"&&Number.isFinite(d)&&d>0?d:0,Dm=d=>{let g=Vi(Number(d));if(g<=0)return;let h=Y(),y=Vi(ve(h?.getAttribute("data-duration"))),w=Math.max(Ts,Vi(f.getDuration()),y);g<=w||(Ts=g,h?.setAttribute("data-duration",String(g)),f.setDuration(g),st(),ke(!0))},He=(d,g=0)=>{for(let h of e.deterministicAdapters){try{d==="discover"&&h.discover(),d==="pause"&&h.pause(),d==="play"&&h.play&&h.play()}catch(y){L("runtime.init.site8",y)}if(d==="discover")try{h.seek({time:g,suppressEvents:!0})}catch(y){L("runtime.init.site9",y)}}},wt=()=>{window.__renderReady=!1},mn=null,pn=!0,Im=()=>{let d=[];for(let g of e.deterministicAdapters){let h=g.getReadyPromise;if(typeof h=="function")try{let y=h();y&&d.push(y)}catch(y){L("runtime.init.adapterReady",y)}}return d},Pm=()=>{let d=Im();if(d.length===0)return mn=null,pn=!0,!0;let g=d[0];if(!g)return!0;let h=d.length===1?g:Promise.all(d);return h!==mn&&(mn=h,pn=!1,Promise.resolve(h).then(()=>{mn===h&&(pn=!0,wt())},y=>{mn===h&&(pn=!0,L("runtime.init.adapterReady",y),wt())})),pn};if(B)_a();else{let d={injectedStyles:e.injectedCompStyles,injectedScripts:e.injectedCompScripts,injectedLinks:e.injectedCompLinks,parseDimensionPx:W,onDiagnostic:({code:g,details:h})=>{be({source:"hf-preview",type:"diagnostic",code:g,details:h})}};yd(d).then(()=>xd(d)).finally(()=>{B=!0,Hi(),Tm(),_a(),La(document),wt()})}let Er=yu({postMessage:d=>be(d)});Er.installPickerApi(),Ar(e.currentTime,Array.from(document.querySelectorAll("video[data-start], img[data-start]")));let ze=of();r=ze,T(()=>{ze.destroy(),r=null});let zi=d=>{let g=Number(d);!Number.isFinite(g)||g<=0?e.playbackRate=1:e.playbackRate=Math.max(.1,Math.min(5,g)),e.mediaForceSyncNextTick=!0,e.capturedTimeline&&typeof e.capturedTimeline.timeScale=="function"&&e.capturedTimeline.timeScale(e.playbackRate);let h=document.querySelectorAll("video, audio");for(let y of h)if(y instanceof HTMLMediaElement)try{y.playbackRate=e.playbackRate}catch(w){L("runtime.init.site10",w)}},Rs={play:()=>{let d=e.capturedTimeline;if(f.isPlaying())return;let g=Ce(d,0);if(g>0)f.setDuration(g),f.reachedEnd()&&(f.seek(0),e.currentTime=0,Ct(0));else{let h=Y(),y=Number(h?.getAttribute("data-duration")??0);y>0&&f.setDuration(y)}ot(d),f.play()&&(e.isPlaying=!0,e.mediaForceSyncNextTick=!0,Ps(f.now()),p&&!e.nativeMediaSyncDisabled&&!e.webAudioMediaDisabled&&ji(),He("play"),Oe(),ze.redraw(),ke(!0))},pause:()=>{if(!f.isPlaying())return;m.stopAll(),f.detachAudioSource(),f.pause(),e.isPlaying=!1,e.currentTime=f.now(),e.mediaForceSyncNextTick=!0,Ps(e.currentTime);let d=e.capturedTimeline;ot(d),He("pause"),Oe(),ze.redraw(),ke(!0)},seek:(d,g)=>{let h=$t(Math.max(0,Number(d)||0),e.canonicalFps);m.stopAll(),f.detachAudioSource();let y=f.isPlaying();y&&f.pause(),f.seek(h),e.currentTime=f.now(),e.isPlaying=!1,e.mediaForceSyncNextTick=!0;let w=e.capturedTimeline;if(ot(w),Ct(e.currentTime),He("pause"),g?.keepPlaying&&y){Rs.play();return}Oe(),ze.redraw(),ke(!0)},renderSeek:(d,g)=>{xs=!0;let h=$t(Math.max(0,Number(d)||0),e.canonicalFps);m.stopAll(),f.detachAudioSource(),f.isPlaying()&&f.pause(),f.seek(h),e.currentTime=f.now(),e.isPlaying=!1,e.mediaForceSyncNextTick=!0,Ct(e.currentTime,{activateChildren:!0,suppressEvents:g?.suppressEvents}),He("pause"),Oe(),ze.redraw(),ke(!0)},getTime:()=>f.now(),getDuration:()=>{let d=f.getDuration();return Number.isFinite(d)?d:0},isPlaying:()=>f.isPlaying(),setPlaybackRate:d=>{zi(d),f.setRate(e.playbackRate),Os()},getPlaybackRate:()=>e.playbackRate},ks=Ce(e.capturedTimeline,0);ks>0&&f.setDuration(ks);let Ge=Au({getTimeline:()=>e.capturedTimeline,setTimeline:d=>{e.capturedTimeline=d},getTimelineRegistry:()=>window.__timelines??{},getIsPlaying:()=>e.isPlaying,setIsPlaying:d=>{e.isPlaying!==d&&(e.mediaForceSyncNextTick=!0),e.isPlaying=d},getPlaybackRate:()=>e.playbackRate,setPlaybackRate:zi,getCanonicalFps:()=>e.canonicalFps,onSyncMedia:(d,g)=>{e.currentTime=Math.max(0,Number(d)||0),e.isPlaying!==g&&(e.mediaForceSyncNextTick=!0),e.isPlaying=g,Oe()},onStatePost:ke,onDeterministicSeek:(d,g)=>{for(let h of e.deterministicAdapters)if(!(h.name==="gsap"&&e.capturedTimeline))try{h.seek({time:Number(d)||0,suppressEvents:g?.suppressEvents})}catch(y){L("runtime.init.site11",y)}},onDeterministicPause:()=>He("pause"),onDeterministicPlay:()=>He("play"),onRenderFrameSeek:()=>{ze.redraw()},onShowNativeVideos:()=>{},getSafeDuration:()=>Ce(e.capturedTimeline,0),transport:Rs});window.__player=D(Ge),window.__playerReady=!0,Ne("composition_loaded",{duration:Ge.getDuration(),compositionId:document.querySelector("[data-composition-id]")?.getAttribute("data-composition-id")??null}),e.deterministicAdapters=[hl(),Js({resolveStartSeconds:d=>P(d,0)}),Zs(),tl(),il(),ol(),al(),sl(),ll(),ul(),cl(),Qs({getTimeline:()=>e.capturedTimeline})],ml(),pl(),window.__hfReseekGpu=d=>{let g=Math.max(0,Number(d)||0);window.__hfThreeTime=g,window.__hfTypegpuTime=g,Fr(g)},window.__hfWaitForSeekCompletion=ao,a.push(()=>{window.__hfWaitForSeekCompletion===ao&&delete window.__hfWaitForSeekCompletion}),_m(),Hi(),He("discover");let Om=()=>{let d=e.capturedTimeline,g=dn();e.capturedTimeline&&(g||e.capturedTimeline!==d||!Ge._timeline)&&(Ge._timeline=e.capturedTimeline);let h=Ce(e.capturedTimeline,0);if(h>0&&f.setDuration(h),He("discover",e.currentTime),!e.capturedTimeline){let y=window.__timelines??{},w=Object.keys(y).filter(N=>y[N]);if(w.length>0){let G=Y()?.getAttribute("data-composition-id")??null;M("root_timeline_unbound_registry_present",{reason:G?"root data-composition-id has no matching key in window.__timelines":"root composition element has no data-composition-id attribute",rootCompositionId:G,registeredTimelineKeys:w},"root_timeline_unbound_registry_present"),console.warn("[hyperframes] Root timeline not bound \u2014 render will freeze at t=0. "+(G?`Root data-composition-id is "${G}" but window.__timelines has no such key. `:"Root composition element has no data-composition-id. ")+`Registered timeline keys: [${w.join(", ")}]. Register the root timeline under its data-composition-id (window.__timelines["${G??""}"] = tl).`)}}window.__renderReady=!0,st(),ke(!0)},It=null,Hm=()=>{if(It)return;let d=()=>{window.removeEventListener("hf-timelines-built",d),It=null,wt()};It=d,window.addEventListener("hf-timelines-built",d)};T(()=>{It&&(window.removeEventListener("hf-timelines-built",It),It=null)}),wt=()=>{if(!B){window.__renderReady=!1;return}if(window.__hfTimelinesBuilding){window.__renderReady=!1,Hm();return}if(He("discover",e.currentTime),!Pm()){window.__renderReady=!1;return}Om()},wt(),B&&setTimeout(()=>{wt()},0);let wr=0,qi=!1,Ms=Number.NaN,Fs=null,$i=!1,Gm=(d,g,h,y)=>{try{let w=y?.suppressEvents===!0;ot(d),typeof d.totalTime=="function"?d.totalTime(g,w):d.seek(g,w)}catch(w){L(h,w)}},Bm=(d,g)=>{let h=window.__timelines??{},y=Y()?.getAttribute("data-composition-id")??null;for(let[w,N]of Object.entries(h)){if(!N||w===y)continue;let G=document.querySelector(`[data-composition-id="${CSS.escape(w)}"]`);if(!G)continue;let re=P(G,0);if(!Number.isFinite(re))continue;let $=ee(N),le=$e(G)+Math.max(0,d-re)*_e(G),Be=Math.max(0,$!=null&&$>0?Math.min($,le):le);Gm(N,Be,"runtime.init.transport.childTimeline",g)}},Ns=d=>{let g=window.__timelines??{};for(let h of Object.values(g))if(!(!h||h===d))try{h.play()}catch(y){L("runtime.init.activateSiblings",y)}},Ls=d=>typeof d=="object"&&d!==null,hn=new WeakMap,Um=["onStart","onUpdate","onComplete","onReverseComplete","onRepeat"],Ds=(d,g)=>{let h=d[g];if(typeof h!="function")return null;try{let y=Number(h.call(d));return Number.isFinite(y)?y:null}catch(y){return L("runtime.init.gsapCallbackDuration",y),null}},Wm=d=>{let g=hn.get(d);if(g!=null)return g;if(!("getChildren"in d)||typeof d.getChildren!="function")return!1;let h;try{h=d.getChildren(!0,!0,!0)}catch(y){return L("runtime.init.gsapCallbackChildren",y),hn.set(d,!1),!1}if(!Array.isArray(h))return hn.set(d,!1),!1;for(let y of h){if(!Ls(y))continue;let w=y.vars;if(!Ls(w)||!Um.some($=>typeof w[$]=="function"))continue;let re=Ds(y,"totalDuration")??Ds(y,"duration");if(re!=null&&re<=1e-6)return hn.set(d,!0),!0}return hn.set(d,!1),!1};function Ct(d,g){let h=e.capturedTimeline,y=g?.suppressEvents===!0;if(h){g?.activateChildren&&Ns(h);let w=h,N=d;if(typeof w.totalDuration=="function")try{let G=Number(w.totalDuration());Number.isFinite(G)&&G>0&&d>G&&(N=G)}catch(G){L("runtime.init.transport.clampDuration",G)}try{typeof h.totalTime=="function"?(h.totalTime(N,y),!y&&!Wm(h)&&(h.totalTime(N+.001,!0),h.totalTime(N,!0))):h.seek(N,y)}catch(G){L("runtime.init.transport.seek",G)}}Bm(d,g),h&&g?.activateChildren&&Ns(h);for(let w of e.deterministicAdapters)if(!(w.name==="gsap"&&h))try{w.seek({time:d,suppressEvents:y})}catch(N){L("runtime.init.transport.adapter",N)}}let Vm=()=>{try{return document.querySelector(`[${Cf}]`)!=null}catch{return!1}},Is=()=>{if(!(e.tornDown||qi)){qi=!0;try{if(e.transportRafId=window.requestAnimationFrame(Is),wr+=1,_f({tick:wr,isPlaying:f.isPlaying(),hasCapturedTimeline:e.capturedTimeline!=null,currentTimeSeconds:f.now()})){let y=e.capturedTimeline;if(dn()){e.capturedTimeline&&!Ge._timeline&&(Ge._timeline=e.capturedTimeline),e.capturedTimeline&&e.capturedTimeline!==y&&ot(e.capturedTimeline);let w=Ce(e.capturedTimeline,0);w>0&&f.setDuration(w),st()}}if(wr%20===0&&st(),wr%30===0&&Hi(),e.capturedTimeline){let y=Ce(e.capturedTimeline,0);y>0&&(!f.isPlaying()||y>=f.getDuration())&&f.setDuration(y)}if(f.isPlaying()&&!e.mediaOutputMuted)if(!e.nativeMediaSyncDisabled&&!e.webAudioMediaDisabled&&m.isActive()&&m.context){let y=m.getTime();y>=0&&f.attachAudioSource({currentTimeSeconds:y})}else{let y=document.querySelectorAll("audio[data-start]"),w=!1;for(let N of y){if(!(N instanceof HTMLMediaElement)||!N.isConnected||b(N))continue;let G=Number.parseFloat(N.dataset.start??""),re=ve(N.dataset.duration),$=re!=null&&re>0?G+re:1/0,le=$e(N);if(Number.isFinite(G)&&e.currentTime>=G&&e.currentTime<$){N.paused?!N.error&&N.readyState{let g=document.querySelectorAll("video, audio");for(let h of g){if(!(h instanceof HTMLMediaElement)||!h.isConnected)continue;let y=Number.parseFloat(h.dataset.start??"");if(!Number.isFinite(y))continue;let w=ve(h.dataset.duration),N=w!=null&&w>0?y+w:1/0;if(d=N)continue;let G=$e(h),re=d-y+G;if(re>=0)try{h.currentTime=re}catch{}}},ji=()=>{if(e.nativeMediaSyncDisabled||e.webAudioMediaDisabled)return;let d=m.startGeneration(),g=document.querySelectorAll("audio[data-start]");for(let h of g){if(!(h instanceof HTMLMediaElement)||!h.isConnected||b(h))continue;let y=Number.parseFloat(h.dataset.start??"");if(!Number.isFinite(y))continue;let w=$e(h),N=Number.parseFloat(h.dataset.volume??""),G=Number.isFinite(N)?N:1,re=ve(h.dataset.duration),$=re!=null&&re>0?re:Number.POSITIVE_INFINITY,le=h.closest("[data-composition-id]");if(le){let Q=P(le,0),ne=H(le,{includeAuthoredTimingAttrs:!0});ne!=null&&ne>0&&($=Math.min($,Math.max(0,Q+ne-y)))}let Be=an(h);sn(h,Be),(Be.kind==="web-audio"?m.scheduleMediaElementPlayback(h,y,w,f.now(),G,d,e.playbackRate):Promise.resolve(null)).then(Q=>{if(Q||!f.isPlaying())return;let ne=e.playbackRate*_e(h),_t=h.hasAttribute("data-fx-chain")||h.hasAttribute("data-automation");if(Math.abs(ne-1)>1e-9){Be.kind==="web-audio"&&_t&&(h.muted=!0);return}m.decodeAudioElement(h).then(ye=>{!ye||!f.isPlaying()||m.schedulePlayback(h,ye,y,w,f.now(),G,d,e.playbackRate,$)})})}};function Os(){m.setRate(e.playbackRate)&&!e.nativeMediaSyncDisabled&&!e.webAudioMediaDisabled&&p&&f.isPlaying()&&m.hasBoundedActiveSources()&&(m.stopAll(),ji())}if(e.capturedTimeline){let d=Ce(e.capturedTimeline,0);d>0&&f.setDuration(d),ot(e.capturedTimeline)}Cd(window),e.transportRafId=window.requestAnimationFrame(Is),st(),ke(!0),e.controlBridgeHandler=Us({onPlay:()=>{Ge.play(),Ne("composition_played",{time:Ge.getTime()})},onPause:()=>{Ge.pause(),Ne("composition_paused",{time:Ge.getTime()})},onStopMedia:()=>{m.stopAll();let d=document.querySelectorAll("video, audio");for(let g of d)g instanceof HTMLMediaElement&&!g.paused&&g.pause()},onSeek:(d,g)=>{Ge.seek(d),Ne("composition_seeked",{time:d})},onSetMuted:d=>{e.bridgeMuted=d;let g=d||e.mediaOutputMuted;m.setMuted(g);let h=document.querySelectorAll("video, audio");for(let y of h)y instanceof HTMLMediaElement&&(y.muted=g||y.defaultMuted)},onSetVolume:d=>{e.bridgeVolume=d,m.setVolume(d);let g=document.querySelectorAll("video, audio");for(let h of g){if(!(h instanceof HTMLMediaElement))continue;let y=parseFloat(h.dataset.volume??""),w=Number.isFinite(y)?y:1;h.volume=Nr(w*d)}},onSetMediaOutputMuted:d=>{e.mediaOutputMuted=d;let g=d||e.bridgeMuted;m.setMuted(g);let h=document.querySelectorAll("video, audio");for(let y of h)y instanceof HTMLMediaElement&&(y.muted=g||y.defaultMuted)},onSetNativeMediaSyncDisabled:d=>{e.nativeMediaSyncDisabled!==d&&(e.nativeMediaSyncDisabled=d,e.mediaForceSyncNextTick=!0,d?(m.stopAll(),f.detachAudioSource()):Oe())},onSetWebAudioMediaDisabled:d=>{e.webAudioMediaDisabled!==d&&(e.webAudioMediaDisabled=d,e.mediaForceSyncNextTick=!0,d&&(m.stopAll(),f.detachAudioSource()),Oe())},onSetPlaybackRate:d=>{zi(d),e.transportClock&&e.transportClock.setRate(e.playbackRate),Os()},onSetRootDuration:Dm,onSetColorGrading:(d,g)=>{ze.setGrading(d,g)},onSetColorGradingCompare:(d,g)=>{ze.setCompare(d,g)},onTick:()=>{if(e.tornDown||!f.isPlaying())return;let d=f.now();if(e.currentTime=d,Ct(d),f.reachedEnd()){m.stopAll(),f.detachAudioSource(),f.pause(),e.isPlaying=!1;let g=f.getDuration();Number.isFinite(g)&&(f.seek(g),e.currentTime=g,Ct(g)),He("pause"),Oe(),ke(!0)}},onEnablePickMode:()=>Er.enablePickMode(),onDisablePickMode:()=>Er.disablePickMode(),onSetRuntimeData:Ri,onClearRuntimeData:ki,getCanonicalFps:()=>e.canonicalFps});let Ki=()=>{if(!e.tornDown){e.tornDown=!0,e.transportRafId!=null&&(window.cancelAnimationFrame(e.transportRafId),e.transportRafId=null),e.transportClock=null,m.destroy(),Et!=null&&(window.clearTimeout(Et),Et=null),s!=null&&(window.cancelAnimationFrame(s),s=null),km(),e.controlBridgeHandler&&(window.removeEventListener("message",e.controlBridgeHandler),e.controlBridgeHandler=null),i&&(window.removeEventListener("error",i),i=null),o&&(window.removeEventListener("unhandledrejection",o),o=null),e.beforeUnloadHandler&&(window.removeEventListener("beforeunload",e.beforeUnloadHandler),e.beforeUnloadHandler=null),Er.disablePickMode();for(let d of e.deterministicAdapters)if(!(!d||typeof d.revert!="function"))try{d.revert()}catch(g){L("runtime.init.site12",g)}e.deterministicAdapters=[];for(let d of a.splice(0))try{d()}catch(g){L("runtime.init.site13",g)}for(let d of e.injectedCompStyles)try{d.remove()}catch(g){L("runtime.init.site14",g)}e.injectedCompStyles=[];for(let d of e.injectedCompLinks)try{d.remove()}catch(g){L("runtime.init.site15",g)}e.injectedCompLinks=[];for(let d of e.injectedCompScripts)try{d.remove()}catch(g){L("runtime.init.site16",g)}e.injectedCompScripts=[],e.capturedTimeline=null,t=()=>{},window.__hfRuntimeTeardown===Ki&&(window.__hfRuntimeTeardown=null)}};window.__hfRuntimeTeardown=Ki,e.beforeUnloadHandler=Ki,window.addEventListener("beforeunload",e.beforeUnloadHandler)}var Vf=["BN","BN","BN","BN","BN","BN","BN","BN","BN","S","B","S","WS","B","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","B","B","B","S","WS","ON","ON","ET","ET","ET","ON","ON","ON","ON","ON","ES","CS","ES","CS","CS","EN","EN","EN","EN","EN","EN","EN","EN","EN","EN","CS","ON","ON","ON","ON","ON","ON","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","ON","ON","ON","ON","ON","ON","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","ON","ON","ON","ON","BN","BN","BN","BN","BN","BN","B","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","CS","ON","ET","ET","ET","ET","ON","ON","ON","ON","L","ON","ON","BN","ON","ON","ET","ET","EN","EN","ON","L","ON","ON","ON","EN","L","ON","ON","ON","ON","ON","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","ON","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","ON","L","L","L","L","L","L","L","L"],ss=[[697,698,"ON"],[706,719,"ON"],[722,735,"ON"],[741,749,"ON"],[751,767,"ON"],[768,879,"NSM"],[884,885,"ON"],[894,894,"ON"],[900,901,"ON"],[903,903,"ON"],[1014,1014,"ON"],[1155,1161,"NSM"],[1418,1418,"ON"],[1421,1422,"ON"],[1423,1423,"ET"],[1424,1424,"R"],[1425,1469,"NSM"],[1470,1470,"R"],[1471,1471,"NSM"],[1472,1472,"R"],[1473,1474,"NSM"],[1475,1475,"R"],[1476,1477,"NSM"],[1478,1478,"R"],[1479,1479,"NSM"],[1480,1535,"R"],[1536,1541,"AN"],[1542,1543,"ON"],[1544,1544,"AL"],[1545,1546,"ET"],[1547,1547,"AL"],[1548,1548,"CS"],[1549,1549,"AL"],[1550,1551,"ON"],[1552,1562,"NSM"],[1563,1610,"AL"],[1611,1631,"NSM"],[1632,1641,"AN"],[1642,1642,"ET"],[1643,1644,"AN"],[1645,1647,"AL"],[1648,1648,"NSM"],[1649,1749,"AL"],[1750,1756,"NSM"],[1757,1757,"AN"],[1758,1758,"ON"],[1759,1764,"NSM"],[1765,1766,"AL"],[1767,1768,"NSM"],[1769,1769,"ON"],[1770,1773,"NSM"],[1774,1775,"AL"],[1776,1785,"EN"],[1786,1808,"AL"],[1809,1809,"NSM"],[1810,1839,"AL"],[1840,1866,"NSM"],[1867,1957,"AL"],[1958,1968,"NSM"],[1969,1983,"AL"],[1984,2026,"R"],[2027,2035,"NSM"],[2036,2037,"R"],[2038,2041,"ON"],[2042,2044,"R"],[2045,2045,"NSM"],[2046,2069,"R"],[2070,2073,"NSM"],[2074,2074,"R"],[2075,2083,"NSM"],[2084,2084,"R"],[2085,2087,"NSM"],[2088,2088,"R"],[2089,2093,"NSM"],[2094,2136,"R"],[2137,2139,"NSM"],[2140,2143,"R"],[2144,2191,"AL"],[2192,2193,"AN"],[2194,2198,"AL"],[2199,2207,"NSM"],[2208,2249,"AL"],[2250,2273,"NSM"],[2274,2274,"AN"],[2275,2306,"NSM"],[2362,2362,"NSM"],[2364,2364,"NSM"],[2369,2376,"NSM"],[2381,2381,"NSM"],[2385,2391,"NSM"],[2402,2403,"NSM"],[2433,2433,"NSM"],[2492,2492,"NSM"],[2497,2500,"NSM"],[2509,2509,"NSM"],[2530,2531,"NSM"],[2546,2547,"ET"],[2555,2555,"ET"],[2558,2558,"NSM"],[2561,2562,"NSM"],[2620,2620,"NSM"],[2625,2626,"NSM"],[2631,2632,"NSM"],[2635,2637,"NSM"],[2641,2641,"NSM"],[2672,2673,"NSM"],[2677,2677,"NSM"],[2689,2690,"NSM"],[2748,2748,"NSM"],[2753,2757,"NSM"],[2759,2760,"NSM"],[2765,2765,"NSM"],[2786,2787,"NSM"],[2801,2801,"ET"],[2810,2815,"NSM"],[2817,2817,"NSM"],[2876,2876,"NSM"],[2879,2879,"NSM"],[2881,2884,"NSM"],[2893,2893,"NSM"],[2901,2902,"NSM"],[2914,2915,"NSM"],[2946,2946,"NSM"],[3008,3008,"NSM"],[3021,3021,"NSM"],[3059,3064,"ON"],[3065,3065,"ET"],[3066,3066,"ON"],[3072,3072,"NSM"],[3076,3076,"NSM"],[3132,3132,"NSM"],[3134,3136,"NSM"],[3142,3144,"NSM"],[3146,3149,"NSM"],[3157,3158,"NSM"],[3170,3171,"NSM"],[3192,3198,"ON"],[3201,3201,"NSM"],[3260,3260,"NSM"],[3276,3277,"NSM"],[3298,3299,"NSM"],[3328,3329,"NSM"],[3387,3388,"NSM"],[3393,3396,"NSM"],[3405,3405,"NSM"],[3426,3427,"NSM"],[3457,3457,"NSM"],[3530,3530,"NSM"],[3538,3540,"NSM"],[3542,3542,"NSM"],[3633,3633,"NSM"],[3636,3642,"NSM"],[3647,3647,"ET"],[3655,3662,"NSM"],[3761,3761,"NSM"],[3764,3772,"NSM"],[3784,3790,"NSM"],[3864,3865,"NSM"],[3893,3893,"NSM"],[3895,3895,"NSM"],[3897,3897,"NSM"],[3898,3901,"ON"],[3953,3966,"NSM"],[3968,3972,"NSM"],[3974,3975,"NSM"],[3981,3991,"NSM"],[3993,4028,"NSM"],[4038,4038,"NSM"],[4141,4144,"NSM"],[4146,4151,"NSM"],[4153,4154,"NSM"],[4157,4158,"NSM"],[4184,4185,"NSM"],[4190,4192,"NSM"],[4209,4212,"NSM"],[4226,4226,"NSM"],[4229,4230,"NSM"],[4237,4237,"NSM"],[4253,4253,"NSM"],[4957,4959,"NSM"],[5008,5017,"ON"],[5120,5120,"ON"],[5760,5760,"WS"],[5787,5788,"ON"],[5906,5908,"NSM"],[5938,5939,"NSM"],[5970,5971,"NSM"],[6002,6003,"NSM"],[6068,6069,"NSM"],[6071,6077,"NSM"],[6086,6086,"NSM"],[6089,6099,"NSM"],[6107,6107,"ET"],[6109,6109,"NSM"],[6128,6137,"ON"],[6144,6154,"ON"],[6155,6157,"NSM"],[6158,6158,"BN"],[6159,6159,"NSM"],[6277,6278,"NSM"],[6313,6313,"NSM"],[6432,6434,"NSM"],[6439,6440,"NSM"],[6450,6450,"NSM"],[6457,6459,"NSM"],[6464,6464,"ON"],[6468,6469,"ON"],[6622,6655,"ON"],[6679,6680,"NSM"],[6683,6683,"NSM"],[6742,6742,"NSM"],[6744,6750,"NSM"],[6752,6752,"NSM"],[6754,6754,"NSM"],[6757,6764,"NSM"],[6771,6780,"NSM"],[6783,6783,"NSM"],[6832,6877,"NSM"],[6880,6891,"NSM"],[6912,6915,"NSM"],[6964,6964,"NSM"],[6966,6970,"NSM"],[6972,6972,"NSM"],[6978,6978,"NSM"],[7019,7027,"NSM"],[7040,7041,"NSM"],[7074,7077,"NSM"],[7080,7081,"NSM"],[7083,7085,"NSM"],[7142,7142,"NSM"],[7144,7145,"NSM"],[7149,7149,"NSM"],[7151,7153,"NSM"],[7212,7219,"NSM"],[7222,7223,"NSM"],[7376,7378,"NSM"],[7380,7392,"NSM"],[7394,7400,"NSM"],[7405,7405,"NSM"],[7412,7412,"NSM"],[7416,7417,"NSM"],[7616,7679,"NSM"],[8125,8125,"ON"],[8127,8129,"ON"],[8141,8143,"ON"],[8157,8159,"ON"],[8173,8175,"ON"],[8189,8190,"ON"],[8192,8202,"WS"],[8203,8205,"BN"],[8207,8207,"R"],[8208,8231,"ON"],[8232,8232,"WS"],[8233,8233,"B"],[8234,8238,"BN"],[8239,8239,"CS"],[8240,8244,"ET"],[8245,8259,"ON"],[8260,8260,"CS"],[8261,8286,"ON"],[8287,8287,"WS"],[8288,8303,"BN"],[8304,8304,"EN"],[8308,8313,"EN"],[8314,8315,"ES"],[8316,8318,"ON"],[8320,8329,"EN"],[8330,8331,"ES"],[8332,8334,"ON"],[8352,8399,"ET"],[8400,8432,"NSM"],[8448,8449,"ON"],[8451,8454,"ON"],[8456,8457,"ON"],[8468,8468,"ON"],[8470,8472,"ON"],[8478,8483,"ON"],[8485,8485,"ON"],[8487,8487,"ON"],[8489,8489,"ON"],[8494,8494,"ET"],[8506,8507,"ON"],[8512,8516,"ON"],[8522,8525,"ON"],[8528,8543,"ON"],[8585,8587,"ON"],[8592,8721,"ON"],[8722,8722,"ES"],[8723,8723,"ET"],[8724,9013,"ON"],[9083,9108,"ON"],[9110,9257,"ON"],[9280,9290,"ON"],[9312,9351,"ON"],[9352,9371,"EN"],[9450,9899,"ON"],[9901,10239,"ON"],[10496,11123,"ON"],[11126,11263,"ON"],[11493,11498,"ON"],[11503,11505,"NSM"],[11513,11519,"ON"],[11647,11647,"NSM"],[11744,11775,"NSM"],[11776,11869,"ON"],[11904,11929,"ON"],[11931,12019,"ON"],[12032,12245,"ON"],[12272,12287,"ON"],[12288,12288,"WS"],[12289,12292,"ON"],[12296,12320,"ON"],[12330,12333,"NSM"],[12336,12336,"ON"],[12342,12343,"ON"],[12349,12351,"ON"],[12441,12442,"NSM"],[12443,12444,"ON"],[12448,12448,"ON"],[12539,12539,"ON"],[12736,12773,"ON"],[12783,12783,"ON"],[12829,12830,"ON"],[12880,12895,"ON"],[12924,12926,"ON"],[12977,12991,"ON"],[13004,13007,"ON"],[13175,13178,"ON"],[13278,13279,"ON"],[13311,13311,"ON"],[19904,19967,"ON"],[42128,42182,"ON"],[42509,42511,"ON"],[42607,42610,"NSM"],[42611,42611,"ON"],[42612,42621,"NSM"],[42622,42623,"ON"],[42654,42655,"NSM"],[42736,42737,"NSM"],[42752,42785,"ON"],[42888,42888,"ON"],[43010,43010,"NSM"],[43014,43014,"NSM"],[43019,43019,"NSM"],[43045,43046,"NSM"],[43048,43051,"ON"],[43052,43052,"NSM"],[43064,43065,"ET"],[43124,43127,"ON"],[43204,43205,"NSM"],[43232,43249,"NSM"],[43263,43263,"NSM"],[43302,43309,"NSM"],[43335,43345,"NSM"],[43392,43394,"NSM"],[43443,43443,"NSM"],[43446,43449,"NSM"],[43452,43453,"NSM"],[43493,43493,"NSM"],[43561,43566,"NSM"],[43569,43570,"NSM"],[43573,43574,"NSM"],[43587,43587,"NSM"],[43596,43596,"NSM"],[43644,43644,"NSM"],[43696,43696,"NSM"],[43698,43700,"NSM"],[43703,43704,"NSM"],[43710,43711,"NSM"],[43713,43713,"NSM"],[43756,43757,"NSM"],[43766,43766,"NSM"],[43882,43883,"ON"],[44005,44005,"NSM"],[44008,44008,"NSM"],[44013,44013,"NSM"],[64285,64285,"R"],[64286,64286,"NSM"],[64287,64296,"R"],[64297,64297,"ES"],[64298,64335,"R"],[64336,64450,"AL"],[64451,64466,"ON"],[64467,64829,"AL"],[64830,64847,"ON"],[64848,64911,"AL"],[64912,64913,"ON"],[64914,64967,"AL"],[64968,64975,"ON"],[64976,65007,"BN"],[65008,65020,"AL"],[65021,65023,"ON"],[65024,65039,"NSM"],[65040,65049,"ON"],[65056,65071,"NSM"],[65072,65103,"ON"],[65104,65104,"CS"],[65105,65105,"ON"],[65106,65106,"CS"],[65108,65108,"ON"],[65109,65109,"CS"],[65110,65118,"ON"],[65119,65119,"ET"],[65120,65121,"ON"],[65122,65123,"ES"],[65124,65126,"ON"],[65128,65128,"ON"],[65129,65130,"ET"],[65131,65131,"ON"],[65136,65278,"AL"],[65279,65279,"BN"],[65281,65282,"ON"],[65283,65285,"ET"],[65286,65290,"ON"],[65291,65291,"ES"],[65292,65292,"CS"],[65293,65293,"ES"],[65294,65295,"CS"],[65296,65305,"EN"],[65306,65306,"CS"],[65307,65312,"ON"],[65339,65344,"ON"],[65371,65381,"ON"],[65504,65505,"ET"],[65506,65508,"ON"],[65509,65510,"ET"],[65512,65518,"ON"],[65520,65528,"BN"],[65529,65533,"ON"],[65534,65535,"BN"],[65793,65793,"ON"],[65856,65932,"ON"],[65936,65948,"ON"],[65952,65952,"ON"],[66045,66045,"NSM"],[66272,66272,"NSM"],[66273,66299,"EN"],[66422,66426,"NSM"],[67584,67870,"R"],[67871,67871,"ON"],[67872,68096,"R"],[68097,68099,"NSM"],[68100,68100,"R"],[68101,68102,"NSM"],[68103,68107,"R"],[68108,68111,"NSM"],[68112,68151,"R"],[68152,68154,"NSM"],[68155,68158,"R"],[68159,68159,"NSM"],[68160,68324,"R"],[68325,68326,"NSM"],[68327,68408,"R"],[68409,68415,"ON"],[68416,68863,"R"],[68864,68899,"AL"],[68900,68903,"NSM"],[68904,68911,"AL"],[68912,68921,"AN"],[68922,68927,"AL"],[68928,68937,"AN"],[68938,68968,"R"],[68969,68973,"NSM"],[68974,68974,"ON"],[68975,69215,"R"],[69216,69246,"AN"],[69247,69290,"R"],[69291,69292,"NSM"],[69293,69311,"R"],[69312,69327,"AL"],[69328,69336,"ON"],[69337,69369,"AL"],[69370,69375,"NSM"],[69376,69423,"R"],[69424,69445,"AL"],[69446,69456,"NSM"],[69457,69487,"AL"],[69488,69505,"R"],[69506,69509,"NSM"],[69510,69631,"R"],[69633,69633,"NSM"],[69688,69702,"NSM"],[69714,69733,"ON"],[69744,69744,"NSM"],[69747,69748,"NSM"],[69759,69761,"NSM"],[69811,69814,"NSM"],[69817,69818,"NSM"],[69826,69826,"NSM"],[69888,69890,"NSM"],[69927,69931,"NSM"],[69933,69940,"NSM"],[70003,70003,"NSM"],[70016,70017,"NSM"],[70070,70078,"NSM"],[70089,70092,"NSM"],[70095,70095,"NSM"],[70191,70193,"NSM"],[70196,70196,"NSM"],[70198,70199,"NSM"],[70206,70206,"NSM"],[70209,70209,"NSM"],[70367,70367,"NSM"],[70371,70378,"NSM"],[70400,70401,"NSM"],[70459,70460,"NSM"],[70464,70464,"NSM"],[70502,70508,"NSM"],[70512,70516,"NSM"],[70587,70592,"NSM"],[70606,70606,"NSM"],[70608,70608,"NSM"],[70610,70610,"NSM"],[70625,70626,"NSM"],[70712,70719,"NSM"],[70722,70724,"NSM"],[70726,70726,"NSM"],[70750,70750,"NSM"],[70835,70840,"NSM"],[70842,70842,"NSM"],[70847,70848,"NSM"],[70850,70851,"NSM"],[71090,71093,"NSM"],[71100,71101,"NSM"],[71103,71104,"NSM"],[71132,71133,"NSM"],[71219,71226,"NSM"],[71229,71229,"NSM"],[71231,71232,"NSM"],[71264,71276,"ON"],[71339,71339,"NSM"],[71341,71341,"NSM"],[71344,71349,"NSM"],[71351,71351,"NSM"],[71453,71453,"NSM"],[71455,71455,"NSM"],[71458,71461,"NSM"],[71463,71467,"NSM"],[71727,71735,"NSM"],[71737,71738,"NSM"],[71995,71996,"NSM"],[71998,71998,"NSM"],[72003,72003,"NSM"],[72148,72151,"NSM"],[72154,72155,"NSM"],[72160,72160,"NSM"],[72193,72198,"NSM"],[72201,72202,"NSM"],[72243,72248,"NSM"],[72251,72254,"NSM"],[72263,72263,"NSM"],[72273,72278,"NSM"],[72281,72283,"NSM"],[72330,72342,"NSM"],[72344,72345,"NSM"],[72544,72544,"NSM"],[72546,72548,"NSM"],[72550,72550,"NSM"],[72752,72758,"NSM"],[72760,72765,"NSM"],[72850,72871,"NSM"],[72874,72880,"NSM"],[72882,72883,"NSM"],[72885,72886,"NSM"],[73009,73014,"NSM"],[73018,73018,"NSM"],[73020,73021,"NSM"],[73023,73029,"NSM"],[73031,73031,"NSM"],[73104,73105,"NSM"],[73109,73109,"NSM"],[73111,73111,"NSM"],[73459,73460,"NSM"],[73472,73473,"NSM"],[73526,73530,"NSM"],[73536,73536,"NSM"],[73538,73538,"NSM"],[73562,73562,"NSM"],[73685,73692,"ON"],[73693,73696,"ET"],[73697,73713,"ON"],[78912,78912,"NSM"],[78919,78933,"NSM"],[90398,90409,"NSM"],[90413,90415,"NSM"],[92912,92916,"NSM"],[92976,92982,"NSM"],[94031,94031,"NSM"],[94095,94098,"NSM"],[94178,94178,"ON"],[94180,94180,"NSM"],[113821,113822,"NSM"],[113824,113827,"BN"],[117760,117973,"ON"],[118e3,118009,"EN"],[118010,118012,"ON"],[118016,118451,"ON"],[118458,118480,"ON"],[118496,118512,"ON"],[118528,118573,"NSM"],[118576,118598,"NSM"],[119143,119145,"NSM"],[119155,119162,"BN"],[119163,119170,"NSM"],[119173,119179,"NSM"],[119210,119213,"NSM"],[119273,119274,"ON"],[119296,119361,"ON"],[119362,119364,"NSM"],[119365,119365,"ON"],[119552,119638,"ON"],[120513,120513,"ON"],[120539,120539,"ON"],[120571,120571,"ON"],[120597,120597,"ON"],[120629,120629,"ON"],[120655,120655,"ON"],[120687,120687,"ON"],[120713,120713,"ON"],[120745,120745,"ON"],[120771,120771,"ON"],[120782,120831,"EN"],[121344,121398,"NSM"],[121403,121452,"NSM"],[121461,121461,"NSM"],[121476,121476,"NSM"],[121499,121503,"NSM"],[121505,121519,"NSM"],[122880,122886,"NSM"],[122888,122904,"NSM"],[122907,122913,"NSM"],[122915,122916,"NSM"],[122918,122922,"NSM"],[123023,123023,"NSM"],[123184,123190,"NSM"],[123566,123566,"NSM"],[123628,123631,"NSM"],[123647,123647,"ET"],[124140,124143,"NSM"],[124398,124399,"NSM"],[124643,124643,"NSM"],[124646,124646,"NSM"],[124654,124655,"NSM"],[124661,124661,"NSM"],[124928,125135,"R"],[125136,125142,"NSM"],[125143,125251,"R"],[125252,125258,"NSM"],[125259,126063,"R"],[126064,126143,"AL"],[126144,126207,"R"],[126208,126287,"AL"],[126288,126463,"R"],[126464,126703,"AL"],[126704,126705,"ON"],[126706,126719,"AL"],[126720,126975,"R"],[126976,127019,"ON"],[127024,127123,"ON"],[127136,127150,"ON"],[127153,127167,"ON"],[127169,127183,"ON"],[127185,127221,"ON"],[127232,127242,"EN"],[127243,127247,"ON"],[127279,127279,"ON"],[127338,127343,"ON"],[127405,127405,"ON"],[127584,127589,"ON"],[127744,128728,"ON"],[128732,128748,"ON"],[128752,128764,"ON"],[128768,128985,"ON"],[128992,129003,"ON"],[129008,129008,"ON"],[129024,129035,"ON"],[129040,129095,"ON"],[129104,129113,"ON"],[129120,129159,"ON"],[129168,129197,"ON"],[129200,129211,"ON"],[129216,129217,"ON"],[129232,129240,"ON"],[129280,129623,"ON"],[129632,129645,"ON"],[129648,129660,"ON"],[129664,129674,"ON"],[129678,129734,"ON"],[129736,129736,"ON"],[129741,129756,"ON"],[129759,129770,"ON"],[129775,129784,"ON"],[129792,129938,"ON"],[129940,130031,"ON"],[130032,130041,"EN"],[130042,130042,"ON"],[131070,131071,"BN"],[196606,196607,"BN"],[262142,262143,"BN"],[327678,327679,"BN"],[393214,393215,"BN"],[458750,458751,"BN"],[524286,524287,"BN"],[589822,589823,"BN"],[655358,655359,"BN"],[720894,720895,"BN"],[786430,786431,"BN"],[851966,851967,"BN"],[917502,917759,"BN"],[917760,917999,"NSM"],[918e3,921599,"BN"],[983038,983039,"BN"],[1048574,1048575,"BN"],[1114110,1114111,"BN"]];function xy(e){if(e<=255)return Vf[e];let t=0,n=ss.length-1;for(;t<=n;){let r=t+n>>1,i=ss[r];if(ei[1]){t=r+1;continue}return i[2]}return"L"}function yy(e){let t=e.length;if(t===0)return null;let n=new Array(t),r=!1;for(let u=0;u=55296&&c<=56319&&u+1=56320&&b<=57343&&(f=(c-55296<<10)+(b-56320)+65536,m=2)}let p=xy(f);(p==="R"||p==="AL"||p==="AN")&&(r=!0);for(let b=0;b=0&&n[c]==="ET";c--)n[c]="EN";for(c=u+1;c0?n[u-1]:l,m=c0&&t.charCodeAt(t.length-1)===32&&(t=t.slice(0,-1)),t}function wy(e){return/[\r\f]/.test(e)?e.replace(/\r\n/g,` +`,$a=new WeakMap;function ja(e){return lf.has(e)}var lf=new WeakSet;function Ka(e){let t=$a.get(e);return t||(t=(async()=>{if(!e.audioWorklet)throw new Error("AudioWorklet is unavailable \u2014 the page needs a secure context (https, localhost or file://)");let n=`data:text/javascript;base64,${btoa(String.fromCharCode(...new TextEncoder().encode(Ox)))}`;await e.audioWorklet.addModule(n),lf.add(e)})().catch(n=>{throw $a.delete(e),n}),$a.set(e,t)),t}function Hx(e,t,n){let r=.6+Math.max(0,Math.min(1,t))*2.6,i=Math.max(1,Math.floor(e*r)),o=new Float32Array(i),a=Math.round(t*1e3)*2654435761+Math.round(n*1e3)*40503>>>0,l=()=>(a=a*1664525+1013904223>>>0,a/4294967295*2-1),s=Math.max(.001,1-Math.max(0,Math.min(1,n))),u=0,c=0;for(let m=0;m0)for(let m=0;mtypeof e=="number"?e:Number(e??0),Ya=e=>e/1e3;function ff(e,t,n,r){let i=Math.max(1,Math.round(e.sampleRate)),o=e.createBuffer(1,i,e.sampleRate),a=o.getChannelData(0);for(let u=0;u1-n}]}function pf(e,t,n){e.gain.value=n,t.gain.value=1-n}function Ja(e,t,n){return{input:e,output:e,update:t,automation:n,dispose:()=>e.disconnect()}}var Gx=new Set(["peaking","highpass","lowpass"]),uf=e=>Math.pow(10,e/20),Bx=(e,t)=>{let n=e.createGain(),r=i=>{n.gain.value=uf(de(i.gain))};return r(t),Ja(n,r,{gain:[{param:n.gain,map:uf}]})};function ur(e,t){return(n,r)=>{let i=n.createBiquadFilter();i.type=e;let o=a=>{i.frequency.value=de(a.frequency),a.q!==void 0&&(i.Q.value=de(a.q)),t&&(i.gain.value=de(a.gain))};return o(r),Ja(i,o,{frequency:[{param:i.frequency}],...Gx.has(e)?{q:[{param:i.Q}]}:{},...t?{gain:[{param:i.gain}]}:{}})}}function Ux(e){return(t,n)=>{let r=Math.tan(Math.PI*de(n.frequency)/t.sampleRate),i=e==="highpass"?t.createIIRFilter([1/(1+r),-1/(1+r)],[1,(r-1)/(r+1)]):t.createIIRFilter([r/(1+r),r/(1+r)],[1,(r-1)/(r+1)]);return Ja(i,()=>{})}}function cr(e){return(t,n)=>{let r=new AudioWorkletNode(t,e,{processorOptions:{...n}});return{input:r,output:r,update:i=>r.port.postMessage({...i}),dispose:()=>{r.port.postMessage({__hfDispose:!0}),r.disconnect()}}}}var Wx={tanh:Math.tanh,atan:e=>2/Math.PI*Math.atan(Math.PI/2*e),cubic:e=>Math.abs(e)>=1?Math.sign(e):e-e**3/3,exp:e=>Math.sign(e)*(1-Math.exp(-Math.abs(e))),alg:e=>e/Math.sqrt(1+e*e),quintic:e=>Math.abs(e)>=1?Math.sign(e):e-e**5/5,sin:e=>Math.abs(e)>=1?Math.sign(e):Math.sin(Math.PI/2*e),erf:e=>Math.tanh(1.20211*e),hard:e=>Math.max(-1,Math.min(1,e))},Vx=(e,t)=>{let n=e.createWaveShaper(),r=e.createGain(),i=e.createGain();r.connect(n).connect(i);let o=a=>{let l=Wx[String(a.type)]??Math.tanh,s=Math.pow(10,de(a.threshold)/20),u=8192,c=new Float32Array(u);for(let f=0;f=4?"4x":de(a.oversample)>=2?"2x":"none",i.gain.value=Math.pow(10,de(a.output)/20)};return o(t),{input:r,output:i,update:o,automation:{output:[{param:i.gain,map:a=>Math.pow(10,a/20)}]},dispose:()=>{r.disconnect(),n.disconnect(),i.disconnect()}}},zx=(e,t)=>{let n=e.createGain(),r=e.createGain(),i=e.createDelay(5),o=e.createGain(),a=e.createGain(),l=e.createGain();n.connect(i),i.connect(o),o.connect(i),i.connect(a).connect(r),n.connect(l).connect(r);let s=u=>{i.delayTime.value=Math.min(5,de(u.time)/1e3),o.gain.value=de(u.feedback),pf(a,l,de(u.mix))};return s(t),{input:n,output:r,update:s,automation:{time:[{param:i.delayTime,map:u=>Math.min(5,Ya(u))}],feedback:[{param:o.gain}],mix:Xa(a.gain,l.gain)},dispose:()=>[n,r,i,o,a,l].forEach(u=>u.disconnect())}},qx=(e,t,n)=>{let r=e.createGain(),i=e.createGain(),o=e.createDelay(.5),a=ff(e,"sine",de(t.speed),n),l=e.createGain(),s=e.createGain(),u=e.createGain();a.connect(l).connect(o.delayTime),r.connect(o).connect(s).connect(i),r.connect(u).connect(i);let c=f=>{o.delayTime.value=de(f.delay)/1e3,l.gain.value=de(f.depth)/1e3,a.playbackRate.value=de(f.speed),pf(s,u,de(f.mix))};return c(t),{input:r,output:i,update:c,automation:{delay:[{param:o.delayTime,map:Ya}],depth:[{param:l.gain,map:Ya}],speed:[{param:a.playbackRate}],mix:Xa(s.gain,u.gain)},dispose:()=>{mf(a),[r,i,o,l,s,u].forEach(f=>f.disconnect())}}},$x=6,jx=(e,t,n)=>{let r=e.createGain(),i=e.createGain(),o=e.createGain(),a=e.createGain(),l=ff(e,String(t.type)==="1"?"sine":"triangle",de(t.speed),n),s=e.createGain(),u=e.createGain(),c=e.createGain(),f=[];r.connect(o);let m=o;for(let b=0;b<$x;b++){let v=e.createBiquadFilter();v.type="allpass",v.Q.value=.7071,s.connect(v.frequency),m.connect(v),m=v,f.push(v)}l.connect(s),m.connect(u).connect(a),o.connect(c).connect(a),a.connect(i);let p=b=>{let v=1e3/Math.max(.1,de(b.delay));for(let x of f)x.frequency.value=v;s.gain.value=v*de(b.decay),l.playbackRate.value=de(b.speed),o.gain.value=de(b.in_gain),a.gain.value=de(b.out_gain),u.gain.value=1,c.gain.value=1};return p(t),{input:r,output:i,update:p,automation:{speed:[{param:l.playbackRate}],in_gain:[{param:o.gain}],out_gain:[{param:a.gain}]},dispose:()=>{mf(l),[r,i,o,a,s,u,c,...f].forEach(b=>b.disconnect())}}},Kx=(e,t)=>{let n=e.createGain(),r=e.createGain(),i=e.createConvolver(),o=e.createGain(),a=e.createGain();i.normalize=!1,n.connect(i).connect(o).connect(r),n.connect(a).connect(r);let l="",s=u=>{let c=`${de(u.size)}:${de(u.damping)}`;if(c!==l){let f=Hx(e.sampleRate,de(u.size),de(u.damping)),m=e.createBuffer(1,f.length,e.sampleRate);m.getChannelData(0).set(f),i.buffer=m,l=c}o.gain.value=de(u.wet),a.gain.value=de(u.dry)};return s(t),{input:n,output:r,update:s,automation:{wet:[{param:o.gain}],dry:[{param:a.gain}]},dispose:()=>[n,r,i,o,a].forEach(u=>u.disconnect())}},Yx={"gain-node":Bx,"biquad-peaking":ur("peaking",!0),"biquad-lowshelf":ur("lowshelf",!0),"biquad-highshelf":ur("highshelf",!0),"biquad-highpass":ur("highpass",!1),"biquad-lowpass":ur("lowpass",!1),"worklet-compressor":cr("hf-compressor"),"worklet-limiter":cr("hf-limiter"),"worklet-gate":cr("hf-gate"),"worklet-bitcrush":cr("hf-bitcrush"),"worklet-pitchshift":cr("hf-pitchshift"),waveshaper:Vx,"delay-feedback":zx,"chorus-lfo":qx,"allpass-phaser":jx,convolver:Kx};function hf(e){return e.nodes.some(t=>Sn(t.type)?.web.startsWith("worklet-")??!1)}function Xx(e,t,n,r=0){let i=Sn(t);if(!i)throw new Error(`Unknown effect type: ${t}`);let o=An(t,n);if((t==="highpass"||t==="lowpass")&&String(o.poles)==="1")return Ux(t)(e,o,r);let a=Yx[i.web];if(!a)throw new Error(`No Web Audio builder for ${i.web}`);return a(e,o,r)}function cf(e){let t=[];for(let n of e){let r=n.fromPreset,i=t.at(-1);if(i&&i.preset===r)i.nodes.push(n);else{let o=typeof n.presetAmount=="number"?n.presetAmount:1;t.push({...r?{preset:r}:{},amount:Math.min(1,Math.max(0,o)),nodes:[n]})}}return t}function df(e){return En(e).map(t=>{let n=An(t.type,t.params),r=n.poles!==void 0?`:${n.poles}`:"",i=String(n.poles)==="1"?`@${n.frequency}`:"",o=t.type==="phaser"?`~${n.type}`:"",a=t.fromPreset?`%${t.fromPreset}`:"";return`${t.type}${r}${i}${o}${a}`}).join("|")}function gf(e,t,n=0){var f;let r=e.createGain(),i=e.createGain(),o=[],a=[],l=cf(En(t)),s=r;for(let m of l){let p=null;if(m.preset){let b=e.createGain(),v=e.createGain(),x=e.createGain(),_=e.createGain();x.gain.value=m.amount,v.gain.value=1-m.amount,s.connect(b),b.connect(v).connect(_),p={entry:b,wet:x,dry:v,join:_},s=b}for(let b of m.nodes){let v=Xx(e,b.type,b.params??{},n);s.connect(v.input),s=v.output,o.push({...b.id?{id:b.id}:{},type:b.type,handle:v})}p&&m.preset&&(s.connect(p.wet).connect(p.join),a.push({id:m.preset,...p}),s=p.join)}s.connect(i);let u=df(t),c={};for(let m of a)(c[f=m.id]??(c[f]=[])).push(...Xa(m.wet.gain,m.dry.gain));return{input:r,output:i,presets:c,nodes:o,update(m){if(df(m)!==u)return!1;En(m).forEach((b,v)=>{let x=o[v];x&&(x.handle.update(An(b.type,b.params)),b.id===void 0?delete x.id:x.id=b.id)});let p=0;for(let b of cf(En(m))){if(!b.preset)continue;let v=a[p++];!v||v.id!==b.preset||(v.wet.gain.value=b.amount,v.dry.gain.value=1-b.amount)}return!0},dispose(){for(let{handle:m}of o)m.dispose();for(let{entry:m,wet:p,dry:b,join:v}of a)m.disconnect(),p.disconnect(),b.disconnect(),v.disconnect();r.disconnect(),i.disconnect()}}}var bf={version:1,nodes:[]},xf={version:1,lanes:[]};function yf(e,t){let n=(typeof e.getAttribute=="function"?e.getAttribute(et):null)??"";if(!n)return xf;try{return Fl(Or(n),t)}catch{return xf}}function on(e){let t=(typeof e.getAttribute=="function"?e.getAttribute(Tt):null)??"";if(!t)return{chain:bf,raw:""};try{return{chain:Rl(t),raw:t}}catch{return{chain:bf,raw:""}}}function vf(e){return yf(e,on(e).chain)}function wi(e,t,n,r,i){let{chain:o}=on(t),a=null,l=[],s=!1,u=0,c=()=>{try{a?(n.disconnect(a.input),a.output.disconnect(r),a.dispose()):n.disconnect(r)}catch{}a=null},f=(T,M)=>{if(T.nodes.length===0){n.connect(r);return}if(hf(T)&&!ja(e)){n.connect(r);let D=++u;Ka(e).then(()=>{s||D!==u||x(on(t).chain)}).catch(()=>{});return}try{let D=gf(e,T,M);n.connect(D.input),D.output.connect(r),a=D}catch{n.connect(r)}},m=(T,M)=>{l=M&&a?af(yf(t,T),T,a.nodes,M,a.presets):[]},p=i?{...i}:null;f(o,p?.elapsed??0),m(o,p);let b=()=>{if(!p)return null;let T=typeof e.currentTime=="number"?e.currentTime:p.scheduledAt;return{scheduledAt:T,elapsed:p.elapsed+(T-p.scheduledAt)*p.rate,rate:p.rate}},v=T=>{let M=b();M&&(rn(l,M.scheduledAt),m(T,M))},x=T=>{let M=b();rn(l,M?.scheduledAt??0),c(),f(T,M?.elapsed??0),m(T,M)},_=null,R=t;return typeof MutationObserver<"u"&&typeof R?.nodeType=="number"&&(_=new MutationObserver(()=>{let T=on(t);l.length>0&&lr(l),!a||!a.update(T.chain)?x(T.chain):v(T.chain)}),_.observe(R,{attributes:!0,attributeFilter:[Tt,et]})),{reanchor:T=>{if(s)return;let M=b();M&&rn(l,M.scheduledAt),p={...T},m(on(t).chain,p)},setRate:T=>{let M=b();s||!M||!Number.isFinite(T)||T<=0||T===M.rate||(p={...M,rate:T},rn(l,M.scheduledAt),m(on(t).chain,p))},dispose:()=>{s=!0,_?.disconnect(),l.length>0&&rn(l,typeof e.currentTime=="number"?e.currentTime:0),a?.dispose()}}}var Sf="runtime_web_audio_bypass";function Qa(e,t){return typeof e.getAttribute=="function"?e.getAttribute(t):null}function dr(e,t){return Qa(e,t)!==null}function Jx(e){return dr(e,"crossorigin")?!0:e.crossOrigin!=null}function Qx(e){return typeof e.baseURI=="string"&&e.baseURI?e.baseURI:typeof document<"u"?document.baseURI:""}function Zx(e){let t=typeof e.currentSrc=="string"?e.currentSrc:"";if(t)return[t];let n=Qa(e,"src");if(n)return[n];if(typeof e.querySelectorAll!="function")return[];let r=[];for(let i of Array.from(e.querySelectorAll("source"))){let o=i.getAttribute("src");o&&r.push(o)}return r}function ey(e,t){if(typeof window>"u")return!1;let n;try{n=new URL(e,Qx(t))}catch{return!1}return n.protocol!=="http:"&&n.protocol!=="https:"||n.origin===window.location.origin?!1:!Jx(t)}function Ef(e){return(typeof e.currentSrc=="string"?e.currentSrc:"")?!0:dr(e,"src")}function an(e){for(let t of Zx(e))if(ey(t,e))return{kind:"decode-only",reason:"cross_origin_no_cors",asset:t};return{kind:"web-audio"}}function ty(e){let t=[];dr(e,Tt)&&t.push("fx-chain"),dr(e,et)&&t.push("automation"),dr(e,Gr)&&t.push("audio-group");let n=Number.parseFloat(Qa(e,"data-volume")??"");return Number.isFinite(n)&&n>1&&t.push("above-unity-gain"),t}function ny(){return typeof window<"u"&&!!window.__HF_EXPORT_RENDER_SEEK_CONFIG}var Af=new WeakSet;function sn(e,t){if(t.kind==="web-audio"||ny()||Af.has(e))return;let n=ty(e);Af.add(e);let r={asset:t.asset,reason:t.reason,lostProcessing:n,note:"cross-origin media without a `crossorigin` opt-in is silent through createMediaElementSource (Web Audio spec); using native playback instead"};be({source:"hf-preview",type:"diagnostic",code:Sf,details:r});let i=n.length>0?` Native playback cannot reproduce: ${n.join(", ")} \u2014 proxy or download the asset to a same-origin URL to keep it.`:"";console.info(`[hyperframes] ${Sf}: "${t.asset}" (${t.reason}): Web Audio capture withheld; the track plays through native HTMLMediaElement output.${i}`)}function Za(e){return!Number.isFinite(e)||e<=0?1:e}function wf(e){return Le(e)}function ry(e,t){t||e.paused||!Cr().__hfDebug||console.debug("[hyperframes] webAudioTransport claimed fallback-playing element:",e.currentSrc||e.getAttribute("src")||"")}function iy(e,t){let{elapsed:n,mediaStart:r,scheduledAt:i,globalRate:o,mediaRate:a,clipDuration:l}=t,s=Number.isFinite(l)&&l>0,u=l*a;if(n>=0){let f=n*a,m=u-f;return s&&m<=0?!1:(s?e.start(0,f+r,m):e.start(0,f+r),!0)}let c=-n/o;return s?e.start(i+c,r,u):e.start(i+c,r),!0}function Ci(e,t,n){let r=sf(vf(e));r&&qa([{param:t.gain}],r,Pr.scale,n)}function fr(e){return e.sourceKind==="buffer"}var _i=class{constructor(){ge(this,"_ctx",null);ge(this,"_bufferCache",new Map);ge(this,"_failedSrcs",new Set);ge(this,"_mediaElementSources",new WeakMap);ge(this,"_activeSources",[]);ge(this,"_masterGain",null);ge(this,"_masterVolume",1);ge(this,"_masterMuted",!1);ge(this,"_groups",new Map);ge(this,"_rateAnchorCtx",0);ge(this,"_rateAnchorComp",0);ge(this,"_rate",1);ge(this,"_paused",!0);ge(this,"_playGeneration",0)}async init(){try{return this._ctx=new AudioContext,this._masterGain=this._ctx.createGain(),this._masterGain.connect(this._ctx.destination),this.applyMasterGain(),!0}catch{return!1}}get context(){return this._ctx}getTime(){return!this._ctx||this._paused?-1:this._rateAnchorComp+(this._ctx.currentTime-this._rateAnchorCtx)*this._rate}async decodeAudioElement(t){let n=t.currentSrc||t.getAttribute("src");if(!n)return null;if(this._bufferCache.has(n))return this._bufferCache.get(n);if(this._failedSrcs.has(n)||!this._ctx)return null;let r;try{let i=await fetch(n,{cache:"no-store"});if(!i.ok)return L("webAudioTransport.fetch",new Error(`${i.status} ${n}`)),null;r=await i.arrayBuffer()}catch(i){return L("webAudioTransport.fetch",i),null}try{let i=await this._ctx.decodeAudioData(r);return this._bufferCache.set(n,i),i}catch(i){return this._failedSrcs.add(n),L("webAudioTransport.decode",i),null}}startGeneration(){return this._playGeneration+=1,this._playGeneration}currentGeneration(){return this._playGeneration}acquireMediaElementSource(t){let n=this._mediaElementSources.get(t);if(n){let o=an(t);if(o.kind!=="web-audio"){try{n.disconnect()}catch{}return this._mediaElementSources.delete(t),sn(t,o),null}return n}if(!this._ctx)return null;let r=an(t);if(r.kind!=="web-audio")return sn(t,r),null;let i=this._ctx.createMediaElementSource(t);return this._mediaElementSources.set(t,i),i}async scheduleMediaElementPlayback(t,n,r,i,o,a,l=1){if(!this._ctx||!this._masterGain||a!==this._playGeneration)return null;try{if(this._ctx.state==="suspended"&&await this._ctx.resume(),a!==this._playGeneration)return null;let s=this.acquireMediaElementSource(t);if(!s)return null;let u=Za(l),c=this._ctx.createGain();c.gain.value=o;let f=this._ctx.currentTime,m=i-n,p={scheduledAt:f,elapsed:m,rate:u},b=wi(this._ctx,t,s,c,p);c.connect(this.resolveDestination(t,f,i,u)??this._masterGain),Ci(t,c,p),this._rate=u,this._rateAnchorCtx=f,this._rateAnchorComp=i;let v={fx:b,el:t,sourceNode:s,sourceKind:"media-element",gainNode:c,compositionStart:n,mediaStart:r,scheduledAt:f,priorMuted:t.muted,priorVolume:t.volume,mediaPlaybackRate:_e(t),bounded:!1};return t.volume=1,this._activeSources.push(v),this._paused=!1,v}catch(s){return L("webAudioTransport.mediaElementSource",s),null}}groupInput(t,n,r){let i=this._groups.get(t);if(i){if(i.generation!==this._playGeneration)try{i.reanchor(r),i.generation=this._playGeneration}catch(m){L("webAudioTransport.groupReanchor",m)}return i.input}if(!this._ctx||!this._masterGain)return null;let o=this._ctx.createGain(),a=this._ctx.createGain();a.connect(this._masterGain);let l=()=>po(n,t),s=l(),u=this._ctx.createGain();u.gain.value=s?.hasAttribute("data-hidden")?0:1,u.connect(a);let c=this._ctx.createGain();c.gain.value=wf(mo(s)),c.connect(u);let f=wi(this._ctx,s??{getAttribute:()=>null},o,c,r);return s&&Ci(s,c,r),this._groups.set(t,{input:o,fader:c,muteGain:u,fx:f,generation:this._playGeneration,reanchor:m=>{lr([{param:c.gain}]);let p=l();c.gain.value=wf(mo(p)),u.gain.value=p?.hasAttribute("data-hidden")?0:1,f?.reanchor(m),p&&Ci(p,c,m)},dispose:()=>{try{f?.dispose(),o.disconnect(),c.disconnect(),u.disconnect(),a.disconnect()}catch{}}}),o}setGroupMuted(t,n){let r=this._groups.get(t);if(r)try{r.muteGain.gain.value=n?0:1}catch(i){L("webAudioTransport.setGroupMuted",i)}}resolveDestination(t,n,r,i){if(!this._masterGain)return null;let o=Il(t);if(!o)return this._masterGain;let a={scheduledAt:n,elapsed:r,rate:i};return this.groupInput(o,t.ownerDocument,a)??this._masterGain}handleSourceEnded(t,n,r,i){let o=this._activeSources.indexOf(n);if(o!==-1){this._activeSources.splice(o,1),r.muted=i;try{t.disconnect(),n.fx?.dispose(),n.gainNode.disconnect()}catch{}this._activeSources.length===0&&(this._paused=!0)}}async schedulePlayback(t,n,r,i,o,a,l,s=1,u=Number.POSITIVE_INFINITY){if(!this._ctx||!this._masterGain||l!==this._playGeneration)return null;try{if(this._ctx.state==="suspended"&&await this._ctx.resume(),l!==this._playGeneration)return null;let c=Za(s),f=_e(t),m=c*f,p=this._ctx.createBufferSource();p.buffer=n,p.playbackRate.value=m;let b=this._ctx.createGain();b.gain.value=a;let v=o-r,x=this._ctx.currentTime,_={scheduledAt:x,elapsed:v,rate:c},R=wi(this._ctx,t,p,b,_);if(b.connect(this.resolveDestination(t,x,o,c)??this._masterGain),Ci(t,b,_),this._rate=c,this._rateAnchorCtx=x,this._rateAnchorComp=o,!iy(p,{elapsed:v,mediaStart:i,scheduledAt:x,globalRate:c,mediaRate:f,clipDuration:u}))return p.disconnect(),R?.dispose(),b.disconnect(),null;let T=t.muted;t.muted=!0,ry(t,T);let M={fx:R,el:t,sourceNode:p,sourceKind:"buffer",gainNode:b,compositionStart:r,mediaStart:i,scheduledAt:x,priorMuted:T,priorVolume:t.volume,mediaPlaybackRate:f,bounded:Number.isFinite(u)&&u>0};return this._activeSources.push(M),this._paused=!1,p.addEventListener("ended",()=>this.handleSourceEnded(p,M,t,T)),M}catch(c){return L("webAudioTransport.schedule",c),null}}setRate(t){let n=Za(t);if(n===this._rate)return!1;this._ctx&&!this._paused&&(this._rateAnchorComp=this.getTime(),this._rateAnchorCtx=this._ctx.currentTime),this._rate=n;for(let r of this._activeSources)try{fr(r)&&(r.sourceNode.playbackRate.value=n*r.mediaPlaybackRate),r.fx?.setRate(n)}catch(i){L("webAudioTransport.setRate",i)}for(let r of this._groups.values())try{r.fx?.setRate(n)}catch(i){L("webAudioTransport.setRate.group",i)}return!0}hasBoundedActiveSources(){return this._activeSources.some(t=>fr(t)&&t.bounded)}stopAll(){for(let t of this._activeSources){try{fr(t)&&t.sourceNode.stop(),t.sourceNode.disconnect(),t.fx?.dispose(),t.gainNode.disconnect()}catch{}fr(t)?t.el.muted=t.priorMuted:t.el.volume=t.priorVolume}this._activeSources=[],this._paused=!0}setVolume(t){this._masterVolume=Math.max(0,Math.min(1,t)),this.applyMasterGain()}setElementVolume(t,n){let r=Le(n);for(let i of this._activeSources)if(i.el===t)try{i.sourceKind==="media-element"&&(i.el.volume=1),i.gainNode.gain.value=r}catch(o){L("webAudioTransport.setElementVolume",o)}}setMuted(t){this._masterMuted=t,this.applyMasterGain()}applyMasterGain(){this._masterGain&&(this._masterGain.gain.value=this._masterMuted?0:this._masterVolume)}isActive(){return this._activeSources.length>0&&!this._paused}ownsElement(t){return!this._paused&&this._activeSources.some(n=>n.el===t&&fr(n))}routesElement(t){return!this._paused&&this._activeSources.some(n=>n.el===t)}destroy(){this.stopAll();for(let t of this._groups.values())t.dispose();if(this._groups.clear(),this._bufferCache.clear(),this._failedSrcs.clear(),this._mediaElementSources=new WeakMap,this._ctx)try{this._ctx.close()}catch{}this._ctx=null,this._masterGain=null,this._masterVolume=1,this._masterMuted=!1}};var Cf="data-hf-studio-manual-edit-gesture";function _f(e){return!Number.isInteger(e.tick)||e.tick<=0||e.tick%60!==0?!1:!(e.isPlaying&&e.hasCapturedTimeline&&e.currentTimeSeconds<2)}var oy=/^\s*spring\(\s*([+-]?(?:\d+(?:\.\d*)?|\.\d+))\s*\)\s*$/;function Tf(e){return Math.max(0,Math.min(1,e))}function Rf(e){let t=oy.exec(e);if(!t)return null;let n=Number(t[1]);return Number.isFinite(n)?Tf(n):null}function kf(e,t){if(!Number.isFinite(e))return e;if(e<=0)return 0;if(e>=1)return 1;let n=Tf(t),r=12-n*6,i=Math.PI*2*(1+n*1.5),o=1-Math.exp(-r)*Math.cos(i);return(1-Math.exp(-r*e)*Math.cos(i*e))/o}var ay=/^\s*wiggle\(\s*(\d+)\s*,\s*(easeOut|easeInOut|anticipate|uniform)\s*(?:,\s*([+-]?(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+)?)\s*)?\)\s*$/,sy=Math.PI*2;function ly(e){let t=ay.exec(e);if(!t)return null;let n=Number(t[1]);if(!Number.isSafeInteger(n)||n<1)return null;let r=t[2];if(r!=="easeOut"&&r!=="easeInOut"&&r!=="anticipate"&&r!=="uniform")return null;if(t[3]===void 0)return{wiggles:n,type:r};let i=Number(t[3]);return!Number.isFinite(i)||i<0||i>1?null:{wiggles:n,type:r,amplitude:i}}function uy(e,t,n,r){if(!Number.isFinite(e))return e;if(e<=0)return 0;if(e>=1)return 1;let i=r??(n==="easeInOut"?.08:n==="uniform"?.14:n==="anticipate"?.12:.16),o=n==="easeInOut"?i*Math.sin(Math.PI*e):n==="uniform"?i:i*(1-e);return e+(n==="anticipate"?-1:1)*o*Math.sin(sy*t*e)}function Mf(e,t){let n=ly(e);if(!n)return null;let r=`${n.wiggles}:${n.type}:${n.amplitude??"default"}`,i=t?.get(r);if(i)return i;let o=a=>uy(a,n.wiggles,n.type,n.amplitude);return t?.set(r,o),o}var cy=24,Ff=e=>e>=1?1:0,dy=e=>e,Ti=String.raw`([+-]?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?)`,fy=new RegExp(String.raw`^\s*M\s*0\s*,\s*0\s+C\s*${Ti}\s*,\s*${Ti}\s+${Ti}\s*,\s*${Ti}\s+1\s*,\s*1\s*$`,"i");function Nf(e,t,n){let r=1-e;return 3*r*r*e*t+3*r*e*e*n+e*e*e}function my(e,t,n,r,i){if(!Number.isFinite(e))return e;if(e<=0)return 0;if(e>=1)return 1;let o=0,a=1;for(let l=0;l1?null:a=>my(a,n,r,i,o)}function hy(e,t){if(!e.startsWith("spring("))return null;let n=Rf(e);if(n===null)return null;let r=t.get(n);if(r)return r;let i=o=>kf(o,n);return t.set(n,i),i}function gy(e,t){if(!e.startsWith("custom(")||!e.endsWith(")"))return null;let n=e.slice(7,-1),r=t.get(n);if(r)return r;let i=py(n);return i&&t.set(n,i),i}function Lf(e){if(e.__hfCustomEaseInstalled)return!0;let t=e.parseEase;if(!t)return!1;let n=new Map,r=new Map,i=new Map,o=s=>typeof s!="string"?null:s==="hold"?Ff:Mf(s,i)??hy(s,r)??gy(s,n),a=(s,u,c=[])=>{let f=o(s);return f||(typeof s=="string"&&/^(?:hold|spring|wiggle|custom)(?:\(|$)/.test(s.trim())&&Ne("custom_ease_parse_failed",{ease:s}),t.call(u,s,...c)??dy)};e.parseEase=function(u,...c){return a(u,this,c)};let l=e.registerEase;if(typeof l=="function"){l("hold",Ff);let s=u=>{let c=f=>f;c.config=(...f)=>a(`${u}(${f.join(",")})`,e),l(u,c)};s("spring"),s("wiggle"),s("custom")}return e.__hfCustomEaseInstalled=!0,!0}var ns=new Map,mr=new Map,es=new Map,ts=()=>{},If=()=>{},Df=0;function rs(e){return/^[a-z][a-z0-9-]{0,63}$/.test(e)}function Pf(e){let t=(es.get(e)??0)+1;return es.set(e,t),t}function Of(e){return typeof e=="number"&&Number.isSafeInteger(e)&&e>0?e:(Df-=1,Df)}function is(e,t){let n=mr.get(e);if(!n)return;let r=()=>es.get(e)===t.generation&&mr.get(e)===n;try{Promise.resolve(n(t.payload)).then(()=>{r()&&If(e,t.requestId)},i=>{r()&&ts(e,t.requestId,i)})}catch(i){r()&&ts(e,t.requestId,i)}}function Hf(e){ts=e}function Gf(e){If=e}function Ri(e,t,n){if(!rs(e))return;let r={payload:t,requestId:Of(n),generation:Pf(e)};ns.set(e,r),is(e,r)}function ki(e,t){rs(e)&&(ns.delete(e),is(e,{payload:void 0,requestId:Of(t),generation:Pf(e)}))}function Bf(e,t){if(!rs(e))throw new Error(`Invalid HyperFrames runtime-data channel: ${e}`);mr.set(e,t);let n=ns.get(e);return n&&is(e,n),()=>{mr.get(e)===t&&mr.delete(e)}}var os="data-hf-authored-duration",as="data-hf-authored-end",Uf=!1;function ot(e){if(e){if(typeof e.pause!="function"){Uf||(Uf=!0,Ne("timeline_missing_pause",{}));return}try{e.pause()}catch(t){L("runtime.timeline.pause",t)}}}function by(){let e=window.__HF_EXPORT_RENDER_SEEK_CONFIG,t=e?.fps,n=e?.fpsSource,r=Number(t);return!e||t==null?{fps:null,source:"default",rawFpsSource:n,rawFps:t,fallbackReason:"missing"}:!Number.isFinite(r)||r<=0?{fps:null,source:"default",rawFpsSource:n,rawFps:t,fallbackReason:"invalid"}:{fps:r,source:n==="render-options"||n==="default"?n:"unknown",rawFpsSource:n,rawFps:t,fallbackReason:e.fpsFallbackReason}}function Wf(){let e=Eu(),t=()=>{};Ws(be),Hf((d,g,h)=>{be({source:"hf-preview",type:"runtime-data-error",channel:d,requestId:g,message:h instanceof Error?h.message:String(h)})}),Gf((d,g)=>{try{t()}catch(h){be({source:"hf-preview",type:"runtime-data-error",channel:d,requestId:g,message:h instanceof Error?h.message:String(h)});return}be({source:"hf-preview",type:"runtime-data-applied",channel:d,requestId:g})}),mi(document),La(document),Pl(document);let n=by();e.canonicalFps=n.fps??e.canonicalFps,Bs(e.canonicalFps),window.__HF_EXPORT_RENDER_SEEK_CONFIG&&console.info("[hyperframes] render runtime fps",{canonicalFps:e.canonicalFps,source:n.source,rawFpsSource:n.rawFpsSource,rawFps:n.rawFps,fallbackReason:n.fallbackReason});let r=null,i=null,o=null,a=[],l=new Set,s=null,u=new Set,c=(d,g,h)=>{u.has(d)||(u.add(d),Ne(g,h))};if(typeof window.__hfRuntimeTeardown=="function")try{window.__hfRuntimeTeardown()}catch(d){L("runtime.init.site1",d)}let f=new Ei;e.transportClock=f;let m=new _i,p=!1;m.init().then(d=>{p=d}),window.__hf=window.__hf||{};let b=d=>d.closest("[data-hidden]")!==null||Br(d.ownerDocument,d),v=()=>{let d=window.gsap,g=window;if(!(!d?.registerPlugin||g.__hfAutoNoopRegistered))try{d.registerPlugin({name:"_auto",init:()=>!1}),g.__hfAutoNoopRegistered=!0}catch(h){c("auto_marker_install_failed","auto_marker_install_failed",{reason:"threw"}),L("runtime.autoMarker.install",h)}},x=()=>{let d=window.gsap;if(!d){c("custom_ease_missing_gsap","custom_ease_install_failed",{reason:"missing_gsap"});return}try{Lf(d)||c("custom_ease_no_parse_ease","custom_ease_install_failed",{reason:"no_parseEase"})}catch(g){c("custom_ease_install_threw","custom_ease_install_failed",{reason:"threw"}),L("runtime.customEase.install",g)}};v(),x(),document.documentElement&&(document.documentElement.style.margin="0",document.documentElement.style.padding="0",document.documentElement.style.overflow="hidden"),document.body&&(document.body.style.margin="0",document.body.style.padding="0",document.body.style.overflow="hidden");try{Ys(document)}catch(d){L("runtime.init.cssVariables",d)}window.__timelines=window.__timelines||{};let _=()=>{let d=document.querySelector('[data-composition-id][data-root="true"]');if(d instanceof HTMLElement)return d;let g=Array.from(document.querySelectorAll("[data-composition-id]"));return g.find(h=>!h.parentElement?.closest("[data-composition-id]"))??g[0]??null};if(Array.isArray(window.__timelines)){let d=window.__timelines,g=_()?.getAttribute("data-composition-id")??"root",h={};if(d.length===1)h[g]=d[0];else for(let y=0;y{a.push(d)},M=(d,g,h)=>{let y=h??`${d}:${JSON.stringify(g)}`;l.has(y)||(l.add(y),be({source:"hf-preview",type:"diagnostic",code:d,details:g}))},D=d=>{let g={scale:1,focusX:960,focusY:540},h=[],y=[],w={time:d.getTime(),duration:d.getDuration(),isPlaying:d.isPlaying(),renderMode:!1,timelineDirty:!1};return{play:d.play,pause:d.pause,seek:d.seek,getTime:d.getTime,getDuration:d.getDuration,isPlaying:d.isPlaying,getMainTimeline:()=>null,getElementBounds:()=>{},getElementsAtPoint:()=>{},setElementPosition:()=>{},previewElementPosition:()=>{},setElementKeyframes:()=>{},setElementScale:()=>{},setElementFontSize:()=>{},setElementTextContent:()=>{},setElementTextColor:()=>{},setElementTextShadow:()=>{},setElementTextFontWeight:()=>{},setElementTextFontFamily:()=>{},setElementTextOutline:()=>{},setElementTextHighlight:()=>{},setElementVolume:()=>{},setStageZoom:()=>{},getStageZoom:()=>g,setStageZoomKeyframes:()=>{},getStageZoomKeyframes:()=>h,addElement:()=>!1,removeElement:()=>!1,updateElementTiming:()=>!1,setElementTiming:()=>{},updateElementSrc:()=>!1,updateElementLayer:()=>!1,updateElementBasePosition:()=>!1,markTimelineDirty:()=>{},isTimelineDirty:()=>!1,rebuildTimeline:()=>{},ensureTimeline:()=>{},enableRenderMode:()=>{},disableRenderMode:()=>{},renderSeek:d.renderSeek,getElementVisibility:()=>({visible:!1}),getVisibleElements:()=>y,getRenderState:()=>({...w,time:d.getTime(),duration:d.getDuration(),isPlaying:d.isPlaying()})}},E=1/60,S=.75,A=.05,C=100,F=240,I=d=>{if(d instanceof Error)return d.message||String(d);if(typeof d=="string")return d;try{return JSON.stringify(d)}catch{return String(d??"")}},q=d=>{let g=d.toLowerCase();return g.includes("cannot read properties of null")||g.includes("cannot set properties of null")?{code:"runtime_null_dom_access",category:"dom-null-access"}:g.includes("failed to execute 'queryselector'")?{code:"runtime_invalid_selector",category:"selector-invalid"}:g.includes("is not defined")?{code:"runtime_reference_missing",category:"reference-missing"}:{code:"runtime_script_error",category:"script-error"}},W=d=>{if(d==null||d.trim()==="")return null;let g=Number.parseFloat(d);return!Number.isFinite(g)||g<=0?null:`${g}px`},Y=()=>_(),k=()=>{let d=Y();if(!d)return;let g=W(d.getAttribute("data-width")),h=W(d.getAttribute("data-height"));g&&(d.style.width=g),h&&(d.style.height=h),g&&d.style.setProperty("--comp-width",g),h&&d.style.setProperty("--comp-height",h)},U=()=>{let d=Y(),g=Array.from(document.querySelectorAll("[data-composition-id]")).filter(h=>h.hasAttribute("data-duration")||h.hasAttribute("data-end"));for(let h of g){if(d&&h===d)continue;let y=h.getAttribute("data-duration"),w=h.getAttribute("data-end");y!=null&&!h.hasAttribute(os)&&h.setAttribute(os,y),w!=null&&!h.hasAttribute(as)&&h.setAttribute(as,w),h.removeAttribute("data-duration"),h.removeAttribute("data-end")}},ie=()=>{let d=Y();if(!d)return;d.style.position||(d.style.position="relative"),d.style.overflow="hidden";let g=W(d.getAttribute("data-width")),h=W(d.getAttribute("data-height"));g&&(d.style.width=g),h&&(d.style.height=h);let y=Array.from(d.children);for(let w of y){let N=w.tagName.toLowerCase();if(N==="script"||N==="style"||N==="link"||N==="meta"||!w.hasAttribute("data-start")||w.hasAttribute("data-hf-autostamped"))continue;let G=(w.style.top==="0px"||w.style.top==="0")&&(w.style.left==="0px"||w.style.left==="0")&&w.style.width==="100%"&&w.style.height==="100%",re=/translate\(\s*-50%\s*,\s*-50%\s*\)/.test(w.style.transform);if(G&&re&&!w.hasAttribute("data-width")&&!w.hasAttribute("data-height")){let ne=w.style.top,_t=w.style.left,ye=w.style.width,gn=w.style.height;w.style.top="",w.style.left="",w.style.width="",w.style.height="";let se=window.getComputedStyle(w);se.top!=="auto"||se.bottom!=="auto"||se.left!=="auto"||se.right!=="auto"||se.width!=="0px"||se.height!=="0px"||(w.style.top=ne,w.style.left=_t,w.style.width=ye,w.style.height=gn)}let $=window.getComputedStyle(w),le=$.position;if(le!=="absolute"&&le!=="fixed"&&(w.style.position="absolute"),!!w.style.top||!!w.style.bottom||$.top!=="auto"||$.bottom!=="auto"||(w.style.top="0"),!!w.style.left||!!w.style.right||$.left!=="auto"||$.right!=="auto"||(w.style.left="0"),N!=="audio"){let ne=W(w.getAttribute("data-width")),_t=W(w.getAttribute("data-height")),ye=$.width!=="0px"&&$.width!=="auto",gn=$.height!=="0px"&&$.height!=="auto";ne?!w.style.width&&!ye&&(w.style.width=ne):!w.style.width&&$.width==="0px"&&(w.style.width="100%"),_t?!w.style.height&&!gn&&(w.style.height=_t):!w.style.height&&$.height==="0px"&&(w.style.height="100%")}}},P=(d,g=0,h)=>mt({timelineRegistry:window.__timelines??{},includeAuthoredTimingAttrs:h?.includeAuthoredTimingAttrs??!0}).resolveStartForElement(d,g),H=(d,g)=>mt({timelineRegistry:window.__timelines??{},includeAuthoredTimingAttrs:g?.includeAuthoredTimingAttrs??!0}).resolveDurationForElement(d),V=d=>{let g=d.closest("[data-composition-id]"),h=g?P(g,0):null,y=g?H(g,{includeAuthoredTimingAttrs:!0}):null;return{compositionRoot:g,inheritedStart:h,inheritedDuration:y}},j=d=>{let g=V(d),h=g.inheritedStart??0,y=Gt(d.getAttribute("data-start"));if(d.hasAttribute("data-hf-auto-start")||y==null||h<=0)return P(d,h);let w=g.inheritedDuration,N=w!=null&&w>0?h+w:null;return y>=h&&(N==null||y{window.__hfResolveMediaStartSeconds===j&&delete window.__hfResolveMediaStartSeconds});let we=(d,g)=>{let h=d.tagName.toLowerCase();if(h==="script"||h==="style"||h==="link"||h==="meta")return!1;let w=h==="video"||h==="audio"?j(d):P(d,0),N=H(d),G=d.getAttribute("data-composition-id");if(G){let $=(window.__timelines??{})[G],le=null;if($&&typeof $.duration=="function"){let Me=Number($.duration());Number.isFinite(Me)&&Me>0&&(le=Me)}!(d.hasAttribute("data-duration")||d.hasAttribute("data-end")||d.hasAttribute(os)||d.hasAttribute(as))&&(N==null||N<=0)&&le!=null&&(N=le)}let re=N!=null&&N>0?w+N:Number.POSITIVE_INFINITY;return g>=w&&(Number.isFinite(re)?g{if(!d||typeof d.duration!="function")return null;try{let g=Number(d.duration());return Number.isFinite(g)?Math.max(0,g):null}catch{return null}},K=d=>typeof d=="number"&&Number.isFinite(d)&&d>E,te=d=>{let g=ve(d.getAttribute("data-duration"));return g!=null&&g>0?g:Number.isFinite(d.duration)?Qe(d,d.duration):null},J=()=>{let d=Array.from(document.querySelectorAll("video[data-start], audio[data-start]"));if(d.length===0)return null;let g=0;for(let h of d){let y=j(h);if(!Number.isFinite(y))continue;let w=te(h);w==null||w<=E||(g=Math.max(g,Math.max(0,y)+w))}return g>E?g:null},X=()=>{let d=Y();if(!d)return null;let g=window.__timelines??{},h=mt({timelineRegistry:g,includeAuthoredTimingAttrs:!0}),y=0,w=ve(d.getAttribute("data-duration"));w!=null&&w>0&&(y=w);let N=Array.from(d.querySelectorAll("[data-composition-id][data-start]"));for(let G of N){if(!(G instanceof Element)||G.parentElement?.closest("[data-composition-id]")!==d)continue;let $=h.resolveStartForElement(G,0),le=h.resolveDurationForElement(G);!Number.isFinite($)||le==null||le<=0||(y=Math.max(y,Math.max(0,$)+le))}return y>E?y:null},Pe=()=>{let d=J();return typeof d!="number"||!Number.isFinite(d)||d<=E?null:d},Fe=d=>K(d)?Math.max(E,d*S):E,cn=()=>{let d=0;for(let g of e.deterministicAdapters){let h=g.getInferredDurationSeconds;if(typeof h!="function")continue;let y=null;try{y=h()}catch(w){L("runtime.init.adapterDuration",w)}typeof y=="number"&&Number.isFinite(y)&&y>0&&(d=Math.max(d,y))}return d>E?d:null},Ce=(d,g=0)=>{let h=ee(d),y=Pe(),w=X(),N=cn(),G=Math.max(y??0,w??0,N??0,window.__crocoPlannedPreviewDuration?.()||0),re=Number.isFinite(g)&&g>E?g:0,$=0;return K(h)?$=Math.max(h,G,re):K(G)?$=Math.max(G,re):$=re,$>0?Math.max(0,$):0},Oi=()=>{let d=window.__timelines??{},g=se=>{let oe=Object.entries(d).filter(ue=>!!ue[1]&&typeof ue[1].play=="function"&&typeof ue[1].pause=="function");if(oe.length!==1)return{timeline:null};let he=oe[0];if(!he)return{timeline:null};let[xe,fe]=he;return{timeline:fe,selectedTimelineIds:[xe],selectedDurationSeconds:ee(fe),diagnostics:{code:"root_timeline_sole_registered_fallback",details:{reason:se,soleTimelineId:xe}}}},h=mt({timelineRegistry:d,includeAuthoredTimingAttrs:!0}),y=Pe(),w=X(),N=Math.max(y??0,w??0)||null,G=Fe(N),re=se=>{let oe=document.querySelector(`[data-composition-id="${CSS.escape(se)}"]`);return oe?h.resolveStartForElement(oe,0):0},$=se=>{let oe=window.gsap;if(!oe||typeof oe.timeline!="function")return null;let he=oe.timeline({paused:!0});for(let xe of se)he.add(xe.timeline,re(xe.compositionId));return he},le=(se,oe)=>{if(!K(se))return null;let he=window.gsap;if(!he||typeof he.timeline!="function")return null;let xe=he.timeline({paused:!0});if(oe)try{xe.add(oe,0)}catch(ue){L("runtime.init.site2",ue)}let fe=xe;if(typeof fe.to=="function")try{fe.to({},{duration:se})}catch(ue){L("runtime.init.site3",ue)}return xe},Be=(se,oe)=>{let he=se;if(typeof he.getChildren!="function")return[];try{let xe=he.getChildren(!0,!0,!0)??[];if(!Array.isArray(xe))return[];let fe=[];for(let ue of oe)if(!xe.some(Je=>Je===ue.timeline))try{let Je=re(ue.compositionId);se.add(ue.timeline,Je),fe.push(ue.compositionId)}catch(Je){L("runtime.init.site4",Je)}return fe}catch{return[]}},Me=Y(),Q=Me?.getAttribute("data-composition-id")??null;if(!Q)return g("root_missing_composition_id");let ne=d[Q]??null,ye=(()=>{if(!Me)return[];let se=new Set,oe=Array.from(Me.querySelectorAll("[data-composition-id]")),he=[];for(let xe of oe){let fe=xe.getAttribute("data-composition-id");if(!fe||fe===Q||se.has(fe))continue;se.add(fe);let ue=d[fe]??null;if(!ue||typeof ue.play!="function"||typeof ue.pause!="function")continue;let lt=ee(ue);he.push({compositionId:fe,timeline:ue,durationSeconds:lt??0})}return he})(),gn=se=>{for(let oe of se){let he=oe.timeline;if(typeof he.paused=="function")try{he.paused(!1)}catch(xe){L("runtime.init.site5",xe)}}};if(ye.length>0&&gn(ye),ne){let se=ye.length>0?Be(ne,ye):[];if((ye.length>0||!document.querySelector("[data-composition-id]:not([data-composition-id='"+Q+"'])"))&&(gr=!0),se.length>0)try{let fe=ne.time();ne.seek(fe,!1)}catch{}let oe=ee(ne);if(!K(oe)&&ye.length>0){let fe=ye.map(zm=>zm.compositionId),ue=$(ye),lt=ee(ue);if(ue&&K(lt))return{timeline:ue,selectedTimelineIds:fe,selectedDurationSeconds:lt,mediaDurationFloorSeconds:y,diagnostics:{code:"root_timeline_unusable_fallback",details:{rootCompositionId:Q,rootDurationSeconds:oe,fallbackKind:"composite_by_root_children",minCandidateDurationSeconds:G,selectedDurationSeconds:lt,mediaDurationFloorSeconds:y,authoredCompositionDurationFloorSeconds:w,selectedTimelineIds:fe,autoNestedChildren:se}}};let Je=le(N??0,ne),Yi=ee(Je);if(Je&&K(Yi))return{timeline:Je,selectedTimelineIds:[Q],selectedDurationSeconds:Yi,mediaDurationFloorSeconds:y,diagnostics:{code:"root_timeline_unusable_media_floor_fallback",details:{rootCompositionId:Q,rootDurationSeconds:oe,fallbackKind:"media_duration_floor",mediaDurationFloorSeconds:y,authoredCompositionDurationFloorSeconds:w,selectedDurationSeconds:Yi,selectedTimelineIds:[Q],autoNestedChildren:se}}}}if(!K(oe)&&ye.length===0){let fe=le(N??0,ne),ue=ee(fe);if(fe&&K(ue))return{timeline:fe,selectedTimelineIds:[Q],selectedDurationSeconds:ue,mediaDurationFloorSeconds:y,diagnostics:{code:"root_timeline_unusable_media_floor_fallback",details:{rootCompositionId:Q,rootDurationSeconds:oe,fallbackKind:"media_duration_floor",mediaDurationFloorSeconds:y,authoredCompositionDurationFloorSeconds:w,selectedDurationSeconds:ue,selectedTimelineIds:[Q]}}}}let he=ve(Me?.getAttribute("data-duration")),xe=Math.max(K(he)?he:0,w??0);if(xe>0&&K(xe)&&K(oe)&&xe>=oe+.5){let fe=ne;if(typeof fe.to=="function")try{fe.to({},{duration:0},xe)}catch(lt){L("runtime.init.site6",lt)}let ue=ee(ne);if(K(ue))return{timeline:ne,selectedTimelineIds:[Q],selectedDurationSeconds:ue,mediaDurationFloorSeconds:y,diagnostics:{code:"root_timeline_padded_to_declared_duration",details:{rootCompositionId:Q,rootDurationSeconds:oe,rootDeclaredDur:he,authoredCompositionDurationFloorSeconds:w,newDur:ue}}}}return{timeline:ne,selectedTimelineIds:[Q],selectedDurationSeconds:oe,mediaDurationFloorSeconds:y,diagnostics:se.length>0?{code:"root_timeline_auto_nested_children",details:{rootCompositionId:Q,selectedDurationSeconds:oe,autoNestedChildren:se}}:void 0}}if(ye.length>0){let se=ye.map(xe=>xe.compositionId),oe=$(ye),he=ee(oe);if(oe)return{timeline:oe,selectedTimelineIds:se,selectedDurationSeconds:he,mediaDurationFloorSeconds:y,diagnostics:{code:"root_timeline_missing_fallback",details:{rootCompositionId:Q,fallbackKind:"composite_by_root_children",minCandidateDurationSeconds:G,selectedDurationSeconds:he,mediaDurationFloorSeconds:y,selectedTimelineIds:se}}}}return g("root_composition_id_unmatched_in_registry")},gr=!1,Em=d=>{let g=window.gsap,h=d;if(!(!h||typeof h.getChildren!="function"||!g||typeof g.parseEase!="function"))for(let y of h.getChildren(!0,!0,!0)){let w=y,N=w.timeline;if(!N||!("_ease"in N)||typeof N._ease=="function")continue;let G=w.vars?.keyframes,$=(G&&!Array.isArray(G)?G.ease:void 0)??w.vars?.ease??"none";try{let le=g.parseEase($);typeof le=="function"&&(N._ease=le)}catch(le){Ne("keyframe_ease_repair_failed",{ease:typeof $=="string"?$:String($)}),L("runtime.keyframeEase.repair",le)}}},dn=()=>{if(x(),!B)return!1;let d=e.capturedTimeline,g=ee(d),h=K(g);if(d&&h&&gr)return!1;let y=Oi();if(!y.timeline)return!1;if(d&&d===y.timeline)return typeof d.timeScale=="function"&&d.timeScale(e.playbackRate),!1;e.capturedTimeline=y.timeline,typeof e.capturedTimeline.timeScale=="function"&&e.capturedTimeline.timeScale(e.playbackRate),Em(e.capturedTimeline);let w=Ce(e.capturedTimeline,0);if(w<=0&&typeof e.capturedTimeline.progress=="function"&&(e.capturedTimeline.progress(1,!0),e.capturedTimeline.progress(0,!1),ot(e.capturedTimeline)),w>0){try{f.setDuration(w)}catch{}if(typeof e.capturedTimeline.totalTime=="function"){typeof e.capturedTimeline.progress=="function"&&e.capturedTimeline.progress(1e-4,!0);let G=Math.max(0,e.currentTime||0);e.capturedTimeline.totalTime(G,!1),ot(e.capturedTimeline)}let N=window.__hfStudioManualEditsApply;typeof N=="function"&&N(),mi(document)}if(y.diagnostics&&be({source:"hf-preview",type:"diagnostic",code:y.diagnostics.code,details:y.diagnostics.details}),be({source:"hf-preview",type:"diagnostic",code:"timeline_bound",details:{selectedTimelineIds:y.selectedTimelineIds??[],selectedDurationSeconds:y.selectedDurationSeconds??null,mediaDurationFloorSeconds:y.mediaDurationFloorSeconds??null}}),window.parent!==window){let N=Y(),G=w>0?w:0,re=String(G>0?G:1),$=new Set,le=Q=>Q.tagName.toLowerCase()===Ut,Be=new Set(document.querySelectorAll("[data-start]")),Me=Q=>{let ne=Q.parentElement;for(;ne&&ne!==N;){if(Be.has(ne))return!0;ne=ne.parentElement}return!1};if(e.capturedTimeline.getChildren)try{for(let Q of e.capturedTimeline.getChildren(!0))if(typeof Q.targets=="function")for(let ne of Q.targets())ne instanceof HTMLElement&&ne!==N&&(le(ne)||ne.hasAttribute("data-start")||Me(ne)||$.has(ne)||($.add(ne),ne.setAttribute("data-start","0"),ne.setAttribute("data-duration",re),ne.setAttribute("data-hf-autostamped","1")))}catch{}if(N instanceof HTMLElement)for(let Q of N.querySelectorAll("[id]"))Q instanceof HTMLElement&&Q!==N&&(Q.hasAttribute("data-start")||Me(Q)||$.has(Q)||Q.tagName==="SCRIPT"||Q.tagName==="STYLE"||Q.tagName==="LINK"||le(Q)||($.add(Q),Q.setAttribute("data-start","0"),Q.setAttribute("data-duration",re),Q.setAttribute("data-hf-autostamped","1")))}for(let N of fn)br.delete(N),Es(N);return!0},gs=()=>{if(e.tornDown)return;let d=Oi();if(!d.timeline){e.capturedTimeline=null,gr=!1,f.setDuration(0),Ar(e.currentTime);return}e.capturedTimeline!==d.timeline&&(gr=!1,dn()),Ar(e.currentTime)};t=()=>{gs(),st()},window.__hfForceTimelineRebind=gs;let wm=()=>{let d=Y();if(!(d instanceof HTMLElement))return;let g=d.getBoundingClientRect(),h=Number(d.getAttribute("data-width")),y=Number(d.getAttribute("data-height")),w=window.getComputedStyle(d),N=Number.isFinite(h)&&h>0&&Number.isFinite(y)&&y>0,G=g.width<=0||g.height<=0||d.clientWidth<=0||d.clientHeight<=0;!N||!G||M("root_stage_layout_zero",{compositionId:d.getAttribute("data-composition-id")??null,declaredWidth:h,declaredHeight:y,rectWidth:Math.round(g.width),rectHeight:Math.round(g.height),clientWidth:d.clientWidth,clientHeight:d.clientHeight,display:w.display,visibility:w.visibility,overflow:w.overflow},`root-stage-layout-zero:${d.getAttribute("data-composition-id")??"unknown"}`)},Cm=()=>{e.tornDown||(s!=null&&window.cancelAnimationFrame(s),s=window.requestAnimationFrame(()=>{s=null,wm()}))},_m=()=>{i=d=>{let g=I(d.error??d.message).slice(0,F);if(!g)return;let h=q(g);be({source:"hf-preview",type:"diagnostic",code:h.code,details:{category:h.category,message:g,filename:d.filename||null,line:Number.isFinite(d.lineno)?d.lineno:null,column:Number.isFinite(d.colno)?d.colno:null}})},o=d=>{let g=I(d.reason).slice(0,F);if(!g)return;let h=q(g);be({source:"hf-preview",type:"diagnostic",code:`${h.code}_unhandled_rejection`,details:{category:`${h.category}-unhandled-rejection`,message:g}})},window.addEventListener("error",i),window.addEventListener("unhandledrejection",o)},Tm=()=>{let d=Array.from(document.querySelectorAll("img, video, audio, source, link[rel='stylesheet']"));for(let h of d){let y=()=>{if(!(h instanceof Element))return;let w=h.tagName.toLowerCase(),N=h.getAttribute("src")??h.getAttribute("href")??h.getAttribute("poster")??null,G=w==="link"?"runtime_stylesheet_load_failed":"runtime_asset_load_failed";M(G,{tagName:w,assetUrl:N,currentSrc:(h instanceof HTMLImageElement||h instanceof HTMLMediaElement)&&h.currentSrc||null,readyState:h instanceof HTMLMediaElement?h.readyState:null,networkState:h instanceof HTMLMediaElement?h.networkState:null},`${G}:${w}:${N??"unknown"}`)};h.addEventListener("error",y),T(()=>{h.removeEventListener("error",y)})}let g=document.fonts;g&&g.ready.then(()=>{if(e.tornDown)return;let h=Array.from(g).filter(y=>y.status==="error").map(y=>y.family).filter(y=>!!y).slice(0,10);h.length!==0&&M("runtime_font_load_issue",{failedFamilies:h,totalFaces:Array.from(g).length},`runtime-font-load-issue:${h.join("|")}`)}).catch(()=>{})},Rm=(d,g)=>{if(!d.timeline)return!1;let h=e.capturedTimeline;if(h&&h===d.timeline)return!1;let y=Math.max(0,e.currentTime||0),w=e.isPlaying;e.capturedTimeline=d.timeline,typeof e.capturedTimeline.timeScale=="function"&&e.capturedTimeline.timeScale(e.playbackRate);try{ot(e.capturedTimeline),typeof e.capturedTimeline.seek=="function"&&e.capturedTimeline.seek(y,!1),w&&typeof e.capturedTimeline.play=="function"&&e.capturedTimeline.play()}catch(N){L("runtime.init.site7",N)}return be({source:"hf-preview",type:"diagnostic",code:"timeline_loop_guard_rebind",details:{reason:g,previousTime:y,selectedTimelineIds:d.selectedTimelineIds??[],selectedDurationSeconds:d.selectedDurationSeconds??null,mediaDurationFloorSeconds:d.mediaDurationFloorSeconds??null}}),!0},Et=null,bs=!1,xs=!1,fn=new Set,br=new WeakMap,xr=()=>{e.tornDown||(Et!=null&&window.clearTimeout(Et),Et=window.setTimeout(()=>{if(e.tornDown||(Et=null,xs&&window.__HF_EXPORT_RENDER_SEEK_CONFIG))return;let d=Oi();if(!d.timeline||!K(d.mediaDurationFloorSeconds??null))return;if(!e.capturedTimeline){dn()&&(st(),ke(!0));return}if(bs)return;let h=ee(e.capturedTimeline),y=d.selectedDurationSeconds??ee(d.timeline);K(y)&&(!K(h)||y>=h+A)&&Rm(d,"manual")&&(bs=!0,be({source:"hf-preview",type:"diagnostic",code:"timeline_rebind_after_media_metadata",details:{previousDurationSeconds:h??null,selectedDurationSeconds:y??null,selectedTimelineIds:d.selectedTimelineIds??[],mediaDurationFloorSeconds:d.mediaDurationFloorSeconds??null}}),st(),ke(!0))},C))},ys=d=>{d.currentTarget instanceof HTMLMediaElement&&zl(d.currentTarget)},vs=d=>{d.currentTarget instanceof HTMLMediaElement&&ql(d.currentTarget)},Ss=d=>{d instanceof HTMLAudioElement&&Ef(d)&&sn(d,an(d))},As=d=>{let g=d.currentTarget;g instanceof HTMLMediaElement&&Ss(g)},km=()=>{for(let d of fn)d.removeEventListener("loadedmetadata",xr),d.removeEventListener("durationchange",xr),d.removeEventListener("loadedmetadata",ys),d.removeEventListener("loadedmetadata",As),d.removeEventListener("error",vs);fn.clear()},Hi=()=>{if(e.tornDown)return;let d=Array.from(document.querySelectorAll("video, audio"));for(let g of d){if(fn.has(g))continue;fn.add(g);let h=Number.parseFloat(g.dataset.volume??"");Number.isFinite(h)&&(g.volume=Math.max(0,Math.min(1,h))),g.addEventListener("loadedmetadata",xr),g.addEventListener("durationchange",xr),g.addEventListener("loadedmetadata",As),Ss(g),g.addEventListener("loadedmetadata",ys),g.addEventListener("error",vs),Vl(g),g.preload!=="auto"&&(g.preload="auto"),g.readyState{br.has(d)||El(d,e.capturedTimeline,Ce(e.capturedTimeline,0),br,{allowLiveTimelineSeek:!window.__HF_RENDER_CAPTURE_MODE})},Gi=new WeakMap,ws=d=>{let g=Gi.get(d);if(g!==void 0)return g;let h=window.getComputedStyle(d).position,y=h==="static"||h==="relative"||h==="sticky";return Gi.set(d,y),y},Bi=new WeakMap,Mm=d=>{let g=Bi.get(d);if(g!==void 0)return g;let h=d.querySelector("[data-start]")===null;return Bi.set(d,h),h},Fm=()=>{Gi=new WeakMap,Bi=new WeakMap},Ui=new WeakMap,yr=new WeakSet,vr=!1,Cs=d=>d.matches("audio[data-start]")||d.querySelector("audio[data-start]")!==null,_s=new WeakMap,Sr=!0,Nm=()=>{if(Sr){Sr=!1;for(let d of document.querySelectorAll(Ut)){let g=d.hasAttribute("data-hidden");_s.get(d)!==g&&(_s.set(d,g),d.id&&m.setGroupMuted(d.id,g))}}},Ar=(d,g=Array.from(document.querySelectorAll("[data-start]")))=>{let h=Y();for(let y of g){if((y.nodeType!==1||y.namespaceURI!=="http://www.w3.org/1999/xhtml"))continue;if(y.hasAttribute("data-hidden")){yr.has(y)||(Ui.set(y,y.style.getPropertyValue("display")),yr.add(y),Cs(y)&&(vr=!0),Sr=!0),y.style.display="none",(y.tagName==="VIDEO"||y.tagName==="IMG")&&r?.setSourceVisibility(y,!1);continue}if(yr.has(y)){let N=Ui.get(y);N?y.style.display=N:y.style.removeProperty("display"),Ui.delete(y),yr.delete(y),Cs(y)&&(vr=!0),Sr=!0}let w=we(y,d);if(w){let N=y.parentElement;for(;N&&N!==h;){if(N.nodeType===1&&N.namespaceURI==="http://www.w3.org/1999/xhtml"&&N.hasAttribute("data-start")&&!we(N,d)){w=!1;break}N=N.parentElement}}y.style.visibility=w?"visible":"hidden",(y.tagName==="VIDEO"||y.tagName==="IMG")&&r?.setSourceVisibility(y,w),w?ws(y)&&y.style.removeProperty("display"):ws(y)&&Mm(y)&&(y.style.display="none")}vr&&f.isPlaying()&&(m.stopAll(),ji()),vr=!1,Nm()},Oe=()=>{let d=Hl({shouldIncludeElement:h=>h.hasAttribute("data-start")||!!V(h).compositionRoot,resolveStartSeconds:h=>j(h),resolveDurationSeconds:h=>{let y=V(h),w=j(h),N=y.inheritedStart!=null&&y.inheritedDuration!=null&&y.inheritedDuration>0?Math.max(0,y.inheritedStart+y.inheritedDuration-w):null,G=Number.isFinite(h.duration)?Qe(h,h.duration):null,re=ve(h.dataset.duration),$=re!=null&&re>0?re:null;return Ol({isVideo:h.tagName==="VIDEO",sourceDuration:G,hostRemaining:N,explicitDuration:$})}});for(let h of d.mediaClips){let y=br.get(h.el);y&&(h.volumeKeyframes=y)}let g=e.mediaForceSyncNextTick;g&&(e.mediaForceSyncNextTick=!1),e.nativeMediaSyncDisabled||Gl({clips:d.mediaClips,timeSeconds:e.currentTime,playing:e.isPlaying,playbackRate:e.playbackRate,outputMuted:e.mediaOutputMuted,userMuted:e.bridgeMuted,userVolume:e.bridgeVolume,forceSync:g,onElementVolume:(h,y,w)=>m.setElementVolume(h,w),isWebAudioOwned:h=>m.ownsElement(h),isWebAudioRouted:h=>m.routesElement(h),onAutoplayBlocked:()=>{e.mediaAutoplayBlockedPosted||(e.mediaAutoplayBlockedPosted=!0,be({source:"hf-preview",type:"media-autoplay-blocked"}))}}),Ar(e.currentTime)},ke=d=>{let g=Math.max(0,Math.round((e.currentTime||0)*e.canonicalFps)),h=Date.now();(d||g!==e.bridgeLastPostedFrame||e.isPlaying!==e.bridgeLastPostedPlaying||e.bridgeMuted!==e.bridgeLastPostedMuted||h-e.bridgeLastPostedAt>=e.bridgeMaxPostIntervalMs)&&(e.bridgeLastPostedFrame=g,e.bridgeLastPostedPlaying=e.isPlaying,e.bridgeLastPostedMuted=e.bridgeMuted,e.bridgeLastPostedAt=h,be({source:"hf-preview",type:"state",frame:g,isPlaying:e.isPlaying,muted:e.bridgeMuted,playbackRate:e.playbackRate}))},Wi="",Ts=0,Lm=()=>{let d="";for(let g of document.querySelectorAll("[data-start]"))d+=`${g.id}:${g.tagName}|`;return d},st=()=>{U(),k(),ie();let d=Y();if(d){let y=W(d.getAttribute("data-width")),w=W(d.getAttribute("data-height")),N=y?parseInt(y,10):0,G=w?parseInt(w,10):0;N>0&&G>0&&be({source:"hf-preview",type:"stage-size",width:N,height:G})}dn();let g=Ru({canonicalFps:e.canonicalFps});window.__clipManifest=g;let h=Lm();if(Wi!==h&&Fm(),!window.__clipTree||Wi!==h){let y=window;window.__clipTree=wu({startResolver:mt({timelineRegistry:y.__timelines??{},includeAuthoredTimingAttrs:!0}),timelineRegistry:y.__timelines??{},rootDuration:g.durationInFrames/e.canonicalFps}),Wi=h}be(g),Cm()},Vi=d=>typeof d=="number"&&Number.isFinite(d)&&d>0?d:0,Dm=d=>{let g=Vi(Number(d));if(g<=0)return;let h=Y(),y=Vi(ve(h?.getAttribute("data-duration"))),w=Math.max(Ts,Vi(f.getDuration()),y);g<=w||(Ts=g,h?.setAttribute("data-duration",String(g)),f.setDuration(g),st(),ke(!0))},He=(d,g=0)=>{for(let h of e.deterministicAdapters){try{d==="discover"&&h.discover(),d==="pause"&&h.pause(),d==="play"&&h.play&&h.play()}catch(y){L("runtime.init.site8",y)}if(d==="discover")try{h.seek({time:g,suppressEvents:!0})}catch(y){L("runtime.init.site9",y)}}},wt=()=>{window.__renderReady=!1},mn=null,pn=!0,Im=()=>{let d=[];for(let g of e.deterministicAdapters){let h=g.getReadyPromise;if(typeof h=="function")try{let y=h();y&&d.push(y)}catch(y){L("runtime.init.adapterReady",y)}}return d},Pm=()=>{let d=Im();if(d.length===0)return mn=null,pn=!0,!0;let g=d[0];if(!g)return!0;let h=d.length===1?g:Promise.all(d);return h!==mn&&(mn=h,pn=!1,Promise.resolve(h).then(()=>{mn===h&&(pn=!0,wt())},y=>{mn===h&&(pn=!0,L("runtime.init.adapterReady",y),wt())})),pn};if(B)_a();else{let d={injectedStyles:e.injectedCompStyles,injectedScripts:e.injectedCompScripts,injectedLinks:e.injectedCompLinks,parseDimensionPx:W,onDiagnostic:({code:g,details:h})=>{be({source:"hf-preview",type:"diagnostic",code:g,details:h})}};yd(d).then(()=>xd(d)).finally(()=>{B=!0,Hi(),Tm(),_a(),La(document),wt()})}let Er=yu({postMessage:d=>be(d)});Er.installPickerApi(),Ar(e.currentTime,Array.from(document.querySelectorAll("video[data-start], img[data-start]")));let ze=of();r=ze,T(()=>{ze.destroy(),r=null});let zi=d=>{let g=Number(d);!Number.isFinite(g)||g<=0?e.playbackRate=1:e.playbackRate=Math.max(.1,Math.min(5,g)),e.mediaForceSyncNextTick=!0,e.capturedTimeline&&typeof e.capturedTimeline.timeScale=="function"&&e.capturedTimeline.timeScale(e.playbackRate);let h=document.querySelectorAll("video, audio");for(let y of h)if(y instanceof HTMLMediaElement)try{y.playbackRate=e.playbackRate}catch(w){L("runtime.init.site10",w)}},Rs={play:()=>{let d=e.capturedTimeline;if(f.isPlaying())return;let g=Ce(d,0);if(g>0)f.setDuration(g),f.reachedEnd()&&(f.seek(0),e.currentTime=0,Ct(0));else{let h=Y(),y=Number(h?.getAttribute("data-duration")??0);y>0&&f.setDuration(y)}ot(d),f.play()&&(e.isPlaying=!0,e.mediaForceSyncNextTick=!0,Ps(f.now()),p&&!e.nativeMediaSyncDisabled&&!e.webAudioMediaDisabled&&ji(),He("play"),Oe(),ze.redraw(),ke(!0))},pause:()=>{if(!f.isPlaying())return;m.stopAll(),f.detachAudioSource(),f.pause(),e.isPlaying=!1,e.currentTime=f.now(),e.mediaForceSyncNextTick=!0,Ps(e.currentTime);let d=e.capturedTimeline;ot(d),He("pause"),Oe(),ze.redraw(),ke(!0)},seek:(d,g)=>{let h=$t(Math.max(0,Number(d)||0),e.canonicalFps);m.stopAll(),f.detachAudioSource();let y=f.isPlaying();y&&f.pause(),f.seek(h),e.currentTime=f.now(),e.isPlaying=!1,e.mediaForceSyncNextTick=!0;let w=e.capturedTimeline;if(ot(w),Ct(e.currentTime),He("pause"),g?.keepPlaying&&y){Rs.play();return}Oe(),ze.redraw(),ke(!0)},renderSeek:(d,g)=>{xs=!0;let h=$t(Math.max(0,Number(d)||0),e.canonicalFps);m.stopAll(),f.detachAudioSource(),f.isPlaying()&&f.pause(),f.seek(h),e.currentTime=f.now(),e.isPlaying=!1,e.mediaForceSyncNextTick=!0,Ct(e.currentTime,{activateChildren:!0,suppressEvents:g?.suppressEvents}),He("pause"),Oe(),ze.redraw(),ke(!0)},getTime:()=>f.now(),getDuration:()=>{if(window.__crocoPlannedPreviewDuration){let g=Ce(e.capturedTimeline,0);g>0&&f.setDuration(g)}let d=f.getDuration();return Number.isFinite(d)?d:0},isPlaying:()=>f.isPlaying(),setPlaybackRate:d=>{zi(d),f.setRate(e.playbackRate),Os()},getPlaybackRate:()=>e.playbackRate},ks=Ce(e.capturedTimeline,0);ks>0&&f.setDuration(ks);let Ge=Au({getTimeline:()=>e.capturedTimeline,setTimeline:d=>{e.capturedTimeline=d},getTimelineRegistry:()=>window.__timelines??{},getIsPlaying:()=>e.isPlaying,setIsPlaying:d=>{e.isPlaying!==d&&(e.mediaForceSyncNextTick=!0),e.isPlaying=d},getPlaybackRate:()=>e.playbackRate,setPlaybackRate:zi,getCanonicalFps:()=>e.canonicalFps,onSyncMedia:(d,g)=>{e.currentTime=Math.max(0,Number(d)||0),e.isPlaying!==g&&(e.mediaForceSyncNextTick=!0),e.isPlaying=g,Oe()},onStatePost:ke,onDeterministicSeek:(d,g)=>{for(let h of e.deterministicAdapters)if(!(h.name==="gsap"&&e.capturedTimeline))try{h.seek({time:Number(d)||0,suppressEvents:g?.suppressEvents})}catch(y){L("runtime.init.site11",y)}},onDeterministicPause:()=>He("pause"),onDeterministicPlay:()=>He("play"),onRenderFrameSeek:()=>{ze.redraw()},onShowNativeVideos:()=>{},getSafeDuration:()=>Ce(e.capturedTimeline,0),transport:Rs});window.__player=D(Ge),window.__playerReady=!0,Ne("composition_loaded",{duration:Ge.getDuration(),compositionId:document.querySelector("[data-composition-id]")?.getAttribute("data-composition-id")??null}),e.deterministicAdapters=[hl(),Js({resolveStartSeconds:d=>P(d,0)}),Zs(),tl(),il(),ol(),al(),sl(),ll(),ul(),cl(),Qs({getTimeline:()=>e.capturedTimeline})],ml(),pl(),window.__hfReseekGpu=d=>{let g=Math.max(0,Number(d)||0);window.__hfThreeTime=g,window.__hfTypegpuTime=g,Fr(g)},window.__hfWaitForSeekCompletion=ao,a.push(()=>{window.__hfWaitForSeekCompletion===ao&&delete window.__hfWaitForSeekCompletion}),_m(),Hi(),He("discover");let Om=()=>{let d=e.capturedTimeline,g=dn();e.capturedTimeline&&(g||e.capturedTimeline!==d||!Ge._timeline)&&(Ge._timeline=e.capturedTimeline);let h=Ce(e.capturedTimeline,0);if(h>0&&f.setDuration(h),He("discover",e.currentTime),!e.capturedTimeline){let y=window.__timelines??{},w=Object.keys(y).filter(N=>y[N]);if(w.length>0){let G=Y()?.getAttribute("data-composition-id")??null;M("root_timeline_unbound_registry_present",{reason:G?"root data-composition-id has no matching key in window.__timelines":"root composition element has no data-composition-id attribute",rootCompositionId:G,registeredTimelineKeys:w},"root_timeline_unbound_registry_present"),console.warn("[hyperframes] Root timeline not bound \u2014 render will freeze at t=0. "+(G?`Root data-composition-id is "${G}" but window.__timelines has no such key. `:"Root composition element has no data-composition-id. ")+`Registered timeline keys: [${w.join(", ")}]. Register the root timeline under its data-composition-id (window.__timelines["${G??""}"] = tl).`)}}window.__renderReady=!0,st(),ke(!0)},It=null,Hm=()=>{if(It)return;let d=()=>{window.removeEventListener("hf-timelines-built",d),It=null,wt()};It=d,window.addEventListener("hf-timelines-built",d)};T(()=>{It&&(window.removeEventListener("hf-timelines-built",It),It=null)}),wt=()=>{if(!B){window.__renderReady=!1;return}if(window.__hfTimelinesBuilding){window.__renderReady=!1,Hm();return}if(He("discover",e.currentTime),!Pm()){window.__renderReady=!1;return}Om()},wt(),B&&setTimeout(()=>{wt()},0);let wr=0,qi=!1,Ms=Number.NaN,Fs=null,$i=!1,Gm=(d,g,h,y)=>{try{let w=y?.suppressEvents===!0;ot(d),typeof d.totalTime=="function"?d.totalTime(g,w):d.seek(g,w)}catch(w){L(h,w)}},Bm=(d,g)=>{let h=window.__timelines??{},y=Y()?.getAttribute("data-composition-id")??null;for(let[w,N]of Object.entries(h)){if(!N||w===y)continue;let G=document.querySelector(`[data-composition-id="${CSS.escape(w)}"]`);if(!G)continue;let re=P(G,0);if(!Number.isFinite(re))continue;let $=ee(N),le=$e(G)+Math.max(0,d-re)*_e(G),Be=Math.max(0,$!=null&&$>0?Math.min($,le):le);Gm(N,Be,"runtime.init.transport.childTimeline",g)}},Ns=d=>{let g=window.__timelines??{};for(let h of Object.values(g))if(!(!h||h===d))try{h.play()}catch(y){L("runtime.init.activateSiblings",y)}},Ls=d=>typeof d=="object"&&d!==null,hn=new WeakMap,Um=["onStart","onUpdate","onComplete","onReverseComplete","onRepeat"],Ds=(d,g)=>{let h=d[g];if(typeof h!="function")return null;try{let y=Number(h.call(d));return Number.isFinite(y)?y:null}catch(y){return L("runtime.init.gsapCallbackDuration",y),null}},Wm=d=>{let g=hn.get(d);if(g!=null)return g;if(!("getChildren"in d)||typeof d.getChildren!="function")return!1;let h;try{h=d.getChildren(!0,!0,!0)}catch(y){return L("runtime.init.gsapCallbackChildren",y),hn.set(d,!1),!1}if(!Array.isArray(h))return hn.set(d,!1),!1;for(let y of h){if(!Ls(y))continue;let w=y.vars;if(!Ls(w)||!Um.some($=>typeof w[$]=="function"))continue;let re=Ds(y,"totalDuration")??Ds(y,"duration");if(re!=null&&re<=1e-6)return hn.set(d,!0),!0}return hn.set(d,!1),!1};function Ct(d,g){let h=e.capturedTimeline,y=g?.suppressEvents===!0;if(h){g?.activateChildren&&Ns(h);let w=h,N=d;if(typeof w.totalDuration=="function")try{let G=Number(w.totalDuration());Number.isFinite(G)&&G>0&&d>G&&(N=G)}catch(G){L("runtime.init.transport.clampDuration",G)}try{typeof h.totalTime=="function"?(h.totalTime(N,y),!y&&!Wm(h)&&(h.totalTime(N+.001,!0),h.totalTime(N,!0))):h.seek(N,y)}catch(G){L("runtime.init.transport.seek",G)}}Bm(d,g),h&&g?.activateChildren&&Ns(h);for(let w of e.deterministicAdapters)if(!(w.name==="gsap"&&h))try{w.seek({time:d,suppressEvents:y})}catch(N){L("runtime.init.transport.adapter",N)}}let Vm=()=>{try{return document.querySelector(`[${Cf}]`)!=null}catch{return!1}},Is=()=>{if(!(e.tornDown||qi)){qi=!0;try{if(e.transportRafId=window.requestAnimationFrame(Is),wr+=1,_f({tick:wr,isPlaying:f.isPlaying(),hasCapturedTimeline:e.capturedTimeline!=null,currentTimeSeconds:f.now()})){let y=e.capturedTimeline;if(dn()){e.capturedTimeline&&!Ge._timeline&&(Ge._timeline=e.capturedTimeline),e.capturedTimeline&&e.capturedTimeline!==y&&ot(e.capturedTimeline);let w=Ce(e.capturedTimeline,0);w>0&&f.setDuration(w),st()}}if(wr%20===0&&st(),wr%30===0&&Hi(),e.capturedTimeline){let y=Ce(e.capturedTimeline,0);y>0&&(!f.isPlaying()||y>=f.getDuration())&&f.setDuration(y)}if(f.isPlaying()&&!e.mediaOutputMuted)if(!e.nativeMediaSyncDisabled&&!e.webAudioMediaDisabled&&m.isActive()&&m.context){let y=m.getTime();y>=0&&f.attachAudioSource({currentTimeSeconds:y})}else{let y=document.querySelectorAll("audio[data-start]"),w=!1;for(let N of y){if(!(N instanceof HTMLMediaElement)||!N.isConnected||b(N))continue;let G=Number.parseFloat(N.dataset.start??""),re=ve(N.dataset.duration),$=re!=null&&re>0?G+re:1/0,le=$e(N);if(Number.isFinite(G)&&e.currentTime>=G&&e.currentTime<$){N.paused?!N.error&&N.readyState{let g=document.querySelectorAll("video, audio");for(let h of g){if(!(h instanceof HTMLMediaElement)||!h.isConnected)continue;let y=Number.parseFloat(h.dataset.start??"");if(!Number.isFinite(y))continue;let w=ve(h.dataset.duration),N=w!=null&&w>0?y+w:1/0;if(d=N)continue;let G=$e(h),re=d-y+G;if(re>=0)try{h.currentTime=re}catch{}}},ji=()=>{if(e.nativeMediaSyncDisabled||e.webAudioMediaDisabled)return;let d=m.startGeneration(),g=document.querySelectorAll("audio[data-start]");for(let h of g){if(!(h instanceof HTMLMediaElement)||!h.isConnected||b(h))continue;let y=Number.parseFloat(h.dataset.start??"");if(!Number.isFinite(y))continue;let w=$e(h),N=Number.parseFloat(h.dataset.volume??""),G=Number.isFinite(N)?N:1,re=ve(h.dataset.duration),$=re!=null&&re>0?re:Number.POSITIVE_INFINITY,le=h.closest("[data-composition-id]");if(le){let Q=P(le,0),ne=H(le,{includeAuthoredTimingAttrs:!0});ne!=null&&ne>0&&($=Math.min($,Math.max(0,Q+ne-y)))}let Be=an(h);sn(h,Be),(Be.kind==="web-audio"?m.scheduleMediaElementPlayback(h,y,w,f.now(),G,d,e.playbackRate):Promise.resolve(null)).then(Q=>{if(Q||!f.isPlaying())return;let ne=e.playbackRate*_e(h),_t=h.hasAttribute("data-fx-chain")||h.hasAttribute("data-automation");if(Math.abs(ne-1)>1e-9){Be.kind==="web-audio"&&_t&&(h.muted=!0);return}m.decodeAudioElement(h).then(ye=>{!ye||!f.isPlaying()||m.schedulePlayback(h,ye,y,w,f.now(),G,d,e.playbackRate,$)})})}};function Os(){m.setRate(e.playbackRate)&&!e.nativeMediaSyncDisabled&&!e.webAudioMediaDisabled&&p&&f.isPlaying()&&m.hasBoundedActiveSources()&&(m.stopAll(),ji())}if(e.capturedTimeline){let d=Ce(e.capturedTimeline,0);d>0&&f.setDuration(d),ot(e.capturedTimeline)}Cd(window),e.transportRafId=window.requestAnimationFrame(Is),st(),ke(!0),e.controlBridgeHandler=Us({onPlay:()=>{Ge.play(),Ne("composition_played",{time:Ge.getTime()})},onPause:()=>{Ge.pause(),Ne("composition_paused",{time:Ge.getTime()})},onStopMedia:()=>{m.stopAll();let d=document.querySelectorAll("video, audio");for(let g of d)g instanceof HTMLMediaElement&&!g.paused&&g.pause()},onSeek:(d,g)=>{Ge.seek(d),Ne("composition_seeked",{time:d})},onSetMuted:d=>{e.bridgeMuted=d;let g=d||e.mediaOutputMuted;m.setMuted(g);let h=document.querySelectorAll("video, audio");for(let y of h)y instanceof HTMLMediaElement&&(y.muted=g||y.defaultMuted)},onSetVolume:d=>{e.bridgeVolume=d,m.setVolume(d);let g=document.querySelectorAll("video, audio");for(let h of g){if(!(h instanceof HTMLMediaElement))continue;let y=parseFloat(h.dataset.volume??""),w=Number.isFinite(y)?y:1;h.volume=Nr(w*d)}},onSetMediaOutputMuted:d=>{e.mediaOutputMuted=d;let g=d||e.bridgeMuted;m.setMuted(g);let h=document.querySelectorAll("video, audio");for(let y of h)y instanceof HTMLMediaElement&&(y.muted=g||y.defaultMuted)},onSetNativeMediaSyncDisabled:d=>{e.nativeMediaSyncDisabled!==d&&(e.nativeMediaSyncDisabled=d,e.mediaForceSyncNextTick=!0,d?(m.stopAll(),f.detachAudioSource()):Oe())},onSetWebAudioMediaDisabled:d=>{e.webAudioMediaDisabled!==d&&(e.webAudioMediaDisabled=d,e.mediaForceSyncNextTick=!0,d&&(m.stopAll(),f.detachAudioSource()),Oe())},onSetPlaybackRate:d=>{zi(d),e.transportClock&&e.transportClock.setRate(e.playbackRate),Os()},onSetRootDuration:Dm,onSetColorGrading:(d,g)=>{ze.setGrading(d,g)},onSetColorGradingCompare:(d,g)=>{ze.setCompare(d,g)},onTick:()=>{if(e.tornDown||!f.isPlaying())return;let d=f.now();if(e.currentTime=d,Ct(d),f.reachedEnd()){m.stopAll(),f.detachAudioSource(),f.pause(),e.isPlaying=!1;let g=f.getDuration();Number.isFinite(g)&&(f.seek(g),e.currentTime=g,Ct(g)),He("pause"),Oe(),ke(!0)}},onEnablePickMode:()=>Er.enablePickMode(),onDisablePickMode:()=>Er.disablePickMode(),onSetRuntimeData:Ri,onClearRuntimeData:ki,getCanonicalFps:()=>e.canonicalFps});let Ki=()=>{if(!e.tornDown){e.tornDown=!0,e.transportRafId!=null&&(window.cancelAnimationFrame(e.transportRafId),e.transportRafId=null),e.transportClock=null,m.destroy(),Et!=null&&(window.clearTimeout(Et),Et=null),s!=null&&(window.cancelAnimationFrame(s),s=null),km(),e.controlBridgeHandler&&(window.removeEventListener("message",e.controlBridgeHandler),e.controlBridgeHandler=null),i&&(window.removeEventListener("error",i),i=null),o&&(window.removeEventListener("unhandledrejection",o),o=null),e.beforeUnloadHandler&&(window.removeEventListener("beforeunload",e.beforeUnloadHandler),e.beforeUnloadHandler=null),Er.disablePickMode();for(let d of e.deterministicAdapters)if(!(!d||typeof d.revert!="function"))try{d.revert()}catch(g){L("runtime.init.site12",g)}e.deterministicAdapters=[];for(let d of a.splice(0))try{d()}catch(g){L("runtime.init.site13",g)}for(let d of e.injectedCompStyles)try{d.remove()}catch(g){L("runtime.init.site14",g)}e.injectedCompStyles=[];for(let d of e.injectedCompLinks)try{d.remove()}catch(g){L("runtime.init.site15",g)}e.injectedCompLinks=[];for(let d of e.injectedCompScripts)try{d.remove()}catch(g){L("runtime.init.site16",g)}e.injectedCompScripts=[],e.capturedTimeline=null,t=()=>{},window.__hfRuntimeTeardown===Ki&&(window.__hfRuntimeTeardown=null)}};window.__hfRuntimeTeardown=Ki,e.beforeUnloadHandler=Ki,window.addEventListener("beforeunload",e.beforeUnloadHandler)}var Vf=["BN","BN","BN","BN","BN","BN","BN","BN","BN","S","B","S","WS","B","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","B","B","B","S","WS","ON","ON","ET","ET","ET","ON","ON","ON","ON","ON","ES","CS","ES","CS","CS","EN","EN","EN","EN","EN","EN","EN","EN","EN","EN","CS","ON","ON","ON","ON","ON","ON","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","ON","ON","ON","ON","ON","ON","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","ON","ON","ON","ON","BN","BN","BN","BN","BN","BN","B","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","CS","ON","ET","ET","ET","ET","ON","ON","ON","ON","L","ON","ON","BN","ON","ON","ET","ET","EN","EN","ON","L","ON","ON","ON","EN","L","ON","ON","ON","ON","ON","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","ON","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","ON","L","L","L","L","L","L","L","L"],ss=[[697,698,"ON"],[706,719,"ON"],[722,735,"ON"],[741,749,"ON"],[751,767,"ON"],[768,879,"NSM"],[884,885,"ON"],[894,894,"ON"],[900,901,"ON"],[903,903,"ON"],[1014,1014,"ON"],[1155,1161,"NSM"],[1418,1418,"ON"],[1421,1422,"ON"],[1423,1423,"ET"],[1424,1424,"R"],[1425,1469,"NSM"],[1470,1470,"R"],[1471,1471,"NSM"],[1472,1472,"R"],[1473,1474,"NSM"],[1475,1475,"R"],[1476,1477,"NSM"],[1478,1478,"R"],[1479,1479,"NSM"],[1480,1535,"R"],[1536,1541,"AN"],[1542,1543,"ON"],[1544,1544,"AL"],[1545,1546,"ET"],[1547,1547,"AL"],[1548,1548,"CS"],[1549,1549,"AL"],[1550,1551,"ON"],[1552,1562,"NSM"],[1563,1610,"AL"],[1611,1631,"NSM"],[1632,1641,"AN"],[1642,1642,"ET"],[1643,1644,"AN"],[1645,1647,"AL"],[1648,1648,"NSM"],[1649,1749,"AL"],[1750,1756,"NSM"],[1757,1757,"AN"],[1758,1758,"ON"],[1759,1764,"NSM"],[1765,1766,"AL"],[1767,1768,"NSM"],[1769,1769,"ON"],[1770,1773,"NSM"],[1774,1775,"AL"],[1776,1785,"EN"],[1786,1808,"AL"],[1809,1809,"NSM"],[1810,1839,"AL"],[1840,1866,"NSM"],[1867,1957,"AL"],[1958,1968,"NSM"],[1969,1983,"AL"],[1984,2026,"R"],[2027,2035,"NSM"],[2036,2037,"R"],[2038,2041,"ON"],[2042,2044,"R"],[2045,2045,"NSM"],[2046,2069,"R"],[2070,2073,"NSM"],[2074,2074,"R"],[2075,2083,"NSM"],[2084,2084,"R"],[2085,2087,"NSM"],[2088,2088,"R"],[2089,2093,"NSM"],[2094,2136,"R"],[2137,2139,"NSM"],[2140,2143,"R"],[2144,2191,"AL"],[2192,2193,"AN"],[2194,2198,"AL"],[2199,2207,"NSM"],[2208,2249,"AL"],[2250,2273,"NSM"],[2274,2274,"AN"],[2275,2306,"NSM"],[2362,2362,"NSM"],[2364,2364,"NSM"],[2369,2376,"NSM"],[2381,2381,"NSM"],[2385,2391,"NSM"],[2402,2403,"NSM"],[2433,2433,"NSM"],[2492,2492,"NSM"],[2497,2500,"NSM"],[2509,2509,"NSM"],[2530,2531,"NSM"],[2546,2547,"ET"],[2555,2555,"ET"],[2558,2558,"NSM"],[2561,2562,"NSM"],[2620,2620,"NSM"],[2625,2626,"NSM"],[2631,2632,"NSM"],[2635,2637,"NSM"],[2641,2641,"NSM"],[2672,2673,"NSM"],[2677,2677,"NSM"],[2689,2690,"NSM"],[2748,2748,"NSM"],[2753,2757,"NSM"],[2759,2760,"NSM"],[2765,2765,"NSM"],[2786,2787,"NSM"],[2801,2801,"ET"],[2810,2815,"NSM"],[2817,2817,"NSM"],[2876,2876,"NSM"],[2879,2879,"NSM"],[2881,2884,"NSM"],[2893,2893,"NSM"],[2901,2902,"NSM"],[2914,2915,"NSM"],[2946,2946,"NSM"],[3008,3008,"NSM"],[3021,3021,"NSM"],[3059,3064,"ON"],[3065,3065,"ET"],[3066,3066,"ON"],[3072,3072,"NSM"],[3076,3076,"NSM"],[3132,3132,"NSM"],[3134,3136,"NSM"],[3142,3144,"NSM"],[3146,3149,"NSM"],[3157,3158,"NSM"],[3170,3171,"NSM"],[3192,3198,"ON"],[3201,3201,"NSM"],[3260,3260,"NSM"],[3276,3277,"NSM"],[3298,3299,"NSM"],[3328,3329,"NSM"],[3387,3388,"NSM"],[3393,3396,"NSM"],[3405,3405,"NSM"],[3426,3427,"NSM"],[3457,3457,"NSM"],[3530,3530,"NSM"],[3538,3540,"NSM"],[3542,3542,"NSM"],[3633,3633,"NSM"],[3636,3642,"NSM"],[3647,3647,"ET"],[3655,3662,"NSM"],[3761,3761,"NSM"],[3764,3772,"NSM"],[3784,3790,"NSM"],[3864,3865,"NSM"],[3893,3893,"NSM"],[3895,3895,"NSM"],[3897,3897,"NSM"],[3898,3901,"ON"],[3953,3966,"NSM"],[3968,3972,"NSM"],[3974,3975,"NSM"],[3981,3991,"NSM"],[3993,4028,"NSM"],[4038,4038,"NSM"],[4141,4144,"NSM"],[4146,4151,"NSM"],[4153,4154,"NSM"],[4157,4158,"NSM"],[4184,4185,"NSM"],[4190,4192,"NSM"],[4209,4212,"NSM"],[4226,4226,"NSM"],[4229,4230,"NSM"],[4237,4237,"NSM"],[4253,4253,"NSM"],[4957,4959,"NSM"],[5008,5017,"ON"],[5120,5120,"ON"],[5760,5760,"WS"],[5787,5788,"ON"],[5906,5908,"NSM"],[5938,5939,"NSM"],[5970,5971,"NSM"],[6002,6003,"NSM"],[6068,6069,"NSM"],[6071,6077,"NSM"],[6086,6086,"NSM"],[6089,6099,"NSM"],[6107,6107,"ET"],[6109,6109,"NSM"],[6128,6137,"ON"],[6144,6154,"ON"],[6155,6157,"NSM"],[6158,6158,"BN"],[6159,6159,"NSM"],[6277,6278,"NSM"],[6313,6313,"NSM"],[6432,6434,"NSM"],[6439,6440,"NSM"],[6450,6450,"NSM"],[6457,6459,"NSM"],[6464,6464,"ON"],[6468,6469,"ON"],[6622,6655,"ON"],[6679,6680,"NSM"],[6683,6683,"NSM"],[6742,6742,"NSM"],[6744,6750,"NSM"],[6752,6752,"NSM"],[6754,6754,"NSM"],[6757,6764,"NSM"],[6771,6780,"NSM"],[6783,6783,"NSM"],[6832,6877,"NSM"],[6880,6891,"NSM"],[6912,6915,"NSM"],[6964,6964,"NSM"],[6966,6970,"NSM"],[6972,6972,"NSM"],[6978,6978,"NSM"],[7019,7027,"NSM"],[7040,7041,"NSM"],[7074,7077,"NSM"],[7080,7081,"NSM"],[7083,7085,"NSM"],[7142,7142,"NSM"],[7144,7145,"NSM"],[7149,7149,"NSM"],[7151,7153,"NSM"],[7212,7219,"NSM"],[7222,7223,"NSM"],[7376,7378,"NSM"],[7380,7392,"NSM"],[7394,7400,"NSM"],[7405,7405,"NSM"],[7412,7412,"NSM"],[7416,7417,"NSM"],[7616,7679,"NSM"],[8125,8125,"ON"],[8127,8129,"ON"],[8141,8143,"ON"],[8157,8159,"ON"],[8173,8175,"ON"],[8189,8190,"ON"],[8192,8202,"WS"],[8203,8205,"BN"],[8207,8207,"R"],[8208,8231,"ON"],[8232,8232,"WS"],[8233,8233,"B"],[8234,8238,"BN"],[8239,8239,"CS"],[8240,8244,"ET"],[8245,8259,"ON"],[8260,8260,"CS"],[8261,8286,"ON"],[8287,8287,"WS"],[8288,8303,"BN"],[8304,8304,"EN"],[8308,8313,"EN"],[8314,8315,"ES"],[8316,8318,"ON"],[8320,8329,"EN"],[8330,8331,"ES"],[8332,8334,"ON"],[8352,8399,"ET"],[8400,8432,"NSM"],[8448,8449,"ON"],[8451,8454,"ON"],[8456,8457,"ON"],[8468,8468,"ON"],[8470,8472,"ON"],[8478,8483,"ON"],[8485,8485,"ON"],[8487,8487,"ON"],[8489,8489,"ON"],[8494,8494,"ET"],[8506,8507,"ON"],[8512,8516,"ON"],[8522,8525,"ON"],[8528,8543,"ON"],[8585,8587,"ON"],[8592,8721,"ON"],[8722,8722,"ES"],[8723,8723,"ET"],[8724,9013,"ON"],[9083,9108,"ON"],[9110,9257,"ON"],[9280,9290,"ON"],[9312,9351,"ON"],[9352,9371,"EN"],[9450,9899,"ON"],[9901,10239,"ON"],[10496,11123,"ON"],[11126,11263,"ON"],[11493,11498,"ON"],[11503,11505,"NSM"],[11513,11519,"ON"],[11647,11647,"NSM"],[11744,11775,"NSM"],[11776,11869,"ON"],[11904,11929,"ON"],[11931,12019,"ON"],[12032,12245,"ON"],[12272,12287,"ON"],[12288,12288,"WS"],[12289,12292,"ON"],[12296,12320,"ON"],[12330,12333,"NSM"],[12336,12336,"ON"],[12342,12343,"ON"],[12349,12351,"ON"],[12441,12442,"NSM"],[12443,12444,"ON"],[12448,12448,"ON"],[12539,12539,"ON"],[12736,12773,"ON"],[12783,12783,"ON"],[12829,12830,"ON"],[12880,12895,"ON"],[12924,12926,"ON"],[12977,12991,"ON"],[13004,13007,"ON"],[13175,13178,"ON"],[13278,13279,"ON"],[13311,13311,"ON"],[19904,19967,"ON"],[42128,42182,"ON"],[42509,42511,"ON"],[42607,42610,"NSM"],[42611,42611,"ON"],[42612,42621,"NSM"],[42622,42623,"ON"],[42654,42655,"NSM"],[42736,42737,"NSM"],[42752,42785,"ON"],[42888,42888,"ON"],[43010,43010,"NSM"],[43014,43014,"NSM"],[43019,43019,"NSM"],[43045,43046,"NSM"],[43048,43051,"ON"],[43052,43052,"NSM"],[43064,43065,"ET"],[43124,43127,"ON"],[43204,43205,"NSM"],[43232,43249,"NSM"],[43263,43263,"NSM"],[43302,43309,"NSM"],[43335,43345,"NSM"],[43392,43394,"NSM"],[43443,43443,"NSM"],[43446,43449,"NSM"],[43452,43453,"NSM"],[43493,43493,"NSM"],[43561,43566,"NSM"],[43569,43570,"NSM"],[43573,43574,"NSM"],[43587,43587,"NSM"],[43596,43596,"NSM"],[43644,43644,"NSM"],[43696,43696,"NSM"],[43698,43700,"NSM"],[43703,43704,"NSM"],[43710,43711,"NSM"],[43713,43713,"NSM"],[43756,43757,"NSM"],[43766,43766,"NSM"],[43882,43883,"ON"],[44005,44005,"NSM"],[44008,44008,"NSM"],[44013,44013,"NSM"],[64285,64285,"R"],[64286,64286,"NSM"],[64287,64296,"R"],[64297,64297,"ES"],[64298,64335,"R"],[64336,64450,"AL"],[64451,64466,"ON"],[64467,64829,"AL"],[64830,64847,"ON"],[64848,64911,"AL"],[64912,64913,"ON"],[64914,64967,"AL"],[64968,64975,"ON"],[64976,65007,"BN"],[65008,65020,"AL"],[65021,65023,"ON"],[65024,65039,"NSM"],[65040,65049,"ON"],[65056,65071,"NSM"],[65072,65103,"ON"],[65104,65104,"CS"],[65105,65105,"ON"],[65106,65106,"CS"],[65108,65108,"ON"],[65109,65109,"CS"],[65110,65118,"ON"],[65119,65119,"ET"],[65120,65121,"ON"],[65122,65123,"ES"],[65124,65126,"ON"],[65128,65128,"ON"],[65129,65130,"ET"],[65131,65131,"ON"],[65136,65278,"AL"],[65279,65279,"BN"],[65281,65282,"ON"],[65283,65285,"ET"],[65286,65290,"ON"],[65291,65291,"ES"],[65292,65292,"CS"],[65293,65293,"ES"],[65294,65295,"CS"],[65296,65305,"EN"],[65306,65306,"CS"],[65307,65312,"ON"],[65339,65344,"ON"],[65371,65381,"ON"],[65504,65505,"ET"],[65506,65508,"ON"],[65509,65510,"ET"],[65512,65518,"ON"],[65520,65528,"BN"],[65529,65533,"ON"],[65534,65535,"BN"],[65793,65793,"ON"],[65856,65932,"ON"],[65936,65948,"ON"],[65952,65952,"ON"],[66045,66045,"NSM"],[66272,66272,"NSM"],[66273,66299,"EN"],[66422,66426,"NSM"],[67584,67870,"R"],[67871,67871,"ON"],[67872,68096,"R"],[68097,68099,"NSM"],[68100,68100,"R"],[68101,68102,"NSM"],[68103,68107,"R"],[68108,68111,"NSM"],[68112,68151,"R"],[68152,68154,"NSM"],[68155,68158,"R"],[68159,68159,"NSM"],[68160,68324,"R"],[68325,68326,"NSM"],[68327,68408,"R"],[68409,68415,"ON"],[68416,68863,"R"],[68864,68899,"AL"],[68900,68903,"NSM"],[68904,68911,"AL"],[68912,68921,"AN"],[68922,68927,"AL"],[68928,68937,"AN"],[68938,68968,"R"],[68969,68973,"NSM"],[68974,68974,"ON"],[68975,69215,"R"],[69216,69246,"AN"],[69247,69290,"R"],[69291,69292,"NSM"],[69293,69311,"R"],[69312,69327,"AL"],[69328,69336,"ON"],[69337,69369,"AL"],[69370,69375,"NSM"],[69376,69423,"R"],[69424,69445,"AL"],[69446,69456,"NSM"],[69457,69487,"AL"],[69488,69505,"R"],[69506,69509,"NSM"],[69510,69631,"R"],[69633,69633,"NSM"],[69688,69702,"NSM"],[69714,69733,"ON"],[69744,69744,"NSM"],[69747,69748,"NSM"],[69759,69761,"NSM"],[69811,69814,"NSM"],[69817,69818,"NSM"],[69826,69826,"NSM"],[69888,69890,"NSM"],[69927,69931,"NSM"],[69933,69940,"NSM"],[70003,70003,"NSM"],[70016,70017,"NSM"],[70070,70078,"NSM"],[70089,70092,"NSM"],[70095,70095,"NSM"],[70191,70193,"NSM"],[70196,70196,"NSM"],[70198,70199,"NSM"],[70206,70206,"NSM"],[70209,70209,"NSM"],[70367,70367,"NSM"],[70371,70378,"NSM"],[70400,70401,"NSM"],[70459,70460,"NSM"],[70464,70464,"NSM"],[70502,70508,"NSM"],[70512,70516,"NSM"],[70587,70592,"NSM"],[70606,70606,"NSM"],[70608,70608,"NSM"],[70610,70610,"NSM"],[70625,70626,"NSM"],[70712,70719,"NSM"],[70722,70724,"NSM"],[70726,70726,"NSM"],[70750,70750,"NSM"],[70835,70840,"NSM"],[70842,70842,"NSM"],[70847,70848,"NSM"],[70850,70851,"NSM"],[71090,71093,"NSM"],[71100,71101,"NSM"],[71103,71104,"NSM"],[71132,71133,"NSM"],[71219,71226,"NSM"],[71229,71229,"NSM"],[71231,71232,"NSM"],[71264,71276,"ON"],[71339,71339,"NSM"],[71341,71341,"NSM"],[71344,71349,"NSM"],[71351,71351,"NSM"],[71453,71453,"NSM"],[71455,71455,"NSM"],[71458,71461,"NSM"],[71463,71467,"NSM"],[71727,71735,"NSM"],[71737,71738,"NSM"],[71995,71996,"NSM"],[71998,71998,"NSM"],[72003,72003,"NSM"],[72148,72151,"NSM"],[72154,72155,"NSM"],[72160,72160,"NSM"],[72193,72198,"NSM"],[72201,72202,"NSM"],[72243,72248,"NSM"],[72251,72254,"NSM"],[72263,72263,"NSM"],[72273,72278,"NSM"],[72281,72283,"NSM"],[72330,72342,"NSM"],[72344,72345,"NSM"],[72544,72544,"NSM"],[72546,72548,"NSM"],[72550,72550,"NSM"],[72752,72758,"NSM"],[72760,72765,"NSM"],[72850,72871,"NSM"],[72874,72880,"NSM"],[72882,72883,"NSM"],[72885,72886,"NSM"],[73009,73014,"NSM"],[73018,73018,"NSM"],[73020,73021,"NSM"],[73023,73029,"NSM"],[73031,73031,"NSM"],[73104,73105,"NSM"],[73109,73109,"NSM"],[73111,73111,"NSM"],[73459,73460,"NSM"],[73472,73473,"NSM"],[73526,73530,"NSM"],[73536,73536,"NSM"],[73538,73538,"NSM"],[73562,73562,"NSM"],[73685,73692,"ON"],[73693,73696,"ET"],[73697,73713,"ON"],[78912,78912,"NSM"],[78919,78933,"NSM"],[90398,90409,"NSM"],[90413,90415,"NSM"],[92912,92916,"NSM"],[92976,92982,"NSM"],[94031,94031,"NSM"],[94095,94098,"NSM"],[94178,94178,"ON"],[94180,94180,"NSM"],[113821,113822,"NSM"],[113824,113827,"BN"],[117760,117973,"ON"],[118e3,118009,"EN"],[118010,118012,"ON"],[118016,118451,"ON"],[118458,118480,"ON"],[118496,118512,"ON"],[118528,118573,"NSM"],[118576,118598,"NSM"],[119143,119145,"NSM"],[119155,119162,"BN"],[119163,119170,"NSM"],[119173,119179,"NSM"],[119210,119213,"NSM"],[119273,119274,"ON"],[119296,119361,"ON"],[119362,119364,"NSM"],[119365,119365,"ON"],[119552,119638,"ON"],[120513,120513,"ON"],[120539,120539,"ON"],[120571,120571,"ON"],[120597,120597,"ON"],[120629,120629,"ON"],[120655,120655,"ON"],[120687,120687,"ON"],[120713,120713,"ON"],[120745,120745,"ON"],[120771,120771,"ON"],[120782,120831,"EN"],[121344,121398,"NSM"],[121403,121452,"NSM"],[121461,121461,"NSM"],[121476,121476,"NSM"],[121499,121503,"NSM"],[121505,121519,"NSM"],[122880,122886,"NSM"],[122888,122904,"NSM"],[122907,122913,"NSM"],[122915,122916,"NSM"],[122918,122922,"NSM"],[123023,123023,"NSM"],[123184,123190,"NSM"],[123566,123566,"NSM"],[123628,123631,"NSM"],[123647,123647,"ET"],[124140,124143,"NSM"],[124398,124399,"NSM"],[124643,124643,"NSM"],[124646,124646,"NSM"],[124654,124655,"NSM"],[124661,124661,"NSM"],[124928,125135,"R"],[125136,125142,"NSM"],[125143,125251,"R"],[125252,125258,"NSM"],[125259,126063,"R"],[126064,126143,"AL"],[126144,126207,"R"],[126208,126287,"AL"],[126288,126463,"R"],[126464,126703,"AL"],[126704,126705,"ON"],[126706,126719,"AL"],[126720,126975,"R"],[126976,127019,"ON"],[127024,127123,"ON"],[127136,127150,"ON"],[127153,127167,"ON"],[127169,127183,"ON"],[127185,127221,"ON"],[127232,127242,"EN"],[127243,127247,"ON"],[127279,127279,"ON"],[127338,127343,"ON"],[127405,127405,"ON"],[127584,127589,"ON"],[127744,128728,"ON"],[128732,128748,"ON"],[128752,128764,"ON"],[128768,128985,"ON"],[128992,129003,"ON"],[129008,129008,"ON"],[129024,129035,"ON"],[129040,129095,"ON"],[129104,129113,"ON"],[129120,129159,"ON"],[129168,129197,"ON"],[129200,129211,"ON"],[129216,129217,"ON"],[129232,129240,"ON"],[129280,129623,"ON"],[129632,129645,"ON"],[129648,129660,"ON"],[129664,129674,"ON"],[129678,129734,"ON"],[129736,129736,"ON"],[129741,129756,"ON"],[129759,129770,"ON"],[129775,129784,"ON"],[129792,129938,"ON"],[129940,130031,"ON"],[130032,130041,"EN"],[130042,130042,"ON"],[131070,131071,"BN"],[196606,196607,"BN"],[262142,262143,"BN"],[327678,327679,"BN"],[393214,393215,"BN"],[458750,458751,"BN"],[524286,524287,"BN"],[589822,589823,"BN"],[655358,655359,"BN"],[720894,720895,"BN"],[786430,786431,"BN"],[851966,851967,"BN"],[917502,917759,"BN"],[917760,917999,"NSM"],[918e3,921599,"BN"],[983038,983039,"BN"],[1048574,1048575,"BN"],[1114110,1114111,"BN"]];function xy(e){if(e<=255)return Vf[e];let t=0,n=ss.length-1;for(;t<=n;){let r=t+n>>1,i=ss[r];if(ei[1]){t=r+1;continue}return i[2]}return"L"}function yy(e){let t=e.length;if(t===0)return null;let n=new Array(t),r=!1;for(let u=0;u=55296&&c<=56319&&u+1=56320&&b<=57343&&(f=(c-55296<<10)+(b-56320)+65536,m=2)}let p=xy(f);(p==="R"||p==="AL"||p==="AN")&&(r=!0);for(let b=0;b=0&&n[c]==="ET";c--)n[c]="EN";for(c=u+1;c0?n[u-1]:l,m=c0&&t.charCodeAt(t.length-1)===32&&(t=t.slice(0,-1)),t}function wy(e){return/[\r\f]/.test(e)?e.replace(/\r\n/g,` `).replace(/[\r\f]/g,` `):e.replace(/\r\n/g,` `)}var ls=null,Cy;function _y(){return ls===null&&(ls=new Intl.Segmenter(Cy,{granularity:"word"})),ls}var Ty=/\p{Script=Arabic}/u,Mi=/\p{M}/u,Qf=/\p{Nd}/u;function qf(e){return Ty.test(e)}function $f(e){return e>=19968&&e<=40959||e>=13312&&e<=19903||e>=131072&&e<=173791||e>=173824&&e<=177983||e>=177984&&e<=178207||e>=178208&&e<=183983||e>=183984&&e<=191471||e>=191472&&e<=192093||e>=194560&&e<=195103||e>=196608&&e<=201551||e>=201552&&e<=205743||e>=205744&&e<=210041||e>=63744&&e<=64255||e>=12288&&e<=12351||e>=12352&&e<=12447||e>=12448&&e<=12543||e>=44032&&e<=55215||e>=65280&&e<=65519}function Ve(e){for(let t=0;t=55296&&n<=56319&&t+1=56320&&r<=57343){let i=(n-55296<<10)+(r-56320)+65536;if($f(i))return!0;t++;continue}}if($f(n))return!0}}return!1}function Ry(e){let t=Li(e);return t!==null&&(Ni.has(t)||vt.has(t))}var ky=new Set(["\xA0","\u202F","\u2060","\uFEFF"]);function My(e){return Ve(e)}function Fy(e){let t=Li(e);return t!==null&&ky.has(t)}function Fi(e){return!Ry(e)&&!Fy(e)}var Ni=new Set(["\uFF0C","\uFF0E","\uFF01","\uFF1A","\uFF1B","\uFF1F","\u3001","\u3002","\u30FB","\uFF09","\u3015","\u3009","\u300B","\u300D","\u300F","\u3011","\u3017","\u3019","\u301B","\u30FC","\u3005","\u303B","\u309D","\u309E","\u30FD","\u30FE"]),hr=new Set(['"',"(","[","{","\u201C","\u2018","\xAB","\u2039","\uFF08","\u3014","\u3008","\u300A","\u300C","\u300E","\u3010","\u3016","\u3018","\u301A"]),cs=new Set(["'","\u2019"]),vt=new Set([".",",","!","?",":",";","\u060C","\u061B","\u061F","\u0964","\u0965","\u104A","\u104B","\u104C","\u104D","\u104F",")","]","}","%",'"',"\u201D","\u2019","\xBB","\u203A","\u2026"]),Ny=new Set([":",".","\u060C","\u061B"]),Ly=new Set(["\u104F"]),Dy=new Set(["\u201D","\u2019","\xBB","\u203A","\u300D","\u300F","\u3011","\u300B","\u3009","\u3015","\uFF09"]);function Iy(e){if(ds(e))return!0;let t=!1;for(let n of e){if(vt.has(n)){t=!0;continue}if(!(t&&Mi.test(n)))return!1}return t}function Py(e){for(let t of e)if(!Ni.has(t)&&!vt.has(t))return!1;return e.length>0}function Oy(e){if(ds(e))return!0;for(let t of e)if(!hr.has(t)&&!cs.has(t)&&!Mi.test(t))return!1;return e.length>0}function ds(e){let t=!1;for(let n of e)if(!(n==="\\"||Mi.test(n))){if(hr.has(n)||vt.has(n)||cs.has(n)){t=!0;continue}return!1}return t}function Zf(e,t){let n=t-1;if(n<=0)return Math.max(n,0);let r=e.charCodeAt(n);if(r<56320||r>57343)return n;let i=n-1;if(i<0)return n;let o=e.charCodeAt(i);return o>=55296&&o<=56319?i:n}function Li(e){if(e.length===0)return null;let t=Zf(e,e.length);return e.slice(t)}function Hy(e){let t=Array.from(e),n=t.length;for(;n>0;){let r=t[n-1];if(Mi.test(r)){n--;continue}if(hr.has(r)||cs.has(r)){n--;continue}break}return n<=0||n===t.length?null:{head:t.slice(0,n).join(""),tail:t.slice(n).join("")}}function Gy(e,t,n){return n==="text"&&!t&&e.length===1&&e!=="-"&&e!=="\u2014"?e:null}function jf(e,t,n,r){let i=t[r],o=e[r];if(i==null)return o;let a=n[r];if(o.length===a)return o;let l=i.repeat(a);return e[r]=l,l}function Kf(e,t){return e&&t!==null&&Ny.has(t)}function By(e){let t=Li(e);return t!==null&&Ly.has(t)}function Uy(e){if(e.length<2||e[0]!==" ")return null;let t=e.slice(1);return/^\p{M}+$/u.test(t)?{space:" ",marks:t}:null}function Di(e){let t=e.length;for(;t>0;){let n=Zf(e,t),r=e.slice(n,t);if(Dy.has(r))return!0;if(!vt.has(r))return!1;t=n}return!1}function Wy(e,t){if(t.preserveOrdinarySpaces||t.preserveHardBreaks){if(e===" ")return"preserved-space";if(e===" ")return"tab";if(t.preserveHardBreaks&&e===` diff --git a/dist/studio/assets/index-BIf0zQNt.js b/dist/studio/assets/index-BIf0zQNt.js index 94f85eee8ac6768b3ba46f5654ae62ae65c6d865..d57e862b19eab6c67e8600b5fc96094ab29f0017 100644 --- a/dist/studio/assets/index-BIf0zQNt.js +++ b/dist/studio/assets/index-BIf0zQNt.js @@ -46,7 +46,7 @@ var dOe=Object.defineProperty;var pOe=(t,e,n)=>e in t?dOe(t,e,{enumerable:!0,con `+Ee[D].replace(" at new "," at ");return g.displayName&&Ge.includes("")&&(Ge=Ge.replace("",g.displayName)),Ge}while(1<=D&&0<=V);break}}}finally{ge=!1,Error.prepareStackTrace=C}return(C=g?g.displayName||g.name:"")?pe(C):""}function ve(g,A){switch(g.tag){case 26:case 27:case 5:return pe(g.type);case 16:return pe("Lazy");case 13:return g.child!==A&&A!==null?pe("Suspense Fallback"):pe("Suspense");case 19:return pe("SuspenseList");case 0:case 15:return Pe(g.type,!1);case 11:return Pe(g.type.render,!1);case 1:return Pe(g.type,!0);case 31:return pe("Activity");default:return""}}function xe(g){try{var A="",C=null;do A+=ve(g,C),C=g,g=g.return;while(g);return A}catch(D){return` Error generating stack: `+D.message+` `+D.stack}}var we=Object.prototype.hasOwnProperty,Ce=t.unstable_scheduleCallback,Me=t.unstable_cancelCallback,Ve=t.unstable_shouldYield,tt=t.unstable_requestPaint,Ze=t.unstable_now,qe=t.unstable_getCurrentPriorityLevel,pt=t.unstable_ImmediatePriority,it=t.unstable_UserBlockingPriority,vt=t.unstable_NormalPriority,Ot=t.unstable_LowPriority,Kt=t.unstable_IdlePriority,qt=t.log,fn=t.unstable_setDisableYieldValue,Jt=null,Je=null;function St(g){if(typeof qt=="function"&&fn(g),Je&&typeof Je.setStrictMode=="function")try{Je.setStrictMode(Jt,g)}catch{}}var At=Math.clz32?Math.clz32:We,Ke=Math.log,Be=Math.LN2;function We(g){return g>>>=0,g===0?32:31-(Ke(g)/Be|0)|0}var Ye=256,Zt=262144,Te=4194304;function De(g){var A=g&42;if(A!==0)return A;switch(g&-g){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return g&261888;case 262144:case 524288:case 1048576:case 2097152:return g&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return g&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return g}}function ze(g,A,C){var D=g.pendingLanes;if(D===0)return 0;var V=0,G=g.suspendedLanes,ae=g.pingedLanes;g=g.warmLanes;var de=D&134217727;return de!==0?(D=de&~G,D!==0?V=De(D):(ae&=de,ae!==0?V=De(ae):C||(C=de&~g,C!==0&&(V=De(C))))):(de=D&~G,de!==0?V=De(de):ae!==0?V=De(ae):C||(C=D&~g,C!==0&&(V=De(C)))),V===0?0:A!==0&&A!==V&&(A&G)===0&&(G=V&-V,C=A&-A,G>=C||G===32&&(C&4194048)!==0)?A:V}function st(g,A){return(g.pendingLanes&~(g.suspendedLanes&~g.pingedLanes)&A)===0}function Gt(g,A){switch(g){case 1:case 2:case 4:case 8:case 64:return A+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return A+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function ln(){var g=Te;return Te<<=1,(Te&62914560)===0&&(Te=4194304),g}function Yt(g){for(var A=[],C=0;31>C;C++)A.push(g);return A}function Nn(g,A){g.pendingLanes|=A,A!==268435456&&(g.suspendedLanes=0,g.pingedLanes=0,g.warmLanes=0)}function Mr(g,A,C,D,V,G){var ae=g.pendingLanes;g.pendingLanes=C,g.suspendedLanes=0,g.pingedLanes=0,g.warmLanes=0,g.expiredLanes&=C,g.entangledLanes&=C,g.errorRecoveryDisabledLanes&=C,g.shellSuspendCounter=0;var de=g.entanglements,Ee=g.expirationTimes,Le=g.hiddenUpdates;for(C=ae&~C;0"u")return null;try{return g.activeElement||g.body}catch{return g.body}}var Qa=/[\n"\\]/g;function bi(g){return g.replace(Qa,function(A){return"\\"+A.charCodeAt(0).toString(16)+" "})}function wa(g,A,C,D,V,G,ae,de){g.name="",ae!=null&&typeof ae!="function"&&typeof ae!="symbol"&&typeof ae!="boolean"?g.type=ae:g.removeAttribute("type"),A!=null?ae==="number"?(A===0&&g.value===""||g.value!=A)&&(g.value=""+ir(A)):g.value!==""+ir(A)&&(g.value=""+ir(A)):ae!=="submit"&&ae!=="reset"||g.removeAttribute("value"),A!=null?Ae(g,ae,ir(A)):C!=null?Ae(g,ae,ir(C)):D!=null&&g.removeAttribute("value"),V==null&&G!=null&&(g.defaultChecked=!!G),V!=null&&(g.checked=V&&typeof V!="function"&&typeof V!="symbol"),de!=null&&typeof de!="function"&&typeof de!="symbol"&&typeof de!="boolean"?g.name=""+ir(de):g.removeAttribute("name")}function ft(g,A,C,D,V,G,ae,de){if(G!=null&&typeof G!="function"&&typeof G!="symbol"&&typeof G!="boolean"&&(g.type=G),A!=null||C!=null){if(!(G!=="submit"&&G!=="reset"||A!=null)){Vi(g);return}C=C!=null?""+ir(C):"",A=A!=null?""+ir(A):C,de||A===g.value||(g.value=A),g.defaultValue=A}D=D??V,D=typeof D!="function"&&typeof D!="symbol"&&!!D,g.checked=de?g.checked:!!D,g.defaultChecked=!!D,ae!=null&&typeof ae!="function"&&typeof ae!="symbol"&&typeof ae!="boolean"&&(g.name=ae),Vi(g)}function Ae(g,A,C){A==="number"&&Nr(g.ownerDocument)===g||g.defaultValue===""+C||(g.defaultValue=""+C)}function _e(g,A,C,D){if(g=g.options,A){A={};for(var V=0;V"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Fu=!1;if(Rs)try{var Hr={};Object.defineProperty(Hr,"passive",{get:function(){Fu=!0}}),window.addEventListener("test",Hr,Hr),window.removeEventListener("test",Hr,Hr)}catch{Fu=!1}var lt=null,kt=null,Ai=null;function ph(){if(Ai)return Ai;var g,A=kt,C=A.length,D,V="value"in lt?lt.value:lt.textContent,G=V.length;for(g=0;g=at),Cr=" ",pn=!1;function br(g,A){switch(g){case"keyup":return $e.indexOf(A.keyCode)!==-1;case"keydown":return A.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Hc(g){return g=g.detail,typeof g=="object"&&"data"in g?g.data:null}var ka=!1;function xw(g,A){switch(g){case"compositionend":return Hc(A);case"keypress":return A.which!==32?null:(pn=!0,Cr);case"textInput":return g=A.data,g===Cr&&pn?null:g;default:return null}}function bw(g,A){if(ka)return g==="compositionend"||!nt&&br(g,A)?(g=ph(),Ai=kt=lt=null,ka=!1,g):null;switch(g){case"paste":return null;case"keypress":if(!(A.ctrlKey||A.altKey||A.metaKey)||A.ctrlKey&&A.altKey){if(A.char&&1=A)return{node:C,offset:A-g};g=D}e:{for(;C;){if(C.nextSibling){C=C.nextSibling;break e}C=C.parentNode}C=void 0}C=ox(C)}}function cx(g,A){return g&&A?g===A?!0:g&&g.nodeType===3?!1:A&&A.nodeType===3?cx(g,A.parentNode):"contains"in g?g.contains(A):g.compareDocumentPosition?!!(g.compareDocumentPosition(A)&16):!1:!1}function ux(g){g=g!=null&&g.ownerDocument!=null&&g.ownerDocument.defaultView!=null?g.ownerDocument.defaultView:window;for(var A=Nr(g.document);A instanceof g.HTMLIFrameElement;){try{var C=typeof A.contentWindow.location.href=="string"}catch{C=!1}if(C)g=A.contentWindow;else break;A=Nr(g.document)}return A}function hm(g){var A=g&&g.nodeName&&g.nodeName.toLowerCase();return A&&(A==="input"&&(g.type==="text"||g.type==="search"||g.type==="tel"||g.type==="url"||g.type==="password")||A==="textarea"||g.contentEditable==="true")}var Ew=Rs&&"documentMode"in document&&11>=document.documentMode,Bu=null,E5=null,fx=null,T5=!1;function aH(g,A,C){var D=C.window===C?C.document:C.nodeType===9?C:C.ownerDocument;T5||Bu==null||Bu!==Nr(D)||(D=Bu,"selectionStart"in D&&hm(D)?D={start:D.selectionStart,end:D.selectionEnd}:(D=(D.ownerDocument&&D.ownerDocument.defaultView||window).getSelection(),D={anchorNode:D.anchorNode,anchorOffset:D.anchorOffset,focusNode:D.focusNode,focusOffset:D.focusOffset}),fx&&bh(fx,D)||(fx=D,D=mO(E5,"onSelect"),0>=ae,V-=ae,Qc=1<<32-At(A)+V|C<Mn?(Xn=Bt,Bt=null):Xn=Bt.sibling;var dr=Fe(Ie,Bt,je[Mn],Ue);if(dr===null){Bt===null&&(Bt=Xn);break}g&&Bt&&dr.alternate===null&&A(Ie,Bt),Ne=G(dr,Ne,Mn),hr===null?Wt=dr:hr.sibling=dr,hr=dr,Bt=Xn}if(Mn===je.length)return C(Ie,Bt),Kn&&Hu(Ie,Mn),Wt;if(Bt===null){for(;MnMn?(Xn=Bt,Bt=null):Xn=Bt.sibling;var Vh=Fe(Ie,Bt,dr.value,Ue);if(Vh===null){Bt===null&&(Bt=Xn);break}g&&Bt&&Vh.alternate===null&&A(Ie,Bt),Ne=G(Vh,Ne,Mn),hr===null?Wt=Vh:hr.sibling=Vh,hr=Vh,Bt=Xn}if(dr.done)return C(Ie,Bt),Kn&&Hu(Ie,Mn),Wt;if(Bt===null){for(;!dr.done;Mn++,dr=je.next())dr=Xe(Ie,dr.value,Ue),dr!==null&&(Ne=G(dr,Ne,Mn),hr===null?Wt=dr:hr.sibling=dr,hr=dr);return Kn&&Hu(Ie,Mn),Wt}for(Bt=D(Bt);!dr.done;Mn++,dr=je.next())dr=He(Bt,Ie,Mn,dr.value,Ue),dr!==null&&(g&&dr.alternate!==null&&Bt.delete(dr.key===null?Mn:dr.key),Ne=G(dr,Ne,Mn),hr===null?Wt=dr:hr.sibling=dr,hr=dr);return g&&Bt.forEach(function(hOe){return A(Ie,hOe)}),Kn&&Hu(Ie,Mn),Wt}function _r(Ie,Ne,je,Ue){if(typeof je=="object"&&je!==null&&je.type===m&&je.key===null&&(je=je.props.children),typeof je=="object"&&je!==null){switch(je.$$typeof){case p:e:{for(var Wt=je.key;Ne!==null;){if(Ne.key===Wt){if(Wt=je.type,Wt===m){if(Ne.tag===7){C(Ie,Ne.sibling),Ue=V(Ne,je.props.children),Ue.return=Ie,Ie=Ue;break e}}else if(Ne.elementType===Wt||typeof Wt=="object"&&Wt!==null&&Wt.$$typeof===_&&up(Wt)===Ne.type){C(Ie,Ne.sibling),Ue=V(Ne,je.props),yx(Ue,je),Ue.return=Ie,Ie=Ue;break e}C(Ie,Ne);break}else A(Ie,Ne);Ne=Ne.sibling}je.type===m?(Ue=sp(je.props.children,Ie.mode,Ue,je.key),Ue.return=Ie,Ie=Ue):(Ue=Dw(je.type,je.key,je.props,null,Ie.mode,Ue),yx(Ue,je),Ue.return=Ie,Ie=Ue)}return ae(Ie);case y:e:{for(Wt=je.key;Ne!==null;){if(Ne.key===Wt)if(Ne.tag===4&&Ne.stateNode.containerInfo===je.containerInfo&&Ne.stateNode.implementation===je.implementation){C(Ie,Ne.sibling),Ue=V(Ne,je.children||[]),Ue.return=Ie,Ie=Ue;break e}else{C(Ie,Ne);break}else A(Ie,Ne);Ne=Ne.sibling}Ue=R5(je,Ie.mode,Ue),Ue.return=Ie,Ie=Ue}return ae(Ie);case _:return je=up(je),_r(Ie,Ne,je,Ue)}if(Y(je))return jt(Ie,Ne,je,Ue);if(B(je)){if(Wt=B(je),typeof Wt!="function")throw Error(r(150));return je=Wt.call(je),sn(Ie,Ne,je,Ue)}if(typeof je.then=="function")return _r(Ie,Ne,$w(je),Ue);if(je.$$typeof===O)return _r(Ie,Ne,Rw(Ie,je),Ue);Bw(Ie,je)}return typeof je=="string"&&je!==""||typeof je=="number"||typeof je=="bigint"?(je=""+je,Ne!==null&&Ne.tag===6?(C(Ie,Ne.sibling),Ue=V(Ne,je),Ue.return=Ie,Ie=Ue):(C(Ie,Ne),Ue=_5(je,Ie.mode,Ue),Ue.return=Ie,Ie=Ue),ae(Ie)):C(Ie,Ne)}return function(Ie,Ne,je,Ue){try{gx=0;var Wt=_r(Ie,Ne,je,Ue);return wm=null,Wt}catch(Bt){if(Bt===Sm||Bt===Lw)throw Bt;var hr=wo(29,Bt,null,Ie.mode);return hr.lanes=Ue,hr.return=Ie,hr}finally{}}}var hp=PH(!0),MH=PH(!1),Oh=!1;function U5(g){g.updateQueue={baseState:g.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function X5(g,A){g=g.updateQueue,A.updateQueue===g&&(A.updateQueue={baseState:g.baseState,firstBaseUpdate:g.firstBaseUpdate,lastBaseUpdate:g.lastBaseUpdate,shared:g.shared,callbacks:null})}function Ch(g){return{lane:g,tag:0,payload:null,callback:null,next:null}}function kh(g,A,C){var D=g.updateQueue;if(D===null)return null;if(D=D.shared,(gr&2)!==0){var V=D.pending;return V===null?A.next=A:(A.next=V.next,V.next=A),D.pending=A,A=Nw(g),dH(g,null,C),A}return Mw(g,D,A,C),Nw(g)}function xx(g,A,C){if(A=A.updateQueue,A!==null&&(A=A.shared,(C&4194048)!==0)){var D=A.lanes;D&=g.pendingLanes,C|=D,A.lanes=C,vn(g,C)}}function W5(g,A){var C=g.updateQueue,D=g.alternate;if(D!==null&&(D=D.updateQueue,C===D)){var V=null,G=null;if(C=C.firstBaseUpdate,C!==null){do{var ae={lane:C.lane,tag:C.tag,payload:C.payload,callback:null,next:null};G===null?V=G=ae:G=G.next=ae,C=C.next}while(C!==null);G===null?V=G=A:G=G.next=A}else V=G=A;C={baseState:D.baseState,firstBaseUpdate:V,lastBaseUpdate:G,shared:D.shared,callbacks:D.callbacks},g.updateQueue=C;return}g=C.lastBaseUpdate,g===null?C.firstBaseUpdate=A:g.next=A,C.lastBaseUpdate=A}var q5=!1;function bx(){if(q5){var g=Am;if(g!==null)throw g}}function vx(g,A,C,D){q5=!1;var V=g.updateQueue;Oh=!1;var G=V.firstBaseUpdate,ae=V.lastBaseUpdate,de=V.shared.pending;if(de!==null){V.shared.pending=null;var Ee=de,Le=Ee.next;Ee.next=null,ae===null?G=Le:ae.next=Le,ae=Ee;var Ge=g.alternate;Ge!==null&&(Ge=Ge.updateQueue,de=Ge.lastBaseUpdate,de!==ae&&(de===null?Ge.firstBaseUpdate=Le:de.next=Le,Ge.lastBaseUpdate=Ee))}if(G!==null){var Xe=V.baseState;ae=0,Ge=Le=Ee=null,de=G;do{var Fe=de.lane&-536870913,He=Fe!==de.lane;if(He?(Un&Fe)===Fe:(D&Fe)===Fe){Fe!==0&&Fe===vm&&(q5=!0),Ge!==null&&(Ge=Ge.next={lane:0,tag:de.tag,payload:de.payload,callback:null,next:null});e:{var jt=g,sn=de;Fe=A;var _r=C;switch(sn.tag){case 1:if(jt=sn.payload,typeof jt=="function"){Xe=jt.call(_r,Xe,Fe);break e}Xe=jt;break e;case 3:jt.flags=jt.flags&-65537|128;case 0:if(jt=sn.payload,Fe=typeof jt=="function"?jt.call(_r,Xe,Fe):jt,Fe==null)break e;Xe=f({},Xe,Fe);break e;case 2:Oh=!0}}Fe=de.callback,Fe!==null&&(g.flags|=64,He&&(g.flags|=8192),He=V.callbacks,He===null?V.callbacks=[Fe]:He.push(Fe))}else He={lane:Fe,tag:de.tag,payload:de.payload,callback:de.callback,next:null},Ge===null?(Le=Ge=He,Ee=Xe):Ge=Ge.next=He,ae|=Fe;if(de=de.next,de===null){if(de=V.shared.pending,de===null)break;He=de,de=He.next,He.next=null,V.lastBaseUpdate=He,V.shared.pending=null}}while(!0);Ge===null&&(Ee=Xe),V.baseState=Ee,V.firstBaseUpdate=Le,V.lastBaseUpdate=Ge,G===null&&(V.shared.lanes=0),Nh|=ae,g.lanes=ae,g.memoizedState=Xe}}function NH(g,A){if(typeof g!="function")throw Error(r(191,g));g.call(A)}function DH(g,A){var C=g.callbacks;if(C!==null)for(g.callbacks=null,g=0;gG?G:8;var ae=W.T,de={};W.T=de,mT(g,!1,A,C);try{var Ee=V(),Le=W.S;if(Le!==null&&Le(de,Ee),Ee!==null&&typeof Ee=="object"&&typeof Ee.then=="function"){var Ge=twe(Ee,D);wx(g,A,Ge,To(g))}else wx(g,A,D,To(g))}catch(Xe){wx(g,A,{then:function(){},status:"rejected",reason:Xe},To())}finally{J.p=G,ae!==null&&de.types!==null&&(ae.types=de.types),W.T=ae}}function owe(){}function dT(g,A,C,D){if(g.tag!==5)throw Error(r(476));var V=uQ(g).queue;cQ(g,V,A,ne,C===null?owe:function(){return fQ(g),C(D)})}function uQ(g){var A=g.memoizedState;if(A!==null)return A;A={memoizedState:ne,baseState:ne,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Gu,lastRenderedState:ne},next:null};var C={};return A.next={memoizedState:C,baseState:C,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Gu,lastRenderedState:C},next:null},g.memoizedState=A,g=g.alternate,g!==null&&(g.memoizedState=A),A}function fQ(g){var A=uQ(g);A.next===null&&(A=g.alternate.memoizedState),wx(g,A.next.queue,{},To())}function pT(){return Fs(Bx)}function hQ(){return Qi().memoizedState}function dQ(){return Qi().memoizedState}function lwe(g){for(var A=g.return;A!==null;){switch(A.tag){case 24:case 3:var C=To();g=Ch(C);var D=kh(A,g,C);D!==null&&(Xa(D,A,C),xx(D,A,C)),A={cache:Q5()},g.payload=A;return}A=A.return}}function cwe(g,A,C){var D=To();C={lane:D,revertLane:0,gesture:null,action:C,hasEagerState:!1,eagerState:null,next:null},qw(g)?mQ(A,C):(C=D5(g,A,C,D),C!==null&&(Xa(C,g,D),gQ(C,A,D)))}function pQ(g,A,C){var D=To();wx(g,A,C,D)}function wx(g,A,C,D){var V={lane:D,revertLane:0,gesture:null,action:C,hasEagerState:!1,eagerState:null,next:null};if(qw(g))mQ(A,V);else{var G=g.alternate;if(g.lanes===0&&(G===null||G.lanes===0)&&(G=A.lastRenderedReducer,G!==null))try{var ae=A.lastRenderedState,de=G(ae,C);if(V.hasEagerState=!0,V.eagerState=de,na(de,ae))return Mw(g,A,V,0),Qr===null&&Pw(),!1}catch{}finally{}if(C=D5(g,A,V,D),C!==null)return Xa(C,g,D),gQ(C,A,D),!0}return!1}function mT(g,A,C,D){if(D={lane:2,revertLane:UT(),gesture:null,action:D,hasEagerState:!1,eagerState:null,next:null},qw(g)){if(A)throw Error(r(479))}else A=D5(g,C,D,2),A!==null&&Xa(A,g,2)}function qw(g){var A=g.alternate;return g===En||A!==null&&A===En}function mQ(g,A){Cm=Qw=!0;var C=g.pending;C===null?A.next=A:(A.next=C.next,C.next=A),g.pending=A}function gQ(g,A,C){if((C&4194048)!==0){var D=A.lanes;D&=g.pendingLanes,C|=D,A.lanes=C,vn(g,C)}}var Ox={readContext:Fs,use:Gw,useCallback:Mi,useContext:Mi,useEffect:Mi,useImperativeHandle:Mi,useLayoutEffect:Mi,useInsertionEffect:Mi,useMemo:Mi,useReducer:Mi,useRef:Mi,useState:Mi,useDebugValue:Mi,useDeferredValue:Mi,useTransition:Mi,useSyncExternalStore:Mi,useId:Mi,useHostTransitionStatus:Mi,useFormState:Mi,useActionState:Mi,useOptimistic:Mi,useMemoCache:Mi,useCacheRefresh:Mi};Ox.useEffectEvent=Mi;var yQ={readContext:Fs,use:Gw,useCallback:function(g,A){return Ea().memoizedState=[g,A===void 0?null:A],g},useContext:Fs,useEffect:eQ,useImperativeHandle:function(g,A,C){C=C!=null?C.concat([g]):null,Xw(4194308,4,iQ.bind(null,A,g),C)},useLayoutEffect:function(g,A){return Xw(4194308,4,g,A)},useInsertionEffect:function(g,A){Xw(4,2,g,A)},useMemo:function(g,A){var C=Ea();A=A===void 0?null:A;var D=g();if(dp){St(!0);try{g()}finally{St(!1)}}return C.memoizedState=[D,A],D},useReducer:function(g,A,C){var D=Ea();if(C!==void 0){var V=C(A);if(dp){St(!0);try{C(A)}finally{St(!1)}}}else V=A;return D.memoizedState=D.baseState=V,g={pending:null,lanes:0,dispatch:null,lastRenderedReducer:g,lastRenderedState:V},D.queue=g,g=g.dispatch=cwe.bind(null,En,g),[D.memoizedState,g]},useRef:function(g){var A=Ea();return g={current:g},A.memoizedState=g},useState:function(g){g=lT(g);var A=g.queue,C=pQ.bind(null,En,A);return A.dispatch=C,[g.memoizedState,C]},useDebugValue:fT,useDeferredValue:function(g,A){var C=Ea();return hT(C,g,A)},useTransition:function(){var g=lT(!1);return g=cQ.bind(null,En,g.queue,!0,!1),Ea().memoizedState=g,[!1,g]},useSyncExternalStore:function(g,A,C){var D=En,V=Ea();if(Kn){if(C===void 0)throw Error(r(407));C=C()}else{if(C=A(),Qr===null)throw Error(r(349));(Un&127)!==0||FH(D,A,C)}V.memoizedState=C;var G={value:C,getSnapshot:A};return V.queue=G,eQ(BH.bind(null,D,G,g),[g]),D.flags|=2048,Em(9,{destroy:void 0},$H.bind(null,D,G,C,A),null),C},useId:function(){var g=Ea(),A=Qr.identifierPrefix;if(Kn){var C=zc,D=Qc;C=(D&~(1<<32-At(D)-1)).toString(32)+C,A="_"+A+"R_"+C,C=zw++,0<\/script>",G=G.removeChild(G.firstChild);break;case"select":G=typeof D.is=="string"?ae.createElement("select",{is:D.is}):ae.createElement("select"),D.multiple?G.multiple=!0:D.size&&(G.size=D.size);break;default:G=typeof D.is=="string"?ae.createElement(V,{is:D.is}):ae.createElement(V)}}G[hn]=A,G[Ht]=D;e:for(ae=A.child;ae!==null;){if(ae.tag===5||ae.tag===6)G.appendChild(ae.stateNode);else if(ae.tag!==4&&ae.tag!==27&&ae.child!==null){ae.child.return=ae,ae=ae.child;continue}if(ae===A)break e;for(;ae.sibling===null;){if(ae.return===null||ae.return===A)break e;ae=ae.return}ae.sibling.return=ae.return,ae=ae.sibling}A.stateNode=G;e:switch(Bs(G,V,D),V){case"button":case"input":case"select":case"textarea":D=!!D.autoFocus;break e;case"img":D=!0;break e;default:D=!1}D&&Xu(A)}}return si(A),PT(A,A.type,g===null?null:g.memoizedProps,A.pendingProps,C),null;case 6:if(g&&A.stateNode!=null)g.memoizedProps!==D&&Xu(A);else{if(typeof D!="string"&&A.stateNode===null)throw Error(r(166));if(g=ee.current,xm(A)){if(g=A.stateNode,C=A.memoizedProps,D=null,V=Ls,V!==null)switch(V.tag){case 27:case 5:D=V.memoizedProps}g[hn]=A,g=!!(g.nodeValue===C||D!==null&&D.suppressHydrationWarning===!0||jz(g.nodeValue,C)),g||Sh(A,!0)}else g=gO(g).createTextNode(D),g[hn]=A,A.stateNode=g}return si(A),null;case 31:if(C=A.memoizedState,g===null||g.memoizedState!==null){if(D=xm(A),C!==null){if(g===null){if(!D)throw Error(r(318));if(g=A.memoizedState,g=g!==null?g.dehydrated:null,!g)throw Error(r(557));g[hn]=A}else ap(),(A.flags&128)===0&&(A.memoizedState=null),A.flags|=4;si(A),g=!1}else C=$5(),g!==null&&g.memoizedState!==null&&(g.memoizedState.hydrationErrors=C),g=!0;if(!g)return A.flags&256?(Co(A),A):(Co(A),null);if((A.flags&128)!==0)throw Error(r(558))}return si(A),null;case 13:if(D=A.memoizedState,g===null||g.memoizedState!==null&&g.memoizedState.dehydrated!==null){if(V=xm(A),D!==null&&D.dehydrated!==null){if(g===null){if(!V)throw Error(r(318));if(V=A.memoizedState,V=V!==null?V.dehydrated:null,!V)throw Error(r(317));V[hn]=A}else ap(),(A.flags&128)===0&&(A.memoizedState=null),A.flags|=4;si(A),V=!1}else V=$5(),g!==null&&g.memoizedState!==null&&(g.memoizedState.hydrationErrors=V),V=!0;if(!V)return A.flags&256?(Co(A),A):(Co(A),null)}return Co(A),(A.flags&128)!==0?(A.lanes=C,A):(C=D!==null,g=g!==null&&g.memoizedState!==null,C&&(D=A.child,V=null,D.alternate!==null&&D.alternate.memoizedState!==null&&D.alternate.memoizedState.cachePool!==null&&(V=D.alternate.memoizedState.cachePool.pool),G=null,D.memoizedState!==null&&D.memoizedState.cachePool!==null&&(G=D.memoizedState.cachePool.pool),G!==V&&(D.flags|=2048)),C!==g&&C&&(A.child.flags|=8192),tO(A,A.updateQueue),si(A),null);case 4:return H(),g===null&&YT(A.stateNode.containerInfo),si(A),null;case 10:return zu(A.type),si(A),null;case 19:if(F(Hi),D=A.memoizedState,D===null)return si(A),null;if(V=(A.flags&128)!==0,G=D.rendering,G===null)if(V)kx(D,!1);else{if(Ni!==0||g!==null&&(g.flags&128)!==0)for(g=A.child;g!==null;){if(G=Hw(g),G!==null){for(A.flags|=128,kx(D,!1),g=G.updateQueue,A.updateQueue=g,tO(A,g),A.subtreeFlags=0,g=C,C=A.child;C!==null;)pH(C,g),C=C.sibling;return U(Hi,Hi.current&1|2),Kn&&Hu(A,D.treeForkCount),A.child}g=g.sibling}D.tail!==null&&Ze()>aO&&(A.flags|=128,V=!0,kx(D,!1),A.lanes=4194304)}else{if(!V)if(g=Hw(G),g!==null){if(A.flags|=128,V=!0,g=g.updateQueue,A.updateQueue=g,tO(A,g),kx(D,!0),D.tail===null&&D.tailMode==="hidden"&&!G.alternate&&!Kn)return si(A),null}else 2*Ze()-D.renderingStartTime>aO&&C!==536870912&&(A.flags|=128,V=!0,kx(D,!1),A.lanes=4194304);D.isBackwards?(G.sibling=A.child,A.child=G):(g=D.last,g!==null?g.sibling=G:A.child=G,D.last=G)}return D.tail!==null?(g=D.tail,D.rendering=g,D.tail=g.sibling,D.renderingStartTime=Ze(),g.sibling=null,C=Hi.current,U(Hi,V?C&1|2:C&1),Kn&&Hu(A,D.treeForkCount),g):(si(A),null);case 22:case 23:return Co(A),K5(),D=A.memoizedState!==null,g!==null?g.memoizedState!==null!==D&&(A.flags|=8192):D&&(A.flags|=8192),D?(C&536870912)!==0&&(A.flags&128)===0&&(si(A),A.subtreeFlags&6&&(A.flags|=8192)):si(A),C=A.updateQueue,C!==null&&tO(A,C.retryQueue),C=null,g!==null&&g.memoizedState!==null&&g.memoizedState.cachePool!==null&&(C=g.memoizedState.cachePool.pool),D=null,A.memoizedState!==null&&A.memoizedState.cachePool!==null&&(D=A.memoizedState.cachePool.pool),D!==C&&(A.flags|=2048),g!==null&&F(cp),null;case 24:return C=null,g!==null&&(C=g.memoizedState.cache),A.memoizedState.cache!==C&&(A.flags|=2048),zu(Ki),si(A),null;case 25:return null;case 30:return null}throw Error(r(156,A.tag))}function pwe(g,A){switch(L5(A),A.tag){case 1:return g=A.flags,g&65536?(A.flags=g&-65537|128,A):null;case 3:return zu(Ki),H(),g=A.flags,(g&65536)!==0&&(g&128)===0?(A.flags=g&-65537|128,A):null;case 26:case 27:case 5:return fe(A),null;case 31:if(A.memoizedState!==null){if(Co(A),A.alternate===null)throw Error(r(340));ap()}return g=A.flags,g&65536?(A.flags=g&-65537|128,A):null;case 13:if(Co(A),g=A.memoizedState,g!==null&&g.dehydrated!==null){if(A.alternate===null)throw Error(r(340));ap()}return g=A.flags,g&65536?(A.flags=g&-65537|128,A):null;case 19:return F(Hi),null;case 4:return H(),null;case 10:return zu(A.type),null;case 22:case 23:return Co(A),K5(),g!==null&&F(cp),g=A.flags,g&65536?(A.flags=g&-65537|128,A):null;case 24:return zu(Ki),null;case 25:return null;default:return null}}function VQ(g,A){switch(L5(A),A.tag){case 3:zu(Ki),H();break;case 26:case 27:case 5:fe(A);break;case 4:H();break;case 31:A.memoizedState!==null&&Co(A);break;case 13:Co(A);break;case 19:F(Hi);break;case 10:zu(A.type);break;case 22:case 23:Co(A),K5(),g!==null&&F(cp);break;case 24:zu(Ki)}}function Ex(g,A){try{var C=A.updateQueue,D=C!==null?C.lastEffect:null;if(D!==null){var V=D.next;C=V;do{if((C.tag&g)===g){D=void 0;var G=C.create,ae=C.inst;D=G(),ae.destroy=D}C=C.next}while(C!==V)}}catch(de){Er(A,A.return,de)}}function Ph(g,A,C){try{var D=A.updateQueue,V=D!==null?D.lastEffect:null;if(V!==null){var G=V.next;D=G;do{if((D.tag&g)===g){var ae=D.inst,de=ae.destroy;if(de!==void 0){ae.destroy=void 0,V=A;var Ee=C,Le=de;try{Le()}catch(Ge){Er(V,Ee,Ge)}}}D=D.next}while(D!==G)}}catch(Ge){Er(A,A.return,Ge)}}function HQ(g){var A=g.updateQueue;if(A!==null){var C=g.stateNode;try{DH(A,C)}catch(D){Er(g,g.return,D)}}}function QQ(g,A,C){C.props=pp(g.type,g.memoizedProps),C.state=g.memoizedState;try{C.componentWillUnmount()}catch(D){Er(g,A,D)}}function Tx(g,A){try{var C=g.ref;if(C!==null){switch(g.tag){case 26:case 27:case 5:var D=g.stateNode;break;case 30:D=g.stateNode;break;default:D=g.stateNode}typeof C=="function"?g.refCleanup=C(D):C.current=D}}catch(V){Er(g,A,V)}}function Zc(g,A){var C=g.ref,D=g.refCleanup;if(C!==null)if(typeof D=="function")try{D()}catch(V){Er(g,A,V)}finally{g.refCleanup=null,g=g.alternate,g!=null&&(g.refCleanup=null)}else if(typeof C=="function")try{C(null)}catch(V){Er(g,A,V)}else C.current=null}function zQ(g){var A=g.type,C=g.memoizedProps,D=g.stateNode;try{e:switch(A){case"button":case"input":case"select":case"textarea":C.autoFocus&&D.focus();break e;case"img":C.src?D.src=C.src:C.srcSet&&(D.srcset=C.srcSet)}}catch(V){Er(g,g.return,V)}}function MT(g,A,C){try{var D=g.stateNode;jwe(D,g.type,C,A),D[Ht]=A}catch(V){Er(g,g.return,V)}}function ZQ(g){return g.tag===5||g.tag===3||g.tag===26||g.tag===27&&jh(g.type)||g.tag===4}function NT(g){e:for(;;){for(;g.sibling===null;){if(g.return===null||ZQ(g.return))return null;g=g.return}for(g.sibling.return=g.return,g=g.sibling;g.tag!==5&&g.tag!==6&&g.tag!==18;){if(g.tag===27&&jh(g.type)||g.flags&2||g.child===null||g.tag===4)continue e;g.child.return=g,g=g.child}if(!(g.flags&2))return g.stateNode}}function DT(g,A,C){var D=g.tag;if(D===5||D===6)g=g.stateNode,A?(C.nodeType===9?C.body:C.nodeName==="HTML"?C.ownerDocument.body:C).insertBefore(g,A):(A=C.nodeType===9?C.body:C.nodeName==="HTML"?C.ownerDocument.body:C,A.appendChild(g),C=C._reactRootContainer,C!=null||A.onclick!==null||(A.onclick=As));else if(D!==4&&(D===27&&jh(g.type)&&(C=g.stateNode,A=null),g=g.child,g!==null))for(DT(g,A,C),g=g.sibling;g!==null;)DT(g,A,C),g=g.sibling}function nO(g,A,C){var D=g.tag;if(D===5||D===6)g=g.stateNode,A?C.insertBefore(g,A):C.appendChild(g);else if(D!==4&&(D===27&&jh(g.type)&&(C=g.stateNode),g=g.child,g!==null))for(nO(g,A,C),g=g.sibling;g!==null;)nO(g,A,C),g=g.sibling}function GQ(g){var A=g.stateNode,C=g.memoizedProps;try{for(var D=g.type,V=A.attributes;V.length;)A.removeAttributeNode(V[0]);Bs(A,D,C),A[hn]=g,A[Ht]=C}catch(G){Er(g,g.return,G)}}var Wu=!1,ts=!1,IT=!1,UQ=typeof WeakSet=="function"?WeakSet:Set,Ss=null;function mwe(g,A){if(g=g.containerInfo,eP=wO,g=ux(g),hm(g)){if("selectionStart"in g)var C={start:g.selectionStart,end:g.selectionEnd};else e:{C=(C=g.ownerDocument)&&C.defaultView||window;var D=C.getSelection&&C.getSelection();if(D&&D.rangeCount!==0){C=D.anchorNode;var V=D.anchorOffset,G=D.focusNode;D=D.focusOffset;try{C.nodeType,G.nodeType}catch{C=null;break e}var ae=0,de=-1,Ee=-1,Le=0,Ge=0,Xe=g,Fe=null;t:for(;;){for(var He;Xe!==C||V!==0&&Xe.nodeType!==3||(de=ae+V),Xe!==G||D!==0&&Xe.nodeType!==3||(Ee=ae+D),Xe.nodeType===3&&(ae+=Xe.nodeValue.length),(He=Xe.firstChild)!==null;)Fe=Xe,Xe=He;for(;;){if(Xe===g)break t;if(Fe===C&&++Le===V&&(de=ae),Fe===G&&++Ge===D&&(Ee=ae),(He=Xe.nextSibling)!==null)break;Xe=Fe,Fe=Xe.parentNode}Xe=He}C=de===-1||Ee===-1?null:{start:de,end:Ee}}else C=null}C=C||{start:0,end:0}}else C=null;for(tP={focusedElem:g,selectionRange:C},wO=!1,Ss=A;Ss!==null;)if(A=Ss,g=A.child,(A.subtreeFlags&1028)!==0&&g!==null)g.return=A,Ss=g;else for(;Ss!==null;){switch(A=Ss,G=A.alternate,g=A.flags,A.tag){case 0:if((g&4)!==0&&(g=A.updateQueue,g=g!==null?g.events:null,g!==null))for(C=0;C title"))),Bs(G,D,C),G[hn]=g,Ct(G),D=G;break e;case"link":var ae=Jz("link","href",V).get(D+(C.href||""));if(ae){for(var de=0;de_r&&(ae=_r,_r=sn,sn=ae);var Ie=lx(de,sn),Ne=lx(de,_r);if(Ie&&Ne&&(He.rangeCount!==1||He.anchorNode!==Ie.node||He.anchorOffset!==Ie.offset||He.focusNode!==Ne.node||He.focusOffset!==Ne.offset)){var je=Xe.createRange();je.setStart(Ie.node,Ie.offset),He.removeAllRanges(),sn>_r?(He.addRange(je),He.extend(Ne.node,Ne.offset)):(je.setEnd(Ne.node,Ne.offset),He.addRange(je))}}}}for(Xe=[],He=de;He=He.parentNode;)He.nodeType===1&&Xe.push({element:He,left:He.scrollLeft,top:He.scrollTop});for(typeof de.focus=="function"&&de.focus(),de=0;deC?32:C,W.T=null,C=BT,BT=null;var G=Ih,ae=ef;if(ms=0,Dm=Ih=null,ef=0,(gr&6)!==0)throw Error(r(331));var de=gr;if(gr|=4,iz(G.current),tz(G,G.current,ae,C),gr=de,_x(0,!1),Je&&typeof Je.onPostCommitFiberRoot=="function")try{Je.onPostCommitFiberRoot(Jt,G)}catch{}return!0}finally{J.p=V,W.T=D,Sz(g,A)}}function Oz(g,A,C){A=ul(C,A),A=bT(g.stateNode,A,2),g=kh(g,A,2),g!==null&&(Nn(g,2),Gc(g))}function Er(g,A,C){if(g.tag===3)Oz(g,g,C);else for(;A!==null;){if(A.tag===3){Oz(A,g,C);break}else if(A.tag===1){var D=A.stateNode;if(typeof A.type.getDerivedStateFromError=="function"||typeof D.componentDidCatch=="function"&&(Dh===null||!Dh.has(D))){g=ul(C,g),C=CQ(2),D=kh(A,C,2),D!==null&&(kQ(C,D,A,g),Nn(D,2),Gc(D));break}}A=A.return}}function zT(g,A,C){var D=g.pingCache;if(D===null){D=g.pingCache=new xwe;var V=new Set;D.set(A,V)}else V=D.get(A),V===void 0&&(V=new Set,D.set(A,V));V.has(C)||(jT=!0,V.add(C),g=wwe.bind(null,g,A,C),A.then(g,g))}function wwe(g,A,C){var D=g.pingCache;D!==null&&D.delete(A),g.pingedLanes|=g.suspendedLanes&C,g.warmLanes&=~C,Qr===g&&(Un&C)===C&&(Ni===4||Ni===3&&(Un&62914560)===Un&&300>Ze()-sO?(gr&2)===0&&Im(g,0):LT|=C,Nm===Un&&(Nm=0)),Gc(g)}function Cz(g,A){A===0&&(A=ln()),g=ip(g,A),g!==null&&(Nn(g,A),Gc(g))}function Owe(g){var A=g.memoizedState,C=0;A!==null&&(C=A.retryLane),Cz(g,C)}function Cwe(g,A){var C=0;switch(g.tag){case 31:case 13:var D=g.stateNode,V=g.memoizedState;V!==null&&(C=V.retryLane);break;case 19:D=g.stateNode;break;case 22:D=g.stateNode._retryCache;break;default:throw Error(r(314))}D!==null&&D.delete(A),Cz(g,C)}function kwe(g,A){return Ce(g,A)}var hO=null,Rm=null,ZT=!1,dO=!1,GT=!1,Rh=0;function Gc(g){g!==Rm&&g.next===null&&(Rm===null?hO=Rm=g:Rm=Rm.next=g),dO=!0,ZT||(ZT=!0,Twe())}function _x(g,A){if(!GT&&dO){GT=!0;do for(var C=!1,D=hO;D!==null;){if(g!==0){var V=D.pendingLanes;if(V===0)var G=0;else{var ae=D.suspendedLanes,de=D.pingedLanes;G=(1<<31-At(42|g)+1)-1,G&=V&~(ae&~de),G=G&201326741?G&201326741|1:G?G|2:0}G!==0&&(C=!0,Pz(D,G))}else G=Un,G=ze(D,D===Qr?G:0,D.cancelPendingCommit!==null||D.timeoutHandle!==-1),(G&3)===0||st(D,G)||(C=!0,Pz(D,G));D=D.next}while(C);GT=!1}}function Ewe(){kz()}function kz(){dO=ZT=!1;var g=0;Rh!==0&&Fwe()&&(g=Rh);for(var A=Ze(),C=null,D=hO;D!==null;){var V=D.next,G=Ez(D,A);G===0?(D.next=null,C===null?hO=V:C.next=V,V===null&&(Rm=C)):(C=D,(g!==0||(G&3)!==0)&&(dO=!0)),D=V}ms!==0&&ms!==5||_x(g),Rh!==0&&(Rh=0)}function Ez(g,A){for(var C=g.suspendedLanes,D=g.pingedLanes,V=g.expirationTimes,G=g.pendingLanes&-62914561;0de)break;var Ge=Ee.transferSize,Xe=Ee.initiatorType;Ge&&Lz(Xe)&&(Ee=Ee.responseEnd,ae+=Ge*(Ee"u"?null:document;function Wz(g,A,C){var D=jm;if(D&&typeof A=="string"&&A){var V=bi(A);V='link[rel="'+g+'"][href="'+V+'"]',typeof C=="string"&&(V+='[crossorigin="'+C+'"]'),Xz.has(V)||(Xz.add(V),g={rel:g,crossOrigin:C,href:A},D.querySelector(V)===null&&(A=D.createElement("link"),Bs(A,"link",g),Ct(A),D.head.appendChild(A)))}}function Uwe(g){tf.D(g),Wz("dns-prefetch",g,null)}function Xwe(g,A){tf.C(g,A),Wz("preconnect",g,A)}function Wwe(g,A,C){tf.L(g,A,C);var D=jm;if(D&&g&&A){var V='link[rel="preload"][as="'+bi(A)+'"]';A==="image"&&C&&C.imageSrcSet?(V+='[imagesrcset="'+bi(C.imageSrcSet)+'"]',typeof C.imageSizes=="string"&&(V+='[imagesizes="'+bi(C.imageSizes)+'"]')):V+='[href="'+bi(g)+'"]';var G=V;switch(A){case"style":G=Lm(g);break;case"script":G=Fm(g)}gl.has(G)||(g=f({rel:"preload",href:A==="image"&&C&&C.imageSrcSet?void 0:g,as:A},C),gl.set(G,g),D.querySelector(V)!==null||A==="style"&&D.querySelector(Fx(G))||A==="script"&&D.querySelector($x(G))||(A=D.createElement("link"),Bs(A,"link",g),Ct(A),D.head.appendChild(A)))}}function qwe(g,A){tf.m(g,A);var C=jm;if(C&&g){var D=A&&typeof A.as=="string"?A.as:"script",V='link[rel="modulepreload"][as="'+bi(D)+'"][href="'+bi(g)+'"]',G=V;switch(D){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":G=Fm(g)}if(!gl.has(G)&&(g=f({rel:"modulepreload",href:g},A),gl.set(G,g),C.querySelector(V)===null)){switch(D){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(C.querySelector($x(G)))return}D=C.createElement("link"),Bs(D,"link",g),Ct(D),C.head.appendChild(D)}}}function Ywe(g,A,C){tf.S(g,A,C);var D=jm;if(D&&g){var V=Ut(D).hoistableStyles,G=Lm(g);A=A||"default";var ae=V.get(G);if(!ae){var de={loading:0,preload:null};if(ae=D.querySelector(Fx(G)))de.loading=5;else{g=f({rel:"stylesheet",href:g,"data-precedence":A},C),(C=gl.get(G))&&lP(g,C);var Ee=ae=D.createElement("link");Ct(Ee),Bs(Ee,"link",g),Ee._p=new Promise(function(Le,Ge){Ee.onload=Le,Ee.onerror=Ge}),Ee.addEventListener("load",function(){de.loading|=1}),Ee.addEventListener("error",function(){de.loading|=2}),de.loading|=4,xO(ae,A,D)}ae={type:"stylesheet",instance:ae,count:1,state:de},V.set(G,ae)}}}function Kwe(g,A){tf.X(g,A);var C=jm;if(C&&g){var D=Ut(C).hoistableScripts,V=Fm(g),G=D.get(V);G||(G=C.querySelector($x(V)),G||(g=f({src:g,async:!0},A),(A=gl.get(V))&&cP(g,A),G=C.createElement("script"),Ct(G),Bs(G,"link",g),C.head.appendChild(G)),G={type:"script",instance:G,count:1,state:null},D.set(V,G))}}function Jwe(g,A){tf.M(g,A);var C=jm;if(C&&g){var D=Ut(C).hoistableScripts,V=Fm(g),G=D.get(V);G||(G=C.querySelector($x(V)),G||(g=f({src:g,async:!0,type:"module"},A),(A=gl.get(V))&&cP(g,A),G=C.createElement("script"),Ct(G),Bs(G,"link",g),C.head.appendChild(G)),G={type:"script",instance:G,count:1,state:null},D.set(V,G))}}function qz(g,A,C,D){var V=(V=ee.current)?yO(V):null;if(!V)throw Error(r(446));switch(g){case"meta":case"title":return null;case"style":return typeof C.precedence=="string"&&typeof C.href=="string"?(A=Lm(C.href),C=Ut(V).hoistableStyles,D=C.get(A),D||(D={type:"style",instance:null,count:0,state:null},C.set(A,D)),D):{type:"void",instance:null,count:0,state:null};case"link":if(C.rel==="stylesheet"&&typeof C.href=="string"&&typeof C.precedence=="string"){g=Lm(C.href);var G=Ut(V).hoistableStyles,ae=G.get(g);if(ae||(V=V.ownerDocument||V,ae={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},G.set(g,ae),(G=V.querySelector(Fx(g)))&&!G._p&&(ae.instance=G,ae.state.loading=5),gl.has(g)||(C={rel:"preload",as:"style",href:C.href,crossOrigin:C.crossOrigin,integrity:C.integrity,media:C.media,hrefLang:C.hrefLang,referrerPolicy:C.referrerPolicy},gl.set(g,C),G||eOe(V,g,C,ae.state))),A&&D===null)throw Error(r(528,""));return ae}if(A&&D!==null)throw Error(r(529,""));return null;case"script":return A=C.async,C=C.src,typeof C=="string"&&A&&typeof A!="function"&&typeof A!="symbol"?(A=Fm(C),C=Ut(V).hoistableScripts,D=C.get(A),D||(D={type:"script",instance:null,count:0,state:null},C.set(A,D)),D):{type:"void",instance:null,count:0,state:null};default:throw Error(r(444,g))}}function Lm(g){return'href="'+bi(g)+'"'}function Fx(g){return'link[rel="stylesheet"]['+g+"]"}function Yz(g){return f({},g,{"data-precedence":g.precedence,precedence:null})}function eOe(g,A,C,D){g.querySelector('link[rel="preload"][as="style"]['+A+"]")?D.loading=1:(A=g.createElement("link"),D.preload=A,A.addEventListener("load",function(){return D.loading|=1}),A.addEventListener("error",function(){return D.loading|=2}),Bs(A,"link",C),Ct(A),g.head.appendChild(A))}function Fm(g){return'[src="'+bi(g)+'"]'}function $x(g){return"script[async]"+g}function Kz(g,A,C){if(A.count++,A.instance===null)switch(A.type){case"style":var D=g.querySelector('style[data-href~="'+bi(C.href)+'"]');if(D)return A.instance=D,Ct(D),D;var V=f({},C,{"data-href":C.href,"data-precedence":C.precedence,href:null,precedence:null});return D=(g.ownerDocument||g).createElement("style"),Ct(D),Bs(D,"style",V),xO(D,C.precedence,g),A.instance=D;case"stylesheet":V=Lm(C.href);var G=g.querySelector(Fx(V));if(G)return A.state.loading|=4,A.instance=G,Ct(G),G;D=Yz(C),(V=gl.get(V))&&lP(D,V),G=(g.ownerDocument||g).createElement("link"),Ct(G);var ae=G;return ae._p=new Promise(function(de,Ee){ae.onload=de,ae.onerror=Ee}),Bs(G,"link",D),A.state.loading|=4,xO(G,C.precedence,g),A.instance=G;case"script":return G=Fm(C.src),(V=g.querySelector($x(G)))?(A.instance=V,Ct(V),V):(D=C,(V=gl.get(G))&&(D=f({},C),cP(D,V)),g=g.ownerDocument||g,V=g.createElement("script"),Ct(V),Bs(V,"link",D),g.head.appendChild(V),A.instance=V);case"void":return null;default:throw Error(r(443,A.type))}else A.type==="stylesheet"&&(A.state.loading&4)===0&&(D=A.instance,A.state.loading|=4,xO(D,C.precedence,g));return A.instance}function xO(g,A,C){for(var D=C.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),V=D.length?D[D.length-1]:null,G=V,ae=0;ae title"):null)}function tOe(g,A,C){if(C===1||A.itemProp!=null)return!1;switch(g){case"meta":case"title":return!0;case"style":if(typeof A.precedence!="string"||typeof A.href!="string"||A.href==="")break;return!0;case"link":if(typeof A.rel!="string"||typeof A.href!="string"||A.href===""||A.onLoad||A.onError)break;switch(A.rel){case"stylesheet":return g=A.disabled,typeof A.precedence=="string"&&g==null;default:return!0}case"script":if(A.async&&typeof A.async!="function"&&typeof A.async!="symbol"&&!A.onLoad&&!A.onError&&A.src&&typeof A.src=="string")return!0}return!1}function tZ(g){return!(g.type==="stylesheet"&&(g.state.loading&3)===0)}function nOe(g,A,C,D){if(C.type==="stylesheet"&&(typeof D.media!="string"||matchMedia(D.media).matches!==!1)&&(C.state.loading&4)===0){if(C.instance===null){var V=Lm(D.href),G=A.querySelector(Fx(V));if(G){A=G._p,A!==null&&typeof A=="object"&&typeof A.then=="function"&&(g.count++,g=vO.bind(g),A.then(g,g)),C.state.loading|=4,C.instance=G,Ct(G);return}G=A.ownerDocument||A,D=Yz(D),(V=gl.get(V))&&lP(D,V),G=G.createElement("link"),Ct(G);var ae=G;ae._p=new Promise(function(de,Ee){ae.onload=de,ae.onerror=Ee}),Bs(G,"link",D),C.instance=G}g.stylesheets===null&&(g.stylesheets=new Map),g.stylesheets.set(C,A),(A=C.state.preload)&&(C.state.loading&3)===0&&(g.count++,C=vO.bind(g),A.addEventListener("load",C),A.addEventListener("error",C))}}var uP=0;function rOe(g,A){return g.stylesheets&&g.count===0&&SO(g,g.stylesheets),0uP?50:800)+A);return g.unsuspend=C,function(){g.unsuspend=null,clearTimeout(D),clearTimeout(V)}}:null}function vO(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)SO(this,this.stylesheets);else if(this.unsuspend){var g=this.unsuspend;this.unsuspend=null,g()}}}var AO=null;function SO(g,A){g.stylesheets=null,g.unsuspend!==null&&(g.count++,AO=new Map,A.forEach(iOe,g),AO=null,vO.call(g))}function iOe(g,A){if(!(A.state.loading&4)){var C=AO.get(g);if(C)var D=C.get(null);else{C=new Map,AO.set(g,C);for(var V=g.querySelectorAll("link[data-precedence],style[data-precedence]"),G=0;G"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(t)}catch(e){console.error(e)}}return t(),bP.exports=AOe(),bP.exports}var wOe=SOe();function Of(){return typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():`${Date.now()}-${Math.random().toString(36).slice(2)}`}function JA(){try{return typeof localStorage>"u"?null:localStorage}catch{return null}}function J7(){try{return typeof sessionStorage>"u"?null:sessionStorage}catch{return null}}const sie="hyperframes-studio:anonymousId",aie="hf-studio-anon-id";let yp=null;function OOe(){try{const t=typeof window>"u"?void 0:window.__HF_CLI_DISTINCT_ID;return typeof t=="string"&&t.length>0?t:null}catch{return null}}function wP(t,e){for(const n of[sie,aie])try{t.setItem(n,e)}catch{}}function ej(){if(yp)return yp;const t=JA(),e=OOe();if(e)return yp=e,t&&wP(t,e),e;if(t){let r=null;try{r=t.getItem(sie)??t.getItem(aie)}catch{}if(r)return yp=r,wP(t,r),r}else return yp=Of(),yp;const n=Of();return yp=n,wP(t,n),n}const COe="hyperframes-studio:telemetryDisabled",oie="hyperframes-studio:telemetryNoticeShown";function lie(){return ej()}function cie(t){var e;try{return((e=JA())==null?void 0:e.getItem(t))==="1"}catch{return!1}}function kOe(){return cie(COe)}function EOe(){return cie(oie)}function TOe(){var t;try{(t=JA())==null||t.setItem(oie,"1")}catch{}}const uie="hyperframes-studio:sessionStartFired";function POe(){var t;return((t=J7())==null?void 0:t.getItem(uie))==="1"}function MOe(){var t;try{(t=J7())==null||t.setItem(uie,"1")}catch{}}const NOe="phc_zjjbX0PnWxERXrMHhkEJWj9A9BhGVLRReICgsfTMmpx",DOe="hf-studio-telemetry-opt-out";function IOe(){try{return localStorage.getItem(DOe)==="1"}catch{return!1}}function _Oe(){return typeof navigator<"u"&&navigator.doNotTrack==="1"}function ROe(){return NOe.startsWith("phc_")}function jOe(){try{return!1}catch{return!1}}function LOe(){try{return!1}catch{return!1}}function eS(){try{return FOe()}catch{return!1}}function FOe(){return ROe()&&!jOe()&&!LOe()&&!kOe()&&!IOe()&&!_Oe()}let Bm;function $Oe(){if(Bm!==void 0)return Bm;if(typeof window>"u")return Bm=null,Bm;const t=window.__HF_CLI_AGENT_RUNTIME;return Bm=typeof t=="string"&&t.length>0?t:null,Bm}function fie(){return $Oe()??"none"}const BOe={user_agent:"",language:"",screen_width:0,screen_height:0,device_pixel_ratio:0,timezone_offset_minutes:0,is_mobile:!1,studio_version:"dev",agent_runtime:"none"};let Vm=null;function VOe(){if(Vm)return Vm;if(typeof navigator>"u"||typeof window>"u")return Vm=BOe,Vm;const t=navigator.userAgent,e=window.screen;return Vm={user_agent:t,language:navigator.language,screen_width:e.width,screen_height:e.height,device_pixel_ratio:window.devicePixelRatio,timezone_offset_minutes:new Date().getTimezoneOffset(),is_mobile:/Android|iPhone|iPad/i.test(t),studio_version:"0.8.22",agent_runtime:fie()},Vm}function HOe(t){let e=2166136261;for(let n=0;n>>0;return e>>>0}function QOe(t,e){return HOe(`${t}:${e}`)%100}function zOe(t){var i;if(t.override===!0)return{enabled:!0,reason:"forced_on"};if(t.override===!1)return{enabled:!1,reason:"forced_off"};const e=Math.max(0,Math.min(100,Math.trunc(t.percentage)));if(e<=0)return{enabled:!1,reason:"out_of_cohort"};if(e>=100)return{enabled:!0,reason:"in_cohort"};if(t.exclude)return{enabled:!1,reason:"excluded"};const n=(i=t.unitId)==null?void 0:i.trim();if(!n)return{enabled:!1,reason:"no_unit_id"};const r=QOe(t.feature,n);return re.name===t)}function qOe(t){return`hf_canary_${t.toLowerCase().replace(/[^a-z0-9]+/g,"_")}`}function YOe(t){var e;try{if(typeof window>"u")return;const n=(e=window.__HF_CLI_CANARY_DECISIONS)==null?void 0:e[t];return typeof(n==null?void 0:n.enabled)!="boolean"?void 0:{enabled:n.enabled,forced:n.forced===!0}}catch{return}}function KOe(){try{const t=typeof window>"u"?void 0:window.__HF_CLI_BUCKET_SEED;if(typeof t=="string"&&t.length>0)return t}catch{}return ej()}const JOe="hyperframes-studio:canary:";function e8e(t){if(typeof window>"u")return;const e=qOe(t),n=`${JOe}${t}`,r=J7();let i=null;try{i=new URLSearchParams(window.location.search).get(e)}catch{i=null}if(i!==null){if(i.trim().toLowerCase()==="reset"){r==null||r.removeItem(n);return}try{r==null||r.setItem(n,i)}catch{}return CZ(i)}return CZ((r==null?void 0:r.getItem(n))??void 0)}function kZ(){return typeof navigator>"u"?!1:navigator.webdriver===!0}const EZ=new Map,TZ=t=>({enabled:t,reason:t?"forced_on":"forced_off"}),t8e=t=>({enabled:t,reason:t?"in_cohort":"out_of_cohort"});function n8e(t){const e=WOe(t);if(!e)return{enabled:!1,reason:"out_of_cohort"};const n=YOe(e.name);if(n!=null&&n.forced)return TZ(n.enabled);const r=e8e(e.name);if(r===void 0){if(!eS())return{enabled:!1,reason:"telemetry_opt_out"};if(kZ())return{enabled:!1,reason:"excluded"};if(n!==void 0)return t8e(n.enabled)}return r!==void 0?TZ(r):zOe({feature:e.name,unitId:KOe(),percentage:e.percentage,exclude:kZ()})}function r8e(t){const e=EZ.get(t);if(e)return e;const n=n8e(t);return EZ.set(t,n),n}function die(){return XOe(hie.map(t=>{const{enabled:e,reason:n}=r8e(t.name);return{name:t.name,enabled:e,reason:n}}))}const i8e=14,s8e=["action","tab","panel","status","mode","reason","format","via"],y4=[],a8e=Date.now();function o8e(t){for(const e of s8e){const n=t[e];if(typeof n=="string"&&n.length>0&&n.length<=24)return`:${n}`;if(typeof n=="number"||typeof n=="boolean")return`:${String(n)}`}return""}function l8e(t,e){const n=t.replace(/^studio[:_]/,"");y4.push({at:Date.now()-a8e,label:`${n}${o8e(e)}`}),y4.length>i8e&&y4.shift()}function c8e(){return y4.map(t=>`${(t.at/1e3).toFixed(1)} ${t.label}`).join(" > ")}const u8e="phc_zjjbX0PnWxERXrMHhkEJWj9A9BhGVLRReICgsfTMmpx",f8e="https://us.i.posthog.com",h8e=1e3;let x4=[],OP=null;function d8e(){return eS()}function Ds(t,e={}){if(!d8e())return;l8e(t,e);const n=VOe();x4.push({event:t,properties:{...e,...n,...die()},timestamp:new Date().toISOString()}),OP===null&&(OP=setTimeout(()=>{OP=null,TI()},h8e)),m8e()}function TI(){if(x4.length===0)return;const t=lie(),e=x4.map(n=>({event:n.event,properties:{...n.properties,$ip:null},distinct_id:t,timestamp:n.timestamp}));x4=[],p8e(`${f8e}/batch/`,JSON.stringify({api_key:u8e,batch:e}))}function p8e(t,e){try{fetch(t,{method:"POST",headers:{"Content-Type":"application/json"},body:e,keepalive:!0}).catch(()=>{});return}catch{}try{navigator.sendBeacon(t,new Blob([e],{type:"application/json"}))}catch{}}function m8e(){EOe()||(TOe(),console.info("%c[HyperFrames]%c Anonymous studio usage analytics enabled. Disable: localStorage.setItem('hyperframes-studio:telemetryDisabled','1') (then reload).","color:#7c3aed;font-weight:bold","color:inherit"))}typeof window<"u"&&(window.addEventListener("pagehide",()=>TI(),{capture:!0}),window.addEventListener("visibilitychange",()=>{typeof document<"u"&&document.visibilityState==="hidden"&&TI()}));function g8e(t){Ds("studio_session_start",{has_project:t.has_project})}function y8e(t){Ds("studio_render_start",{fps:t.fps,quality:t.quality,format:t.format,resolution:t.resolution,composition:t.composition})}function x8e(t){Ds("studio_timeline_performance",t)}function b8e(){var t,e;try{const n=navigator,i=[`ua=${((t=n.userAgentData)==null?void 0:t.platform)??navigator.platform??"unknown"}`,`screen=${screen.width}x${screen.height}@${devicePixelRatio}x`,`lang=${navigator.language}`];return n.deviceMemory&&i.push(`mem=${n.deviceMemory}GB`),(e=n.connection)!=null&&e.effectiveType&&i.push(`net=${n.connection.effectiveType}`),navigator.hardwareConcurrency&&i.push(`cpu=${navigator.hardwareConcurrency}cores`),i.join(" ")}catch{return""}}function v8e(t){Ds("studio_razor_split",{mode:t.mode,count:t.count})}function Hm(t){Ds("studio_expanded_clip_edit",{action:t.action})}function PZ(t){Ds("studio_keyframe_lane_expand",{expanded:t.expanded})}function tj(t){Ds("studio_segment_ease_edit",{action:t.action,ease:t.ease})}function A8e(t){Ds("studio_feedback_shown",{reason:t.reason,render_id:t.render_id,source:"studio"})}function S8e(t){Ds("studio_feedback_dismissed",{reason:t.reason,render_id:t.render_id,via:t.via,had_rating:t.had_rating,source:"studio"})}function w8e(t){Ds("studio_feedback_interview_click",{reason:t.reason,source:"studio"})}function O8e(t){Ds("studio_feedback",{...t.rating===void 0?{}:{rating:t.rating,rating_scale:10},...t.comment?{comment:t.comment}:{},...t.context,reason:t.reason,render_id:t.render_id,question:t.question,answer_kind:t.answer_kind,doctor_summary:b8e(),breadcrumbs:c8e(),source:"studio"})}function MO(t){Ds("studio_block_param_commit",{tone:t.tone,block_name:t.blockName,param_key:t.key})}async function C8e(t){try{const e=await t.json();if(typeof e=="object"&&e!==null){const{error:n,hint:r}=e;if(typeof n=="string"&&n)return typeof r=="string"&&r?`${n}. ${r}`:n}}catch{}return`Server error (${t.status}). Check the terminal for details.`}function k8e(t){const e=(t==null?void 0:t.title)??"FFmpeg not found",n=(t==null?void 0:t.command)??(t==null?void 0:t.hint);return n?`${e}. Install it with: ${n}`:`${e}. Install FFmpeg to export.`}let Gx=null;const NO=t=>typeof t=="string"&&t?t:void 0;function E8e(t){if(typeof t!="object"||t===null)return null;const{ok:e,title:n,detail:r,hint:i,command:s}=t;return typeof e!="boolean"?null:{ok:e,title:NO(n),detail:NO(r),hint:NO(i),command:NO(s)}}async function T8e(){try{const t=await fetch("/api/environment/ffmpeg");return t.ok?E8e(await t.json()):null}catch{return null}}function P8e(){const[t,e]=x.useState(Gx),[n,r]=x.useState(Gx===null),i=x.useRef(!0);x.useEffect(()=>(i.current=!0,()=>{i.current=!1}),[]);const s=x.useCallback(async()=>{r(!0);const o=await T8e();Gx=o,i.current&&(e(o),r(!1))},[]);x.useEffect(()=>{Gx===null&&s()},[s]);const a=x.useCallback(()=>{Gx=null,s()},[s]);return{status:t,checking:n,recheck:a}}function MZ(t){return t!=="render_complete"}const NZ=[{id:"remove",prompt:"What would you cut from Studio?",placeholder:"The part you never use",presets:[{label:"Layers panel",hint:"The layer tree on the right"},{label:"Variables panel",hint:"Composition variables on the right"},{label:"Blocks browser",hint:"The block library in the sidebar"},{label:"Storyboard mode",hint:"The storyboard view next to Preview"},{label:"Caption editing",hint:"Editing caption words and presets in Studio"},{label:"Render history",hint:"The list of past exports"},{label:"Nothing",hint:"It all earns its place"}]},{id:"workaround",prompt:"What did you have to do outside Studio?",placeholder:"The step you finished somewhere else",presets:[{label:"Fix the exported file",hint:"Remuxing or re-encoding the output by hand"},{label:"Convert source media",hint:"Re-encoding footage before it would import cleanly"},{label:"Match loudness",hint:"Normalising levels across the finished audio"},{label:"Make images or graphics",hint:"Creating visual assets in another tool"},{label:"Record footage",hint:"Capturing screen or camera video"},{label:"Nothing, it was all here",hint:"No outside tools needed"}]},{id:"fix",prompt:"What should we fix first?",placeholder:"The thing that slowed you down",presets:[{label:"Audio mixing",hint:"Levels, ducking or the balance in the exported mix"},{label:"Export encoding",hint:"The render fails, or the finished file is wrong"},{label:"Export matches preview",hint:"The exported video differs from the preview"},{label:"Media and fonts",hint:"Adding video, images or fonts to a project"},{label:"Render speed",hint:"Exports take too long to finish"},{label:"Re-rendering everything",hint:"A small change means rendering the whole thing"},{label:"Checks and warnings",hint:"Lint flags things that are fine, or misses real ones"}]}],M8e={id:"detractor",prompt:"What went wrong?",placeholder:"The thing that made that a low score",presets:[{label:"Export failed",hint:"The render did not finish"},{label:"Output looked wrong",hint:"It rendered, but not the way I built it"},{label:"Crashed or froze",hint:"The editor stopped responding"},{label:"Lost my edits",hint:"Changes did not save, or came back changed"},{label:"Too slow",hint:"Waiting on renders, or the editor itself lagging"},{label:"Could not figure it out",hint:"Could not find or understand something"}]},N8e=6;function D8e(t){return t<=N8e?M8e:NZ[Math.floor(Math.random()*NZ.length)]}const p6={dismissedAt:"hyperframes-studio:feedbackDismissedAt",answeredAt:"hyperframes-studio:feedbackAnsweredAt"},pie="hyperframes-studio:feedbackAskedThisSession",mie=864e5,I8e=30*mie,_8e=7*mie;let F2=null;function R8e(){try{return!1}catch{return!1}}function DZ(t){try{return parseInt(window.localStorage.getItem(t)||"0",10)||0}catch{return 0}}function gie(t,e){try{window.localStorage.setItem(t,String(e))}catch{}}function j8e(){try{return window.sessionStorage.getItem(pie)==="1"}catch{return!0}}function L8e(){try{window.sessionStorage.setItem(pie,"1")}catch{}}function F8e(t){return!(R8e()||!eS()||j8e()||t-DZ(p6.answeredAt){F2===t&&(F2=null)}}function B8e(){gie(p6.answeredAt,Date.now())}function V8e(){gie(p6.dismissedAt,Date.now())}function xie(t){return`hf-studio-hidden-renders:${t}`}function IZ(t){try{const e=window.localStorage.getItem(xie(t)),n=e?JSON.parse(e):[];return new Set(Array.isArray(n)?n.filter(r=>typeof r=="string"):[])}catch{return new Set}}function H8e(t,e){try{window.localStorage.setItem(xie(t),JSON.stringify([...e].slice(-200)))}catch{}}function Q8e(t,e){const[n,r]=x.useState([]),[i,s]=x.useState(null),[a,o]=x.useState(null),{status:l,checking:c,recheck:u}=P8e(),f=l!==null&&!l.ok,h=x.useRef(null),p=x.useRef(null),y=x.useRef(new Map),m=x.useRef(new Set),v=x.useCallback((I,j)=>{y.current.set(I.id,j),r(L=>[...L,I])},[]),b=x.useCallback(I=>{var j;I&&p.current!==I||((j=h.current)==null||j.close(),h.current=null,p.current=null)},[]),w=x.useCallback(async()=>{if(t)try{const I=await fetch(`/api/projects/${t}/renders`);if(!I.ok){s(`Couldn't load render history (server error ${I.status}).`);return}const j=await I.json();if(s(null),Array.isArray(j.renders)){const L=IZ(t);r(B=>{const $=new Set(B.map(Y=>Y.id)),z=j.renders.filter(Y=>!$.has(Y.id)&&!L.has(Y.id)).map(Y=>({id:Y.id,status:Y.status==="failed"?"failed":"complete",progress:100,filename:Y.filename,createdAt:Y.createdAt,durationMs:Y.durationMs}));return[...B,...z]})}}catch{s("Couldn't load render history. Is the studio server running?")}},[t]);x.useEffect(()=>{w()},[w]);const O=x.useCallback(async(I={})=>{if(!t)return;if(f){v({id:Of(),status:"failed",progress:0,error:k8e(l),filename:"Export blocked",createdAt:Date.now()},{});return}const j=I.fps??30,L=I.quality??"standard",B=I.format??"mp4",$=I.resolution,z=I.composition??e.current??void 0;y8e({fps:j,quality:L,format:B,resolution:$,composition:z});const Y=Date.now(),W={render_format:B,render_quality:L,render_fps:j,render_resolution:$??"auto",render_composition:z??"index.html",render_has_variables:!!(I.variables&&Object.keys(I.variables).length>0)},J={fps:j,quality:L,format:B};eS()?J.telemetryDistinctId=lie():J.telemetryOptOut=!0,$&&$!=="auto"&&(J.resolution=$),z&&(J.composition=z),I.variables&&Object.keys(I.variables).length>0&&(J.variables=I.variables);let ne;try{ne=await fetch(`/api/projects/${t}/render`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(J)})}catch(Z){const K=Z instanceof Error?Z.message:String(Z),ee={id:Of(),status:"failed",progress:0,error:`Could not reach render server: ${K}. Use \`hyperframes render\` from the CLI instead.`,filename:"Export failed",createdAt:Y};v(ee,W);return}if(!ne.ok){const Z={id:Of(),status:"failed",progress:0,error:await C8e(ne),filename:"Export failed",createdAt:Y};v(Z,W);return}const{jobId:le}=await ne.json(),q={mp4:".mp4",webm:".webm",mov:".mov"}[B]??".mp4",F={id:le,status:"rendering",progress:0,filename:`${le}${q}`,createdAt:Y};v(F,W),p.current=le;const U=new EventSource(`/api/render/${le}/progress`);return h.current=U,U.addEventListener("progress",Z=>{try{const K=JSON.parse(Z.data),ee=K.status==="complete"||K.status==="failed"||K.status==="cancelled";r(re=>re.map(Q=>Q.id===le?{...Q,progress:K.progress??Q.progress,stage:K.stage??K.message??Q.stage,status:ee?K.status:Q.status,durationMs:K.status==="complete"?Date.now()-Y:void 0,error:K.error??Q.error}:Q)),ee&&b(le)}catch{}}),U.onerror=()=>{U.close(),r(Z=>Z.map(K=>K.id===le&&K.status==="rendering"?{...K,status:"failed",error:"Connection lost. Is the render server running?"}:K)),p.current=null},le},[t,e,b,v,l,f]),k=x.useCallback(async I=>{o(null),b(I),r(j=>j.map(L=>L.id===I&&L.status==="rendering"?{...L,status:"cancelled"}:L));try{const j=await fetch(`/api/render/${I}/cancel`,{method:"POST"});if(!j.ok&&j.status!==404){o("Couldn't cancel on the server — the render may still be running.");return}if(j.ok){const L=await j.json().catch(()=>null);L!=null&&L.status&&L.status!=="cancelled"&&w()}}catch{o("Couldn't reach the server to cancel — the render may still be running.")}},[b,w]),E=x.useCallback(async I=>{o(null),b(I);try{if(!(await fetch(`/api/render/${I}`,{method:"DELETE"})).ok){o("Couldn't delete the render — it's still on disk.");return}}catch{o("Couldn't reach the server to delete the render.");return}r(j=>j.filter(L=>L.id!==I))},[b]),T=x.useCallback(()=>{r(I=>{const j=I.filter(L=>L.status!=="rendering");if(t&&j.length>0){const L=IZ(t);for(const B of j)L.add(B.id);H8e(t,L)}return I.filter(L=>L.status==="rendering")})},[t]),N=x.useCallback(()=>o(null),[]);x.useEffect(()=>{for(const I of n){if(I.status==="rendering"||I.status==="cancelled")continue;const j=y.current.get(I.id);!j||m.current.has(I.id)||(m.current.add(I.id),yie({reason:I.status==="complete"?"render_complete":"render_failed",renderId:I.id,detail:I.error,context:{...j,render_progress:I.progress,render_duration_ms:I.durationMs??Date.now()-I.createdAt,render_stage:I.stage,render_error:I.error,renders_this_session:y.current.size}}))}},[n]),x.useEffect(()=>()=>{var I;(I=h.current)==null||I.close(),h.current=null},[t]);const _=n.some(I=>I.status==="rendering");return x.useMemo(()=>({jobs:n,isRendering:_,loadError:i,actionError:a,dismissActionError:N,reloadRenders:w,deleteRender:E,cancelRender:k,clearCompleted:T,startRender:O,ffmpeg:l,ffmpegMissing:f,ffmpegChecking:c,recheckFfmpeg:u}),[n,_,i,a,N,w,E,k,T,O,l,f,c,u])}const z8e="modulepreload",Z8e=function(t){return"/"+t},_Z={},hy=function(e,n,r){let i=Promise.resolve();if(n&&n.length>0){let a=function(c){return Promise.all(c.map(u=>Promise.resolve(u).then(f=>({status:"fulfilled",value:f}),f=>({status:"rejected",reason:f}))))};document.getElementsByTagName("link");const o=document.querySelector("meta[property=csp-nonce]"),l=(o==null?void 0:o.nonce)||(o==null?void 0:o.getAttribute("nonce"));i=a(n.map(c=>{if(c=Z8e(c),c in _Z)return;_Z[c]=!0;const u=c.endsWith(".css"),f=u?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${c}"]${f}`))return;const h=document.createElement("link");if(h.rel=u?"stylesheet":z8e,u||(h.as="script"),h.crossOrigin="",h.href=c,l&&h.setAttribute("nonce",l),document.head.appendChild(h),u)return new Promise((p,y)=>{h.addEventListener("load",p),h.addEventListener("error",()=>y(new Error(`Unable to preload CSS for ${c}`)))})}))}function s(a){const o=new Event("vite:preloadError",{cancelable:!0});if(o.payload=a,window.dispatchEvent(o),!o.defaultPrevented)throw a}return i.then(a=>{for(const o of a||[])o.status==="rejected"&&s(o.reason);return e().catch(s)})};function G8e(t){if(typeof t!="object"||t===null)return!0;const e=t;return e.isLoaded===!0||typeof e.totalFrames=="number"&&e.totalFrames>0}function Or(t){x.useEffect(t,[])}const RZ=t=>{let e;const n=new Set,r=(c,u)=>{const f=typeof c=="function"?c(e):c;if(!Object.is(f,e)){const h=e;e=u??(typeof f!="object"||f===null)?f:Object.assign({},e,f),n.forEach(p=>p(e,h))}},i=()=>e,o={setState:r,getState:i,getInitialState:()=>l,subscribe:c=>(n.add(c),()=>n.delete(c))},l=e=t(r,i,o);return o},U8e=(t=>t?RZ(t):RZ),X8e=t=>t;function W8e(t,e=X8e){const n=Lb.useSyncExternalStore(t.subscribe,Lb.useCallback(()=>e(t.getState()),[t,e]),Lb.useCallback(()=>e(t.getInitialState()),[t,e]));return Lb.useDebugValue(n),n}const jZ=t=>{const e=U8e(t),n=r=>W8e(e,r);return Object.assign(n,e),n},lE=(t=>t?jZ(t):jZ),_v=lE(t=>({values:null,setValues:e=>t({values:e&&Object.keys(e).length>0?e:null})}));function bie(t){const e=_v.getState().values;e?t.searchParams.set("variables",JSON.stringify(e)):t.searchParams.delete("variables")}const vie={primary:["bg-white text-neutral-950 font-medium","shadow-btn-primary","enabled:hover:bg-neutral-200","enabled:active:scale-[0.97]"].join(" "),secondary:["bg-transparent text-neutral-300 font-medium","border border-border","enabled:hover:bg-surface-hover enabled:hover:text-white enabled:hover:border-border-strong","enabled:active:scale-[0.98]"].join(" "),danger:["bg-accent-red text-white font-medium","enabled:hover:bg-red-600","enabled:active:scale-[0.97]"].join(" "),ghost:["bg-transparent text-neutral-400","enabled:hover:bg-surface-hover enabled:hover:text-white","enabled:active:scale-[0.98]"].join(" ")},q8e={sm:"h-7 px-2.5 text-xs gap-1.5 rounded-button",md:"h-8 px-3 text-sm gap-1.5 rounded-button",lg:"h-9 px-4 text-base gap-2 rounded-button"},zo=x.forwardRef(({variant:t="secondary",size:e="md",loading:n,icon:r,children:i,className:s="",disabled:a,...o},l)=>d.jsxs("button",{ref:l,disabled:a||n,className:["inline-flex items-center justify-center","transition-all duration-press ease-standard","disabled:opacity-40 disabled:cursor-not-allowed","select-none cursor-pointer","outline-none focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-studio-accent",vie[t],q8e[e],s].join(" "),...o,children:[n?d.jsxs("svg",{className:"animate-spin h-3.5 w-3.5",viewBox:"0 0 24 24",fill:"none",children:[d.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),d.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}):r?d.jsx("span",{className:"flex-shrink-0",children:r}):null,i&&d.jsx("span",{children:i})]}));zo.displayName="Button";const Y8e={sm:"min-w-7 min-h-7 rounded-button",md:"min-w-8 min-h-8 rounded-button",lg:"min-w-9 min-h-9 rounded-button"},K8e=x.forwardRef(({icon:t,size:e="md",variant:n="ghost",className:r="",...i},s)=>d.jsx("button",{ref:s,className:["inline-flex items-center justify-center","transition-all duration-press ease-standard","disabled:opacity-40 disabled:cursor-not-allowed","select-none cursor-pointer","outline-none focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-studio-accent",vie[n],Y8e[e],r].join(" "),...i,children:t}));K8e.displayName="IconButton";function LZ({title:t,detail:e,mono:n,size:r=64,progress:i}){const s=typeof i=="number"&&Number.isFinite(i)?Math.min(1,Math.max(0,i)):void 0,a=Math.round(r*1.16);return d.jsxs("div",{className:"hf-loader",role:"status",draggable:!1,children:[d.jsx("div",{className:"hf-loader-mark-frame",style:{width:a,height:a},draggable:!1,children:d.jsxs("svg",{className:"hf-loader-mark",width:r,height:r,viewBox:"0 0 100 100",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",children:[d.jsx("g",{className:"hf-loader-mark__mark",transform:"translate(50 50)",children:d.jsx("g",{className:"hf-loader-mark__core",transform:"scale(1)",opacity:".92",children:d.jsxs("g",{transform:"translate(-50 -50)",children:[d.jsx("path",{d:"M10.1851 57.8021L33.1145 73.8313C36.2202 75.9978 41.5173 73.5433 42.4816 69.4984L51.7611 30.4271C52.7253 26.3822 48.5802 23.9277 44.4602 26.0942L13.917 42.1235C6.96677 45.7676 4.97564 54.1579 10.1851 57.8021Z",fill:"url(#hf-loader-grad-left)"}),d.jsx("path",{d:"M87.5129 57.5141L56.9696 73.5433C52.8371 75.7098 48.7046 73.2553 49.6688 69.2104L58.9483 30.1391C59.9125 26.0942 65.2097 23.6397 68.3154 25.8062L91.2447 41.8354C96.4668 45.4796 94.4631 53.8699 87.5129 57.5141Z",fill:"url(#hf-loader-grad-right)"})]})})}),d.jsxs("defs",{children:[d.jsxs("linearGradient",{id:"hf-loader-grad-left",x1:"48.5676",y1:"25",x2:"44.7804",y2:"71.9384",gradientUnits:"userSpaceOnUse",children:[d.jsx("stop",{stopColor:"#06E3FA"}),d.jsx("stop",{offset:"1",stopColor:"#4FDB5E"})]}),d.jsxs("linearGradient",{id:"hf-loader-grad-right",x1:"54.8282",y1:"73.8392",x2:"72.0989",y2:"32.8932",gradientUnits:"userSpaceOnUse",children:[d.jsx("stop",{stopColor:"#06E3FA"}),d.jsx("stop",{offset:"1",stopColor:"#4FDB5E"})]})]})]})}),d.jsx("div",{className:"hf-loader-title",children:t}),e&&d.jsx("div",{className:"hf-loader-detail",children:e}),s!==void 0&&d.jsx("div",{className:"hf-loader-progress",role:"progressbar","aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":Math.round(s*100),children:d.jsx("div",{className:"hf-loader-progress__fill",style:{transform:`scaleX(${s})`}})}),n&&d.jsx("div",{className:"hf-loader-mono",children:n})]})}var Bl=iie();function b4(t,e,n){return Math.max(e,Math.min(n,t))}function J8e(t,e,n,r){const i=e/2,s=i+r;return b4(t,s,Math.max(s,n-i-r))}function nj(t,e,n,r){const i=(r==null?void 0:r.offset)??8,s=(r==null?void 0:r.margin)??12,a=Math.max(s,e.width-n.width-s),o=t.left+t.width/2-n.width/2,l=b4(o,s,a),c=t.bottom+i,u=t.top-n.height-i,f=c+n.height<=e.height-s,h=u>=s;return f||!h?{left:l,top:b4(c,s,Math.max(s,e.height-n.height-s)),placement:"bottom"}:{left:l,top:b4(u,s,Math.max(s,e.height-n.height-s)),placement:"top"}}const FZ=28,CP=8;function vr({label:t,children:e,delay:n=400,side:r="top"}){const[i,s]=x.useState(!1),[a,o]=x.useState({x:0,y:0}),[l,c]=x.useState(r),u=x.useRef(null),f=x.useRef(null),h=x.useRef(null),[p,y]=x.useState(0),m=x.useId(),v=x.useCallback(()=>{u.current&&clearTimeout(u.current),u.current=setTimeout(()=>{const O=f.current;if(!O)return;const E=(O.firstElementChild??O).getBoundingClientRect();if(E.width===0&&E.height===0)return;let T=r;r==="top"&&E.top-FZ-6window.innerHeight-CP&&(T="top"),c(T),o({x:E.left+E.width/2,y:T==="top"?E.top-6:E.bottom+6}),s(!0)},n)},[n,r]),b=x.useCallback(()=>{u.current&&(clearTimeout(u.current),u.current=null),s(!1)},[]);x.useLayoutEffect(()=>{var O;y(i?((O=h.current)==null?void 0:O.offsetWidth)??0:0)},[i,t]),x.useEffect(()=>{if(!i)return;const O=k=>{k.key==="Escape"&&b()};return document.addEventListener("keydown",O),()=>document.removeEventListener("keydown",O)},[i,b]);const w=J8e(a.x,p,window.innerWidth,CP);return d.jsxs(d.Fragment,{children:[d.jsx("span",{ref:f,onPointerEnter:v,onPointerLeave:b,onFocus:v,onBlur:b,"aria-describedby":i?m:void 0,className:"contents",children:e}),i&&Bl.createPortal(d.jsx("div",{className:"fixed z-[200] pointer-events-none",style:{left:w,top:a.y,transform:l==="top"?"translate(-50%, -100%)":"translate(-50%, 0)"},children:d.jsx("div",{ref:h,role:"tooltip",id:m,className:"px-2 py-1 rounded-md bg-neutral-800 border border-neutral-700/50 text-[10px] font-medium text-neutral-200 whitespace-nowrap shadow-lg",children:t})}),document.body)]})}const e4e=3,t4e=3;function PI(t){return typeof t=="object"&&t!==null}function n4e(t){if(!(t instanceof CustomEvent))return null;const e=t.detail;if(!PI(e))return null;const n=e.state;return PI(n)?n.loading===!0&&n.ready!==!0:null}const r4e=400,$Z="The composition preview did not become ready.";function i4e(t){return!(t instanceof CustomEvent)||!PI(t.detail)?$Z:typeof t.detail.message=="string"&&t.detail.message.trim()?t.detail.message:$Z}function s4e(t){const e=t.shadowRoot;if(!e)return;const n=e.querySelector(".hfp-container"),r=e.querySelector(".hfp-iframe");n==null||n.style.setProperty("pointer-events","auto"),r==null||r.style.setProperty("pointer-events","auto")}function a4e(t){const e=t.tagName.toLowerCase();return e==="video"||e==="audio"}function BZ(t,e){try{const n=t.contentWindow,r=t.contentDocument;if(!n||!r)return e;for(const s of r.querySelectorAll("video, audio"))if(a4e(s)&&!s.error&&s.networkState!==t4e&&s.readyState{const l=x.useRef(null),c=x.useRef(0),u=x.useRef(null),f=x.useRef(null),h=x.useRef(null),p=x.useRef(0),[y,m]=x.useState(!1),[v,b]=x.useState(!1),[w,O]=x.useState(!1),[k,E]=x.useState(!1),[T,N]=x.useState(!1),[_,I]=x.useState(!0),[j,L]=x.useState(!0),[B,$]=x.useState(null);x.useEffect(()=>{if(!_){L(!0);return}const J=setTimeout(()=>L(!1),r4e);return()=>clearTimeout(J)},[_]),Or(()=>{const J=l.current;if(!J)return;let ne=!1,le;return hy(()=>import("./hyperframes-player-DmtkkaPN.js"),[]).then(()=>{if(ne)return;const ie=document.createElement("hyperframes-player"),q=new URL(e||`/api/projects/${t}/preview`,window.location.origin);bie(q);const F=q.pathname+q.search,U=()=>{p.current+=1;const se=new URL(F,window.location.origin);se.searchParams.set("_hfStudioRetry",String(p.current)),$(null),I(!0),ie.setAttribute("src",se.pathname+se.search)};h.current=U;const Z=ie.iframeElement,K=se=>se.stopImmediatePropagation(),ee=se=>{const fe=n4e(se);fe!==null&&N(fe)},re=()=>{$(null),I(!1)},Q=se=>{$(i4e(se)),I(!1)},H=()=>{if(c.current++,$(null),N(!1),I(!0),c.current>1){J.classList.remove("preview-revealing"),J.offsetWidth,J.classList.add("preview-revealing");const be=()=>J.classList.remove("preview-revealing");J.addEventListener("animationend",be,{once:!0})}n(),u.current&&clearInterval(u.current);let fe=c.current>1?!1:BZ(Z,!1);if(fe){m(!0);let be=0;u.current=setInterval(()=>{be+=1,fe=BZ(Z,fe),(!fe||be>100)&&(fe&&be>100&&console.debug("[studio] asset readiness poll hit the 10s cap — continuing with unloaded assets"),u.current&&clearInterval(u.current),u.current=null,m(!1))},100)}else m(!1)};if(Z.addEventListener("load",H),ie.addEventListener("click",K,{capture:!0}),ie.addEventListener("shadertransitionstate",ee),ie.addEventListener("ready",re),ie.addEventListener("error",Q),typeof o=="function"?o(Z):o&&(o.current=Z),ie.setAttribute("shader-capture-scale","1"),ie.setAttribute("shader-loading","player"),ie.setAttribute("width",String(i?1080:1920)),ie.setAttribute("height",String(i?1920:1080)),ie.style.width="100%",ie.style.height="100%",ie.style.display="block",ie.style.background="transparent",ie.setAttribute("src",F),J.appendChild(ie),ie.shadowRoot){const se=document.createElement("style");se.textContent=".hfp-container{overflow:visible}.hfp-iframe{box-shadow:0 0 0 1px rgba(255,255,255,0.08),0 4px 32px rgba(0,0,0,.7)}",ie.shadowRoot.appendChild(se)}s4e(ie),le=()=>{if(Z.removeEventListener("load",H),ie.removeEventListener("click",K,{capture:!0}),ie.removeEventListener("shadertransitionstate",ee),ie.removeEventListener("ready",re),ie.removeEventListener("error",Q),u.current&&clearInterval(u.current),u.current=null,ie.remove(),h.current===U&&(h.current=null),typeof o!="function"){if(o){const se=o;se.current===Z&&(se.current=null)}}}}),()=>{ne=!0,le==null||le()}}),x.useEffect(()=>{if(!y){E(!1);return}const J=setTimeout(()=>E(!0),3e3);return()=>clearTimeout(J)},[y]),x.useEffect(()=>{if(f.current&&(clearTimeout(f.current),f.current=null),y){b(!0),O(!1);return}return O(!0),f.current=setTimeout(()=>{b(!1),O(!1),f.current=null},240),()=>{f.current&&(clearTimeout(f.current),f.current=null)}},[y]);const z=()=>{u.current&&(clearInterval(u.current),u.current=null),m(!1)},Y=!a&&!j&&_,W=v&&!T&&!Y&&!B;return x.useEffect(()=>{r==null||r(Y||W)},[r,Y,W]),d.jsxs("div",{className:"relative w-full h-full max-w-full max-h-full overflow-hidden flex items-center justify-center",style:s,children:[d.jsx("div",{ref:l,className:"w-full h-full"}),Y&&d.jsx("div",{className:"absolute inset-0 bg-black flex items-center justify-center z-30 select-none","data-hyperframes-ignore":"","data-testid":"composition-loading-overlay",draggable:!1,onDragStart:J=>J.preventDefault(),onMouseDown:J=>J.preventDefault(),onPointerDown:J=>J.preventDefault(),children:d.jsx(LZ,{title:"Loading composition",detail:"Preparing the Studio preview.",size:56})}),W&&d.jsx("div",{className:"absolute inset-0 bg-black flex items-center justify-center z-20 select-none","data-hyperframes-ignore":"",draggable:!1,style:{opacity:w?0:1,pointerEvents:w?"none":"auto",transition:"opacity 180ms ease-in"},onDragStart:J=>J.preventDefault(),onMouseDown:J=>J.preventDefault(),children:d.jsxs("div",{className:"flex flex-col items-center gap-3",children:[d.jsx(LZ,{title:"Preparing preview assets",detail:"Waiting for media and motion assets before playback starts.",size:56}),k&&d.jsx("button",{type:"button",onClick:z,className:"px-3 py-1.5 text-[11px] rounded-md border border-neutral-700 text-neutral-300 hover:border-neutral-500 hover:bg-neutral-800 transition-colors",children:"Continue anyway"})]})}),B&&d.jsx("div",{className:"absolute inset-0 z-40 flex items-center justify-center bg-black/90 px-6 text-center","data-hyperframes-ignore":"","data-testid":"composition-preview-error",children:d.jsxs("div",{className:"max-w-sm",children:[d.jsx("p",{className:"text-sm font-semibold text-white",children:"Preview failed to load"}),d.jsx("p",{className:"mt-1 text-xs text-neutral-400",children:B}),d.jsx("button",{type:"button",className:"mt-4 rounded-md bg-white px-3 py-1.5 text-xs font-semibold text-black transition-colors hover:bg-neutral-200",onClick:()=>{var J;return(J=h.current)==null?void 0:J.call(h)},children:"Retry preview"})]})})]})});MI.displayName="Player";function af(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function Aie(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,t.__proto__=e}/*! +`).replace(Rwe,"")}function jz(g,A){return A=Rz(A),Rz(g)===A}function Ir(g,A,C,D,V,G){switch(C){case"children":typeof D=="string"?A==="body"||A==="textarea"&&D===""||en(g,D):(typeof D=="number"||typeof D=="bigint")&&A!=="body"&&en(g,""+D);break;case"className":cn(g,"class",D);break;case"tabIndex":cn(g,"tabindex",D);break;case"dir":case"role":case"viewBox":case"width":case"height":cn(g,C,D);break;case"style":lr(g,D,G);break;case"data":if(A!=="object"){cn(g,"data",D);break}case"src":case"href":if(D===""&&(A!=="a"||C!=="href")){g.removeAttribute(C);break}if(D==null||typeof D=="function"||typeof D=="symbol"||typeof D=="boolean"){g.removeAttribute(C);break}D=Vr(""+D),g.setAttribute(C,D);break;case"action":case"formAction":if(typeof D=="function"){g.setAttribute(C,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof G=="function"&&(C==="formAction"?(A!=="input"&&Ir(g,A,"name",V.name,V,null),Ir(g,A,"formEncType",V.formEncType,V,null),Ir(g,A,"formMethod",V.formMethod,V,null),Ir(g,A,"formTarget",V.formTarget,V,null)):(Ir(g,A,"encType",V.encType,V,null),Ir(g,A,"method",V.method,V,null),Ir(g,A,"target",V.target,V,null)));if(D==null||typeof D=="symbol"||typeof D=="boolean"){g.removeAttribute(C);break}D=Vr(""+D),g.setAttribute(C,D);break;case"onClick":D!=null&&(g.onclick=As);break;case"onScroll":D!=null&&Qn("scroll",g);break;case"onScrollEnd":D!=null&&Qn("scrollend",g);break;case"dangerouslySetInnerHTML":if(D!=null){if(typeof D!="object"||!("__html"in D))throw Error(r(61));if(C=D.__html,C!=null){if(V.children!=null)throw Error(r(60));g.innerHTML=C}}break;case"multiple":g.multiple=D&&typeof D!="function"&&typeof D!="symbol";break;case"muted":g.muted=D&&typeof D!="function"&&typeof D!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(D==null||typeof D=="function"||typeof D=="boolean"||typeof D=="symbol"){g.removeAttribute("xlink:href");break}C=Vr(""+D),g.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",C);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":D!=null&&typeof D!="function"&&typeof D!="symbol"?g.setAttribute(C,""+D):g.removeAttribute(C);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":D&&typeof D!="function"&&typeof D!="symbol"?g.setAttribute(C,""):g.removeAttribute(C);break;case"capture":case"download":D===!0?g.setAttribute(C,""):D!==!1&&D!=null&&typeof D!="function"&&typeof D!="symbol"?g.setAttribute(C,D):g.removeAttribute(C);break;case"cols":case"rows":case"size":case"span":D!=null&&typeof D!="function"&&typeof D!="symbol"&&!isNaN(D)&&1<=D?g.setAttribute(C,D):g.removeAttribute(C);break;case"rowSpan":case"start":D==null||typeof D=="function"||typeof D=="symbol"||isNaN(D)?g.removeAttribute(C):g.setAttribute(C,D);break;case"popover":Qn("beforetoggle",g),Qn("toggle",g),ri(g,"popover",D);break;case"xlinkActuate":kn(g,"http://www.w3.org/1999/xlink","xlink:actuate",D);break;case"xlinkArcrole":kn(g,"http://www.w3.org/1999/xlink","xlink:arcrole",D);break;case"xlinkRole":kn(g,"http://www.w3.org/1999/xlink","xlink:role",D);break;case"xlinkShow":kn(g,"http://www.w3.org/1999/xlink","xlink:show",D);break;case"xlinkTitle":kn(g,"http://www.w3.org/1999/xlink","xlink:title",D);break;case"xlinkType":kn(g,"http://www.w3.org/1999/xlink","xlink:type",D);break;case"xmlBase":kn(g,"http://www.w3.org/XML/1998/namespace","xml:base",D);break;case"xmlLang":kn(g,"http://www.w3.org/XML/1998/namespace","xml:lang",D);break;case"xmlSpace":kn(g,"http://www.w3.org/XML/1998/namespace","xml:space",D);break;case"is":ri(g,"is",D);break;case"innerText":case"textContent":break;default:(!(2de)break;var Ge=Ee.transferSize,Xe=Ee.initiatorType;Ge&&Lz(Xe)&&(Ee=Ee.responseEnd,ae+=Ge*(Ee"u"?null:document;function Wz(g,A,C){var D=jm;if(D&&typeof A=="string"&&A){var V=bi(A);V='link[rel="'+g+'"][href="'+V+'"]',typeof C=="string"&&(V+='[crossorigin="'+C+'"]'),Xz.has(V)||(Xz.add(V),g={rel:g,crossOrigin:C,href:A},D.querySelector(V)===null&&(A=D.createElement("link"),Bs(A,"link",g),Ct(A),D.head.appendChild(A)))}}function Uwe(g){tf.D(g),Wz("dns-prefetch",g,null)}function Xwe(g,A){tf.C(g,A),Wz("preconnect",g,A)}function Wwe(g,A,C){tf.L(g,A,C);var D=jm;if(D&&g&&A){var V='link[rel="preload"][as="'+bi(A)+'"]';A==="image"&&C&&C.imageSrcSet?(V+='[imagesrcset="'+bi(C.imageSrcSet)+'"]',typeof C.imageSizes=="string"&&(V+='[imagesizes="'+bi(C.imageSizes)+'"]')):V+='[href="'+bi(g)+'"]';var G=V;switch(A){case"style":G=Lm(g);break;case"script":G=Fm(g)}gl.has(G)||(g=f({rel:"preload",href:A==="image"&&C&&C.imageSrcSet?void 0:g,as:A},C),gl.set(G,g),D.querySelector(V)!==null||A==="style"&&D.querySelector(Fx(G))||A==="script"&&D.querySelector($x(G))||(A=D.createElement("link"),Bs(A,"link",g),Ct(A),D.head.appendChild(A)))}}function qwe(g,A){tf.m(g,A);var C=jm;if(C&&g){var D=A&&typeof A.as=="string"?A.as:"script",V='link[rel="modulepreload"][as="'+bi(D)+'"][href="'+bi(g)+'"]',G=V;switch(D){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":G=Fm(g)}if(!gl.has(G)&&(g=f({rel:"modulepreload",href:g},A),gl.set(G,g),C.querySelector(V)===null)){switch(D){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(C.querySelector($x(G)))return}D=C.createElement("link"),Bs(D,"link",g),Ct(D),C.head.appendChild(D)}}}function Ywe(g,A,C){tf.S(g,A,C);var D=jm;if(D&&g){var V=Ut(D).hoistableStyles,G=Lm(g);A=A||"default";var ae=V.get(G);if(!ae){var de={loading:0,preload:null};if(ae=D.querySelector(Fx(G)))de.loading=5;else{g=f({rel:"stylesheet",href:g,"data-precedence":A},C),(C=gl.get(G))&&lP(g,C);var Ee=ae=D.createElement("link");Ct(Ee),Bs(Ee,"link",g),Ee._p=new Promise(function(Le,Ge){Ee.onload=Le,Ee.onerror=Ge}),Ee.addEventListener("load",function(){de.loading|=1}),Ee.addEventListener("error",function(){de.loading|=2}),de.loading|=4,xO(ae,A,D)}ae={type:"stylesheet",instance:ae,count:1,state:de},V.set(G,ae)}}}function Kwe(g,A){tf.X(g,A);var C=jm;if(C&&g){var D=Ut(C).hoistableScripts,V=Fm(g),G=D.get(V);G||(G=C.querySelector($x(V)),G||(g=f({src:g,async:!0},A),(A=gl.get(V))&&cP(g,A),G=C.createElement("script"),Ct(G),Bs(G,"link",g),C.head.appendChild(G)),G={type:"script",instance:G,count:1,state:null},D.set(V,G))}}function Jwe(g,A){tf.M(g,A);var C=jm;if(C&&g){var D=Ut(C).hoistableScripts,V=Fm(g),G=D.get(V);G||(G=C.querySelector($x(V)),G||(g=f({src:g,async:!0,type:"module"},A),(A=gl.get(V))&&cP(g,A),G=C.createElement("script"),Ct(G),Bs(G,"link",g),C.head.appendChild(G)),G={type:"script",instance:G,count:1,state:null},D.set(V,G))}}function qz(g,A,C,D){var V=(V=ee.current)?yO(V):null;if(!V)throw Error(r(446));switch(g){case"meta":case"title":return null;case"style":return typeof C.precedence=="string"&&typeof C.href=="string"?(A=Lm(C.href),C=Ut(V).hoistableStyles,D=C.get(A),D||(D={type:"style",instance:null,count:0,state:null},C.set(A,D)),D):{type:"void",instance:null,count:0,state:null};case"link":if(C.rel==="stylesheet"&&typeof C.href=="string"&&typeof C.precedence=="string"){g=Lm(C.href);var G=Ut(V).hoistableStyles,ae=G.get(g);if(ae||(V=V.ownerDocument||V,ae={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},G.set(g,ae),(G=V.querySelector(Fx(g)))&&!G._p&&(ae.instance=G,ae.state.loading=5),gl.has(g)||(C={rel:"preload",as:"style",href:C.href,crossOrigin:C.crossOrigin,integrity:C.integrity,media:C.media,hrefLang:C.hrefLang,referrerPolicy:C.referrerPolicy},gl.set(g,C),G||eOe(V,g,C,ae.state))),A&&D===null)throw Error(r(528,""));return ae}if(A&&D!==null)throw Error(r(529,""));return null;case"script":return A=C.async,C=C.src,typeof C=="string"&&A&&typeof A!="function"&&typeof A!="symbol"?(A=Fm(C),C=Ut(V).hoistableScripts,D=C.get(A),D||(D={type:"script",instance:null,count:0,state:null},C.set(A,D)),D):{type:"void",instance:null,count:0,state:null};default:throw Error(r(444,g))}}function Lm(g){return'href="'+bi(g)+'"'}function Fx(g){return'link[rel="stylesheet"]['+g+"]"}function Yz(g){return f({},g,{"data-precedence":g.precedence,precedence:null})}function eOe(g,A,C,D){g.querySelector('link[rel="preload"][as="style"]['+A+"]")?D.loading=1:(A=g.createElement("link"),D.preload=A,A.addEventListener("load",function(){return D.loading|=1}),A.addEventListener("error",function(){return D.loading|=2}),Bs(A,"link",C),Ct(A),g.head.appendChild(A))}function Fm(g){return'[src="'+bi(g)+'"]'}function $x(g){return"script[async]"+g}function Kz(g,A,C){if(A.count++,A.instance===null)switch(A.type){case"style":var D=g.querySelector('style[data-href~="'+bi(C.href)+'"]');if(D)return A.instance=D,Ct(D),D;var V=f({},C,{"data-href":C.href,"data-precedence":C.precedence,href:null,precedence:null});return D=(g.ownerDocument||g).createElement("style"),Ct(D),Bs(D,"style",V),xO(D,C.precedence,g),A.instance=D;case"stylesheet":V=Lm(C.href);var G=g.querySelector(Fx(V));if(G)return A.state.loading|=4,A.instance=G,Ct(G),G;D=Yz(C),(V=gl.get(V))&&lP(D,V),G=(g.ownerDocument||g).createElement("link"),Ct(G);var ae=G;return ae._p=new Promise(function(de,Ee){ae.onload=de,ae.onerror=Ee}),Bs(G,"link",D),A.state.loading|=4,xO(G,C.precedence,g),A.instance=G;case"script":return G=Fm(C.src),(V=g.querySelector($x(G)))?(A.instance=V,Ct(V),V):(D=C,(V=gl.get(G))&&(D=f({},C),cP(D,V)),g=g.ownerDocument||g,V=g.createElement("script"),Ct(V),Bs(V,"link",D),g.head.appendChild(V),A.instance=V);case"void":return null;default:throw Error(r(443,A.type))}else A.type==="stylesheet"&&(A.state.loading&4)===0&&(D=A.instance,A.state.loading|=4,xO(D,C.precedence,g));return A.instance}function xO(g,A,C){for(var D=C.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),V=D.length?D[D.length-1]:null,G=V,ae=0;ae title"):null)}function tOe(g,A,C){if(C===1||A.itemProp!=null)return!1;switch(g){case"meta":case"title":return!0;case"style":if(typeof A.precedence!="string"||typeof A.href!="string"||A.href==="")break;return!0;case"link":if(typeof A.rel!="string"||typeof A.href!="string"||A.href===""||A.onLoad||A.onError)break;switch(A.rel){case"stylesheet":return g=A.disabled,typeof A.precedence=="string"&&g==null;default:return!0}case"script":if(A.async&&typeof A.async!="function"&&typeof A.async!="symbol"&&!A.onLoad&&!A.onError&&A.src&&typeof A.src=="string")return!0}return!1}function tZ(g){return!(g.type==="stylesheet"&&(g.state.loading&3)===0)}function nOe(g,A,C,D){if(C.type==="stylesheet"&&(typeof D.media!="string"||matchMedia(D.media).matches!==!1)&&(C.state.loading&4)===0){if(C.instance===null){var V=Lm(D.href),G=A.querySelector(Fx(V));if(G){A=G._p,A!==null&&typeof A=="object"&&typeof A.then=="function"&&(g.count++,g=vO.bind(g),A.then(g,g)),C.state.loading|=4,C.instance=G,Ct(G);return}G=A.ownerDocument||A,D=Yz(D),(V=gl.get(V))&&lP(D,V),G=G.createElement("link"),Ct(G);var ae=G;ae._p=new Promise(function(de,Ee){ae.onload=de,ae.onerror=Ee}),Bs(G,"link",D),C.instance=G}g.stylesheets===null&&(g.stylesheets=new Map),g.stylesheets.set(C,A),(A=C.state.preload)&&(C.state.loading&3)===0&&(g.count++,C=vO.bind(g),A.addEventListener("load",C),A.addEventListener("error",C))}}var uP=0;function rOe(g,A){return g.stylesheets&&g.count===0&&SO(g,g.stylesheets),0uP?50:800)+A);return g.unsuspend=C,function(){g.unsuspend=null,clearTimeout(D),clearTimeout(V)}}:null}function vO(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)SO(this,this.stylesheets);else if(this.unsuspend){var g=this.unsuspend;this.unsuspend=null,g()}}}var AO=null;function SO(g,A){g.stylesheets=null,g.unsuspend!==null&&(g.count++,AO=new Map,A.forEach(iOe,g),AO=null,vO.call(g))}function iOe(g,A){if(!(A.state.loading&4)){var C=AO.get(g);if(C)var D=C.get(null);else{C=new Map,AO.set(g,C);for(var V=g.querySelectorAll("link[data-precedence],style[data-precedence]"),G=0;G"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(t)}catch(e){console.error(e)}}return t(),bP.exports=AOe(),bP.exports}var wOe=SOe();function Of(){return typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():`${Date.now()}-${Math.random().toString(36).slice(2)}`}function JA(){try{return typeof localStorage>"u"?null:localStorage}catch{return null}}function J7(){try{return typeof sessionStorage>"u"?null:sessionStorage}catch{return null}}const sie="hyperframes-studio:anonymousId",aie="hf-studio-anon-id";let yp=null;function OOe(){try{const t=typeof window>"u"?void 0:window.__HF_CLI_DISTINCT_ID;return typeof t=="string"&&t.length>0?t:null}catch{return null}}function wP(t,e){for(const n of[sie,aie])try{t.setItem(n,e)}catch{}}function ej(){if(yp)return yp;const t=JA(),e=OOe();if(e)return yp=e,t&&wP(t,e),e;if(t){let r=null;try{r=t.getItem(sie)??t.getItem(aie)}catch{}if(r)return yp=r,wP(t,r),r}else return yp=Of(),yp;const n=Of();return yp=n,wP(t,n),n}const COe="hyperframes-studio:telemetryDisabled",oie="hyperframes-studio:telemetryNoticeShown";function lie(){return ej()}function cie(t){var e;try{return((e=JA())==null?void 0:e.getItem(t))==="1"}catch{return!1}}function kOe(){return cie(COe)}function EOe(){return cie(oie)}function TOe(){var t;try{(t=JA())==null||t.setItem(oie,"1")}catch{}}const uie="hyperframes-studio:sessionStartFired";function POe(){var t;return((t=J7())==null?void 0:t.getItem(uie))==="1"}function MOe(){var t;try{(t=J7())==null||t.setItem(uie,"1")}catch{}}const NOe="phc_zjjbX0PnWxERXrMHhkEJWj9A9BhGVLRReICgsfTMmpx",DOe="hf-studio-telemetry-opt-out";function IOe(){try{return localStorage.getItem(DOe)==="1"}catch{return!1}}function _Oe(){return typeof navigator<"u"&&navigator.doNotTrack==="1"}function ROe(){return NOe.startsWith("phc_")}function jOe(){try{return!1}catch{return!1}}function LOe(){try{return!1}catch{return!1}}function eS(){try{return FOe()}catch{return!1}}function FOe(){return ROe()&&!jOe()&&!LOe()&&!kOe()&&!IOe()&&!_Oe()}let Bm;function $Oe(){if(Bm!==void 0)return Bm;if(typeof window>"u")return Bm=null,Bm;const t=window.__HF_CLI_AGENT_RUNTIME;return Bm=typeof t=="string"&&t.length>0?t:null,Bm}function fie(){return $Oe()??"none"}const BOe={user_agent:"",language:"",screen_width:0,screen_height:0,device_pixel_ratio:0,timezone_offset_minutes:0,is_mobile:!1,studio_version:"dev",agent_runtime:"none"};let Vm=null;function VOe(){if(Vm)return Vm;if(typeof navigator>"u"||typeof window>"u")return Vm=BOe,Vm;const t=navigator.userAgent,e=window.screen;return Vm={user_agent:t,language:navigator.language,screen_width:e.width,screen_height:e.height,device_pixel_ratio:window.devicePixelRatio,timezone_offset_minutes:new Date().getTimezoneOffset(),is_mobile:/Android|iPhone|iPad/i.test(t),studio_version:"0.8.22",agent_runtime:fie()},Vm}function HOe(t){let e=2166136261;for(let n=0;n>>0;return e>>>0}function QOe(t,e){return HOe(`${t}:${e}`)%100}function zOe(t){var i;if(t.override===!0)return{enabled:!0,reason:"forced_on"};if(t.override===!1)return{enabled:!1,reason:"forced_off"};const e=Math.max(0,Math.min(100,Math.trunc(t.percentage)));if(e<=0)return{enabled:!1,reason:"out_of_cohort"};if(e>=100)return{enabled:!0,reason:"in_cohort"};if(t.exclude)return{enabled:!1,reason:"excluded"};const n=(i=t.unitId)==null?void 0:i.trim();if(!n)return{enabled:!1,reason:"no_unit_id"};const r=QOe(t.feature,n);return re.name===t)}function qOe(t){return`hf_canary_${t.toLowerCase().replace(/[^a-z0-9]+/g,"_")}`}function YOe(t){var e;try{if(typeof window>"u")return;const n=(e=window.__HF_CLI_CANARY_DECISIONS)==null?void 0:e[t];return typeof(n==null?void 0:n.enabled)!="boolean"?void 0:{enabled:n.enabled,forced:n.forced===!0}}catch{return}}function KOe(){try{const t=typeof window>"u"?void 0:window.__HF_CLI_BUCKET_SEED;if(typeof t=="string"&&t.length>0)return t}catch{}return ej()}const JOe="hyperframes-studio:canary:";function e8e(t){if(typeof window>"u")return;const e=qOe(t),n=`${JOe}${t}`,r=J7();let i=null;try{i=new URLSearchParams(window.location.search).get(e)}catch{i=null}if(i!==null){if(i.trim().toLowerCase()==="reset"){r==null||r.removeItem(n);return}try{r==null||r.setItem(n,i)}catch{}return CZ(i)}return CZ((r==null?void 0:r.getItem(n))??void 0)}function kZ(){return typeof navigator>"u"?!1:navigator.webdriver===!0}const EZ=new Map,TZ=t=>({enabled:t,reason:t?"forced_on":"forced_off"}),t8e=t=>({enabled:t,reason:t?"in_cohort":"out_of_cohort"});function n8e(t){const e=WOe(t);if(!e)return{enabled:!1,reason:"out_of_cohort"};const n=YOe(e.name);if(n!=null&&n.forced)return TZ(n.enabled);const r=e8e(e.name);if(r===void 0){if(!eS())return{enabled:!1,reason:"telemetry_opt_out"};if(kZ())return{enabled:!1,reason:"excluded"};if(n!==void 0)return t8e(n.enabled)}return r!==void 0?TZ(r):zOe({feature:e.name,unitId:KOe(),percentage:e.percentage,exclude:kZ()})}function r8e(t){const e=EZ.get(t);if(e)return e;const n=n8e(t);return EZ.set(t,n),n}function die(){return XOe(hie.map(t=>{const{enabled:e,reason:n}=r8e(t.name);return{name:t.name,enabled:e,reason:n}}))}const i8e=14,s8e=["action","tab","panel","status","mode","reason","format","via"],y4=[],a8e=Date.now();function o8e(t){for(const e of s8e){const n=t[e];if(typeof n=="string"&&n.length>0&&n.length<=24)return`:${n}`;if(typeof n=="number"||typeof n=="boolean")return`:${String(n)}`}return""}function l8e(t,e){const n=t.replace(/^studio[:_]/,"");y4.push({at:Date.now()-a8e,label:`${n}${o8e(e)}`}),y4.length>i8e&&y4.shift()}function c8e(){return y4.map(t=>`${(t.at/1e3).toFixed(1)} ${t.label}`).join(" > ")}const u8e="phc_zjjbX0PnWxERXrMHhkEJWj9A9BhGVLRReICgsfTMmpx",f8e="https://us.i.posthog.com",h8e=1e3;let x4=[],OP=null;function d8e(){return eS()}function Ds(t,e={}){if(!d8e())return;l8e(t,e);const n=VOe();x4.push({event:t,properties:{...e,...n,...die()},timestamp:new Date().toISOString()}),OP===null&&(OP=setTimeout(()=>{OP=null,TI()},h8e)),m8e()}function TI(){if(x4.length===0)return;const t=lie(),e=x4.map(n=>({event:n.event,properties:{...n.properties,$ip:null},distinct_id:t,timestamp:n.timestamp}));x4=[],p8e(`${f8e}/batch/`,JSON.stringify({api_key:u8e,batch:e}))}function p8e(t,e){try{fetch(t,{method:"POST",headers:{"Content-Type":"application/json"},body:e,keepalive:!0}).catch(()=>{});return}catch{}try{navigator.sendBeacon(t,new Blob([e],{type:"application/json"}))}catch{}}function m8e(){EOe()||(TOe(),console.info("%c[HyperFrames]%c Anonymous studio usage analytics enabled. Disable: localStorage.setItem('hyperframes-studio:telemetryDisabled','1') (then reload).","color:#7c3aed;font-weight:bold","color:inherit"))}typeof window<"u"&&(window.addEventListener("pagehide",()=>TI(),{capture:!0}),window.addEventListener("visibilitychange",()=>{typeof document<"u"&&document.visibilityState==="hidden"&&TI()}));function g8e(t){Ds("studio_session_start",{has_project:t.has_project})}function y8e(t){Ds("studio_render_start",{fps:t.fps,quality:t.quality,format:t.format,resolution:t.resolution,composition:t.composition})}function x8e(t){Ds("studio_timeline_performance",t)}function b8e(){var t,e;try{const n=navigator,i=[`ua=${((t=n.userAgentData)==null?void 0:t.platform)??navigator.platform??"unknown"}`,`screen=${screen.width}x${screen.height}@${devicePixelRatio}x`,`lang=${navigator.language}`];return n.deviceMemory&&i.push(`mem=${n.deviceMemory}GB`),(e=n.connection)!=null&&e.effectiveType&&i.push(`net=${n.connection.effectiveType}`),navigator.hardwareConcurrency&&i.push(`cpu=${navigator.hardwareConcurrency}cores`),i.join(" ")}catch{return""}}function v8e(t){Ds("studio_razor_split",{mode:t.mode,count:t.count})}function Hm(t){Ds("studio_expanded_clip_edit",{action:t.action})}function PZ(t){Ds("studio_keyframe_lane_expand",{expanded:t.expanded})}function tj(t){Ds("studio_segment_ease_edit",{action:t.action,ease:t.ease})}function A8e(t){Ds("studio_feedback_shown",{reason:t.reason,render_id:t.render_id,source:"studio"})}function S8e(t){Ds("studio_feedback_dismissed",{reason:t.reason,render_id:t.render_id,via:t.via,had_rating:t.had_rating,source:"studio"})}function w8e(t){Ds("studio_feedback_interview_click",{reason:t.reason,source:"studio"})}function O8e(t){Ds("studio_feedback",{...t.rating===void 0?{}:{rating:t.rating,rating_scale:10},...t.comment?{comment:t.comment}:{},...t.context,reason:t.reason,render_id:t.render_id,question:t.question,answer_kind:t.answer_kind,doctor_summary:b8e(),breadcrumbs:c8e(),source:"studio"})}function MO(t){Ds("studio_block_param_commit",{tone:t.tone,block_name:t.blockName,param_key:t.key})}async function C8e(t){try{const e=await t.json();if(typeof e=="object"&&e!==null){const{error:n,hint:r}=e;if(typeof n=="string"&&n)return typeof r=="string"&&r?`${n}. ${r}`:n}}catch{}return`Server error (${t.status}). Check the terminal for details.`}function k8e(t){const e=(t==null?void 0:t.title)??"FFmpeg not found",n=(t==null?void 0:t.command)??(t==null?void 0:t.hint);return n?`${e}. Install it with: ${n}`:`${e}. Install FFmpeg to export.`}let Gx=null;const NO=t=>typeof t=="string"&&t?t:void 0;function E8e(t){if(typeof t!="object"||t===null)return null;const{ok:e,title:n,detail:r,hint:i,command:s}=t;return typeof e!="boolean"?null:{ok:e,title:NO(n),detail:NO(r),hint:NO(i),command:NO(s)}}async function T8e(){try{const t=await fetch("/api/environment/ffmpeg");return t.ok?E8e(await t.json()):null}catch{return null}}function P8e(){const[t,e]=x.useState(Gx),[n,r]=x.useState(Gx===null),i=x.useRef(!0);x.useEffect(()=>(i.current=!0,()=>{i.current=!1}),[]);const s=x.useCallback(async()=>{r(!0);const o=await T8e();Gx=o,i.current&&(e(o),r(!1))},[]);x.useEffect(()=>{Gx===null&&s()},[s]);const a=x.useCallback(()=>{Gx=null,s()},[s]);return{status:t,checking:n,recheck:a}}function MZ(t){return t!=="render_complete"}const NZ=[{id:"remove",prompt:"What would you cut from Studio?",placeholder:"The part you never use",presets:[{label:"Layers panel",hint:"The layer tree on the right"},{label:"Variables panel",hint:"Composition variables on the right"},{label:"Blocks browser",hint:"The block library in the sidebar"},{label:"Storyboard mode",hint:"The storyboard view next to Preview"},{label:"Caption editing",hint:"Editing caption words and presets in Studio"},{label:"Render history",hint:"The list of past exports"},{label:"Nothing",hint:"It all earns its place"}]},{id:"workaround",prompt:"What did you have to do outside Studio?",placeholder:"The step you finished somewhere else",presets:[{label:"Fix the exported file",hint:"Remuxing or re-encoding the output by hand"},{label:"Convert source media",hint:"Re-encoding footage before it would import cleanly"},{label:"Match loudness",hint:"Normalising levels across the finished audio"},{label:"Make images or graphics",hint:"Creating visual assets in another tool"},{label:"Record footage",hint:"Capturing screen or camera video"},{label:"Nothing, it was all here",hint:"No outside tools needed"}]},{id:"fix",prompt:"What should we fix first?",placeholder:"The thing that slowed you down",presets:[{label:"Audio mixing",hint:"Levels, ducking or the balance in the exported mix"},{label:"Export encoding",hint:"The render fails, or the finished file is wrong"},{label:"Export matches preview",hint:"The exported video differs from the preview"},{label:"Media and fonts",hint:"Adding video, images or fonts to a project"},{label:"Render speed",hint:"Exports take too long to finish"},{label:"Re-rendering everything",hint:"A small change means rendering the whole thing"},{label:"Checks and warnings",hint:"Lint flags things that are fine, or misses real ones"}]}],M8e={id:"detractor",prompt:"What went wrong?",placeholder:"The thing that made that a low score",presets:[{label:"Export failed",hint:"The render did not finish"},{label:"Output looked wrong",hint:"It rendered, but not the way I built it"},{label:"Crashed or froze",hint:"The editor stopped responding"},{label:"Lost my edits",hint:"Changes did not save, or came back changed"},{label:"Too slow",hint:"Waiting on renders, or the editor itself lagging"},{label:"Could not figure it out",hint:"Could not find or understand something"}]},N8e=6;function D8e(t){return t<=N8e?M8e:NZ[Math.floor(Math.random()*NZ.length)]}const p6={dismissedAt:"hyperframes-studio:feedbackDismissedAt",answeredAt:"hyperframes-studio:feedbackAnsweredAt"},pie="hyperframes-studio:feedbackAskedThisSession",mie=864e5,I8e=30*mie,_8e=7*mie;let F2=null;function R8e(){try{return!1}catch{return!1}}function DZ(t){try{return parseInt(window.localStorage.getItem(t)||"0",10)||0}catch{return 0}}function gie(t,e){try{window.localStorage.setItem(t,String(e))}catch{}}function j8e(){try{return window.sessionStorage.getItem(pie)==="1"}catch{return!0}}function L8e(){try{window.sessionStorage.setItem(pie,"1")}catch{}}function F8e(t){return!(R8e()||!eS()||j8e()||t-DZ(p6.answeredAt){F2===t&&(F2=null)}}function B8e(){gie(p6.answeredAt,Date.now())}function V8e(){gie(p6.dismissedAt,Date.now())}function xie(t){return`hf-studio-hidden-renders:${t}`}function IZ(t){try{const e=window.localStorage.getItem(xie(t)),n=e?JSON.parse(e):[];return new Set(Array.isArray(n)?n.filter(r=>typeof r=="string"):[])}catch{return new Set}}function H8e(t,e){try{window.localStorage.setItem(xie(t),JSON.stringify([...e].slice(-200)))}catch{}}function Q8e(t,e){const[n,r]=x.useState([]),[i,s]=x.useState(null),[a,o]=x.useState(null),{status:l,checking:c,recheck:u}=P8e(),f=l!==null&&!l.ok,h=x.useRef(null),p=x.useRef(null),y=x.useRef(new Map),m=x.useRef(new Set),v=x.useCallback((I,j)=>{y.current.set(I.id,j),r(L=>[...L,I])},[]),b=x.useCallback(I=>{var j;I&&p.current!==I||((j=h.current)==null||j.close(),h.current=null,p.current=null)},[]),w=x.useCallback(async()=>{if(t)try{const I=await fetch(`/api/projects/${t}/renders`);if(!I.ok){s(`Couldn't load render history (server error ${I.status}).`);return}const j=await I.json();if(s(null),Array.isArray(j.renders)){const L=IZ(t);r(B=>{const $=new Set(B.map(Y=>Y.id)),z=j.renders.filter(Y=>!$.has(Y.id)&&!L.has(Y.id)).map(Y=>({id:Y.id,status:Y.status==="failed"?"failed":"complete",progress:100,filename:Y.filename,createdAt:Y.createdAt,durationMs:Y.durationMs}));return[...B,...z]})}}catch{s("Couldn't load render history. Is the studio server running?")}},[t]);x.useEffect(()=>{w()},[w]);const O=x.useCallback(async(I={})=>{if(!t)return;if(f){v({id:Of(),status:"failed",progress:0,error:k8e(l),filename:"Export blocked",createdAt:Date.now()},{});return}const j=I.fps??30,L=I.quality??"standard",B=I.format??"mp4",$=I.resolution,z=I.composition??e.current??void 0;y8e({fps:j,quality:L,format:B,resolution:$,composition:z});const Y=Date.now(),W={render_format:B,render_quality:L,render_fps:j,render_resolution:$??"auto",render_composition:z??"index.html",render_has_variables:!!(I.variables&&Object.keys(I.variables).length>0)},J={fps:j,quality:L,format:B};eS()?J.telemetryDistinctId=lie():J.telemetryOptOut=!0,$&&$!=="auto"&&(J.resolution=$),z&&(J.composition=z),I.variables&&Object.keys(I.variables).length>0&&(J.variables=I.variables);if(new URLSearchParams(window.location.search).get("crocoView")==="script"&&window.__crocoBeforeExport){await window.__crocoBeforeExport({...I,projectId:t,composition:z??"index.html",fps:j,quality:L,format:B,resolution:$});return}let ne;try{ne=await fetch(`/api/projects/${t}/render`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(J)})}catch(Z){const K=Z instanceof Error?Z.message:String(Z),ee={id:Of(),status:"failed",progress:0,error:`Could not reach render server: ${K}. Use \`hyperframes render\` from the CLI instead.`,filename:"Export failed",createdAt:Y};v(ee,W);return}if(!ne.ok){const Z={id:Of(),status:"failed",progress:0,error:await C8e(ne),filename:"Export failed",createdAt:Y};v(Z,W);return}const{jobId:le}=await ne.json(),q={mp4:".mp4",webm:".webm",mov:".mov"}[B]??".mp4",F={id:le,status:"rendering",progress:0,filename:`${le}${q}`,createdAt:Y};v(F,W),p.current=le;const U=new EventSource(`/api/render/${le}/progress`);return h.current=U,U.addEventListener("progress",Z=>{try{const K=JSON.parse(Z.data),ee=K.status==="complete"||K.status==="failed"||K.status==="cancelled";r(re=>re.map(Q=>Q.id===le?{...Q,progress:K.progress??Q.progress,stage:K.stage??K.message??Q.stage,status:ee?K.status:Q.status,durationMs:K.status==="complete"?Date.now()-Y:void 0,error:K.error??Q.error}:Q)),ee&&b(le)}catch{}}),U.onerror=()=>{U.close(),r(Z=>Z.map(K=>K.id===le&&K.status==="rendering"?{...K,status:"failed",error:"Connection lost. Is the render server running?"}:K)),p.current=null},le},[t,e,b,v,l,f]),k=x.useCallback(async I=>{o(null),b(I),r(j=>j.map(L=>L.id===I&&L.status==="rendering"?{...L,status:"cancelled"}:L));try{const j=await fetch(`/api/render/${I}/cancel`,{method:"POST"});if(!j.ok&&j.status!==404){o("Couldn't cancel on the server — the render may still be running.");return}if(j.ok){const L=await j.json().catch(()=>null);L!=null&&L.status&&L.status!=="cancelled"&&w()}}catch{o("Couldn't reach the server to cancel — the render may still be running.")}},[b,w]),E=x.useCallback(async I=>{o(null),b(I);try{if(!(await fetch(`/api/render/${I}`,{method:"DELETE"})).ok){o("Couldn't delete the render — it's still on disk.");return}}catch{o("Couldn't reach the server to delete the render.");return}r(j=>j.filter(L=>L.id!==I))},[b]),T=x.useCallback(()=>{r(I=>{const j=I.filter(L=>L.status!=="rendering");if(t&&j.length>0){const L=IZ(t);for(const B of j)L.add(B.id);H8e(t,L)}return I.filter(L=>L.status==="rendering")})},[t]),N=x.useCallback(()=>o(null),[]);x.useEffect(()=>{for(const I of n){if(I.status==="rendering"||I.status==="cancelled")continue;const j=y.current.get(I.id);!j||m.current.has(I.id)||(m.current.add(I.id),yie({reason:I.status==="complete"?"render_complete":"render_failed",renderId:I.id,detail:I.error,context:{...j,render_progress:I.progress,render_duration_ms:I.durationMs??Date.now()-I.createdAt,render_stage:I.stage,render_error:I.error,renders_this_session:y.current.size}}))}},[n]),x.useEffect(()=>()=>{var I;(I=h.current)==null||I.close(),h.current=null},[t]);const _=n.some(I=>I.status==="rendering");return x.useMemo(()=>({jobs:n,isRendering:_,loadError:i,actionError:a,dismissActionError:N,reloadRenders:w,deleteRender:E,cancelRender:k,clearCompleted:T,startRender:O,ffmpeg:l,ffmpegMissing:f,ffmpegChecking:c,recheckFfmpeg:u}),[n,_,i,a,N,w,E,k,T,O,l,f,c,u])}const z8e="modulepreload",Z8e=function(t){return"/"+t},_Z={},hy=function(e,n,r){let i=Promise.resolve();if(n&&n.length>0){let a=function(c){return Promise.all(c.map(u=>Promise.resolve(u).then(f=>({status:"fulfilled",value:f}),f=>({status:"rejected",reason:f}))))};document.getElementsByTagName("link");const o=document.querySelector("meta[property=csp-nonce]"),l=(o==null?void 0:o.nonce)||(o==null?void 0:o.getAttribute("nonce"));i=a(n.map(c=>{if(c=Z8e(c),c in _Z)return;_Z[c]=!0;const u=c.endsWith(".css"),f=u?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${c}"]${f}`))return;const h=document.createElement("link");if(h.rel=u?"stylesheet":z8e,u||(h.as="script"),h.crossOrigin="",h.href=c,l&&h.setAttribute("nonce",l),document.head.appendChild(h),u)return new Promise((p,y)=>{h.addEventListener("load",p),h.addEventListener("error",()=>y(new Error(`Unable to preload CSS for ${c}`)))})}))}function s(a){const o=new Event("vite:preloadError",{cancelable:!0});if(o.payload=a,window.dispatchEvent(o),!o.defaultPrevented)throw a}return i.then(a=>{for(const o of a||[])o.status==="rejected"&&s(o.reason);return e().catch(s)})};function G8e(t){if(typeof t!="object"||t===null)return!0;const e=t;return e.isLoaded===!0||typeof e.totalFrames=="number"&&e.totalFrames>0}function Or(t){x.useEffect(t,[])}const RZ=t=>{let e;const n=new Set,r=(c,u)=>{const f=typeof c=="function"?c(e):c;if(!Object.is(f,e)){const h=e;e=u??(typeof f!="object"||f===null)?f:Object.assign({},e,f),n.forEach(p=>p(e,h))}},i=()=>e,o={setState:r,getState:i,getInitialState:()=>l,subscribe:c=>(n.add(c),()=>n.delete(c))},l=e=t(r,i,o);return o},U8e=(t=>t?RZ(t):RZ),X8e=t=>t;function W8e(t,e=X8e){const n=Lb.useSyncExternalStore(t.subscribe,Lb.useCallback(()=>e(t.getState()),[t,e]),Lb.useCallback(()=>e(t.getInitialState()),[t,e]));return Lb.useDebugValue(n),n}const jZ=t=>{const e=U8e(t),n=r=>W8e(e,r);return Object.assign(n,e),n},lE=(t=>t?jZ(t):jZ),_v=lE(t=>({values:null,setValues:e=>t({values:e&&Object.keys(e).length>0?e:null})}));function bie(t){const e=_v.getState().values;e?t.searchParams.set("variables",JSON.stringify(e)):t.searchParams.delete("variables")}const vie={primary:["bg-white text-neutral-950 font-medium","shadow-btn-primary","enabled:hover:bg-neutral-200","enabled:active:scale-[0.97]"].join(" "),secondary:["bg-transparent text-neutral-300 font-medium","border border-border","enabled:hover:bg-surface-hover enabled:hover:text-white enabled:hover:border-border-strong","enabled:active:scale-[0.98]"].join(" "),danger:["bg-accent-red text-white font-medium","enabled:hover:bg-red-600","enabled:active:scale-[0.97]"].join(" "),ghost:["bg-transparent text-neutral-400","enabled:hover:bg-surface-hover enabled:hover:text-white","enabled:active:scale-[0.98]"].join(" ")},q8e={sm:"h-7 px-2.5 text-xs gap-1.5 rounded-button",md:"h-8 px-3 text-sm gap-1.5 rounded-button",lg:"h-9 px-4 text-base gap-2 rounded-button"},zo=x.forwardRef(({variant:t="secondary",size:e="md",loading:n,icon:r,children:i,className:s="",disabled:a,...o},l)=>d.jsxs("button",{ref:l,disabled:a||n,className:["inline-flex items-center justify-center","transition-all duration-press ease-standard","disabled:opacity-40 disabled:cursor-not-allowed","select-none cursor-pointer","outline-none focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-studio-accent",vie[t],q8e[e],s].join(" "),...o,children:[n?d.jsxs("svg",{className:"animate-spin h-3.5 w-3.5",viewBox:"0 0 24 24",fill:"none",children:[d.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),d.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}):r?d.jsx("span",{className:"flex-shrink-0",children:r}):null,i&&d.jsx("span",{children:i})]}));zo.displayName="Button";const Y8e={sm:"min-w-7 min-h-7 rounded-button",md:"min-w-8 min-h-8 rounded-button",lg:"min-w-9 min-h-9 rounded-button"},K8e=x.forwardRef(({icon:t,size:e="md",variant:n="ghost",className:r="",...i},s)=>d.jsx("button",{ref:s,className:["inline-flex items-center justify-center","transition-all duration-press ease-standard","disabled:opacity-40 disabled:cursor-not-allowed","select-none cursor-pointer","outline-none focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-studio-accent",vie[n],Y8e[e],r].join(" "),...i,children:t}));K8e.displayName="IconButton";function LZ({title:t,detail:e,mono:n,size:r=64,progress:i}){const s=typeof i=="number"&&Number.isFinite(i)?Math.min(1,Math.max(0,i)):void 0,a=Math.round(r*1.16);return d.jsxs("div",{className:"hf-loader",role:"status",draggable:!1,children:[d.jsx("div",{className:"hf-loader-mark-frame",style:{width:a,height:a},draggable:!1,children:d.jsxs("svg",{className:"hf-loader-mark",width:r,height:r,viewBox:"0 0 100 100",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",children:[d.jsx("g",{className:"hf-loader-mark__mark",transform:"translate(50 50)",children:d.jsx("g",{className:"hf-loader-mark__core",transform:"scale(1)",opacity:".92",children:d.jsxs("g",{transform:"translate(-50 -50)",children:[d.jsx("path",{d:"M10.1851 57.8021L33.1145 73.8313C36.2202 75.9978 41.5173 73.5433 42.4816 69.4984L51.7611 30.4271C52.7253 26.3822 48.5802 23.9277 44.4602 26.0942L13.917 42.1235C6.96677 45.7676 4.97564 54.1579 10.1851 57.8021Z",fill:"url(#hf-loader-grad-left)"}),d.jsx("path",{d:"M87.5129 57.5141L56.9696 73.5433C52.8371 75.7098 48.7046 73.2553 49.6688 69.2104L58.9483 30.1391C59.9125 26.0942 65.2097 23.6397 68.3154 25.8062L91.2447 41.8354C96.4668 45.4796 94.4631 53.8699 87.5129 57.5141Z",fill:"url(#hf-loader-grad-right)"})]})})}),d.jsxs("defs",{children:[d.jsxs("linearGradient",{id:"hf-loader-grad-left",x1:"48.5676",y1:"25",x2:"44.7804",y2:"71.9384",gradientUnits:"userSpaceOnUse",children:[d.jsx("stop",{stopColor:"#06E3FA"}),d.jsx("stop",{offset:"1",stopColor:"#4FDB5E"})]}),d.jsxs("linearGradient",{id:"hf-loader-grad-right",x1:"54.8282",y1:"73.8392",x2:"72.0989",y2:"32.8932",gradientUnits:"userSpaceOnUse",children:[d.jsx("stop",{stopColor:"#06E3FA"}),d.jsx("stop",{offset:"1",stopColor:"#4FDB5E"})]})]})]})}),d.jsx("div",{className:"hf-loader-title",children:t}),e&&d.jsx("div",{className:"hf-loader-detail",children:e}),s!==void 0&&d.jsx("div",{className:"hf-loader-progress",role:"progressbar","aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":Math.round(s*100),children:d.jsx("div",{className:"hf-loader-progress__fill",style:{transform:`scaleX(${s})`}})}),n&&d.jsx("div",{className:"hf-loader-mono",children:n})]})}var Bl=iie();function b4(t,e,n){return Math.max(e,Math.min(n,t))}function J8e(t,e,n,r){const i=e/2,s=i+r;return b4(t,s,Math.max(s,n-i-r))}function nj(t,e,n,r){const i=(r==null?void 0:r.offset)??8,s=(r==null?void 0:r.margin)??12,a=Math.max(s,e.width-n.width-s),o=t.left+t.width/2-n.width/2,l=b4(o,s,a),c=t.bottom+i,u=t.top-n.height-i,f=c+n.height<=e.height-s,h=u>=s;return f||!h?{left:l,top:b4(c,s,Math.max(s,e.height-n.height-s)),placement:"bottom"}:{left:l,top:b4(u,s,Math.max(s,e.height-n.height-s)),placement:"top"}}const FZ=28,CP=8;function vr({label:t,children:e,delay:n=400,side:r="top"}){const[i,s]=x.useState(!1),[a,o]=x.useState({x:0,y:0}),[l,c]=x.useState(r),u=x.useRef(null),f=x.useRef(null),h=x.useRef(null),[p,y]=x.useState(0),m=x.useId(),v=x.useCallback(()=>{u.current&&clearTimeout(u.current),u.current=setTimeout(()=>{const O=f.current;if(!O)return;const E=(O.firstElementChild??O).getBoundingClientRect();if(E.width===0&&E.height===0)return;let T=r;r==="top"&&E.top-FZ-6window.innerHeight-CP&&(T="top"),c(T),o({x:E.left+E.width/2,y:T==="top"?E.top-6:E.bottom+6}),s(!0)},n)},[n,r]),b=x.useCallback(()=>{u.current&&(clearTimeout(u.current),u.current=null),s(!1)},[]);x.useLayoutEffect(()=>{var O;y(i?((O=h.current)==null?void 0:O.offsetWidth)??0:0)},[i,t]),x.useEffect(()=>{if(!i)return;const O=k=>{k.key==="Escape"&&b()};return document.addEventListener("keydown",O),()=>document.removeEventListener("keydown",O)},[i,b]);const w=J8e(a.x,p,window.innerWidth,CP);return d.jsxs(d.Fragment,{children:[d.jsx("span",{ref:f,onPointerEnter:v,onPointerLeave:b,onFocus:v,onBlur:b,"aria-describedby":i?m:void 0,className:"contents",children:e}),i&&Bl.createPortal(d.jsx("div",{className:"fixed z-[200] pointer-events-none",style:{left:w,top:a.y,transform:l==="top"?"translate(-50%, -100%)":"translate(-50%, 0)"},children:d.jsx("div",{ref:h,role:"tooltip",id:m,className:"px-2 py-1 rounded-md bg-neutral-800 border border-neutral-700/50 text-[10px] font-medium text-neutral-200 whitespace-nowrap shadow-lg",children:t})}),document.body)]})}const e4e=3,t4e=3;function PI(t){return typeof t=="object"&&t!==null}function n4e(t){if(!(t instanceof CustomEvent))return null;const e=t.detail;if(!PI(e))return null;const n=e.state;return PI(n)?n.loading===!0&&n.ready!==!0:null}const r4e=400,$Z="The composition preview did not become ready.";function i4e(t){return!(t instanceof CustomEvent)||!PI(t.detail)?$Z:typeof t.detail.message=="string"&&t.detail.message.trim()?t.detail.message:$Z}function s4e(t){const e=t.shadowRoot;if(!e)return;const n=e.querySelector(".hfp-container"),r=e.querySelector(".hfp-iframe");n==null||n.style.setProperty("pointer-events","auto"),r==null||r.style.setProperty("pointer-events","auto")}function a4e(t){const e=t.tagName.toLowerCase();return e==="video"||e==="audio"}function BZ(t,e){try{const n=t.contentWindow,r=t.contentDocument;if(!n||!r)return e;for(const s of r.querySelectorAll("video, audio"))if(a4e(s)&&!s.error&&s.networkState!==t4e&&s.readyState{const l=x.useRef(null),c=x.useRef(0),u=x.useRef(null),f=x.useRef(null),h=x.useRef(null),p=x.useRef(0),[y,m]=x.useState(!1),[v,b]=x.useState(!1),[w,O]=x.useState(!1),[k,E]=x.useState(!1),[T,N]=x.useState(!1),[_,I]=x.useState(!0),[j,L]=x.useState(!0),[B,$]=x.useState(null);x.useEffect(()=>{if(!_){L(!0);return}const J=setTimeout(()=>L(!1),r4e);return()=>clearTimeout(J)},[_]),Or(()=>{const J=l.current;if(!J)return;let ne=!1,le;return hy(()=>import("./hyperframes-player-DmtkkaPN.js"),[]).then(()=>{if(ne)return;const ie=document.createElement("hyperframes-player"),q=new URL(e||`/api/projects/${t}/preview`,window.location.origin);bie(q);const F=q.pathname+q.search,U=()=>{p.current+=1;const se=new URL(F,window.location.origin);se.searchParams.set("_hfStudioRetry",String(p.current)),$(null),I(!0),ie.setAttribute("src",se.pathname+se.search)};h.current=U;const Z=ie.iframeElement,K=se=>se.stopImmediatePropagation(),ee=se=>{const fe=n4e(se);fe!==null&&N(fe)},re=()=>{$(null),I(!1)},Q=se=>{$(i4e(se)),I(!1)},H=()=>{if(c.current++,$(null),N(!1),I(!0),c.current>1){J.classList.remove("preview-revealing"),J.offsetWidth,J.classList.add("preview-revealing");const be=()=>J.classList.remove("preview-revealing");J.addEventListener("animationend",be,{once:!0})}n(),u.current&&clearInterval(u.current);let fe=c.current>1?!1:BZ(Z,!1);if(fe){m(!0);let be=0;u.current=setInterval(()=>{be+=1,fe=BZ(Z,fe),(!fe||be>100)&&(fe&&be>100&&console.debug("[studio] asset readiness poll hit the 10s cap — continuing with unloaded assets"),u.current&&clearInterval(u.current),u.current=null,m(!1))},100)}else m(!1)};if(Z.addEventListener("load",H),ie.addEventListener("click",K,{capture:!0}),ie.addEventListener("shadertransitionstate",ee),ie.addEventListener("ready",re),ie.addEventListener("error",Q),typeof o=="function"?o(Z):o&&(o.current=Z),ie.setAttribute("shader-capture-scale","1"),ie.setAttribute("shader-loading","player"),ie.setAttribute("width",String(i?1080:1920)),ie.setAttribute("height",String(i?1920:1080)),ie.style.width="100%",ie.style.height="100%",ie.style.display="block",ie.style.background="transparent",ie.setAttribute("src",F),J.appendChild(ie),ie.shadowRoot){const se=document.createElement("style");se.textContent=".hfp-container{overflow:visible}.hfp-iframe{box-shadow:0 0 0 1px rgba(255,255,255,0.08),0 4px 32px rgba(0,0,0,.7)}",ie.shadowRoot.appendChild(se)}s4e(ie),le=()=>{if(Z.removeEventListener("load",H),ie.removeEventListener("click",K,{capture:!0}),ie.removeEventListener("shadertransitionstate",ee),ie.removeEventListener("ready",re),ie.removeEventListener("error",Q),u.current&&clearInterval(u.current),u.current=null,ie.remove(),h.current===U&&(h.current=null),typeof o!="function"){if(o){const se=o;se.current===Z&&(se.current=null)}}}}),()=>{ne=!0,le==null||le()}}),x.useEffect(()=>{if(!y){E(!1);return}const J=setTimeout(()=>E(!0),3e3);return()=>clearTimeout(J)},[y]),x.useEffect(()=>{if(f.current&&(clearTimeout(f.current),f.current=null),y){b(!0),O(!1);return}return O(!0),f.current=setTimeout(()=>{b(!1),O(!1),f.current=null},240),()=>{f.current&&(clearTimeout(f.current),f.current=null)}},[y]);const z=()=>{u.current&&(clearInterval(u.current),u.current=null),m(!1)},Y=!a&&!j&&_,W=v&&!T&&!Y&&!B;return x.useEffect(()=>{r==null||r(Y||W)},[r,Y,W]),d.jsxs("div",{className:"relative w-full h-full max-w-full max-h-full overflow-hidden flex items-center justify-center",style:s,children:[d.jsx("div",{ref:l,className:"w-full h-full"}),Y&&d.jsx("div",{className:"absolute inset-0 bg-black flex items-center justify-center z-30 select-none","data-hyperframes-ignore":"","data-testid":"composition-loading-overlay",draggable:!1,onDragStart:J=>J.preventDefault(),onMouseDown:J=>J.preventDefault(),onPointerDown:J=>J.preventDefault(),children:d.jsx(LZ,{title:"Loading composition",detail:"Preparing the Studio preview.",size:56})}),W&&d.jsx("div",{className:"absolute inset-0 bg-black flex items-center justify-center z-20 select-none","data-hyperframes-ignore":"",draggable:!1,style:{opacity:w?0:1,pointerEvents:w?"none":"auto",transition:"opacity 180ms ease-in"},onDragStart:J=>J.preventDefault(),onMouseDown:J=>J.preventDefault(),children:d.jsxs("div",{className:"flex flex-col items-center gap-3",children:[d.jsx(LZ,{title:"Preparing preview assets",detail:"Waiting for media and motion assets before playback starts.",size:56}),k&&d.jsx("button",{type:"button",onClick:z,className:"px-3 py-1.5 text-[11px] rounded-md border border-neutral-700 text-neutral-300 hover:border-neutral-500 hover:bg-neutral-800 transition-colors",children:"Continue anyway"})]})}),B&&d.jsx("div",{className:"absolute inset-0 z-40 flex items-center justify-center bg-black/90 px-6 text-center","data-hyperframes-ignore":"","data-testid":"composition-preview-error",children:d.jsxs("div",{className:"max-w-sm",children:[d.jsx("p",{className:"text-sm font-semibold text-white",children:"Preview failed to load"}),d.jsx("p",{className:"mt-1 text-xs text-neutral-400",children:B}),d.jsx("button",{type:"button",className:"mt-4 rounded-md bg-white px-3 py-1.5 text-xs font-semibold text-black transition-colors hover:bg-neutral-200",onClick:()=>{var J;return(J=h.current)==null?void 0:J.call(h)},children:"Retry preview"})]})})]})});MI.displayName="Player";function af(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function Aie(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,t.__proto__=e}/*! * GSAP 3.15.0 * https://gsap.com * @@ -67,7 +67,7 @@ Error generating stack: `+D.message+` * Copyright 2008-2026, GreenSock. All rights reserved. * Subject to the terms at https://gsap.com/standard-license * @author: Jack Doyle, jack@greensock.com -*/var k6e=/[achlmqstvz]|(-?\d*\.?\d*(?:e[\-+]?\d+)?)[0-9]/ig,E6e=/(?:(-)?\d*\.?\d*(?:e[\-+]?\d+)?)[0-9]/ig,T6e=/[\+\-]?\d*\.?\d+e[\+\-]?\d+/ig,P6e=/(^[#\.][a-z]|[a-y][a-z])/i,M6e=Math.PI/180,IO=Math.sin,_O=Math.cos,mc=Math.abs,hf=Math.sqrt,RO=Math.atan2,sG=1e8,aG=function(e){return typeof e=="string"},yse=function(e){return typeof e=="number"},oG=1e5,rs=function(e){return Math.round(e*oG)/oG||0},lG=function(e){return e.closed=Math.abs(e[0]-e[e.length-2])<.001&&Math.abs(e[1]-e[e.length-1])<.001},N6e=function(e,n,r){var i=e.length,s=~~(r*i);if(e[s]>n){for(;--s&&e[s]>n;);s<0&&(s=0)}else for(;e[++s] element or an SVG path data string")}function Bb(t){var e=0,n;for(t.reverse();e-1;)a=i[s].nodeName.toLowerCase(),n.indexOf(","+a+",")<0&&r.setAttributeNS(null,a,i[s].nodeValue);return r},_6e={rect:"rx,ry,x,y,width,height",circle:"r,cx,cy",ellipse:"rx,ry,cx,cy",line:"x1,x2,y1,y2"},R6e=function(e,n){for(var r=n?n.split(","):[],i={},s=r.length;--s>-1;)i[r[s]]=+e.getAttribute(r[s])||0;return i};function xse(t,e){var n=t.tagName.toLowerCase(),r=.552284749831,i,s,a,o,l,c,u,f,h,p,y,m,v,b,w,O,k,E,T,N,_,I;return n==="path"||!t.getBBox?t:(c=I6e(t,"x,y,width,height,cx,cy,rx,ry,r,x1,x2,y1,y2,points"),I=R6e(t,_6e[n]),n==="rect"?(o=I.rx,l=I.ry||o,s=I.x,a=I.y,p=I.width-o*2,y=I.height-l*2,o||l?(m=s+o*(1-r),v=s+o,b=v+p,w=b+o*r,O=b+o,k=a+l*(1-r),E=a+l,T=E+y,N=T+l*r,_=T+l,i="M"+O+","+E+" V"+T+" C"+[O,N,w,_,b,_,b-(b-v)/3,_,v+(b-v)/3,_,v,_,m,_,s,N,s,T,s,T-(T-E)/3,s,E+(T-E)/3,s,E,s,k,m,a,v,a,v+(b-v)/3,a,b-(b-v)/3,a,b,a,w,a,O,k,O,E].join(",")+"z"):i="M"+(s+p)+","+a+" v"+y+" h"+-p+" v"+-y+" h"+p+"z"):n==="circle"||n==="ellipse"?(n==="circle"?(o=l=I.r,f=o*r):(o=I.rx,l=I.ry,f=l*r),s=I.cx,a=I.cy,u=o*r,i="M"+(s+o)+","+a+" C"+[s+o,a+f,s+u,a+l,s,a+l,s-u,a+l,s-o,a+f,s-o,a,s-o,a-f,s-u,a-l,s,a-l,s+u,a-l,s+o,a-f,s+o,a].join(",")+"z"):n==="line"?i="M"+I.x1+","+I.y1+" L"+I.x2+","+I.y2:(n==="polyline"||n==="polygon")&&(h=(t.getAttribute("points")+"").match(E6e)||[],s=h.shift(),a=h.shift(),i="M"+s+","+a+" L"+h.join(","),n==="polygon"&&(i+=","+s+","+a+"z")),c.setAttribute("d",Hp(c._gsRawPath=xf(i))),e&&t.parentNode&&(t.parentNode.insertBefore(c,t),t.parentNode.removeChild(t)),c)}function bse(t,e,n){e=e||0,t.samples||(t.samples=[],t.lookup=[]);var r=~~t.resolution||12,i=1/r,s=t.length,a=t[e],o=t[e+1],l=e?e/6*r:0,c=t.samples,u=t.lookup,f=(e?t.minLength:sG)||sG,h=c[l+n*r-1],p=e?c[l-1]:0,y,m,v,b,w,O,k,E,T,N,_,I,j,L,B,$,z;for(c.length=u.length=0,m=e+2;m8&&(t.splice(m,6),m-=6,s-=6);else for(y=1;y<=r;y++)L=i*y,j=1-L,O=k-(k=(L*L*v+3*j*(L*b+j*w))*L),_=I-(I=(L*L*E+3*j*(L*T+j*N))*L),$=hf(_*_+O*O),$1&&(n=hf(k)*n,r=hf(k)*r);var E=n*n,T=r*r,N=(E*T-E*O-T*w)/(E*O+T*w);N<0&&(N=0);var _=(s===a?-1:1)*hf(N),I=_*(n*b/r),j=_*-(r*v/n),L=(t+o)/2,B=(e+l)/2,$=L+(u*I-f*j),z=B+(f*I+u*j),Y=(v-I)/n,W=(b-j)/r,J=(-v-I)/n,ne=(-b-j)/r,le=Y*Y+W*W,ie=(W<0?-1:1)*Math.acos(Y/hf(le)),q=(Y*ne-W*J<0?-1:1)*Math.acos((Y*J+W*ne)/hf(le*(J*J+ne*ne)));isNaN(q)&&(q=h),!a&&q>0?q-=p:a&&q<0&&(q+=p),ie%=p,q%=p;var F=Math.ceil(mc(q)/(p/4)),U=[],Z=q/F,K=4/3*IO(Z/2)/(1+_O(Z/2)),ee=u*n,re=f*n,Q=f*-r,H=u*r,se;for(se=0;se-1e-4?0:j}).match(k6e)||[],n=[],r=0,i=0,s=2/3,a=e.length,o=0,l="ERROR: malformed path: "+t,c,u,f,h,p,y,m,v,b,w,O,k,E,T,N,_=function(j,L,B,$){w=(B-j)/3,O=($-L)/3,m.push(j+w,L+O,B-w,$-O,B,$)};if(!t||!isNaN(e[0])||isNaN(e[1]))return console.log(l),n;for(c=0;c.5||mc(i-h)>.5)&&(_(r,i,f,h),p==="L"&&(c+=2)),r=f,i=h;else if(p==="A"){if(T=e[c+4],N=e[c+5],w=e[c+6],O=e[c+7],u=7,T.length>1&&(T.length<3?(O=w,w=N,u--):(O=N,w=T.substr(2),u-=2),N=T.charAt(1),T=T.charAt(0)),k=j6e(r,i,+e[c+1],+e[c+2],+e[c+3],+T,+N,(y?r:0)+w*1,(y?i:0)+O*1),c+=u,k)for(u=0;uu&&o.push(c);if(o.push(t.length-2),l=o.length,a.nonSmooth=_=[1],e>l)for(e-=l,b=0;br?r=o:os?s=l:l-1;)for(p=e[r],c=p.length,h=6;h-1;)m=l*y,v=1-m,u=(m*m*E+3*v*(m*k+v*O))*m+b,f=(m*m*_+3*v*(m*N+v*T))*m+w,u>i?i=u:ua?a=f:f-1;)for(l=e[i],p=l.length,h=0;h0;)h=1-1/(r+2),p=i+(a-i)*h,y=a+(l-a)*h,m=s+(o-s)*h,v=o+(c-o)*h,b=p+(y-p)*h,w=m+(v-m)*h,O=l+(u-l)*h,k=c+(f-c)*h,y+=(O-y)*h,v+=(k-v)*h,e.splice(n+2,4,a=Uc(p),o=Uc(m),l=Uc(b),c=Uc(w),u=Uc(b+(y-b)*h),f=Uc(w+(v-w)*h),Uc(y),Uc(v),Uc(O),Uc(k))},U6e=function(e){for(var n=e.length,r=-Sj,i;n--;)e[n]>r&&(r=e[n],i=n);return i},w4=function(e,n){for(var r=[],i=[],s=e.length-2,a=0;a.01||Math.abs(e[i+1]-r)>.01)return!1;return!0},jP=function(e,n){n=n||{};var r=n,i=r.redraw,s=r.points,a=r.maxSegments,o=a===void 0?999:a,l=0,c=e,u=Array.isArray(s)?s:0,f,h,p,y,m;if(i=i!==!1,i)vse(e);else for(e.totalPoints=0,h=e.length;h--;)e.totalPoints+=e[h].length;for(u?(c=mG(e),u=mG(u),m=u[0].totalLength/Math.round(u[0].length/6)):((!s||s==="auto")&&(s=ZI(e,i),i||(s-=Math.round(e.totalPoints/6))),s=Math.max(i?10:4,Math.min(999,s))),h=0;h=o||u&&(!u[h]||Cse(u[h]))))if(i){var v;y=F6e(L6e(p,f),n.curviness),p.length=0,(v=p).push.apply(v,y)}else w4(p,f);l+=f}return e},GI=function(e,n,r,i,s){var a=n.length-e.length,o=a>0?n:e,l=a>0?e:n,c=0,u=i==="complexity"?Ose:dG,f=i==="position"?0:typeof i=="number"?i:.8,h=l.length,p=typeof r=="object"&&r.push?r.slice(0):[r],y=p[0]==="reverse"||p[0]<0,m=r==="log",v,b,w,O,k,E,T;if(l[0]){if(o.length>1&&(e.sort(u),n.sort(u),o.size||H2(o),l.size||H2(l),E=o.centerX-l.centerX,T=o.centerY-l.centerY,u===dG))for(h=0;hl[0].length&&w4(l[0],(o[0].length-l[0].length)/6|0),h=l.length;c0&&w4(b,a/6|0),y&&s!==!1&&!b.reversed&&Bb(b),r=p[h]||p[h]===0?p[h]:"auto",r&&(b.closed||Math.abs(b[0]-b[b.length-2])<.5&&Math.abs(b[1]-b[b.length-1])<.5?r==="auto"||r==="log"?(p[h]=r=Q6e(b,v,!h||s===!1),r<0&&(y=!0,Bb(b),r=-r),pG(b,r*6)):r!=="reverse"&&(h&&r<0&&Bb(b),pG(b,(r<0?-r:r)*6)):!y&&(r==="auto"&&Math.abs(v[0]-b[0])+Math.abs(v[1]-b[1])+Math.abs(v[v.length-2]-b[b.length-2])+Math.abs(v[v.length-1]-b[b.length-1])>Math.abs(v[0]-b[b.length-2])+Math.abs(v[1]-b[b.length-1])+Math.abs(v[v.length-2]-b[0])+Math.abs(v[v.length-1]-b[1])||r%2)?(Bb(b),p[h]=-1,y=!0):r==="auto"?p[h]=0:r==="reverse"&&(p[h]=-1),b.closed!==v.closed&&(b.closed=v.closed=!1));return m&&nd("shapeIndex:["+p.join(",")+"]"),e.shapeIndex=p,p}},gG=function(e,n,r,i,s){var a=xf(e[0]),o=xf(e[1]);GI(a,o,n||n===0?n:"auto",r,s)&&(e[0]=Hp(a),e[1]=Hp(o),(i==="log"||i===!0)&&nd('precompile:["'+e[0]+'","'+e[1]+'"]'))},X6e=function(e,n){if(!n)return e;var r=e.match(zv)||[],i=r.length,s="",a,o,l;for(n==="reverse"?(o=i-1,a=-2):(o=((parseInt(n,10)||0)*2+1+i*100)%i,a=2),l=0;lo)for(h=1/(Math.floor(r)+1),f=1;r>o;)a+=(i+(p-i)*h*f).toFixed(2)+","+(s+(y-s)*h*f).toFixed(2)+" ",r--,f++;a+=p+","+y+" ",i=p,s=y}return a},UI=function(e){var n=e[0].match(zv)||[],r=e[1].match(zv)||[],i=r.length-n.length;i>0?e[0]=yG(n,i):e[1]=yG(r,-i)},W6e=function(e){return isNaN(e)?UI:function(n){UI(n),n[1]=X6e(n[1],parseInt(e,10))}},q6e=function(e,n,r){var i=typeof e=="string",s,a;return(!i||V6e.test(e)||(e.match(zv)||[]).length<3)&&(s=Aj(e)[0],s?(a=(s.nodeName+"").toUpperCase(),n&&a!=="PATH"&&(s=xse(s,!1),a="PATH"),e=s.getAttribute(a==="PATH"?"d":"points")||"",s===r&&(e=s.getAttributeNS(null,"data-original")||e)):(nd("WARNING: invalid morph to: "+e),e=!1)),e},xG=function(e){for(var n=e.length,r,i,s,a,o,l,c,u;--n>-1;)for(r=e[n],u=r.cpData=r.cpData||[],u.length=0,c=r.length-2,l=0;lB6e?f:h,sl:c,cl:f0(o*o+l*l)-c,i:r}},AG=function(e){Cl=wse(),Hb=Hb||Cl&&Cl.plugins.morphSVG,Cl&&Hb?(Aj=Cl.utils.toArray,Sse=Cl.core.reverting||function(){},Hb.prototype._tweenRotation=Y6e,Ase=1):e&&nd("Please gsap.registerPlugin(MorphSVGPlugin)")},O1={version:"3.15.0",name:"morphSVG",rawVars:1,register:function(e,n){Cl=e,Hb=n,AG()},init:function(e,n,r,i,s){if(Ase||AG(1),!n)return nd("invalid shape"),!1;_P(n)&&(n=n.call(r,i,e,s));var a,o,l,c,u,f,h,p,y,m,v,b,w,O,k,E,T,N,_,I;if(typeof n=="string"||n.getBBox||n[0])n={shape:n};else if(typeof n=="object"){a={};for(o in n)a[o]=_P(n[o])&&o!=="render"?n[o].call(r,i,e,s):n[o];n=a}var j=e.nodeType?window.getComputedStyle(e):{},L=j.fill+"",B=!(L==="none"||(L.match(zv)||[])[3]==="0"||j.fillRule==="evenodd"),$=n.smooth,z=(n.origin||"50 50").split(",");if($===!0||$==="auto"?$={}:typeof $=="number"&&($={points:$}),a=(e.nodeName+"").toUpperCase(),u=a==="POLYLINE"||a==="POLYGON",a!=="PATH"&&!u&&!n.prop)return nd("Cannot morph a <"+a+"> element. "+vG),!1;if(o=a==="PATH"?"d":"points",!n.prop&&!_P(e.setAttribute))return!1;if(c=q6e(n.shape||n.d||n.points||"",o==="d",e),u&&H6e.test(c))return nd("A <"+a+"> cannot accept path data. "+vG),!1;if(f=n.shapeIndex||n.shapeIndex===0?n.shapeIndex:"auto",h=n.map||O1.defaultMap,this._prop=n.prop,this._render=n.render||O1.defaultRender,this._apply="updateTarget"in n?n.updateTarget:O1.defaultUpdateTarget,this._rnd=Math.pow(10,isNaN(n.precision)?2:+n.precision),this._tween=r,c){if(this._target=e,T=typeof n.precompile=="object",m=this._original=this._prop?e[this._prop]:e.getAttribute(o),!this._prop&&!e.getAttributeNS(null,"data-original")&&e.setAttributeNS(null,"data-original",m),o==="d"||this._prop){if(m=xf(T?n.precompile[0]:m),v=xf(T?n.precompile[1]:c),$){for(w=m.length;--w;)Cse(m[w])&&m.splice(w,1);jP(m,S6({},$,{points:+$.points||Math.max(ZI(m),ZI(v)),maxSegments:v.length})),jP(v,$.redraw===!1?$:S6({},$,{points:m}))}if(!T&&!GI(m,v,f,h,B))return!1;for((n.precompile==="log"||n.precompile===!0)&&nd('precompile:["'+Hp(m)+'","'+Hp(v)+'"]'),_=(n.type||O1.defaultType)!=="linear",I=n.curveMode||_,xG(m),xG(v),_&&(m.size||H2(m),v.size||H2(v),N=bG(z[0]),this._origin=m.origin={x:m.left+N.x*m.width,y:m.top+N.y*m.height},z[1]&&(N=bG(z[1])),this._eOrigin={x:v.left+N.x*v.width,y:v.top+N.y*v.height}),this._rawPath=e._gsRawPath=m,w=m.length;--w>-1;){for(k=m[w],E=v[w],p=k.cpData,y=E.cpData,O=k.length,Vb=0,b=0;b3?b+2:b-2,sa:p[b],ca:kse(y[b]-p[b]),sl:p[b+1],cl:y[b+1]-p[b+1]}:(E[b]!==k[b]&&(l=this.add(k,b,k[b],E[b],0,0,0,0,0,1)),E[b+1]!==k[b+1]&&(l=this.add(k,b+1,k[b+1],E[b+1],0,0,0,0,0,1)||l))}}else l=this.add(e,"setAttribute",e.getAttribute(o)+"",c+"",i,s,0,W6e(f),o);_&&(this.add(this._origin,"x",this._origin.x,this._eOrigin.x,0,0,0,0,0,1),l=this.add(this._origin,"y",this._origin.y,this._eOrigin.y,0,0,0,0,0,1)),l&&(this._props.push("morphSVG"),l.end=$&&$.persist!==!1?Hp(v):c,l.endProp=o)}return 1},render:function(e,n){for(var r=n._rawPath,i=n._controlPT,s=n._anchorPT,a=n._rnd,o=n._target,l=n._pt,c,u,f,h,p,y,m,v,b;l;)l.r(e,l.d),l=l._next;if(e===1&&n._apply)for(l=n._pt;l;)l.end&&(n._prop?o[n._prop]=l.end:o.setAttribute(l.endProp,l.end)),l=l._next;else if(r){for(;s;)p=s.sa+e*s.ca,h=s.sl+e*s.cl,s.t[s.i]=n._origin.x+cG(p)*h,s.t[s.i+1]=n._origin.y+uG(p)*h,s=s._next;for(;i;)f=r[i.j],y=i.i,p=i.sa+e*i.ca,v=uG(p),b=cG(p),h=i.sl+e*i.cl,f[y]=f[i.ai]-b*h,f[y+1]=f[i.ai+1]-v*h,i=i._next;if(!e&&Sse()&&(r=xf(n._original)),o._gsRawPath=r,n._apply){for(c="",u=" ",m=0;m"u"||(window.__playerStore=t)}function Ese(t){return Number.isFinite(t)&&t>0}function wG(t,e){const n=Math.max(0,Number.isFinite(e)?e:0),r=Math.max(0,Number.isFinite(t)?t:0);return n>0?Math.min(r,n):r}function O4(t){if(!t)return 0;try{const e=Number(t.getDuration());return Ese(e)?e:0}catch{return 0}}function tCe(t){return{now:()=>t.performance.now(),requestAnimationFrame:e=>t.requestAnimationFrame(e),cancelAnimationFrame:e=>t.cancelAnimationFrame(e)}}function nCe(t,e,n,r=()=>1){var p;const i=Math.max(0,Number.isFinite(e)?e:0);let s=wG(Number(((p=t.getTime)==null?void 0:p.call(t))??0),i),a=!1,o=0,l=s,c=n.now();const u=y=>{var m;if(s=wG(y,i),typeof t.renderSeek=="function"){t.renderSeek(s);return}(m=t.seek)==null||m.call(t,s)},f=()=>{o&&(n.cancelAnimationFrame(o),o=0)},h=y=>{if(!a)return;const m=Math.max(.1,Number(r())||1),v=(y-c)/1e3*m;if(u(l+v),s>=i){a=!1,o=0;return}o=n.requestAnimationFrame(h)};return{play:()=>{a||i<=0||(s>=i&&u(0),a=!0,l=s,c=n.now(),f(),o=n.requestAnimationFrame(h))},pause:()=>{a=!1,f()},seek:(y,m)=>{if(u(y),m!=null&&m.keepPlaying){a&&(l=s,c=n.now());return}a=!1,f()},getTime:()=>s,getDuration:()=>i,isPlaying:()=>a}}function jO(t,e){var n;(n=t.current)==null||n.adapter.pause(),t.current=null,e.current=!1}function rCe(t){const{cache:e,warned:n,bestAdapter:r,effectiveDuration:i,docDuration:s}=t,a=e.current;if((a==null?void 0:a.player)===r&&a.duration===i)return a.adapter;a==null||a.adapter.pause(),n.current||(n.current=!0,console.warn(`[useTimelinePlayer] Selected adapter duration (${O4(r)}s) does not cover the document duration (${s}s); falling back to seek-driven playback, which never starts media elements or WebAudio. Audio will not play in preview — extend the GSAP timeline to cover the declared data-duration.`));const o=nCe(r,i,t.clock,t.getPlaybackRate);return e.current={player:r,duration:i,adapter:o},o}function OG(t){return{play:()=>t.play(),pause:()=>t.pause(),seek:(e,n)=>{const r=!(n!=null&&n.keepPlaying);r&&t.pause(),t.seek(e),r&&t.pause()},getTime:()=>t.time(),getDuration:()=>t.duration(),isPlaying:()=>t.isActive()}}function Tse(t,e,n,r,i){if(!(!n||n.startsWith("#")||n.startsWith("[data-composition-id=")))try{const s=r??"index.html",o=Array.from(t.querySelectorAll(n)).filter(l=>(i(l)??"index.html")===s).indexOf(e);return o>=0?o:void 0}catch{return}}const Ws="data-fx-chain",Pse=Ws.slice(5),h0=1,Xx=(t="frequency",e="Frequency",n=1e3,r=20,i=2e4)=>({kind:"number",key:t,label:e,unit:"Hz",min:r,max:i,step:1,default:n,scale:"log",automatable:!0}),LP=(t=.707,e="Bandwidth — higher is narrower.")=>({kind:"number",key:"q",label:"Q",unit:"",min:.1,max:20,step:.01,default:t,scale:"log",automatable:!0,hint:e}),LO=(t=-40,e=40,n=0)=>({kind:"number",key:"gain",label:"Gain",unit:"dB",min:t,max:e,step:.1,default:n,automatable:!0}),CG={kind:"enum",key:"poles",label:"Slope",options:[{value:"1",label:"6 dB/oct"},{value:"2",label:"12 dB/oct"}],default:"2",hint:"Two poles is the usual biquad; one pole is gentler."},nS=[{id:"gain",label:"Gain",group:"dynamics",description:"Raise or lower the whole signal. Automate it to duck under something else.",params:[LO(-60,12,0)],web:"gain-node"},{id:"peaking",label:"Peaking EQ",group:"filter",description:"Boost or cut a band, leaving everything either side alone.",params:[Xx("frequency","Frequency",1e3),LO(-40,40,0),LP(1)],web:"biquad-peaking"},{id:"lowshelf",label:"Low Shelf",group:"filter",description:"Lift or drop everything below the corner frequency.",params:[Xx("frequency","Frequency",200,20,2e3),LO(-40,40,0)],web:"biquad-lowshelf"},{id:"highshelf",label:"High Shelf",group:"filter",description:"Lift or drop everything above the corner frequency.",params:[Xx("frequency","Frequency",4e3,500,2e4),LO(-40,40,0)],web:"biquad-highshelf"},{id:"highpass",label:"High-pass",group:"filter",description:"Remove low frequencies — the usual fix for rumble on a voice.",params:[Xx("frequency","Cutoff",300,20,2e4),LP(.707),CG],web:"biquad-highpass"},{id:"lowpass",label:"Low-pass",group:"filter",description:"Remove high frequencies — darkens or muffles a track.",params:[Xx("frequency","Cutoff",8e3,100,2e4),LP(.707),CG],web:"biquad-lowpass"},{id:"compressor",label:"Compressor",group:"dynamics",description:"Pull loud parts down so the quiet ones can come up.",params:[{kind:"number",key:"threshold",label:"Threshold",unit:"dB",min:-60,max:0,step:.5,default:-24,hint:"Level above which the compressor starts working."},{kind:"number",key:"ratio",label:"Ratio",unit:":1",min:1,max:20,step:.1,default:4},{kind:"number",key:"attack",label:"Attack",unit:"ms",min:.01,max:2e3,step:.1,default:20,scale:"log"},{kind:"number",key:"release",label:"Release",unit:"ms",min:.01,max:9e3,step:1,default:250,scale:"log"},{kind:"number",key:"knee",label:"Knee",unit:"",min:1,max:8,step:.01,default:2.83,hint:"1 is a hard corner; higher eases into it."},{kind:"number",key:"makeup",label:"Makeup",unit:"dB",min:0,max:36,step:.1,default:0},{kind:"number",key:"mix",label:"Mix",unit:"",min:0,max:1,step:.01,default:1,hint:"Below 1 blends the dry signal back in."}],web:"worklet-compressor"},{id:"limiter",label:"Limiter",group:"dynamics",description:"Hard ceiling — nothing gets past the limit.",params:[{kind:"number",key:"limit",label:"Ceiling",unit:"dB",min:-24,max:0,step:.1,default:-1},{kind:"number",key:"attack",label:"Attack",unit:"ms",min:.1,max:80,step:.1,default:5},{kind:"number",key:"release",label:"Release",unit:"ms",min:1,max:8e3,step:1,default:50,scale:"log"},{kind:"number",key:"level_out",label:"Output",unit:"dB",min:-24,max:24,step:.1,default:0}],web:"worklet-limiter"},{id:"gate",label:"Noise Gate",group:"dynamics",description:"Silence the track when it drops below the threshold.",params:[{kind:"number",key:"threshold",label:"Threshold",unit:"dB",min:-80,max:0,step:.5,default:-35},{kind:"number",key:"range",label:"Range",unit:"dB",min:-80,max:0,step:.5,default:-24,hint:"How far down the gate pulls when closed."},{kind:"number",key:"ratio",label:"Ratio",unit:":1",min:1,max:20,step:.1,default:10},{kind:"number",key:"attack",label:"Attack",unit:"ms",min:.01,max:9e3,step:.1,default:1,scale:"log"},{kind:"number",key:"release",label:"Release",unit:"ms",min:.01,max:9e3,step:1,default:100,scale:"log"},{kind:"number",key:"knee",label:"Knee",unit:"",min:1,max:8,step:.01,default:2.83}],web:"worklet-gate"},{id:"saturate",label:"Saturation",group:"nonlinear",description:"Soft-clip the waveform for warmth or outright distortion.",params:[{kind:"enum",key:"type",label:"Curve",options:[{value:"tanh",label:"Tanh"},{value:"atan",label:"Arctan"},{value:"cubic",label:"Cubic"},{value:"exp",label:"Exponential"},{value:"alg",label:"Algebraic"},{value:"quintic",label:"Quintic"},{value:"sin",label:"Sine"},{value:"erf",label:"Error function"},{value:"hard",label:"Hard clip"}],default:"tanh"},{kind:"number",key:"threshold",label:"Threshold",unit:"dB",min:-40,max:0,step:.1,default:-6},{kind:"number",key:"output",automatable:!0,label:"Output",unit:"dB",min:-24,max:24,step:.1,default:0},{kind:"number",key:"oversample",label:"Oversample",unit:"x",min:1,max:8,step:1,default:4,hint:"Higher costs more but keeps aliasing down."}],web:"waveshaper"},{id:"bitcrush",label:"Bitcrush",group:"nonlinear",description:"Drop bit depth and sample rate for a lo-fi, digital sound.",params:[{kind:"number",key:"bits",label:"Bit depth",unit:"bit",min:1,max:32,step:.1,default:8},{kind:"number",key:"samples",label:"Sample hold",unit:"x",min:1,max:250,step:1,default:1,hint:"Repeats each sample N times — a crude downsample."},{kind:"number",key:"mix",label:"Mix",unit:"",min:0,max:1,step:.01,default:1}],web:"worklet-bitcrush"},{id:"pitchshift",label:"Pitch shift",group:"time",description:"Shifts pitch up or down without changing playback speed. Adds ~50 ms of latency.",params:[{kind:"number",key:"semitones",label:"Semitones",unit:"st",min:-12,max:12,step:1,default:0},{kind:"number",key:"mix",label:"Mix",unit:"",min:0,max:1,step:.01,default:1}],web:"worklet-pitchshift"},{id:"delay",label:"Delay",group:"time",description:"Repeating echoes behind the dry signal.",params:[{kind:"number",key:"time",automatable:!0,label:"Time",unit:"ms",min:1,max:5e3,step:1,default:250,scale:"log"},{kind:"number",key:"feedback",automatable:!0,label:"Feedback",unit:"",min:.01,max:.95,step:.01,default:.35},{kind:"number",key:"mix",automatable:!0,label:"Mix",unit:"",min:0,max:1,step:.01,default:.4}],web:"delay-feedback"},{id:"chorus",label:"Chorus",group:"time",description:"Detuned copies of the signal for width and thickness.",params:[{kind:"number",key:"delay",automatable:!0,label:"Delay",unit:"ms",min:1,max:100,step:.1,default:7},{kind:"number",key:"depth",automatable:!0,label:"Depth",unit:"ms",min:0,max:10,step:.01,default:2},{kind:"number",key:"speed",automatable:!0,label:"Rate",unit:"Hz",min:.01,max:10,step:.01,default:1},{kind:"number",key:"mix",automatable:!0,label:"Mix",unit:"",min:0,max:1,step:.01,default:.5}],web:"chorus-lfo"},{id:"phaser",label:"Phaser",group:"time",description:"Sweeping notches moving through the spectrum.",params:[{kind:"number",key:"in_gain",automatable:!0,label:"Input",unit:"",min:0,max:1,step:.01,default:.4},{kind:"number",key:"out_gain",automatable:!0,label:"Output",unit:"",min:0,max:2,step:.01,default:.74},{kind:"number",key:"delay",label:"Delay",unit:"ms",min:.1,max:5,step:.1,default:3},{kind:"number",key:"decay",label:"Decay",unit:"",min:0,max:.99,step:.01,default:.4},{kind:"number",key:"speed",automatable:!0,label:"Rate",unit:"Hz",min:.1,max:2,step:.01,default:.5},{kind:"enum",key:"type",label:"Waveform",options:[{value:"0",label:"Triangular"},{value:"1",label:"Sinusoidal"}],default:"0"}],web:"allpass-phaser"},{id:"reverb",label:"Reverb",group:"time",description:"Room tail. Both ends convolve the same generated impulse, so preview matches render.",params:[{kind:"number",key:"size",label:"Room size",unit:"",min:.05,max:1,step:.01,default:.7},{kind:"number",key:"damping",label:"Damping",unit:"",min:0,max:1,step:.01,default:.5,hint:"Higher rolls the top off the tail faster."},{kind:"number",key:"wet",automatable:!0,label:"Wet",unit:"",min:0,max:1,step:.01,default:.35},{kind:"number",key:"dry",automatable:!0,label:"Dry",unit:"",min:0,max:1,step:.01,default:.7}],web:"convolver"}],dE=new Map(nS.map(t=>[t.id,t]));function rS(t){return dE.get(t)}nS.map(t=>t.id);function $f(t){const e=dE.get(t);if(!e)return{};const n={};for(const r of e.params)n[r.key]=r.default;return n}function zd(t,e){const n=dE.get(t);if(!n)return{};const r={};for(const i of n.params){const s=e==null?void 0:e[i.key];if(i.kind==="enum"){const o=i.options.some(l=>l.value===s);r[i.key]=o?s:i.default;continue}const a=typeof s=="number"?s:typeof s=="string"&&s.trim()!==""?Number(s):Number.NaN;r[i.key]=Number.isFinite(a)?Math.min(i.max,Math.max(i.min,a)):i.default}return r}class C1 extends Error{constructor(e){super(e),this.name="AudioFxChainError"}}function pE(t){let e;try{e=JSON.parse(t)}catch(i){throw new C1(`Chain file is not valid JSON: ${i.message}`)}if(typeof e!="object"||e===null)throw new C1("Chain file must be a JSON object.");const n=e;if(n.version!==h0)throw new C1(`Unsupported chain version: ${String(n.version)}`);if(!Array.isArray(n.nodes))throw new C1("Chain file is missing a `nodes` array.");const r=n.nodes.map(sCe);return{version:h0,nodes:r}}function iCe(t){return t.nodes.filter(e=>e.enabled!==!1)}function xu(t){return JSON.stringify({version:h0,nodes:t.nodes.map(aCe)})}function dy(t){const e=new Set(t.nodes.map(n=>n.id).filter(Boolean));for(let n=1;;n+=1){const r=`n${n}`;if(!e.has(r))return r}}function sCe(t,e){if(typeof t!="object"||t===null)throw new C1(`Node ${e} is not an object.`);const n=t;if(typeof n.type!="string"||!dE.has(n.type))throw new C1(`Node ${e} has unknown effect type: ${String(n.type)}`);return Nse({type:n.type,id:rd(n.id),fromCarve:O6(n.fromCarve),fromPreset:rd(n.fromPreset),label:rd(n.label),fromEq:rd(n.fromEq),fromLeveller:O6(n.fromLeveller),presetAmount:Mse(n.presetAmount),enabled:n.enabled!==!1,params:zd(n.type,n.params??void 0)})}function aCe(t){return Nse({type:t.type,id:rd(t.id),fromCarve:O6(t.fromCarve),fromPreset:rd(t.fromPreset),label:rd(t.label),fromEq:rd(t.fromEq),fromLeveller:O6(t.fromLeveller),presetAmount:t.presetAmount===1?void 0:Mse(t.presetAmount),enabled:t.enabled===!1?!1:void 0,params:zd(t.type,t.params)})}function rd(t){return typeof t=="string"&&t?t:void 0}function O6(t){return t===!0?!0:void 0}function Mse(t){if(!(typeof t!="number"||!Number.isFinite(t)))return Math.min(1,Math.max(0,t))}function Nse(t){for(const e of Object.keys(t))t[e]===void 0&&delete t[e];return t}const XI="data-hf-render-id",oCe="data-hf-group-render-id",Oj=12,Dse=10**(Oj/20),md=-100,Og=100,Ise=-60;function Cj(t){return Number.isFinite(t)?Math.max(0,Math.min(Dse,t)):1}function _se(t){return Cj(t).toFixed(6).replace(/\.?0+$/,"")}function WI(t){const e=Math.max(md,Math.min(Og,t));return e===md?0:10**((e<0?e/Math.abs(md)*Math.abs(Ise):e/Og*Oj)/20)}function Rse(t){const e=Cj(t);if(e===0)return md;const n=20*Math.log10(e),r=n<0?n/Math.abs(Ise)*Math.abs(md):n/Oj*Og;return Math.max(md,Math.min(Og,r))}function qI(t){const e=Cj(t);if(e===0)return"-∞ dB";const n=20*Math.log10(e),r=Math.abs(n)<.05?0:n;return(r>0?"+":"")+r.toFixed(1)+" dB"}const so="data-automation",jse=so.slice(5),mE=1,Lse=512;class vp extends Error{constructor(e){super(e),this.name="AudioAutomationError"}}const Q2="volume";function py(t){if(t===Q2)return{kind:"volume"};const e=t.split(".");if(e.length===3&&e[0]==="fx"&&e[1]===Fse){const i=e[2];return i?{kind:"preset",presetId:i}:null}if(e.length!==3||e[0]!=="fx")return null;const[,n,r]=e;return!n||!r?null:{kind:"fx",nodeId:n,param:r}}function Ed(t,e){return`fx.${t}.${e}`}const Fse="preset";function FP(t){return`fx.${Fse}.${t}`}const lCe={min:0,max:1,step:.01,unit:"",label:"Amount",scale:"linear",default:1},$se={min:0,max:Dse,step:.01,unit:"",label:"Volume",scale:"linear",default:1};function d0(t,e){const n=py(t);if(!n)return null;if(n.kind==="volume")return $se;if(n.kind==="preset")return(e==null?void 0:e.nodes.some(o=>o.fromPreset===n.presetId))?{...lCe,label:`${n.presetId} · Amount`}:null;const r=e==null?void 0:e.nodes.find(a=>a.id===n.nodeId);if(!r)return null;const i=rS(r.type),s=i==null?void 0:i.params.find(a=>a.key===n.param);return!s||s.kind!=="number"?null:{min:s.min,max:s.max,step:s.step,unit:s.unit,label:`${(i==null?void 0:i.label)??r.type} · ${s.label}`,scale:s.scale==="log"&&s.min>0?"log":"linear",default:s.default}}function Gv(t){if(typeof t=="number")return Number.isFinite(t)?t:null;if(typeof t=="string"&&t.trim()!==""){const e=Number(t);return Number.isFinite(e)?e:null}return null}function cCe(t){const e=Gv(t);return e===null||e===0?0:Math.min(1,Math.max(-1,e))}function kj(t,e){const n=Gv(t),r=Gv(e);if(n===null||r===null)return null;const i=o=>Math.min(.999,Math.max(.001,o)),s=i(n),a=i(r);return Math.abs(s-a)<1e-6?null:{x:s,y:a}}function uCe(t,e){const n=kj(t,e);return n?{viaX:n.x,viaY:n.y}:null}function fCe(t){const e=cCe(t==null?void 0:t.curve),n=kj(t==null?void 0:t.viaX,t==null?void 0:t.viaY);return{...e?{curve:e}:{},...n?{viaX:n.x,viaY:n.y}:{}}}function hCe(t,e){const n=Gv(t==null?void 0:t.t),r=Gv(t==null?void 0:t.v);if(n===null||r===null)return null;const i=e?Math.min(e.max,Math.max(e.min,r)):r;return{t:Math.max(0,n),v:i,...fCe(t)}}function Bse(t,e){const n=t.map(i=>hCe(i,e)).filter(i=>i!==null).sort((i,s)=>i.t-s.t),r=[];for(const i of n)r.length>0&&r[r.length-1].t===i.t?r[r.length-1]=i:r.push(i);return r.slice(0,Lse)}function dCe(t){const e=[];for(const n of t.lanes){if(!py(n.target))continue;const r=n.target===Q2?$se:null,i=Bse(n.points??[],r);i.length>0&&e.push({target:n.target,points:i})}return{version:mE,lanes:e}}function Vse(t,e){const n=[];for(const r of t.lanes){const i=d0(r.target,e);if(!i)continue;const s=Bse(r.points,i);s.length>0&&n.push({target:r.target,points:s})}return{version:mE,lanes:n}}function Hse(t){let e;try{e=JSON.parse(t)}catch(i){throw new vp(`Automation is not valid JSON: ${i.message}`)}if(typeof e!="object"||e===null)throw new vp("Automation must be a JSON object.");const n=e;if(n.version!==mE)throw new vp(`Unsupported automation version: ${String(n.version)}`);if(!Array.isArray(n.lanes))throw new vp("Automation is missing a `lanes` array.");const r=n.lanes.map((i,s)=>{if(typeof i!="object"||i===null)throw new vp(`Lane ${s} is not an object.`);const a=i;if(typeof a.target!="string"||!py(a.target))throw new vp(`Lane ${s} has an unreadable target: ${String(a.target)}`);if(!Array.isArray(a.points))throw new vp(`Lane ${s} is missing a \`points\` array.`);return{target:a.target,points:a.points}});return dCe({lanes:r})}function Qse(t){return JSON.stringify({version:mE,lanes:t.lanes.map(e=>({target:e.target,points:e.points.map(n=>({t:n.t,v:n.v,...n.curve?{curve:n.curve}:{},...n.viaX!==void 0&&n.viaY!==void 0?{viaX:n.viaX,viaY:n.viaY}:{}}))}))})}function pCe(t,e){return e?Math.pow(t,Math.pow(2,2*e)):t}function mCe(t,e){const n=t-.5,r=e-.5,i=.999,s=1e6,a=n>0?n/(i-t):n<0?-n/(t-(1-i)):0,o=r>0?r/(i-e):r<0?-r/(e-(1-i)):0,l=Math.min(s,Math.max(1,a,o));return{cx:t+n/l,cy:e+r/l,w:l}}function gCe(t,e,n){const{cx:r,cy:i,w:s}=mCe(e,n),a=2-2*s,o=t*a-1+2*s*r,l=-t*a-2*s*r,c=yCe(o,l,t),u=1-c,f=u*u+2*s*c*u+c*c;return f>0?(2*s*i*c*u+c*c)/f:t}function yCe(t,e,n){if(Math.abs(t)<1e-12)return Math.abs(e)<1e-12?n:-n/e;const r=Math.sqrt(Math.max(0,e*e-4*t*n)),i=(-e+r)/(2*t),s=(-e-r)/(2*t),a=o=>o>=-1e-9&&o<=1+1e-9;return a(i)?Math.min(1,Math.max(0,i)):a(s)?Math.min(1,Math.max(0,s)):n}function xCe(t,e){const n=kj(e.viaX,e.viaY);return n?gCe(Math.min(1,Math.max(0,t)),n.x,n.y):pCe(t,e.curve)}function bCe(t,e,n,r){return r==="log"&&t>0&&e>0?Math.exp(Math.log(t)+(Math.log(e)-Math.log(t))*n):t+(e-t)*n}function Bf(t,e,n="linear"){const r=t.points;if(r.length===0)return 0;const i=r[0];if(e<=i.t)return i.v;const s=r[r.length-1];if(e>=s.t)return s.v;let a=0,o=r.length-1;for(;o-a>1;){const f=a+o>>1;r[f].t<=e?a=f:o=f}const l=r[a],c=r[o],u=c.t-l.t;return u<=0?c.v:bCe(l.v,c.v,xCe((e-l.t)/u,l),n)}const ya="hf-audio-group",Go="data-audio-group";function vCe(t){const e=t==null?void 0:t.getAttribute("data-volume"),n=e?parseFloat(e):1;return Number.isFinite(n)?n:1}function ACe(t,e,n){const r=n==null?void 0:n.getAttribute(Ws),i=n==null?void 0:n.getAttribute(so);return{id:t,label:(n==null?void 0:n.getAttribute("data-label"))||t,memberIds:e,...r?{fxChain:r}:{},...i?{automation:i}:{},volume:vCe(n),hidden:(n==null?void 0:n.hasAttribute("data-hidden"))??!1}}function SCe(t,e){var i,s;const n=Array.from(((i=t==null?void 0:t.querySelectorAll)==null?void 0:i.call(t,`${ya}[${XI}]`))??[]).find(a=>a.getAttribute(XI)===e);if(n)return n;const r=(t==null?void 0:t.getElementById(e))??null;return r&&((s=r.tagName)==null?void 0:s.toLowerCase())===ya?r:null}function Zd(t){const e=new Map;for(const i of t.querySelectorAll(`audio[${Go}]`)){const s=i.getAttribute(oCe)??i.getAttribute(Go);if(!s||!i.id)continue;const a=e.get(s);a?a.push(i.id):e.set(s,[i.id])}const n=new Map;for(const i of t.querySelectorAll(ya)){const s=i.getAttribute(XI)??i.id;s&&n.set(s,i)}const r=[];for(const[i,s]of e)r.push(ACe(i,s,n.get(i)));return r}function zse(t,e){const n=new Map(Zd(t).map(a=>[a.id,a])),r=new Set,i=[],s=a=>{r.has(a)||(r.add(a),i.push(a))};for(const a of e){const o=n.get(a);o?o.memberIds.forEach(s):t.getElementById(a)&&!SCe(t,a)&&s(a)}return i}const Vf="data-hf-reveal-prior-z",p0="data-hf-reveal-prior-pos";function Ej(t){const e=t.getAttribute(Vf);if(e==null)return null;const n=Number.parseInt(e,10);return Number.isFinite(n)?n:null}function gE(t){var a,o;const e=Ej(t);if(e!=null)return e;const n=t,r=l=>{if(l==null||l===""||l==="auto")return null;const c=Number.parseInt(l,10);return Number.isFinite(c)?c:null},i=r((a=n.style)==null?void 0:a.zIndex);if(i!=null)return i;const s=(o=t.ownerDocument)==null?void 0:o.defaultView;if(s!=null&&s.getComputedStyle){const l=r(s.getComputedStyle(n).zIndex);if(l!=null)return l}return 0}function Zse(t){if(!t)return 0;const e=Number.parseFloat(t.getAttribute("data-duration")??"")||Number.parseFloat(t.getAttribute("data-hf-authored-duration")??"");return Ese(e)?e:0}function Gse(t){return Number.isFinite(t)&&t>0?Math.max(.1,Math.min(5,t)):1}function yE(t){return t.tagName.toLowerCase()===ya?!0:!!t.closest(["[data-hyperframes-ignore]","[data-hyperframes-picker-ignore]","[data-hf-ignore]","[data-hf-color-grading-canvas]"].join(","))}function Tj(t){if(!t)return 0;const e=t.querySelector("[data-composition-id]");let n=0;for(const r of Array.from(t.querySelectorAll("[data-start]"))){if(r===e||yE(r))continue;const i=Number.parseFloat(r.getAttribute("data-start")??""),s=Zse(r);!Number.isFinite(i)||i<0||s<=0||(n=Math.max(n,i+s))}return n}function Use(t){if(!t)return 0;const e=Zse(t.querySelector("[data-composition-id]"));return e>0?e:Tj(t)}function Pj(t){return t?Tj(new DOMParser().parseFromString(t,"text/html")):0}function YI(t){var n;const e=((n=t.ownerDocument.defaultView)==null?void 0:n.HTMLElement)??globalThis.HTMLElement;return typeof e<"u"&&t instanceof e}function Xse(t){const e=t.ownerDocument.defaultView??window,n=e.HTMLMediaElement??globalThis.HTMLMediaElement,r=e.HTMLImageElement??globalThis.HTMLImageElement;if(t instanceof n||t instanceof r)return t;const i=t.querySelector("video, audio, img");return i instanceof n||i instanceof r?i:null}function wCe(t,e){const n=e.getAttribute("data-playback-start"),r=e.getAttribute("data-media-start"),i=n??r;if(i!=null){const a=parseFloat(i);Number.isFinite(a)&&(t.playbackStart=a)}n!=null?t.playbackStartAttr="playback-start":r!=null&&(t.playbackStartAttr="media-start");const s=Number.parseFloat(e.getAttribute("data-playback-rate")??"");Number.isFinite(s)&&s>0&&(t.playbackRate=Gse(s))}function Wse(t,e){wCe(t,e);const n=Xse(e);if(!n)return;t.tag=n.tagName.toLowerCase();const r=n.getAttribute("src");r&&(t.src=r);const s=(n.ownerDocument.defaultView??window).HTMLMediaElement??globalThis.HTMLMediaElement;if(typeof s>"u"||!(n instanceof s))return;const a=e.getAttribute("data-source-duration")??n.getAttribute("data-source-duration"),o=a?parseFloat(a):n.duration;Number.isFinite(o)&&o>0&&(t.sourceDuration=o);const l=n.defaultPlaybackRate;t.playbackRate==null&&Number.isFinite(l)&&l>0&&(t.playbackRate=Gse(l))}function iS(t){var i,s,a;const e=(i=t.label)==null?void 0:i.trim();if(e)return e;const n=(s=t.id)==null?void 0:s.trim();if(n)return n;const r=(a=t.tag)==null?void 0:a.trim().toLowerCase();return r?`${r} clip`:"Timeline clip"}const OCe=new Set(["base","link","meta","noscript","script","style","template"]);function kG(t){return t.trim().replace(/[_-]+/g," ").replace(/\s+/g," ").replace(/\b\w/g,e=>e.toUpperCase())}function CCe(t){const e=t.getAttribute("data-timeline-label")??t.getAttribute("data-label")??t.getAttribute("aria-label");if(e!=null&&e.trim())return e.trim();if(t.id.trim())return kG(t.id);const n=t.className.split(/\s+/).filter(Boolean),r=n.find(i=>i!=="clip")??n[0];return r?kG(r):iS({tag:t.tagName})}function m0(t){if(YI(t)&&t.id)return`#${CSS.escape(t.id)}`;const e=t.getAttribute("data-composition-id");if(e)return`[data-composition-id="${CSS.escape(e)}"]`;if(YI(t)){const n=t.className.split(/\s+/).filter(Boolean),r=n.find(i=>i!=="clip")??n[0];if(r)return`.${CSS.escape(r)}`}}function g0(t){var n;const e=(n=t.parentElement)==null?void 0:n.closest("[data-composition-id]");return(e==null?void 0:e.getAttribute("data-composition-file"))??(e==null?void 0:e.getAttribute("data-composition-src"))??void 0}function Uv(t,e,n){return Tse(t,e,n,g0(e),g0)}function Xv(t){const e=t.sourceFile??"index.html";return t.domId?`${e}#${t.domId}`:t.selector?`${e}:${t.selector}:${t.selectorIndex??0}`:`${e}:${t.id}:${t.fallbackIndex}`}function C6(t){const e=t.lastIndexOf("#");return e<0?{sourceFile:null,domId:t}:{sourceFile:t.slice(0,e),domId:t.slice(e+1)}}function Wv(t){var r;const e=((r=t.preferredId)==null?void 0:r.trim())||Xv({id:t.label,fallbackIndex:t.fallbackIndex,domId:t.domId,selector:t.selector,selectorIndex:t.selectorIndex,sourceFile:t.sourceFile}),n=Xv({id:e,fallbackIndex:t.fallbackIndex,domId:t.domId,selector:t.selector,selectorIndex:t.selectorIndex,sourceFile:t.sourceFile});return{id:e,key:n}}function Zn(t){return t.key??t.id}function k6(t){return t.domId||null}function q1(t){if(!(!t.domId&&!t.selector))return Xv({id:"",fallbackIndex:0,...t})}function kCe(t){const e=t.querySelector("[data-composition-id]");return Array.from(t.querySelectorAll("[data-start]")).filter(n=>n!==e&&!yE(n))}function ECe(t,e){return Math.abs(t-e)<.001}const TCe=[["data-start",t=>t.start],["data-duration",t=>t.duration],["data-track-index",t=>t.track]];function PCe(t,e){var r;const n=(r=e.tagName)==null?void 0:r.toLowerCase();return n&&t.tagName.toLowerCase()!==n?!1:TCe.every(([i,s])=>{const a=Number.parseFloat(t.getAttribute(i)??"");return!Number.isFinite(a)||ECe(a,s(e))})}function MCe(t,e){return t.getElementById(e)??t.querySelector(`[data-composition-id="${CSS.escape(e)}"]`)??t.querySelector(`.${CSS.escape(e)}`)??null}function NCe(t,e,n,r=new Set){const i=e.id?MCe(t,e.id):null;if(i&&!r.has(i))return i;const s=kCe(t).filter(o=>!r.has(o)),a=s.find(o=>PCe(o,e));return a||(s[n]??null)}function DCe(t,e){if(!YI(e)||yE(e)||e.parentElement!==t)return!1;const n=e.tagName.toLowerCase();return OCe.has(n)||e.hasAttribute("data-start")||e.hasAttribute("data-track-index")?!1:!!m0(e)}function ICe(t,e,n){return n?e&&t.has(e)?new Set(t):new Set:e?new Set([e]):new Set}function _Ce(t,e){return!t||e===null?!1:t.elementKey===C6(e).domId}const qse="hf-studio-ui-preferences";function EG(t){return typeof t=="object"&&t!==null}function Yse(){if(typeof window>"u")return null;try{return window.localStorage}catch{return null}}function Kse(t){if(!t)return{};try{const e=t.getItem(qse);if(!e)return{};const n=JSON.parse(e);if(!EG(n))return{};const r={};if(typeof n.leftCollapsed=="boolean"&&(r.leftCollapsed=n.leftCollapsed),typeof n.leftWidth=="number"&&Number.isFinite(n.leftWidth)&&(r.leftWidth=n.leftWidth),typeof n.rightWidth=="number"&&Number.isFinite(n.rightWidth)&&(r.rightWidth=n.rightWidth),typeof n.timelineVisible=="boolean"&&(r.timelineVisible=n.timelineVisible),typeof n.timelineHeight=="number"&&Number.isFinite(n.timelineHeight)&&(r.timelineHeight=n.timelineHeight),typeof n.playbackRate=="number"&&Number.isFinite(n.playbackRate)&&(r.playbackRate=n.playbackRate),typeof n.audioMuted=="boolean"&&(r.audioMuted=n.audioMuted),typeof n.audioVolume=="number"&&Number.isFinite(n.audioVolume)&&n.audioVolume>=0&&n.audioVolume<=1&&(r.audioVolume=n.audioVolume),n.thumbnailMode==="adaptive"||n.thumbnailMode==="hidden"?r.thumbnailMode=n.thumbnailMode:typeof n.thumbnailsEnabled=="boolean"&&(r.thumbnailMode=n.thumbnailsEnabled?"adaptive":"hidden"),EG(n.previewZoom)){const{zoomPercent:i,panX:s,panY:a}=n.previewZoom;typeof i=="number"&&Number.isFinite(i)&&typeof s=="number"&&Number.isFinite(s)&&typeof a=="number"&&Number.isFinite(a)&&(r.previewZoom={zoomPercent:i,panX:s,panY:a})}return Array.isArray(n.recentBlocks)&&(r.recentBlocks=n.recentBlocks.filter(i=>typeof i=="string")),typeof n.snapEnabled=="boolean"&&(r.snapEnabled=n.snapEnabled),typeof n.gridVisible=="boolean"&&(r.gridVisible=n.gridVisible),typeof n.gridSpacing=="number"&&Number.isFinite(n.gridSpacing)&&(r.gridSpacing=n.gridSpacing),typeof n.snapToGrid=="boolean"&&(r.snapToGrid=n.snapToGrid),typeof n.timelineSnapEnabled=="boolean"&&(r.timelineSnapEnabled=n.timelineSnapEnabled),(n.timeDisplayMode==="time"||n.timeDisplayMode==="frame")&&(r.timeDisplayMode=n.timeDisplayMode),(n.timelineZoomMode==="fit"||n.timelineZoomMode==="manual")&&(r.timelineZoomMode=n.timelineZoomMode),typeof n.timelineManualZoomPercent=="number"&&Number.isFinite(n.timelineManualZoomPercent)&&(r.timelineManualZoomPercent=n.timelineManualZoomPercent),typeof n.agentToolsEnabled=="boolean"&&(r.agentToolsEnabled=n.agentToolsEnabled),r}catch{return{}}}function no(t=Yse()){return Kse(t)}function kl(t,e=Yse()){if(e)try{const n={...Kse(e),...t};e.setItem(qse,JSON.stringify(n))}catch{}}const Jse=10,RCe=48,jCe=.5,LCe=2,FCe=.014;function Mj(t){if(!Number.isFinite(t)||t<=0)return 100;const e=Qd*RCe;return Math.max(100,Math.round(e/t*100))}function B0(t,e){if(!Number.isFinite(t))return 100;const n=Mj(e);return Math.max(Jse,Math.min(n,Math.round(t)))}function xE(t,e,n){return t==="fit"?100:B0(e,n)}function $Ce(t,e){return!Number.isFinite(t)||t<=0||!Number.isFinite(e)||e<=0?100:B0(t/e*100,e)}function BCe(t,e,n){if(!Number.isFinite(t)||t<=0)return 100;const r=xE(e,n,t);return e==="fit"?t:t*(r/100)}function TG(t,e,n,r){const i=xE(e,n,r),s=t==="in"?i*LCe:i*jCe;return B0(s,r)}function VCe(t,e,n,r){const i=xE(e,n,r);return!Number.isFinite(t)||t===0?i:B0(i*Math.exp(-t*FCe),r)}const E6=Math.log(Jse);function HCe(t,e){const n=B0(t,e),r=Math.log(Mj(e));return(Math.log(n)-E6)/(r-E6)*100}function QCe(t,e){const n=Math.max(0,Math.min(100,t)),r=Math.log(Mj(e)),i=E6+n/100*(r-E6);return B0(Math.exp(i),e)}function KI(t,e){return t.projectId===e.timelineProjectId&&t.sessionEpoch===e.timelineSessionEpoch}function eae(t,e){return t.projectId===e.timelineProjectId&&t.sessionEpoch===e.timelineSessionEpoch&&t.elementId===e.selectedElementId}function zCe(t,e){return{selectedKeyframes:new Set,toggleSelectedKeyframe:n=>t(r=>{const i=new Set(r.selectedKeyframes);return i.has(n)?i.delete(n):i.add(n),{selectedKeyframes:i}}),clearSelectedKeyframes:()=>t({selectedKeyframes:new Set}),expandedClipIds:new Set,toggleClipExpanded:n=>t(r=>{const i=new Set(r.expandedClipIds);return i.has(n)?i.delete(n):i.add(n),{expandedClipIds:i}}),setClipExpanded:(n,r)=>t(i=>{if(i.expandedClipIds.has(n)===r)return i;const s=new Set(i.expandedClipIds);return r?s.add(n):s.delete(n),{expandedClipIds:s}}),expandClips:n=>t(r=>{if(n.every(s=>r.expandedClipIds.has(s)))return r;const i=new Set(r.expandedClipIds);for(const s of n)i.add(s);return{expandedClipIds:i}}),collapsedGroupIds:new Set,toggleGroupExpanded:n=>t(r=>{const i=new Set(r.collapsedGroupIds);return i.has(n)?i.delete(n):i.add(n),{collapsedGroupIds:i}}),expandedLaneOwnerIds:new Set,toggleLaneOwnerExpanded:n=>t(r=>{const i=new Set(r.expandedLaneOwnerIds);return i.has(n)?i.delete(n):i.add(n),{expandedLaneOwnerIds:i}}),focusedEaseSegment:null,focusedEaseRequestNonce:0,setFocusedEaseSegment:n=>t(r=>{const i=r.focusedEaseRequestNonce+1,{timelineProjectId:s,timelineSessionEpoch:a}=e();return{focusedEaseRequestNonce:i,focusedEaseSegment:{...n,projectId:s,sessionEpoch:a,nonce:i}}}),clearFocusedEaseSegment:n=>t(r=>{var i;return((i=r.focusedEaseSegment)==null?void 0:i.nonce)===n?{focusedEaseSegment:null}:r}),revealedAudioFxTarget:null,revealedAudioFxNonce:0,setRevealedAudioFxTarget:n=>t(r=>{const i=r.revealedAudioFxNonce+1,{timelineProjectId:s,timelineSessionEpoch:a}=e();return{revealedAudioFxNonce:i,revealedAudioFxTarget:{...n,projectId:s,sessionEpoch:a,nonce:i}}}),clearRevealedAudioFxTarget:n=>t(r=>{var i;return((i=r.revealedAudioFxTarget)==null?void 0:i.nonce)===n?{revealedAudioFxTarget:null}:r}),keyframeCache:new Map,setKeyframeCache:(n,r)=>t(i=>{if(r?i.keyframeCache.get(n)===r:!i.keyframeCache.has(n))return i;const s=new Map(i.keyframeCache);return r?s.set(n,r):s.delete(n),{keyframeCache:s}}),gsapAnimations:new Map,setGsapAnimations:(n,r)=>t(i=>{if(r?i.gsapAnimations.get(n)===r:!i.gsapAnimations.has(n))return i;const s=new Map(i.gsapAnimations);return r?s.set(n,r):s.delete(n),{gsapAnimations:s}})}}function ZCe(t){return{automationSelection:null,setAutomationSelection:e=>t({automationSelection:{...e,t0:Math.min(e.t0,e.t1),t1:Math.max(e.t0,e.t1),v0:Math.min(e.v0,e.v1),v1:Math.max(e.v0,e.v1)}}),clearAutomationSelection:()=>t({automationSelection:null})}}function GCe(t){return{motionPathArmed:!1,setMotionPathArmed:e=>t({motionPathArmed:e}),motionPathCreateAvailable:!1,setMotionPathCreateAvailable:e=>t({motionPathCreateAvailable:e}),autoKeyframeEnabled:!0,setAutoKeyframeEnabled:e=>t({autoKeyframeEnabled:e})}}function UCe(t,e,n,r){return{id:t,projectId:e,sessionEpoch:n,nonce:r}}const tae="follow-preference";function XCe(t,e=tae){return t??(e==="legacy-default"?"hidden":"adaptive")}function WCe(t,e=tae){return e==="force-hidden"?"hidden":t}function qCe(t){return{thumbnailMode:XCe(no().thumbnailMode),setThumbnailMode:e=>{kl({thumbnailMode:e}),t({thumbnailMode:e})}}}const $P=new Set,xa={notify:t=>$P.forEach(e=>e(t)),subscribe:t=>($P.add(t),()=>$P.delete(t))};function BP(t,e){const n=new Set(t);return n.size===0?{selectedElementIds:n,selectedElementId:null}:e&&n.has(e)?{selectedElementIds:n,selectedElementId:e}:{selectedElementIds:n,selectedElementId:n.values().next().value??null}}function JI(){return{isPlaying:!1,currentTime:0,duration:0,timelineReady:!1,beatDragging:!1,elements:[],selectedElementId:null,zEditVersion:0,inPoint:null,outPoint:null,activeTool:"select",activeKeyframePct:null,motionPathArmed:!1,motionPathCreateAvailable:!1,selectedKeyframes:new Set,automationSelection:null,expandedClipIds:new Set,collapsedGroupIds:new Set,expandedLaneOwnerIds:new Set,focusedEaseSegment:null,revealedAudioFxTarget:null,selectedElementIds:new Set,requestedSeekTime:null,lintFindingsByElement:new Map,timelineFocus:null,keyframeCache:new Map,gsapAnimations:new Map,beatAnalysis:null,beatEdits:null,beatUndo:[],beatRedo:[],beatPersist:null,clipManifest:null,clipParentMap:new Map,domClipChildren:[],subCompositionHostState:new Map}}const ue=lE((t,e)=>({isPlaying:!1,currentTime:0,duration:0,timelineReady:!1,timelineSessionEpoch:0,timelineProjectId:null,beatDragging:!1,elements:[],selectedElementId:null,playbackRate:no().playbackRate??1,audioMuted:no().audioMuted??!1,audioVolume:no().audioVolume??1,loopEnabled:!1,zoomMode:"fit",manualZoomPercent:100,zEditVersion:0,timelinePps:100,timelineFitPps:100,inPoint:null,outPoint:null,activeTool:"select",setActiveTool:n=>t({activeTool:n}),...zCe(t,()=>({timelineProjectId:e().timelineProjectId,timelineSessionEpoch:e().timelineSessionEpoch})),...qCe(t),...ZCe(t),...GCe(t),activeKeyframePct:null,setActiveKeyframePct:n=>t({activeKeyframePct:n}),selectedElementIds:new Set,setSelection:(n,r)=>t(BP(n,r)),addSelectedElementId:n=>t(r=>{const i=new Set(r.selectedElementIds);return i.add(n),BP(i,r.selectedElementId)}),toggleSelectedElementId:n=>t(r=>{const i=new Set(r.selectedElementIds);return i.has(n)?i.delete(n):i.add(n),BP(i,r.selectedElementId)}),clearSelection:()=>t({selectedElementId:null,selectedElementIds:new Set}),requestedSeekTime:null,requestSeek:n=>t({requestedSeekTime:n}),clearSeekRequest:()=>t({requestedSeekTime:null}),playbackRequest:null,requestPlayback:(n,r=null)=>t(i=>{var s;return{playbackRequest:{playing:n,returnTo:r,nonce:(((s=i.playbackRequest)==null?void 0:s.nonce)??0)+1}}}),clearPlaybackRequest:()=>t({playbackRequest:null}),clipRevealRequest:null,requestClipReveal:n=>t(r=>{var i;return{clipRevealRequest:{elementId:n,nonce:(((i=r.clipRevealRequest)==null?void 0:i.nonce)??0)+1}}}),clearClipRevealRequest:()=>t({clipRevealRequest:null}),timelineFocus:null,timelineFocusNonce:0,requestTimelineFocus:n=>t(r=>{const i=r.timelineFocusNonce+1;return{timelineFocusNonce:i,timelineFocus:UCe(n,r.timelineProjectId,r.timelineSessionEpoch,i)}}),clearTimelineFocus:n=>t(r=>{var i;return((i=r.timelineFocus)==null?void 0:i.nonce)===n?{timelineFocus:null}:r}),lintFindingsByElement:new Map,setLintFindingsByElement:n=>t({lintFindingsByElement:n}),beatAnalysis:null,setBeatAnalysis:n=>t({beatAnalysis:n}),beatEdits:null,setBeatEdits:n=>t({beatEdits:n}),beatUndo:[],beatRedo:[],beatPersist:null,setBeatPersist:n=>t({beatPersist:n}),commitBeatEdits:(n,r)=>{var i,s;t(a=>({beatEdits:n,beatUndo:[...a.beatUndo,{restore:a.beatEdits,at:Date.now(),label:r}],beatRedo:[]})),(s=(i=e()).beatPersist)==null||s.call(i)},undoBeatEdits:()=>{var i,s;const n=e(),r=n.beatUndo[n.beatUndo.length-1];return r?(t({beatEdits:r.restore,beatUndo:n.beatUndo.slice(0,-1),beatRedo:[...n.beatRedo,{restore:n.beatEdits,at:r.at,label:r.label}]}),(s=(i=e()).beatPersist)==null||s.call(i),r.label):null},resetBeatHistory:()=>t({beatUndo:[],beatRedo:[]}),redoBeatEdits:()=>{var i,s;const n=e(),r=n.beatRedo[n.beatRedo.length-1];return r?(t({beatEdits:r.restore,beatRedo:n.beatRedo.slice(0,-1),beatUndo:[...n.beatUndo,{restore:n.beatEdits,at:r.at,label:r.label}]}),(s=(i=e()).beatPersist)==null||s.call(i),r.label):null},clipManifest:null,setClipManifest:n=>t({clipManifest:n}),clipParentMap:new Map,setClipParentMap:n=>t({clipParentMap:n}),domClipChildren:[],setDomClipChildren:n=>t({domClipChildren:n}),subCompositionHostState:new Map,setSubCompositionHostState:n=>t({subCompositionHostState:n}),setIsPlaying:n=>{e().isPlaying!==n&&t({isPlaying:n})},setPlaybackRate:n=>{kl({playbackRate:n}),t({playbackRate:n})},setAudioMuted:n=>{kl({audioMuted:n}),t({audioMuted:n})},setAudioVolume:n=>{const r=Number.isFinite(n)?Math.max(0,Math.min(1,n)):1;kl({audioVolume:r}),t({audioVolume:r})},setLoopEnabled:n=>t({loopEnabled:n}),setZoomMode:n=>t({zoomMode:n}),clearSelectedElementIds:()=>t({selectedElementIds:new Set}),setSelectedElementIds:n=>t({selectedElementIds:new Set(n)}),timelineSnapEnabled:no().timelineSnapEnabled??!0,setTimelineSnapEnabled:n=>{kl({timelineSnapEnabled:n}),t({timelineSnapEnabled:n})},timeDisplayMode:no().timeDisplayMode??"time",setTimeDisplayMode:n=>{kl({timeDisplayMode:n}),t({timeDisplayMode:n})},pinTimelineZoom:(n,r)=>t(i=>{if(i.zoomMode==="manual")return{};const s=$Ce(n,r);return kl({timelineZoomMode:"manual",timelineManualZoomPercent:s}),{zoomMode:"manual",manualZoomPercent:s}}),setTimelineScale:(n,r)=>{const i=e();i.timelinePps===n&&i.timelineFitPps===r||t({timelinePps:n,timelineFitPps:r})},setInPoint:n=>t(r=>{const i=n!==null&&Number.isFinite(n)?n:null;return{inPoint:i,outPoint:i!==null&&r.outPoint!==null&&i>=r.outPoint?null:r.outPoint,loopEnabled:i!==null?!0:r.loopEnabled}}),setOutPoint:n=>t(r=>{const i=n!==null&&Number.isFinite(n)?n:null;return{outPoint:i,inPoint:i!==null&&r.inPoint!==null&&i<=r.inPoint?null:r.inPoint,loopEnabled:i!==null?!0:r.loopEnabled}}),setManualZoomPercent:n=>t(r=>({manualZoomPercent:B0(n,r.timelineFitPps)})),bumpZEditVersion:()=>t(n=>({zEditVersion:n.zEditVersion+1})),setCurrentTime:n=>t({currentTime:Number.isFinite(n)?n:0}),setDuration:n=>t({duration:Number.isFinite(n)?n:0}),setTimelineReady:n=>t({timelineReady:n}),setBeatDragging:n=>t({beatDragging:n}),setElements:n=>t({elements:n}),setSelectedElementId:(n,r)=>t(i=>{const s=ICe(i.selectedElementIds,n,r==null?void 0:r.preserveSet),a=_Ce(i.revealedAudioFxTarget,n);return n!==i.selectedElementId?{selectedElementId:n,selectedElementIds:s,activeKeyframePct:null,motionPathArmed:!1,focusedEaseSegment:null,...a?{}:{revealedAudioFxTarget:null}}:{selectedElementId:n,selectedElementIds:s}}),setSelectionAnchor:n=>t(r=>n!=null&&r.selectedElementIds.size>1&&r.selectedElementIds.has(n)?{selectedElementId:n,focusedEaseSegment:n===r.selectedElementId?r.focusedEaseSegment:null}:{selectedElementId:n,selectedElementIds:n?new Set([n]):new Set,focusedEaseSegment:n===r.selectedElementId?r.focusedEaseSegment:null}),updateElement:(n,r)=>t(i=>({elements:i.elements.map(s=>(s.key??s.id)===n?{...s,...r}:s)})),beginTimelineSession:n=>t(r=>r.timelineProjectId===n?r:{...JI(),timelineSessionEpoch:r.timelineSessionEpoch+1,timelineProjectId:n}),reset:()=>t(JI())}));eCe(ue);const nae="phc_zjjbX0PnWxERXrMHhkEJWj9A9BhGVLRReICgsfTMmpx",rae="https://us.i.posthog.com",YCe=3e4,KCe=5e3;let qv=[],z2=null;function JCe(){return ej()}function eke(){return eS()}function tke(){var t,e;return{studio_version:"0.8.22",agent_runtime:fie(),screen_width:(t=window.screen)==null?void 0:t.width,screen_height:(e=window.screen)==null?void 0:e.height,viewport_width:window.innerWidth,viewport_height:window.innerHeight,user_agent:navigator.userAgent,url_hash:location.hash.replace(/#project\//,"").split("?")[0]}}function Pt(t,e={}){eke()&&(qv.push({event:`studio:${t}`,properties:{...tke(),...die(),...e},timestamp:new Date().toISOString()}),z2||(z2=setInterval(nke,YCe)))}function iae(){const t=qv.map(e=>({event:e.event,properties:{...e.properties,$ip:null},distinct_id:JCe(),timestamp:e.timestamp}));return qv=[],t}async function nke(){if(qv.length===0)return;const t=iae(),e=new AbortController,n=setTimeout(()=>e.abort(),KCe);try{await fetch(`${rae}/batch/`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({api_key:nae,batch:t}),signal:e.signal})}catch{}finally{clearTimeout(n)}}function sae(){if(z2&&(clearInterval(z2),z2=null),qv.length===0)return;const t=iae(),e=JSON.stringify({api_key:nae,batch:t});try{navigator.sendBeacon(`${rae}/batch/`,e)}catch{}}typeof window<"u"&&window.addEventListener("visibilitychange",()=>{document.visibilityState==="hidden"&&sae()});function V0(t){const e=x.useRef(null),n=x.useCallback(r=>{var i;if(r instanceof KeyboardEvent){r.key==="Escape"&&t();return}(i=e.current)!=null&&i.contains(r.target)||t()},[t]);return x.useEffect(()=>(document.addEventListener("pointerdown",n,!0),document.addEventListener("mousedown",n,!0),document.addEventListener("keydown",n),()=>{document.removeEventListener("pointerdown",n,!0),document.removeEventListener("mousedown",n,!0),document.removeEventListener("keydown",n)}),[n]),e}const rke=[{title:"Playback",hints:[{key:"Space",label:"Play / Pause"},{key:"J",label:"Play backward"},{key:"K",label:"Stop"},{key:"L",label:"Play forward"},{key:"M",label:"Toggle mute"},{key:"⇧L",label:"Toggle loop"},{key:"←/→",label:"Step 1 frame"},{key:"⇧←/⇧→",label:"Step 10 frames"},{key:"F",label:"Toggle fullscreen"}]},{title:"Keyframes (when an element is selected)",hints:[{key:"K",label:"Add keyframe at playhead"},{key:"Del",label:"Delete selected keyframe"},{key:"H",label:"Toggle hold / bezier"},{key:"U",label:"Expand / collapse properties"},{key:"R",label:"Record gesture"}]},{title:"Editing",hints:[{key:"⌘Z",label:"Undo"},{key:"⌘⇧Z",label:"Redo"},{key:"⌘C",label:"Copy element"},{key:"⌘V",label:"Paste element"},{key:"⌘X",label:"Cut element"},{key:"S",label:"Split clip at playhead"},{key:"⇧Click",label:"Razor tool: split all tracks"},{key:"⌘G",label:"Group elements"},{key:"⌘⇧G",label:"Ungroup"},{key:"Del",label:"Delete selected element (no keyframe selected)"}]},{title:"Gesture recording modifiers",hints:[{key:"Drag",label:"Record x / y position"},{key:"Scroll",label:"Record z depth"},{key:"⇧ Drag",label:"Record rotationX / rotationY"},{key:"⌥ Drag",label:"Record rotation"},{key:"⌘ Drag↕",label:"Record opacity"},{key:"⌘ Scroll",label:"Record scale"}]},{title:"Canvas",hints:[{key:"Drag",label:"Move element / add keyframe"},{key:"⌥ Drag",label:"Move entire animation path"},{key:"⇧ Drag",label:"Uniform resize"}]},{title:"Crop",hints:[{key:"Drag edge",label:"Crop a side"},{key:"Drag center",label:"Reposition the crop"}]},{title:"Panels",hints:[{key:"⌘1",label:"Compositions tab"},{key:"⌘2",label:"Assets tab"}]},{title:"Work area",hints:[{key:"I",label:"Set in-point"},{key:"⇧I",label:"Clear in-point"},{key:"O",label:"Set out-point"},{key:"⇧O",label:"Clear out-point"},{key:"A",label:"Jump to in-point"},{key:"E",label:"Jump to out-point"}]}],ike=x.memo(function({disabled:e,duration:n,inPoint:r,outPoint:i,setInPoint:s,setOutPoint:a,onSeek:o}){const[l,c]=x.useState(!1),[u,f]=x.useState(""),h=x.useId(),p=x.useCallback(()=>c(!1),[]),y=V0(p),m=x.useRef(null),v=x.useRef(null);x.useEffect(()=>{var E;if(!l)return;const k=v.current;return(E=m.current)==null||E.focus(),()=>{k==null||k.focus()}},[l]);const b=x.useCallback(()=>{if(e)return;const k=Number.parseInt(u,10);!Number.isFinite(k)||n<=0||o(Math.min(n,wj(Math.max(0,k))))},[e,n,u,o]),w=x.useCallback(k=>{k.preventDefault(),b()},[b]),O=x.useCallback(k=>{k.key==="Enter"&&(k.preventDefault(),b())},[b]);return d.jsxs("div",{ref:y,className:"relative flex-shrink-0",children:[d.jsx(vr,{label:"Shortcuts and tools",children:d.jsx("button",{ref:v,type:"button",onClick:()=>c(k=>!k),className:`flex h-7 w-7 items-center justify-center rounded-md transition-colors ${l?"text-neutral-200":"text-neutral-600 hover:text-neutral-300"}`,"aria-label":"Shortcuts and tools","aria-expanded":l,"aria-controls":h,children:d.jsxs("svg",{width:"11",height:"11",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[d.jsx("rect",{x:"2",y:"4",width:"20",height:"16",rx:"2"}),d.jsx("path",{d:"M6 8h.01M10 8h.01M14 8h.01M18 8h.01M6 12h.01M10 12h.01M14 12h.01M18 12h.01M8 16h8"})]})})}),l&&d.jsxs("div",{id:h,ref:m,tabIndex:-1,role:"dialog","aria-label":"Keyboard shortcuts and tools",className:"absolute bottom-full right-0 mb-2 z-50 rounded-lg shadow-xl min-w-[220px] overflow-y-auto outline-none",style:{background:"#161618",border:"1px solid rgba(255,255,255,0.08)",maxHeight:"min(280px, calc(100vh - 80px))"},children:[d.jsxs("div",{className:"px-3 pt-3 pb-2.5",children:[d.jsx("p",{className:"text-[9px] font-medium text-neutral-500 uppercase tracking-wider mb-1.5",children:"Jump to frame"}),d.jsxs("form",{onSubmit:w,className:"flex items-center gap-1.5",children:[d.jsx("input",{value:u,onChange:k=>f(k.target.value),disabled:e,inputMode:"numeric",pattern:"[0-9]*","aria-label":"Jump to frame",placeholder:"frame number",className:"h-6 flex-1 rounded border border-neutral-700 bg-neutral-900 px-2 text-[10px] font-mono tabular-nums text-neutral-200 outline-none transition-colors placeholder:text-neutral-600 focus:border-studio-accent/60",onKeyDown:O,onBlur:b}),d.jsx(vr,{label:"Jump to frame",children:d.jsx("button",{type:"submit",disabled:e,className:"h-6 px-2 rounded border border-neutral-700 text-[10px] text-neutral-300 transition-colors hover:border-neutral-500 hover:bg-neutral-800 disabled:opacity-40",children:"Go"})})]})]}),d.jsx("div",{style:{borderTop:"1px solid rgba(255,255,255,0.06)"}}),d.jsxs("div",{className:"px-3 pt-2.5 pb-2",children:[d.jsx("p",{className:"text-[9px] font-medium text-neutral-500 uppercase tracking-wider mb-1.5",children:"Work area"}),d.jsxs("div",{className:"flex flex-col gap-1",children:[d.jsxs("div",{className:"flex items-center justify-between gap-2",children:[d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx("span",{className:"font-mono text-[10px] rounded border border-neutral-700 px-1.5 py-0.5 text-neutral-300 min-w-[20px] text-center",style:{background:"rgba(255,255,255,0.05)"},children:"I"}),d.jsx("span",{className:"text-[10px] text-neutral-400",children:"In-point"})]}),d.jsx("div",{className:"flex items-center gap-1.5",children:r!==null?d.jsxs(d.Fragment,{children:[d.jsx("span",{className:"font-mono text-[10px] text-neutral-300",children:os(r)}),d.jsx(vr,{label:"Clear in-point",children:d.jsx("button",{type:"button",onClick:()=>s(null),className:"w-4 h-4 flex items-center justify-center rounded text-neutral-500 hover:text-neutral-200 transition-colors","aria-label":"Clear in-point",children:d.jsx("svg",{width:"8",height:"8",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",children:d.jsx("path",{d:"M18 6L6 18M6 6l12 12"})})})})]}):d.jsx("span",{className:"text-[10px] text-neutral-600",children:"—"})})]}),d.jsxs("div",{className:"flex items-center justify-between gap-2",children:[d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx("span",{className:"font-mono text-[10px] rounded border border-neutral-700 px-1.5 py-0.5 text-neutral-300 min-w-[20px] text-center",style:{background:"rgba(255,255,255,0.05)"},children:"O"}),d.jsx("span",{className:"text-[10px] text-neutral-400",children:"Out-point"})]}),d.jsx("div",{className:"flex items-center gap-1.5",children:i!==null?d.jsxs(d.Fragment,{children:[d.jsx("span",{className:"font-mono text-[10px] text-neutral-300",children:os(i)}),d.jsx(vr,{label:"Clear out-point",children:d.jsx("button",{type:"button",onClick:()=>a(null),className:"w-4 h-4 flex items-center justify-center rounded text-neutral-500 hover:text-neutral-200 transition-colors","aria-label":"Clear out-point",children:d.jsx("svg",{width:"8",height:"8",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",children:d.jsx("path",{d:"M18 6L6 18M6 6l12 12"})})})})]}):d.jsx("span",{className:"text-[10px] text-neutral-600",children:"—"})})]})]})]}),d.jsx("div",{style:{borderTop:"1px solid rgba(255,255,255,0.06)"}}),d.jsx("div",{className:"px-3 pt-2.5 pb-3 flex flex-col gap-3",children:rke.map(k=>d.jsxs("div",{children:[d.jsx("p",{className:"text-[9px] font-medium text-neutral-500 uppercase tracking-wider mb-1.5",children:k.title}),d.jsx("div",{className:"flex flex-col gap-1",children:k.hints.map(E=>d.jsxs("div",{className:"flex items-center gap-3",children:[d.jsx("span",{className:"font-mono text-[10px] rounded border border-neutral-700 px-1.5 py-0.5 text-neutral-300 min-w-[36px] text-center",style:{background:"rgba(255,255,255,0.05)"},children:E.key}),d.jsx("span",{className:"text-[10px] text-neutral-400",children:E.label})]},E.key))})]},k.title))})]})]})}),ske=[.25,.5,1,1.5,2],ake=x.memo(function({playbackRate:e,setPlaybackRate:n,disabled:r}){const[i,s]=x.useState(!1),a=x.useCallback(()=>s(!1),[]),o=V0(a);return d.jsxs("div",{ref:o,className:"relative flex-shrink-0",children:[d.jsx(vr,{label:"Playback speed",children:d.jsx("button",{type:"button",onClick:()=>s(l=>!l),disabled:r,"aria-haspopup":"menu","aria-expanded":i,"aria-label":"Playback speed",className:"h-7 w-8 rounded-md font-mono text-[10px] tabular-nums text-neutral-500 transition-colors hover:text-neutral-200 disabled:opacity-30",children:e===1?"1x":`${e}x`})}),i&&d.jsx("div",{role:"menu","aria-label":"Playback speed options",className:"absolute bottom-full right-0 mb-1.5 rounded-lg shadow-xl z-50 min-w-[56px] overflow-hidden",style:{background:"#161618",border:"1px solid rgba(255,255,255,0.08)"},children:ske.map(l=>{const c=l===e;return d.jsxs("button",{type:"button",role:"menuitemradio","aria-checked":c,onClick:()=>{Pt("playback",{action:"speed_change",rate:l}),n(l),s(!1)},className:`block w-full px-3 py-1.5 text-[11px] text-left font-mono tabular-nums transition-colors outline-none focus-visible:bg-white/[0.04] ${c?"text-neutral-50 bg-white/[0.06]":"text-neutral-500 hover:bg-white/[0.04]"}`,children:[l,"x"]},l)})})]})});function oke({muted:t,volume:e}){const n=t||e===0;return d.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[d.jsx("path",{d:"M11 5 6 9H3v6h3l5 4V5Z"}),n?d.jsxs(d.Fragment,{children:[d.jsx("path",{d:"m19 9-6 6"}),d.jsx("path",{d:"m13 9 6 6"})]}):d.jsxs(d.Fragment,{children:[d.jsx("path",{d:"M15.5 8.5a5 5 0 0 1 0 7"}),e>=.5?d.jsx("path",{d:"M18.5 5.5a9 9 0 0 1 0 13"}):null]})]})}const lke=x.memo(function({audioMuted:e,audioVolume:n,disabled:r,setAudioMuted:i,setAudioVolume:s}){const a=Math.round(n*100),o=e||n===0,l=o?"Unmute audio":"Mute audio";return d.jsxs("div",{className:"group flex flex-shrink-0 items-center",children:[d.jsx("div",{className:"w-0 overflow-hidden opacity-0 transition-[width,opacity] duration-150 ease-out group-hover:w-14 group-hover:opacity-100 group-focus-within:w-14 group-focus-within:opacity-100",children:d.jsxs("div",{className:"relative mx-1 flex h-6 w-12 items-center",children:[d.jsx("div",{className:"absolute inset-x-0 h-0.5 overflow-hidden rounded-full bg-neutral-700",children:d.jsx("div",{className:"h-full rounded-full bg-neutral-300",style:{width:`${a}%`}})}),d.jsx("input",{type:"range",min:"0",max:"100",step:"1",value:a,disabled:r,"aria-label":"Preview volume","aria-valuetext":`${a}%`,title:`Preview volume: ${a}%`,onChange:c=>{const u=Number(c.currentTarget.value)/100;s(u),e&&u>0&&i(!1)},className:"hf-preview-volume-range absolute inset-0 w-full disabled:pointer-events-none"})]})}),d.jsx(vr,{label:l,children:d.jsx("button",{type:"button",onClick:()=>{Pt("playback",{action:"mute_toggle",muted:!o}),o&&n===0&&s(1),i(!o)},disabled:r,"aria-label":l,"aria-pressed":o,className:`flex h-7 w-7 flex-shrink-0 items-center justify-center rounded-md transition-colors disabled:pointer-events-none disabled:opacity-30 ${o?"text-studio-accent":"text-neutral-500 hover:text-neutral-200"}`,children:d.jsx(oke,{muted:e,volume:n})})})]})});Qv.registerPlugin(O1);const PG="M87.5129 57.5141L56.9696 73.5433C52.8371 75.7098 48.7046 73.2553 49.6688 69.2104L58.9483 30.1391C59.9125 26.0942 65.2097 23.6397 68.3154 25.8062L91.2447 41.8354C96.4668 45.4796 94.4631 53.8699 87.5129 57.5141Z",MG="M56 28H67V71H56Z M73 28H84V71H73Z";function cke({playing:t}){const e=x.useRef(null),n=x.useRef(!0);return x.useEffect(()=>{var o;const r=e.current;if(!r)return;const i=t?MG:PG,s=typeof window<"u"&&((o=window.matchMedia)==null?void 0:o.call(window,"(prefers-reduced-motion: reduce)").matches);if(n.current||s){n.current=!1,Qv.set(r,{morphSVG:i});return}const a=Qv.to(r,{duration:.28,ease:"power2.inOut",morphSVG:i});return()=>{a.kill()}},[t]),d.jsx("span",{className:"relative inline-flex h-3 w-3 items-center justify-center","aria-hidden":"true",children:d.jsx("svg",{width:"12",height:"12",viewBox:"46 21 54 56",fill:"#FAFAFA",children:d.jsx("path",{ref:e,d:t?MG:PG})})})}const uke=x.memo(function({loopEnabled:e,disabled:n,setLoopEnabled:r}){return d.jsx(vr,{label:"Loop playback",children:d.jsx("button",{type:"button",onClick:()=>{Pt("playback",{action:"loop_toggle",enabled:!e}),r(!e)},disabled:n,className:`flex h-7 w-7 items-center justify-center rounded-md transition-colors disabled:opacity-30 ${e?"text-studio-accent":"text-neutral-500 hover:text-neutral-200"}`,"aria-label":e?"Disable loop playback":"Enable loop playback","aria-pressed":e,children:d.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[d.jsx("path",{d:"M17 2l4 4-4 4"}),d.jsx("path",{d:"M3 11V9a4 4 0 0 1 4-4h14"}),d.jsx("path",{d:"M7 22l-4-4 4-4"}),d.jsx("path",{d:"M21 13v2a4 4 0 0 1-4 4H3"})]})})})}),fke=x.memo(function({isFullscreen:e,onToggleFullscreen:n}){return d.jsx(vr,{label:e?"Exit fullscreen (F)":"Enter fullscreen (F)",children:d.jsx("button",{type:"button",onClick:()=>{Pt("playback",{action:"fullscreen_toggle",active:!e}),n()},className:`flex h-7 w-7 flex-shrink-0 items-center justify-center rounded-md transition-colors ${e?"text-studio-accent":"text-neutral-500 hover:text-neutral-200"}`,"aria-label":e?"Exit fullscreen":"Enter fullscreen",children:d.jsx("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:e?d.jsxs(d.Fragment,{children:[d.jsx("path",{d:"M8 3v3a2 2 0 0 1-2 2H3"}),d.jsx("path",{d:"M21 8h-3a2 2 0 0 1-2-2V3"}),d.jsx("path",{d:"M3 16h3a2 2 0 0 1 2 2v3"}),d.jsx("path",{d:"M16 21v-3a2 2 0 0 1 2-2h3"})]}):d.jsxs(d.Fragment,{children:[d.jsx("path",{d:"M8 3H5a2 2 0 0 0-2 2v3"}),d.jsx("path",{d:"M21 8V5a2 2 0 0 0-2-2h-3"}),d.jsx("path",{d:"M3 16v3a2 2 0 0 0 2 2h3"}),d.jsx("path",{d:"M16 21h3a2 2 0 0 0 2-2v-3"})]})})})})}),hke=x.memo(function({onTogglePlay:e,onSeek:n,disabled:r=!1,isFullscreen:i=!1,onToggleFullscreen:s}){const a=ue(B=>B.isPlaying),o=ue(B=>B.duration),l=ue(B=>B.timelineReady),c=ue(B=>B.playbackRate),u=ue(B=>B.audioMuted),f=ue(B=>B.audioVolume),h=ue(B=>B.loopEnabled),p=ue.getState().setPlaybackRate,y=ue.getState().setAudioMuted,m=ue.getState().setAudioVolume,v=ue.getState().setLoopEnabled,b=ue(B=>B.inPoint),w=ue(B=>B.outPoint),O=ue.getState().setInPoint,k=ue.getState().setOutPoint,E=ue(B=>B.timeDisplayMode),T=ue.getState().setTimeDisplayMode,N=x.useRef(null),_=x.useRef(0),I=x.useRef(E);I.current=E;const j=x.useRef(o);j.current=o;const L=r||!l;return x.useEffect(()=>{if(!N.current)return;const B=_.current;N.current.textContent=E==="frame"?SG(B,o):os(B)},[o,E]),Or(()=>{const B=z=>{if(_.current=z,!N.current)return;const Y=j.current;N.current.textContent=I.current==="frame"?SG(z,Y):os(z)},$=xa.subscribe(B);return B(ue.getState().currentTime),$}),d.jsx("div",{children:d.jsxs("div",{className:"grid h-10 grid-cols-[minmax(0,1fr)_auto_minmax(0,1fr)] items-center px-3","aria-disabled":r||void 0,style:{paddingBottom:"env(safe-area-inset-bottom)"},children:[d.jsx(vr,{label:E==="time"?"Switch to frame display":"Switch to time display",children:d.jsxs("button",{type:"button",onClick:()=>T(E==="time"?"frame":"time"),disabled:r,className:"min-w-0 justify-self-start whitespace-nowrap font-mono text-[11px] tabular-nums text-neutral-400 transition-colors hover:text-neutral-200 disabled:pointer-events-none",children:[d.jsx("span",{ref:N,children:os(0)}),E==="time"?d.jsxs(d.Fragment,{children:[d.jsx("span",{className:"mx-0.5 text-neutral-700",children:"/"}),d.jsx("span",{className:"text-neutral-600",children:os(o)})]}):null]})}),d.jsx(vr,{label:a?"Pause":"Play",children:d.jsx("button",{type:"button","aria-label":a?"Pause":"Play",onClick:()=>{Pt("playback",{action:a?"pause":"play"}),e()},disabled:L,className:"flex h-8 w-8 items-center justify-center justify-self-center rounded-md text-neutral-100 transition-colors hover:text-white disabled:pointer-events-none disabled:opacity-30",children:d.jsx(cke,{playing:a})})}),d.jsxs("div",{className:"flex min-w-0 items-center justify-self-end",children:[d.jsx(lke,{audioMuted:u,audioVolume:f,disabled:L,setAudioMuted:y,setAudioVolume:m}),d.jsx(ake,{playbackRate:c,setPlaybackRate:p,disabled:r}),d.jsx(uke,{loopEnabled:h,disabled:r,setLoopEnabled:v}),s&&d.jsx(fke,{isFullscreen:i,onToggleFullscreen:s}),d.jsx(ike,{disabled:r,duration:o,inPoint:b,outPoint:w,setInPoint:O,setOutPoint:k,onSeek:n})]})]})})}),dke=new Set(["audio","music","sfx","sound","narration"]),pke=/\.(aac|flac|m4a|mp3|ogg|opus|wav)(?:[?#].*)?$/i,mke=/\b(music|bgm|soundtrack|background[-_]?music)\b/i;function Yv(t){return t?t.tagName.toLowerCase()===ya?!0:Jo({tag:t.tagName,src:t.getAttribute("src")??void 0}):!1}function Jo(t){if(!t)return!1;const e=t.tag.trim().toLowerCase();return dke.has(e)?!0:!!(t.src&&pke.test(t.src))}function my(t){if(!t||!Jo(t))return!1;if(t.timelineRole==="music")return!0;if(t.timelineRole&&t.timelineRole!=="music")return!1;const e=t.domId??t.id??"";return mke.test(e)}function gke(t){const e=t.find(my);if(e)return{element:e,isFallback:!1};let n=null;for(const r of t)Jo(r)&&(r.timelineRole&&r.timelineRole!=="music"||(!n||r.duration>n.duration)&&(n=r));return n?{element:n,isFallback:!0}:null}function aae(t){return!t.some(e=>Yv(e.element))}let FO=null;const NG=()=>hy(()=>import("./index-DXR3nsh2.js").then(t=>t.i),[]);function yke(t=NG){const e=t===NG;if(e&&FO)return FO;const n=t().then(r=>(r.default??r)||null).catch(()=>(e&&(FO=null),null));return e&&(FO=n),n}const VP=1024,DG=512,xke=.05;function oae(t,e,n){const r=Math.floor(e*xke),i=Math.floor(n*e),s=Math.max(0,i-r),a=Math.min(t.length,i+r);let o=0;for(let l=s;ll&&c>(r[a-1]??0)&&c>(r[a+1]??0)){const u=a*DG/n;(i.length===0||u-i[i.length-1]>.1)&&i.push(Math.round(u*1e3)/1e3)}}return i}function vke(t){if(t.length<4)return null;const e=[];for(let s=1;ss-a),r=Math.floor(n.length/2),i=n.length%2===0?(n[r-1]+n[r])/2:n[r];return i<=0?null:Math.round(60/i*10)/10}function HP(t){let e=t;for(;e>120;)e/=2;for(;e<60;)e*=2;return e}function Ake(t,e){const n=[t/2,t,t*2];let r=t,i=Number.POSITIVE_INFINITY;for(const s of n){if(s<=0)continue;const a=Math.abs(s-e);aa&&(a=u,s=c)}const o=[];for(let l=s;l<=n+.001;l+=r)o.push(Math.round(l*1e3)/1e3);return o}function wke(t,e,n){if(t.length===0)return{times:t,strengths:[],peak:1e-6};const r=t.map(l=>oae(e,n,l)),i=Math.max(...r,1e-6),s=i*.12,a=[],o=[];for(let l=0;l=s&&(a.push(t[l]),o.push(Math.min(1,r[l]/i)));return{times:a,strengths:o,peak:i}}async function Oke(t){const e=t.getChannelData(0),n=t.sampleRate,r=t.duration,i=await bke(t),s=vke(i);let a=null;try{const h=await yke();h&&(a=h(t))}catch{}let o=s,l="uncertain",c=null;if(s!==null&&a!==null){const h=Math.abs(HP(s)-HP(a))/HP(a);h<.05?(o=Ake(a,s),l="high",c=o):h<.1?(o=Math.round((s+a)/2),l="low",c=o):(o=s,l="uncertain")}else s!==null?(o=s,l="low",c=s):a!==null&&(o=a,l="low",c=a);const u=c!==null?Ske(i,c,r):i,f=wke(u,e,n);return{beatTimes:f.times,beatStrengths:f.strengths,bpm:o,bpmConfidence:l,channelData:e,sampleRate:n,peak:f.peak}}async function Cke(t){const e=new AudioContext;try{const r=await(await fetch(t)).arrayBuffer(),i=await e.decodeAudioData(r);return Oke(i)}finally{await e.close()}}function cae(t){if(!t||/^(blob:|data:)/i.test(t))return null;let e=null;const n="/preview/",r=t.indexOf(n);if(r!==-1){let i=t.slice(r+n.length);const s=i.search(/[?#]/);s!==-1&&(i=i.slice(0,s)),i.startsWith("comp/")&&(i=i.slice(5)),e=i?decodeURIComponent(i):null}if(!e)try{e=decodeURIComponent(new URL(t,"http://_").pathname)}catch{e=t}return e?(e=e.replace(/^\/+/,""),e||null):null}function IG(t){const e=cae(t);return e?`beats/${e}.json`:null}function kke(t,e,n){const r=t.map((s,a)=>({time:Math.round(s*1e3)/1e3,strength:Math.round((e[a]??.5)*1e3)/1e3}));return`${JSON.stringify({version:1,audio:n,beats:r},null,2)} +*/var k6e=/[achlmqstvz]|(-?\d*\.?\d*(?:e[\-+]?\d+)?)[0-9]/ig,E6e=/(?:(-)?\d*\.?\d*(?:e[\-+]?\d+)?)[0-9]/ig,T6e=/[\+\-]?\d*\.?\d+e[\+\-]?\d+/ig,P6e=/(^[#\.][a-z]|[a-y][a-z])/i,M6e=Math.PI/180,IO=Math.sin,_O=Math.cos,mc=Math.abs,hf=Math.sqrt,RO=Math.atan2,sG=1e8,aG=function(e){return typeof e=="string"},yse=function(e){return typeof e=="number"},oG=1e5,rs=function(e){return Math.round(e*oG)/oG||0},lG=function(e){return e.closed=Math.abs(e[0]-e[e.length-2])<.001&&Math.abs(e[1]-e[e.length-1])<.001},N6e=function(e,n,r){var i=e.length,s=~~(r*i);if(e[s]>n){for(;--s&&e[s]>n;);s<0&&(s=0)}else for(;e[++s] element or an SVG path data string")}function Bb(t){var e=0,n;for(t.reverse();e-1;)a=i[s].nodeName.toLowerCase(),n.indexOf(","+a+",")<0&&r.setAttributeNS(null,a,i[s].nodeValue);return r},_6e={rect:"rx,ry,x,y,width,height",circle:"r,cx,cy",ellipse:"rx,ry,cx,cy",line:"x1,x2,y1,y2"},R6e=function(e,n){for(var r=n?n.split(","):[],i={},s=r.length;--s>-1;)i[r[s]]=+e.getAttribute(r[s])||0;return i};function xse(t,e){var n=t.tagName.toLowerCase(),r=.552284749831,i,s,a,o,l,c,u,f,h,p,y,m,v,b,w,O,k,E,T,N,_,I;return n==="path"||!t.getBBox?t:(c=I6e(t,"x,y,width,height,cx,cy,rx,ry,r,x1,x2,y1,y2,points"),I=R6e(t,_6e[n]),n==="rect"?(o=I.rx,l=I.ry||o,s=I.x,a=I.y,p=I.width-o*2,y=I.height-l*2,o||l?(m=s+o*(1-r),v=s+o,b=v+p,w=b+o*r,O=b+o,k=a+l*(1-r),E=a+l,T=E+y,N=T+l*r,_=T+l,i="M"+O+","+E+" V"+T+" C"+[O,N,w,_,b,_,b-(b-v)/3,_,v+(b-v)/3,_,v,_,m,_,s,N,s,T,s,T-(T-E)/3,s,E+(T-E)/3,s,E,s,k,m,a,v,a,v+(b-v)/3,a,b-(b-v)/3,a,b,a,w,a,O,k,O,E].join(",")+"z"):i="M"+(s+p)+","+a+" v"+y+" h"+-p+" v"+-y+" h"+p+"z"):n==="circle"||n==="ellipse"?(n==="circle"?(o=l=I.r,f=o*r):(o=I.rx,l=I.ry,f=l*r),s=I.cx,a=I.cy,u=o*r,i="M"+(s+o)+","+a+" C"+[s+o,a+f,s+u,a+l,s,a+l,s-u,a+l,s-o,a+f,s-o,a,s-o,a-f,s-u,a-l,s,a-l,s+u,a-l,s+o,a-f,s+o,a].join(",")+"z"):n==="line"?i="M"+I.x1+","+I.y1+" L"+I.x2+","+I.y2:(n==="polyline"||n==="polygon")&&(h=(t.getAttribute("points")+"").match(E6e)||[],s=h.shift(),a=h.shift(),i="M"+s+","+a+" L"+h.join(","),n==="polygon"&&(i+=","+s+","+a+"z")),c.setAttribute("d",Hp(c._gsRawPath=xf(i))),e&&t.parentNode&&(t.parentNode.insertBefore(c,t),t.parentNode.removeChild(t)),c)}function bse(t,e,n){e=e||0,t.samples||(t.samples=[],t.lookup=[]);var r=~~t.resolution||12,i=1/r,s=t.length,a=t[e],o=t[e+1],l=e?e/6*r:0,c=t.samples,u=t.lookup,f=(e?t.minLength:sG)||sG,h=c[l+n*r-1],p=e?c[l-1]:0,y,m,v,b,w,O,k,E,T,N,_,I,j,L,B,$,z;for(c.length=u.length=0,m=e+2;m8&&(t.splice(m,6),m-=6,s-=6);else for(y=1;y<=r;y++)L=i*y,j=1-L,O=k-(k=(L*L*v+3*j*(L*b+j*w))*L),_=I-(I=(L*L*E+3*j*(L*T+j*N))*L),$=hf(_*_+O*O),$1&&(n=hf(k)*n,r=hf(k)*r);var E=n*n,T=r*r,N=(E*T-E*O-T*w)/(E*O+T*w);N<0&&(N=0);var _=(s===a?-1:1)*hf(N),I=_*(n*b/r),j=_*-(r*v/n),L=(t+o)/2,B=(e+l)/2,$=L+(u*I-f*j),z=B+(f*I+u*j),Y=(v-I)/n,W=(b-j)/r,J=(-v-I)/n,ne=(-b-j)/r,le=Y*Y+W*W,ie=(W<0?-1:1)*Math.acos(Y/hf(le)),q=(Y*ne-W*J<0?-1:1)*Math.acos((Y*J+W*ne)/hf(le*(J*J+ne*ne)));isNaN(q)&&(q=h),!a&&q>0?q-=p:a&&q<0&&(q+=p),ie%=p,q%=p;var F=Math.ceil(mc(q)/(p/4)),U=[],Z=q/F,K=4/3*IO(Z/2)/(1+_O(Z/2)),ee=u*n,re=f*n,Q=f*-r,H=u*r,se;for(se=0;se-1e-4?0:j}).match(k6e)||[],n=[],r=0,i=0,s=2/3,a=e.length,o=0,l="ERROR: malformed path: "+t,c,u,f,h,p,y,m,v,b,w,O,k,E,T,N,_=function(j,L,B,$){w=(B-j)/3,O=($-L)/3,m.push(j+w,L+O,B-w,$-O,B,$)};if(!t||!isNaN(e[0])||isNaN(e[1]))return console.log(l),n;for(c=0;c.5||mc(i-h)>.5)&&(_(r,i,f,h),p==="L"&&(c+=2)),r=f,i=h;else if(p==="A"){if(T=e[c+4],N=e[c+5],w=e[c+6],O=e[c+7],u=7,T.length>1&&(T.length<3?(O=w,w=N,u--):(O=N,w=T.substr(2),u-=2),N=T.charAt(1),T=T.charAt(0)),k=j6e(r,i,+e[c+1],+e[c+2],+e[c+3],+T,+N,(y?r:0)+w*1,(y?i:0)+O*1),c+=u,k)for(u=0;uu&&o.push(c);if(o.push(t.length-2),l=o.length,a.nonSmooth=_=[1],e>l)for(e-=l,b=0;br?r=o:os?s=l:l-1;)for(p=e[r],c=p.length,h=6;h-1;)m=l*y,v=1-m,u=(m*m*E+3*v*(m*k+v*O))*m+b,f=(m*m*_+3*v*(m*N+v*T))*m+w,u>i?i=u:ua?a=f:f-1;)for(l=e[i],p=l.length,h=0;h0;)h=1-1/(r+2),p=i+(a-i)*h,y=a+(l-a)*h,m=s+(o-s)*h,v=o+(c-o)*h,b=p+(y-p)*h,w=m+(v-m)*h,O=l+(u-l)*h,k=c+(f-c)*h,y+=(O-y)*h,v+=(k-v)*h,e.splice(n+2,4,a=Uc(p),o=Uc(m),l=Uc(b),c=Uc(w),u=Uc(b+(y-b)*h),f=Uc(w+(v-w)*h),Uc(y),Uc(v),Uc(O),Uc(k))},U6e=function(e){for(var n=e.length,r=-Sj,i;n--;)e[n]>r&&(r=e[n],i=n);return i},w4=function(e,n){for(var r=[],i=[],s=e.length-2,a=0;a.01||Math.abs(e[i+1]-r)>.01)return!1;return!0},jP=function(e,n){n=n||{};var r=n,i=r.redraw,s=r.points,a=r.maxSegments,o=a===void 0?999:a,l=0,c=e,u=Array.isArray(s)?s:0,f,h,p,y,m;if(i=i!==!1,i)vse(e);else for(e.totalPoints=0,h=e.length;h--;)e.totalPoints+=e[h].length;for(u?(c=mG(e),u=mG(u),m=u[0].totalLength/Math.round(u[0].length/6)):((!s||s==="auto")&&(s=ZI(e,i),i||(s-=Math.round(e.totalPoints/6))),s=Math.max(i?10:4,Math.min(999,s))),h=0;h=o||u&&(!u[h]||Cse(u[h]))))if(i){var v;y=F6e(L6e(p,f),n.curviness),p.length=0,(v=p).push.apply(v,y)}else w4(p,f);l+=f}return e},GI=function(e,n,r,i,s){var a=n.length-e.length,o=a>0?n:e,l=a>0?e:n,c=0,u=i==="complexity"?Ose:dG,f=i==="position"?0:typeof i=="number"?i:.8,h=l.length,p=typeof r=="object"&&r.push?r.slice(0):[r],y=p[0]==="reverse"||p[0]<0,m=r==="log",v,b,w,O,k,E,T;if(l[0]){if(o.length>1&&(e.sort(u),n.sort(u),o.size||H2(o),l.size||H2(l),E=o.centerX-l.centerX,T=o.centerY-l.centerY,u===dG))for(h=0;hl[0].length&&w4(l[0],(o[0].length-l[0].length)/6|0),h=l.length;c0&&w4(b,a/6|0),y&&s!==!1&&!b.reversed&&Bb(b),r=p[h]||p[h]===0?p[h]:"auto",r&&(b.closed||Math.abs(b[0]-b[b.length-2])<.5&&Math.abs(b[1]-b[b.length-1])<.5?r==="auto"||r==="log"?(p[h]=r=Q6e(b,v,!h||s===!1),r<0&&(y=!0,Bb(b),r=-r),pG(b,r*6)):r!=="reverse"&&(h&&r<0&&Bb(b),pG(b,(r<0?-r:r)*6)):!y&&(r==="auto"&&Math.abs(v[0]-b[0])+Math.abs(v[1]-b[1])+Math.abs(v[v.length-2]-b[b.length-2])+Math.abs(v[v.length-1]-b[b.length-1])>Math.abs(v[0]-b[b.length-2])+Math.abs(v[1]-b[b.length-1])+Math.abs(v[v.length-2]-b[0])+Math.abs(v[v.length-1]-b[1])||r%2)?(Bb(b),p[h]=-1,y=!0):r==="auto"?p[h]=0:r==="reverse"&&(p[h]=-1),b.closed!==v.closed&&(b.closed=v.closed=!1));return m&&nd("shapeIndex:["+p.join(",")+"]"),e.shapeIndex=p,p}},gG=function(e,n,r,i,s){var a=xf(e[0]),o=xf(e[1]);GI(a,o,n||n===0?n:"auto",r,s)&&(e[0]=Hp(a),e[1]=Hp(o),(i==="log"||i===!0)&&nd('precompile:["'+e[0]+'","'+e[1]+'"]'))},X6e=function(e,n){if(!n)return e;var r=e.match(zv)||[],i=r.length,s="",a,o,l;for(n==="reverse"?(o=i-1,a=-2):(o=((parseInt(n,10)||0)*2+1+i*100)%i,a=2),l=0;lo)for(h=1/(Math.floor(r)+1),f=1;r>o;)a+=(i+(p-i)*h*f).toFixed(2)+","+(s+(y-s)*h*f).toFixed(2)+" ",r--,f++;a+=p+","+y+" ",i=p,s=y}return a},UI=function(e){var n=e[0].match(zv)||[],r=e[1].match(zv)||[],i=r.length-n.length;i>0?e[0]=yG(n,i):e[1]=yG(r,-i)},W6e=function(e){return isNaN(e)?UI:function(n){UI(n),n[1]=X6e(n[1],parseInt(e,10))}},q6e=function(e,n,r){var i=typeof e=="string",s,a;return(!i||V6e.test(e)||(e.match(zv)||[]).length<3)&&(s=Aj(e)[0],s?(a=(s.nodeName+"").toUpperCase(),n&&a!=="PATH"&&(s=xse(s,!1),a="PATH"),e=s.getAttribute(a==="PATH"?"d":"points")||"",s===r&&(e=s.getAttributeNS(null,"data-original")||e)):(nd("WARNING: invalid morph to: "+e),e=!1)),e},xG=function(e){for(var n=e.length,r,i,s,a,o,l,c,u;--n>-1;)for(r=e[n],u=r.cpData=r.cpData||[],u.length=0,c=r.length-2,l=0;lB6e?f:h,sl:c,cl:f0(o*o+l*l)-c,i:r}},AG=function(e){Cl=wse(),Hb=Hb||Cl&&Cl.plugins.morphSVG,Cl&&Hb?(Aj=Cl.utils.toArray,Sse=Cl.core.reverting||function(){},Hb.prototype._tweenRotation=Y6e,Ase=1):e&&nd("Please gsap.registerPlugin(MorphSVGPlugin)")},O1={version:"3.15.0",name:"morphSVG",rawVars:1,register:function(e,n){Cl=e,Hb=n,AG()},init:function(e,n,r,i,s){if(Ase||AG(1),!n)return nd("invalid shape"),!1;_P(n)&&(n=n.call(r,i,e,s));var a,o,l,c,u,f,h,p,y,m,v,b,w,O,k,E,T,N,_,I;if(typeof n=="string"||n.getBBox||n[0])n={shape:n};else if(typeof n=="object"){a={};for(o in n)a[o]=_P(n[o])&&o!=="render"?n[o].call(r,i,e,s):n[o];n=a}var j=e.nodeType?window.getComputedStyle(e):{},L=j.fill+"",B=!(L==="none"||(L.match(zv)||[])[3]==="0"||j.fillRule==="evenodd"),$=n.smooth,z=(n.origin||"50 50").split(",");if($===!0||$==="auto"?$={}:typeof $=="number"&&($={points:$}),a=(e.nodeName+"").toUpperCase(),u=a==="POLYLINE"||a==="POLYGON",a!=="PATH"&&!u&&!n.prop)return nd("Cannot morph a <"+a+"> element. "+vG),!1;if(o=a==="PATH"?"d":"points",!n.prop&&!_P(e.setAttribute))return!1;if(c=q6e(n.shape||n.d||n.points||"",o==="d",e),u&&H6e.test(c))return nd("A <"+a+"> cannot accept path data. "+vG),!1;if(f=n.shapeIndex||n.shapeIndex===0?n.shapeIndex:"auto",h=n.map||O1.defaultMap,this._prop=n.prop,this._render=n.render||O1.defaultRender,this._apply="updateTarget"in n?n.updateTarget:O1.defaultUpdateTarget,this._rnd=Math.pow(10,isNaN(n.precision)?2:+n.precision),this._tween=r,c){if(this._target=e,T=typeof n.precompile=="object",m=this._original=this._prop?e[this._prop]:e.getAttribute(o),!this._prop&&!e.getAttributeNS(null,"data-original")&&e.setAttributeNS(null,"data-original",m),o==="d"||this._prop){if(m=xf(T?n.precompile[0]:m),v=xf(T?n.precompile[1]:c),$){for(w=m.length;--w;)Cse(m[w])&&m.splice(w,1);jP(m,S6({},$,{points:+$.points||Math.max(ZI(m),ZI(v)),maxSegments:v.length})),jP(v,$.redraw===!1?$:S6({},$,{points:m}))}if(!T&&!GI(m,v,f,h,B))return!1;for((n.precompile==="log"||n.precompile===!0)&&nd('precompile:["'+Hp(m)+'","'+Hp(v)+'"]'),_=(n.type||O1.defaultType)!=="linear",I=n.curveMode||_,xG(m),xG(v),_&&(m.size||H2(m),v.size||H2(v),N=bG(z[0]),this._origin=m.origin={x:m.left+N.x*m.width,y:m.top+N.y*m.height},z[1]&&(N=bG(z[1])),this._eOrigin={x:v.left+N.x*v.width,y:v.top+N.y*v.height}),this._rawPath=e._gsRawPath=m,w=m.length;--w>-1;){for(k=m[w],E=v[w],p=k.cpData,y=E.cpData,O=k.length,Vb=0,b=0;b3?b+2:b-2,sa:p[b],ca:kse(y[b]-p[b]),sl:p[b+1],cl:y[b+1]-p[b+1]}:(E[b]!==k[b]&&(l=this.add(k,b,k[b],E[b],0,0,0,0,0,1)),E[b+1]!==k[b+1]&&(l=this.add(k,b+1,k[b+1],E[b+1],0,0,0,0,0,1)||l))}}else l=this.add(e,"setAttribute",e.getAttribute(o)+"",c+"",i,s,0,W6e(f),o);_&&(this.add(this._origin,"x",this._origin.x,this._eOrigin.x,0,0,0,0,0,1),l=this.add(this._origin,"y",this._origin.y,this._eOrigin.y,0,0,0,0,0,1)),l&&(this._props.push("morphSVG"),l.end=$&&$.persist!==!1?Hp(v):c,l.endProp=o)}return 1},render:function(e,n){for(var r=n._rawPath,i=n._controlPT,s=n._anchorPT,a=n._rnd,o=n._target,l=n._pt,c,u,f,h,p,y,m,v,b;l;)l.r(e,l.d),l=l._next;if(e===1&&n._apply)for(l=n._pt;l;)l.end&&(n._prop?o[n._prop]=l.end:o.setAttribute(l.endProp,l.end)),l=l._next;else if(r){for(;s;)p=s.sa+e*s.ca,h=s.sl+e*s.cl,s.t[s.i]=n._origin.x+cG(p)*h,s.t[s.i+1]=n._origin.y+uG(p)*h,s=s._next;for(;i;)f=r[i.j],y=i.i,p=i.sa+e*i.ca,v=uG(p),b=cG(p),h=i.sl+e*i.cl,f[y]=f[i.ai]-b*h,f[y+1]=f[i.ai+1]-v*h,i=i._next;if(!e&&Sse()&&(r=xf(n._original)),o._gsRawPath=r,n._apply){for(c="",u=" ",m=0;m"u"||(window.__playerStore=t)}function Ese(t){return Number.isFinite(t)&&t>0}function wG(t,e){const n=Math.max(0,Number.isFinite(e)?e:0),r=Math.max(0,Number.isFinite(t)?t:0);return n>0?Math.min(r,n):r}function O4(t){if(!t)return 0;try{const e=Number(t.getDuration());return Ese(e)?e:0}catch{return 0}}function tCe(t){return{now:()=>t.performance.now(),requestAnimationFrame:e=>t.requestAnimationFrame(e),cancelAnimationFrame:e=>t.cancelAnimationFrame(e)}}function nCe(t,e,n,r=()=>1){var p;const i=Math.max(0,Number.isFinite(e)?e:0);let s=wG(Number(((p=t.getTime)==null?void 0:p.call(t))??0),i),a=!1,o=0,l=s,c=n.now();const u=y=>{var m;if(s=wG(y,i),typeof t.renderSeek=="function"){t.renderSeek(s);return}(m=t.seek)==null||m.call(t,s)},f=()=>{o&&(n.cancelAnimationFrame(o),o=0)},h=y=>{if(!a)return;const m=Math.max(.1,Number(r())||1),v=(y-c)/1e3*m;if(u(l+v),s>=i){a=!1,o=0;return}o=n.requestAnimationFrame(h)};return{play:()=>{a||i<=0||(s>=i&&u(0),a=!0,l=s,c=n.now(),f(),o=n.requestAnimationFrame(h))},pause:()=>{a=!1,f()},seek:(y,m)=>{if(u(y),m!=null&&m.keepPlaying){a&&(l=s,c=n.now());return}a=!1,f()},getTime:()=>s,getDuration:()=>i,isPlaying:()=>a}}function jO(t,e){var n;(n=t.current)==null||n.adapter.pause(),t.current=null,e.current=!1}function rCe(t){const{cache:e,warned:n,bestAdapter:r,effectiveDuration:i,docDuration:s}=t,a=e.current;if((a==null?void 0:a.player)===r&&a.duration===i)return a.adapter;a==null||a.adapter.pause(),n.current||(n.current=!0,console.warn(`[useTimelinePlayer] Selected adapter duration (${O4(r)}s) does not cover the document duration (${s}s); falling back to seek-driven playback, which never starts media elements or WebAudio. Audio will not play in preview — extend the GSAP timeline to cover the declared data-duration.`));const o=nCe(r,i,t.clock,t.getPlaybackRate);window.__crocoPlannedPreviewDuration?.()>0&&a?.player===r&&o.seek(a.adapter.getTime());return e.current={player:r,duration:i,adapter:o},o}function OG(t){return{play:()=>t.play(),pause:()=>t.pause(),seek:(e,n)=>{const r=!(n!=null&&n.keepPlaying);r&&t.pause(),t.seek(e),r&&t.pause()},getTime:()=>t.time(),getDuration:()=>t.duration(),isPlaying:()=>t.isActive()}}function Tse(t,e,n,r,i){if(!(!n||n.startsWith("#")||n.startsWith("[data-composition-id=")))try{const s=r??"index.html",o=Array.from(t.querySelectorAll(n)).filter(l=>(i(l)??"index.html")===s).indexOf(e);return o>=0?o:void 0}catch{return}}const Ws="data-fx-chain",Pse=Ws.slice(5),h0=1,Xx=(t="frequency",e="Frequency",n=1e3,r=20,i=2e4)=>({kind:"number",key:t,label:e,unit:"Hz",min:r,max:i,step:1,default:n,scale:"log",automatable:!0}),LP=(t=.707,e="Bandwidth — higher is narrower.")=>({kind:"number",key:"q",label:"Q",unit:"",min:.1,max:20,step:.01,default:t,scale:"log",automatable:!0,hint:e}),LO=(t=-40,e=40,n=0)=>({kind:"number",key:"gain",label:"Gain",unit:"dB",min:t,max:e,step:.1,default:n,automatable:!0}),CG={kind:"enum",key:"poles",label:"Slope",options:[{value:"1",label:"6 dB/oct"},{value:"2",label:"12 dB/oct"}],default:"2",hint:"Two poles is the usual biquad; one pole is gentler."},nS=[{id:"gain",label:"Gain",group:"dynamics",description:"Raise or lower the whole signal. Automate it to duck under something else.",params:[LO(-60,12,0)],web:"gain-node"},{id:"peaking",label:"Peaking EQ",group:"filter",description:"Boost or cut a band, leaving everything either side alone.",params:[Xx("frequency","Frequency",1e3),LO(-40,40,0),LP(1)],web:"biquad-peaking"},{id:"lowshelf",label:"Low Shelf",group:"filter",description:"Lift or drop everything below the corner frequency.",params:[Xx("frequency","Frequency",200,20,2e3),LO(-40,40,0)],web:"biquad-lowshelf"},{id:"highshelf",label:"High Shelf",group:"filter",description:"Lift or drop everything above the corner frequency.",params:[Xx("frequency","Frequency",4e3,500,2e4),LO(-40,40,0)],web:"biquad-highshelf"},{id:"highpass",label:"High-pass",group:"filter",description:"Remove low frequencies — the usual fix for rumble on a voice.",params:[Xx("frequency","Cutoff",300,20,2e4),LP(.707),CG],web:"biquad-highpass"},{id:"lowpass",label:"Low-pass",group:"filter",description:"Remove high frequencies — darkens or muffles a track.",params:[Xx("frequency","Cutoff",8e3,100,2e4),LP(.707),CG],web:"biquad-lowpass"},{id:"compressor",label:"Compressor",group:"dynamics",description:"Pull loud parts down so the quiet ones can come up.",params:[{kind:"number",key:"threshold",label:"Threshold",unit:"dB",min:-60,max:0,step:.5,default:-24,hint:"Level above which the compressor starts working."},{kind:"number",key:"ratio",label:"Ratio",unit:":1",min:1,max:20,step:.1,default:4},{kind:"number",key:"attack",label:"Attack",unit:"ms",min:.01,max:2e3,step:.1,default:20,scale:"log"},{kind:"number",key:"release",label:"Release",unit:"ms",min:.01,max:9e3,step:1,default:250,scale:"log"},{kind:"number",key:"knee",label:"Knee",unit:"",min:1,max:8,step:.01,default:2.83,hint:"1 is a hard corner; higher eases into it."},{kind:"number",key:"makeup",label:"Makeup",unit:"dB",min:0,max:36,step:.1,default:0},{kind:"number",key:"mix",label:"Mix",unit:"",min:0,max:1,step:.01,default:1,hint:"Below 1 blends the dry signal back in."}],web:"worklet-compressor"},{id:"limiter",label:"Limiter",group:"dynamics",description:"Hard ceiling — nothing gets past the limit.",params:[{kind:"number",key:"limit",label:"Ceiling",unit:"dB",min:-24,max:0,step:.1,default:-1},{kind:"number",key:"attack",label:"Attack",unit:"ms",min:.1,max:80,step:.1,default:5},{kind:"number",key:"release",label:"Release",unit:"ms",min:1,max:8e3,step:1,default:50,scale:"log"},{kind:"number",key:"level_out",label:"Output",unit:"dB",min:-24,max:24,step:.1,default:0}],web:"worklet-limiter"},{id:"gate",label:"Noise Gate",group:"dynamics",description:"Silence the track when it drops below the threshold.",params:[{kind:"number",key:"threshold",label:"Threshold",unit:"dB",min:-80,max:0,step:.5,default:-35},{kind:"number",key:"range",label:"Range",unit:"dB",min:-80,max:0,step:.5,default:-24,hint:"How far down the gate pulls when closed."},{kind:"number",key:"ratio",label:"Ratio",unit:":1",min:1,max:20,step:.1,default:10},{kind:"number",key:"attack",label:"Attack",unit:"ms",min:.01,max:9e3,step:.1,default:1,scale:"log"},{kind:"number",key:"release",label:"Release",unit:"ms",min:.01,max:9e3,step:1,default:100,scale:"log"},{kind:"number",key:"knee",label:"Knee",unit:"",min:1,max:8,step:.01,default:2.83}],web:"worklet-gate"},{id:"saturate",label:"Saturation",group:"nonlinear",description:"Soft-clip the waveform for warmth or outright distortion.",params:[{kind:"enum",key:"type",label:"Curve",options:[{value:"tanh",label:"Tanh"},{value:"atan",label:"Arctan"},{value:"cubic",label:"Cubic"},{value:"exp",label:"Exponential"},{value:"alg",label:"Algebraic"},{value:"quintic",label:"Quintic"},{value:"sin",label:"Sine"},{value:"erf",label:"Error function"},{value:"hard",label:"Hard clip"}],default:"tanh"},{kind:"number",key:"threshold",label:"Threshold",unit:"dB",min:-40,max:0,step:.1,default:-6},{kind:"number",key:"output",automatable:!0,label:"Output",unit:"dB",min:-24,max:24,step:.1,default:0},{kind:"number",key:"oversample",label:"Oversample",unit:"x",min:1,max:8,step:1,default:4,hint:"Higher costs more but keeps aliasing down."}],web:"waveshaper"},{id:"bitcrush",label:"Bitcrush",group:"nonlinear",description:"Drop bit depth and sample rate for a lo-fi, digital sound.",params:[{kind:"number",key:"bits",label:"Bit depth",unit:"bit",min:1,max:32,step:.1,default:8},{kind:"number",key:"samples",label:"Sample hold",unit:"x",min:1,max:250,step:1,default:1,hint:"Repeats each sample N times — a crude downsample."},{kind:"number",key:"mix",label:"Mix",unit:"",min:0,max:1,step:.01,default:1}],web:"worklet-bitcrush"},{id:"pitchshift",label:"Pitch shift",group:"time",description:"Shifts pitch up or down without changing playback speed. Adds ~50 ms of latency.",params:[{kind:"number",key:"semitones",label:"Semitones",unit:"st",min:-12,max:12,step:1,default:0},{kind:"number",key:"mix",label:"Mix",unit:"",min:0,max:1,step:.01,default:1}],web:"worklet-pitchshift"},{id:"delay",label:"Delay",group:"time",description:"Repeating echoes behind the dry signal.",params:[{kind:"number",key:"time",automatable:!0,label:"Time",unit:"ms",min:1,max:5e3,step:1,default:250,scale:"log"},{kind:"number",key:"feedback",automatable:!0,label:"Feedback",unit:"",min:.01,max:.95,step:.01,default:.35},{kind:"number",key:"mix",automatable:!0,label:"Mix",unit:"",min:0,max:1,step:.01,default:.4}],web:"delay-feedback"},{id:"chorus",label:"Chorus",group:"time",description:"Detuned copies of the signal for width and thickness.",params:[{kind:"number",key:"delay",automatable:!0,label:"Delay",unit:"ms",min:1,max:100,step:.1,default:7},{kind:"number",key:"depth",automatable:!0,label:"Depth",unit:"ms",min:0,max:10,step:.01,default:2},{kind:"number",key:"speed",automatable:!0,label:"Rate",unit:"Hz",min:.01,max:10,step:.01,default:1},{kind:"number",key:"mix",automatable:!0,label:"Mix",unit:"",min:0,max:1,step:.01,default:.5}],web:"chorus-lfo"},{id:"phaser",label:"Phaser",group:"time",description:"Sweeping notches moving through the spectrum.",params:[{kind:"number",key:"in_gain",automatable:!0,label:"Input",unit:"",min:0,max:1,step:.01,default:.4},{kind:"number",key:"out_gain",automatable:!0,label:"Output",unit:"",min:0,max:2,step:.01,default:.74},{kind:"number",key:"delay",label:"Delay",unit:"ms",min:.1,max:5,step:.1,default:3},{kind:"number",key:"decay",label:"Decay",unit:"",min:0,max:.99,step:.01,default:.4},{kind:"number",key:"speed",automatable:!0,label:"Rate",unit:"Hz",min:.1,max:2,step:.01,default:.5},{kind:"enum",key:"type",label:"Waveform",options:[{value:"0",label:"Triangular"},{value:"1",label:"Sinusoidal"}],default:"0"}],web:"allpass-phaser"},{id:"reverb",label:"Reverb",group:"time",description:"Room tail. Both ends convolve the same generated impulse, so preview matches render.",params:[{kind:"number",key:"size",label:"Room size",unit:"",min:.05,max:1,step:.01,default:.7},{kind:"number",key:"damping",label:"Damping",unit:"",min:0,max:1,step:.01,default:.5,hint:"Higher rolls the top off the tail faster."},{kind:"number",key:"wet",automatable:!0,label:"Wet",unit:"",min:0,max:1,step:.01,default:.35},{kind:"number",key:"dry",automatable:!0,label:"Dry",unit:"",min:0,max:1,step:.01,default:.7}],web:"convolver"}],dE=new Map(nS.map(t=>[t.id,t]));function rS(t){return dE.get(t)}nS.map(t=>t.id);function $f(t){const e=dE.get(t);if(!e)return{};const n={};for(const r of e.params)n[r.key]=r.default;return n}function zd(t,e){const n=dE.get(t);if(!n)return{};const r={};for(const i of n.params){const s=e==null?void 0:e[i.key];if(i.kind==="enum"){const o=i.options.some(l=>l.value===s);r[i.key]=o?s:i.default;continue}const a=typeof s=="number"?s:typeof s=="string"&&s.trim()!==""?Number(s):Number.NaN;r[i.key]=Number.isFinite(a)?Math.min(i.max,Math.max(i.min,a)):i.default}return r}class C1 extends Error{constructor(e){super(e),this.name="AudioFxChainError"}}function pE(t){let e;try{e=JSON.parse(t)}catch(i){throw new C1(`Chain file is not valid JSON: ${i.message}`)}if(typeof e!="object"||e===null)throw new C1("Chain file must be a JSON object.");const n=e;if(n.version!==h0)throw new C1(`Unsupported chain version: ${String(n.version)}`);if(!Array.isArray(n.nodes))throw new C1("Chain file is missing a `nodes` array.");const r=n.nodes.map(sCe);return{version:h0,nodes:r}}function iCe(t){return t.nodes.filter(e=>e.enabled!==!1)}function xu(t){return JSON.stringify({version:h0,nodes:t.nodes.map(aCe)})}function dy(t){const e=new Set(t.nodes.map(n=>n.id).filter(Boolean));for(let n=1;;n+=1){const r=`n${n}`;if(!e.has(r))return r}}function sCe(t,e){if(typeof t!="object"||t===null)throw new C1(`Node ${e} is not an object.`);const n=t;if(typeof n.type!="string"||!dE.has(n.type))throw new C1(`Node ${e} has unknown effect type: ${String(n.type)}`);return Nse({type:n.type,id:rd(n.id),fromCarve:O6(n.fromCarve),fromPreset:rd(n.fromPreset),label:rd(n.label),fromEq:rd(n.fromEq),fromLeveller:O6(n.fromLeveller),presetAmount:Mse(n.presetAmount),enabled:n.enabled!==!1,params:zd(n.type,n.params??void 0)})}function aCe(t){return Nse({type:t.type,id:rd(t.id),fromCarve:O6(t.fromCarve),fromPreset:rd(t.fromPreset),label:rd(t.label),fromEq:rd(t.fromEq),fromLeveller:O6(t.fromLeveller),presetAmount:t.presetAmount===1?void 0:Mse(t.presetAmount),enabled:t.enabled===!1?!1:void 0,params:zd(t.type,t.params)})}function rd(t){return typeof t=="string"&&t?t:void 0}function O6(t){return t===!0?!0:void 0}function Mse(t){if(!(typeof t!="number"||!Number.isFinite(t)))return Math.min(1,Math.max(0,t))}function Nse(t){for(const e of Object.keys(t))t[e]===void 0&&delete t[e];return t}const XI="data-hf-render-id",oCe="data-hf-group-render-id",Oj=12,Dse=10**(Oj/20),md=-100,Og=100,Ise=-60;function Cj(t){return Number.isFinite(t)?Math.max(0,Math.min(Dse,t)):1}function _se(t){return Cj(t).toFixed(6).replace(/\.?0+$/,"")}function WI(t){const e=Math.max(md,Math.min(Og,t));return e===md?0:10**((e<0?e/Math.abs(md)*Math.abs(Ise):e/Og*Oj)/20)}function Rse(t){const e=Cj(t);if(e===0)return md;const n=20*Math.log10(e),r=n<0?n/Math.abs(Ise)*Math.abs(md):n/Oj*Og;return Math.max(md,Math.min(Og,r))}function qI(t){const e=Cj(t);if(e===0)return"-∞ dB";const n=20*Math.log10(e),r=Math.abs(n)<.05?0:n;return(r>0?"+":"")+r.toFixed(1)+" dB"}const so="data-automation",jse=so.slice(5),mE=1,Lse=512;class vp extends Error{constructor(e){super(e),this.name="AudioAutomationError"}}const Q2="volume";function py(t){if(t===Q2)return{kind:"volume"};const e=t.split(".");if(e.length===3&&e[0]==="fx"&&e[1]===Fse){const i=e[2];return i?{kind:"preset",presetId:i}:null}if(e.length!==3||e[0]!=="fx")return null;const[,n,r]=e;return!n||!r?null:{kind:"fx",nodeId:n,param:r}}function Ed(t,e){return`fx.${t}.${e}`}const Fse="preset";function FP(t){return`fx.${Fse}.${t}`}const lCe={min:0,max:1,step:.01,unit:"",label:"Amount",scale:"linear",default:1},$se={min:0,max:Dse,step:.01,unit:"",label:"Volume",scale:"linear",default:1};function d0(t,e){const n=py(t);if(!n)return null;if(n.kind==="volume")return $se;if(n.kind==="preset")return(e==null?void 0:e.nodes.some(o=>o.fromPreset===n.presetId))?{...lCe,label:`${n.presetId} · Amount`}:null;const r=e==null?void 0:e.nodes.find(a=>a.id===n.nodeId);if(!r)return null;const i=rS(r.type),s=i==null?void 0:i.params.find(a=>a.key===n.param);return!s||s.kind!=="number"?null:{min:s.min,max:s.max,step:s.step,unit:s.unit,label:`${(i==null?void 0:i.label)??r.type} · ${s.label}`,scale:s.scale==="log"&&s.min>0?"log":"linear",default:s.default}}function Gv(t){if(typeof t=="number")return Number.isFinite(t)?t:null;if(typeof t=="string"&&t.trim()!==""){const e=Number(t);return Number.isFinite(e)?e:null}return null}function cCe(t){const e=Gv(t);return e===null||e===0?0:Math.min(1,Math.max(-1,e))}function kj(t,e){const n=Gv(t),r=Gv(e);if(n===null||r===null)return null;const i=o=>Math.min(.999,Math.max(.001,o)),s=i(n),a=i(r);return Math.abs(s-a)<1e-6?null:{x:s,y:a}}function uCe(t,e){const n=kj(t,e);return n?{viaX:n.x,viaY:n.y}:null}function fCe(t){const e=cCe(t==null?void 0:t.curve),n=kj(t==null?void 0:t.viaX,t==null?void 0:t.viaY);return{...e?{curve:e}:{},...n?{viaX:n.x,viaY:n.y}:{}}}function hCe(t,e){const n=Gv(t==null?void 0:t.t),r=Gv(t==null?void 0:t.v);if(n===null||r===null)return null;const i=e?Math.min(e.max,Math.max(e.min,r)):r;return{t:Math.max(0,n),v:i,...fCe(t)}}function Bse(t,e){const n=t.map(i=>hCe(i,e)).filter(i=>i!==null).sort((i,s)=>i.t-s.t),r=[];for(const i of n)r.length>0&&r[r.length-1].t===i.t?r[r.length-1]=i:r.push(i);return r.slice(0,Lse)}function dCe(t){const e=[];for(const n of t.lanes){if(!py(n.target))continue;const r=n.target===Q2?$se:null,i=Bse(n.points??[],r);i.length>0&&e.push({target:n.target,points:i})}return{version:mE,lanes:e}}function Vse(t,e){const n=[];for(const r of t.lanes){const i=d0(r.target,e);if(!i)continue;const s=Bse(r.points,i);s.length>0&&n.push({target:r.target,points:s})}return{version:mE,lanes:n}}function Hse(t){let e;try{e=JSON.parse(t)}catch(i){throw new vp(`Automation is not valid JSON: ${i.message}`)}if(typeof e!="object"||e===null)throw new vp("Automation must be a JSON object.");const n=e;if(n.version!==mE)throw new vp(`Unsupported automation version: ${String(n.version)}`);if(!Array.isArray(n.lanes))throw new vp("Automation is missing a `lanes` array.");const r=n.lanes.map((i,s)=>{if(typeof i!="object"||i===null)throw new vp(`Lane ${s} is not an object.`);const a=i;if(typeof a.target!="string"||!py(a.target))throw new vp(`Lane ${s} has an unreadable target: ${String(a.target)}`);if(!Array.isArray(a.points))throw new vp(`Lane ${s} is missing a \`points\` array.`);return{target:a.target,points:a.points}});return dCe({lanes:r})}function Qse(t){return JSON.stringify({version:mE,lanes:t.lanes.map(e=>({target:e.target,points:e.points.map(n=>({t:n.t,v:n.v,...n.curve?{curve:n.curve}:{},...n.viaX!==void 0&&n.viaY!==void 0?{viaX:n.viaX,viaY:n.viaY}:{}}))}))})}function pCe(t,e){return e?Math.pow(t,Math.pow(2,2*e)):t}function mCe(t,e){const n=t-.5,r=e-.5,i=.999,s=1e6,a=n>0?n/(i-t):n<0?-n/(t-(1-i)):0,o=r>0?r/(i-e):r<0?-r/(e-(1-i)):0,l=Math.min(s,Math.max(1,a,o));return{cx:t+n/l,cy:e+r/l,w:l}}function gCe(t,e,n){const{cx:r,cy:i,w:s}=mCe(e,n),a=2-2*s,o=t*a-1+2*s*r,l=-t*a-2*s*r,c=yCe(o,l,t),u=1-c,f=u*u+2*s*c*u+c*c;return f>0?(2*s*i*c*u+c*c)/f:t}function yCe(t,e,n){if(Math.abs(t)<1e-12)return Math.abs(e)<1e-12?n:-n/e;const r=Math.sqrt(Math.max(0,e*e-4*t*n)),i=(-e+r)/(2*t),s=(-e-r)/(2*t),a=o=>o>=-1e-9&&o<=1+1e-9;return a(i)?Math.min(1,Math.max(0,i)):a(s)?Math.min(1,Math.max(0,s)):n}function xCe(t,e){const n=kj(e.viaX,e.viaY);return n?gCe(Math.min(1,Math.max(0,t)),n.x,n.y):pCe(t,e.curve)}function bCe(t,e,n,r){return r==="log"&&t>0&&e>0?Math.exp(Math.log(t)+(Math.log(e)-Math.log(t))*n):t+(e-t)*n}function Bf(t,e,n="linear"){const r=t.points;if(r.length===0)return 0;const i=r[0];if(e<=i.t)return i.v;const s=r[r.length-1];if(e>=s.t)return s.v;let a=0,o=r.length-1;for(;o-a>1;){const f=a+o>>1;r[f].t<=e?a=f:o=f}const l=r[a],c=r[o],u=c.t-l.t;return u<=0?c.v:bCe(l.v,c.v,xCe((e-l.t)/u,l),n)}const ya="hf-audio-group",Go="data-audio-group";function vCe(t){const e=t==null?void 0:t.getAttribute("data-volume"),n=e?parseFloat(e):1;return Number.isFinite(n)?n:1}function ACe(t,e,n){const r=n==null?void 0:n.getAttribute(Ws),i=n==null?void 0:n.getAttribute(so);return{id:t,label:(n==null?void 0:n.getAttribute("data-label"))||t,memberIds:e,...r?{fxChain:r}:{},...i?{automation:i}:{},volume:vCe(n),hidden:(n==null?void 0:n.hasAttribute("data-hidden"))??!1}}function SCe(t,e){var i,s;const n=Array.from(((i=t==null?void 0:t.querySelectorAll)==null?void 0:i.call(t,`${ya}[${XI}]`))??[]).find(a=>a.getAttribute(XI)===e);if(n)return n;const r=(t==null?void 0:t.getElementById(e))??null;return r&&((s=r.tagName)==null?void 0:s.toLowerCase())===ya?r:null}function Zd(t){const e=new Map;for(const i of t.querySelectorAll(`audio[${Go}]`)){const s=i.getAttribute(oCe)??i.getAttribute(Go);if(!s||!i.id)continue;const a=e.get(s);a?a.push(i.id):e.set(s,[i.id])}const n=new Map;for(const i of t.querySelectorAll(ya)){const s=i.getAttribute(XI)??i.id;s&&n.set(s,i)}const r=[];for(const[i,s]of e)r.push(ACe(i,s,n.get(i)));return r}function zse(t,e){const n=new Map(Zd(t).map(a=>[a.id,a])),r=new Set,i=[],s=a=>{r.has(a)||(r.add(a),i.push(a))};for(const a of e){const o=n.get(a);o?o.memberIds.forEach(s):t.getElementById(a)&&!SCe(t,a)&&s(a)}return i}const Vf="data-hf-reveal-prior-z",p0="data-hf-reveal-prior-pos";function Ej(t){const e=t.getAttribute(Vf);if(e==null)return null;const n=Number.parseInt(e,10);return Number.isFinite(n)?n:null}function gE(t){var a,o;const e=Ej(t);if(e!=null)return e;const n=t,r=l=>{if(l==null||l===""||l==="auto")return null;const c=Number.parseInt(l,10);return Number.isFinite(c)?c:null},i=r((a=n.style)==null?void 0:a.zIndex);if(i!=null)return i;const s=(o=t.ownerDocument)==null?void 0:o.defaultView;if(s!=null&&s.getComputedStyle){const l=r(s.getComputedStyle(n).zIndex);if(l!=null)return l}return 0}function Zse(t){if(!t)return 0;const e=Number.parseFloat(t.getAttribute("data-duration")??"")||Number.parseFloat(t.getAttribute("data-hf-authored-duration")??"");return Ese(e)?e:0}function Gse(t){return Number.isFinite(t)&&t>0?Math.max(.1,Math.min(5,t)):1}function yE(t){return t.tagName.toLowerCase()===ya?!0:!!t.closest(["[data-hyperframes-ignore]","[data-hyperframes-picker-ignore]","[data-hf-ignore]","[data-hf-color-grading-canvas]"].join(","))}function Tj(t){if(!t)return 0;const e=t.querySelector("[data-composition-id]");let n=0;for(const r of Array.from(t.querySelectorAll("[data-start]"))){if(r===e||yE(r))continue;const i=Number.parseFloat(r.getAttribute("data-start")??""),s=Zse(r);!Number.isFinite(i)||i<0||s<=0||(n=Math.max(n,i+s))}return n}function Use(t){if(!t)return 0;const e=Zse(t.querySelector("[data-composition-id]"));return e>0?e:Tj(t)}function Pj(t){return t?Tj(new DOMParser().parseFromString(t,"text/html")):0}function YI(t){var n;const e=((n=t.ownerDocument.defaultView)==null?void 0:n.HTMLElement)??globalThis.HTMLElement;return typeof e<"u"&&t instanceof e}function Xse(t){const e=t.ownerDocument.defaultView??window,n=e.HTMLMediaElement??globalThis.HTMLMediaElement,r=e.HTMLImageElement??globalThis.HTMLImageElement;if(t instanceof n||t instanceof r)return t;const i=t.querySelector("video, audio, img");return i instanceof n||i instanceof r?i:null}function wCe(t,e){const n=e.getAttribute("data-playback-start"),r=e.getAttribute("data-media-start"),i=n??r;if(i!=null){const a=parseFloat(i);Number.isFinite(a)&&(t.playbackStart=a)}n!=null?t.playbackStartAttr="playback-start":r!=null&&(t.playbackStartAttr="media-start");const s=Number.parseFloat(e.getAttribute("data-playback-rate")??"");Number.isFinite(s)&&s>0&&(t.playbackRate=Gse(s))}function Wse(t,e){wCe(t,e);const n=Xse(e);if(!n)return;t.tag=n.tagName.toLowerCase();const r=n.getAttribute("src");r&&(t.src=r);const s=(n.ownerDocument.defaultView??window).HTMLMediaElement??globalThis.HTMLMediaElement;if(typeof s>"u"||!(n instanceof s))return;const a=e.getAttribute("data-source-duration")??n.getAttribute("data-source-duration"),o=a?parseFloat(a):n.duration;Number.isFinite(o)&&o>0&&(t.sourceDuration=o);const l=n.defaultPlaybackRate;t.playbackRate==null&&Number.isFinite(l)&&l>0&&(t.playbackRate=Gse(l))}function iS(t){var i,s,a;const e=(i=t.label)==null?void 0:i.trim();if(e)return e;const n=(s=t.id)==null?void 0:s.trim();if(n)return n;const r=(a=t.tag)==null?void 0:a.trim().toLowerCase();return r?`${r} clip`:"Timeline clip"}const OCe=new Set(["base","link","meta","noscript","script","style","template"]);function kG(t){return t.trim().replace(/[_-]+/g," ").replace(/\s+/g," ").replace(/\b\w/g,e=>e.toUpperCase())}function CCe(t){const e=t.getAttribute("data-timeline-label")??t.getAttribute("data-label")??t.getAttribute("aria-label");if(e!=null&&e.trim())return e.trim();if(t.id.trim())return kG(t.id);const n=t.className.split(/\s+/).filter(Boolean),r=n.find(i=>i!=="clip")??n[0];return r?kG(r):iS({tag:t.tagName})}function m0(t){if(YI(t)&&t.id)return`#${CSS.escape(t.id)}`;const e=t.getAttribute("data-composition-id");if(e)return`[data-composition-id="${CSS.escape(e)}"]`;if(YI(t)){const n=t.className.split(/\s+/).filter(Boolean),r=n.find(i=>i!=="clip")??n[0];if(r)return`.${CSS.escape(r)}`}}function g0(t){var n;const e=(n=t.parentElement)==null?void 0:n.closest("[data-composition-id]");return(e==null?void 0:e.getAttribute("data-composition-file"))??(e==null?void 0:e.getAttribute("data-composition-src"))??void 0}function Uv(t,e,n){return Tse(t,e,n,g0(e),g0)}function Xv(t){const e=t.sourceFile??"index.html";return t.domId?`${e}#${t.domId}`:t.selector?`${e}:${t.selector}:${t.selectorIndex??0}`:`${e}:${t.id}:${t.fallbackIndex}`}function C6(t){const e=t.lastIndexOf("#");return e<0?{sourceFile:null,domId:t}:{sourceFile:t.slice(0,e),domId:t.slice(e+1)}}function Wv(t){var r;const e=((r=t.preferredId)==null?void 0:r.trim())||Xv({id:t.label,fallbackIndex:t.fallbackIndex,domId:t.domId,selector:t.selector,selectorIndex:t.selectorIndex,sourceFile:t.sourceFile}),n=Xv({id:e,fallbackIndex:t.fallbackIndex,domId:t.domId,selector:t.selector,selectorIndex:t.selectorIndex,sourceFile:t.sourceFile});return{id:e,key:n}}function Zn(t){return t.key??t.id}function k6(t){return t.domId||null}function q1(t){if(!(!t.domId&&!t.selector))return Xv({id:"",fallbackIndex:0,...t})}function kCe(t){const e=t.querySelector("[data-composition-id]");return Array.from(t.querySelectorAll("[data-start]")).filter(n=>n!==e&&!yE(n))}function ECe(t,e){return Math.abs(t-e)<.001}const TCe=[["data-start",t=>t.start],["data-duration",t=>t.duration],["data-track-index",t=>t.track]];function PCe(t,e){var r;const n=(r=e.tagName)==null?void 0:r.toLowerCase();return n&&t.tagName.toLowerCase()!==n?!1:TCe.every(([i,s])=>{const a=Number.parseFloat(t.getAttribute(i)??"");return!Number.isFinite(a)||ECe(a,s(e))})}function MCe(t,e){return t.getElementById(e)??t.querySelector(`[data-composition-id="${CSS.escape(e)}"]`)??t.querySelector(`.${CSS.escape(e)}`)??null}function NCe(t,e,n,r=new Set){const i=e.id?MCe(t,e.id):null;if(i&&!r.has(i))return i;const s=kCe(t).filter(o=>!r.has(o)),a=s.find(o=>PCe(o,e));return a||(s[n]??null)}function DCe(t,e){if(!YI(e)||yE(e)||e.parentElement!==t)return!1;const n=e.tagName.toLowerCase();return OCe.has(n)||e.hasAttribute("data-start")||e.hasAttribute("data-track-index")?!1:!!m0(e)}function ICe(t,e,n){return n?e&&t.has(e)?new Set(t):new Set:e?new Set([e]):new Set}function _Ce(t,e){return!t||e===null?!1:t.elementKey===C6(e).domId}const qse="hf-studio-ui-preferences";function EG(t){return typeof t=="object"&&t!==null}function Yse(){if(typeof window>"u")return null;try{return window.localStorage}catch{return null}}function Kse(t){if(!t)return{};try{const e=t.getItem(qse);if(!e)return{};const n=JSON.parse(e);if(!EG(n))return{};const r={};if(typeof n.leftCollapsed=="boolean"&&(r.leftCollapsed=n.leftCollapsed),typeof n.leftWidth=="number"&&Number.isFinite(n.leftWidth)&&(r.leftWidth=n.leftWidth),typeof n.rightWidth=="number"&&Number.isFinite(n.rightWidth)&&(r.rightWidth=n.rightWidth),typeof n.timelineVisible=="boolean"&&(r.timelineVisible=n.timelineVisible),typeof n.timelineHeight=="number"&&Number.isFinite(n.timelineHeight)&&(r.timelineHeight=n.timelineHeight),typeof n.playbackRate=="number"&&Number.isFinite(n.playbackRate)&&(r.playbackRate=n.playbackRate),typeof n.audioMuted=="boolean"&&(r.audioMuted=n.audioMuted),typeof n.audioVolume=="number"&&Number.isFinite(n.audioVolume)&&n.audioVolume>=0&&n.audioVolume<=1&&(r.audioVolume=n.audioVolume),n.thumbnailMode==="adaptive"||n.thumbnailMode==="hidden"?r.thumbnailMode=n.thumbnailMode:typeof n.thumbnailsEnabled=="boolean"&&(r.thumbnailMode=n.thumbnailsEnabled?"adaptive":"hidden"),EG(n.previewZoom)){const{zoomPercent:i,panX:s,panY:a}=n.previewZoom;typeof i=="number"&&Number.isFinite(i)&&typeof s=="number"&&Number.isFinite(s)&&typeof a=="number"&&Number.isFinite(a)&&(r.previewZoom={zoomPercent:i,panX:s,panY:a})}return Array.isArray(n.recentBlocks)&&(r.recentBlocks=n.recentBlocks.filter(i=>typeof i=="string")),typeof n.snapEnabled=="boolean"&&(r.snapEnabled=n.snapEnabled),typeof n.gridVisible=="boolean"&&(r.gridVisible=n.gridVisible),typeof n.gridSpacing=="number"&&Number.isFinite(n.gridSpacing)&&(r.gridSpacing=n.gridSpacing),typeof n.snapToGrid=="boolean"&&(r.snapToGrid=n.snapToGrid),typeof n.timelineSnapEnabled=="boolean"&&(r.timelineSnapEnabled=n.timelineSnapEnabled),(n.timeDisplayMode==="time"||n.timeDisplayMode==="frame")&&(r.timeDisplayMode=n.timeDisplayMode),(n.timelineZoomMode==="fit"||n.timelineZoomMode==="manual")&&(r.timelineZoomMode=n.timelineZoomMode),typeof n.timelineManualZoomPercent=="number"&&Number.isFinite(n.timelineManualZoomPercent)&&(r.timelineManualZoomPercent=n.timelineManualZoomPercent),typeof n.agentToolsEnabled=="boolean"&&(r.agentToolsEnabled=n.agentToolsEnabled),r}catch{return{}}}function no(t=Yse()){return Kse(t)}function kl(t,e=Yse()){if(e)try{const n={...Kse(e),...t};e.setItem(qse,JSON.stringify(n))}catch{}}const Jse=10,RCe=48,jCe=.5,LCe=2,FCe=.014;function Mj(t){if(!Number.isFinite(t)||t<=0)return 100;const e=Qd*RCe;return Math.max(100,Math.round(e/t*100))}function B0(t,e){if(!Number.isFinite(t))return 100;const n=Mj(e);return Math.max(Jse,Math.min(n,Math.round(t)))}function xE(t,e,n){return t==="fit"?100:B0(e,n)}function $Ce(t,e){return!Number.isFinite(t)||t<=0||!Number.isFinite(e)||e<=0?100:B0(t/e*100,e)}function BCe(t,e,n){if(!Number.isFinite(t)||t<=0)return 100;const r=xE(e,n,t);return e==="fit"?t:t*(r/100)}function TG(t,e,n,r){const i=xE(e,n,r),s=t==="in"?i*LCe:i*jCe;return B0(s,r)}function VCe(t,e,n,r){const i=xE(e,n,r);return!Number.isFinite(t)||t===0?i:B0(i*Math.exp(-t*FCe),r)}const E6=Math.log(Jse);function HCe(t,e){const n=B0(t,e),r=Math.log(Mj(e));return(Math.log(n)-E6)/(r-E6)*100}function QCe(t,e){const n=Math.max(0,Math.min(100,t)),r=Math.log(Mj(e)),i=E6+n/100*(r-E6);return B0(Math.exp(i),e)}function KI(t,e){return t.projectId===e.timelineProjectId&&t.sessionEpoch===e.timelineSessionEpoch}function eae(t,e){return t.projectId===e.timelineProjectId&&t.sessionEpoch===e.timelineSessionEpoch&&t.elementId===e.selectedElementId}function zCe(t,e){return{selectedKeyframes:new Set,toggleSelectedKeyframe:n=>t(r=>{const i=new Set(r.selectedKeyframes);return i.has(n)?i.delete(n):i.add(n),{selectedKeyframes:i}}),clearSelectedKeyframes:()=>t({selectedKeyframes:new Set}),expandedClipIds:new Set,toggleClipExpanded:n=>t(r=>{const i=new Set(r.expandedClipIds);return i.has(n)?i.delete(n):i.add(n),{expandedClipIds:i}}),setClipExpanded:(n,r)=>t(i=>{if(i.expandedClipIds.has(n)===r)return i;const s=new Set(i.expandedClipIds);return r?s.add(n):s.delete(n),{expandedClipIds:s}}),expandClips:n=>t(r=>{if(n.every(s=>r.expandedClipIds.has(s)))return r;const i=new Set(r.expandedClipIds);for(const s of n)i.add(s);return{expandedClipIds:i}}),collapsedGroupIds:new Set,toggleGroupExpanded:n=>t(r=>{const i=new Set(r.collapsedGroupIds);return i.has(n)?i.delete(n):i.add(n),{collapsedGroupIds:i}}),expandedLaneOwnerIds:new Set,toggleLaneOwnerExpanded:n=>t(r=>{const i=new Set(r.expandedLaneOwnerIds);return i.has(n)?i.delete(n):i.add(n),{expandedLaneOwnerIds:i}}),focusedEaseSegment:null,focusedEaseRequestNonce:0,setFocusedEaseSegment:n=>t(r=>{const i=r.focusedEaseRequestNonce+1,{timelineProjectId:s,timelineSessionEpoch:a}=e();return{focusedEaseRequestNonce:i,focusedEaseSegment:{...n,projectId:s,sessionEpoch:a,nonce:i}}}),clearFocusedEaseSegment:n=>t(r=>{var i;return((i=r.focusedEaseSegment)==null?void 0:i.nonce)===n?{focusedEaseSegment:null}:r}),revealedAudioFxTarget:null,revealedAudioFxNonce:0,setRevealedAudioFxTarget:n=>t(r=>{const i=r.revealedAudioFxNonce+1,{timelineProjectId:s,timelineSessionEpoch:a}=e();return{revealedAudioFxNonce:i,revealedAudioFxTarget:{...n,projectId:s,sessionEpoch:a,nonce:i}}}),clearRevealedAudioFxTarget:n=>t(r=>{var i;return((i=r.revealedAudioFxTarget)==null?void 0:i.nonce)===n?{revealedAudioFxTarget:null}:r}),keyframeCache:new Map,setKeyframeCache:(n,r)=>t(i=>{if(r?i.keyframeCache.get(n)===r:!i.keyframeCache.has(n))return i;const s=new Map(i.keyframeCache);return r?s.set(n,r):s.delete(n),{keyframeCache:s}}),gsapAnimations:new Map,setGsapAnimations:(n,r)=>t(i=>{if(r?i.gsapAnimations.get(n)===r:!i.gsapAnimations.has(n))return i;const s=new Map(i.gsapAnimations);return r?s.set(n,r):s.delete(n),{gsapAnimations:s}})}}function ZCe(t){return{automationSelection:null,setAutomationSelection:e=>t({automationSelection:{...e,t0:Math.min(e.t0,e.t1),t1:Math.max(e.t0,e.t1),v0:Math.min(e.v0,e.v1),v1:Math.max(e.v0,e.v1)}}),clearAutomationSelection:()=>t({automationSelection:null})}}function GCe(t){return{motionPathArmed:!1,setMotionPathArmed:e=>t({motionPathArmed:e}),motionPathCreateAvailable:!1,setMotionPathCreateAvailable:e=>t({motionPathCreateAvailable:e}),autoKeyframeEnabled:!0,setAutoKeyframeEnabled:e=>t({autoKeyframeEnabled:e})}}function UCe(t,e,n,r){return{id:t,projectId:e,sessionEpoch:n,nonce:r}}const tae="follow-preference";function XCe(t,e=tae){return t??(e==="legacy-default"?"hidden":"adaptive")}function WCe(t,e=tae){return e==="force-hidden"?"hidden":t}function qCe(t){return{thumbnailMode:XCe(no().thumbnailMode),setThumbnailMode:e=>{kl({thumbnailMode:e}),t({thumbnailMode:e})}}}const $P=new Set,xa={notify:t=>$P.forEach(e=>e(t)),subscribe:t=>($P.add(t),()=>$P.delete(t))};function BP(t,e){const n=new Set(t);return n.size===0?{selectedElementIds:n,selectedElementId:null}:e&&n.has(e)?{selectedElementIds:n,selectedElementId:e}:{selectedElementIds:n,selectedElementId:n.values().next().value??null}}function JI(){return{isPlaying:!1,currentTime:0,duration:0,timelineReady:!1,beatDragging:!1,elements:[],selectedElementId:null,zEditVersion:0,inPoint:null,outPoint:null,activeTool:"select",activeKeyframePct:null,motionPathArmed:!1,motionPathCreateAvailable:!1,selectedKeyframes:new Set,automationSelection:null,expandedClipIds:new Set,collapsedGroupIds:new Set,expandedLaneOwnerIds:new Set,focusedEaseSegment:null,revealedAudioFxTarget:null,selectedElementIds:new Set,requestedSeekTime:null,lintFindingsByElement:new Map,timelineFocus:null,keyframeCache:new Map,gsapAnimations:new Map,beatAnalysis:null,beatEdits:null,beatUndo:[],beatRedo:[],beatPersist:null,clipManifest:null,clipParentMap:new Map,domClipChildren:[],subCompositionHostState:new Map}}const ue=lE((t,e)=>({isPlaying:!1,currentTime:0,duration:0,timelineReady:!1,timelineSessionEpoch:0,timelineProjectId:null,beatDragging:!1,elements:[],selectedElementId:null,playbackRate:no().playbackRate??1,audioMuted:no().audioMuted??!1,audioVolume:no().audioVolume??1,loopEnabled:!1,zoomMode:"fit",manualZoomPercent:100,zEditVersion:0,timelinePps:100,timelineFitPps:100,inPoint:null,outPoint:null,activeTool:"select",setActiveTool:n=>t({activeTool:n}),...zCe(t,()=>({timelineProjectId:e().timelineProjectId,timelineSessionEpoch:e().timelineSessionEpoch})),...qCe(t),...ZCe(t),...GCe(t),activeKeyframePct:null,setActiveKeyframePct:n=>t({activeKeyframePct:n}),selectedElementIds:new Set,setSelection:(n,r)=>t(BP(n,r)),addSelectedElementId:n=>t(r=>{const i=new Set(r.selectedElementIds);return i.add(n),BP(i,r.selectedElementId)}),toggleSelectedElementId:n=>t(r=>{const i=new Set(r.selectedElementIds);return i.has(n)?i.delete(n):i.add(n),BP(i,r.selectedElementId)}),clearSelection:()=>t({selectedElementId:null,selectedElementIds:new Set}),requestedSeekTime:null,requestSeek:n=>t({requestedSeekTime:n}),clearSeekRequest:()=>t({requestedSeekTime:null}),playbackRequest:null,requestPlayback:(n,r=null)=>t(i=>{var s;return{playbackRequest:{playing:n,returnTo:r,nonce:(((s=i.playbackRequest)==null?void 0:s.nonce)??0)+1}}}),clearPlaybackRequest:()=>t({playbackRequest:null}),clipRevealRequest:null,requestClipReveal:n=>t(r=>{var i;return{clipRevealRequest:{elementId:n,nonce:(((i=r.clipRevealRequest)==null?void 0:i.nonce)??0)+1}}}),clearClipRevealRequest:()=>t({clipRevealRequest:null}),timelineFocus:null,timelineFocusNonce:0,requestTimelineFocus:n=>t(r=>{const i=r.timelineFocusNonce+1;return{timelineFocusNonce:i,timelineFocus:UCe(n,r.timelineProjectId,r.timelineSessionEpoch,i)}}),clearTimelineFocus:n=>t(r=>{var i;return((i=r.timelineFocus)==null?void 0:i.nonce)===n?{timelineFocus:null}:r}),lintFindingsByElement:new Map,setLintFindingsByElement:n=>t({lintFindingsByElement:n}),beatAnalysis:null,setBeatAnalysis:n=>t({beatAnalysis:n}),beatEdits:null,setBeatEdits:n=>t({beatEdits:n}),beatUndo:[],beatRedo:[],beatPersist:null,setBeatPersist:n=>t({beatPersist:n}),commitBeatEdits:(n,r)=>{var i,s;t(a=>({beatEdits:n,beatUndo:[...a.beatUndo,{restore:a.beatEdits,at:Date.now(),label:r}],beatRedo:[]})),(s=(i=e()).beatPersist)==null||s.call(i)},undoBeatEdits:()=>{var i,s;const n=e(),r=n.beatUndo[n.beatUndo.length-1];return r?(t({beatEdits:r.restore,beatUndo:n.beatUndo.slice(0,-1),beatRedo:[...n.beatRedo,{restore:n.beatEdits,at:r.at,label:r.label}]}),(s=(i=e()).beatPersist)==null||s.call(i),r.label):null},resetBeatHistory:()=>t({beatUndo:[],beatRedo:[]}),redoBeatEdits:()=>{var i,s;const n=e(),r=n.beatRedo[n.beatRedo.length-1];return r?(t({beatEdits:r.restore,beatRedo:n.beatRedo.slice(0,-1),beatUndo:[...n.beatUndo,{restore:n.beatEdits,at:r.at,label:r.label}]}),(s=(i=e()).beatPersist)==null||s.call(i),r.label):null},clipManifest:null,setClipManifest:n=>t({clipManifest:n}),clipParentMap:new Map,setClipParentMap:n=>t({clipParentMap:n}),domClipChildren:[],setDomClipChildren:n=>t({domClipChildren:n}),subCompositionHostState:new Map,setSubCompositionHostState:n=>t({subCompositionHostState:n}),setIsPlaying:n=>{e().isPlaying!==n&&t({isPlaying:n})},setPlaybackRate:n=>{kl({playbackRate:n}),t({playbackRate:n})},setAudioMuted:n=>{kl({audioMuted:n}),t({audioMuted:n})},setAudioVolume:n=>{const r=Number.isFinite(n)?Math.max(0,Math.min(1,n)):1;kl({audioVolume:r}),t({audioVolume:r})},setLoopEnabled:n=>t({loopEnabled:n}),setZoomMode:n=>t({zoomMode:n}),clearSelectedElementIds:()=>t({selectedElementIds:new Set}),setSelectedElementIds:n=>t({selectedElementIds:new Set(n)}),timelineSnapEnabled:no().timelineSnapEnabled??!0,setTimelineSnapEnabled:n=>{kl({timelineSnapEnabled:n}),t({timelineSnapEnabled:n})},timeDisplayMode:no().timeDisplayMode??"time",setTimeDisplayMode:n=>{kl({timeDisplayMode:n}),t({timeDisplayMode:n})},pinTimelineZoom:(n,r)=>t(i=>{if(i.zoomMode==="manual")return{};const s=$Ce(n,r);return kl({timelineZoomMode:"manual",timelineManualZoomPercent:s}),{zoomMode:"manual",manualZoomPercent:s}}),setTimelineScale:(n,r)=>{const i=e();i.timelinePps===n&&i.timelineFitPps===r||t({timelinePps:n,timelineFitPps:r})},setInPoint:n=>t(r=>{const i=n!==null&&Number.isFinite(n)?n:null;return{inPoint:i,outPoint:i!==null&&r.outPoint!==null&&i>=r.outPoint?null:r.outPoint,loopEnabled:i!==null?!0:r.loopEnabled}}),setOutPoint:n=>t(r=>{const i=n!==null&&Number.isFinite(n)?n:null;return{outPoint:i,inPoint:i!==null&&r.inPoint!==null&&i<=r.inPoint?null:r.inPoint,loopEnabled:i!==null?!0:r.loopEnabled}}),setManualZoomPercent:n=>t(r=>({manualZoomPercent:B0(n,r.timelineFitPps)})),bumpZEditVersion:()=>t(n=>({zEditVersion:n.zEditVersion+1})),setCurrentTime:n=>t({currentTime:Number.isFinite(n)?n:0}),setDuration:n=>t({duration:Number.isFinite(n)?n:0}),setTimelineReady:n=>t({timelineReady:n}),setBeatDragging:n=>t({beatDragging:n}),setElements:n=>t({elements:n}),setSelectedElementId:(n,r)=>t(i=>{const s=ICe(i.selectedElementIds,n,r==null?void 0:r.preserveSet),a=_Ce(i.revealedAudioFxTarget,n);return n!==i.selectedElementId?{selectedElementId:n,selectedElementIds:s,activeKeyframePct:null,motionPathArmed:!1,focusedEaseSegment:null,...a?{}:{revealedAudioFxTarget:null}}:{selectedElementId:n,selectedElementIds:s}}),setSelectionAnchor:n=>t(r=>n!=null&&r.selectedElementIds.size>1&&r.selectedElementIds.has(n)?{selectedElementId:n,focusedEaseSegment:n===r.selectedElementId?r.focusedEaseSegment:null}:{selectedElementId:n,selectedElementIds:n?new Set([n]):new Set,focusedEaseSegment:n===r.selectedElementId?r.focusedEaseSegment:null}),updateElement:(n,r)=>t(i=>({elements:i.elements.map(s=>(s.key??s.id)===n?{...s,...r}:s)})),beginTimelineSession:n=>t(r=>r.timelineProjectId===n?r:{...JI(),timelineSessionEpoch:r.timelineSessionEpoch+1,timelineProjectId:n}),reset:()=>t(JI())}));eCe(ue);const nae="phc_zjjbX0PnWxERXrMHhkEJWj9A9BhGVLRReICgsfTMmpx",rae="https://us.i.posthog.com",YCe=3e4,KCe=5e3;let qv=[],z2=null;function JCe(){return ej()}function eke(){return eS()}function tke(){var t,e;return{studio_version:"0.8.22",agent_runtime:fie(),screen_width:(t=window.screen)==null?void 0:t.width,screen_height:(e=window.screen)==null?void 0:e.height,viewport_width:window.innerWidth,viewport_height:window.innerHeight,user_agent:navigator.userAgent,url_hash:location.hash.replace(/#project\//,"").split("?")[0]}}function Pt(t,e={}){eke()&&(qv.push({event:`studio:${t}`,properties:{...tke(),...die(),...e},timestamp:new Date().toISOString()}),z2||(z2=setInterval(nke,YCe)))}function iae(){const t=qv.map(e=>({event:e.event,properties:{...e.properties,$ip:null},distinct_id:JCe(),timestamp:e.timestamp}));return qv=[],t}async function nke(){if(qv.length===0)return;const t=iae(),e=new AbortController,n=setTimeout(()=>e.abort(),KCe);try{await fetch(`${rae}/batch/`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({api_key:nae,batch:t}),signal:e.signal})}catch{}finally{clearTimeout(n)}}function sae(){if(z2&&(clearInterval(z2),z2=null),qv.length===0)return;const t=iae(),e=JSON.stringify({api_key:nae,batch:t});try{navigator.sendBeacon(`${rae}/batch/`,e)}catch{}}typeof window<"u"&&window.addEventListener("visibilitychange",()=>{document.visibilityState==="hidden"&&sae()});function V0(t){const e=x.useRef(null),n=x.useCallback(r=>{var i;if(r instanceof KeyboardEvent){r.key==="Escape"&&t();return}(i=e.current)!=null&&i.contains(r.target)||t()},[t]);return x.useEffect(()=>(document.addEventListener("pointerdown",n,!0),document.addEventListener("mousedown",n,!0),document.addEventListener("keydown",n),()=>{document.removeEventListener("pointerdown",n,!0),document.removeEventListener("mousedown",n,!0),document.removeEventListener("keydown",n)}),[n]),e}const rke=[{title:"Playback",hints:[{key:"Space",label:"Play / Pause"},{key:"J",label:"Play backward"},{key:"K",label:"Stop"},{key:"L",label:"Play forward"},{key:"M",label:"Toggle mute"},{key:"⇧L",label:"Toggle loop"},{key:"←/→",label:"Step 1 frame"},{key:"⇧←/⇧→",label:"Step 10 frames"},{key:"F",label:"Toggle fullscreen"}]},{title:"Keyframes (when an element is selected)",hints:[{key:"K",label:"Add keyframe at playhead"},{key:"Del",label:"Delete selected keyframe"},{key:"H",label:"Toggle hold / bezier"},{key:"U",label:"Expand / collapse properties"},{key:"R",label:"Record gesture"}]},{title:"Editing",hints:[{key:"⌘Z",label:"Undo"},{key:"⌘⇧Z",label:"Redo"},{key:"⌘C",label:"Copy element"},{key:"⌘V",label:"Paste element"},{key:"⌘X",label:"Cut element"},{key:"S",label:"Split clip at playhead"},{key:"⇧Click",label:"Razor tool: split all tracks"},{key:"⌘G",label:"Group elements"},{key:"⌘⇧G",label:"Ungroup"},{key:"Del",label:"Delete selected element (no keyframe selected)"}]},{title:"Gesture recording modifiers",hints:[{key:"Drag",label:"Record x / y position"},{key:"Scroll",label:"Record z depth"},{key:"⇧ Drag",label:"Record rotationX / rotationY"},{key:"⌥ Drag",label:"Record rotation"},{key:"⌘ Drag↕",label:"Record opacity"},{key:"⌘ Scroll",label:"Record scale"}]},{title:"Canvas",hints:[{key:"Drag",label:"Move element / add keyframe"},{key:"⌥ Drag",label:"Move entire animation path"},{key:"⇧ Drag",label:"Uniform resize"}]},{title:"Crop",hints:[{key:"Drag edge",label:"Crop a side"},{key:"Drag center",label:"Reposition the crop"}]},{title:"Panels",hints:[{key:"⌘1",label:"Compositions tab"},{key:"⌘2",label:"Assets tab"}]},{title:"Work area",hints:[{key:"I",label:"Set in-point"},{key:"⇧I",label:"Clear in-point"},{key:"O",label:"Set out-point"},{key:"⇧O",label:"Clear out-point"},{key:"A",label:"Jump to in-point"},{key:"E",label:"Jump to out-point"}]}],ike=x.memo(function({disabled:e,duration:n,inPoint:r,outPoint:i,setInPoint:s,setOutPoint:a,onSeek:o}){const[l,c]=x.useState(!1),[u,f]=x.useState(""),h=x.useId(),p=x.useCallback(()=>c(!1),[]),y=V0(p),m=x.useRef(null),v=x.useRef(null);x.useEffect(()=>{var E;if(!l)return;const k=v.current;return(E=m.current)==null||E.focus(),()=>{k==null||k.focus()}},[l]);const b=x.useCallback(()=>{if(e)return;const k=Number.parseInt(u,10);!Number.isFinite(k)||n<=0||o(Math.min(n,wj(Math.max(0,k))))},[e,n,u,o]),w=x.useCallback(k=>{k.preventDefault(),b()},[b]),O=x.useCallback(k=>{k.key==="Enter"&&(k.preventDefault(),b())},[b]);return d.jsxs("div",{ref:y,className:"relative flex-shrink-0",children:[d.jsx(vr,{label:"Shortcuts and tools",children:d.jsx("button",{ref:v,type:"button",onClick:()=>c(k=>!k),className:`flex h-7 w-7 items-center justify-center rounded-md transition-colors ${l?"text-neutral-200":"text-neutral-600 hover:text-neutral-300"}`,"aria-label":"Shortcuts and tools","aria-expanded":l,"aria-controls":h,children:d.jsxs("svg",{width:"11",height:"11",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[d.jsx("rect",{x:"2",y:"4",width:"20",height:"16",rx:"2"}),d.jsx("path",{d:"M6 8h.01M10 8h.01M14 8h.01M18 8h.01M6 12h.01M10 12h.01M14 12h.01M18 12h.01M8 16h8"})]})})}),l&&d.jsxs("div",{id:h,ref:m,tabIndex:-1,role:"dialog","aria-label":"Keyboard shortcuts and tools",className:"absolute bottom-full right-0 mb-2 z-50 rounded-lg shadow-xl min-w-[220px] overflow-y-auto outline-none",style:{background:"#161618",border:"1px solid rgba(255,255,255,0.08)",maxHeight:"min(280px, calc(100vh - 80px))"},children:[d.jsxs("div",{className:"px-3 pt-3 pb-2.5",children:[d.jsx("p",{className:"text-[9px] font-medium text-neutral-500 uppercase tracking-wider mb-1.5",children:"Jump to frame"}),d.jsxs("form",{onSubmit:w,className:"flex items-center gap-1.5",children:[d.jsx("input",{value:u,onChange:k=>f(k.target.value),disabled:e,inputMode:"numeric",pattern:"[0-9]*","aria-label":"Jump to frame",placeholder:"frame number",className:"h-6 flex-1 rounded border border-neutral-700 bg-neutral-900 px-2 text-[10px] font-mono tabular-nums text-neutral-200 outline-none transition-colors placeholder:text-neutral-600 focus:border-studio-accent/60",onKeyDown:O,onBlur:b}),d.jsx(vr,{label:"Jump to frame",children:d.jsx("button",{type:"submit",disabled:e,className:"h-6 px-2 rounded border border-neutral-700 text-[10px] text-neutral-300 transition-colors hover:border-neutral-500 hover:bg-neutral-800 disabled:opacity-40",children:"Go"})})]})]}),d.jsx("div",{style:{borderTop:"1px solid rgba(255,255,255,0.06)"}}),d.jsxs("div",{className:"px-3 pt-2.5 pb-2",children:[d.jsx("p",{className:"text-[9px] font-medium text-neutral-500 uppercase tracking-wider mb-1.5",children:"Work area"}),d.jsxs("div",{className:"flex flex-col gap-1",children:[d.jsxs("div",{className:"flex items-center justify-between gap-2",children:[d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx("span",{className:"font-mono text-[10px] rounded border border-neutral-700 px-1.5 py-0.5 text-neutral-300 min-w-[20px] text-center",style:{background:"rgba(255,255,255,0.05)"},children:"I"}),d.jsx("span",{className:"text-[10px] text-neutral-400",children:"In-point"})]}),d.jsx("div",{className:"flex items-center gap-1.5",children:r!==null?d.jsxs(d.Fragment,{children:[d.jsx("span",{className:"font-mono text-[10px] text-neutral-300",children:os(r)}),d.jsx(vr,{label:"Clear in-point",children:d.jsx("button",{type:"button",onClick:()=>s(null),className:"w-4 h-4 flex items-center justify-center rounded text-neutral-500 hover:text-neutral-200 transition-colors","aria-label":"Clear in-point",children:d.jsx("svg",{width:"8",height:"8",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",children:d.jsx("path",{d:"M18 6L6 18M6 6l12 12"})})})})]}):d.jsx("span",{className:"text-[10px] text-neutral-600",children:"—"})})]}),d.jsxs("div",{className:"flex items-center justify-between gap-2",children:[d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx("span",{className:"font-mono text-[10px] rounded border border-neutral-700 px-1.5 py-0.5 text-neutral-300 min-w-[20px] text-center",style:{background:"rgba(255,255,255,0.05)"},children:"O"}),d.jsx("span",{className:"text-[10px] text-neutral-400",children:"Out-point"})]}),d.jsx("div",{className:"flex items-center gap-1.5",children:i!==null?d.jsxs(d.Fragment,{children:[d.jsx("span",{className:"font-mono text-[10px] text-neutral-300",children:os(i)}),d.jsx(vr,{label:"Clear out-point",children:d.jsx("button",{type:"button",onClick:()=>a(null),className:"w-4 h-4 flex items-center justify-center rounded text-neutral-500 hover:text-neutral-200 transition-colors","aria-label":"Clear out-point",children:d.jsx("svg",{width:"8",height:"8",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",children:d.jsx("path",{d:"M18 6L6 18M6 6l12 12"})})})})]}):d.jsx("span",{className:"text-[10px] text-neutral-600",children:"—"})})]})]})]}),d.jsx("div",{style:{borderTop:"1px solid rgba(255,255,255,0.06)"}}),d.jsx("div",{className:"px-3 pt-2.5 pb-3 flex flex-col gap-3",children:rke.map(k=>d.jsxs("div",{children:[d.jsx("p",{className:"text-[9px] font-medium text-neutral-500 uppercase tracking-wider mb-1.5",children:k.title}),d.jsx("div",{className:"flex flex-col gap-1",children:k.hints.map(E=>d.jsxs("div",{className:"flex items-center gap-3",children:[d.jsx("span",{className:"font-mono text-[10px] rounded border border-neutral-700 px-1.5 py-0.5 text-neutral-300 min-w-[36px] text-center",style:{background:"rgba(255,255,255,0.05)"},children:E.key}),d.jsx("span",{className:"text-[10px] text-neutral-400",children:E.label})]},E.key))})]},k.title))})]})]})}),ske=[.25,.5,1,1.5,2],ake=x.memo(function({playbackRate:e,setPlaybackRate:n,disabled:r}){const[i,s]=x.useState(!1),a=x.useCallback(()=>s(!1),[]),o=V0(a);return d.jsxs("div",{ref:o,className:"relative flex-shrink-0",children:[d.jsx(vr,{label:"Playback speed",children:d.jsx("button",{type:"button",onClick:()=>s(l=>!l),disabled:r,"aria-haspopup":"menu","aria-expanded":i,"aria-label":"Playback speed",className:"h-7 w-8 rounded-md font-mono text-[10px] tabular-nums text-neutral-500 transition-colors hover:text-neutral-200 disabled:opacity-30",children:e===1?"1x":`${e}x`})}),i&&d.jsx("div",{role:"menu","aria-label":"Playback speed options",className:"absolute bottom-full right-0 mb-1.5 rounded-lg shadow-xl z-50 min-w-[56px] overflow-hidden",style:{background:"#161618",border:"1px solid rgba(255,255,255,0.08)"},children:ske.map(l=>{const c=l===e;return d.jsxs("button",{type:"button",role:"menuitemradio","aria-checked":c,onClick:()=>{Pt("playback",{action:"speed_change",rate:l}),n(l),s(!1)},className:`block w-full px-3 py-1.5 text-[11px] text-left font-mono tabular-nums transition-colors outline-none focus-visible:bg-white/[0.04] ${c?"text-neutral-50 bg-white/[0.06]":"text-neutral-500 hover:bg-white/[0.04]"}`,children:[l,"x"]},l)})})]})});function oke({muted:t,volume:e}){const n=t||e===0;return d.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[d.jsx("path",{d:"M11 5 6 9H3v6h3l5 4V5Z"}),n?d.jsxs(d.Fragment,{children:[d.jsx("path",{d:"m19 9-6 6"}),d.jsx("path",{d:"m13 9 6 6"})]}):d.jsxs(d.Fragment,{children:[d.jsx("path",{d:"M15.5 8.5a5 5 0 0 1 0 7"}),e>=.5?d.jsx("path",{d:"M18.5 5.5a9 9 0 0 1 0 13"}):null]})]})}const lke=x.memo(function({audioMuted:e,audioVolume:n,disabled:r,setAudioMuted:i,setAudioVolume:s}){const a=Math.round(n*100),o=e||n===0,l=o?"Unmute audio":"Mute audio";return d.jsxs("div",{className:"group flex flex-shrink-0 items-center",children:[d.jsx("div",{className:"w-0 overflow-hidden opacity-0 transition-[width,opacity] duration-150 ease-out group-hover:w-14 group-hover:opacity-100 group-focus-within:w-14 group-focus-within:opacity-100",children:d.jsxs("div",{className:"relative mx-1 flex h-6 w-12 items-center",children:[d.jsx("div",{className:"absolute inset-x-0 h-0.5 overflow-hidden rounded-full bg-neutral-700",children:d.jsx("div",{className:"h-full rounded-full bg-neutral-300",style:{width:`${a}%`}})}),d.jsx("input",{type:"range",min:"0",max:"100",step:"1",value:a,disabled:r,"aria-label":"Preview volume","aria-valuetext":`${a}%`,title:`Preview volume: ${a}%`,onChange:c=>{const u=Number(c.currentTarget.value)/100;s(u),e&&u>0&&i(!1)},className:"hf-preview-volume-range absolute inset-0 w-full disabled:pointer-events-none"})]})}),d.jsx(vr,{label:l,children:d.jsx("button",{type:"button",onClick:()=>{Pt("playback",{action:"mute_toggle",muted:!o}),o&&n===0&&s(1),i(!o)},disabled:r,"aria-label":l,"aria-pressed":o,className:`flex h-7 w-7 flex-shrink-0 items-center justify-center rounded-md transition-colors disabled:pointer-events-none disabled:opacity-30 ${o?"text-studio-accent":"text-neutral-500 hover:text-neutral-200"}`,children:d.jsx(oke,{muted:e,volume:n})})})]})});Qv.registerPlugin(O1);const PG="M87.5129 57.5141L56.9696 73.5433C52.8371 75.7098 48.7046 73.2553 49.6688 69.2104L58.9483 30.1391C59.9125 26.0942 65.2097 23.6397 68.3154 25.8062L91.2447 41.8354C96.4668 45.4796 94.4631 53.8699 87.5129 57.5141Z",MG="M56 28H67V71H56Z M73 28H84V71H73Z";function cke({playing:t}){const e=x.useRef(null),n=x.useRef(!0);return x.useEffect(()=>{var o;const r=e.current;if(!r)return;const i=t?MG:PG,s=typeof window<"u"&&((o=window.matchMedia)==null?void 0:o.call(window,"(prefers-reduced-motion: reduce)").matches);if(n.current||s){n.current=!1,Qv.set(r,{morphSVG:i});return}const a=Qv.to(r,{duration:.28,ease:"power2.inOut",morphSVG:i});return()=>{a.kill()}},[t]),d.jsx("span",{className:"relative inline-flex h-3 w-3 items-center justify-center","aria-hidden":"true",children:d.jsx("svg",{width:"12",height:"12",viewBox:"46 21 54 56",fill:"#FAFAFA",children:d.jsx("path",{ref:e,d:t?MG:PG})})})}const uke=x.memo(function({loopEnabled:e,disabled:n,setLoopEnabled:r}){return d.jsx(vr,{label:"Loop playback",children:d.jsx("button",{type:"button",onClick:()=>{Pt("playback",{action:"loop_toggle",enabled:!e}),r(!e)},disabled:n,className:`flex h-7 w-7 items-center justify-center rounded-md transition-colors disabled:opacity-30 ${e?"text-studio-accent":"text-neutral-500 hover:text-neutral-200"}`,"aria-label":e?"Disable loop playback":"Enable loop playback","aria-pressed":e,children:d.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[d.jsx("path",{d:"M17 2l4 4-4 4"}),d.jsx("path",{d:"M3 11V9a4 4 0 0 1 4-4h14"}),d.jsx("path",{d:"M7 22l-4-4 4-4"}),d.jsx("path",{d:"M21 13v2a4 4 0 0 1-4 4H3"})]})})})}),fke=x.memo(function({isFullscreen:e,onToggleFullscreen:n}){return d.jsx(vr,{label:e?"Exit fullscreen (F)":"Enter fullscreen (F)",children:d.jsx("button",{type:"button",onClick:()=>{Pt("playback",{action:"fullscreen_toggle",active:!e}),n()},className:`flex h-7 w-7 flex-shrink-0 items-center justify-center rounded-md transition-colors ${e?"text-studio-accent":"text-neutral-500 hover:text-neutral-200"}`,"aria-label":e?"Exit fullscreen":"Enter fullscreen",children:d.jsx("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:e?d.jsxs(d.Fragment,{children:[d.jsx("path",{d:"M8 3v3a2 2 0 0 1-2 2H3"}),d.jsx("path",{d:"M21 8h-3a2 2 0 0 1-2-2V3"}),d.jsx("path",{d:"M3 16h3a2 2 0 0 1 2 2v3"}),d.jsx("path",{d:"M16 21v-3a2 2 0 0 1 2-2h3"})]}):d.jsxs(d.Fragment,{children:[d.jsx("path",{d:"M8 3H5a2 2 0 0 0-2 2v3"}),d.jsx("path",{d:"M21 8V5a2 2 0 0 0-2-2h-3"}),d.jsx("path",{d:"M3 16v3a2 2 0 0 0 2 2h3"}),d.jsx("path",{d:"M16 21h3a2 2 0 0 0 2-2v-3"})]})})})})}),hke=x.memo(function({onTogglePlay:e,onSeek:n,disabled:r=!1,isFullscreen:i=!1,onToggleFullscreen:s}){const a=ue(B=>B.isPlaying),o=ue(B=>B.duration),l=ue(B=>B.timelineReady),c=ue(B=>B.playbackRate),u=ue(B=>B.audioMuted),f=ue(B=>B.audioVolume),h=ue(B=>B.loopEnabled),p=ue.getState().setPlaybackRate,y=ue.getState().setAudioMuted,m=ue.getState().setAudioVolume,v=ue.getState().setLoopEnabled,b=ue(B=>B.inPoint),w=ue(B=>B.outPoint),O=ue.getState().setInPoint,k=ue.getState().setOutPoint,E=ue(B=>B.timeDisplayMode),T=ue.getState().setTimeDisplayMode,N=x.useRef(null),_=x.useRef(0),I=x.useRef(E);I.current=E;const j=x.useRef(o);j.current=o;const L=r||!l;return x.useEffect(()=>{if(!N.current)return;const B=_.current;N.current.textContent=E==="frame"?SG(B,o):os(B)},[o,E]),Or(()=>{const B=z=>{if(_.current=z,!N.current)return;const Y=j.current;N.current.textContent=I.current==="frame"?SG(z,Y):os(z)},$=xa.subscribe(B);return B(ue.getState().currentTime),$}),d.jsx("div",{children:d.jsxs("div",{className:"grid h-10 grid-cols-[minmax(0,1fr)_auto_minmax(0,1fr)] items-center px-3","aria-disabled":r||void 0,style:{paddingBottom:"env(safe-area-inset-bottom)"},children:[d.jsx(vr,{label:E==="time"?"Switch to frame display":"Switch to time display",children:d.jsxs("button",{type:"button",onClick:()=>T(E==="time"?"frame":"time"),disabled:r,className:"min-w-0 justify-self-start whitespace-nowrap font-mono text-[11px] tabular-nums text-neutral-400 transition-colors hover:text-neutral-200 disabled:pointer-events-none",children:[d.jsx("span",{ref:N,children:os(0)}),E==="time"?d.jsxs(d.Fragment,{children:[d.jsx("span",{className:"mx-0.5 text-neutral-700",children:"/"}),d.jsx("span",{className:"text-neutral-600",children:os(o)})]}):null]})}),d.jsx(vr,{label:a?"Pause":"Play",children:d.jsx("button",{type:"button","aria-label":a?"Pause":"Play",onClick:()=>{Pt("playback",{action:a?"pause":"play"}),e()},disabled:L,className:"flex h-8 w-8 items-center justify-center justify-self-center rounded-md text-neutral-100 transition-colors hover:text-white disabled:pointer-events-none disabled:opacity-30",children:d.jsx(cke,{playing:a})})}),d.jsxs("div",{className:"flex min-w-0 items-center justify-self-end",children:[d.jsx(lke,{audioMuted:u,audioVolume:f,disabled:L,setAudioMuted:y,setAudioVolume:m}),d.jsx(ake,{playbackRate:c,setPlaybackRate:p,disabled:r}),d.jsx(uke,{loopEnabled:h,disabled:r,setLoopEnabled:v}),s&&d.jsx(fke,{isFullscreen:i,onToggleFullscreen:s}),d.jsx(ike,{disabled:r,duration:o,inPoint:b,outPoint:w,setInPoint:O,setOutPoint:k,onSeek:n})]})]})})}),dke=new Set(["audio","music","sfx","sound","narration"]),pke=/\.(aac|flac|m4a|mp3|ogg|opus|wav)(?:[?#].*)?$/i,mke=/\b(music|bgm|soundtrack|background[-_]?music)\b/i;function Yv(t){return t?t.tagName.toLowerCase()===ya?!0:Jo({tag:t.tagName,src:t.getAttribute("src")??void 0}):!1}function Jo(t){if(!t)return!1;const e=t.tag.trim().toLowerCase();return dke.has(e)?!0:!!(t.src&&pke.test(t.src))}function my(t){if(!t||!Jo(t))return!1;if(t.timelineRole==="music")return!0;if(t.timelineRole&&t.timelineRole!=="music")return!1;const e=t.domId??t.id??"";return mke.test(e)}function gke(t){const e=t.find(my);if(e)return{element:e,isFallback:!1};let n=null;for(const r of t)Jo(r)&&(r.timelineRole&&r.timelineRole!=="music"||(!n||r.duration>n.duration)&&(n=r));return n?{element:n,isFallback:!0}:null}function aae(t){return!t.some(e=>Yv(e.element))}let FO=null;const NG=()=>hy(()=>import("./index-DXR3nsh2.js").then(t=>t.i),[]);function yke(t=NG){const e=t===NG;if(e&&FO)return FO;const n=t().then(r=>(r.default??r)||null).catch(()=>(e&&(FO=null),null));return e&&(FO=n),n}const VP=1024,DG=512,xke=.05;function oae(t,e,n){const r=Math.floor(e*xke),i=Math.floor(n*e),s=Math.max(0,i-r),a=Math.min(t.length,i+r);let o=0;for(let l=s;ll&&c>(r[a-1]??0)&&c>(r[a+1]??0)){const u=a*DG/n;(i.length===0||u-i[i.length-1]>.1)&&i.push(Math.round(u*1e3)/1e3)}}return i}function vke(t){if(t.length<4)return null;const e=[];for(let s=1;ss-a),r=Math.floor(n.length/2),i=n.length%2===0?(n[r-1]+n[r])/2:n[r];return i<=0?null:Math.round(60/i*10)/10}function HP(t){let e=t;for(;e>120;)e/=2;for(;e<60;)e*=2;return e}function Ake(t,e){const n=[t/2,t,t*2];let r=t,i=Number.POSITIVE_INFINITY;for(const s of n){if(s<=0)continue;const a=Math.abs(s-e);aa&&(a=u,s=c)}const o=[];for(let l=s;l<=n+.001;l+=r)o.push(Math.round(l*1e3)/1e3);return o}function wke(t,e,n){if(t.length===0)return{times:t,strengths:[],peak:1e-6};const r=t.map(l=>oae(e,n,l)),i=Math.max(...r,1e-6),s=i*.12,a=[],o=[];for(let l=0;l=s&&(a.push(t[l]),o.push(Math.min(1,r[l]/i)));return{times:a,strengths:o,peak:i}}async function Oke(t){const e=t.getChannelData(0),n=t.sampleRate,r=t.duration,i=await bke(t),s=vke(i);let a=null;try{const h=await yke();h&&(a=h(t))}catch{}let o=s,l="uncertain",c=null;if(s!==null&&a!==null){const h=Math.abs(HP(s)-HP(a))/HP(a);h<.05?(o=Ake(a,s),l="high",c=o):h<.1?(o=Math.round((s+a)/2),l="low",c=o):(o=s,l="uncertain")}else s!==null?(o=s,l="low",c=s):a!==null&&(o=a,l="low",c=a);const u=c!==null?Ske(i,c,r):i,f=wke(u,e,n);return{beatTimes:f.times,beatStrengths:f.strengths,bpm:o,bpmConfidence:l,channelData:e,sampleRate:n,peak:f.peak}}async function Cke(t){const e=new AudioContext;try{const r=await(await fetch(t)).arrayBuffer(),i=await e.decodeAudioData(r);return Oke(i)}finally{await e.close()}}function cae(t){if(!t||/^(blob:|data:)/i.test(t))return null;let e=null;const n="/preview/",r=t.indexOf(n);if(r!==-1){let i=t.slice(r+n.length);const s=i.search(/[?#]/);s!==-1&&(i=i.slice(0,s)),i.startsWith("comp/")&&(i=i.slice(5)),e=i?decodeURIComponent(i):null}if(!e)try{e=decodeURIComponent(new URL(t,"http://_").pathname)}catch{e=t}return e?(e=e.replace(/^\/+/,""),e||null):null}function IG(t){const e=cae(t);return e?`beats/${e}.json`:null}function kke(t,e,n){const r=t.map((s,a)=>({time:Math.round(s*1e3)/1e3,strength:Math.round((e[a]??.5)*1e3)/1e3}));return`${JSON.stringify({version:1,audio:n,beats:r},null,2)} `}function uae(t){try{const e=JSON.parse(t);if(!e||e.version!==1||!Array.isArray(e.beats))return null;const n=[],r=[];for(const i of e.beats)if(i&&typeof i.time=="number"&&Number.isFinite(i.time)){n.push(i.time);const s=typeof i.strength=="number"&&Number.isFinite(i.strength)?i.strength:.5;r.push(Math.max(0,Math.min(1,s)))}return{times:n,strengths:r}}catch{return null}}const _G="__hfStudioContexts",RG=new Map;function Eke(){const t=globalThis,e=t[_G];if(e)return e;const n=new Map;return t[_G]=n,n}function Rc(t,e){const n=Eke();n.has(t)&&RG.get(t)!==e&&console.warn(`[hmrStableContext] "${t}" was registered twice with different defaults — two contexts are sharing one identity. Use module path + export name.`),RG.set(t,e);const r=n.get(t);if(r)return r;const i=x.createContext(e);return n.set(t,i),i}const Nj=Rc("FileManagerContext",null);function H0(){const t=x.useContext(Nj);if(!t)throw new Error("useFileManagerContext must be used within FileManagerProvider");return t}function fae(){return x.useContext(Nj)}function Tke({value:{editingFile:t,setEditingFile:e,projectDir:n,fileTree:r,fileTreeLoaded:i,setFileTree:s,editingPathRef:a,projectIdRef:o,saveRafRef:l,flushPendingSourceSave:c,discardPendingSourceSave:u,getPendingSourceCandidate:f,importedFontAssetsRef:h,readProjectFile:p,writeProjectFile:y,overwriteExternalConflict:m,readOptionalProjectFile:v,observeProjectFileVersion:b,updateEditingFileContent:w,revealSourceOffset:O,openSourceForSelection:k,handleFileSelect:E,handleContentChange:T,refreshFileTree:N,uploadProjectFiles:_,handleCreateFile:I,handleCreateFolder:j,handleDeleteFile:L,handleRenameFile:B,handleDuplicateFile:$,handleMoveFile:z,handleImportFiles:Y,handleImportFonts:W,compositions:J,assets:ne,fontAssets:le},children:ie}){const q=x.useMemo(()=>({editingFile:t,setEditingFile:e,projectDir:n,fileTree:r,fileTreeLoaded:i,setFileTree:s,editingPathRef:a,projectIdRef:o,saveRafRef:l,flushPendingSourceSave:c,discardPendingSourceSave:u,getPendingSourceCandidate:f,importedFontAssetsRef:h,readProjectFile:p,writeProjectFile:y,overwriteExternalConflict:m,readOptionalProjectFile:v,observeProjectFileVersion:b,updateEditingFileContent:w,revealSourceOffset:O,openSourceForSelection:k,handleFileSelect:E,handleContentChange:T,refreshFileTree:N,uploadProjectFiles:_,handleCreateFile:I,handleCreateFolder:j,handleDeleteFile:L,handleRenameFile:B,handleDuplicateFile:$,handleMoveFile:z,handleImportFiles:Y,handleImportFonts:W,compositions:J,assets:ne,fontAssets:le}),[t,e,n,r,i,s,a,o,l,c,u,f,h,p,y,m,v,b,w,O,k,E,T,N,_,I,j,L,B,$,z,Y,W,J,ne,le]);return d.jsx(Nj,{value:q,children:ie})}const Pke=.015;function uc(t,e){return Math.abs(t-e)uc(c,l))||a.push({time:l,strength:e[o]??.5})}if(i)for(const o of i.added)a.some(l=>uc(l.time,o.time))||a.push(o);return a.sort((o,l)=>o.time-l.time),{times:a.map(o=>o.time),strengths:a.map(o=>o.strength)}}function hae(t,e){const n=bE(t,e);return n?{...n,added:[...n.added],removed:[...n.removed]}:{src:e,added:[],removed:[]}}function dae(t,e,n,r=[]){const i=bE(t,e);if(r.some(l=>uc(l,n.time))&&!((i==null?void 0:i.removed)??[]).some(l=>uc(l,n.time))||((i==null?void 0:i.added)??[]).some(l=>uc(l.time,n.time)))return t;const a=hae(t,e),o=a.removed.findIndex(l=>uc(l,n.time));return o>=0?(a.removed.splice(o,1),a):(a.added.push(n),a)}function pae(t,e,n,r){const i=bE(t,e),s=((i==null?void 0:i.added)??[]).some(u=>uc(u.time,r)),a=n.find(u=>uc(u,r)),o=a!==void 0&&((i==null?void 0:i.removed)??[]).some(u=>uc(u,a));if(!s&&(a===void 0||o))return t;const l=hae(t,e),c=l.added.findIndex(u=>uc(u.time,r));return c>=0?(l.added.splice(c,1),l):(a!==void 0&&!l.removed.some(u=>uc(u,a))&&l.removed.push(a),l)}function Mke(t,e,n,r,i){const s=pae(t,e,n,r);return dae(s,e,i,n)??s}const jG=new WeakMap;function y0(t){const e=jG.get(t);if(e)return e;const n=new Map,r=[],i=new Set;let s=null;for(const o of t)n.set(Zn(o),o),o.src&&r.push(o),Jo(o)&&i.add(o.track),!s&&my(o)&&(s=o);const a=Object.freeze({byKey:n,musicElement:s,mediaElements:Object.freeze(r),audioTracks:i});return jG.set(t,a),a}function mae(t,e,n){if(!t||!e)return null;const r=Dj(t.beatTimes,t.beatStrengths,n,e.src??null),i=e.playbackStart??0,s=i+e.duration,a=e.start-i,o=[],l=[];return r.times.forEach((c,u)=>{c>=i&&c<=s&&(o.push(Math.round((c+a)*1e3)/1e3),l.push(r.strengths[u]??1))}),{...t,beatTimes:o,beatStrengths:l}}function vE(){const t=ue.getState(),e=t.elements.find(my),n=t.beatAnalysis;return!e||!n||!e.src?null:{s:t,music:e,analysis:n,src:e.src}}function T6(t,e,n){return e+(n-t)}function Ij(t){return t.duration>0?t.duration:t.sourceDuration&&t.sourceDuration>0?t.sourceDuration:Number.POSITIVE_INFINITY}function Nke(t){const e=vE();return e?t>=e.music.start&&t<=e.music.start+Ij(e.music):!1}function Dke(t){const e=vE();if(!e)return;const n=e.music.playbackStart??0,r=T6(e.music.start,n,t);if(rn+Ij(e.music))return;const i=lae(e.analysis,r),s=dae(e.s.beatEdits,e.src,{time:r,strength:i},e.analysis.beatTimes);s!==e.s.beatEdits&&e.s.commitBeatEdits(s,"add beat")}function Ike(t){const e=vE();if(!e)return;const n=T6(e.music.start,e.music.playbackStart??0,t),r=pae(e.s.beatEdits,e.src,e.analysis.beatTimes,n);r!==e.s.beatEdits&&e.s.commitBeatEdits(r,"delete beat")}function _ke(t,e){const n=vE();if(!n)return;const r=n.music.playbackStart??0,i=T6(n.music.start,r,t),s=T6(n.music.start,r,e),a=Math.max(r,Math.min(r+Ij(n.music),s)),o=lae(n.analysis,a),l=Mke(n.s.beatEdits,n.src,n.analysis.beatTimes,i,{time:a,strength:o});l!==n.s.beatEdits&&n.s.commitBeatEdits(l,"move beat")}const k1=new Map,Rke=4,jke=350;function Lke(t,e){for(k1.set(t,e);k1.size>Rke;){const n=k1.keys().next().value;if(n===void 0)break;k1.delete(n)}}async function Fke(t,e,n){if(!t)return{...e,hasFile:!1};try{const r=await n.readOptionalProjectFile(t),i=r?uae(r):null;if(i&&i.times.length>0)return{times:i.times,strengths:i.strengths,hasFile:!0}}catch{}return{...e,hasFile:!1}}async function $ke(t,e){try{const n=await t.readOptionalProjectFile(e),r=n?uae(n):null;return!!(r&&r.times.length>0)}catch{return!1}}async function Bke(t,e,n){let r=k1.get(t);r||(r=Cke(t),Lke(t,r));try{const i=await r,s={times:i.beatTimes,strengths:i.beatStrengths},{times:a,strengths:o}=await Fke(e,s,n);return{analysis:i,times:a,strengths:o}}catch{return null}}function Vke(){const t=ue(r=>r.beatAnalysis),e=ue(r=>y0(r.elements).musicElement),n=ue(r=>r.beatEdits);return x.useMemo(()=>mae(t,e,n),[t,e,n])}function Hke(){const t=ue(f=>f.elements),e=ue(f=>f.setBeatAnalysis),n=ue(f=>f.setBeatEdits),r=ue(f=>f.setBeatPersist),i=ue(f=>f.resetBeatHistory),s=fae(),a=s==null?void 0:s.readOptionalProjectFile,o=s==null?void 0:s.writeProjectFile,l=x.useRef(null);l.current=a&&o?{readOptionalProjectFile:a,writeProjectFile:o}:null;const{musicSrc:c,isFallbackTrack:u}=x.useMemo(()=>{const f=gke(t);return{musicSrc:(f==null?void 0:f.element.src)??null,isFallbackTrack:(f==null?void 0:f.isFallback)??!1}},[t]);x.useEffect(()=>{if(!c){e(null),n(null),i();return}if(!l.current){e(null),n(null),i();return}let f=!1;const h=IG(c),p=l.current;return(async()=>{if(!h||!p)return;if(!u){const m=await $ke(p,h);if(f)return;if(!m){e(null);return}}if(f)return;const y=await Bke(c,h,p);if(!f){if(!y){e(null),k1.delete(c);return}n(null),i(),e({...y.analysis,beatTimes:y.times,beatStrengths:y.strengths})}})(),()=>{f=!0}},[c,u,e,n,i]),x.useEffect(()=>{const f=IG(c);if(!c||!f||!l.current){r(null);return}const h=l.current,p=cae(c)??"audio";let y=null,m=null;const v=()=>{if(m===null)return;const w=m;m=null,h.writeProjectFile(f,w).catch(()=>{})};return r(()=>{const w=ue.getState(),O=w.beatAnalysis;if(!O)return;const k=Dj(O.beatTimes,O.beatStrengths,w.beatEdits,c);m=kke(k.times,k.strengths,p),y&&clearTimeout(y),y=setTimeout(()=>{y=null,v()},jke)}),()=>{y&&clearTimeout(y),v(),r(null)}},[c,r])}const QP="css:root",gae=["backdrop-filter","clip-path","filter","mask","mask-border-source","mask-image","perspective","rotate","scale","transform","translate","-webkit-mask-image"],Qke=new Set([...gae,"contain","isolation","mask-border","mix-blend-mode","opacity"]),zke=new Set(["absolute","relative"]),Zke=new Set(["flex","inline-flex","grid","inline-grid"]),Gke=new Set(["layout","paint","strict","content"]),Uke=new Set(["size","inline-size"]);function Xke(t){return t.position==="fixed"||t.position==="sticky"}function Wke(t,e){var r;if(e.zIndex==="auto"||e.zIndex==="")return!1;if(zke.has(e.position))return!0;const n=t.parentElement?(r=t.ownerDocument.defaultView)==null?void 0:r.getComputedStyle(t.parentElement).display:null;return n!=null&&Zke.has(n)}function qke(t){const e=Number.parseFloat(t.opacity);if(Number.isFinite(e)&&e<1||t.getPropertyValue("isolation")==="isolate")return!0;const n=t.getPropertyValue("mix-blend-mode");return n&&n!=="normal"?!0:gae.some(r=>{const i=t.getPropertyValue(r);return i!==""&&i!=="none"})}function Yke(t){return t.getPropertyValue("contain").split(/\s+/).some(n=>Gke.has(n))?!0:Uke.has(t.getPropertyValue("container-type"))}function Kke(t){return t.getPropertyValue("will-change").split(",").map(e=>e.trim()).some(e=>Qke.has(e))}function Jke(t,e){return Xke(e)||Wke(t,e)||qke(e)||Yke(e)?!0:Kke(e)}function eEe(t){const e=[];let n=t;for(;n!=null&&n.parentElement;)e.push(Array.prototype.indexOf.call(n.parentElement.children,n)),n=n.parentElement;return`css:${e.reverse().join(".")}`}function _j(t){const e=t.ownerDocument.defaultView;if(!e)return QP;let n=t.parentElement;for(;n&&n!==t.ownerDocument.documentElement;){try{if(Jke(n,e.getComputedStyle(n)))return eEe(n)}catch{return QP}n=n.parentElement}return QP}const Dn=Object.freeze({start:"data-start",duration:"data-duration",trackIndex:"data-track-index",derivedEnd:"data-end",legacyTrack:"data-layer"});Object.freeze([Dn.start,Dn.duration,Dn.trackIndex]);Object.freeze([Dn.derivedEnd]);Object.freeze([Dn.derivedEnd,Dn.legacyTrack]);class sS extends Error{constructor(n,r){super(r);Et(this,"code");this.name="ClipTimingWriteError",this.code=n}}function gy(t){if(t==null||t.trim()==="")return null;const e=Number(t);return Number.isFinite(e)?e:null}const yae=/^[A-Za-z0-9_.:-]+$/;function xae(t,e){const n=t.charCodeAt(e);return n>=48&&n<=57}function LG(t,e){let n=e;for(;n>=0&&xae(t,n);)n--;return n}function tEe(t,e){let n=e;for(;n>=0&&(t[n]??"").trim()==="";)n--;return n}function nEe(t){const e=t.length-1;if(!xae(t,e))return null;let n=LG(t,e);return t[n]==="."&&(n=LG(t,n-1)),n+1}function rEe(t){const e=nEe(t);if(e==null)return null;const n=tEe(t,e-1),r=t[n];if(r!=="+"&&r!=="-")return null;const i=t.slice(0,n).trim();if(!yae.test(i))return null;const s=Number(t.slice(e));return Number.isFinite(s)?{refId:i,operator:r,magnitude:s}:null}function bae(t){const e=(t??"").trim();if(!e)return null;const n=gy(e);if(n!=null)return{kind:"absolute",value:n};if(yae.test(e))return{kind:"reference",refId:e,offset:0};const r=rEe(e);return r?{kind:"reference",refId:r.refId,offset:r.operator==="-"?-r.magnitude:r.magnitude}:null}function Ia(t,e,n,r){t.push({code:e,attribute:n,value:r})}function iEe(t,e,n,r){var s;if(e==null||e.trim()==="")return n.defaultStart===void 0?0:n.defaultStart;if(!t)return Ia(r,"invalid-start",Dn.start,e),null;if(t.kind==="absolute")return Math.max(0,t.value);const i=(s=n.resolveReferenceEnd)==null?void 0:s.call(n,t.refId);return i==null||!Number.isFinite(i)?(Ia(r,"unresolved-start-reference",Dn.start,e),null):Math.max(0,i+t.offset)}const sEe=1e-9;function aEe(t,e){return Math.abs(t-e)<=sEe}function oEe(t,e,n){const r=gy(t);if(r==null){Ia(n,"deprecated-end",Dn.derivedEnd,t),Ia(n,"invalid-end",Dn.derivedEnd,t);return}if(e==null){Ia(n,"deprecated-end",Dn.derivedEnd,t);return}aEe(r,e)||(Ia(n,"deprecated-end",Dn.derivedEnd,t),Ia(n,"conflicting-end",Dn.derivedEnd,t))}function lEe(t,e,n){const r=gy(t);return r==null||r<0?(Ia(n,"invalid-duration",Dn.duration,t),{duration:null,end:null,durationSource:"invalid"}):{duration:r,end:e==null?null:e+r,durationSource:"duration"}}function cEe(t,e,n){Ia(n,"deprecated-end",Dn.derivedEnd,t);const r=gy(t);return r==null?(Ia(n,"invalid-end",Dn.derivedEnd,t),{duration:null,end:null,durationSource:"invalid"}):e==null?{duration:null,end:r,durationSource:"legacy-end"}:r"u"||!t.body)return;$G.add(t),new MutationObserver(n=>{n.some(i=>i.type!=="childList"||[...i.addedNodes,...i.removedNodes].some(s=>{var a;return s instanceof Element&&(s.tagName.toLowerCase()===ya||s.hasAttribute(Go)||((a=s.querySelector)==null?void 0:a.call(s,`${ya},[${Go}]`))!=null)}))&&t_.set(t,(t_.get(t)??0)+1)}).observe(t.body,{subtree:!0,childList:!0,attributes:!0,attributeFilter:[Go,Ws,so,"data-label","data-volume","data-hidden","id"]})}function AE(t){t&&e_.delete(t)}function SE(t,e){if(!t)return{label:e,volume:1,hidden:!1};yEe(t);const n=t_.get(t)??0,r=e_.get(t);let i=r&&r.revision===n?r.entries:void 0;return i||(i=new Map(Zd(t).map(s=>[s.id,{label:s.label,volume:s.volume,hidden:s.hidden,...s.fxChain?{fxChain:s.fxChain}:{},...s.automation?{automation:s.automation}:{}}])),e_.set(t,{revision:n,entries:i})),i.get(e)??{label:e,volume:1,hidden:!1}}const Aae=1,xEe=["seconds-time","rational-fps","seek-keep-playing","composition-manifest-v1","runtime-data"];function bEe(t,e){let n=Math.abs(t),r=Math.abs(e);for(;r!==0;){const i=n%r;n=r,r=i}return n||1}function vEe(t){const e=Number.isFinite(t)&&t>0?t:30,n=Number.isInteger(e)?1:1e6,r=Math.round(e*n),i=bEe(r,n);return{numerator:r/i,denominator:n/i}}function AEe(t){if(typeof t!="object"||t===null)return null;const e=t;return!Number.isFinite(e.numerator)||!Number.isFinite(e.denominator)||(e.numerator??0)<=0||(e.denominator??0)<=0?null:Number(e.numerator)/Number(e.denominator)}function SEe(t){return{protocolVersion:Aae,capabilities:xEe,fps:vEe(t)}}function wEe(t){return Array.isArray(t)&&t.every(e=>typeof e=="string")}function OEe(t,e=30){if(typeof t!="object"||t===null)return{status:"legacy",fps:e};const n=t;if(n.protocolVersion===void 0)return{status:"legacy",fps:e};if(n.protocolVersion!==Aae)return{status:"unsupported",code:"unsupported_protocol_version",receivedVersion:n.protocolVersion};const r=AEe(n.fps);return r===null||!wEe(n.capabilities)?{status:"unsupported",code:"invalid_protocol_metadata",receivedVersion:n.protocolVersion}:{status:"supported",fps:r,metadata:n}}function CEe(t,e={},n=30){return{...e,source:"hf-parent",type:"control",action:t,...SEe(n)}}function n_(t,e,n={},r=30){t==null||t.postMessage(CEe(e,n,r),"*")}function Rj(t){return OEe(t,30)}function kEe(t){t.status==="unsupported"&&window.dispatchEvent(new CustomEvent("runtimeprotocolerror",{detail:{code:t.code,receivedVersion:t.receivedVersion}}))}function wE(t){const e=Rj(t);return e.status!=="unsupported"?e:(kEe(e),null)}function EEe(t){const e=Rj(t);return e.status==="supported"?e.fps:30}function TEe(t,e){t.documentElement&&(t.documentElement.style.overflow="hidden",t.documentElement.style.margin="0"),t.body&&(t.body.style.overflow="hidden",t.body.style.margin="0"),e.scrollTo({top:0,left:0,behavior:"auto"})}function PEe(t){const e=/data-composition-id=["']([^"']+)["']/gi,n=new Set,r=Array.from(t.querySelectorAll("style, script"));for(const a of r){const o=a.textContent||"";if(!o)continue;let l;for(;(l=e.exec(o))!==null;){const c=(l[1]||"").trim();c&&n.add(c)}}if(n.size===0)return;const i=new Set,s=Array.from(t.querySelectorAll("[data-composition-id]"));for(const a of s){const o=a.getAttribute("data-composition-id");o&&i.add(o)}for(const a of n){if(a==="root"||i.has(a))continue;const o=t.getElementById(`${a}-layer`)||t.getElementById(`${a}-comp`)||t.getElementById(a);o&&(o.getAttribute("data-composition-id")||o.setAttribute("data-composition-id",a))}}function Sae(t){return Number.isFinite(t)?Math.max(0,Math.min(1,t)):1}function MEe(t){return t instanceof HTMLElement}function jj(t){const e=t.getRootNode();return typeof ShadowRoot<"u"&&e instanceof ShadowRoot&&MEe(e.host)?e.host:null}function Lj(t,e,n){n_(t.contentWindow,e,n)}function wae(t,e){if(t)try{const n=jj(t);if(n&&typeof n.muted=="boolean"){n.muted=e;return}Lj(t,"set-muted",{muted:e})}catch{}}function NEe(t,e){if(!t)return;const n=Sae(e);try{const r=jj(t);if(r&&typeof r.volume=="number"){r.volume=n;return}Lj(t,"set-volume",{volume:n})}catch{}}function DEe(t,e,n){wae(t,e),NEe(t,n)}function IEe(t,e){if(!t)return;const n=Number.isFinite(e)&&e>0?e:1;try{const r=jj(t);if(r&&typeof r.playbackRate=="number"){r.playbackRate=n;return}Lj(t,"set-playback-rate",{playbackRate:n})}catch{}}const _Ee=.25;let Z2=null,Y1=null,G2=null,U2=null;function REe(t,e){if(e){const n=t.getElementById(e);if(n instanceof HTMLAudioElement)return n}return t.querySelector("audio[data-timeline-role='music']")??t.querySelector("audio")}function jEe(t,e,n){Z2&&Z2!==t&&Kv(),G2===null&&(G2=t.muted),U2===null&&(U2=t.volume),Z2=t;try{t.muted=!1,t.volume=_Ee*Sae(n),Math.abs(t.currentTime-e)>.04&&(t.currentTime=e),t.paused&&t.play().catch(()=>{})}catch{}Y1&&clearTimeout(Y1),Y1=setTimeout(Kv,140)}function LEe(t,e,n,r=1){if(!t)return;if(e===null){Kv();return}let i=null;try{i=t.contentDocument}catch{return}if(!i)return;const s=REe(i,n);s&&jEe(s,e,r)}function Kv(){Y1&&(clearTimeout(Y1),Y1=null);const t=Z2;if(Z2=null,!!t){try{t.pause(),G2!==null&&(t.muted=G2),U2!==null&&(t.volume=U2)}catch{}G2=null,U2=null}}function Oae(t,e){var n,r,i;return((i=(r=(n=t.__timelines)==null?void 0:n[e])==null?void 0:r.duration)==null?void 0:i.call(r))??0}function FEe(t){const e=new Map;for(const n of t.querySelectorAll("[data-start]"))for(const r of[n.id,n.getAttribute("data-hf-id"),n.getAttribute("data-composition-id")])r&&e.set(r,n);return e}function $Ee(t,e){const n=(r,i)=>{if(i.has(r))return null;const s=t.get(r);if(!s)return null;const a=new Set(i).add(r),o=Td(s,{resolveReferenceEnd:u=>n(u,a)});if(o.end!=null)return o.end;const l=s.getAttribute("data-composition-id"),c=l?Oae(e,l):0;return o.start==null||c<=0?null:o.start+c};return n}function BEe(t,e,n){if(!Number.isFinite(e)||e<=0)return null;const r=Number.isFinite(t)?t:0;if(!Number.isFinite(n)||n<=0)return{start:r,duration:e};if(r>=n)return null;const i=Math.min(e,Math.max(0,n-r));return i>0?{start:r,duration:i}:null}function VEe(t,e){return t||e}function C4(t){return t||void 0}function HEe(t,e,n){if(n)return{...t,compositionSrc:n};const r=e.querySelector("video[src]");return r?{...t,src:C4(r.getAttribute("src")),tag:"video"}:t}function QEe(t){const{doc:e,iframeWin:n,element:r,compositionId:i,rootDuration:s,fallbackIndex:a,resolveEnd:o}=t,l=Td(r,{resolveReferenceEnd:w=>o(w,new Set([i]))}),c=BEe(l.start??0,l.duration??Oae(n,i),s);if(!c)return null;const u=VEe(r.id,i),f=r.getAttribute("data-composition-src")??r.getAttribute("data-composition-file"),h=m0(r),p=g0(r),y=Uv(e,r,h),m=iS({id:u,label:r.getAttribute("data-timeline-label")??r.getAttribute("data-label"),tag:r.tagName}),v=Wv({preferredId:u,label:m,fallbackIndex:a,domId:C4(r.id),selector:h,selectorIndex:y,sourceFile:p}),b={id:v.id,label:m,key:v.key,tag:r.tagName.toLowerCase(),start:c.start,duration:c.duration,track:l.trackIndex,domId:C4(r.id),hfId:C4(r.getAttribute("data-hf-id")),selector:h,selectorIndex:y,sourceFile:p,zIndex:gE(r)};return HEe(b,r,f)}function zEe(t,e,n,r){const i=new Set(n.map(h=>h.id)),s=t.querySelector("[data-composition-id]"),a=s==null?void 0:s.getAttribute("data-composition-id"),o=t.querySelectorAll("[data-composition-id][data-start]"),l=[],c=$Ee(FEe(t),e);for(const h of o){const p=h,y=p.getAttribute("data-composition-id");if(!y||y===a||i.has(p.id)||i.has(y))continue;const m=QEe({doc:t,iframeWin:e,element:p,compositionId:y,rootDuration:r,fallbackIndex:l.length,resolveEnd:c});m&&l.push(m)}let u=!1;const f=n.map(h=>{if(h.compositionSrc)return h;const p=t.getElementById(h.id)??t.querySelector(`[data-composition-id="${CSS.escape(h.id)}"]`);if(!p)return h;const y=p.getAttribute("data-composition-src")||p.getAttribute("data-composition-file");return y?(u=!0,{...h,compositionSrc:y}):h});return{missing:l,updatedEls:f,patched:u}}function BG(t){return t.tagName||t.kind||"div"}function Cae(t){const{clip:e,fallbackIndex:n,doc:r}=t;let i=t.hostEl??null;const s=iS({id:e.id,label:e.label,tag:BG(e)});let a,o,l,c,u;i&&(a=i.id||void 0,u=i.getAttribute("data-hf-id")||void 0,o=m0(i),l=r&&o?Uv(r,i,o):void 0,c=g0(i));const f=Wv({preferredId:e.id,label:s,fallbackIndex:n,domId:a,selector:o,selectorIndex:l,sourceFile:c}),h={id:f.id,label:s,key:f.key,kind:e.kind,tag:BG(e),start:e.start,duration:e.duration,track:e.track,authoredTrack:e.track,stackingContextId:e.stackingContextId??null,domId:a,hfId:u,selector:o,selectorIndex:l,sourceFile:c,playbackStart:e.playbackStart,playbackRate:e.playbackRate};if(i){Wse(h,i),i.hasAttribute("data-hidden")&&(h.hidden=!0);const p=i.getAttribute("data-timeline-role");p&&(h.timelineRole=p);const y=i.getAttribute("data-audio-group");if(y){h.audioGroup=y;const b=SE(r??i.ownerDocument,y);h.audioGroupLabel=b.label,h.audioGroupVolume=b.volume,h.audioGroupHidden=b.hidden,b.fxChain&&(h.audioGroupFxChain=b.fxChain),b.automation&&(h.audioGroupAutomation=b.automation)}const m=i.getAttribute("data-fx-chain");m&&(h.fxChain=m);const v=i.getAttribute("data-automation");v&&(h.automation=v),h.zIndex=gE(i)}if(e.assetUrl&&(h.src=e.assetUrl),e.kind==="composition"&&e.compositionId){h.playbackStart??(h.playbackStart=0),h.playbackRate??(h.playbackRate=1);let p=e.compositionSrc;if(p||(i=(r==null?void 0:r.querySelector(`[data-composition-id="${CSS.escape(e.compositionId)}"]`))??i,p=(i==null?void 0:i.getAttribute("data-composition-src"))??(i==null?void 0:i.getAttribute("data-composition-file"))??null),p)h.compositionSrc=p;else if(i){const y=i.querySelector("video[src]");y&&(h.src=y.getAttribute("src")||void 0,h.tag="video")}if(i){h.domId=i.id||void 0,h.hfId=i.getAttribute("data-hf-id")||void 0,h.selector=m0(i),h.selectorIndex=r&&h.selector?Uv(r,i,h.selector):void 0,h.sourceFile=g0(i);const y=Wv({preferredId:e.id,label:s,fallbackIndex:n,domId:h.domId,selector:h.selector,selectorIndex:h.selectorIndex,sourceFile:h.sourceFile});h.id=y.id,h.key=y.key}}return h}function kae(t,e,n=[]){if(!Number.isFinite(e)||e<=0)return[];const r=t.querySelector("[data-composition-id]");if(!r)return[];const i=new Set(n.map(Zn)),s=n.reduce((o,l)=>Math.max(o,Number.isFinite(l.track)?l.track:0),-1),a=[];for(const o of Array.from(r.children)){if(!DCe(r,o))continue;const l=m0(o);if(!l)continue;const c=Uv(t,o,l),u=g0(o),f=CCe(o),h=Wv({preferredId:o.id||null,label:f,fallbackIndex:n.length+a.length,domId:o.id||void 0,selector:l,selectorIndex:c,sourceFile:u});i.has(h.key)||i.has(h.id)||a.push({domId:o.id||void 0,hfId:o.getAttribute("data-hf-id")||void 0,zIndex:gE(o),duration:e,id:h.id,key:h.key,label:f,selector:l,selectorIndex:c,sourceFile:u,stackingContextId:_j(o),start:0,tag:o.tagName.toLowerCase(),timingSource:"implicit",track:s+1+a.length})}return a}function Eae(t,e){const n=t.querySelector("[data-composition-id]"),r=t.querySelectorAll("[data-start]"),i=[];let s=0;return r.forEach(a=>{if(a===n||yE(a))return;const o=a,l=Td(o),c=l.start;if(c==null||Number.isFinite(e)&&e>0&&c>=e)return;const u=o.tagName.toLowerCase();let f=l.duration??0;if(f<=0&&(f=Math.max(0,e-c)),Number.isFinite(e)&&e>0&&(f=Math.min(f,Math.max(0,e-c))),!Number.isFinite(f)||f<=0)return;const h=l.trackSource==="default"?s++:l.trackIndex,p=o.getAttribute("data-composition-id"),y=m0(o),m=g0(o),v=Uv(t,o,y),b=iS({id:o.id||p||null,label:o.getAttribute("data-timeline-label")??o.getAttribute("data-label"),tag:u}),w=Wv({preferredId:o.id||p||null,label:b,fallbackIndex:i.length,domId:o.id||void 0,selector:y,selectorIndex:v,sourceFile:m}),O={id:w.id,label:b,key:w.key,kind:p&&p!==(n==null?void 0:n.getAttribute("data-composition-id"))?"composition":u==="video"||u==="audio"?u:u==="img"?"image":"element",tag:u,start:c,duration:f,track:h,domId:o.id||void 0,hfId:o.getAttribute("data-hf-id")||void 0,selector:y,selectorIndex:v,sourceFile:m,stackingContextId:_j(o),timingSource:"authored",zIndex:gE(o)},k=Xse(o);if(Wse(O,o),k){k.tagName==="IMG"&&(O.tag="img");const j=o.getAttribute("data-volume")??k.getAttribute("data-volume");j&&(O.volume=parseFloat(j));const L=k.src||void 0;L&&(O.src=L)}const E=o.getAttribute("data-fx-chain");E&&(O.fxChain=E);const T=o.getAttribute("data-automation");T&&(O.automation=T),o.hasAttribute("data-timeline-locked")&&(O.timelineLocked=!0),o.hasAttribute("data-hidden")&&(O.hidden=!0);const N=o.getAttribute("data-timeline-role");N&&(O.timelineRole=N);const _=o.getAttribute("data-audio-group");if(_){O.audioGroup=_;const j=SE(t,_);O.audioGroupLabel=j.label,O.audioGroupVolume=j.volume,O.audioGroupHidden=j.hidden,j.fxChain&&(O.audioGroupFxChain=j.fxChain),j.automation&&(O.audioGroupAutomation=j.automation)}const I=o.getAttribute("data-composition-src")||o.getAttribute("data-composition-file");if(I)O.compositionSrc=I;else if(p&&p!==(n==null?void 0:n.getAttribute("data-composition-id"))){const j=o.querySelector("video[src]");j&&(O.src=j.getAttribute("src")||void 0,O.tag="video")}O.kind==="composition"&&(O.playbackStart??(O.playbackStart=0),O.playbackRate??(O.playbackRate=1)),i.push(O)}),[...i,...kae(t,e,i)]}function ZEe(t,e,n,r){const i=Number.isFinite(n)?n:0,s=Number.isFinite(r)?r:0;if(t.length===0||e.length>=t.length||s>i)return e;const a=new Set(e.map(Zn)),o=t.filter(l=>!a.has(Zn(l))&&l.compositionSrc!=null);return o.length===0?e:[...e,...o]}function GEe(t){const e=t.match(/\/preview\/comp\/(.+?)(?:\?|$)/);return e?decodeURIComponent(e[1]):void 0}function UEe(t){if(!Number.isFinite(t.rootDuration)||t.rootDuration<=0)return null;const e=GEe(t.iframeSrc);return{id:t.compositionId,label:iS({id:t.compositionId,tag:t.tagName}),key:Xv({id:t.compositionId,fallbackIndex:0,selector:t.selector,selectorIndex:t.selectorIndex,sourceFile:e}),tag:t.tagName.toLowerCase()||"div",start:0,duration:t.rootDuration,track:0,compositionSrc:e,selector:t.selector,selectorIndex:t.selectorIndex,sourceFile:e}}function XEe(t,e){let n=e.get(t);if(!n)return null;const r=new Set;for(r.add(t);e.has(n);){if(r.has(n))return n;r.add(n);const i=e.get(n);if(!i)return n;n=i}return n}function Tae(t,e,n){if(!t)return null;const r=C6(t).domId;if(n.has(r))return r;if(n.has(t))return t;const i=e.find(s=>s.label===t||s.label===r);return i!=null&&i.id&&n.has(i.id)?i.id:null}function WEe(t,e){return Number.isFinite(e)&&e>=t.start&&e=t.start&&e<=t.start+t.duration}function YEe(t,e,n){let r=0,i=e.get(t);const s=new Set;for(s.add(t);i;){if(s.has(i))return r;s.add(i),n.has(i)&&(r+=1),i=e.get(i)}return r}function KEe(t,e,n){const r=new Set(n.values()),i=c=>{const u=new Set;for(const f of e)f.id&&r.has(f.id)&&c(f,t)&&u.add(f.id);return u},s=i(WEe),a=s.size>0?s:i(qEe);let o=null,l=-1;for(const c of a){const u=YEe(c,n,a);u<=l||(o=c,l=u)}return o}function JEe({selectedElementId:t,currentTime:e,manifest:n,parentMap:r}){const i=Tae(t,n,r);return i||KEe(e,n,r)}function X2(t,e){return e.size===0?t:t.filter(n=>!e.has(n.domId??n.id))}function e3e(t,e,n){const r=t.start+t.duration;if(t.start>=n||r<=e)return null;const i=Math.max(t.start,e),s=Math.min(r,n)-i;return s>0?{start:i,duration:s}:null}function t3e(t,e){const n=t!=null&&t.audioGroup?t:e!=null&&e.audioGroup?e:null;return n?{audioGroup:n.audioGroup,audioGroupLabel:n.audioGroupLabel,audioGroupVolume:n.audioGroupVolume,audioGroupHidden:n.audioGroupHidden,audioGroupFxChain:n.audioGroupFxChain,audioGroupAutomation:n.audioGroupAutomation}:{}}function n3e(t,e){if(!t)return{...e};const{hidden:n,timelineLocked:r,timelineRole:i,fxChain:s,automation:a}=t;return{hidden:n,timelineLocked:r,timelineRole:i,fxChain:s,automation:a,...e}}function r3e(t,e,n,r,i,s,a){const o=[];for(const l of t){const c=e3e(l,e.start,e.end);if(!c)continue;const u=Cae({clip:l,fallbackIndex:o.length}),f=l.id??void 0,h=l.id?`#${l.id}`:void 0,p=Xv({id:u.id,fallbackIndex:o.length,domId:f,selector:h,selectorIndex:u.selectorIndex,sourceFile:n.sourceFile});o.push({...u,...n3e(i.find(y=>y.key===p),f?a.get(f):void 0),...t3e(i.find(y=>y.key===p),f?s.get(f):void 0),key:p,start:c.start,duration:c.duration,track:e.track+.5*(o.length+1)/(t.length+1),authoredTrack:u.authoredTrack,stackingContextId:u.stackingContextId,expandedParentStart:n.start,expandedHostKey:r,domId:f,selector:h,sourceFile:n.sourceFile,timingSource:"authored"})}return o}function i3e(t,e,n){return t.filter(r=>r.parentId===e).map(r=>({id:r.id,label:r.label,start:n.start,duration:n.duration,track:n.track,kind:"element",tagName:null,compositionId:null,parentCompositionId:n.id??null,compositionSrc:n.compositionSrc??null,assetUrl:null,stackingContextId:r.stackingContextId}))}function s3e(t,e,n,r,i,s=[],a=new Map){const o=t.find(v=>v.id===r||v.domId===r);if(!o)return X2(t,n);const l=e.find(v=>v.id===i),c=(()=>{const v=e.filter(b=>b.id!=null&&n.get(b.id)===i);return v.length>0?v:i3e(s,i,l??o)})();if(c.length===0)return X2(t,n);const u={start:(l==null?void 0:l.start)??o.start,sourceFile:(l==null?void 0:l.compositionSrc)??o.compositionSrc??void 0},f=o.key??o.id,h=new Map(s.map(v=>[v.id,v])),p=r3e(c,{start:o.start,end:o.start+o.duration,track:o.track},u,f,t,h,a);if(p.length===0)return X2(t,n);const y=new Set;for(let v=i;v&&!(y.has(v)||(y.add(v),v===r));)v=n.get(v);const m=v=>y.has(i)&&t.some(b=>(b.domId??b.id)===i)?(v.domId??v.id)===i:(v.key??v.id)===f;return t.filter(v=>(v.key??v.id)===f||y.has(v.domId??v.id)||!n.has(v.domId??v.id)).flatMap(v=>m(v)?[v,...p]:[v])}function aS(){const t=ue(c=>c.elements),e=ue(c=>c.clipManifest),n=ue(c=>c.clipParentMap),r=ue(c=>c.domClipChildren),i=ue(c=>c.subCompositionHostState),s=ue(c=>c.selectedElementId),a=ue(c=>c.currentTime),{rawId:o,selectedRawId:l}=x.useMemo(()=>!e||e.length===0||n.size===0?{rawId:null,selectedRawId:null}:{rawId:JEe({selectedElementId:s,currentTime:a,manifest:e,parentMap:n}),selectedRawId:Tae(s,e,n)},[e,n,s,a]);return x.useMemo(()=>{if(!e||e.length===0||n.size===0)return t;if(!o)return X2(t,n);const c=l?n.get(o):o;if(!c)return X2(t,n);const u=XEe(o,n)??c;return s3e(t,e,n,u,c,r,i)},[t,e,n,r,i,o,l])}const a3e={clip:"rgba(255,255,255,0.055)",clipActive:"rgba(60,230,172,0.16)",accent:"#3CE6AC",label:"rgba(255,255,255,0.5)"},Fj={shellBackground:"#0A0A0B",shellBorder:"rgba(255,255,255,0.05)",rulerBorder:"rgba(255,255,255,0.16)",rowBackground:"#101014",rowBorder:"rgba(255,255,255,0.06)",gutterBackground:"#0E0F12",gutterBorder:"rgba(255,255,255,0.10)",textPrimary:"rgba(255,255,255,0.92)",textSecondary:"rgba(255,255,255,0.62)",tickText:"rgba(255,255,255,0.34)",tickMajor:"rgba(255,255,255,0.10)",tickMinor:"rgba(255,255,255,0.06)",clipBackground:"#141922",clipBackgroundActive:"#181e28",clipBorder:"rgba(255,255,255,0.10)",clipBorderHover:"rgba(255,255,255,0.18)",clipBorderActive:"rgba(255,255,255,0.24)",clipShadow:"none",clipShadowHover:"0 2px 8px rgba(0,0,0,0.2)",clipShadowActive:"0 2px 8px rgba(0,0,0,0.2), 0 0 0 1px rgba(255,255,255,0.04)",clipShadowDragging:"0 8px 24px rgba(0,0,0,0.4), 0 0 0 1px rgba(255,255,255,0.06)",handleColor:"rgba(255,255,255,0.2)",panelResizeSeam:"rgba(255,255,255,0.12)",panelResizeActive:"rgba(255,255,255,0.24)",clipRadius:"8px"};function o3e(t){return a3e}function l3e({isHovered:t,isSelected:e,isDragging:n}){return n?.95:e?.82:t?.76:0}function c3e({element:t,draggedElementId:e,previewStart:n,previewTrack:r}){return(t.key??t.id)!==e||n===null||r===null?t:{...t,start:n,track:r}}function Xt(t){return Math.round(t*1e3)/1e3}function va(t){return Math.round(t*100)/100}function r_(t){var e,n;try{const r=Ej(t);if(r!=null)return r;const i=(e=t.style)==null?void 0:e.zIndex;if(i&&i!=="auto"){const l=parseInt(i,10);if(Number.isFinite(l))return l}const s=(n=t.ownerDocument)==null?void 0:n.defaultView;if(!s)return 0;const a=s.getComputedStyle(t).zIndex;if(a==="auto"||a==="")return 0;const o=parseInt(a,10);return Number.isFinite(o)?o:0}catch{return 0}}function Pae(t){return t.stackingContextId??t.parentCompositionId??t.compositionAncestors[0]??""}function Mae(t){return{key:Zn(t),track:t.track,zIndex:t.zIndex??0,stackingContextId:t.stackingContextId??null,parentCompositionId:t.parentCompositionId??null,compositionAncestors:t.compositionAncestors??[]}}function u3e(t,e){return t.startZn(n)===e)}function Dae(t,e,n){return t.elements.some(r=>Zn(r)!==n&&u3e(r,e))}function Iae(t,e,n){(e.zIndex??0)!==n&&t.push({key:Zn(e),zIndex:n,domId:e.domId,selector:e.selector,selectorIndex:e.selectorIndex,sourceFile:e.sourceFile})}function _ae(t,e,n,r){let i=0;for(const s of e.elements){if(Zn(s)===r)continue;const o=t.length;Iae(t,s,n),t.length>o&&(i+=1)}return i}function h3e(t,e){return t.filter(n=>n.kind==="visual"&&n.contextKey===e)}function Jv(t,e){return t.find(n=>n.id===e)??null}function oS(t){const e=[];return Iae(e,t.element,t.targetZIndex),e}function d3e(t){const e=Zn(t.element),n=t.bottomZIndex+1,r=oS({element:t.element,targetZIndex:n});let i=0,s=n+1;for(let a=t.beforeIndex;a>=0;a-=1){const o=t.layers[a];if(!o)continue;const l=o.zIndex>=s?o.zIndex:s;i+=_ae(r,o,l,e),s=l+1}return{changes:r,siblingChanges:i}}function p3e(t){const e=Zn(t.element),n=t.topZIndex-1,r=oS({element:t.element,targetZIndex:n});let i=0,s=n-1;for(let a=t.afterIndex;a1)return oS({element:t.element,targetZIndex:Math.floor((e+n)/2)});const r=t.layers.findIndex(o=>o.id===t.beforeLayer.id),i=t.layers.findIndex(o=>o.id===t.afterLayer.id),s=d3e({element:t.element,layers:t.layers,beforeIndex:r,bottomZIndex:n}),a=p3e({element:t.element,layers:t.layers,afterIndex:i,topZIndex:e});return s.siblingChanges<=a.siblingChanges?s.changes:a.changes}function g3e(t){const e=Jv(t.layers,t.layerId);return!e||Dae(e,t.element,Zn(t.element))?null:oS({element:t.element,targetZIndex:e.zIndex})}function VG(t){const e=Jv(t.layers,t.layerId);return e?oS({element:t.element,targetZIndex:e.zIndex+t.offset}):null}function y3e(t){switch(t.placement.type){case"onto":return g3e({element:t.element,layers:t.layers,layerId:t.placement.layerId});case"above":return VG({element:t.element,layers:t.layers,layerId:t.placement.layerId,offset:1});case"below":return VG({element:t.element,layers:t.layers,layerId:t.placement.layerId,offset:-1});case"between":{const e=Jv(t.layers,t.placement.beforeLayerId),n=Jv(t.layers,t.placement.afterLayerId);return e&&n?m3e({element:t.element,layers:t.layers,beforeLayer:e,afterLayer:n}):null}}}function x3e(t){if(Nae(t.element))return null;const e=Pae(Mae(t.element)),n=h3e(t.layers,e),r=y3e({element:t.element,layers:n,placement:t.placement});return r&&r.length>0?{contextKey:e,placement:t.placement,zIndexChanges:r}:null}function b3e(t,e){const n=t[0],r=t[t.length-1];if(!n||!r)return null;if(e<-zP)return{type:"above",layerId:n.id};if(e>t.length-1+zP)return{type:"below",layerId:r.id};const i=Math.round(e),s=t[i];if(s&&Math.abs(e-i)<=zP)return{type:"onto",layerId:s.id};const a=Math.max(0,Math.min(t.length,Math.ceil(e)));if(a<=0)return{type:"above",layerId:n.id};if(a>=t.length)return{type:"below",layerId:r.id};const o=t[a-1],l=t[a];return o&&l?{type:"between",beforeLayerId:o.id,afterLayerId:l.id}:null}function v3e(t){if(t.placement.type!=="onto")return t.placement;const e=Jv(t.layers,t.placement.layerId);return e?Dae(e,t.element,t.draggedKey)?t.targetPositiont.currentIndex?{type:"below",layerId:e.id}:t.placement:t.placement:null}function A3e(t,e){return e.type==="onto"?e.layerId:e.type==="between"?`preview:${t}:between:${e.beforeLayerId}:${e.afterLayerId}`:`preview:${t}:${e.type}:${e.layerId}`}function S3e(t,e){if(e.type==="onto")return Math.max(0,t.indexOf(e.layerId));if(e.type==="between")return Math.max(0,t.indexOf(e.afterLayerId));const n=Math.max(0,t.indexOf(e.layerId));return e.type==="above"?n:n+1}function w3e(t){if(Nae(t.element))return null;const e=Pae(Mae(t.element)),n=new Map(t.layers.map(c=>[c.id,c])),r=t.layerOrder.map(c=>n.get(c)??null).filter(c=>c!=null&&c.kind==="visual"&&c.contextKey===e),i=Zn(t.element),s=r.findIndex(c=>f3e(c,i));if(s<0)return null;const a=s+t.trackDeltaRaw,o=b3e(r,a);if(!o)return null;const l=v3e({layers:r,element:t.element,draggedKey:i,placement:o,targetPosition:a,currentIndex:s});return l?{previewLayerId:A3e(i,l),previewLayerIndex:S3e(t.layerOrder,l),stackingReorder:x3e({element:t.element,layers:r,placement:l})}:null}const Pd=72,W2=32,Fo=232,Xi=48,Cg=28,Ra=24,ha=3,O3e=18;function C3e(t,e){let n=0,r=t.length;for(;n=s)break;a.add(o)}for(const o of r)o>=0&&oo-l).map(o=>({index:o,time:t[o],strength:e==null?void 0:e[o]}))}function kg(t){return Xi+Math.max(0,Math.trunc(t))*Cg}const k3e=ha/Xi,r0=50,Rae=Math.round(Xi*1.5),E3e=48;function T3e(t,e){return t.map(n=>{let r=0,i=0;for(const s of n)e!=null&&e.has(s.clipId)&&(r=Math.max(r,s.laneCount),i=Math.max(i,s.automationLaneCount??0));return Xi+Math.max(0,Math.trunc(r))*Cg+i*Pd})}function P6(t){return t===void 0||!Number.isFinite(t)||t<=0?Xi:t}const i_=new WeakMap,OE=Object.freeze([]);function Bj(t,e){const n=Object.freeze(e.map(P6)),r=Object.freeze(n.map((f,h)=>{const p=t[h];return p!==void 0&&Number.isFinite(p)?p:h})),i=[0];for(const f of n)i.push((i.at(-1)??0)+f);Object.freeze(i);const s=new Map(r.map((f,h)=>[f,h])),a=f=>P6(n[f]),o=f=>{if(n.length===0)return f*Xi;if(f<=0)return f*a(0);if(f>=n.length)return(i[n.length]??0)+(f-n.length)*Xi;const h=Math.floor(f);return(i[h]??0)+(f-h)*a(h)},l=f=>{const h=f-Ra-r0;if(n.length===0)return h/Xi;if(h<0)return h/a(0);const p=i[n.length]??0;if(h>=p)return n.length+(h-p)/Xi;let y=1,m=n.length;for(;yh?m=b:y=b+1}const v=y-1;return v+(h-(i[v]??0))/a(v)},c={rowKeys:r,rowHeights:n,rowOffsets:i,rowsHeight:i.at(-1)??0,canvasHeight:Ra+r0+(i.at(-1)??0)+Rae,getRowIndex:f=>s.get(f)??-1,getRowHeight:a,getRowTop:f=>Ra+r0+o(f),getRowFromY:l,getRowPositionFromY:f=>{const h=l(f),p=Math.floor(h);return{rowFloat:h,row:p,fraction:h-p,rowHeight:a(p)}}},u=Object.freeze(c);return i_.set(n,u),u}function Vj(t){const e=i_.get(t);if(e)return e;const n=Bj(t.map((r,i)=>i),t);return i_.set(t,n),n}function jae(t,e=OE){return P6(e[t])}function P3e(t,e){return Vj(e).getRowTop(t)-Ra-r0}function ZP(t,e=OE){return Ra+r0+P3e(t,e)}function s_(t,e=OE){return Vj(e).getRowFromY(t)}function M3e(t,e=OE){return Vj(e).getRowPositionFromY(t)}function N3e(t){return ha/P6(t)}const HG=160,Lae=60,D3e=1.2;function I3e(t,e,n){const r=Number.isFinite(e)&&e>0?e:0,i=Math.max(r*D3e,Lae);return!Number.isFinite(t)||t<=n?100:(t-n-2)/i}function _3e(t){const e=Number.isFinite(t.pps)?Math.max(t.pps,0):0;return Math.max(t.trackContentWidth,t.viewportWidth-t.contentOrigin-2,t.dragGhostEndPx??0,t.resizeGhostEndPx??0,Lae*e)}function CE(t){return t.clientX-t.rectLeft+t.scrollLeft-t.contentOrigin}function R3e(t,e,n){return t==="fit"||!Number.isFinite(e)||!Number.isFinite(n)?!1:e-n>1}function j3e(t,e,n){return e==="fit"?0:n}function QG(t){const e=Math.max(0,t.currentPixelsPerSecond),n=Math.max(0,t.nextPixelsPerSecond);if(!Number.isFinite(t.pointerX)||!Number.isFinite(t.currentScrollLeft)||!Number.isFinite(t.duration)||t.duration<=0||e<=0||n<=0)return Math.max(0,t.currentScrollLeft);const r=Math.max(0,CE({clientX:t.pointerX,rectLeft:0,scrollLeft:t.currentScrollLeft,contentOrigin:t.contentOrigin})),i=Math.max(0,Math.min(t.duration,r/e));return Math.max(0,t.contentOrigin+i*n-t.pointerX)}const M6=9;function a_(t,e,n){return!Number.isFinite(t)||!Number.isFinite(e)?n-M6/2:n+Math.max(0,t)*Math.max(0,e)-M6/2}function Fae(t){const{clientX:e,viewportLeft:n,scrollLeft:r,contentOrigin:i,pixelsPerSecond:s,duration:a}=t;if(!(s>0)||!Number.isFinite(a))return 0;const o=CE({clientX:e,rectLeft:n,scrollLeft:r,contentOrigin:i});return Math.max(0,Math.min(a,o/s))}const zG=.75;function L3e(t){const e=Number.isFinite(t.currentScrollLeft)?Math.max(0,t.currentScrollLeft):0,n=Number.isFinite(t.maxScrollLeft)?Math.max(0,t.maxScrollLeft):0,r=t.viewportWidth-t.contentOrigin;if(!Number.isFinite(t.playheadX)||!Number.isFinite(t.contentOrigin)||!Number.isFinite(r)||r<=0||n<=0)return Math.min(n,e);const i=e+t.contentOrigin,s=i+r*zG;let a=e;return t.playheadX>s?a=t.playheadX-t.contentOrigin-r*zG:t.playheadX=t.length?Math.max(...t)+1:t[e]??t[t.length-1]??0}function B3e(t,e,n){const r=CE({clientX:e,rectLeft:t.rectLeft,scrollLeft:t.scrollLeft,contentOrigin:t.contentOrigin}),i=n-t.rectTop+t.scrollTop,s=Math.round(r/Math.max(t.pixelsPerSecond,1)*100)/100,a=Math.max(0,t.clampStartToDuration===!1?s:Math.min(t.duration,s)),o=Math.floor(s_(i,t.rowHeights));return{start:a,track:$3e(t.trackOrder,o)}}function V3e(t){return t.kind==="composition"||t.compositionSrc||t.playbackStartAttr!=null||t.sourceDuration!=null&&Number.isFinite(t.sourceDuration)&&t.sourceDuration>0?!0:["video","audio","img"].includes(t.tag.toLowerCase())}function H3e(t){return!!(t.domId||t.selector)}function lS(t){if(t.timingSource==="implicit"||t.timelineLocked)return{canMove:!1,canTrimStart:!1,canTrimEnd:!1};const e=H3e(t),n=Number.isFinite(t.duration)&&t.duration>0,r=V3e(t);return{canMove:e&&(r||n),canTrimEnd:e&&n,canTrimStart:e&&n}}const Q3e=.1,z3e=.05;function Z3e(t,e,n){return Math.min(Math.max(t,e),n)}function E1(t){return va(t)}function kE(t){return Math.max(z3e,t??Q3e)}function $ae(t){return Math.max(.1,t??1)}function Bae(t,e,n){const r=$ae(t.playbackRate),i=t.playbackStart!=null?t.playbackStart/r:Number.POSITIVE_INFINITY;return{minDelta:-Math.min(t.start-e,i),maxDelta:t.duration-n}}function Vae(t,e){const n=$ae(t.playbackRate);return{start:t.start+e,duration:t.duration-e,playbackStart:t.playbackStart!=null?Math.max(0,t.playbackStart+e*n):void 0}}function G3e(t,e,n,r=kE()){if(e.length===0)return 0;if(n==="end"){const o=Math.max(...e.map(l=>r-l.duration));return E1(Math.max(t,o))}const i=e.map(o=>Bae(o,0,r)),s=Math.max(...i.map(o=>o.minDelta)),a=Math.min(...i.map(o=>o.maxDelta));return E1(Z3e(t,s,a))}function U3e(t,e,n,r=kE()){const i=G3e(n,t,e,r);return{delta:i,members:t.map(s=>{if(e==="end")return{start:s.start,duration:E1(s.duration+i),playbackStart:s.playbackStart};const a=Vae(s,i);return{start:E1(a.start),duration:E1(a.duration),playbackStart:a.playbackStart!=null?E1(a.playbackStart):void 0}})}}function ZG(t){return t.key??t.id}function X3e(t){const e=t.tag.toLowerCase();return t.kind==="composition"||e==="audio"||e==="video"}function W3e(t,e){const n=lS({tag:t.tag,kind:t.kind,duration:t.duration,domId:t.domId,selector:t.selector,compositionSrc:t.compositionSrc,playbackStart:t.playbackStart,playbackStartAttr:t.playbackStartAttr,sourceDuration:t.sourceDuration,timingSource:t.timingSource,timelineLocked:t.timelineLocked});return e==="start"?n.canTrimStart:n.canTrimEnd}function q3e(t,e,n,r){if(e.size<=1||!e.has(n))return null;const i=t.filter(s=>e.has(ZG(s)));return i.length<=1||!i.every(s=>W3e(s,r))?null:i.map(s=>({element:s,key:ZG(s),start:s.start,duration:s.duration,playbackStart:r==="start"&&X3e(s)?s.playbackStart??0:s.playbackStart,playbackRate:s.playbackRate}))}function Y3e(t,e,n,r=kE()){return U3e(t,e,n,r).members.map((s,a)=>({element:t[a].element,key:t[a].key,start:s.start,duration:s.duration,playbackStart:s.playbackStart}))}function K3e(t,e){const n=t.members.find(s=>s.key===t.grabbedKey),r=t.edge==="start"?e.previewStart-((n==null?void 0:n.start)??e.previewStart):e.previewDuration-((n==null?void 0:n.duration)??e.previewDuration),i=Y3e(t.members,t.edge,r);return t.changes=i,t.hasChanged=i.some((s,a)=>s.start!==t.members[a].start||s.duration!==t.members[a].duration||s.playbackStart!==t.members[a].playbackStart),i.find(s=>s.key===t.grabbedKey)}const T1=va;function eA(t,e,n){return Math.min(Math.max(t,e),n)}const GG=.55,$O=40,UG=12;function Hj(t,e,n,r=0){const i=(a,o,l)=>{if(lo-$O){const c=Math.min(1,Math.max(0,1-(o-l)/$O));return Math.round(UG*c)}return 0},s=Math.min(t.right,t.left+Math.max(0,r));return{x:i(s,t.right,e),y:i(t.top,t.bottom,n)}}function J3e(t,e,n){const r=(t.currentScrollLeft??0)-(t.originScrollLeft??0),i=(e-t.originClientX+r)/Math.max(t.pixelsPerSecond,1),s=n-t.originRow,a=Math.round(s),o=eA(T1(t.start+i),0,Math.max(0,t.maxStart));if(t.stackingElement){const v=t.timelineLayers&&t.layerOrder?w3e({element:{...t.stackingElement,duration:t.duration},layers:t.timelineLayers,layerOrder:t.layerOrder,trackDeltaRaw:s}):null;return{start:o,track:t.track,previewLayerId:v==null?void 0:v.previewLayerId,previewLayerIndex:v==null?void 0:v.previewLayerIndex,stackingReorder:(v==null?void 0:v.stackingReorder)??null}}const l=Math.max(0,t.trackOrder.indexOf(t.track)),c=l+a,u=eA(c,0,Math.max(0,t.trackOrder.length-1)),f=Math.min(...t.trackOrder),h=Math.max(...t.trackOrder);let p=t.trackOrder[u]??t.track;const y=l===0,m=l===t.trackOrder.length-1;return y&&c<0&&l+s<=-GG?p=f-1:m&&c>t.trackOrder.length-1&&l+s>=t.trackOrder.length-1+GG&&(p=h+1),{start:o,track:p}}function e5e(t,e,n){const r=kE(t.minDuration),i=(n-t.originClientX)/Math.max(t.pixelsPerSecond,1);if(e==="end"){const c=eA(T1(t.duration+i),r,Math.max(r,t.maxEnd-t.start));return{start:t.start,duration:c,playbackStart:t.playbackStart}}const{minDelta:s,maxDelta:a}=Bae(t,t.minStart,r),o=eA(i,s,a),l=Vae(t,o);return{start:T1(l.start),duration:T1(l.duration),playbackStart:l.playbackStart!=null?T1(l.playbackStart):void 0}}function t5e(t){if(t.capabilities.canMove)return null;const e=Math.max(0,t.width),n=eA(t.offsetX,0,e),r=Math.max(0,t.handleWidth);return n<=r&&!t.capabilities.canTrimStart?"resize-start":n>=Math.max(0,e-r)&&!t.capabilities.canTrimEnd?"resize-end":"move"}function n5e(t,e){return{start:t.start,end:t.start+t.duration,anchorX:e.anchorX,anchorY:e.anchorY}}function r5e({rangeStart:t,rangeEnd:e,elements:n,prompt:r}){const i=Math.min(t,e),s=Math.max(t,e),a=n.map(o=>`- #${o.id} (${o.tag}) - ${os(o.start)} to ${os(o.start+o.duration)}, track ${o.track}`).join(` `);return`Edit the following HyperFrames composition: @@ -86,7 +86,7 @@ Preserve all other elements and timing outside this range.`}function XG(t){retur `,n.index),a=(((l=t.slice(i+1,n.index).match(/^(\s*)/))==null?void 0:l[1])??"")+" ",o=e.split(` `).map((c,u)=>u===0?c:a+c).join(` `);return`${t.slice(0,r)} -${a}${o}${t.slice(r)}`}const l_="application/x-hyperframes-composition";function _5e(t){try{const e=JSON.parse(t);if(typeof e!="object"||e===null||!("sourcePath"in e))return null;const n=e.sourcePath;return typeof n=="string"&&n.trim()?{sourcePath:n}:null}catch{return null}}function R5e(t,e,n,r){try{const i=e(JSON.parse(t));return i?(n(i,r),!0):!1}catch{return!1}}function Xj(t){try{Promise.resolve(t()).catch(()=>{})}catch{}}function j5e(t,e){return t?e:Math.max(0,ue.getState().currentTime)}function L5e(t,e,n){return!e||t.files.length===0?!1:(Xj(()=>e(Array.from(t.files),n)),!0)}function KG(t,e,n,r,i){if(!r||!Array.from(t.types).includes(e))return!1;const s=t.getData(e);return s?R5e(s,a=>a[n],(a,o)=>Xj(()=>r(a,o)),i):!1}function F5e({scrollRef:t,ppsRef:e,durationRef:n,trackOrderRef:r,rowGeometryRef:i,contentOrigin:s,onFileDrop:a,onAssetDrop:o,onBlockDrop:l,onCompositionDrop:c,sessionEpoch:u}){const[f,h]=x.useState(!1),p=x.useRef(null),y=x.useRef(0),m=x.useRef(null),v=x.useCallback(()=>{p.current=null,y.current&&cancelAnimationFrame(y.current),y.current=0},[]),b=x.useCallback(function _(){y.current=0;const I=p.current,j=t.current;!I||I.sessionEpoch!==u||!j||EE(j,I.clientX,I.clientY)&&(y.current=requestAnimationFrame(_))},[t,u]),w=x.useCallback((_,I)=>{p.current={clientX:_,clientY:I,sessionEpoch:u};const j=t.current,L=cS(j,_,I,y.current!==0);L==="stop"?(cancelAnimationFrame(y.current),y.current=0):L==="start"&&(y.current=requestAnimationFrame(b))},[t,u,b]),O=x.useCallback(_=>{const I=Array.from(_.dataTransfer.types),j=I.includes("Files"),L=I.includes(N6),B=I.includes(K1),$=I.includes(l_);!j&&!L&&!B&&!$||(_.preventDefault(),_.dataTransfer.dropEffect="copy",m.current=u,h(!0),w(_.clientX,_.clientY))},[u,w]),k=x.useCallback(()=>{m.current=null,v(),h(!1)},[v]),E=x.useCallback(_=>{const I=_.relatedTarget;I instanceof Node&&_.currentTarget.contains(I)||k()},[k]),T=x.useCallback((_,I,j=!1)=>{const L=t.current,B=L==null?void 0:L.getBoundingClientRect(),$=B3e({rectLeft:(B==null?void 0:B.left)??0,rectTop:(B==null?void 0:B.top)??0,scrollLeft:(L==null?void 0:L.scrollLeft)??0,scrollTop:(L==null?void 0:L.scrollTop)??0,contentOrigin:s,pixelsPerSecond:e.current,duration:n.current,clampStartToDuration:!j,rowHeights:i.current.rowHeights,trackOrder:r.current},_,I);return{start:j5e(j,$.start),track:$.track}},[t,e,n,r,i,s]),N=x.useCallback(_=>{_.preventDefault();const I=m.current===u;if(k(),!I)return;const j=_5e(_.dataTransfer.getData(l_));if(j&&c){const B=T(_.clientX,_.clientY,!0);Xj(()=>c(j.sourcePath,B));return}const L=T(_.clientX,_.clientY);L5e(_.dataTransfer,a,L)||KG(_.dataTransfer,N6,"path",o,L)||KG(_.dataTransfer,K1,"name",l,L)},[k,o,l,c,a,T,u]);return x.useEffect(()=>(window.addEventListener("dragend",k),()=>{window.removeEventListener("dragend",k),k()}),[k]),x.useEffect(()=>k(),[k,u]),{isDragOver:f,handleAssetDragOver:O,handleAssetDragLeave:E,handleAssetDrop:N,clearDropPreview:k}}function $5e({isDragOver:t,onFileDrop:e,onDragOver:n,onDragLeave:r,onDrop:i}){return d.jsxs("div",{className:`h-full border-t bg-[#0a0a0b] flex flex-col select-none transition-colors duration-150 ${t?"border-studio-accent/50 bg-studio-accent/[0.03]":"border-neutral-800/50"}`,onDragOver:n,onDragLeave:r,onDrop:i,children:[d.jsx("div",{className:"flex-shrink-0 border-b border-neutral-800/40 flex items-end relative",style:{height:Ra,paddingLeft:W2},children:[0,10,20,30,40,50].map(s=>d.jsxs("div",{className:"flex flex-col items-center",style:{position:"absolute",left:W2+s*14},children:[d.jsx("span",{className:"text-[9px] text-neutral-600 font-mono tabular-nums leading-none mb-0.5",children:`${Math.floor(s/60).toString().padStart(2,"0")}:${(s%60).toString().padStart(2,"0")}`}),d.jsx("div",{className:"w-px h-[5px] bg-neutral-700/40"})]},s))}),d.jsx("div",{className:"flex-1 flex items-center justify-center",children:d.jsx("div",{className:`flex items-center gap-3 px-6 py-3 border border-dashed rounded-lg transition-colors duration-150 ${t?"border-studio-accent/60 bg-studio-accent/[0.06]":"border-neutral-700/50"}`,children:t?d.jsxs(d.Fragment,{children:[d.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",className:"text-studio-accent flex-shrink-0",children:[d.jsx("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}),d.jsx("polyline",{points:"7 10 12 15 17 10"}),d.jsx("line",{x1:"12",y1:"15",x2:"12",y2:"3"})]}),d.jsx("span",{className:"text-[13px] text-studio-accent",children:"Drop media files to import"})]}):d.jsxs(d.Fragment,{children:[d.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",className:"text-neutral-600 flex-shrink-0",children:[d.jsx("rect",{x:"2",y:"2",width:"20",height:"20",rx:"2"}),d.jsx("path",{d:"M7 2v20"}),d.jsx("path",{d:"M17 2v20"}),d.jsx("path",{d:"M2 7h20"}),d.jsx("path",{d:"M2 17h20"})]}),d.jsx("span",{className:"text-[13px] text-neutral-500",children:e?"Drop media here or describe your video to start":"Describe your video to start creating"})]})})})]})}function Jae(t,e,n){const r=[.02,.05,.1,.2,.5,1,2,5,10,15,30,60,120,300,600,900,1800,3600];let i;if(Number.isFinite(e)&&(e??0)>0)i=r.find(a=>a*(e??0)>=88)??3600;else{const s=[.25,.5,1,2,5,10,15,30,60],a=t/6;i=s.find(o=>o>=a)??60}if(Number.isFinite(n)&&(n??0)>0){const s=n??0;return Math.max(1,Math.ceil(i*s-1e-6))/s}return i}function B5e(t,e,n){const r=Number.isFinite(e)?e??0:0;if(r<=0)return 4;const i=Number.isFinite(n)?n??0:0,s=i>0?Math.round(t*i):0,a=i>0?[4,5,3,2]:[4,2];for(const o of a)if(!(i>0&&s%o!==0)&&t/o*r>=8)return o;return 0}function eoe(t){return Math.round(t*1e6)/1e6}function V5e(t){return t>0&&Number.isFinite(t)&&t<=14400}function H5e(t,e){return{start:Math.max(0,(e==null?void 0:e.start)??0),end:Math.min(t,(e==null?void 0:e.end)??t)}}function Q5e(t,e,n,r,i,s,a){for(let o=1;o=i.start-.001&&l<=i.end+.001&&t.push(eoe(l))}}function z5e(t,e,n,r){if(!V5e(t))return{major:[],minor:[]};const i=Jae(t,e,n),s=B5e(i,e,n),a=s>0?i/s:0,o=[],l=[],c=2e3,u=H5e(t,r),f=Math.max(0,Math.floor(u.start/i));for(let h=f;o.lengthu.end+.001)break;p>=u.start-.001&&o.push(eoe(p)),Q5e(l,p,a,s,u,c,o.length)}return{major:o,minor:l}}function Z5e(t,e,n){if(!Number.isFinite(t))return"00:00";const r=Math.max(0,t);if(n<.1){const i=Math.round(r*100),s=Math.floor(i/100),a=i%100;return`${os(s)}.${a.toString().padStart(2,"0")}`}if(n<1){const i=Math.round(r*10),s=Math.floor(i/10),a=i%10;return`${os(s)}.${a}`}if(e>=3600||r>=3600){const i=Math.floor(r),s=Math.floor(i/3600),a=Math.floor(i%3600/60),o=i%60;return`${s}:${a.toString().padStart(2,"0")}:${o.toString().padStart(2,"0")}`}return os(r)}const G5e=x.memo(function({major:e,minor:n,pps:r,trackContentWidth:i,totalH:s,effectiveDuration:a,majorTickInterval:o,theme:l,beatAnalysis:c,contentOrigin:u,renderTimeRange:f}){const h=ue(w=>w.timeDisplayMode),p=(c==null?void 0:c.beatTimes)??[],y=(c==null?void 0:c.beatStrengths)??[],m=$j(p,y,f),v=p.length>1?(p[p.length-1]-p[0])/(p.length-1):null,b=v!==null&&v*r>=5;return d.jsxs(d.Fragment,{children:[d.jsx("svg",{className:"absolute pointer-events-none",style:{left:u,width:i,zIndex:0},height:s,children:b&&m.map(({time:w,index:O,strength:k})=>{const E=w*r,N=.08+Math.pow(Math.min(1,k??.5),2.2)*.62;return d.jsx("line",{"data-timeline-grid-cell":"beat",x1:E,y1:0,x2:E,y2:s,stroke:`rgba(34, 197, 94, ${N.toFixed(3)})`,strokeWidth:"1"},`b-${w}-${O}`)})}),d.jsxs("div",{className:"sticky top-0 flex",style:{height:Ra,width:u+i,zIndex:70},children:[d.jsx("div",{className:"sticky left-0 z-[12] flex-shrink-0",style:{width:u,background:l.shellBackground}}),d.jsxs("div",{className:"relative overflow-hidden",style:{height:Ra,width:i,background:l.shellBackground},children:[n.map(w=>d.jsx("div",{"data-timeline-grid-cell":"minor",className:"absolute bottom-0",style:{left:w*r-.5},children:d.jsx("div",{className:"w-px h-2",style:{background:l.tickMinor}})},`m-${w}`)),e.map(w=>d.jsxs("div",{"data-timeline-grid-cell":"major",className:"absolute top-0",style:{left:w*r-.5},children:[d.jsx("span",{className:"absolute font-mono tabular-nums leading-none whitespace-nowrap",style:{color:l.tickText,left:5,top:5,fontSize:10},children:h==="frame"?Zv(w):Z5e(w,a,o)}),d.jsx("div",{className:"w-px",style:{height:Ra,background:l.tickMajor}})]},`M-${w}`))]})]})]})});function U5e({color:t="var(--hf-accent, #3CE6AC)",glowColor:e="rgba(60,230,172,0.14)",scrubbing:n=!1,stickyHead:r=!0}){const i=M6,s=9,a=1+s;return d.jsxs(d.Fragment,{children:[d.jsx("div",{"aria-hidden":"true",className:"absolute top-0 bottom-0",style:{left:"50%",width:13,transform:"translateX(-50%)",background:`radial-gradient(closest-side, ${e}, transparent)`}}),d.jsx("div",{className:"absolute bottom-0",style:{left:"50%",top:a,width:1,marginLeft:-.5,background:t,boxShadow:`0 0 6px ${e}`}}),d.jsx("div",{className:r?"sticky":"absolute",style:{left:0,top:r?0:1,height:r?0:void 0},children:d.jsx("div",{style:{width:i,height:s,borderRadius:2,marginTop:1,background:n?t:"transparent",border:`1.5px solid ${t}`,boxSizing:"border-box",boxShadow:`0 1px 3px rgba(0,0,0,0.55), 0 0 5px ${e}`,transform:"rotate(45deg)"}})})]})}const Wj=Rc("TimelineEditContext",null);function X5e(){const t=x.useContext(Wj);if(!t)throw new Error("useTimelineEditContext must be used within TimelineEditProvider");return t}function fS(){return x.useContext(Wj)??{}}function W5e({value:t,children:e}){const n=x.useMemo(()=>t,[t.onMoveElement,t.onMoveElements,t.onResizeElement,t.onToggleTrackHidden,t.onSetAudioGroupAttributeLive,t.onSetAudioGroupAttributeQuiet,t.onGroupClips,t.onSetElementAttributeLive,t.onSetElementAttributeQuiet,t.onBlockedEditAttempt,t.onSplitElement,t.onRazorSplit,t.onRazorSplitAll,t.onDeleteKeyframe,t.onDeleteAllKeyframes,t.onMoveKeyframeToPlayhead,t.onMoveKeyframe,t.onToggleKeyframeAtPlayhead,t.onTogglePropertyGroupKeyframe]);return d.jsx(Wj.Provider,{value:n,children:e})}const q2=14,GP=24;let Uo=null,cu=0,Qb=null,P1=null;const c_=new Set;function qj(t){Uo=t;for(const e of c_)e()}function q5e(t){return c_.add(t),()=>c_.delete(t)}function JG(){return Uo}function Y5e(t){var e,n;cu!==0&&(cancelAnimationFrame(cu),cu=0),Qb==null||Qb(),Qb=null,P1==null||P1.disconnect(),P1=null,window.removeEventListener("pointermove",roe),window.removeEventListener("pointerup",ioe),window.removeEventListener("pointercancel",D6),window.removeEventListener("lostpointercapture",D6),window.removeEventListener("keydown",soe),window.removeEventListener("blur",Y2);try{(n=(e=t.scroll).hasPointerCapture)!=null&&n.call(e,t.pointerId)&&t.scroll.releasePointerCapture(t.pointerId)}catch{}ue.getState().setBeatDragging(!1)}function Yj(t){const e=Uo;return!e||t!==void 0&&e.pointerId!==t?null:(qj(null),Y5e(e),e)}function Y2(){Yj()}function toe(t){return Math.max(0,t.originalTime+t.dx/t.pixelsPerSecond)}function Kj(t,e){const n=y0(e.elements).musicElement;if(!t.scroll.isConnected||e.timelineSessionEpoch!==t.sessionEpoch||e.timelineProjectId!==t.projectId||n!==t.musicElement||(n.key??n.id)!==t.musicKey||n.src!==t.musicSrc)return!1;const r=mae(e.beatAnalysis,n,e.beatEdits);return(r==null?void 0:r.beatTimes.some(i=>Math.abs(i-t.originalTime)<.001))===!0}function Jj(t,e){const n=Uo;if(!n)return null;const r=t-n.startX,i={...n,clientX:t,clientY:e,dx:r+n.scroll.scrollLeft-n.startScrollLeft,started:n.started||Math.abs(r)>2};return qj(i),ue.getState().requestSeek(toe(i)),i}function noe(){cu=0;const t=Uo;t!=null&&t.started&&EE(t.scroll,t.clientX,t.clientY)&&(Jj(t.clientX,t.clientY),cu=requestAnimationFrame(noe))}function K5e(t){const e=cS(t.scroll,t.clientX,t.clientY,cu!==0);e==="start"&&t.started?cu=requestAnimationFrame(noe):e==="stop"&&cu!==0&&(cancelAnimationFrame(cu),cu=0)}function roe(t){if(t.pointerId!==(Uo==null?void 0:Uo.pointerId))return;t.preventDefault();const e=Jj(t.clientX,t.clientY);e&&K5e(e)}function ioe(t){if(t.pointerId!==(Uo==null?void 0:Uo.pointerId))return;const e=Jj(t.clientX,t.clientY),n=Yj(t.pointerId);if(!n||!(e!=null&&e.started))return;const r=ue.getState();if(!Kj(n,r))return;const i=toe(e);_ke(n.originalTime,i),r.requestSeek(i)}function D6(t){Yj(t.pointerId)}function soe(t){t.key!=="Escape"||!Uo||(t.preventDefault(),Y2())}function J5e(t,e){return t.button!==0||!(e>0)?null:t.currentTarget.closest("[data-timeline-scroll-viewport]")}function eTe(t,e,n,r){const i=ue.getState(),s=y0(i.elements).musicElement;if(!(s!=null&&s.src))return null;const a={pointerId:t.pointerId,startX:t.clientX,clientX:t.clientX,clientY:t.clientY,originalTime:e,pixelsPerSecond:n,startScrollLeft:r.scrollLeft,dx:0,started:!1,sessionEpoch:i.timelineSessionEpoch,projectId:i.timelineProjectId,musicElement:s,musicKey:s.key??s.id,musicSrc:s.src,scroll:r};return Kj(a,i)?a:null}function tTe(t){var r,i;qj(t),window.addEventListener("pointermove",roe),window.addEventListener("pointerup",ioe),window.addEventListener("pointercancel",D6),window.addEventListener("lostpointercapture",D6),window.addEventListener("keydown",soe),window.addEventListener("blur",Y2),Qb=ue.subscribe((s,a)=>{s.timelineSessionEpoch===a.timelineSessionEpoch&&s.timelineProjectId===a.timelineProjectId&&s.elements===a.elements&&s.beatAnalysis===a.beatAnalysis&&s.beatEdits===a.beatEdits||Kj(t,s)||Y2()});const e=t.scroll.parentNode;e&&(P1=new MutationObserver(()=>{t.scroll.isConnected||Y2()}),P1.observe(e,{childList:!0}));try{(i=(r=t.scroll).setPointerCapture)==null||i.call(r,t.pointerId)}catch{}const n=ue.getState();n.setBeatDragging(!0),n.requestSeek(Math.max(0,t.originalTime))}function nTe(t,e,n){if(Uo)return;const r=J5e(t,n);if(!r)return;const i=eTe(t,e,n,r);i&&tTe(i)}function aoe(t,e){return t.length<2?!0:(t[t.length-1]-t[0])/(t.length-1)*e<5}const rTe=x.memo(function({beatTimes:e,beatStrengths:n,pps:r,highlightTime:i,renderTimeRange:s}){const a=e&&!aoe(e,r)?e:null,o=i!=null&&(a==null?void 0:a.some(c=>Math.abs(c-i)<.001))===!0;if(!a&&i==null)return null;const l=$j(a??void 0,n,s);return d.jsxs("div",{className:"absolute inset-0 pointer-events-none",style:{zIndex:0},children:[l.map(({time:c,index:u,strength:f})=>{const h=i!=null&&Math.abs(c-i)<.001,p=Math.pow(Math.min(1,f??.5),2.2),y=h?1:.06+p*.16;return d.jsx("div",{className:"absolute top-0 bottom-0",style:{left:c*r,width:h?2:1,background:`rgba(34,197,94,${y.toFixed(3)})`,boxShadow:h?"0 0 6px rgba(34,197,94,0.9)":void 0,zIndex:h?1:void 0}},`${c}-${u}`)}),i!=null&&!o&&d.jsx("div",{className:"absolute top-0 bottom-0",style:{left:i*r,width:2,background:"rgba(34,197,94,1)",boxShadow:"0 0 6px rgba(34,197,94,0.9)",zIndex:1}})]})}),iTe=x.memo(function({beatTimes:e,beatStrengths:n,pps:r,renderTimeRange:i}){const s=x.useSyncExternalStore(q5e,JG,JG),a=ue(h=>h.timelineSessionEpoch),o=ue(h=>h.timelineProjectId);if(!e||aoe(e,r))return null;const l=s?e.findIndex(h=>Math.abs(h-s.originalTime)<.001):-1,c=s&&s.sessionEpoch===a&&s.projectId===o&&l>=0?s:null,u=q2/2,f=$j(e,n,i,c?new Set([l]):void 0);return d.jsx("div",{className:"absolute left-0 right-0 pointer-events-none",style:{top:ha,height:q2,background:"rgba(0,0,0,0.28)",zIndex:11},children:f.map(({time:h,index:p,strength:y})=>{const m=Math.pow(Math.min(1,y??.5),2.2),v=1.5+m*2.5,b=.25+m*.75,w=c&&l===p?c.dx:0,O=h*r+w;return d.jsx("div",{className:"absolute select-none",title:"Drag to move · ⌥-click to delete",draggable:!1,style:{left:O-GP/2,top:0,width:GP,height:q2,cursor:"ew-resize",pointerEvents:"auto",touchAction:"none"},onPointerDown:k=>{k.preventDefault(),k.stopPropagation(),!k.altKey&&nTe(k,h,r)},onClick:k=>{k.altKey&&(k.stopPropagation(),Ike(h),ue.getState().requestSeek(Math.max(0,h)))},children:d.jsx("div",{className:"absolute",style:{left:GP/2-v,top:u-v,width:v*2,height:v*2,borderRadius:"50%",background:`rgba(34,197,94,${b.toFixed(3)})`,pointerEvents:"none"}})},`${h}-${p}`)})})});function Cf(t,e){return e.propertyGroup?JSON.stringify([t,e.propertyGroup,e.animationId??"",e.percentage,e.tweenPercentage??e.percentage]):`${t}:${e.percentage}`}function sTe(t,e){if(e.startsWith("[")){let i;try{i=JSON.parse(e)}catch{return null}if(!Array.isArray(i)||i.length!==5)return null;const[s,a,o,l,c]=i;return s!==t||typeof a!="string"||a.length===0||typeof o!="string"||typeof l!="number"||!Number.isFinite(l)||typeof c!="number"||!Number.isFinite(c)?null:{propertyGroup:a,animationId:o||void 0,percentage:l,tweenPercentage:c}}const n=e.lastIndexOf(":");if(n<0||e.slice(0,n)!==t)return null;const r=Number(e.slice(n+1));return Number.isFinite(r)?{percentage:r}:null}function Q0(t,...e){return JSON.stringify(["timeline",t,...e])}function aTe(t){return Q0("track",t)}function oTe(t){return Q0("group",t)}function K2(t,e){return Q0("property",t,e)}function I6(t,e,n){return`${t}-${Q0("cell",e,n)}`}function hS(t){return Q0("clip",t)}function ooe(t,e){return Q0("keyframe",Cf(t,e))}function loe(t,e){return Q0("ease",Cf(t,e))}const coe=x.memo(function({el:e,pps:n,clipY:r,clipHeight:i,isSelected:s,isHovered:a,isDragging:o=!1,isGestureActor:l=!1,isActive:c=!1,hasCustomContent:u,capabilities:f,theme:h=Fj,isComposition:p,tabIndex:y=-1,onHoverStart:m,onHoverEnd:v,onPointerDown:b,onResizeStart:w,onClick:O,onDoubleClick:k,onContextMenu:E,children:T}){const N=e.start*n,_=Math.max(e.duration*n,4),I=l3e({isHovered:a,isSelected:s,isDragging:o}),j=e.label||e.id||e.tag,L=I>.01&&(_>=32||s),B=_>=40||s,$=!u&&(_>=40||s),z=e.start.toFixed(1),Y=(e.start+e.duration).toFixed(1),W=["timeline-clip","absolute",u?"overflow-visible":"overflow-hidden",s?"is-selected":"",a?"is-hovered":"",o?"is-dragging":"",$?"":"is-micro",Jo(e)?"is-audio":""].filter(ne=>ne.length>0).join(" "),J={left:N,width:_,top:r,...i===void 0?{bottom:r}:{height:i},borderRadius:h.clipRadius,zIndex:o?20:s?10:a?5:1,cursor:"default",appearance:"none",color:"inherit",font:"inherit",padding:0,textAlign:"left",transform:o?"translateY(-1px)":void 0};return d.jsxs("button",{type:"button","data-clip":l?void 0:"true","data-el-id":l?void 0:e.key??e.id,"data-timeline-focus-id":l?void 0:hS(e.key??e.id),"data-clip-start":e.start,"data-clip-end":e.start+e.duration,"data-clip-hidden":e.hidden?"true":void 0,"data-active":c?"":void 0,"aria-hidden":l?"true":void 0,tabIndex:l?void 0:y,"aria-label":`${j}, ${z} to ${Y} seconds`,"aria-pressed":l?void 0:s,className:W,style:J,title:p?`${e.compositionSrc} • Double-click to open`:`${j} • ${e.start.toFixed(1)}s – ${(e.start+e.duration).toFixed(1)}s`,onPointerEnter:m,onPointerLeave:v,onPointerDown:b,onClick:O,onDoubleClick:k,onContextMenu:E,children:[L&&f.canTrimStart&&d.jsx("div",{"aria-hidden":"true",onPointerDown:ne=>w==null?void 0:w("start",ne),style:{position:"absolute",left:0,top:0,bottom:0,width:14,cursor:"col-resize",zIndex:4},children:d.jsx("div",{className:"timeline-clip__handle-bar",style:{position:"absolute",left:4,top:6,bottom:6,width:2,borderRadius:1,background:"rgba(255, 255, 255, 0.55)",opacity:I*.6}})}),L&&f.canTrimEnd&&d.jsx("div",{"aria-hidden":"true",onPointerDown:ne=>w==null?void 0:w("end",ne),style:{position:"absolute",right:0,top:0,bottom:0,width:14,cursor:"col-resize",zIndex:4},children:d.jsx("div",{className:"timeline-clip__handle-bar",style:{position:"absolute",right:4,top:6,bottom:6,width:2,borderRadius:1,background:"rgba(255, 255, 255, 0.55)",opacity:I*.6}})}),B&&d.jsx("span",{className:"timeline-clip__label",children:j}),$&&d.jsxs("span",{className:"timeline-clip__timecode",children:[z,"-",Y,"s"]}),T]})}),eL=4,lTe=.1,eU=.5,cTe=(t,e,n)=>Math.max(e,Math.min(n,t));function uoe(t,e,n){const r=n>0?(e[n-1]??0)+eU:0,i=ni?(r+i)/2:cTe(t,r,i)}function uTe(t){const e=t.pointerUpX-t.pointerDownX;if(Math.abs(e)=1)return 1;const n=foe(e),r=12-n*6,i=Math.PI*2*(1+n*1.5),s=1-Math.exp(-r)*Math.cos(i);return(1-Math.exp(-r*t)*Math.cos(i*t))/s}const dTe=/^\s*wiggle\(\s*(\d+)\s*,\s*(easeOut|easeInOut|anticipate|uniform)\s*(?:,\s*([+-]?(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+)?)\s*)?\)\s*$/,pTe=Math.PI*2;function nL(t){const e=dTe.exec(t);if(!e)return null;const n=Number(e[1]);if(!Number.isSafeInteger(n)||n<1)return null;const r=e[2];if(r!=="easeOut"&&r!=="easeInOut"&&r!=="anticipate"&&r!=="uniform")return null;if(e[3]===void 0)return{wiggles:n,type:r};const i=Number(e[3]);return!Number.isFinite(i)||i<0||i>1?null:{wiggles:n,type:r,amplitude:i}}function doe(t,e,n,r){if(!Number.isFinite(t))return t;if(t<=0)return 0;if(t>=1)return 1;const i=r??(n==="easeInOut"?.08:n==="uniform"?.14:n==="anticipate"?.12:.16),s=n==="easeInOut"?i*Math.sin(Math.PI*t):n==="uniform"?i:i*(1-t);return t+(n==="anticipate"?-1:1)*s*Math.sin(pTe*e*t)}const poe=[{id:"linear",label:"Linear",ease:"none",kind:"curve"},{id:"ease-in",label:"Ease In",ease:"power1.in",kind:"curve"},{id:"quad-in",label:"Quad In",ease:"power2.in",kind:"curve"},{id:"cubic-in",label:"Cubic In",ease:"power3.in",kind:"curve"},{id:"ease-out",label:"Ease Out",ease:"power1.out",kind:"curve"},{id:"quad-out",label:"Quad Out",ease:"power2.out",kind:"curve"},{id:"cubic-out",label:"Cubic Out",ease:"power3.out",kind:"curve"},{id:"ease",label:"Ease In & Out",ease:"power1.inOut",kind:"curve"},{id:"quad-ease",label:"Quad Ease",ease:"power2.inOut",kind:"curve"},{id:"cubic-ease",label:"Cubic Ease",ease:"power3.inOut",kind:"curve"},{id:"circular-ease",label:"Circular Ease",ease:"circ.inOut",kind:"curve"},{id:"rebound-in",label:"Ease In Back",ease:"back.in",kind:"curve"},{id:"rebound-out",label:"Ease Out Back",ease:"back.out",kind:"curve"},{id:"flow-1",label:"Flow 1",ease:"wiggle(1,easeInOut,0.20)",kind:"wiggle"},{id:"flow-2",label:"Flow 2",ease:"wiggle(2,easeInOut,0.15)",kind:"wiggle"},{id:"flow-3",label:"Flow 3",ease:"wiggle(3,easeInOut,0.12)",kind:"wiggle"},{id:"flow-4",label:"Flow 4",ease:"wiggle(4,easeInOut,0.10)",kind:"wiggle"},{id:"flow-5",label:"Flow 5",ease:"wiggle(5,easeInOut,0.08)",kind:"wiggle"},{id:"flow-6",label:"Flow 6",ease:"wiggle(6,easeInOut,0.07)",kind:"wiggle"},{id:"flow-7",label:"Flow 7",ease:"wiggle(7,easeInOut,0.06)",kind:"wiggle"},{id:"bounce-1",label:"Bounce 1",ease:"wiggle(4,easeOut,0.22)",kind:"wiggle"},{id:"bounce-2",label:"Bounce 2",ease:"wiggle(6,easeOut,0.26)",kind:"wiggle"},{id:"bounce-3",label:"Bounce 3",ease:"wiggle(9,uniform,0.32)",kind:"wiggle"},{id:"bounce-4",label:"Bounce 4",ease:"wiggle(5,anticipate,0.28)",kind:"wiggle"},{id:"hold",label:"Hold",ease:"hold",kind:"curve"},{id:"rebound-ease",label:"Ease In & Out Back",ease:"back.inOut",kind:"curve"},{id:"expo-in",label:"Expo In",ease:"expo.in",kind:"curve"},{id:"expo-out",label:"Expo Out",ease:"expo.out",kind:"curve"},{id:"spring-gentle",label:"Gentle",ease:"spring(0.15)",kind:"spring"},{id:"spring-quick",label:"Quick",ease:"spring(0.4)",kind:"spring"},{id:"spring-bouncy",label:"Bouncy",ease:"spring(0.6)",kind:"spring"},{id:"spring-slow",label:"Slow",ease:"spring(0.25)",kind:"spring"}];function mTe(t){var e;return((e=poe.find(n=>n.ease===t))==null?void 0:e.label)??null}const u_=".hyperframes/studio-motion.json",UP="studio-motion",moe="data-hf-studio-motion",zb={x1:.215,y1:.61,x2:.355,y2:1},gTe={none:{x1:0,y1:0,x2:1,y2:1},"power1.in":{x1:.55,y1:.085,x2:.68,y2:.53},"power1.out":{x1:.25,y1:.46,x2:.45,y2:.94},"power1.inOut":{x1:.455,y1:.03,x2:.515,y2:.955},"power2.in":{x1:.55,y1:.055,x2:.675,y2:.19},"power2.out":{x1:.215,y1:.61,x2:.355,y2:1},"power2.inOut":{x1:.645,y1:.045,x2:.355,y2:1},"power3.in":{x1:.895,y1:.03,x2:.685,y2:.22},"power3.out":{x1:.165,y1:.84,x2:.44,y2:1},"power3.inOut":{x1:.77,y1:0,x2:.175,y2:1},"power4.in":{x1:.755,y1:.05,x2:.855,y2:.06},"power4.out":{x1:.23,y1:1,x2:.32,y2:1},"power4.inOut":{x1:.86,y1:0,x2:.07,y2:1},"sine.in":{x1:.47,y1:0,x2:.745,y2:.715},"sine.out":{x1:.39,y1:.575,x2:.565,y2:1},"sine.inOut":{x1:.445,y1:.05,x2:.55,y2:.95},"expo.in":{x1:.95,y1:.05,x2:.795,y2:.035},"expo.out":{x1:.19,y1:1,x2:.22,y2:1},"expo.inOut":{x1:1,y1:0,x2:0,y2:1},"circ.in":{x1:.6,y1:.04,x2:.98,y2:.335},"circ.out":{x1:.075,y1:.82,x2:.165,y2:1},"circ.inOut":{x1:.785,y1:.135,x2:.15,y2:.86},"back.in(1.7)":{x1:.6,y1:-.28,x2:.735,y2:.045},"back.out(1.7)":{x1:.175,y1:.885,x2:.32,y2:1.275},"back.inOut(1.7)":{x1:.68,y1:-.55,x2:.265,y2:1.55},"elastic.out(1, 0.45)":{x1:.16,y1:1.32,x2:.28,y2:.86},"bounce.out":{x1:.34,y1:1.56,x2:.64,y2:.74}},yTe=/^M\s*0\s*,\s*0\s*C\s*(-?\d+(?:\.\d+)?)\s*,\s*(-?\d+(?:\.\d+)?)\s+(-?\d+(?:\.\d+)?)\s*,\s*(-?\d+(?:\.\d+)?)\s+1\s*,\s*1\s*$/i;function BO(t){return Xt(t)}function VO(t,e,n,r){return Number.isFinite(t)?Math.min(n,Math.max(e,t)):r}function f_(t){return typeof t=="number"&&Number.isFinite(t)?t:null}function xTe(t){return{x1:BO(VO(t.x1??zb.x1,0,1,.215)),y1:BO(VO(t.y1??zb.y1,-.6,1.6,.61)),x2:BO(VO(t.x2??zb.x2,0,1,.355)),y2:BO(VO(t.y2??zb.y2,-.6,1.6,1))}}function bTe(t){if(!t)return null;const e=t.trim().match(yTe);if(!e)return null;const n={x1:Number.parseFloat(e[1]??""),y1:Number.parseFloat(e[2]??""),x2:Number.parseFloat(e[3]??""),y2:Number.parseFloat(e[4]??"")};return Object.values(n).every(Number.isFinite)?xTe(n):null}function goe(t){return gTe[t]??zb}function tU(t){if(!t||typeof t!="object")return null;const e=t,n={};for(const r of["x","y","scale","rotation","opacity","autoAlpha"]){const i=f_(e[r]);i!=null&&(n[r]=i)}return Object.keys(n).length>0?n:null}function vTe(t){if(!t||typeof t!="object")return;const e=t,n=typeof e.id=="string"?e.id.trim():"",r=typeof e.data=="string"?e.data.trim():"";if(!(!n||!r))return{id:n,data:r}}function ATe(t){const e=t.getAttribute(moe);if(!e||e==="true")return null;try{const n=JSON.parse(e);if(!n||typeof n!="object")return null;const r=n,i=f_(r.start),s=f_(r.duration);if(i==null||s==null||i<0||s<=0)return null;const a=typeof r.ease=="string"&&r.ease.trim()?r.ease.trim():"none",o=tU(r.from),l=tU(r.to);return!o||!l?null:{start:i,duration:s,ease:a,customEase:vTe(r.customEase),from:o,to:l}}catch{return null}}function STe(t,e){var n,r,i,s;try{const a=(r=(n=t.__player)==null?void 0:n.getTime)==null?void 0:r.call(n);if(typeof a=="number"&&Number.isFinite(a))return Math.max(0,a)}catch{}try{const a=(s=(i=t.__timeline)==null?void 0:i.time)==null?void 0:s.call(i);if(typeof a=="number"&&Number.isFinite(a))return Math.max(0,a)}catch{}return 0}function wTe(t,e){var c,u,f,h,p,y;const n=t.defaultView;if(!n)return 0;const r=n.gsap;n.__timelines=n.__timelines??{},(u=(c=n.__timelines[UP])==null?void 0:c.kill)==null||u.call(c),delete n.__timelines[UP];const i=(f=t.defaultView)==null?void 0:f.HTMLElement;if(!i)return 0;const s=[];for(const m of Array.from(t.querySelectorAll(`[${moe}]`))){if(!(m instanceof i))continue;const v=ATe(m);v&&s.push({element:m,motion:v})}if(!(r!=null&&r.timeline)||s.length===0)return 0;const a=r.timeline({paused:!0,defaults:{overwrite:"auto"}});let o=0;for(const{element:m,motion:v}of s){if(!a.fromTo)continue;const b={...v.from},w=OTe(n,v),O={...v.to,duration:v.duration,ease:w,overwrite:"auto",immediateRender:!1};a.fromTo(m,b,O,v.start),o+=1}if(o===0)return(h=a.kill)==null||h.call(a),0;n.__timelines[UP]=a,(p=a.pause)==null||p.call(a);const l=STe(n);return a.totalTime?a.totalTime(l,!1):(y=a.time)==null||y.call(a,l),o}function OTe(t,e){var i,s;const n=e.customEase;if(!n)return e.ease;const r=t.CustomEase;if(typeof(r==null?void 0:r.create)!="function")return e.ease;try{return(s=(i=t.gsap)==null?void 0:i.registerPlugin)==null||s.call(i,r),r.create(n.id,n.data),n.id}catch{return e.ease}}const CTe={set:"Set",to:"Animate",from:"Animate In",fromTo:"From → To"},yoe={set:"Instantly snap to these values — no transition",to:"Smoothly animate the element to these target values",from:"Element starts at these values and transitions to its normal state",fromTo:"Animate from one state to another"},gd={x:"Move X",y:"Move Y",width:"Width",height:"Height",rotation:"Rotate",z:"Move Z",rotationX:"Rotate X",rotationY:"Rotate Y",rotationZ:"Rotate Z",perspective:"Perspective",transformPerspective:"Perspective",transformOrigin:"Transform Origin",opacity:"Opacity",scale:"Scale",scaleX:"Scale X",scaleY:"Scale Y",autoAlpha:"Visibility",visibility:"Visible",scaleX_alias:"Stretch X",filter:"Filter",clipPath:"Clip Path",color:"Color",backgroundColor:"Background",borderColor:"Border Color",borderRadius:"Radius",fontSize:"Font Size",letterSpacing:"Tracking",skewX:"Skew X",skewY:"Skew Y",innerText:"Counter Value"},xoe={x:"px",y:"px",width:"px",height:"px",rotation:"°",z:"px",rotationX:"°",rotationY:"°",rotationZ:"°",perspective:"px",transformPerspective:"px",transformOrigin:"",opacity:"%",scale:"×",scaleX:"×",scaleY:"×",autoAlpha:"%",visibility:""},kTe={x:"Move left/right (negative = left, positive = right)",y:"Move up/down (negative = up, positive = down)",opacity:"How visible (0 = invisible, 1 = fully visible)",scale:"Size multiplier (1 = normal, 2 = double, 0.5 = half)",scaleX:"Horizontal stretch (1 = normal)",scaleY:"Vertical stretch (1 = normal)",rotation:"Spin angle (360 = full rotation)",z:"Move forward/back along the Z axis",rotationX:"Rotate around the horizontal X axis",rotationY:"Rotate around the vertical Y axis",rotationZ:"Rotate around the screen-facing Z axis",perspective:"3D depth context for child elements; set it on a parent when rotating children in 3D",transformPerspective:"3D depth for THIS element's own X/Y rotation — lower = stronger perspective (try 600–1000)",transformOrigin:"Pivot point for transforms, for example center center or 50% 50%",width:"Element width",height:"Element height",autoAlpha:"Like opacity but hides element completely at 0",visibility:"Show or hide the element",innerText:"End value for a number roll-up (the number it counts up/down to)"},tA={},rL={none:[0,0,1,1],"power1.out":[0,0,.58,1],"power2.out":[.16,1,.3,1],"power3.out":[.08,.82,.17,1],"power4.out":[.06,.73,.09,1],"power1.in":[.42,0,1,1],"power2.in":[.55,.06,.68,.19],"power3.in":[.6,.04,.98,.34],"power4.in":[.7,0,.84,0],"power1.inOut":[.42,0,.58,1],"power2.inOut":[.45,.05,.55,.95],"power3.inOut":[.65,.05,.35,1],"power4.inOut":[.76,0,.24,1],"back.out":[.34,1.56,.64,1],"back.in":[.36,0,.66,-.56],"back.inOut":[.68,-.55,.27,1.55],"circ.inOut":[.785,.135,.15,.86],"expo.out":[.16,1,.3,1],"expo.in":[.7,0,.84,0],"expo.inOut":[.87,0,.13,1],"bounce.out":[.34,1.56,.64,.74],"bounce.in":[.36,.26,.66,-.56],"elastic.out(1,0.3)":[.16,1.45,.28,.82],"elastic.inOut(1,0.3)":[.68,-.55,.32,1.55],"ae-ease":[.333,0,.667,1],"ae-ease-in":[.333,.333,.667,1],"ae-ease-out":[.333,0,.667,.667]};function boe(t){var r;if(t.startsWith("custom(")){const i=bTe((r=t.match(/^custom\((.+)\)$/))==null?void 0:r[1]);if(i)return[i.x1,i.y1,i.x2,i.y2]}const e=rL[t];if(e)return e;const n=goe(t);return[n.x1,n.y1,n.x2,n.y2]}const voe=new Set(["opacity","autoAlpha"]),Aoe={opacity:{min:0,max:1,step:.01},autoAlpha:{min:0,max:1,step:.01},scale:{min:-10,max:10,step:.01},scaleX:{min:-10,max:10,step:.01},scaleY:{min:-10,max:10,step:.01},rotation:{step:1},z:{step:1},rotationX:{step:1},rotationY:{step:1},rotationZ:{step:1},perspective:{min:0,step:1},transformPerspective:{min:0,step:1},skewX:{min:-90,max:90,step:1},skewY:{min:-90,max:90,step:1},width:{min:0,step:1},height:{min:0,step:1},borderRadius:{min:0,step:1},x:{step:1},y:{step:1},fontSize:{min:1,step:1},letterSpacing:{step:.1},innerText:{step:1}};function nU(t,e){const n=Aoe[t];if(!n)return e;let r=e;return n.min!==void 0&&(r=Math.max(n.min,r)),n.max!==void 0&&(r=Math.min(n.max,r)),r}const ETe=["to","from","fromTo","set"],TTe={to:"Animate",from:"Animate In",fromTo:"From → To",set:"Set Instantly"};function _6(t,e,n,r){return Array.from({length:t+1},(i,s)=>{const a=s/t;return`${s===0?"M":"L"}${e(a)},${n(r(a))}`}).join(" ")}function Soe(t,e,n,r){return`M${t},${e} L${n},${e} L${n},${r}`}function TE({ease:t,active:e,size:n=24}){const r=tL(t),i=nL(t),s=boe(t),[a,o,l,c]=s,u=n,f=n/8,h=u-f*2,p=v=>f+h*v,y=v=>u-f-h*v,m=t==="hold"?Soe(f,u-f,u-f,f):i?_6(64,p,y,v=>doe(v,i.wiggles,i.type,i.amplitude)):r!==null?_6(24,p,v=>y(v/1.2),v=>hoe(v,r)):`M${f},${u-f} C${p(a)},${y(o)} ${p(l)},${y(c)} ${u-f},${f}`;return d.jsx("svg",{width:u,height:u,viewBox:`0 0 ${u} ${u}`,children:d.jsx("path",{d:m,fill:"none",stroke:e?"#3CE6AC":"#737373",strokeWidth:"1.5",strokeLinecap:"round"})})}const PTe=["curve","spring","wiggle"],M1=rL["power2.out"],iL={curve:"Curve",spring:"Spring",wiggle:"Wiggle"},MTe={curve:`custom(M0,0 C${M1[0]},${M1[1]} ${M1[2]},${M1[3]} 1,1)`,spring:"spring(0.42)",wiggle:"wiggle(3,easeInOut,0.12)"},NTe=function({kind:e,currentEase:n,onSelect:r}){return d.jsx("div",{className:"mb-2 grid max-h-56 grid-cols-4 gap-1 overflow-y-auto pr-0.5",children:poe.filter(i=>i.kind===e).map(i=>{const s=n===i.ease;return d.jsxs("button",{type:"button","data-ease-preset-id":i.id,role:"menuitemradio","aria-checked":s,tabIndex:s?0:-1,onClick:()=>r(i.ease),className:`flex flex-col items-center gap-0.5 rounded-md p-1 transition-colors ${s?"bg-panel-accent/10 ring-1 ring-panel-accent/30":"hover:bg-neutral-800"}`,title:i.label,children:[d.jsx(TE,{ease:i.ease,active:s}),d.jsx("span",{className:`text-center text-[8px] leading-none ${s?"text-panel-accent":"text-neutral-500"}`,children:i.label})]},i.id)})})};function DTe({mode:t,onCommit:e}){return d.jsx("div",{className:"mb-2 grid grid-cols-3 rounded-md bg-black/20 p-0.5",role:"radiogroup","aria-label":"Ease editor mode",children:PTe.map(n=>{const r=n===t;return d.jsx("button",{type:"button","data-ease-mode":n,role:"radio","aria-checked":r,onClick:()=>{r||e(MTe[n])},className:`rounded px-2 py-1 text-[10px] font-medium transition-colors ${r?"bg-neutral-700 text-neutral-100":"text-neutral-500 hover:text-neutral-300"}`,children:iL[n]},n)})})}const Zb=va,XP=-1,WP=2,woe=["easeOut","easeInOut","anticipate","uniform"],ITe={easeOut:.16,easeInOut:.08,anticipate:.12,uniform:.14};function _Te(t){return woe.some(e=>e===t)}function qP(t,e,n,r){const i=`wiggle(${e},${n},${va(r)})`;nL(i)&&t(i)}function RTe({tuple:t,onCommit:e}){const n=t.join(", "),r=x.useRef(null),i=x.useId(),[s,a]=x.useState(null);x.useEffect(()=>{r.current&&(r.current.value=n),a(null)},[n]);const o=l=>{const c=l.trim().split(/[\s,]+/),u=c.map(Number);if(c.length!==4||u.some(v=>!Number.isFinite(v))){a("Enter four finite numbers");return}const[f,h,p,y]=u;if(hWP||yWP){a(`Y values must be between ${XP} and ${WP}`);return}const m=v=>Math.max(0,Math.min(1,v));a(null),e(`custom(M0,0 C${Zb(m(f))},${Zb(h)} ${Zb(m(p))},${Zb(y)} 1,1)`)};return d.jsxs("div",{className:"mt-1.5 px-0.5",children:[d.jsxs("div",{className:"flex items-center gap-1.5",children:[d.jsx(TE,{ease:`custom(M0,0 C${t[0]},${t[1]} ${t[2]},${t[3]} 1,1)`,active:!0,size:14}),d.jsx("input",{ref:r,type:"text",defaultValue:n,"aria-label":"Cubic bezier control points","aria-invalid":s!==null,"aria-describedby":s?i:void 0,onInput:()=>a(null),onKeyDown:l=>{l.key==="Enter"&&l.currentTarget.blur(),l.key==="Escape"&&(l.currentTarget.value=n,a(null))},onBlur:l=>o(l.currentTarget.value),className:`w-full rounded border bg-black/20 px-1.5 py-1 font-mono text-[10px] text-neutral-300 outline-none ${s?"border-red-500/70 focus:border-red-400":"border-white/10 focus:border-panel-accent/50"}`})]}),d.jsx("p",{id:i,"aria-live":"polite",className:`mt-1 text-[9px] text-red-400 ${s?"":"sr-only"}`,children:s??"Valid bezier values"})]})}function h_({label:t,value:e,min:n,max:r,step:i,className:s,onCommit:a}){const[o,l]=x.useState(String(e));x.useEffect(()=>l(String(e)),[e]);const c=()=>{if(o.trim()===""){l(String(e));return}const u=Number(o);if(!Number.isFinite(u)||ur){l(String(e));return}a(u)};return d.jsx("input",{type:"number","aria-label":t,min:n,max:r,step:i,value:o,onChange:u=>l(u.currentTarget.value),onBlur:c,onKeyDown:u=>{u.key==="Enter"&&u.currentTarget.blur(),u.key==="Escape"&&l(String(e))},className:s})}function jTe({springBounce:t,onCommit:e}){return d.jsxs("div",{className:"mt-1.5 flex items-center gap-2 px-0.5 text-[10px] text-neutral-400",children:[d.jsx("span",{"aria-hidden":"true",children:"Bounce"}),d.jsx(h_,{label:"Spring bounce",value:t,min:0,max:1,step:.01,onCommit:n=>{const r=tL(`spring(${n})`);r!==null&&e(`spring(${Zb(r)})`)},className:"w-16 rounded border border-white/10 bg-black/20 px-1.5 py-1 font-mono text-[10px] text-neutral-300 outline-none focus:border-panel-accent/50"})]})}function LTe({config:t,onCommit:e}){const n=t.amplitude??ITe[t.type];return d.jsxs("div",{className:"mt-1.5 flex items-center gap-2 px-0.5 text-[10px] text-neutral-400",children:[d.jsxs("div",{className:"flex items-center gap-1",children:[d.jsx("span",{"aria-hidden":"true",children:"Count"}),d.jsx(h_,{label:"Wiggle count",value:t.wiggles,min:1,step:1,onCommit:r=>qP(e,r,t.type,n),className:"w-14 rounded border border-white/10 bg-black/20 px-1.5 py-1 font-mono text-[10px] text-neutral-300 outline-none focus:border-panel-accent/50"})]}),d.jsxs("div",{className:"flex items-center gap-1",children:[d.jsx("span",{"aria-hidden":"true",children:"Type"}),d.jsx("select",{"aria-label":"Wiggle type",value:t.type,onChange:r=>{_Te(r.currentTarget.value)&&qP(e,t.wiggles,r.currentTarget.value,n)},className:"rounded border border-white/10 bg-black/20 px-1.5 py-1 text-[10px] text-neutral-300 outline-none focus:border-panel-accent/50",children:woe.map(r=>d.jsx("option",{value:r,children:r},r))})]}),d.jsxs("div",{className:"flex items-center gap-1",children:[d.jsx("span",{"aria-hidden":"true",children:"Amplitude"}),d.jsx(h_,{label:"Wiggle amplitude",value:n,min:0,max:1,step:.01,onCommit:r=>qP(e,t.wiggles,t.type,r),className:"w-16 rounded border border-white/10 bg-black/20 px-1.5 py-1 font-mono text-[10px] text-neutral-300 outline-none focus:border-panel-accent/50"})]})]})}const N1=va,kf=184,dS=52,sL=16,YP=kf+sL*2,KP=kf+dS*2,FTe=1+dS/kf,$Te=-dS/kf,BTe=2,VTe=-1,zm="#3CE6AC";function HTe({kind:t,ease:e,label:n,onSelect:r}){const[i,s]=x.useState(!1),a=x.useRef(null),o=x.useRef(null),l=x.useId();x.useEffect(()=>{if(!i)return;const u=o.current,f=(u==null?void 0:u.querySelector('[role="menuitemradio"][aria-checked="true"]'))??(u==null?void 0:u.querySelector('[role="menuitemradio"]'));f==null||f.focus();const h=y=>{var v,b;const m=y.target;m instanceof Node&&!((v=o.current)!=null&&v.contains(m))&&!((b=a.current)!=null&&b.contains(m))&&s(!1)},p=y=>{var m;y.key==="Escape"&&(y.preventDefault(),s(!1),(m=a.current)==null||m.focus())};return document.addEventListener("pointerdown",h),document.addEventListener("keydown",p),()=>{document.removeEventListener("pointerdown",h),document.removeEventListener("keydown",p)}},[i]);const c=u=>{var v;if(u.key==="Tab"){s(!1);return}const h={ArrowLeft:-1,ArrowRight:1,ArrowUp:-4,ArrowDown:4}[u.key];if(h===void 0&&u.key!=="Home"&&u.key!=="End")return;u.preventDefault();const p=Array.from(u.currentTarget.querySelectorAll('[role="menuitemradio"]'));if(p.length===0)return;const y=Math.max(0,p.indexOf(document.activeElement)),m=u.key==="Home"?0:u.key==="End"?p.length-1:(y+(h??0)+p.length)%p.length;(v=p[m])==null||v.focus()};return d.jsxs("div",{className:"relative mb-2",children:[d.jsxs("button",{ref:a,type:"button","data-ease-type-dropdown":"","aria-haspopup":"menu","aria-expanded":i,"aria-controls":i?l:void 0,onClick:()=>s(u=>!u),className:"flex w-full items-center gap-2 rounded-md border border-white/10 bg-black/20 px-2 py-1.5 text-left transition-colors hover:border-white/20",children:[d.jsx(TE,{ease:e,active:!0,size:16}),d.jsx("span",{className:"text-[11px] text-neutral-200",children:n}),d.jsx("svg",{width:"8",height:"8",viewBox:"0 0 10 10",fill:"currentColor",className:`ml-auto text-neutral-500 transition-transform ${i?"rotate-180":""}`,children:d.jsx("path",{d:"M2 3l3 4 3-4z"})})]}),i&&d.jsx("div",{ref:o,id:l,role:"menu","aria-label":`${iL[t]} ease presets`,onKeyDown:c,className:"absolute inset-x-0 top-full z-20 mt-1 rounded-md border border-white/10 bg-neutral-900 p-2 shadow-xl",children:d.jsx(NTe,{kind:t,currentEase:e,onSelect:u=>{var f;r(u),s(!1),(f=a.current)==null||f.focus()}})})]})}function QTe(t,e){return e!==null?M1:t==="hold"?null:t.startsWith("custom(")||t in rL?boe(t):null}function zTe(t,e,n){const r=mTe(t);return r!==null?r:e!==null?"Custom spring":n?"Custom wiggle":t.startsWith("custom(")?"Custom bezier":tA[t]??t}const sa=t=>sL+kf*t,aa=t=>dS+kf*(1-t),rU=t=>Math.max($Te,Math.min(FTe,t)),Ooe=t=>Math.max(VTe,Math.min(BTe,t));function ZTe(t,e,n,r){const i=n==="ArrowLeft"?-r:n==="ArrowRight"?r:0,s=n==="ArrowDown"?-r:n==="ArrowUp"?r:0;if(i===0&&s===0)return null;const a=[...t],o=e==="p1"?0:2,l=e==="p1"?1:3;return a[o]=N1(Math.max(0,Math.min(1,a[o]+i))),a[l]=N1(Ooe(a[l]+s)),a}function GTe(t,e,n,r){if(t==="hold")return Soe(sa(0),aa(0),sa(1),aa(1));if(n!==null)return _6(64,sa,aa,l=>doe(l,n.wiggles,n.type,n.amplitude));if(e!==null)return _6(64,sa,aa,l=>hoe(l,e));const[i,s,a,o]=r;return`M${sa(0)},${aa(0)} C${sa(i)},${aa(s)} ${sa(a)},${aa(o)} ${sa(1)},${aa(1)}`}function UTe({springBounce:t,wiggleConfig:e,tuple:n,onCommit:r}){return t!==null?d.jsx(jTe,{springBounce:t,onCommit:r}):e!==null?d.jsx(LTe,{config:e,onCommit:r}):d.jsx(RTe,{tuple:n,onCommit:r})}const XTe=2e3;function Coe({ease:t,onCustomEaseCommit:e,collidingAnimationTargets:n}){const[r,i]=x.useState(null),s=x.useRef([]),a=r??t,o=tL(a),l=o!==null,c=nL(a),u=c!==null,f=l?"spring":u?"wiggle":"curve",h=QTe(a,o),[p,y]=x.useState(null),[m,v]=x.useState(null),b=x.useRef(null),w=x.useRef(null);x.useEffect(()=>{y(null);const ee=s.current,re=ee.indexOf(t);if(re<0){ee.length=0,i(null);return}ee.splice(0,re+1),ee.length===0&&i(null)},[t]),x.useEffect(()=>{if(r===null)return;const ee=setTimeout(()=>{s.current.length=0,i(null)},XTe);return()=>clearTimeout(ee)},[r]);const O=ee=>{s.current.push(ee),i(ee),e(ee)},k=p??h,E=k??M1,[T,N,_,I]=E,j={x:sa(0),y:aa(0)},L={x:sa(1),y:aa(1)},B={x:sa(T),y:aa(rU(N))},$={x:sa(_),y:aa(rU(I))},z=GTe(a,o,c,E),Y=k!==null||u||a==="hold",W=h!==null&&!l&&!u,J=(ee,re)=>{re.preventDefault(),re.stopPropagation(),b.current=ee,re.target.setPointerCapture(re.pointerId),p||y([T,N,_,I])},ne=ee=>{if(!b.current||!w.current)return;ee.preventDefault();const re=w.current.getBoundingClientRect(),Q=(ee.clientX-re.left)/re.width*YP,H=(ee.clientY-re.top)/re.height*KP,se=Math.max(0,Math.min(1,(Q-sL)/kf)),fe=Ooe(1-(H-dS)/kf),be=p??[T,N,_,I],me=b.current==="p1"?[N1(se),N1(fe),be[2],be[3]]:[be[0],be[1],N1(se),N1(fe)];y(me)},le=()=>{if(!b.current||!p)return;b.current=null;const ee=`M0,0 C${p[0]},${p[1]} ${p[2]},${p[3]} 1,1`;O(`custom(${ee})`)},ie=(ee,re)=>{const Q=ZTe(E,ee,re.key,re.shiftKey?.1:.01);Q&&(re.preventDefault(),re.stopPropagation(),y(Q),O(`custom(M0,0 C${Q[0]},${Q[1]} ${Q[2]},${Q[3]} 1,1)`))},q=aa(1),F=aa(0),U=sa(0),Z=sa(1),K=zTe(a,o,u);return d.jsxs("div",{className:"rounded-lg bg-neutral-900/50 p-2",children:[d.jsx(HTe,{kind:f,ease:a,label:K,onSelect:O}),n&&n.length>1&&d.jsxs("p",{className:"mb-1 text-[9px] text-neutral-500",children:["Applies to ",n.length," animations"]}),d.jsx(DTe,{mode:f,onCommit:O}),d.jsxs("span",{className:"sr-only","aria-live":"polite",children:[iL[f]," ease editor selected"]}),Y?d.jsxs(d.Fragment,{children:[d.jsx("div",{className:"mx-auto overflow-hidden rounded-md border border-white/5 bg-black/20",style:{aspectRatio:`${YP} / ${KP}`,width:"100%",maxWidth:230},children:d.jsxs("svg",{ref:w,width:"100%",height:"100%",viewBox:`0 0 ${YP} ${KP}`,preserveAspectRatio:"none",className:"touch-none select-none",onPointerMove:ne,onPointerUp:le,onPointerCancel:le,children:[[.25,.5,.75].map(ee=>d.jsx("line",{x1:sa(ee),y1:q,x2:sa(ee),y2:F,stroke:"white",strokeOpacity:"0.05",strokeWidth:"1"},`v${ee}`)),[.25,.5,.75].map(ee=>d.jsx("line",{x1:U,y1:aa(ee),x2:Z,y2:aa(ee),stroke:"white",strokeOpacity:"0.05",strokeWidth:"1"},`h${ee}`)),d.jsx("rect",{x:U,y:q,width:kf,height:F-q,fill:"none",stroke:"white",strokeOpacity:"0.1",strokeWidth:"1"}),d.jsx("line",{x1:j.x,y1:j.y,x2:L.x,y2:L.y,stroke:"white",strokeOpacity:"0.08",strokeWidth:"1",strokeDasharray:"3 4"}),W&&d.jsxs(d.Fragment,{children:[d.jsx("line",{x1:j.x,y1:j.y,x2:B.x,y2:B.y,stroke:zm,strokeOpacity:"0.5",strokeWidth:"1.5"}),d.jsx("line",{x1:L.x,y1:L.y,x2:$.x,y2:$.y,stroke:zm,strokeOpacity:"0.5",strokeWidth:"1.5"})]}),d.jsx("path",{d:z,fill:"none",stroke:zm,strokeWidth:"2.5",strokeLinecap:"round"}),d.jsx("circle",{cx:j.x,cy:j.y,r:"3",fill:zm}),d.jsx("circle",{cx:L.x,cy:L.y,r:"3",fill:zm}),W&&[["p1",B],["p2",$]].map(([ee,re])=>d.jsxs("g",{children:[d.jsx("circle",{cx:re.x,cy:re.y,r:"14",fill:"transparent",role:"slider",tabIndex:0,"aria-label":`${ee==="p1"?"First":"Second"} bezier control point`,"aria-valuemin":0,"aria-valuemax":1,"aria-valuenow":ee==="p1"?T:_,"aria-valuetext":`x ${ee==="p1"?T:_}, y ${ee==="p1"?N:I}`,className:"cursor-grab stroke-transparent outline-none active:cursor-grabbing focus-visible:stroke-white focus-visible:stroke-[2px]",onPointerDown:Q=>J(ee,Q),onKeyDown:Q=>ie(ee,Q),onPointerEnter:()=>v(ee),onPointerLeave:()=>v(Q=>Q===ee?null:Q)}),d.jsx("circle",{cx:re.x,cy:re.y,r:m===ee||b.current===ee?7:5.5,fill:"#0a0a1a",stroke:zm,strokeWidth:"2.5",className:"pointer-events-none transition-[r]"})]},ee))]})}),d.jsx(UTe,{springBounce:o,wiggleConfig:c,tuple:E,onCommit:O})]}):d.jsxs("p",{className:"px-0.5 py-1.5 text-[10px] leading-relaxed text-neutral-500",children:[K," preset: switch to Curve, Spring, or Wiggle above to shape it by hand."]})]})}const WTe=.8;function koe(t,e,n){return`${Number((t+e*n/100).toFixed(2))}s`}function HO(t){return{percentage:t.percentage,tweenPercentage:t.tweenPercentage,propertyGroup:t.propertyGroup,animationId:t.animationId,collidingAnimationTargets:t.collidingAnimationTargets}}function qTe({markers:t,centerY:e,elementId:n,clipStart:r,clipDuration:i,rovingTargetId:s,baseColor:a,baseOpacity:o,groupAware:l,globalEase:c,keyframeTarget:u,onSelectSegment:f}){return d.jsx(d.Fragment,{children:t.map((h,p)=>{const y=t[p-1];if(!y)return null;const m=h.keyframe,v=y.centerX,b=h.centerX;if(b-v<1)return null;const w=v+y.visualSize/2,O=b-v-y.visualSize/2-h.visualSize/2,k=u(m);return d.jsxs(x.Fragment,{children:[d.jsx("div",{className:"absolute","data-keyframe-connector":l?"":void 0,style:{left:w,top:e,width:Math.max(0,O),height:2,transform:"translateY(-1px)",background:a,opacity:o,borderRadius:1}}),f&&YTe(m)&&d.jsx(KTe,{left:v,width:b-v,centerY:e,ease:m.ease??c,target:k,focusId:loe(n,k),rovingTargetId:s,afterLabel:koe(r,i,y.keyframe.percentage),roomForFullTarget:O>=24,onSelectSegment:f})]},`line-${p}-${y.keyframe.percentage}-${m.percentage}`)})})}function YTe(t){return t.animationId!==void 0}function KTe({left:t,width:e,centerY:n,ease:r,target:i,focusId:s,rovingTargetId:a,afterLabel:o,roomForFullTarget:l,onSelectSegment:c}){const u=x.useRef(null);return d.jsx("div",{className:"group absolute","data-keyframe-ease-segment":"",style:{left:t,top:n,width:e,height:18,transform:"translateY(-50%)",zIndex:3,pointerEvents:"none"},children:d.jsx("button",{type:"button","data-keyframe-ease-button":"","data-timeline-focus-id":s,tabIndex:s===a?0:-1,"aria-label":`Edit ${r} easing after ${o}`,title:`Edit ${r} easing`,className:`absolute flex items-center justify-center rounded opacity-0 transition-opacity group-hover:opacity-100 focus-visible:opacity-100 ${l?"before:absolute before:left-1/2 before:top-1/2 before:h-6 before:w-6 before:-translate-x-1/2 before:-translate-y-1/2 before:content-['']":""}`,style:{left:"50%",top:"50%",width:16,height:16,transform:"translate(-50%, -50%)",zIndex:3,pointerEvents:"auto",padding:0,border:"1px solid rgba(255, 255, 255, 0.14)",background:"#171717",cursor:"pointer"},onPointerDown:f=>{u.current=f.clientX},onClick:f=>{f.stopPropagation();const h=u.current;u.current=null,!(h!==null&&Math.abs(f.clientX-h)>=eL)&&c(i)},children:d.jsx(TE,{ease:r,active:!0,size:12})})})}const JTe=x.memo(function({state:e,onClick:n,title:r,size:i=10,isHold:s=!1}){const a=e==="active",o=e==="ghost"?.25:e==="inactive"?.6:1,l=e==="active"?"#3CE6AC":"#a3a3a3";return d.jsx("button",{type:"button",onClick:c=>{c.stopPropagation(),n()},className:"relative flex-shrink-0 p-0.5 transition-opacity hover:opacity-100 before:absolute before:-inset-1.5 before:content-['']",style:{color:l,opacity:o},title:r,"aria-label":r,"aria-pressed":e==="active",children:d.jsx("svg",{width:i,height:i,viewBox:"0 0 10 10",children:s?d.jsx("rect",{x:"2",y:"2",width:"6",height:"6",rx:"0.5",fill:a?"currentColor":"none",stroke:"currentColor",strokeWidth:"1.2"}):d.jsx("rect",{x:"5",y:"0.7",width:"6",height:"6",rx:"1",transform:"rotate(45 5 0.7)",fill:a?"currentColor":"none",stroke:"currentColor",strokeWidth:"1.2"})})})}),JP=.5;function Eoe(t,e,n){const r=n?t.filter(i=>n in i.properties):t;return{propertyKeyframes:r,prevKeyframe:r.filter(i=>i.percentagei.percentage>e+JP)??null,currentKeyframe:r.find(i=>Math.abs(i.percentage-e)<=JP)??null}}function aL(t,e){const n=t.filter(a=>typeof a.tweenPercentage=="number");if(n.length<2)return e;const r=n[0],i=n[n.length-1];if(i.percentage===r.percentage)return r.tweenPercentage;const s=(i.tweenPercentage-r.tweenPercentage)/(i.percentage-r.percentage);return r.tweenPercentage+(e-r.percentage)*s}function ePe({disabled:t}){return d.jsx("svg",{width:"6",height:"10",viewBox:"0 0 6 10",fill:"none",style:{opacity:t?.25:1},children:d.jsx("path",{d:"M5 1L1 5L5 9",stroke:"#a3a3a3",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round"})})}function tPe({disabled:t}){return d.jsx("svg",{width:"6",height:"10",viewBox:"0 0 6 10",fill:"none",style:{opacity:t?.25:1},children:d.jsx("path",{d:"M1 1L5 5L1 9",stroke:"#a3a3a3",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round"})})}const jp=x.memo(function({property:e,keyframes:n,currentPercentage:r,onSeek:i,onAddKeyframe:s,onRemoveKeyframe:a,onConvertToKeyframes:o}){const{propertyKeyframes:l,prevKeyframe:c,nextKeyframe:u,currentKeyframe:f}=Eoe(n??[],r,e);let h;!n||n.length===0?h="ghost":f?h="active":l.length>0?h="inactive":h="ghost";const p=()=>{h==="ghost"?o():h==="active"&&f?a(f.tweenPercentage??f.percentage,f.animationId):s(aL(l,r))};return d.jsxs("div",{className:"flex h-5 items-center gap-0.5",children:[d.jsx("button",{type:"button",disabled:!c,onClick:()=>c&&i(c.percentage),title:"Previous keyframe","aria-label":`Previous ${e} keyframe`,className:"relative flex h-5 w-3 items-center justify-center disabled:cursor-default before:absolute before:-inset-1.5 before:content-['']",children:d.jsx(ePe,{disabled:!c})}),d.jsx(JTe,{state:h,onClick:p,size:9,title:h==="ghost"?`Convert ${e} to keyframes`:h==="active"?`Remove ${e} keyframe`:`Add ${e} keyframe`}),d.jsx("button",{type:"button",disabled:!u,onClick:()=>u&&i(u.percentage),title:"Next keyframe","aria-label":`Next ${e} keyframe`,className:"relative flex h-5 w-3 items-center justify-center disabled:cursor-default before:absolute before:-inset-1.5 before:content-['']",children:d.jsx(tPe,{disabled:!u})})]})}),d_=new WeakMap;function oL(t){return t.closest("[data-timeline-scroll-viewport]")??t.ownerDocument}function Toe(t){const e=d_.get(t);if(e)return e;const n={actor:null,pending:new Map,preview:null,previewListeners:new Set,latest:null};return d_.set(t,n),n}function nPe(t){return Number.isFinite(t)?t:null}function rPe(t){var e;return t?((e=d_.get(oL(t)))==null?void 0:e.pending)??iU:iU}const iU=new Map;function eM(t,e){t.preview=e;for(const n of t.previewListeners)n(e)}function iPe(t,e){const n=Toe(oL(t));return n.previewListeners.add(e),e(n.preview),()=>n.previewListeners.delete(e)}function sPe(t,e){const n=t.target.animationId===void 0?t.keyframes:t.keyframes.filter(s=>s.animationId===t.target.animationId),r=n.map(s=>s.tweenPercentage).filter(s=>typeof s=="number"),i=aL(n,e);return r.length===0?i:Math.max(Math.min(...r),Math.min(Math.max(...r),i))}function aPe(t){const e=t.event.currentTarget,n=oL(e),r=n instanceof HTMLElement?n:null,i=Toe(n),s=ue.getState().timelineSessionEpoch,a=I=>{var j,L;if(I.phase==="active"){if(I.phase="cancelled",eM(i,null),I.scrollRaf&&cancelAnimationFrame(I.scrollRaf),(j=I.unsubscribeStore)==null||j.call(I),(L=I.teardownListeners)==null||L.call(I),r&&I.pointerId!==null)try{r.releasePointerCapture(I.pointerId)}catch{}i.actor===I&&(i.actor=null),I.phase="complete"}};i.actor&&a(i.actor);for(const[I,j]of i.pending)j.sessionEpoch!==s&&i.pending.delete(I);for(const[I,j]of i.pending)j.elementId===t.elementId&&t.keyframes.some(L=>t.keyframeKeyOf(L)===j.destinationKeyframeKey&&Math.abs(L.percentage-j.clipPercentage)<.2)&&i.pending.delete(I);const o=i.pending.get(t.keyframeKey),l={...t,phase:"active",pointerId:nPe(t.event.pointerId),pointerDownX:t.event.clientX,lastClientX:t.event.clientX,lastClientY:t.event.clientY,originScrollLeft:(r==null?void 0:r.scrollLeft)??0,fromClipPercentage:(o==null?void 0:o.clipPercentage)??t.target.percentage,moved:!1,sessionEpoch:s,sourceWasPresent:ue.getState().elements.some(I=>(I.key??I.id)===t.elementId),scrollRaf:0,unsubscribeStore:null,teardownListeners:null};i.actor=l;const c=I=>l.pointerId===null||I.pointerId===l.pointerId,u=()=>l.lastClientX+((r==null?void 0:r.scrollLeft)??0)-l.originScrollLeft,f=()=>{eM(i,{keyframeKey:l.keyframeKey,clipPercentage:fTe({pointerDownX:l.pointerDownX,pointerMoveX:u(),clipWidthPx:l.clipWidthPx,draggedClipPct:l.fromClipPercentage,draggedIndex:l.draggedIndex,sortedClipPcts:l.sortedClipPercentages})})},h=()=>{l.scrollRaf&&cancelAnimationFrame(l.scrollRaf),l.scrollRaf=0},p=()=>{l.scrollRaf=0,!(l.phase!=="active"||!r||!Hae(r,l.lastClientX))&&(f(),l.scrollRaf=requestAnimationFrame(p))},y=()=>{if(!r||!l.moved)return;const I=cS(r,l.lastClientX,l.lastClientY,l.scrollRaf!==0);I==="stop"?h():I==="start"&&(l.scrollRaf=requestAnimationFrame(p))},m=()=>{var I,j;h(),(I=l.unsubscribeStore)==null||I.call(l),l.unsubscribeStore=null,(j=l.teardownListeners)==null||j.call(l),l.teardownListeners=null},v=()=>{if(!(!r||l.pointerId===null))try{r.releasePointerCapture(l.pointerId)}catch{}},b=I=>l.phase!=="active"||!c(I)?!1:l.sessionEpoch!==ue.getState().timelineSessionEpoch?(a(l),!1):(l.phase="committing",l.lastClientX=I.clientX,l.lastClientY=I.clientY,m(),v(),eM(i,null),i.actor===l&&(i.actor=null),l.suppressNextClick(),!0),w=I=>{const j=sPe(l,I),L=i.pending.get(l.keyframeKey),B=L?{...l.target,percentage:L.clipPercentage,tweenPercentage:L.tweenPercentage}:l.target,$={elementId:l.elementId,clipPercentage:I,tweenPercentage:j,destinationKeyframeKey:Cf(l.elementId,{...l.target,percentage:I,tweenPercentage:j}),sessionEpoch:l.sessionEpoch};i.pending.set(l.keyframeKey,$),i.latest=$;const z=()=>{i.pending.get(l.keyframeKey)===$&&i.pending.delete(l.keyframeKey)},Y=()=>{const W=i.latest===$;z(),W&&l.onSelect(B,!1)};l.onMove(B,I).then(W=>{W||Y()},Y),l.onSelect({...l.target,percentage:I,tweenPercentage:j},!1)},O=I=>{if(!b(I))return;const j=uTe({pointerDownX:l.pointerDownX,pointerUpX:u(),clipWidthPx:l.clipWidthPx,draggedClipPct:l.fromClipPercentage,draggedIndex:l.draggedIndex,sortedClipPcts:l.sortedClipPercentages});j.kind==="move"&&j.toClipPct!==void 0?w(j.toClipPct):l.onSelect(l.target,I.shiftKey),l.phase="complete"},k=I=>{l.phase!=="active"||!c(I)||(l.lastClientX=I.clientX,l.lastClientY=I.clientY,!l.moved&&Math.abs(u()-l.pointerDownX)>=eL&&(l.moved=!0),l.moved&&f(),y())},E=I=>O(I),T=I=>{l.phase==="active"&&c(I)&&a(l)},N=I=>{l.phase==="active"&&c(I)&&a(l)},_=I=>{I.key==="Escape"&&a(l)};if(window.addEventListener("pointermove",k,!0),window.addEventListener("pointerup",E,!0),window.addEventListener("pointercancel",T,!0),window.addEventListener("keydown",_),r==null||r.addEventListener("lostpointercapture",N),l.teardownListeners=()=>{window.removeEventListener("pointermove",k,!0),window.removeEventListener("pointerup",E,!0),window.removeEventListener("pointercancel",T,!0),window.removeEventListener("keydown",_),r==null||r.removeEventListener("lostpointercapture",N)},l.unsubscribeStore=ue.subscribe(I=>{var L;const j=I.elements.some(B=>(B.key??B.id)===l.elementId);if(I.timelineSessionEpoch!==l.sessionEpoch)i.pending.clear(),i.latest=null,a(l);else if(l.sourceWasPresent&&!j){for(const[B,$]of i.pending)$.elementId===l.elementId&&i.pending.delete(B);((L=i.latest)==null?void 0:L.elementId)===l.elementId&&(i.latest=null),a(l)}}),r&&l.pointerId!==null)try{r.setPointerCapture(l.pointerId)}catch{}return{update:k,commit:E,cancel:T}}function oPe({expandedElements:t,keyframeCache:e,onSelectElement:n,onSeek:r,setSelectedElementId:i,setKfContextMenu:s,toggleSelectedKeyframe:a}){const o=x.useCallback((f,h,p)=>{ue.getState().clearSelectedKeyframes();const y=f.key??f.id;i(y),n==null||n(f),a(Cf(y,h)),(p==null?void 0:p.seek)!==!1&&(r==null||r(f.start+h.percentage/100*f.duration));const m=e.get(y),v=m==null?void 0:m.keyframes.find(b=>Math.abs(b.percentage-h.percentage)<.5);ue.getState().setActiveKeyframePct(h.tweenPercentage??(v==null?void 0:v.tweenPercentage)??null)},[e,r,n,i,a]),l=x.useCallback((f,h)=>{a(Cf(f,h))},[a]),c=x.useCallback((f,h)=>{const p=t.find(y=>(y.key??y.id)===f);p&&(o(p,h,{seek:!1}),h.animationId!==void 0&&h.tweenPercentage!==void 0&&(ue.getState().setFocusedEaseSegment({animationId:h.animationId,collidingAnimationTargets:h.collidingAnimationTargets,tweenPercentage:h.tweenPercentage,elementId:f}),tj({action:"open"})))},[t,o]),u=x.useCallback((f,h,p)=>{const y=t.find(b=>(b.key??b.id)===h);if(!y)return;i(h),n==null||n(y);const m=e.get(h),v=m==null?void 0:m.keyframes.find(b=>Math.abs(b.percentage-p.percentage)<.2);s({x:f.clientX+4,y:f.clientY+2,sessionEpoch:ue.getState().timelineSessionEpoch,element:y,elementId:h,percentage:p.percentage,tweenPercentage:p.tweenPercentage??(v==null?void 0:v.tweenPercentage),propertyGroup:p.propertyGroup,animationId:p.animationId,currentEase:(v==null?void 0:v.ease)??(m==null?void 0:m.ease)})},[t,e,n,s,i]);return{onClickKeyframe:o,onSelectSegment:c,onShiftClickKeyframe:l,onContextMenuKeyframe:u}}const lPe=12;function cPe(t){return Math.round(t*1e3)/1e3}function uPe(t,e,n){if(!Number.isFinite(e)||n<=0||t.length===0)return null;let r=0,i=t.length;for(;r>>1;t[l].percentage{const Q=E.current;if(Q)return iPe(Q,H=>{I(H===null?null:{kfKey:H.keyframeKey,clipPct:H.clipPercentage})})},[]);const j=()=>{w&&(w.current=!0,requestAnimationFrame(()=>{w.current=!1}))};if(n<20)return null;const L=Math.round(i?r*.45:Cg*WTe),B=i?q2+(r-q2)/2:r/2,$=i?L:24,z=[...e.keyframes].sort((Q,H)=>Q.percentage-H.percentage),Y=z.filter(Q=>Q.percentage<0),W=z.filter(Q=>Q.percentage>100),J=Math.max(6,Math.round(L*.55)),ne=Q=>Q.animationId===void 0?z:z.filter(H=>H.animationId===Q.animationId),le=Q=>{var H;return((H=N.get(Cf(l,HO(Q))))==null?void 0:H.clipPercentage)??Q.percentage},ie=new Map;for(const Q of z){if(ie.has(Q.animationId))continue;const H=ne(Q).map(se=>({keyframe:se,clipPct:le(se)})).sort((se,fe)=>se.clipPct-fe.clipPct);ie.set(Q.animationId,{keyframes:H.map(se=>se.keyframe),clipPcts:H.map(se=>se.clipPct)})}const q=(Q,H=Q.percentage)=>{if(H<0){const se=Y.indexOf(Q);return-(Y.length-Math.max(0,se))*J}if(H>100){const se=W.indexOf(Q);return n+(Math.max(0,se)+1)*J}return H/100*n},F=z.map((Q,H)=>{const se=q(Q);if(Q.percentage<0||Q.percentage>100)return{keyframe:Q,centerX:se,hitWidth:L,visualSize:L};const fe=z[H-1],be=z[H+1],me=fe?se-q(fe):1/0,pe=be?q(be)-se:1/0,ge=Math.max(1,Math.min(me,pe)),Pe=Math.min(L,ge);return{keyframe:Q,centerX:se,hitWidth:Math.max(lPe,Pe),visualSize:L}}),U=u&&u>0?50/Qd/u:0,Z=a&&U>0?uPe(z,o,U):null,K=a?s:"#a3a3a3",ee=a?.4:.25,re=a&&!!v;return d.jsxs("div",{ref:E,className:"absolute inset-0",style:{zIndex:5,pointerEvents:"none"},children:[d.jsx(qTe,{markers:F,centerY:B,elementId:l,clipStart:c,clipDuration:u,rovingTargetId:h,baseColor:K,baseOpacity:ee,groupAware:O,globalEase:k,keyframeTarget:HO,onSelectSegment:b}),F.map((Q,H)=>{const se=Q.keyframe,fe=HO(se),be=ooe(l,fe),me=Cf(l,fe),pe=se.percentage<0?"before":se.percentage>100?"after":null,ge=ie.get(se.animationId),Pe=(ge==null?void 0:ge.clipPcts)??[],ve=(ge==null?void 0:ge.keyframes.indexOf(se))??-1,xe=(_==null?void 0:_.kfKey)===me?_.clipPct:se.percentage,we=q(se,xe)-Q.hitWidth/2,Ce=f.has(me),Me=se===Z,Ve=Ce||Me,tt=Ce?s:"#a3a3a3",Ze=pt=>{pt.button===0&&(pt.stopPropagation(),re&&(T.current=aPe({event:pt,elementId:l,keyframeKey:me,target:fe,keyframes:e.keyframes,clipWidthPx:n,draggedIndex:ve,sortedClipPercentages:Pe,keyframeKeyOf:it=>Cf(l,HO(it)),onMove:(it,vt)=>(v==null?void 0:v(it,vt))??Promise.resolve(!1),onSelect:(it,vt)=>{vt?y==null||y(it):p==null||p(it)},suppressNextClick:j})))},qe=pt=>{var it;if(re){(it=T.current)==null||it.commit(pt),T.current=null,pt.stopPropagation();return}pt.button===0&&(j(),pt.shiftKey?y==null||y(fe):p==null||p(fe))};return d.jsx("button",{type:"button",className:"absolute","data-timeline-focus-id":be,"data-keyframe-group":O?se.propertyGroup:void 0,"data-keyframe-percentage":O?se.tweenPercentage??se.percentage:void 0,"data-keyframe-at-playhead":String(Me),"data-keyframe-selected":String(Ce),"aria-current":Me?"time":void 0,"data-keyframe-outside-clip":pe??void 0,tabIndex:be===h?0:-1,"aria-label":`${se.propertyGroup??"Motion"} keyframe at ${koe(c,u,se.percentage)}${pe?` (${pe} clip)`:""}`,"aria-pressed":Ce,style:{left:we,top:B,transform:"translateY(-50%)",width:Q.hitWidth,height:$,zIndex:Ve?2:1,pointerEvents:"auto",background:"none",border:"none",cursor:re?"ew-resize":"pointer",padding:0,touchAction:"none",display:"flex",alignItems:"center",justifyContent:"center",overflow:"visible"},onPointerDown:Ze,onPointerMove:re?pt=>{var it;return(it=T.current)==null?void 0:it.update(pt)}:void 0,onPointerUp:qe,onClick:pt=>{pt.detail===0&&(pt.stopPropagation(),j(),pt.shiftKey?y==null||y(fe):p==null||p(fe))},onPointerCancel:re?pt=>{var it;(it=T.current)==null||it.cancel(pt),T.current=null}:void 0,onContextMenu:pt=>{pt.preventDefault(),pt.stopPropagation(),m==null||m(pt,fe)},title:`${cPe(se.percentage)}%${pe?` · ${pe} clip`:""}`,children:d.jsxs("svg",{width:Q.visualSize,height:Q.visualSize,viewBox:"0 0 10 10",style:{flexShrink:0,pointerEvents:"none"},children:[(Ce||Me)&&d.jsx("path",{d:"M5 0L10 5L5 10L0 5Z",fill:"none",stroke:s,strokeWidth:"0.8",opacity:Ce?.5:1}),d.jsx("path",{d:"M5 1L9 5L5 9L1 5Z",fill:tt,opacity:Ce?1:Me?.9:.55})]})},`${se.animationId??H}:${se.propertyGroup??""}:${se.tweenPercentage??se.percentage}`)})]})}),fPe=x.memo(function(e){return d.jsx(Poe,{...e,globalEase:e.keyframesData.ease,onClickKeyframe:n=>{var r;return(r=e.onClickKeyframe)==null?void 0:r.call(e,e.elementId,n)},onShiftClickKeyframe:n=>{var r;return(r=e.onShiftClickKeyframe)==null?void 0:r.call(e,e.elementId,n)},onContextMenuKeyframe:(n,r)=>{var i;return(i=e.onContextMenuKeyframe)==null?void 0:i.call(e,n,e.elementId,r)},onMoveKeyframe:e.onMoveKeyframe?(n,r)=>{var i;return((i=e.onMoveKeyframe)==null?void 0:i.call(e,e.elementId,n,r))??Promise.resolve(!1)}:void 0,onSelectSegment:e.onSelectSegment?n=>{var r;return(r=e.onSelectSegment)==null?void 0:r.call(e,e.elementId,n)}:void 0})});function hPe({element:t,elementId:e,keyframesData:n,pixelsPerSecond:r,rowHeight:i,beatsActive:s,accentColor:a,isSelected:o,currentTime:l,selectedKeyframes:c,rovingTargetId:u,onClickKeyframe:f,onShiftClickKeyframe:h,onContextMenuKeyframe:p,onMoveKeyframe:y,onSelectSegment:m,suppressClickRef:v}){const b=Math.max(t.duration*r,4);return d.jsx("div",{className:"absolute pointer-events-none",style:{left:t.start*r,top:ha,width:b,height:i-2*ha,zIndex:o?11:6},children:d.jsx(fPe,{keyframesData:n,clipWidthPx:b,clipHeightPx:i-2*ha,beatsActive:s,accentColor:a,isSelected:o,currentPercentage:t.duration>0?(l-t.start)/t.duration*100:0,elementId:e,clipStart:t.start,clipDuration:t.duration,selectedKeyframes:c,rovingTargetId:u,onClickKeyframe:(w,O)=>f==null?void 0:f(t,O),onShiftClickKeyframe:h,onContextMenuKeyframe:p,onMoveKeyframe:y,onSelectSegment:m,suppressClickRef:v})})}const sU=["x","y","scale","scaleX","scaleY","rotation","skewX","skewY","z","rotationX","rotationY","rotationZ","perspective","transformPerspective","transformOrigin","opacity","visibility","autoAlpha","width","height","color","backgroundColor","borderColor","borderRadius","fontSize","letterSpacing","filter","clipPath","innerText"],dPe={position:new Set(["x","y","xPercent","yPercent"]),scale:new Set(["scale","scaleX","scaleY"]),size:new Set(["width","height"]),rotation:new Set(["rotation","skewX","skewY"]),visual:new Set(["opacity","autoAlpha"]),other:new Set},Moe=new Map;for(const[t,e]of Object.entries(dPe))for(const n of e)Moe.set(n,t);function rl(t){return Moe.get(t)??"other"}function aU(t){const e=new Set;for(const n of Object.keys(t)){if(n==="transformOrigin"||n==="_auto"||n==="data")continue;const r=rl(n);e.add(r)}if(e.size===1)return e.values().next().value}const pPe=["none","power1.in","power1.out","power1.inOut","power2.in","power2.out","power2.inOut","power3.in","power3.out","power3.inOut","power4.in","power4.out","power4.inOut","back.in","back.out","back.inOut","elastic.in","elastic.out","elastic.inOut","bounce.in","bounce.out","bounce.inOut","circ.inOut","expo.in","expo.out","expo.inOut","elastic.out(1,0.3)","elastic.inOut(1,0.3)","spring-gentle","spring-bouncy","spring-stiff","spring-wobbly","spring-heavy","hold","steps(1)"];function Noe(t){return!t||t.kind==="literal"?"direct":t.kind==="runtime-dynamic"?"source":"unroll"}function mPe(t){const e=new Map;for(const n of t){const r=e.get(n.percentage);if(!r){e.set(n.percentage,{...n,properties:{...n.properties}});continue}r.properties={...r.properties,...n.properties},n.ease!==void 0&&(r.ease=n.ease),n.auto!==void 0&&(r.auto=n.auto)}return[...e.values()].sort((n,r)=>n.percentage-r.percentage)}function Doe(t,e,n,r){const i=t[0];if(t.length<2||!i)return;const s=[];let a;if(r&&t.length>=4){a=[i];for(let o=1;o+2bPe(o.properties)).filter(o=>o!==null);if(e.length>=2)return e;const n=t.properties.x,r=t.properties.y;return typeof n!="number"&&typeof r!="number"?e:[{x:0,y:0},{x:typeof n=="number"?n:0,y:typeof r=="number"?r:0}]}function vPe(t){return t===!0?", autoRotate: true":typeof t=="number"?`, autoRotate: ${t}`:""}function APe(t,e,n){if(t.cp1&&t.cp2)return[`{x: ${t.cp1.x}, y: ${t.cp1.y}}`,`{x: ${t.cp2.x}, y: ${t.cp2.y}}`];const r=n.x-e.x,i=n.y-e.y,s=t.curviness??1;return[`{x: ${e.x+r*.33}, y: ${e.y+i*.33-s*Math.abs(r)*.25}}`,`{x: ${e.x+r*.66}, y: ${e.y+i*.66-s*Math.abs(r)*.25}}`]}function SPe(t,e){const n=t[0];if(!n)return[];const r=[`{x: ${n.x}, y: ${n.y}}`];for(let i=0;if.cp1&&f.cp2),a=n.some(f=>{var h;return(f.curviness??1)!==(((h=n[0])==null?void 0:h.curviness)??1)});if((s||a)&&e.length>=2)return`{ path: [${SPe(e,n).join(", ")}], type: "cubic"${i} }`;const o=e.map(f=>`{x: ${f.x}, y: ${f.y}}`),l=((u=n[0])==null?void 0:u.curviness)??1,c=l!==1?`, curviness: ${l}`:"";return`{ path: [${o.join(", ")}]${c}${i} }`}var tM={},p_=function(t,e){return p_=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,r){n.__proto__=r}||function(n,r){for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(n[i]=r[i])},p_(t,e)};function Ioe(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");p_(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}var R6=function(){return R6=Object.assign||function(e){for(var n,r=1,i=arguments.length;r=0;o--)(a=t[o])&&(s=(i<3?a(s):i>3?a(e,n,s):a(e,n))||s);return i>3&&s&&Object.defineProperty(e,n,s),s}function joe(t,e){return function(n,r){e(n,r,t)}}function Loe(t,e,n,r,i,s){function a(b){if(b!==void 0&&typeof b!="function")throw new TypeError("Function expected");return b}for(var o=r.kind,l=o==="getter"?"get":o==="setter"?"set":"value",c=!e&&t?r.static?t:t.prototype:null,u=e||(c?Object.getOwnPropertyDescriptor(c,r.name):{}),f,h=!1,p=n.length-1;p>=0;p--){var y={};for(var m in r)y[m]=m==="access"?{}:r[m];for(var m in r.access)y.access[m]=r.access[m];y.addInitializer=function(b){if(h)throw new TypeError("Cannot add initializers after decoration has completed");s.push(a(b||null))};var v=(0,n[p])(o==="accessor"?{get:u.get,set:u.set}:u[l],y);if(o==="accessor"){if(v===void 0)continue;if(v===null||typeof v!="object")throw new TypeError("Object expected");(f=a(v.get))&&(u.get=f),(f=a(v.set))&&(u.set=f),(f=a(v.init))&&i.unshift(f)}else(f=a(v))&&(o==="field"?i.unshift(f):u[l]=f)}c&&Object.defineProperty(c,r.name,u),h=!0}function Foe(t,e,n){for(var r=arguments.length>2,i=0;i0&&s[s.length-1])&&(c[0]===6||c[0]===2)){n=0;continue}if(c[0]===3&&(!s||c[1]>s[0]&&c[1]=t.length&&(t=void 0),{value:t&&t[r++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function cL(t,e){var n=typeof Symbol=="function"&&t[Symbol.iterator];if(!n)return t;var r=n.call(t),i,s=[],a;try{for(;(e===void 0||e-- >0)&&!(i=r.next()).done;)s.push(i.value)}catch(o){a={error:o}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(a)throw a.error}}return s}function Zoe(){for(var t=[],e=0;e1||l(p,m)})},y&&(i[p]=y(i[p])))}function l(p,y){try{c(r[p](y))}catch(m){h(s[0][3],m)}}function c(p){p.value instanceof Eg?Promise.resolve(p.value.v).then(u,f):h(s[0][2],p)}function u(p){l("next",p)}function f(p){l("throw",p)}function h(p,y){p(y),s.shift(),s.length&&l(s[0][0],s[0][1])}}function Woe(t){var e,n;return e={},r("next"),r("throw",function(i){throw i}),r("return"),e[Symbol.iterator]=function(){return this},e;function r(i,s){e[i]=t[i]?function(a){return(n=!n)?{value:Eg(t[i](a)),done:!1}:s?s(a):a}:s}}function qoe(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=t[Symbol.asyncIterator],n;return e?e.call(t):(t=typeof j6=="function"?j6(t):t[Symbol.iterator](),n={},r("next"),r("throw"),r("return"),n[Symbol.asyncIterator]=function(){return this},n);function r(s){n[s]=t[s]&&function(a){return new Promise(function(o,l){a=t[s](a),i(o,l,a.done,a.value)})}}function i(s,a,o,l){Promise.resolve(l).then(function(c){s({value:c,done:o})},a)}}function Yoe(t,e){return Object.defineProperty?Object.defineProperty(t,"raw",{value:e}):t.raw=e,t}var wPe=Object.create?(function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}):function(t,e){t.default=e},m_=function(t){return m_=Object.getOwnPropertyNames||function(e){var n=[];for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(n[n.length]=r);return n},m_(t)};function Koe(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var n=m_(t),r=0;r=p},l+" >= "+p)}var u={null:function(){return null},emptyArray:function(){return[]},false:function(){return!1},true:function(){return!0},undefined:function(){},"use strict":function(){return"use strict"}},f=a.or(o.string,o.number,o.boolean,o.null,o.undefined),h=a.from(function(p){if(p===null)return!0;var y=typeof p;return!(y==="object"||y==="function")},f.toString());return{geq:c,defaults:u,isPrimitive:h}}Zm.default=n;function r(i){try{var s=i(),a=s.exports,o=a.default}catch{return}o&&o!==a&&typeof a=="object"&&(Object.assign(o,a,{default:o}),a.__esModule&&Object.defineProperty(o,"__esModule",{value:!0}),s.exports=o)}return Zm.maybeSetModuleExports=r,Zm}Ub.exports;var cU;function Bi(){return cU||(cU=1,(function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.Def=void 0;var n=Bn,r=$r(),i=Object.prototype,s=i.toString,a=i.hasOwnProperty,o=(function(){function b(){}return b.prototype.assert=function(w,O){if(!this.check(w,O)){var k=m(w);throw new Error(k+" does not match type "+this)}return!0},b.prototype.arrayOf=function(){var w=this;return new l(w)},b})(),l=(function(b){n.__extends(w,b);function w(O){var k=b.call(this)||this;return k.elemType=O,k.kind="ArrayType",k}return w.prototype.toString=function(){return"["+this.elemType+"]"},w.prototype.check=function(O,k){var E=this;return Array.isArray(O)&&O.every(function(T){return E.elemType.check(T,k)})},w})(o),c=(function(b){n.__extends(w,b);function w(O){var k=b.call(this)||this;return k.value=O,k.kind="IdentityType",k}return w.prototype.toString=function(){return String(this.value)},w.prototype.check=function(O,k){var E=O===this.value;return!E&&typeof k=="function"&&k(this,O),E},w})(o),u=(function(b){n.__extends(w,b);function w(O){var k=b.call(this)||this;return k.fields=O,k.kind="ObjectType",k}return w.prototype.toString=function(){return"{ "+this.fields.join(", ")+" }"},w.prototype.check=function(O,k){return s.call(O)===s.call({})&&this.fields.every(function(E){return E.type.check(O[E.name],k)})},w})(o),f=(function(b){n.__extends(w,b);function w(O){var k=b.call(this)||this;return k.types=O,k.kind="OrType",k}return w.prototype.toString=function(){return this.types.join(" | ")},w.prototype.check=function(O,k){return this.types.some(function(E){return E.check(O,!!k)})?!0:(typeof k=="function"&&k(this,O),!1)},w})(o),h=(function(b){n.__extends(w,b);function w(O,k){var E=b.call(this)||this;return E.name=O,E.predicate=k,E.kind="PredicateType",E}return w.prototype.toString=function(){return this.name},w.prototype.check=function(O,k){var E=this.predicate(O,k);return!E&&typeof k=="function"&&k(this,O),E},w})(o),p=(function(){function b(w,O){this.type=w,this.typeName=O,this.baseNames=[],this.ownFields=Object.create(null),this.allSupertypes=Object.create(null),this.supertypeList=[],this.allFields=Object.create(null),this.fieldNames=[],this.finalized=!1,this.buildable=!1,this.buildParams=[]}return b.prototype.isSupertypeOf=function(w){if(w instanceof b){if(this.finalized!==!0||w.finalized!==!0)throw new Error("");return a.call(w.allSupertypes,this.typeName)}else throw new Error(w+" is not a Def")},b.prototype.checkAllFields=function(w,O){var k=this.allFields;if(this.finalized!==!0)throw new Error(""+this.typeName);function E(T){var N=k[T],_=N.type,I=N.getValue(w);return _.check(I,O)}return w!==null&&typeof w=="object"&&Object.keys(k).every(E)},b.prototype.bases=function(){for(var w=[],O=0;O=0)return k[we];if(typeof xe!="string")throw new Error("missing name");return new h(xe,ve)}return new c(ve)},def:function(ve){return a.call(ne,ve)?ne[ve]:ne[ve]=new ie(ve)},hasDef:function(ve){return a.call(ne,ve)}},O=[],k=[];function E(ve,xe){var we=s.call(xe),Ce=new h(ve,function(Me){return s.call(Me)===we});return xe&&typeof xe.constructor=="function"&&(O.push(xe.constructor),k.push(Ce)),Ce}var T=E("string","truthy"),N=E("function",function(){}),_=E("array",[]),I=E("object",{}),j=E("RegExp",/./),L=E("Date",new Date),B=E("number",3),$=E("boolean",!0),z=E("null",null),Y=E("undefined",void 0),W=typeof BigInt=="function"?E("BigInt",BigInt(1234)):new h("BigInt",function(){return!1}),J={string:T,function:N,array:_,object:I,RegExp:j,Date:L,number:B,boolean:$,null:z,undefined:Y,BigInt:W},ne=Object.create(null);function le(ve){if(ve&&typeof ve=="object"){var xe=ve.type;if(typeof xe=="string"&&a.call(ne,xe)){var we=ne[xe];if(we.finalized)return we}}return null}var ie=(function(ve){n.__extends(xe,ve);function xe(we){var Ce=ve.call(this,new h(we,function(Me,Ve){return Ce.check(Me,Ve)}),we)||this;return Ce}return xe.prototype.check=function(we,Ce){if(this.finalized!==!0)throw new Error("prematurely checking unfinalized type "+this.typeName);if(we===null||typeof we!="object")return!1;var Me=le(we);return Me?Ce&&Me===this?this.checkAllFields(we,Ce):this.isSupertypeOf(Me)?Ce?Me.checkAllFields(we,Ce)&&this.checkAllFields(we,!1):!0:!1:this.typeName==="SourceLocation"||this.typeName==="Position"?this.checkAllFields(we,Ce):!1},xe.prototype.build=function(){for(var we=this,Ce=[],Me=0;Me=0&&me(this.typeName)}},xe})(p);function q(ve){if(!a.call(ne,ve))throw new Error("");var xe=ne[ve];if(xe.finalized!==!0)throw new Error("");return xe.supertypeList.slice(1)}function F(ve){for(var xe={},we=Object.keys(ne),Ce=we.length,Me=0;Me=0&&(T[O.name=N]=O)}else E[O.name]=O.value,T[O.name]=O;if(E[O.name]!==O.value)throw new Error("");if(O.parentPath.get(O.name)!==O)throw new Error("");return O}return p.replace=function(k){var E=[],T=this.parentPath.value,N=y(this.parentPath),_=arguments.length;if(w(this),u.check(T)){for(var I=T.length,j=b(this.parentPath,_-1,this.name+1),L=[this.name,1],B=0;B<_;++B)L.push(arguments[B]);var $=T.splice.apply(T,L);if($[0]!==this.value)throw new Error("");if(T.length!==I-1+_)throw new Error("");if(j(),_===0)delete this.value,delete N[this.name],this.__childCache=null;else{if(T[this.name]!==k)throw new Error("");for(this.value!==k&&(this.value=k,this.__childCache=null),B=0;B<_;++B)E.push(this.parentPath.get(this.name+B));if(E[0]!==this)throw new Error("")}}else if(_===1)this.value!==k&&(this.__childCache=null),this.value=T[this.name]=k,E.push(this);else if(_===0)delete T[this.name],delete this.value,this.__childCache=null;else throw new Error("Could not replace path");return E},h}e.default=o,(0,r.maybeSetModuleExports)(function(){return t})})(qb,qb.exports)),qb.exports}var Yb={exports:{}};Yb.exports;var fU;function PPe(){return fU||(fU=1,(function(t,e){Object.defineProperty(e,"__esModule",{value:!0});var n=Bn,r=$r(),i=n.__importDefault(Bi()),s=Object.prototype.hasOwnProperty;function a(o){var l=o.use(i.default),c=l.Type,u=l.namedTypes,f=u.Node,h=u.Expression,p=l.builtInTypes.array,y=l.builders,m=function L(B,$){if(!(this instanceof L))throw new Error("Scope constructor cannot be invoked without 'new'");b.check(B.value)||v.assert(B.value);var z;if($){if(!($ instanceof L))throw new Error("");z=$.depth+1}else $=null,z=0;Object.defineProperties(this,{path:{value:B},node:{value:B.value},isGlobal:{value:!$,enumerable:!0},depth:{value:z},parent:{value:$},bindings:{value:{}},types:{value:{}}})},v=c.or(u.Program,u.Function,u.CatchClause),b=c.or(u.Function,u.ClassDeclaration,u.ClassExpression,u.InterfaceDeclaration,u.TSInterfaceDeclaration,u.TypeAlias,u.TSTypeAliasDeclaration),w=c.or(u.TypeParameter,u.TSTypeParameter);m.isEstablishedBy=function(L){return v.check(L)||b.check(L)};var O=m.prototype;O.didScan=!1,O.declares=function(L){return this.scan(),s.call(this.bindings,L)},O.declaresType=function(L){return this.scan(),s.call(this.types,L)},O.declareTemporary=function(L){if(L){if(!/^[a-z$_]/i.test(L))throw new Error("")}else L="t$";L+=this.depth.toString(36)+"$",this.scan();for(var B=0;this.declares(L+B);)++B;var $=L+B;return this.bindings[$]=l.builders.identifier($)},O.injectTemporary=function(L,B){L||(L=this.declareTemporary());var $=this.path.get("body");return u.BlockStatement.check($.value)&&($=$.get("body")),$.unshift(y.variableDeclaration("var",[y.variableDeclarator(L,B||null)])),L},O.scan=function(L){if(L||!this.didScan){for(var B in this.bindings)delete this.bindings[B];for(var B in this.types)delete this.types[B];k(this.path,this.bindings,this.types),this.didScan=!0}},O.getBindings=function(){return this.scan(),this.bindings},O.getTypes=function(){return this.scan(),this.types};function k(L,B,$){var z=L.value;if(b.check(z)){var Y=L.get("typeParameters","params");p.check(Y.value)&&Y.each(function(W){j(W,$)})}v.check(z)&&(u.CatchClause.check(z)?_(L.get("param"),B):E(L,B,$))}function E(L,B,$){var z=L.value;L.parent&&u.FunctionExpression.check(L.parent.node)&&L.parent.node.id&&_(L.parent.get("id"),B),z&&(p.check(z)?L.each(function(Y){N(Y,B,$)}):u.Function.check(z)?(L.get("params").each(function(Y){_(Y,B)}),N(L.get("body"),B,$),E(L.get("typeParameters"),B,$)):u.TypeAlias&&u.TypeAlias.check(z)||u.InterfaceDeclaration&&u.InterfaceDeclaration.check(z)||u.TSTypeAliasDeclaration&&u.TSTypeAliasDeclaration.check(z)||u.TSInterfaceDeclaration&&u.TSInterfaceDeclaration.check(z)?I(L.get("id"),$):u.VariableDeclarator.check(z)?(_(L.get("id"),B),N(L.get("init"),B,$)):z.type==="ImportSpecifier"||z.type==="ImportNamespaceSpecifier"||z.type==="ImportDefaultSpecifier"?_(L.get(z.local?"local":z.name?"name":"id"),B):f.check(z)&&!h.check(z)&&l.eachField(z,function(Y,W){var J=L.get(Y);if(!T(J,W))throw new Error("");N(J,B,$)}))}function T(L,B){return!!(L.value===B||Array.isArray(L.value)&&L.value.length===0&&Array.isArray(B)&&B.length===0)}function N(L,B,$){var z=L.value;if(!(!z||h.check(z)))if(u.FunctionDeclaration.check(z)&&z.id!==null)_(L.get("id"),B);else if(u.ClassDeclaration&&u.ClassDeclaration.check(z)&&z.id!==null)_(L.get("id"),B),E(L.get("typeParameters"),B,$);else if(u.InterfaceDeclaration&&u.InterfaceDeclaration.check(z)||u.TSInterfaceDeclaration&&u.TSInterfaceDeclaration.check(z))I(L.get("id"),$);else if(v.check(z)){if(u.CatchClause.check(z)&&u.Identifier.check(z.param)){var Y=z.param.name,W=s.call(B,Y);E(L.get("body"),B,$),W||delete B[Y]}}else E(L,B,$)}function _(L,B){var $=L.value;u.Pattern.assert($),u.Identifier.check($)?s.call(B,$.name)?B[$.name].push(L):B[$.name]=[L]:u.AssignmentPattern&&u.AssignmentPattern.check($)?_(L.get("left"),B):u.ObjectPattern&&u.ObjectPattern.check($)?L.get("properties").each(function(z){var Y=z.value;u.Pattern.check(Y)?_(z,B):u.Property.check(Y)||u.ObjectProperty&&u.ObjectProperty.check(Y)?_(z.get("value"),B):u.SpreadProperty&&u.SpreadProperty.check(Y)&&_(z.get("argument"),B)}):u.ArrayPattern&&u.ArrayPattern.check($)?L.get("elements").each(function(z){var Y=z.value;u.Pattern.check(Y)?_(z,B):u.SpreadElement&&u.SpreadElement.check(Y)&&_(z.get("argument"),B)}):u.PropertyPattern&&u.PropertyPattern.check($)?_(L.get("pattern"),B):(u.SpreadElementPattern&&u.SpreadElementPattern.check($)||u.RestElement&&u.RestElement.check($)||u.SpreadPropertyPattern&&u.SpreadPropertyPattern.check($))&&_(L.get("argument"),B)}function I(L,B){var $=L.value;u.Pattern.assert($),u.Identifier.check($)&&(s.call(B,$.name)?B[$.name].push(L):B[$.name]=[L])}function j(L,B){var $=L.value;w.assert($),s.call(B,$.name)?B[$.name].push(L):B[$.name]=[L]}return O.lookup=function(L){for(var B=this;B&&!B.declares(L);B=B.parent);return B},O.lookupType=function(L){for(var B=this;B&&!B.declaresType(L);B=B.parent);return B},O.getGlobalScope=function(){for(var L=this;!L.isGlobal;)L=L.parent;return L},m}e.default=a,(0,r.maybeSetModuleExports)(function(){return t})})(Yb,Yb.exports)),Yb.exports}Wb.exports;var hU;function lle(){return hU||(hU=1,(function(t,e){Object.defineProperty(e,"__esModule",{value:!0});var n=Bn,r=n.__importDefault(Bi()),i=n.__importDefault(ole()),s=n.__importDefault(PPe()),a=$r();function o(l){var c=l.use(r.default),u=c.namedTypes,f=c.builders,h=c.builtInTypes.number,p=c.builtInTypes.array,y=l.use(i.default),m=l.use(s.default),v=function _(I,j,L){if(!(this instanceof _))throw new Error("NodePath constructor cannot be invoked without 'new'");y.call(this,I,j,L)},b=v.prototype=Object.create(y.prototype,{constructor:{value:v,enumerable:!1,writable:!0,configurable:!0}});Object.defineProperties(b,{node:{get:function(){return Object.defineProperty(this,"node",{configurable:!0,value:this._computeNode()}),this.node}},parent:{get:function(){return Object.defineProperty(this,"parent",{configurable:!0,value:this._computeParent()}),this.parent}},scope:{get:function(){return Object.defineProperty(this,"scope",{configurable:!0,value:this._computeScope()}),this.scope}}}),b.replace=function(){return delete this.node,delete this.parent,delete this.scope,y.prototype.replace.apply(this,arguments)},b.prune=function(){var _=this.parent;return this.replace(),T(_)},b._computeNode=function(){var _=this.value;if(u.Node.check(_))return _;var I=this.parentPath;return I&&I.node||null},b._computeParent=function(){var _=this.value,I=this.parentPath;if(!u.Node.check(_)){for(;I&&!u.Node.check(I.value);)I=I.parentPath;I&&(I=I.parentPath)}for(;I&&!u.Node.check(I.value);)I=I.parentPath;return I||null},b._computeScope=function(){var _=this.value,I=this.parentPath,j=I&&I.scope;return u.Node.check(_)&&m.isEstablishedBy(_)&&(j=new m(this,j)),j||null},b.getValueProperty=function(_){return c.getFieldValue(this.value,_)},b.needsParens=function(_){var I=this.parentPath;if(!I)return!1;var j=this.value;if(!u.Expression.check(j)||j.type==="Identifier")return!1;for(;!u.Node.check(I.value);)if(I=I.parentPath,!I)return!1;var L=I.value;switch(j.type){case"UnaryExpression":case"SpreadElement":case"SpreadProperty":return L.type==="MemberExpression"&&this.name==="object"&&L.object===j;case"BinaryExpression":case"LogicalExpression":switch(L.type){case"CallExpression":return this.name==="callee"&&L.callee===j;case"UnaryExpression":case"SpreadElement":case"SpreadProperty":return!0;case"MemberExpression":return this.name==="object"&&L.object===j;case"BinaryExpression":case"LogicalExpression":{var B=j,$=L.operator,z=O[$],Y=B.operator,W=O[Y];if(z>W)return!0;if(z===W&&this.name==="right"){if(L.right!==B)throw new Error("Nodes must be equal");return!0}}default:return!1}case"SequenceExpression":switch(L.type){case"ForStatement":return!1;case"ExpressionStatement":return this.name!=="expression";default:return!0}case"YieldExpression":switch(L.type){case"BinaryExpression":case"LogicalExpression":case"UnaryExpression":case"SpreadElement":case"SpreadProperty":case"CallExpression":case"MemberExpression":case"NewExpression":case"ConditionalExpression":case"YieldExpression":return!0;default:return!1}case"Literal":return L.type==="MemberExpression"&&h.check(j.value)&&this.name==="object"&&L.object===j;case"AssignmentExpression":case"ConditionalExpression":switch(L.type){case"UnaryExpression":case"SpreadElement":case"SpreadProperty":case"BinaryExpression":case"LogicalExpression":return!0;case"CallExpression":return this.name==="callee"&&L.callee===j;case"ConditionalExpression":return this.name==="test"&&L.test===j;case"MemberExpression":return this.name==="object"&&L.object===j;default:return!1}default:if(L.type==="NewExpression"&&this.name==="callee"&&L.callee===j)return k(j)}return!!(_!==!0&&!this.canBeFirstInStatement()&&this.firstInStatement())};function w(_){return u.BinaryExpression.check(_)||u.LogicalExpression.check(_)}var O={};[["||"],["&&"],["|"],["^"],["&"],["==","===","!=","!=="],["<",">","<=",">=","in","instanceof"],[">>","<<",">>>"],["+","-"],["*","/","%"]].forEach(function(_,I){_.forEach(function(j){O[j]=I})});function k(_){return u.CallExpression.check(_)?!0:p.check(_)?_.some(k):u.Node.check(_)?c.someField(_,function(I,j){return k(j)}):!1}b.canBeFirstInStatement=function(){var _=this.node;return!u.FunctionExpression.check(_)&&!u.ObjectExpression.check(_)},b.firstInStatement=function(){return E(this)};function E(_){for(var I,j;_.parent;_=_.parent){if(I=_.node,j=_.parent.node,u.BlockStatement.check(j)&&_.parent.name==="body"&&_.name===0){if(j.body[0]!==I)throw new Error("Nodes must be equal");return!0}if(u.ExpressionStatement.check(j)&&_.name==="expression"){if(j.expression!==I)throw new Error("Nodes must be equal");return!0}if(u.SequenceExpression.check(j)&&_.parent.name==="expressions"&&_.name===0){if(j.expressions[0]!==I)throw new Error("Nodes must be equal");continue}if(u.CallExpression.check(j)&&_.name==="callee"){if(j.callee!==I)throw new Error("Nodes must be equal");continue}if(u.MemberExpression.check(j)&&_.name==="object"){if(j.object!==I)throw new Error("Nodes must be equal");continue}if(u.ConditionalExpression.check(j)&&_.name==="test"){if(j.test!==I)throw new Error("Nodes must be equal");continue}if(w(j)&&_.name==="left"){if(j.left!==I)throw new Error("Nodes must be equal");continue}if(u.UnaryExpression.check(j)&&!j.prefix&&_.name==="argument"){if(j.argument!==I)throw new Error("Nodes must be equal");continue}return!1}return!0}function T(_){if(u.VariableDeclaration.check(_.node)){var I=_.get("declarations").value;if(!I||I.length===0)return _.prune()}else if(u.ExpressionStatement.check(_.node)){if(!_.get("expression").value)return _.prune()}else u.IfStatement.check(_.node)&&N(_);return _}function N(_){var I=_.get("test").value,j=_.get("alternate").value,L=_.get("consequent").value;if(!L&&!j){var B=f.expressionStatement(I);_.replace(B)}else if(!L&&j){var $=f.unaryExpression("!",I,!0);u.UnaryExpression.check(I)&&I.operator==="!"&&($=I.argument),_.get("test").replace($),_.get("consequent").replace(j),_.get("alternate").replace()}}return v}e.default=o,(0,a.maybeSetModuleExports)(function(){return t})})(Wb,Wb.exports)),Wb.exports}Xb.exports;var dU;function MPe(){return dU||(dU=1,(function(t,e){Object.defineProperty(e,"__esModule",{value:!0});var n=Bn,r=n.__importDefault(Bi()),i=n.__importDefault(lle()),s=$r(),a=Object.prototype.hasOwnProperty;function o(l){var c=l.use(r.default),u=l.use(i.default),f=c.builtInTypes.array,h=c.builtInTypes.object,p=c.builtInTypes.function,y,m=function T(){if(!(this instanceof T))throw new Error("PathVisitor constructor cannot be invoked without 'new'");this._reusableContextStack=[],this._methodNameTable=v(this),this._shouldVisitComments=a.call(this._methodNameTable,"Block")||a.call(this._methodNameTable,"Line"),this.Context=k(this),this._visiting=!1,this._changeReported=!1};function v(T){var N=Object.create(null);for(var _ in T)/^visit[A-Z]/.test(_)&&(N[_.slice(5)]=!0);for(var I=c.computeSupertypeLookupTable(N),j=Object.create(null),L=Object.keys(I),B=L.length,$=0;$",">=","<<",">>",">>>","+","-","*","/","%","&","|","^","in","instanceof"],AssignmentOperators:["=","+=","-=","*=","/=","%=","<<=",">>=",">>>=","|=","^=","&="],LogicalOperators:["||","&&"]}}e.default=r,(0,n.maybeSetModuleExports)(function(){return t})})(s2,s2.exports)),s2.exports}i2.exports;var yU;function ule(){return yU||(yU=1,(function(t,e){Object.defineProperty(e,"__esModule",{value:!0});var n=Bn,r=$r(),i=n.__importDefault(cle());function s(a){var o=a.use(i.default);return o.BinaryOperators.indexOf("**")<0&&o.BinaryOperators.push("**"),o.AssignmentOperators.indexOf("**=")<0&&o.AssignmentOperators.push("**="),o}e.default=s,(0,r.maybeSetModuleExports)(function(){return t})})(i2,i2.exports)),i2.exports}r2.exports;var xU;function fle(){return xU||(xU=1,(function(t,e){Object.defineProperty(e,"__esModule",{value:!0});var n=Bn,r=$r(),i=n.__importDefault(ule());function s(a){var o=a.use(i.default);return o.LogicalOperators.indexOf("??")<0&&o.LogicalOperators.push("??"),o}e.default=s,(0,r.maybeSetModuleExports)(function(){return t})})(r2,r2.exports)),r2.exports}n2.exports;var bU;function IPe(){return bU||(bU=1,(function(t,e){Object.defineProperty(e,"__esModule",{value:!0});var n=Bn,r=$r(),i=n.__importDefault(fle());function s(a){var o=a.use(i.default);return o.LogicalOperators.forEach(function(l){var c=l+"=";o.AssignmentOperators.indexOf(c)<0&&o.AssignmentOperators.push(c)}),o}e.default=s,(0,r.maybeSetModuleExports)(function(){return t})})(n2,n2.exports)),n2.exports}var a2={exports:{}},o2={exports:{}},l2={exports:{}},c2={exports:{}},u2={exports:{}},f2={exports:{}},h2={exports:{}};h2.exports;var vU;function _Pe(){return vU||(vU=1,(function(t,e){Object.defineProperty(e,"__esModule",{value:!0});var n=Bn,r=n.__importDefault(cle()),i=n.__importDefault(Bi()),s=n.__importStar($r());function a(o){var l=o.use(i.default),c=l.Type,u=c.def,f=c.or,h=o.use(s.default),p=h.defaults,y=h.geq,m=o.use(r.default),v=m.BinaryOperators,b=m.AssignmentOperators,w=m.LogicalOperators;u("Printable").field("loc",f(u("SourceLocation"),null),p.null,!0),u("Node").bases("Printable").field("type",String).field("comments",f([u("Comment")],null),p.null,!0),u("SourceLocation").field("start",u("Position")).field("end",u("Position")).field("source",f(String,null),p.null),u("Position").field("line",y(1)).field("column",y(0)),u("File").bases("Node").build("program","name").field("program",u("Program")).field("name",f(String,null),p.null),u("Program").bases("Node").build("body").field("body",[u("Statement")]),u("Function").bases("Node").field("id",f(u("Identifier"),null),p.null).field("params",[u("Pattern")]).field("body",u("BlockStatement")).field("generator",Boolean,p.false).field("async",Boolean,p.false),u("Statement").bases("Node"),u("EmptyStatement").bases("Statement").build(),u("BlockStatement").bases("Statement").build("body").field("body",[u("Statement")]),u("ExpressionStatement").bases("Statement").build("expression").field("expression",u("Expression")),u("IfStatement").bases("Statement").build("test","consequent","alternate").field("test",u("Expression")).field("consequent",u("Statement")).field("alternate",f(u("Statement"),null),p.null),u("LabeledStatement").bases("Statement").build("label","body").field("label",u("Identifier")).field("body",u("Statement")),u("BreakStatement").bases("Statement").build("label").field("label",f(u("Identifier"),null),p.null),u("ContinueStatement").bases("Statement").build("label").field("label",f(u("Identifier"),null),p.null),u("WithStatement").bases("Statement").build("object","body").field("object",u("Expression")).field("body",u("Statement")),u("SwitchStatement").bases("Statement").build("discriminant","cases","lexical").field("discriminant",u("Expression")).field("cases",[u("SwitchCase")]).field("lexical",Boolean,p.false),u("ReturnStatement").bases("Statement").build("argument").field("argument",f(u("Expression"),null)),u("ThrowStatement").bases("Statement").build("argument").field("argument",u("Expression")),u("TryStatement").bases("Statement").build("block","handler","finalizer").field("block",u("BlockStatement")).field("handler",f(u("CatchClause"),null),function(){return this.handlers&&this.handlers[0]||null}).field("handlers",[u("CatchClause")],function(){return this.handler?[this.handler]:[]},!0).field("guardedHandlers",[u("CatchClause")],p.emptyArray).field("finalizer",f(u("BlockStatement"),null),p.null),u("CatchClause").bases("Node").build("param","guard","body").field("param",u("Pattern")).field("guard",f(u("Expression"),null),p.null).field("body",u("BlockStatement")),u("WhileStatement").bases("Statement").build("test","body").field("test",u("Expression")).field("body",u("Statement")),u("DoWhileStatement").bases("Statement").build("body","test").field("body",u("Statement")).field("test",u("Expression")),u("ForStatement").bases("Statement").build("init","test","update","body").field("init",f(u("VariableDeclaration"),u("Expression"),null)).field("test",f(u("Expression"),null)).field("update",f(u("Expression"),null)).field("body",u("Statement")),u("ForInStatement").bases("Statement").build("left","right","body").field("left",f(u("VariableDeclaration"),u("Expression"))).field("right",u("Expression")).field("body",u("Statement")),u("DebuggerStatement").bases("Statement").build(),u("Declaration").bases("Statement"),u("FunctionDeclaration").bases("Function","Declaration").build("id","params","body").field("id",u("Identifier")),u("FunctionExpression").bases("Function","Expression").build("id","params","body"),u("VariableDeclaration").bases("Declaration").build("kind","declarations").field("kind",f("var","let","const")).field("declarations",[u("VariableDeclarator")]),u("VariableDeclarator").bases("Node").build("id","init").field("id",u("Pattern")).field("init",f(u("Expression"),null),p.null),u("Expression").bases("Node"),u("ThisExpression").bases("Expression").build(),u("ArrayExpression").bases("Expression").build("elements").field("elements",[f(u("Expression"),null)]),u("ObjectExpression").bases("Expression").build("properties").field("properties",[u("Property")]),u("Property").bases("Node").build("kind","key","value").field("kind",f("init","get","set")).field("key",f(u("Literal"),u("Identifier"))).field("value",u("Expression")),u("SequenceExpression").bases("Expression").build("expressions").field("expressions",[u("Expression")]);var O=f("-","+","!","~","typeof","void","delete");u("UnaryExpression").bases("Expression").build("operator","argument","prefix").field("operator",O).field("argument",u("Expression")).field("prefix",Boolean,p.true);var k=f.apply(void 0,v);u("BinaryExpression").bases("Expression").build("operator","left","right").field("operator",k).field("left",u("Expression")).field("right",u("Expression"));var E=f.apply(void 0,b);u("AssignmentExpression").bases("Expression").build("operator","left","right").field("operator",E).field("left",f(u("Pattern"),u("MemberExpression"))).field("right",u("Expression"));var T=f("++","--");u("UpdateExpression").bases("Expression").build("operator","argument","prefix").field("operator",T).field("argument",u("Expression")).field("prefix",Boolean);var N=f.apply(void 0,w);u("LogicalExpression").bases("Expression").build("operator","left","right").field("operator",N).field("left",u("Expression")).field("right",u("Expression")),u("ConditionalExpression").bases("Expression").build("test","consequent","alternate").field("test",u("Expression")).field("consequent",u("Expression")).field("alternate",u("Expression")),u("NewExpression").bases("Expression").build("callee","arguments").field("callee",u("Expression")).field("arguments",[u("Expression")]),u("CallExpression").bases("Expression").build("callee","arguments").field("callee",u("Expression")).field("arguments",[u("Expression")]),u("MemberExpression").bases("Expression").build("object","property","computed").field("object",u("Expression")).field("property",f(u("Identifier"),u("Expression"))).field("computed",Boolean,function(){var _=this.property.type;return _==="Literal"||_==="MemberExpression"||_==="BinaryExpression"}),u("Pattern").bases("Node"),u("SwitchCase").bases("Node").build("test","consequent").field("test",f(u("Expression"),null)).field("consequent",[u("Statement")]),u("Identifier").bases("Expression","Pattern").build("name").field("name",String).field("optional",Boolean,p.false),u("Literal").bases("Expression").build("value").field("value",f(String,Boolean,null,Number,RegExp,BigInt)),u("Comment").bases("Printable").field("value",String).field("leading",Boolean,p.true).field("trailing",Boolean,p.false)}e.default=a,(0,s.maybeSetModuleExports)(function(){return t})})(h2,h2.exports)),h2.exports}f2.exports;var AU;function RPe(){return AU||(AU=1,(function(t,e){Object.defineProperty(e,"__esModule",{value:!0});var n=Bn,r=n.__importDefault(_Pe()),i=n.__importDefault(Bi()),s=n.__importStar($r());function a(o){o.use(r.default);var l=o.use(i.default),c=l.Type.def,u=l.Type.or,f=o.use(s.default).defaults;c("Function").field("generator",Boolean,f.false).field("expression",Boolean,f.false).field("defaults",[u(c("Expression"),null)],f.emptyArray).field("rest",u(c("Identifier"),null),f.null),c("RestElement").bases("Pattern").build("argument").field("argument",c("Pattern")).field("typeAnnotation",u(c("TypeAnnotation"),c("TSTypeAnnotation"),null),f.null),c("SpreadElementPattern").bases("Pattern").build("argument").field("argument",c("Pattern")),c("FunctionDeclaration").build("id","params","body","generator","expression").field("id",u(c("Identifier"),null)),c("FunctionExpression").build("id","params","body","generator","expression"),c("ArrowFunctionExpression").bases("Function","Expression").build("params","body","expression").field("id",null,f.null).field("body",u(c("BlockStatement"),c("Expression"))).field("generator",!1,f.false),c("ForOfStatement").bases("Statement").build("left","right","body").field("left",u(c("VariableDeclaration"),c("Pattern"))).field("right",c("Expression")).field("body",c("Statement")),c("YieldExpression").bases("Expression").build("argument","delegate").field("argument",u(c("Expression"),null)).field("delegate",Boolean,f.false),c("GeneratorExpression").bases("Expression").build("body","blocks","filter").field("body",c("Expression")).field("blocks",[c("ComprehensionBlock")]).field("filter",u(c("Expression"),null)),c("ComprehensionExpression").bases("Expression").build("body","blocks","filter").field("body",c("Expression")).field("blocks",[c("ComprehensionBlock")]).field("filter",u(c("Expression"),null)),c("ComprehensionBlock").bases("Node").build("left","right","each").field("left",c("Pattern")).field("right",c("Expression")).field("each",Boolean),c("Property").field("key",u(c("Literal"),c("Identifier"),c("Expression"))).field("value",u(c("Expression"),c("Pattern"))).field("method",Boolean,f.false).field("shorthand",Boolean,f.false).field("computed",Boolean,f.false),c("ObjectProperty").field("shorthand",Boolean,f.false),c("PropertyPattern").bases("Pattern").build("key","pattern").field("key",u(c("Literal"),c("Identifier"),c("Expression"))).field("pattern",c("Pattern")).field("computed",Boolean,f.false),c("ObjectPattern").bases("Pattern").build("properties").field("properties",[u(c("PropertyPattern"),c("Property"))]),c("ArrayPattern").bases("Pattern").build("elements").field("elements",[u(c("Pattern"),null)]),c("SpreadElement").bases("Node").build("argument").field("argument",c("Expression")),c("ArrayExpression").field("elements",[u(c("Expression"),c("SpreadElement"),c("RestElement"),null)]),c("NewExpression").field("arguments",[u(c("Expression"),c("SpreadElement"))]),c("CallExpression").field("arguments",[u(c("Expression"),c("SpreadElement"))]),c("AssignmentPattern").bases("Pattern").build("left","right").field("left",c("Pattern")).field("right",c("Expression")),c("MethodDefinition").bases("Declaration").build("kind","key","value","static").field("kind",u("constructor","method","get","set")).field("key",c("Expression")).field("value",c("Function")).field("computed",Boolean,f.false).field("static",Boolean,f.false);var h=u(c("MethodDefinition"),c("VariableDeclarator"),c("ClassPropertyDefinition"),c("ClassProperty"),c("StaticBlock"));c("ClassProperty").bases("Declaration").build("key").field("key",u(c("Literal"),c("Identifier"),c("Expression"))).field("computed",Boolean,f.false),c("ClassPropertyDefinition").bases("Declaration").build("definition").field("definition",h),c("ClassBody").bases("Declaration").build("body").field("body",[h]),c("ClassDeclaration").bases("Declaration").build("id","body","superClass").field("id",u(c("Identifier"),null)).field("body",c("ClassBody")).field("superClass",u(c("Expression"),null),f.null),c("ClassExpression").bases("Expression").build("id","body","superClass").field("id",u(c("Identifier"),null),f.null).field("body",c("ClassBody")).field("superClass",u(c("Expression"),null),f.null),c("Super").bases("Expression").build(),c("Specifier").bases("Node"),c("ModuleSpecifier").bases("Specifier").field("local",u(c("Identifier"),null),f.null).field("id",u(c("Identifier"),null),f.null).field("name",u(c("Identifier"),null),f.null),c("ImportSpecifier").bases("ModuleSpecifier").build("imported","local").field("imported",c("Identifier")),c("ImportDefaultSpecifier").bases("ModuleSpecifier").build("local"),c("ImportNamespaceSpecifier").bases("ModuleSpecifier").build("local"),c("ImportDeclaration").bases("Declaration").build("specifiers","source","importKind").field("specifiers",[u(c("ImportSpecifier"),c("ImportNamespaceSpecifier"),c("ImportDefaultSpecifier"))],f.emptyArray).field("source",c("Literal")).field("importKind",u("value","type"),function(){return"value"}),c("ExportNamedDeclaration").bases("Declaration").build("declaration","specifiers","source").field("declaration",u(c("Declaration"),null)).field("specifiers",[c("ExportSpecifier")],f.emptyArray).field("source",u(c("Literal"),null),f.null),c("ExportSpecifier").bases("ModuleSpecifier").build("local","exported").field("exported",c("Identifier")),c("ExportDefaultDeclaration").bases("Declaration").build("declaration").field("declaration",u(c("Declaration"),c("Expression"))),c("ExportAllDeclaration").bases("Declaration").build("source").field("source",c("Literal")),c("TaggedTemplateExpression").bases("Expression").build("tag","quasi").field("tag",c("Expression")).field("quasi",c("TemplateLiteral")),c("TemplateLiteral").bases("Expression").build("quasis","expressions").field("quasis",[c("TemplateElement")]).field("expressions",[c("Expression")]),c("TemplateElement").bases("Node").build("value","tail").field("value",{cooked:String,raw:String}).field("tail",Boolean),c("MetaProperty").bases("Expression").build("meta","property").field("meta",c("Identifier")).field("property",c("Identifier"))}e.default=a,(0,s.maybeSetModuleExports)(function(){return t})})(f2,f2.exports)),f2.exports}u2.exports;var SU;function jPe(){return SU||(SU=1,(function(t,e){Object.defineProperty(e,"__esModule",{value:!0});var n=Bn,r=n.__importDefault(ule()),i=n.__importDefault(RPe()),s=$r();function a(o){o.use(r.default),o.use(i.default)}e.default=a,(0,s.maybeSetModuleExports)(function(){return t})})(u2,u2.exports)),u2.exports}c2.exports;var wU;function LPe(){return wU||(wU=1,(function(t,e){Object.defineProperty(e,"__esModule",{value:!0});var n=Bn,r=n.__importDefault(jPe()),i=n.__importDefault(Bi()),s=n.__importStar($r());function a(o){o.use(r.default);var l=o.use(i.default),c=l.Type.def,u=o.use(s.default).defaults;c("Function").field("async",Boolean,u.false),c("AwaitExpression").bases("Expression").build("argument").field("argument",c("Expression"))}e.default=a,(0,s.maybeSetModuleExports)(function(){return t})})(c2,c2.exports)),c2.exports}l2.exports;var OU;function FPe(){return OU||(OU=1,(function(t,e){Object.defineProperty(e,"__esModule",{value:!0});var n=Bn,r=n.__importDefault(LPe()),i=n.__importDefault(Bi()),s=n.__importStar($r());function a(o){o.use(r.default);var l=o.use(i.default),c=l.Type.def,u=l.Type.or,f=o.use(s.default).defaults;c("ForOfStatement").field("await",Boolean,f.false),c("SpreadProperty").bases("Node").build("argument").field("argument",c("Expression")),c("ObjectExpression").field("properties",[u(c("Property"),c("SpreadProperty"),c("SpreadElement"))]),c("TemplateElement").field("value",{cooked:u(String,null),raw:String}),c("SpreadPropertyPattern").bases("Pattern").build("argument").field("argument",c("Pattern")),c("ObjectPattern").field("properties",[u(c("PropertyPattern"),c("Property"),c("RestElement"),c("SpreadPropertyPattern"))])}e.default=a,(0,s.maybeSetModuleExports)(function(){return t})})(l2,l2.exports)),l2.exports}o2.exports;var CU;function $Pe(){return CU||(CU=1,(function(t,e){Object.defineProperty(e,"__esModule",{value:!0});var n=Bn,r=n.__importDefault(FPe()),i=n.__importDefault(Bi()),s=n.__importStar($r());function a(o){o.use(r.default);var l=o.use(i.default),c=l.Type.def,u=l.Type.or,f=o.use(s.default).defaults;c("CatchClause").field("param",u(c("Pattern"),null),f.null)}e.default=a,(0,s.maybeSetModuleExports)(function(){return t})})(o2,o2.exports)),o2.exports}a2.exports;var kU;function BPe(){return kU||(kU=1,(function(t,e){Object.defineProperty(e,"__esModule",{value:!0});var n=Bn,r=n.__importDefault(fle()),i=n.__importDefault($Pe()),s=n.__importDefault(Bi()),a=n.__importStar($r());function o(l){l.use(r.default),l.use(i.default);var c=l.use(s.default),u=c.Type.def,f=c.Type.or,h=l.use(a.default),p=h.defaults;u("ImportExpression").bases("Expression").build("source").field("source",u("Expression")),u("ExportAllDeclaration").bases("Declaration").build("source","exported").field("source",u("Literal")).field("exported",f(u("Identifier"),null,void 0),p.null),u("ChainElement").bases("Node").field("optional",Boolean,p.false),u("CallExpression").bases("Expression","ChainElement"),u("MemberExpression").bases("Expression","ChainElement"),u("ChainExpression").bases("Expression").build("expression").field("expression",u("ChainElement")),u("OptionalCallExpression").bases("CallExpression").build("callee","arguments","optional").field("optional",Boolean,p.true),u("OptionalMemberExpression").bases("MemberExpression").build("object","property","computed","optional").field("optional",Boolean,p.true)}e.default=o,(0,a.maybeSetModuleExports)(function(){return t})})(a2,a2.exports)),a2.exports}t2.exports;var EU;function VPe(){return EU||(EU=1,(function(t,e){Object.defineProperty(e,"__esModule",{value:!0});var n=Bn,r=n.__importDefault(IPe()),i=n.__importDefault(BPe()),s=$r();function a(o){o.use(r.default),o.use(i.default)}e.default=a,(0,s.maybeSetModuleExports)(function(){return t})})(t2,t2.exports)),t2.exports}e2.exports;var TU;function HPe(){return TU||(TU=1,(function(t,e){Object.defineProperty(e,"__esModule",{value:!0});var n=Bn,r=n.__importDefault(VPe()),i=n.__importDefault(Bi()),s=$r();function a(o){o.use(r.default);var l=o.use(i.default),c=l.Type.def;c("StaticBlock").bases("Declaration").build("body").field("body",[c("Statement")])}e.default=a,(0,s.maybeSetModuleExports)(function(){return t})})(e2,e2.exports)),e2.exports}Jb.exports;var PU;function pS(){return PU||(PU=1,(function(t,e){Object.defineProperty(e,"__esModule",{value:!0});var n=Bn,r=n.__importDefault(Bi()),i=n.__importStar($r()),s=n.__importDefault(HPe());function a(o){o.use(s.default);var l=o.use(r.default),c=l.Type,u=l.Type.def,f=c.or,h=o.use(i.default),p=h.defaults;u("AwaitExpression").build("argument","all").field("argument",f(u("Expression"),null)).field("all",Boolean,p.false),u("Decorator").bases("Node").build("expression").field("expression",u("Expression")),u("Property").field("decorators",f([u("Decorator")],null),p.null),u("MethodDefinition").field("decorators",f([u("Decorator")],null),p.null),u("PrivateName").bases("Expression","Pattern").build("id").field("id",u("Identifier")),u("ClassPrivateProperty").bases("ClassProperty").build("key","value").field("key",u("PrivateName")).field("value",f(u("Expression"),null),p.null),u("ImportAttribute").bases("Node").build("key","value").field("key",f(u("Identifier"),u("Literal"))).field("value",u("Expression")),["ImportDeclaration","ExportAllDeclaration","ExportNamedDeclaration"].forEach(function(y){u(y).field("assertions",[u("ImportAttribute")],p.emptyArray)}),u("RecordExpression").bases("Expression").build("properties").field("properties",[f(u("ObjectProperty"),u("ObjectMethod"),u("SpreadElement"))]),u("TupleExpression").bases("Expression").build("elements").field("elements",[f(u("Expression"),u("SpreadElement"),null)]),u("ModuleExpression").bases("Node").build("body").field("body",u("Program"))}e.default=a,(0,i.maybeSetModuleExports)(function(){return t})})(Jb,Jb.exports)),Jb.exports}var d2={exports:{}};d2.exports;var MU;function QPe(){return MU||(MU=1,(function(t,e){Object.defineProperty(e,"__esModule",{value:!0});var n=Bn,r=n.__importDefault(pS()),i=n.__importDefault(Bi()),s=n.__importStar($r());function a(o){o.use(r.default);var l=o.use(i.default),c=l.Type.def,u=l.Type.or,f=o.use(s.default).defaults;c("JSXAttribute").bases("Node").build("name","value").field("name",u(c("JSXIdentifier"),c("JSXNamespacedName"))).field("value",u(c("Literal"),c("JSXExpressionContainer"),c("JSXElement"),c("JSXFragment"),null),f.null),c("JSXIdentifier").bases("Identifier").build("name").field("name",String),c("JSXNamespacedName").bases("Node").build("namespace","name").field("namespace",c("JSXIdentifier")).field("name",c("JSXIdentifier")),c("JSXMemberExpression").bases("MemberExpression").build("object","property").field("object",u(c("JSXIdentifier"),c("JSXMemberExpression"))).field("property",c("JSXIdentifier")).field("computed",Boolean,f.false);var h=u(c("JSXIdentifier"),c("JSXNamespacedName"),c("JSXMemberExpression"));c("JSXSpreadAttribute").bases("Node").build("argument").field("argument",c("Expression"));var p=[u(c("JSXAttribute"),c("JSXSpreadAttribute"))];c("JSXExpressionContainer").bases("Expression").build("expression").field("expression",u(c("Expression"),c("JSXEmptyExpression")));var y=[u(c("JSXText"),c("JSXExpressionContainer"),c("JSXSpreadChild"),c("JSXElement"),c("JSXFragment"),c("Literal"))];c("JSXElement").bases("Expression").build("openingElement","closingElement","children").field("openingElement",c("JSXOpeningElement")).field("closingElement",u(c("JSXClosingElement"),null),f.null).field("children",y,f.emptyArray).field("name",h,function(){return this.openingElement.name},!0).field("selfClosing",Boolean,function(){return this.openingElement.selfClosing},!0).field("attributes",p,function(){return this.openingElement.attributes},!0),c("JSXOpeningElement").bases("Node").build("name","attributes","selfClosing").field("name",h).field("attributes",p,f.emptyArray).field("selfClosing",Boolean,f.false),c("JSXClosingElement").bases("Node").build("name").field("name",h),c("JSXFragment").bases("Expression").build("openingFragment","closingFragment","children").field("openingFragment",c("JSXOpeningFragment")).field("closingFragment",c("JSXClosingFragment")).field("children",y,f.emptyArray),c("JSXOpeningFragment").bases("Node").build(),c("JSXClosingFragment").bases("Node").build(),c("JSXText").bases("Literal").build("value","raw").field("value",String).field("raw",String,function(){return this.value}),c("JSXEmptyExpression").bases("Node").build(),c("JSXSpreadChild").bases("Node").build("expression").field("expression",c("Expression"))}e.default=a,(0,s.maybeSetModuleExports)(function(){return t})})(d2,d2.exports)),d2.exports}var p2={exports:{}},m2={exports:{}};m2.exports;var NU;function hle(){return NU||(NU=1,(function(t,e){Object.defineProperty(e,"__esModule",{value:!0});var n=Bn,r=n.__importDefault(Bi()),i=n.__importStar($r());function s(a){var o=a.use(r.default),l=o.Type.def,c=o.Type.or,u=a.use(i.default).defaults,f=c(l("TypeAnnotation"),l("TSTypeAnnotation"),null),h=c(l("TypeParameterDeclaration"),l("TSTypeParameterDeclaration"),null);l("Identifier").field("typeAnnotation",f,u.null),l("ObjectPattern").field("typeAnnotation",f,u.null),l("Function").field("returnType",f,u.null).field("typeParameters",h,u.null),l("ClassProperty").build("key","value","typeAnnotation","static").field("value",c(l("Expression"),null)).field("static",Boolean,u.false).field("typeAnnotation",f,u.null),["ClassDeclaration","ClassExpression"].forEach(function(p){l(p).field("typeParameters",h,u.null).field("superTypeParameters",c(l("TypeParameterInstantiation"),l("TSTypeParameterInstantiation"),null),u.null).field("implements",c([l("ClassImplements")],[l("TSExpressionWithTypeArguments")]),u.emptyArray)})}e.default=s,(0,i.maybeSetModuleExports)(function(){return t})})(m2,m2.exports)),m2.exports}p2.exports;var DU;function dle(){return DU||(DU=1,(function(t,e){Object.defineProperty(e,"__esModule",{value:!0});var n=Bn,r=n.__importDefault(pS()),i=n.__importDefault(hle()),s=n.__importDefault(Bi()),a=n.__importStar($r());function o(l){l.use(r.default),l.use(i.default);var c=l.use(s.default),u=c.Type.def,f=c.Type.or,h=l.use(a.default).defaults;u("Flow").bases("Node"),u("FlowType").bases("Flow"),u("AnyTypeAnnotation").bases("FlowType").build(),u("EmptyTypeAnnotation").bases("FlowType").build(),u("MixedTypeAnnotation").bases("FlowType").build(),u("VoidTypeAnnotation").bases("FlowType").build(),u("SymbolTypeAnnotation").bases("FlowType").build(),u("NumberTypeAnnotation").bases("FlowType").build(),u("BigIntTypeAnnotation").bases("FlowType").build(),u("NumberLiteralTypeAnnotation").bases("FlowType").build("value","raw").field("value",Number).field("raw",String),u("NumericLiteralTypeAnnotation").bases("FlowType").build("value","raw").field("value",Number).field("raw",String),u("BigIntLiteralTypeAnnotation").bases("FlowType").build("value","raw").field("value",null).field("raw",String),u("StringTypeAnnotation").bases("FlowType").build(),u("StringLiteralTypeAnnotation").bases("FlowType").build("value","raw").field("value",String).field("raw",String),u("BooleanTypeAnnotation").bases("FlowType").build(),u("BooleanLiteralTypeAnnotation").bases("FlowType").build("value","raw").field("value",Boolean).field("raw",String),u("TypeAnnotation").bases("Node").build("typeAnnotation").field("typeAnnotation",u("FlowType")),u("NullableTypeAnnotation").bases("FlowType").build("typeAnnotation").field("typeAnnotation",u("FlowType")),u("NullLiteralTypeAnnotation").bases("FlowType").build(),u("NullTypeAnnotation").bases("FlowType").build(),u("ThisTypeAnnotation").bases("FlowType").build(),u("ExistsTypeAnnotation").bases("FlowType").build(),u("ExistentialTypeParam").bases("FlowType").build(),u("FunctionTypeAnnotation").bases("FlowType").build("params","returnType","rest","typeParameters").field("params",[u("FunctionTypeParam")]).field("returnType",u("FlowType")).field("rest",f(u("FunctionTypeParam"),null)).field("typeParameters",f(u("TypeParameterDeclaration"),null)),u("FunctionTypeParam").bases("Node").build("name","typeAnnotation","optional").field("name",f(u("Identifier"),null)).field("typeAnnotation",u("FlowType")).field("optional",Boolean),u("ArrayTypeAnnotation").bases("FlowType").build("elementType").field("elementType",u("FlowType")),u("ObjectTypeAnnotation").bases("FlowType").build("properties","indexers","callProperties").field("properties",[f(u("ObjectTypeProperty"),u("ObjectTypeSpreadProperty"))]).field("indexers",[u("ObjectTypeIndexer")],h.emptyArray).field("callProperties",[u("ObjectTypeCallProperty")],h.emptyArray).field("inexact",f(Boolean,void 0),h.undefined).field("exact",Boolean,h.false).field("internalSlots",[u("ObjectTypeInternalSlot")],h.emptyArray),u("Variance").bases("Node").build("kind").field("kind",f("plus","minus"));var p=f(u("Variance"),"plus","minus",null);u("ObjectTypeProperty").bases("Node").build("key","value","optional").field("key",f(u("Literal"),u("Identifier"))).field("value",u("FlowType")).field("optional",Boolean).field("variance",p,h.null),u("ObjectTypeIndexer").bases("Node").build("id","key","value").field("id",u("Identifier")).field("key",u("FlowType")).field("value",u("FlowType")).field("variance",p,h.null).field("static",Boolean,h.false),u("ObjectTypeCallProperty").bases("Node").build("value").field("value",u("FunctionTypeAnnotation")).field("static",Boolean,h.false),u("QualifiedTypeIdentifier").bases("Node").build("qualification","id").field("qualification",f(u("Identifier"),u("QualifiedTypeIdentifier"))).field("id",u("Identifier")),u("GenericTypeAnnotation").bases("FlowType").build("id","typeParameters").field("id",f(u("Identifier"),u("QualifiedTypeIdentifier"))).field("typeParameters",f(u("TypeParameterInstantiation"),null)),u("MemberTypeAnnotation").bases("FlowType").build("object","property").field("object",u("Identifier")).field("property",f(u("MemberTypeAnnotation"),u("GenericTypeAnnotation"))),u("IndexedAccessType").bases("FlowType").build("objectType","indexType").field("objectType",u("FlowType")).field("indexType",u("FlowType")),u("OptionalIndexedAccessType").bases("FlowType").build("objectType","indexType","optional").field("objectType",u("FlowType")).field("indexType",u("FlowType")).field("optional",Boolean),u("UnionTypeAnnotation").bases("FlowType").build("types").field("types",[u("FlowType")]),u("IntersectionTypeAnnotation").bases("FlowType").build("types").field("types",[u("FlowType")]),u("TypeofTypeAnnotation").bases("FlowType").build("argument").field("argument",u("FlowType")),u("ObjectTypeSpreadProperty").bases("Node").build("argument").field("argument",u("FlowType")),u("ObjectTypeInternalSlot").bases("Node").build("id","value","optional","static","method").field("id",u("Identifier")).field("value",u("FlowType")).field("optional",Boolean).field("static",Boolean).field("method",Boolean),u("TypeParameterDeclaration").bases("Node").build("params").field("params",[u("TypeParameter")]),u("TypeParameterInstantiation").bases("Node").build("params").field("params",[u("FlowType")]),u("TypeParameter").bases("FlowType").build("name","variance","bound","default").field("name",String).field("variance",p,h.null).field("bound",f(u("TypeAnnotation"),null),h.null).field("default",f(u("FlowType"),null),h.null),u("ClassProperty").field("variance",p,h.null),u("ClassImplements").bases("Node").build("id").field("id",u("Identifier")).field("superClass",f(u("Expression"),null),h.null).field("typeParameters",f(u("TypeParameterInstantiation"),null),h.null),u("InterfaceTypeAnnotation").bases("FlowType").build("body","extends").field("body",u("ObjectTypeAnnotation")).field("extends",f([u("InterfaceExtends")],null),h.null),u("InterfaceDeclaration").bases("Declaration").build("id","body","extends").field("id",u("Identifier")).field("typeParameters",f(u("TypeParameterDeclaration"),null),h.null).field("body",u("ObjectTypeAnnotation")).field("extends",[u("InterfaceExtends")]),u("DeclareInterface").bases("InterfaceDeclaration").build("id","body","extends"),u("InterfaceExtends").bases("Node").build("id").field("id",u("Identifier")).field("typeParameters",f(u("TypeParameterInstantiation"),null),h.null),u("TypeAlias").bases("Declaration").build("id","typeParameters","right").field("id",u("Identifier")).field("typeParameters",f(u("TypeParameterDeclaration"),null)).field("right",u("FlowType")),u("DeclareTypeAlias").bases("TypeAlias").build("id","typeParameters","right"),u("OpaqueType").bases("Declaration").build("id","typeParameters","impltype","supertype").field("id",u("Identifier")).field("typeParameters",f(u("TypeParameterDeclaration"),null)).field("impltype",u("FlowType")).field("supertype",f(u("FlowType"),null)),u("DeclareOpaqueType").bases("OpaqueType").build("id","typeParameters","supertype").field("impltype",f(u("FlowType"),null)),u("TypeCastExpression").bases("Expression").build("expression","typeAnnotation").field("expression",u("Expression")).field("typeAnnotation",u("TypeAnnotation")),u("TupleTypeAnnotation").bases("FlowType").build("types").field("types",[u("FlowType")]),u("DeclareVariable").bases("Statement").build("id").field("id",u("Identifier")),u("DeclareFunction").bases("Statement").build("id").field("id",u("Identifier")).field("predicate",f(u("FlowPredicate"),null),h.null),u("DeclareClass").bases("InterfaceDeclaration").build("id"),u("DeclareModule").bases("Statement").build("id","body").field("id",f(u("Identifier"),u("Literal"))).field("body",u("BlockStatement")),u("DeclareModuleExports").bases("Statement").build("typeAnnotation").field("typeAnnotation",u("TypeAnnotation")),u("DeclareExportDeclaration").bases("Declaration").build("default","declaration","specifiers","source").field("default",Boolean).field("declaration",f(u("DeclareVariable"),u("DeclareFunction"),u("DeclareClass"),u("FlowType"),u("TypeAlias"),u("DeclareOpaqueType"),u("InterfaceDeclaration"),null)).field("specifiers",[f(u("ExportSpecifier"),u("ExportBatchSpecifier"))],h.emptyArray).field("source",f(u("Literal"),null),h.null),u("DeclareExportAllDeclaration").bases("Declaration").build("source").field("source",f(u("Literal"),null),h.null),u("ImportDeclaration").field("importKind",f("value","type","typeof"),function(){return"value"}),u("FlowPredicate").bases("Flow"),u("InferredPredicate").bases("FlowPredicate").build(),u("DeclaredPredicate").bases("FlowPredicate").build("value").field("value",u("Expression")),u("Function").field("predicate",f(u("FlowPredicate"),null),h.null),u("CallExpression").field("typeArguments",f(null,u("TypeParameterInstantiation")),h.null),u("NewExpression").field("typeArguments",f(null,u("TypeParameterInstantiation")),h.null),u("EnumDeclaration").bases("Declaration").build("id","body").field("id",u("Identifier")).field("body",f(u("EnumBooleanBody"),u("EnumNumberBody"),u("EnumStringBody"),u("EnumSymbolBody"))),u("EnumBooleanBody").build("members","explicitType").field("members",[u("EnumBooleanMember")]).field("explicitType",Boolean),u("EnumNumberBody").build("members","explicitType").field("members",[u("EnumNumberMember")]).field("explicitType",Boolean),u("EnumStringBody").build("members","explicitType").field("members",f([u("EnumStringMember")],[u("EnumDefaultedMember")])).field("explicitType",Boolean),u("EnumSymbolBody").build("members").field("members",[u("EnumDefaultedMember")]),u("EnumBooleanMember").build("id","init").field("id",u("Identifier")).field("init",f(u("Literal"),Boolean)),u("EnumNumberMember").build("id","init").field("id",u("Identifier")).field("init",u("Literal")),u("EnumStringMember").build("id","init").field("id",u("Identifier")).field("init",u("Literal")),u("EnumDefaultedMember").build("id").field("id",u("Identifier"))}e.default=o,(0,a.maybeSetModuleExports)(function(){return t})})(p2,p2.exports)),p2.exports}var g2={exports:{}};g2.exports;var IU;function zPe(){return IU||(IU=1,(function(t,e){Object.defineProperty(e,"__esModule",{value:!0});var n=Bn,r=n.__importDefault(pS()),i=n.__importDefault(Bi()),s=n.__importStar($r());function a(o){o.use(r.default);var l=o.use(i.default),c=o.use(s.default).defaults,u=l.Type.def,f=l.Type.or;u("VariableDeclaration").field("declarations",[f(u("VariableDeclarator"),u("Identifier"))]),u("Property").field("value",f(u("Expression"),u("Pattern"))),u("ArrayPattern").field("elements",[f(u("Pattern"),u("SpreadElement"),null)]),u("ObjectPattern").field("properties",[f(u("Property"),u("PropertyPattern"),u("SpreadPropertyPattern"),u("SpreadProperty"))]),u("ExportSpecifier").bases("ModuleSpecifier").build("id","name"),u("ExportBatchSpecifier").bases("Specifier").build(),u("ExportDeclaration").bases("Declaration").build("default","declaration","specifiers","source").field("default",Boolean).field("declaration",f(u("Declaration"),u("Expression"),null)).field("specifiers",[f(u("ExportSpecifier"),u("ExportBatchSpecifier"))],c.emptyArray).field("source",f(u("Literal"),null),c.null),u("Block").bases("Comment").build("value","leading","trailing"),u("Line").bases("Comment").build("value","leading","trailing")}e.default=a,(0,s.maybeSetModuleExports)(function(){return t})})(g2,g2.exports)),g2.exports}var y2={exports:{}},x2={exports:{}};x2.exports;var _U;function ple(){return _U||(_U=1,(function(t,e){Object.defineProperty(e,"__esModule",{value:!0});var n=Bn,r=n.__importDefault(pS()),i=n.__importDefault(Bi()),s=n.__importStar($r());function a(o){var l,c,u,f,h;o.use(r.default);var p=o.use(i.default),y=o.use(s.default).defaults,m=p.Type.def,v=p.Type.or,b=p.builtInTypes.undefined;m("Noop").bases("Statement").build(),m("DoExpression").bases("Expression").build("body").field("body",[m("Statement")]),m("BindExpression").bases("Expression").build("object","callee").field("object",v(m("Expression"),null)).field("callee",m("Expression")),m("ParenthesizedExpression").bases("Expression").build("expression").field("expression",m("Expression")),m("ExportNamespaceSpecifier").bases("Specifier").build("exported").field("exported",m("Identifier")),m("ExportDefaultSpecifier").bases("Specifier").build("exported").field("exported",m("Identifier")),m("CommentBlock").bases("Comment").build("value","leading","trailing"),m("CommentLine").bases("Comment").build("value","leading","trailing"),m("Directive").bases("Node").build("value").field("value",m("DirectiveLiteral")),m("DirectiveLiteral").bases("Node","Expression").build("value").field("value",String,y["use strict"]),m("InterpreterDirective").bases("Node").build("value").field("value",String),m("BlockStatement").bases("Statement").build("body").field("body",[m("Statement")]).field("directives",[m("Directive")],y.emptyArray),m("Program").bases("Node").build("body").field("body",[m("Statement")]).field("directives",[m("Directive")],y.emptyArray).field("interpreter",v(m("InterpreterDirective"),null),y.null);function w(T,N){return T===void 0&&(T=String),["extra",{rawValue:T,raw:String},function(){var I=p.getFieldValue(this,"value");return{rawValue:I,raw:N?N(I):String(I)}}]}(l=m("StringLiteral").bases("Literal").build("value").field("value",String)).field.apply(l,w(String,function(T){return JSON.stringify(T)})),(c=m("NumericLiteral").bases("Literal").build("value").field("value",Number).field("raw",v(String,null),y.null)).field.apply(c,w(Number)),(u=m("BigIntLiteral").bases("Literal").build("value").field("value",v(String,Number))).field.apply(u,w(String,function(T){return T+"n"})),(f=m("DecimalLiteral").bases("Literal").build("value").field("value",String)).field.apply(f,w(String,function(T){return T+"m"})),m("NullLiteral").bases("Literal").build().field("value",null,y.null),m("BooleanLiteral").bases("Literal").build("value").field("value",Boolean),(h=m("RegExpLiteral").bases("Literal").build("pattern","flags").field("pattern",String).field("flags",String).field("value",RegExp,function(){return new RegExp(this.pattern,this.flags)})).field.apply(h,w(v(RegExp,b),function(T){return"/".concat(T.pattern,"/").concat(T.flags||"")})).field("regex",{pattern:String,flags:String},function(){return{pattern:this.pattern,flags:this.flags}});var O=v(m("Property"),m("ObjectMethod"),m("ObjectProperty"),m("SpreadProperty"),m("SpreadElement"));m("ObjectExpression").bases("Expression").build("properties").field("properties",[O]),m("ObjectMethod").bases("Node","Function").build("kind","key","params","body","computed").field("kind",v("method","get","set")).field("key",v(m("Literal"),m("Identifier"),m("Expression"))).field("params",[m("Pattern")]).field("body",m("BlockStatement")).field("computed",Boolean,y.false).field("generator",Boolean,y.false).field("async",Boolean,y.false).field("accessibility",v(m("Literal"),null),y.null).field("decorators",v([m("Decorator")],null),y.null),m("ObjectProperty").bases("Node").build("key","value").field("key",v(m("Literal"),m("Identifier"),m("Expression"))).field("value",v(m("Expression"),m("Pattern"))).field("accessibility",v(m("Literal"),null),y.null).field("computed",Boolean,y.false);var k=v(m("MethodDefinition"),m("VariableDeclarator"),m("ClassPropertyDefinition"),m("ClassProperty"),m("ClassPrivateProperty"),m("ClassMethod"),m("ClassPrivateMethod"),m("ClassAccessorProperty"),m("StaticBlock"));m("ClassBody").bases("Declaration").build("body").field("body",[k]),m("ClassMethod").bases("Declaration","Function").build("kind","key","params","body","computed","static").field("key",v(m("Literal"),m("Identifier"),m("Expression"))),m("ClassPrivateMethod").bases("Declaration","Function").build("key","params","body","kind","computed","static").field("key",m("PrivateName")),m("ClassAccessorProperty").bases("Declaration").build("key","value","decorators","computed","static").field("key",v(m("Literal"),m("Identifier"),m("PrivateName"),m("Expression"))).field("value",v(m("Expression"),null),y.null),["ClassMethod","ClassPrivateMethod"].forEach(function(T){m(T).field("kind",v("get","set","method","constructor"),function(){return"method"}).field("body",m("BlockStatement")).field("access",v("public","private","protected",null),y.null)}),["ClassMethod","ClassPrivateMethod","ClassAccessorProperty"].forEach(function(T){m(T).field("computed",Boolean,y.false).field("static",Boolean,y.false).field("abstract",Boolean,y.false).field("accessibility",v("public","private","protected",null),y.null).field("decorators",v([m("Decorator")],null),y.null).field("definite",Boolean,y.false).field("optional",Boolean,y.false).field("override",Boolean,y.false).field("readonly",Boolean,y.false)});var E=v(m("Property"),m("PropertyPattern"),m("SpreadPropertyPattern"),m("SpreadProperty"),m("ObjectProperty"),m("RestProperty"),m("RestElement"));m("ObjectPattern").bases("Pattern").build("properties").field("properties",[E]).field("decorators",v([m("Decorator")],null),y.null),m("SpreadProperty").bases("Node").build("argument").field("argument",m("Expression")),m("RestProperty").bases("Node").build("argument").field("argument",m("Expression")),m("ForAwaitStatement").bases("Statement").build("left","right","body").field("left",v(m("VariableDeclaration"),m("Expression"))).field("right",m("Expression")).field("body",m("Statement")),m("Import").bases("Expression").build()}e.default=a,(0,s.maybeSetModuleExports)(function(){return t})})(x2,x2.exports)),x2.exports}y2.exports;var RU;function ZPe(){return RU||(RU=1,(function(t,e){Object.defineProperty(e,"__esModule",{value:!0});var n=Bn,r=n.__importDefault(Bi()),i=n.__importDefault(ple()),s=n.__importDefault(dle()),a=$r();function o(l){var c=l.use(r.default),u=c.Type.def;l.use(i.default),l.use(s.default),u("V8IntrinsicIdentifier").bases("Expression").build("name").field("name",String),u("TopicReference").bases("Expression").build()}e.default=o,(0,a.maybeSetModuleExports)(function(){return t})})(y2,y2.exports)),y2.exports}var b2={exports:{}};b2.exports;var jU;function GPe(){return jU||(jU=1,(function(t,e){Object.defineProperty(e,"__esModule",{value:!0});var n=Bn,r=n.__importDefault(ple()),i=n.__importDefault(hle()),s=n.__importDefault(Bi()),a=n.__importStar($r());function o(l){l.use(r.default),l.use(i.default);var c=l.use(s.default),u=c.namedTypes,f=c.Type.def,h=c.Type.or,p=l.use(a.default).defaults,y=c.Type.from(function(w,O){return!!(u.StringLiteral&&u.StringLiteral.check(w,O)||u.Literal&&u.Literal.check(w,O)&&typeof w.value=="string")},"StringLiteral");f("TSType").bases("Node");var m=h(f("Identifier"),f("TSQualifiedName"));f("TSTypeReference").bases("TSType","TSHasOptionalTypeParameterInstantiation").build("typeName","typeParameters").field("typeName",m),f("TSHasOptionalTypeParameterInstantiation").field("typeParameters",h(f("TSTypeParameterInstantiation"),null),p.null),f("TSHasOptionalTypeParameters").field("typeParameters",h(f("TSTypeParameterDeclaration"),null,void 0),p.null),f("TSHasOptionalTypeAnnotation").field("typeAnnotation",h(f("TSTypeAnnotation"),null),p.null),f("TSQualifiedName").bases("Node").build("left","right").field("left",m).field("right",m),f("TSAsExpression").bases("Expression","Pattern").build("expression","typeAnnotation").field("expression",f("Expression")).field("typeAnnotation",f("TSType")).field("extra",h({parenthesized:Boolean},null),p.null),f("TSTypeCastExpression").bases("Expression").build("expression","typeAnnotation").field("expression",f("Expression")).field("typeAnnotation",f("TSType")),f("TSSatisfiesExpression").bases("Expression","Pattern").build("expression","typeAnnotation").field("expression",f("Expression")).field("typeAnnotation",f("TSType")),f("TSNonNullExpression").bases("Expression","Pattern").build("expression").field("expression",f("Expression")),["TSAnyKeyword","TSBigIntKeyword","TSBooleanKeyword","TSNeverKeyword","TSNullKeyword","TSNumberKeyword","TSObjectKeyword","TSStringKeyword","TSSymbolKeyword","TSUndefinedKeyword","TSUnknownKeyword","TSVoidKeyword","TSIntrinsicKeyword","TSThisType"].forEach(function(w){f(w).bases("TSType").build()}),f("TSArrayType").bases("TSType").build("elementType").field("elementType",f("TSType")),f("TSLiteralType").bases("TSType").build("literal").field("literal",h(f("NumericLiteral"),f("StringLiteral"),f("BooleanLiteral"),f("TemplateLiteral"),f("UnaryExpression"),f("BigIntLiteral"))),f("TemplateLiteral").field("expressions",h([f("Expression")],[f("TSType")])),["TSUnionType","TSIntersectionType"].forEach(function(w){f(w).bases("TSType").build("types").field("types",[f("TSType")])}),f("TSConditionalType").bases("TSType").build("checkType","extendsType","trueType","falseType").field("checkType",f("TSType")).field("extendsType",f("TSType")).field("trueType",f("TSType")).field("falseType",f("TSType")),f("TSInferType").bases("TSType").build("typeParameter").field("typeParameter",f("TSTypeParameter")),f("TSParenthesizedType").bases("TSType").build("typeAnnotation").field("typeAnnotation",f("TSType"));var v=[h(f("Identifier"),f("RestElement"),f("ArrayPattern"),f("ObjectPattern"))];["TSFunctionType","TSConstructorType"].forEach(function(w){f(w).bases("TSType","TSHasOptionalTypeParameters","TSHasOptionalTypeAnnotation").build("parameters").field("parameters",v)}),f("TSDeclareFunction").bases("Declaration","TSHasOptionalTypeParameters").build("id","params","returnType").field("declare",Boolean,p.false).field("async",Boolean,p.false).field("generator",Boolean,p.false).field("id",h(f("Identifier"),null),p.null).field("params",[f("Pattern")]).field("returnType",h(f("TSTypeAnnotation"),f("Noop"),null),p.null),f("TSDeclareMethod").bases("Declaration","TSHasOptionalTypeParameters").build("key","params","returnType").field("async",Boolean,p.false).field("generator",Boolean,p.false).field("params",[f("Pattern")]).field("abstract",Boolean,p.false).field("accessibility",h("public","private","protected",void 0),p.undefined).field("static",Boolean,p.false).field("computed",Boolean,p.false).field("optional",Boolean,p.false).field("key",h(f("Identifier"),f("StringLiteral"),f("NumericLiteral"),f("Expression"))).field("kind",h("get","set","method","constructor"),function(){return"method"}).field("access",h("public","private","protected",void 0),p.undefined).field("decorators",h([f("Decorator")],null),p.null).field("returnType",h(f("TSTypeAnnotation"),f("Noop"),null),p.null),f("TSMappedType").bases("TSType").build("typeParameter","typeAnnotation").field("readonly",h(Boolean,"+","-"),p.false).field("typeParameter",f("TSTypeParameter")).field("optional",h(Boolean,"+","-"),p.false).field("typeAnnotation",h(f("TSType"),null),p.null),f("TSTupleType").bases("TSType").build("elementTypes").field("elementTypes",[h(f("TSType"),f("TSNamedTupleMember"))]),f("TSNamedTupleMember").bases("TSType").build("label","elementType","optional").field("label",f("Identifier")).field("optional",Boolean,p.false).field("elementType",f("TSType")),f("TSRestType").bases("TSType").build("typeAnnotation").field("typeAnnotation",f("TSType")),f("TSOptionalType").bases("TSType").build("typeAnnotation").field("typeAnnotation",f("TSType")),f("TSIndexedAccessType").bases("TSType").build("objectType","indexType").field("objectType",f("TSType")).field("indexType",f("TSType")),f("TSTypeOperator").bases("TSType").build("operator").field("operator",String).field("typeAnnotation",f("TSType")),f("TSTypeAnnotation").bases("Node").build("typeAnnotation").field("typeAnnotation",h(f("TSType"),f("TSTypeAnnotation"))),f("TSIndexSignature").bases("Declaration","TSHasOptionalTypeAnnotation").build("parameters","typeAnnotation").field("parameters",[f("Identifier")]).field("readonly",Boolean,p.false),f("TSPropertySignature").bases("Declaration","TSHasOptionalTypeAnnotation").build("key","typeAnnotation","optional").field("key",f("Expression")).field("computed",Boolean,p.false).field("readonly",Boolean,p.false).field("optional",Boolean,p.false).field("initializer",h(f("Expression"),null),p.null),f("TSMethodSignature").bases("Declaration","TSHasOptionalTypeParameters","TSHasOptionalTypeAnnotation").build("key","parameters","typeAnnotation").field("key",f("Expression")).field("computed",Boolean,p.false).field("optional",Boolean,p.false).field("parameters",v),f("TSTypePredicate").bases("TSTypeAnnotation","TSType").build("parameterName","typeAnnotation","asserts").field("parameterName",h(f("Identifier"),f("TSThisType"))).field("typeAnnotation",h(f("TSTypeAnnotation"),null),p.null).field("asserts",Boolean,p.false),["TSCallSignatureDeclaration","TSConstructSignatureDeclaration"].forEach(function(w){f(w).bases("Declaration","TSHasOptionalTypeParameters","TSHasOptionalTypeAnnotation").build("parameters","typeAnnotation").field("parameters",v)}),f("TSEnumMember").bases("Node").build("id","initializer").field("id",h(f("Identifier"),y)).field("initializer",h(f("Expression"),null),p.null),f("TSTypeQuery").bases("TSType").build("exprName").field("exprName",h(m,f("TSImportType")));var b=h(f("TSCallSignatureDeclaration"),f("TSConstructSignatureDeclaration"),f("TSIndexSignature"),f("TSMethodSignature"),f("TSPropertySignature"));f("TSTypeLiteral").bases("TSType").build("members").field("members",[b]),f("TSTypeParameter").bases("Identifier").build("name","constraint","default").field("name",h(f("Identifier"),String)).field("constraint",h(f("TSType"),void 0),p.undefined).field("default",h(f("TSType"),void 0),p.undefined),f("TSTypeAssertion").bases("Expression","Pattern").build("typeAnnotation","expression").field("typeAnnotation",f("TSType")).field("expression",f("Expression")).field("extra",h({parenthesized:Boolean},null),p.null),f("TSTypeParameterDeclaration").bases("Declaration").build("params").field("params",[f("TSTypeParameter")]),f("TSInstantiationExpression").bases("Expression","TSHasOptionalTypeParameterInstantiation").build("expression","typeParameters").field("expression",f("Expression")),f("TSTypeParameterInstantiation").bases("Node").build("params").field("params",[f("TSType")]),f("TSEnumDeclaration").bases("Declaration").build("id","members").field("id",f("Identifier")).field("const",Boolean,p.false).field("declare",Boolean,p.false).field("members",[f("TSEnumMember")]).field("initializer",h(f("Expression"),null),p.null),f("TSTypeAliasDeclaration").bases("Declaration","TSHasOptionalTypeParameters").build("id","typeAnnotation").field("id",f("Identifier")).field("declare",Boolean,p.false).field("typeAnnotation",f("TSType")),f("TSModuleBlock").bases("Node").build("body").field("body",[f("Statement")]),f("TSModuleDeclaration").bases("Declaration").build("id","body").field("id",h(y,m)).field("declare",Boolean,p.false).field("global",Boolean,p.false).field("body",h(f("TSModuleBlock"),f("TSModuleDeclaration"),null),p.null),f("TSImportType").bases("TSType","TSHasOptionalTypeParameterInstantiation").build("argument","qualifier","typeParameters").field("argument",y).field("qualifier",h(m,void 0),p.undefined),f("TSImportEqualsDeclaration").bases("Declaration").build("id","moduleReference").field("id",f("Identifier")).field("isExport",Boolean,p.false).field("moduleReference",h(m,f("TSExternalModuleReference"))),f("TSExternalModuleReference").bases("Declaration").build("expression").field("expression",y),f("TSExportAssignment").bases("Statement").build("expression").field("expression",f("Expression")),f("TSNamespaceExportDeclaration").bases("Declaration").build("id").field("id",f("Identifier")),f("TSInterfaceBody").bases("Node").build("body").field("body",[b]),f("TSExpressionWithTypeArguments").bases("TSType","TSHasOptionalTypeParameterInstantiation").build("expression","typeParameters").field("expression",m),f("TSInterfaceDeclaration").bases("Declaration","TSHasOptionalTypeParameters").build("id","body").field("id",m).field("declare",Boolean,p.false).field("extends",h([f("TSExpressionWithTypeArguments")],null),p.null).field("body",f("TSInterfaceBody")),f("TSParameterProperty").bases("Pattern").build("parameter").field("accessibility",h("public","private","protected",void 0),p.undefined).field("readonly",Boolean,p.false).field("parameter",h(f("Identifier"),f("AssignmentPattern"))),f("ClassProperty").field("access",h("public","private","protected",void 0),p.undefined),f("ClassAccessorProperty").bases("Declaration","TSHasOptionalTypeAnnotation"),f("ClassBody").field("body",[h(f("MethodDefinition"),f("VariableDeclarator"),f("ClassPropertyDefinition"),f("ClassProperty"),f("ClassPrivateProperty"),f("ClassAccessorProperty"),f("ClassMethod"),f("ClassPrivateMethod"),f("StaticBlock"),f("TSDeclareMethod"),b)])}e.default=o,(0,a.maybeSetModuleExports)(function(){return t})})(b2,b2.exports)),b2.exports}var rM={},LU;function UPe(){return LU||(LU=1,(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.namedTypes=void 0,t.namedTypes||(t.namedTypes={})})(rM)),rM}var FU;function Md(){return FU||(FU=1,(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.visit=t.use=t.Type=t.someField=t.PathVisitor=t.Path=t.NodePath=t.namedTypes=t.getSupertypeNames=t.getFieldValue=t.getFieldNames=t.getBuilderName=t.finalize=t.eachField=t.defineMethod=t.builtInTypes=t.builders=t.astNodesAreEquivalent=void 0;var e=Bn,n=e.__importDefault(DPe()),r=e.__importDefault(pS()),i=e.__importDefault(QPe()),s=e.__importDefault(dle()),a=e.__importDefault(zPe()),o=e.__importDefault(ZPe()),l=e.__importDefault(GPe()),c=UPe();Object.defineProperty(t,"namedTypes",{enumerable:!0,get:function(){return c.namedTypes}});var u=(0,n.default)([r.default,i.default,s.default,a.default,o.default,l.default]),f=u.astNodesAreEquivalent,h=u.builders,p=u.builtInTypes,y=u.defineMethod,m=u.eachField,v=u.finalize,b=u.getBuilderName,w=u.getFieldNames,O=u.getFieldValue,k=u.getSupertypeNames,E=u.namedTypes,T=u.NodePath,N=u.Path,_=u.PathVisitor,I=u.someField,j=u.Type,L=u.use,B=u.visit;t.astNodesAreEquivalent=f,t.builders=h,t.builtInTypes=p,t.defineMethod=y,t.eachField=m,t.finalize=v,t.getBuilderName=b,t.getFieldNames=w,t.getFieldValue=O,t.getSupertypeNames=k,t.NodePath=T,t.Path=N,t.PathVisitor=_,t.someField=I,t.Type=j,t.use=L,t.visit=B,Object.assign(c.namedTypes,E)})(nM)),nM}var Wx={},iM,$U;function Gd(){if($U)return iM;$U=1;var t="Invariant failed";function e(n,r){if(!n)throw new Error(t)}return iM=e,iM}var qx={},zr={},Yx={},sM={},QO={},zO={},BU;function XPe(){if(BU)return zO;BU=1;var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split("");return zO.encode=function(e){if(0<=e&&e>1;return l?-c:c}return QO.encode=function(l){var c="",u,f=s(l);do u=f&r,f>>>=e,f>0&&(u|=i),c+=t.encode(u);while(f>0);return c},QO.decode=function(l,c,u){var f=l.length,h=0,p=0,y,m;do{if(c>=f)throw new Error("Expected more digits in base 64 VLQ value.");if(m=t.decode(l.charCodeAt(c++)),m===-1)throw new Error("Invalid base64 digit: "+l.charAt(c-1));y=!!(m&i),m&=r,h=h+(m<=0;L--)I=_[L],I==="."?_.splice(L,1):I===".."?j++:j>0&&(I===""?(_.splice(L+1,j),j=0):(_.splice(L,2),j--));return E=_.join("/"),E===""&&(E=N?"/":"."),T?(T.path=E,s(T)):E}t.normalize=a;function o(k,E){k===""&&(k="."),E===""&&(E=".");var T=i(E),N=i(k);if(N&&(k=N.path||"/"),T&&!T.scheme)return N&&(T.scheme=N.scheme),s(T);if(T||E.match(r))return E;if(N&&!N.host&&!N.path)return N.host=E,s(N);var _=E.charAt(0)==="/"?E:a(k.replace(/\/+$/,"")+"/"+E);return N?(N.path=_,s(N)):_}t.join=o,t.isAbsolute=function(k){return k.charAt(0)==="/"||n.test(k)};function l(k,E){k===""&&(k="."),k=k.replace(/\/$/,"");for(var T=0;E.indexOf(k+"/")!==0;){var N=k.lastIndexOf("/");if(N<0||(k=k.slice(0,N),k.match(/^([^\/]+:\/)?\/*$/)))return E;++T}return Array(T+1).join("../")+E.substr(k.length+1)}t.relative=l;var c=(function(){var k=Object.create(null);return!("__proto__"in k)})();function u(k){return k}function f(k){return p(k)?"$"+k:k}t.toSetString=c?u:f;function h(k){return p(k)?k.slice(1):k}t.fromSetString=c?u:h;function p(k){if(!k)return!1;var E=k.length;if(E<9||k.charCodeAt(E-1)!==95||k.charCodeAt(E-2)!==95||k.charCodeAt(E-3)!==111||k.charCodeAt(E-4)!==116||k.charCodeAt(E-5)!==111||k.charCodeAt(E-6)!==114||k.charCodeAt(E-7)!==112||k.charCodeAt(E-8)!==95||k.charCodeAt(E-9)!==95)return!1;for(var T=E-10;T>=0;T--)if(k.charCodeAt(T)!==36)return!1;return!0}function y(k,E,T){var N=v(k.source,E.source);return N!==0||(N=k.originalLine-E.originalLine,N!==0)||(N=k.originalColumn-E.originalColumn,N!==0||T)||(N=k.generatedColumn-E.generatedColumn,N!==0)||(N=k.generatedLine-E.generatedLine,N!==0)?N:v(k.name,E.name)}t.compareByOriginalPositions=y;function m(k,E,T){var N=k.generatedLine-E.generatedLine;return N!==0||(N=k.generatedColumn-E.generatedColumn,N!==0||T)||(N=v(k.source,E.source),N!==0)||(N=k.originalLine-E.originalLine,N!==0)||(N=k.originalColumn-E.originalColumn,N!==0)?N:v(k.name,E.name)}t.compareByGeneratedPositionsDeflated=m;function v(k,E){return k===E?0:k===null?1:E===null?-1:k>E?1:-1}function b(k,E){var T=k.generatedLine-E.generatedLine;return T!==0||(T=k.generatedColumn-E.generatedColumn,T!==0)||(T=v(k.source,E.source),T!==0)||(T=k.originalLine-E.originalLine,T!==0)||(T=k.originalColumn-E.originalColumn,T!==0)?T:v(k.name,E.name)}t.compareByGeneratedPositionsInflated=b;function w(k){return JSON.parse(k.replace(/^\)]}'[^\n]*\n/,""))}t.parseSourceMapInput=w;function O(k,E,T){if(E=E||"",k&&(k[k.length-1]!=="/"&&E[0]!=="/"&&(k+="/"),E=k+E),T){var N=i(T);if(!N)throw new Error("sourceMapURL could not be parsed");if(N.path){var _=N.path.lastIndexOf("/");_>=0&&(N.path=N.path.substring(0,_+1))}E=o(s(N),E)}return a(E)}t.computeSourceURL=O})(aM)),aM}var oM={},QU;function gle(){if(QU)return oM;QU=1;var t=mS(),e=Object.prototype.hasOwnProperty,n=typeof Map<"u";function r(){this._array=[],this._set=n?new Map:Object.create(null)}return r.fromArray=function(s,a){for(var o=new r,l=0,c=s.length;l=0)return a}else{var o=t.toSetString(s);if(e.call(this._set,o))return this._set[o]}throw new Error('"'+s+'" is not in the set.')},r.prototype.at=function(s){if(s>=0&&ss||a==s&&l>=o||t.compareByGeneratedPositionsInflated(r,i)<=0}function n(){this._array=[],this._sorted=!0,this._last={generatedLine:-1,generatedColumn:0}}return n.prototype.unsortedForEach=function(i,s){this._array.forEach(i,s)},n.prototype.add=function(i){e(this._last,i)?(this._last=i,this._array.push(i)):(this._sorted=!1,this._array.push(i))},n.prototype.toArray=function(){return this._sorted||(this._array.sort(t.compareByGeneratedPositionsInflated),this._sorted=!0),this._array},lM.MappingList=n,lM}var ZU;function yle(){if(ZU)return sM;ZU=1;var t=mle(),e=mS(),n=gle().ArraySet,r=WPe().MappingList;function i(s){s||(s={}),this._file=e.getArg(s,"file",null),this._sourceRoot=e.getArg(s,"sourceRoot",null),this._skipValidation=e.getArg(s,"skipValidation",!1),this._sources=new n,this._names=new n,this._mappings=new r,this._sourcesContents=null}return i.prototype._version=3,i.fromSourceMap=function(a){var o=a.sourceRoot,l=new i({file:a.file,sourceRoot:o});return a.eachMapping(function(c){var u={generated:{line:c.generatedLine,column:c.generatedColumn}};c.source!=null&&(u.source=c.source,o!=null&&(u.source=e.relative(o,u.source)),u.original={line:c.originalLine,column:c.originalColumn},c.name!=null&&(u.name=c.name)),l.addMapping(u)}),a.sources.forEach(function(c){var u=c;o!==null&&(u=e.relative(o,c)),l._sources.has(u)||l._sources.add(u);var f=a.sourceContentFor(c);f!=null&&l.setSourceContent(c,f)}),l},i.prototype.addMapping=function(a){var o=e.getArg(a,"generated"),l=e.getArg(a,"original",null),c=e.getArg(a,"source",null),u=e.getArg(a,"name",null);this._skipValidation||this._validateMapping(o,l,c,u),c!=null&&(c=String(c),this._sources.has(c)||this._sources.add(c)),u!=null&&(u=String(u),this._names.has(u)||this._names.add(u)),this._mappings.add({generatedLine:o.line,generatedColumn:o.column,originalLine:l!=null&&l.line,originalColumn:l!=null&&l.column,source:c,name:u})},i.prototype.setSourceContent=function(a,o){var l=a;this._sourceRoot!=null&&(l=e.relative(this._sourceRoot,l)),o!=null?(this._sourcesContents||(this._sourcesContents=Object.create(null)),this._sourcesContents[e.toSetString(l)]=o):this._sourcesContents&&(delete this._sourcesContents[e.toSetString(l)],Object.keys(this._sourcesContents).length===0&&(this._sourcesContents=null))},i.prototype.applySourceMap=function(a,o,l){var c=o;if(o==null){if(a.file==null)throw new Error(`SourceMapGenerator.prototype.applySourceMap requires either an explicit source file, or the source map's "file" property. Both were omitted.`);c=a.file}var u=this._sourceRoot;u!=null&&(c=e.relative(u,c));var f=new n,h=new n;this._mappings.unsortedForEach(function(p){if(p.source===c&&p.originalLine!=null){var y=a.originalPositionFor({line:p.originalLine,column:p.originalColumn});y.source!=null&&(p.source=y.source,l!=null&&(p.source=e.join(l,p.source)),u!=null&&(p.source=e.relative(u,p.source)),p.originalLine=y.line,p.originalColumn=y.column,y.name!=null&&(p.name=y.name))}var m=p.source;m!=null&&!f.has(m)&&f.add(m);var v=p.name;v!=null&&!h.has(v)&&h.add(v)},this),this._sources=f,this._names=h,a.sources.forEach(function(p){var y=a.sourceContentFor(p);y!=null&&(l!=null&&(p=e.join(l,p)),u!=null&&(p=e.relative(u,p)),this.setSourceContent(p,y))},this)},i.prototype._validateMapping=function(a,o,l,c){if(o&&typeof o.line!="number"&&typeof o.column!="number")throw new Error("original.line and original.column are not numbers -- you probably meant to omit the original mapping entirely and only map the generated position. If so, pass null for the original mapping instead of an object with empty or null values.");if(!(a&&"line"in a&&"column"in a&&a.line>0&&a.column>=0&&!o&&!l&&!c)){if(a&&"line"in a&&"column"in a&&o&&"line"in o&&"column"in o&&a.line>0&&a.column>=0&&o.line>0&&o.column>=0&&l)return;throw new Error("Invalid mapping: "+JSON.stringify({generated:a,source:l,original:o,name:c}))}},i.prototype._serializeMappings=function(){for(var a=0,o=1,l=0,c=0,u=0,f=0,h="",p,y,m,v,b=this._mappings.toArray(),w=0,O=b.length;w0){if(!e.compareByGeneratedPositionsInflated(y,b[w-1]))continue;p+=","}p+=t.encode(y.generatedColumn-a),a=y.generatedColumn,y.source!=null&&(v=this._sources.indexOf(y.source),p+=t.encode(v-f),f=v,p+=t.encode(y.originalLine-1-c),c=y.originalLine-1,p+=t.encode(y.originalColumn-l),l=y.originalColumn,y.name!=null&&(m=this._names.indexOf(y.name),p+=t.encode(m-u),u=m)),h+=p}return h},i.prototype._generateSourcesContent=function(a,o){return a.map(function(l){if(!this._sourcesContents)return null;o!=null&&(l=e.relative(o,l));var c=e.toSetString(l);return Object.prototype.hasOwnProperty.call(this._sourcesContents,c)?this._sourcesContents[c]:null},this)},i.prototype.toJSON=function(){var a={version:this._version,sources:this._sources.toArray(),names:this._names.toArray(),mappings:this._serializeMappings()};return this._file!=null&&(a.file=this._file),this._sourceRoot!=null&&(a.sourceRoot=this._sourceRoot),this._sourcesContents&&(a.sourcesContent=this._generateSourcesContent(a.sources,a.sourceRoot)),a},i.prototype.toString=function(){return JSON.stringify(this.toJSON())},sM.SourceMapGenerator=i,sM}var Kx={},cM={},GU;function qPe(){return GU||(GU=1,(function(t){t.GREATEST_LOWER_BOUND=1,t.LEAST_UPPER_BOUND=2;function e(n,r,i,s,a,o){var l=Math.floor((r-n)/2)+n,c=a(i,s[l],!0);return c===0?l:c>0?r-l>1?e(l,r,i,s,a,o):o==t.LEAST_UPPER_BOUND?r1?e(n,l,i,s,a,o):o==t.LEAST_UPPER_BOUND?l:n<0?-1:n}t.search=function(r,i,s,a){if(i.length===0)return-1;var o=e(-1,i.length,r,i,s,a||t.GREATEST_LOWER_BOUND);if(o<0)return-1;for(;o-1>=0&&s(i[o],i[o-1],!0)===0;)--o;return o}})(cM)),cM}var uM={},UU;function YPe(){if(UU)return uM;UU=1;function t(r,i,s){var a=r[i];r[i]=r[s],r[s]=a}function e(r,i){return Math.round(r+Math.random()*(i-r))}function n(r,i,s,a){if(s=0){var m=this._originalMappings[y];if(u.column===void 0)for(var v=m.originalLine;m&&m.originalLine===v;)p.push({line:t.getArg(m,"generatedLine",null),column:t.getArg(m,"generatedColumn",null),lastColumn:t.getArg(m,"lastGeneratedColumn",null)}),m=this._originalMappings[++y];else for(var b=m.originalColumn;m&&m.originalLine===f&&m.originalColumn==b;)p.push({line:t.getArg(m,"generatedLine",null),column:t.getArg(m,"generatedColumn",null),lastColumn:t.getArg(m,"lastGeneratedColumn",null)}),m=this._originalMappings[++y]}return p},Kx.SourceMapConsumer=s;function a(c,u){var f=c;typeof c=="string"&&(f=t.parseSourceMapInput(c));var h=t.getArg(f,"version"),p=t.getArg(f,"sources"),y=t.getArg(f,"names",[]),m=t.getArg(f,"sourceRoot",null),v=t.getArg(f,"sourcesContent",null),b=t.getArg(f,"mappings"),w=t.getArg(f,"file",null);if(h!=this._version)throw new Error("Unsupported version: "+h);m&&(m=t.normalize(m)),p=p.map(String).map(t.normalize).map(function(O){return m&&t.isAbsolute(m)&&t.isAbsolute(O)?t.relative(m,O):O}),this._names=n.fromArray(y.map(String),!0),this._sources=n.fromArray(p,!0),this._absoluteSources=this._sources.toArray().map(function(O){return t.computeSourceURL(m,O,u)}),this.sourceRoot=m,this.sourcesContent=v,this._mappings=b,this._sourceMapURL=u,this.file=w}a.prototype=Object.create(s.prototype),a.prototype.consumer=s,a.prototype._findSourceIndex=function(c){var u=c;if(this.sourceRoot!=null&&(u=t.relative(this.sourceRoot,u)),this._sources.has(u))return this._sources.indexOf(u);var f;for(f=0;f1&&(_.source=v+j[1],v+=j[1],_.originalLine=y+j[2],y=_.originalLine,_.originalLine+=1,_.originalColumn=m+j[3],m=_.originalColumn,j.length>4&&(_.name=b+j[4],b+=j[4])),N.push(_),typeof _.originalLine=="number"&&T.push(_)}i(N,t.compareByGeneratedPositionsDeflated),this.__generatedMappings=N,i(T,t.compareByOriginalPositions),this.__originalMappings=T},a.prototype._findMapping=function(u,f,h,p,y,m){if(u[h]<=0)throw new TypeError("Line must be greater than or equal to 1, got "+u[h]);if(u[p]<0)throw new TypeError("Column must be greater than or equal to 0, got "+u[p]);return e.search(u,f,y,m)},a.prototype.computeColumnSpans=function(){for(var u=0;u=0){var p=this._generatedMappings[h];if(p.generatedLine===f.generatedLine){var y=t.getArg(p,"source",null);y!==null&&(y=this._sources.at(y),y=t.computeSourceURL(this.sourceRoot,y,this._sourceMapURL));var m=t.getArg(p,"name",null);return m!==null&&(m=this._names.at(m)),{source:y,line:t.getArg(p,"originalLine",null),column:t.getArg(p,"originalColumn",null),name:m}}}return{source:null,line:null,column:null,name:null}},a.prototype.hasContentsOfAllSources=function(){return this.sourcesContent?this.sourcesContent.length>=this._sources.size()&&!this.sourcesContent.some(function(u){return u==null}):!1},a.prototype.sourceContentFor=function(u,f){if(!this.sourcesContent)return null;var h=this._findSourceIndex(u);if(h>=0)return this.sourcesContent[h];var p=u;this.sourceRoot!=null&&(p=t.relative(this.sourceRoot,p));var y;if(this.sourceRoot!=null&&(y=t.urlParse(this.sourceRoot))){var m=p.replace(/^file:\/\//,"");if(y.scheme=="file"&&this._sources.has(m))return this.sourcesContent[this._sources.indexOf(m)];if((!y.path||y.path=="/")&&this._sources.has("/"+p))return this.sourcesContent[this._sources.indexOf("/"+p)]}if(f)return null;throw new Error('"'+p+'" is not in the SourceMap.')},a.prototype.generatedPositionFor=function(u){var f=t.getArg(u,"source");if(f=this._findSourceIndex(f),f<0)return{line:null,column:null,lastColumn:null};var h={source:f,originalLine:t.getArg(u,"line"),originalColumn:t.getArg(u,"column")},p=this._findMapping(h,this._originalMappings,"originalLine","originalColumn",t.compareByOriginalPositions,t.getArg(u,"bias",s.GREATEST_LOWER_BOUND));if(p>=0){var y=this._originalMappings[p];if(y.source===h.source)return{line:t.getArg(y,"generatedLine",null),column:t.getArg(y,"generatedColumn",null),lastColumn:t.getArg(y,"lastGeneratedColumn",null)}}return{line:null,column:null,lastColumn:null}},Kx.BasicSourceMapConsumer=a;function l(c,u){var f=c;typeof c=="string"&&(f=t.parseSourceMapInput(c));var h=t.getArg(f,"version"),p=t.getArg(f,"sections");if(h!=this._version)throw new Error("Unsupported version: "+h);this._sources=new n,this._names=new n;var y={line:-1,column:0};this._sections=p.map(function(m){if(m.url)throw new Error("Support for url field in sections not implemented.");var v=t.getArg(m,"offset"),b=t.getArg(v,"line"),w=t.getArg(v,"column");if(b=0;l--)this.prepend(o[l]);else if(o[i]||typeof o=="string")this.children.unshift(o);else throw new TypeError("Expected a SourceNode, string, or an array of SourceNodes and strings. Got "+o);return this},s.prototype.walk=function(o){for(var l,c=0,u=this.children.length;c0){for(l=[],c=0;c{})}catch{}}function j5e(t,e){return t?e:Math.max(0,ue.getState().currentTime)}function L5e(t,e,n){return!e||t.files.length===0?!1:(Xj(()=>e(Array.from(t.files),n)),!0)}function KG(t,e,n,r,i){if(!r||!Array.from(t.types).includes(e))return!1;const s=t.getData(e);return s?R5e(s,a=>a[n],(a,o)=>Xj(()=>r(a,o)),i):!1}function F5e({scrollRef:t,ppsRef:e,durationRef:n,trackOrderRef:r,rowGeometryRef:i,contentOrigin:s,onFileDrop:a,onAssetDrop:o,onBlockDrop:l,onCompositionDrop:c,sessionEpoch:u}){const[f,h]=x.useState(!1),p=x.useRef(null),y=x.useRef(0),m=x.useRef(null),v=x.useCallback(()=>{p.current=null,y.current&&cancelAnimationFrame(y.current),y.current=0},[]),b=x.useCallback(function _(){y.current=0;const I=p.current,j=t.current;!I||I.sessionEpoch!==u||!j||EE(j,I.clientX,I.clientY)&&(y.current=requestAnimationFrame(_))},[t,u]),w=x.useCallback((_,I)=>{p.current={clientX:_,clientY:I,sessionEpoch:u};const j=t.current,L=cS(j,_,I,y.current!==0);L==="stop"?(cancelAnimationFrame(y.current),y.current=0):L==="start"&&(y.current=requestAnimationFrame(b))},[t,u,b]),O=x.useCallback(_=>{const I=Array.from(_.dataTransfer.types),j=I.includes("Files"),L=I.includes(N6),B=I.includes(K1),$=I.includes(l_);!j&&!L&&!B&&!$||(_.preventDefault(),_.dataTransfer.dropEffect="copy",m.current=u,h(!0),w(_.clientX,_.clientY))},[u,w]),k=x.useCallback(()=>{m.current=null,v(),h(!1)},[v]),E=x.useCallback(_=>{const I=_.relatedTarget;I instanceof Node&&_.currentTarget.contains(I)||k()},[k]),T=x.useCallback((_,I,j=!1)=>{const L=t.current,B=L==null?void 0:L.getBoundingClientRect(),$=B3e({rectLeft:(B==null?void 0:B.left)??0,rectTop:(B==null?void 0:B.top)??0,scrollLeft:(L==null?void 0:L.scrollLeft)??0,scrollTop:(L==null?void 0:L.scrollTop)??0,contentOrigin:s,pixelsPerSecond:e.current,duration:n.current,clampStartToDuration:!j,rowHeights:i.current.rowHeights,trackOrder:r.current},_,I);return{start:j5e(j,$.start),track:$.track}},[t,e,n,r,i,s]),N=x.useCallback(_=>{_.preventDefault();const I=m.current===u;if(k(),!I)return;const j=_5e(_.dataTransfer.getData(l_));if(j&&c){const B=T(_.clientX,_.clientY,!0);Xj(()=>c(j.sourcePath,B));return}const L=T(_.clientX,_.clientY);L5e(_.dataTransfer,a,L)||KG(_.dataTransfer,N6,"path",o,L)||KG(_.dataTransfer,K1,"name",l,L)},[k,o,l,c,a,T,u]);return x.useEffect(()=>(window.addEventListener("dragend",k),()=>{window.removeEventListener("dragend",k),k()}),[k]),x.useEffect(()=>k(),[k,u]),{isDragOver:f,handleAssetDragOver:O,handleAssetDragLeave:E,handleAssetDrop:N,clearDropPreview:k}}function $5e({isDragOver:t,onFileDrop:e,onDragOver:n,onDragLeave:r,onDrop:i}){return d.jsxs("div",{className:`h-full border-t bg-[#0a0a0b] flex flex-col select-none transition-colors duration-150 ${t?"border-studio-accent/50 bg-studio-accent/[0.03]":"border-neutral-800/50"}`,onDragOver:n,onDragLeave:r,onDrop:i,children:[d.jsx("div",{className:"flex-shrink-0 border-b border-neutral-800/40 flex items-end relative",style:{height:Ra,paddingLeft:W2},children:[0,10,20,30,40,50].map(s=>d.jsxs("div",{className:"flex flex-col items-center",style:{position:"absolute",left:W2+s*14},children:[d.jsx("span",{className:"text-[9px] text-neutral-600 font-mono tabular-nums leading-none mb-0.5",children:`${Math.floor(s/60).toString().padStart(2,"0")}:${(s%60).toString().padStart(2,"0")}`}),d.jsx("div",{className:"w-px h-[5px] bg-neutral-700/40"})]},s))}),d.jsx("div",{className:"flex-1 flex items-center justify-center",children:d.jsx("div",{className:`flex items-center gap-3 px-6 py-3 border border-dashed rounded-lg transition-colors duration-150 ${t?"border-studio-accent/60 bg-studio-accent/[0.06]":"border-neutral-700/50"}`,children:t?d.jsxs(d.Fragment,{children:[d.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",className:"text-studio-accent flex-shrink-0",children:[d.jsx("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}),d.jsx("polyline",{points:"7 10 12 15 17 10"}),d.jsx("line",{x1:"12",y1:"15",x2:"12",y2:"3"})]}),d.jsx("span",{className:"text-[13px] text-studio-accent",children:"Drop media files to import"})]}):d.jsxs(d.Fragment,{children:[d.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",className:"text-neutral-600 flex-shrink-0",children:[d.jsx("rect",{x:"2",y:"2",width:"20",height:"20",rx:"2"}),d.jsx("path",{d:"M7 2v20"}),d.jsx("path",{d:"M17 2v20"}),d.jsx("path",{d:"M2 7h20"}),d.jsx("path",{d:"M2 17h20"})]}),d.jsx("span",{className:"text-[13px] text-neutral-500",children:e?"Drop media here or describe your video to start":"Describe your video to start creating"})]})})})]})}function Jae(t,e,n){const r=[.02,.05,.1,.2,.5,1,2,5,10,15,30,60,120,300,600,900,1800,3600];let i;if(Number.isFinite(e)&&(e??0)>0)i=r.find(a=>a*(e??0)>=88)??3600;else{const s=[.25,.5,1,2,5,10,15,30,60],a=t/6;i=s.find(o=>o>=a)??60}if(Number.isFinite(n)&&(n??0)>0){const s=n??0;return Math.max(1,Math.ceil(i*s-1e-6))/s}return i}function B5e(t,e,n){const r=Number.isFinite(e)?e??0:0;if(r<=0)return 4;const i=Number.isFinite(n)?n??0:0,s=i>0?Math.round(t*i):0,a=i>0?[4,5,3,2]:[4,2];for(const o of a)if(!(i>0&&s%o!==0)&&t/o*r>=8)return o;return 0}function eoe(t){return Math.round(t*1e6)/1e6}function V5e(t){return t>0&&Number.isFinite(t)&&t<=14400}function H5e(t,e){return{start:Math.max(0,(e==null?void 0:e.start)??0),end:Math.min(t,(e==null?void 0:e.end)??t)}}function Q5e(t,e,n,r,i,s,a){for(let o=1;o=i.start-.001&&l<=i.end+.001&&t.push(eoe(l))}}function z5e(t,e,n,r){if(!V5e(t))return{major:[],minor:[]};const i=Jae(t,e,n),s=B5e(i,e,n),a=s>0?i/s:0,o=[],l=[],c=2e3,u=H5e(t,r),f=Math.max(0,Math.floor(u.start/i));for(let h=f;o.lengthu.end+.001)break;p>=u.start-.001&&o.push(eoe(p)),Q5e(l,p,a,s,u,c,o.length)}return{major:o,minor:l}}function Z5e(t,e,n){if(!Number.isFinite(t))return"00:00";const r=Math.max(0,t);if(n<.1){const i=Math.round(r*100),s=Math.floor(i/100),a=i%100;return`${os(s)}.${a.toString().padStart(2,"0")}`}if(n<1){const i=Math.round(r*10),s=Math.floor(i/10),a=i%10;return`${os(s)}.${a}`}if(e>=3600||r>=3600){const i=Math.floor(r),s=Math.floor(i/3600),a=Math.floor(i%3600/60),o=i%60;return`${s}:${a.toString().padStart(2,"0")}:${o.toString().padStart(2,"0")}`}return os(r)}const G5e=x.memo(function({major:e,minor:n,pps:r,trackContentWidth:i,totalH:s,effectiveDuration:a,majorTickInterval:o,theme:l,beatAnalysis:c,contentOrigin:u,renderTimeRange:f}){const h=ue(w=>w.timeDisplayMode),p=(c==null?void 0:c.beatTimes)??[],y=(c==null?void 0:c.beatStrengths)??[],m=$j(p,y,f),v=p.length>1?(p[p.length-1]-p[0])/(p.length-1):null,b=v!==null&&v*r>=5;return d.jsxs(d.Fragment,{children:[d.jsx("svg",{className:"absolute pointer-events-none",style:{left:u,width:i,zIndex:0},height:s,children:b&&m.map(({time:w,index:O,strength:k})=>{const E=w*r,N=.08+Math.pow(Math.min(1,k??.5),2.2)*.62;return d.jsx("line",{"data-timeline-grid-cell":"beat",x1:E,y1:0,x2:E,y2:s,stroke:`rgba(34, 197, 94, ${N.toFixed(3)})`,strokeWidth:"1"},`b-${w}-${O}`)})}),d.jsxs("div",{className:"sticky top-0 flex",style:{height:Ra,width:u+i,zIndex:70},children:[d.jsx("div",{className:"sticky left-0 z-[12] flex-shrink-0",style:{width:u,background:l.shellBackground}}),d.jsxs("div",{className:"relative overflow-hidden",style:{height:Ra,width:i,background:l.shellBackground},children:[n.map(w=>d.jsx("div",{"data-timeline-grid-cell":"minor",className:"absolute bottom-0",style:{left:w*r-.5},children:d.jsx("div",{className:"w-px h-2",style:{background:l.tickMinor}})},`m-${w}`)),e.map(w=>d.jsxs("div",{"data-timeline-grid-cell":"major",className:"absolute top-0",style:{left:w*r-.5},children:[d.jsx("span",{className:"absolute font-mono tabular-nums leading-none whitespace-nowrap",style:{color:l.tickText,left:5,top:5,fontSize:10},children:h==="frame"?Zv(w):Z5e(w,a,o)}),d.jsx("div",{className:"w-px",style:{height:Ra,background:l.tickMajor}})]},`M-${w}`))]})]})]})});function U5e({color:t="var(--hf-accent, #3CE6AC)",glowColor:e="rgba(60,230,172,0.14)",scrubbing:n=!1,stickyHead:r=!0}){const i=M6,s=9,a=1+s;return d.jsxs(d.Fragment,{children:[d.jsx("div",{"aria-hidden":"true",className:"absolute top-0 bottom-0",style:{left:"50%",width:13,transform:"translateX(-50%)",background:`radial-gradient(closest-side, ${e}, transparent)`}}),d.jsx("div",{className:"absolute bottom-0",style:{left:"50%",top:a,width:1,marginLeft:-.5,background:t,boxShadow:`0 0 6px ${e}`}}),d.jsx("div",{className:r?"sticky":"absolute",style:{left:0,top:r?0:1,height:r?0:void 0},children:d.jsx("div",{style:{width:i,height:s,borderRadius:2,marginTop:1,background:n?t:"transparent",border:`1.5px solid ${t}`,boxSizing:"border-box",boxShadow:`0 1px 3px rgba(0,0,0,0.55), 0 0 5px ${e}`,transform:"rotate(45deg)"}})})]})}const Wj=Rc("TimelineEditContext",null);function X5e(){const t=x.useContext(Wj);if(!t)throw new Error("useTimelineEditContext must be used within TimelineEditProvider");return t}function fS(){return x.useContext(Wj)??{}}function W5e({value:t,children:e}){const n=x.useMemo(()=>t,[t.onMoveElement,t.onMoveElements,t.onResizeElement,t.onToggleTrackHidden,t.onSetAudioGroupAttributeLive,t.onSetAudioGroupAttributeQuiet,t.onGroupClips,t.onSetElementAttributeLive,t.onSetElementAttributeQuiet,t.onBlockedEditAttempt,t.onSplitElement,t.onRazorSplit,t.onRazorSplitAll,t.onDeleteKeyframe,t.onDeleteAllKeyframes,t.onMoveKeyframeToPlayhead,t.onMoveKeyframe,t.onToggleKeyframeAtPlayhead,t.onTogglePropertyGroupKeyframe]);return d.jsx(Wj.Provider,{value:n,children:e})}const q2=14,GP=24;let Uo=null,cu=0,Qb=null,P1=null;const c_=new Set;function qj(t){Uo=t;for(const e of c_)e()}function q5e(t){return c_.add(t),()=>c_.delete(t)}function JG(){return Uo}function Y5e(t){var e,n;cu!==0&&(cancelAnimationFrame(cu),cu=0),Qb==null||Qb(),Qb=null,P1==null||P1.disconnect(),P1=null,window.removeEventListener("pointermove",roe),window.removeEventListener("pointerup",ioe),window.removeEventListener("pointercancel",D6),window.removeEventListener("lostpointercapture",D6),window.removeEventListener("keydown",soe),window.removeEventListener("blur",Y2);try{(n=(e=t.scroll).hasPointerCapture)!=null&&n.call(e,t.pointerId)&&t.scroll.releasePointerCapture(t.pointerId)}catch{}ue.getState().setBeatDragging(!1)}function Yj(t){const e=Uo;return!e||t!==void 0&&e.pointerId!==t?null:(qj(null),Y5e(e),e)}function Y2(){Yj()}function toe(t){return Math.max(0,t.originalTime+t.dx/t.pixelsPerSecond)}function Kj(t,e){const n=y0(e.elements).musicElement;if(!t.scroll.isConnected||e.timelineSessionEpoch!==t.sessionEpoch||e.timelineProjectId!==t.projectId||n!==t.musicElement||(n.key??n.id)!==t.musicKey||n.src!==t.musicSrc)return!1;const r=mae(e.beatAnalysis,n,e.beatEdits);return(r==null?void 0:r.beatTimes.some(i=>Math.abs(i-t.originalTime)<.001))===!0}function Jj(t,e){const n=Uo;if(!n)return null;const r=t-n.startX,i={...n,clientX:t,clientY:e,dx:r+n.scroll.scrollLeft-n.startScrollLeft,started:n.started||Math.abs(r)>2};return qj(i),ue.getState().requestSeek(toe(i)),i}function noe(){cu=0;const t=Uo;t!=null&&t.started&&EE(t.scroll,t.clientX,t.clientY)&&(Jj(t.clientX,t.clientY),cu=requestAnimationFrame(noe))}function K5e(t){const e=cS(t.scroll,t.clientX,t.clientY,cu!==0);e==="start"&&t.started?cu=requestAnimationFrame(noe):e==="stop"&&cu!==0&&(cancelAnimationFrame(cu),cu=0)}function roe(t){if(t.pointerId!==(Uo==null?void 0:Uo.pointerId))return;t.preventDefault();const e=Jj(t.clientX,t.clientY);e&&K5e(e)}function ioe(t){if(t.pointerId!==(Uo==null?void 0:Uo.pointerId))return;const e=Jj(t.clientX,t.clientY),n=Yj(t.pointerId);if(!n||!(e!=null&&e.started))return;const r=ue.getState();if(!Kj(n,r))return;const i=toe(e);_ke(n.originalTime,i),r.requestSeek(i)}function D6(t){Yj(t.pointerId)}function soe(t){t.key!=="Escape"||!Uo||(t.preventDefault(),Y2())}function J5e(t,e){return t.button!==0||!(e>0)?null:t.currentTarget.closest("[data-timeline-scroll-viewport]")}function eTe(t,e,n,r){const i=ue.getState(),s=y0(i.elements).musicElement;if(!(s!=null&&s.src))return null;const a={pointerId:t.pointerId,startX:t.clientX,clientX:t.clientX,clientY:t.clientY,originalTime:e,pixelsPerSecond:n,startScrollLeft:r.scrollLeft,dx:0,started:!1,sessionEpoch:i.timelineSessionEpoch,projectId:i.timelineProjectId,musicElement:s,musicKey:s.key??s.id,musicSrc:s.src,scroll:r};return Kj(a,i)?a:null}function tTe(t){var r,i;qj(t),window.addEventListener("pointermove",roe),window.addEventListener("pointerup",ioe),window.addEventListener("pointercancel",D6),window.addEventListener("lostpointercapture",D6),window.addEventListener("keydown",soe),window.addEventListener("blur",Y2),Qb=ue.subscribe((s,a)=>{s.timelineSessionEpoch===a.timelineSessionEpoch&&s.timelineProjectId===a.timelineProjectId&&s.elements===a.elements&&s.beatAnalysis===a.beatAnalysis&&s.beatEdits===a.beatEdits||Kj(t,s)||Y2()});const e=t.scroll.parentNode;e&&(P1=new MutationObserver(()=>{t.scroll.isConnected||Y2()}),P1.observe(e,{childList:!0}));try{(i=(r=t.scroll).setPointerCapture)==null||i.call(r,t.pointerId)}catch{}const n=ue.getState();n.setBeatDragging(!0),n.requestSeek(Math.max(0,t.originalTime))}function nTe(t,e,n){if(Uo)return;const r=J5e(t,n);if(!r)return;const i=eTe(t,e,n,r);i&&tTe(i)}function aoe(t,e){return t.length<2?!0:(t[t.length-1]-t[0])/(t.length-1)*e<5}const rTe=x.memo(function({beatTimes:e,beatStrengths:n,pps:r,highlightTime:i,renderTimeRange:s}){const a=e&&!aoe(e,r)?e:null,o=i!=null&&(a==null?void 0:a.some(c=>Math.abs(c-i)<.001))===!0;if(!a&&i==null)return null;const l=$j(a??void 0,n,s);return d.jsxs("div",{className:"absolute inset-0 pointer-events-none",style:{zIndex:0},children:[l.map(({time:c,index:u,strength:f})=>{const h=i!=null&&Math.abs(c-i)<.001,p=Math.pow(Math.min(1,f??.5),2.2),y=h?1:.06+p*.16;return d.jsx("div",{className:"absolute top-0 bottom-0",style:{left:c*r,width:h?2:1,background:`rgba(34,197,94,${y.toFixed(3)})`,boxShadow:h?"0 0 6px rgba(34,197,94,0.9)":void 0,zIndex:h?1:void 0}},`${c}-${u}`)}),i!=null&&!o&&d.jsx("div",{className:"absolute top-0 bottom-0",style:{left:i*r,width:2,background:"rgba(34,197,94,1)",boxShadow:"0 0 6px rgba(34,197,94,0.9)",zIndex:1}})]})}),iTe=x.memo(function({beatTimes:e,beatStrengths:n,pps:r,renderTimeRange:i}){const s=x.useSyncExternalStore(q5e,JG,JG),a=ue(h=>h.timelineSessionEpoch),o=ue(h=>h.timelineProjectId);if(!e||aoe(e,r))return null;const l=s?e.findIndex(h=>Math.abs(h-s.originalTime)<.001):-1,c=s&&s.sessionEpoch===a&&s.projectId===o&&l>=0?s:null,u=q2/2,f=$j(e,n,i,c?new Set([l]):void 0);return d.jsx("div",{className:"absolute left-0 right-0 pointer-events-none",style:{top:ha,height:q2,background:"rgba(0,0,0,0.28)",zIndex:11},children:f.map(({time:h,index:p,strength:y})=>{const m=Math.pow(Math.min(1,y??.5),2.2),v=1.5+m*2.5,b=.25+m*.75,w=c&&l===p?c.dx:0,O=h*r+w;return d.jsx("div",{className:"absolute select-none",title:"Drag to move · ⌥-click to delete",draggable:!1,style:{left:O-GP/2,top:0,width:GP,height:q2,cursor:"ew-resize",pointerEvents:"auto",touchAction:"none"},onPointerDown:k=>{k.preventDefault(),k.stopPropagation(),!k.altKey&&nTe(k,h,r)},onClick:k=>{k.altKey&&(k.stopPropagation(),Ike(h),ue.getState().requestSeek(Math.max(0,h)))},children:d.jsx("div",{className:"absolute",style:{left:GP/2-v,top:u-v,width:v*2,height:v*2,borderRadius:"50%",background:`rgba(34,197,94,${b.toFixed(3)})`,pointerEvents:"none"}})},`${h}-${p}`)})})});function Cf(t,e){return e.propertyGroup?JSON.stringify([t,e.propertyGroup,e.animationId??"",e.percentage,e.tweenPercentage??e.percentage]):`${t}:${e.percentage}`}function sTe(t,e){if(e.startsWith("[")){let i;try{i=JSON.parse(e)}catch{return null}if(!Array.isArray(i)||i.length!==5)return null;const[s,a,o,l,c]=i;return s!==t||typeof a!="string"||a.length===0||typeof o!="string"||typeof l!="number"||!Number.isFinite(l)||typeof c!="number"||!Number.isFinite(c)?null:{propertyGroup:a,animationId:o||void 0,percentage:l,tweenPercentage:c}}const n=e.lastIndexOf(":");if(n<0||e.slice(0,n)!==t)return null;const r=Number(e.slice(n+1));return Number.isFinite(r)?{percentage:r}:null}function Q0(t,...e){return JSON.stringify(["timeline",t,...e])}function aTe(t){return Q0("track",t)}function oTe(t){return Q0("group",t)}function K2(t,e){return Q0("property",t,e)}function I6(t,e,n){return`${t}-${Q0("cell",e,n)}`}function hS(t){return Q0("clip",t)}function ooe(t,e){return Q0("keyframe",Cf(t,e))}function loe(t,e){return Q0("ease",Cf(t,e))}const coe=x.memo(function({el:e,pps:n,clipY:r,clipHeight:i,isSelected:s,isHovered:a,isDragging:o=!1,isGestureActor:l=!1,isActive:c=!1,hasCustomContent:u,capabilities:f,theme:h=Fj,isComposition:p,tabIndex:y=-1,onHoverStart:m,onHoverEnd:v,onPointerDown:b,onResizeStart:w,onClick:O,onDoubleClick:k,onContextMenu:E,children:T}){const N=e.start*n,_=Math.max(e.duration*n,4),I=l3e({isHovered:a,isSelected:s,isDragging:o}),j=e.label||e.id||e.tag,L=I>.01&&(_>=32||s),B=_>=40||s,$=!u&&(_>=40||s),z=e.start.toFixed(1),Y=(e.start+e.duration).toFixed(1),W=["timeline-clip","absolute",u?"overflow-visible":"overflow-hidden",s?"is-selected":"",a?"is-hovered":"",o?"is-dragging":"",$?"":"is-micro",Jo(e)?"is-audio":""].filter(ne=>ne.length>0).join(" "),J={left:N,width:_,top:r,...i===void 0?{bottom:r}:{height:i},borderRadius:h.clipRadius,zIndex:o?20:s?10:a?5:1,cursor:"default",appearance:"none",color:"inherit",font:"inherit",padding:0,textAlign:"left",transform:o?"translateY(-1px)":void 0};return d.jsxs("button",{type:"button","data-clip":l?void 0:"true","data-el-id":l?void 0:e.key??e.id,"data-timeline-focus-id":l?void 0:hS(e.key??e.id),"data-clip-start":e.start,"data-clip-end":e.start+e.duration,"data-clip-audio":Jo(e)?"true":void 0,"data-clip-hidden":e.hidden?"true":void 0,"data-active":c?"":void 0,"aria-hidden":l?"true":void 0,tabIndex:l?void 0:y,"aria-label":`${j}, ${z} to ${Y} seconds`,"aria-pressed":l?void 0:s,className:W,style:J,title:p?`${e.compositionSrc} • Double-click to open`:`${j} • ${e.start.toFixed(1)}s – ${(e.start+e.duration).toFixed(1)}s`,onPointerEnter:m,onPointerLeave:v,onPointerDown:b,onClick:O,onDoubleClick:k,onContextMenu:E,children:[L&&f.canTrimStart&&d.jsx("div",{"aria-hidden":"true",onPointerDown:ne=>w==null?void 0:w("start",ne),style:{position:"absolute",left:0,top:0,bottom:0,width:14,cursor:"col-resize",zIndex:4},children:d.jsx("div",{className:"timeline-clip__handle-bar",style:{position:"absolute",left:4,top:6,bottom:6,width:2,borderRadius:1,background:"rgba(255, 255, 255, 0.55)",opacity:I*.6}})}),L&&f.canTrimEnd&&d.jsx("div",{"aria-hidden":"true","data-croco-timeline-resize-edge":"end",onPointerDown:ne=>w==null?void 0:w("end",ne),style:{position:"absolute",right:0,top:0,bottom:0,width:14,cursor:"col-resize",zIndex:4},children:d.jsx("div",{className:"timeline-clip__handle-bar",style:{position:"absolute",right:4,top:6,bottom:6,width:2,borderRadius:1,background:"rgba(255, 255, 255, 0.55)",opacity:I*.6}})}),B&&d.jsx("span",{className:"timeline-clip__label",children:j}),$&&d.jsxs("span",{className:"timeline-clip__timecode",children:[z,"-",Y,"s"]}),T]})}),eL=4,lTe=.1,eU=.5,cTe=(t,e,n)=>Math.max(e,Math.min(n,t));function uoe(t,e,n){const r=n>0?(e[n-1]??0)+eU:0,i=ni?(r+i)/2:cTe(t,r,i)}function uTe(t){const e=t.pointerUpX-t.pointerDownX;if(Math.abs(e)=1)return 1;const n=foe(e),r=12-n*6,i=Math.PI*2*(1+n*1.5),s=1-Math.exp(-r)*Math.cos(i);return(1-Math.exp(-r*t)*Math.cos(i*t))/s}const dTe=/^\s*wiggle\(\s*(\d+)\s*,\s*(easeOut|easeInOut|anticipate|uniform)\s*(?:,\s*([+-]?(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+)?)\s*)?\)\s*$/,pTe=Math.PI*2;function nL(t){const e=dTe.exec(t);if(!e)return null;const n=Number(e[1]);if(!Number.isSafeInteger(n)||n<1)return null;const r=e[2];if(r!=="easeOut"&&r!=="easeInOut"&&r!=="anticipate"&&r!=="uniform")return null;if(e[3]===void 0)return{wiggles:n,type:r};const i=Number(e[3]);return!Number.isFinite(i)||i<0||i>1?null:{wiggles:n,type:r,amplitude:i}}function doe(t,e,n,r){if(!Number.isFinite(t))return t;if(t<=0)return 0;if(t>=1)return 1;const i=r??(n==="easeInOut"?.08:n==="uniform"?.14:n==="anticipate"?.12:.16),s=n==="easeInOut"?i*Math.sin(Math.PI*t):n==="uniform"?i:i*(1-t);return t+(n==="anticipate"?-1:1)*s*Math.sin(pTe*e*t)}const poe=[{id:"linear",label:"Linear",ease:"none",kind:"curve"},{id:"ease-in",label:"Ease In",ease:"power1.in",kind:"curve"},{id:"quad-in",label:"Quad In",ease:"power2.in",kind:"curve"},{id:"cubic-in",label:"Cubic In",ease:"power3.in",kind:"curve"},{id:"ease-out",label:"Ease Out",ease:"power1.out",kind:"curve"},{id:"quad-out",label:"Quad Out",ease:"power2.out",kind:"curve"},{id:"cubic-out",label:"Cubic Out",ease:"power3.out",kind:"curve"},{id:"ease",label:"Ease In & Out",ease:"power1.inOut",kind:"curve"},{id:"quad-ease",label:"Quad Ease",ease:"power2.inOut",kind:"curve"},{id:"cubic-ease",label:"Cubic Ease",ease:"power3.inOut",kind:"curve"},{id:"circular-ease",label:"Circular Ease",ease:"circ.inOut",kind:"curve"},{id:"rebound-in",label:"Ease In Back",ease:"back.in",kind:"curve"},{id:"rebound-out",label:"Ease Out Back",ease:"back.out",kind:"curve"},{id:"flow-1",label:"Flow 1",ease:"wiggle(1,easeInOut,0.20)",kind:"wiggle"},{id:"flow-2",label:"Flow 2",ease:"wiggle(2,easeInOut,0.15)",kind:"wiggle"},{id:"flow-3",label:"Flow 3",ease:"wiggle(3,easeInOut,0.12)",kind:"wiggle"},{id:"flow-4",label:"Flow 4",ease:"wiggle(4,easeInOut,0.10)",kind:"wiggle"},{id:"flow-5",label:"Flow 5",ease:"wiggle(5,easeInOut,0.08)",kind:"wiggle"},{id:"flow-6",label:"Flow 6",ease:"wiggle(6,easeInOut,0.07)",kind:"wiggle"},{id:"flow-7",label:"Flow 7",ease:"wiggle(7,easeInOut,0.06)",kind:"wiggle"},{id:"bounce-1",label:"Bounce 1",ease:"wiggle(4,easeOut,0.22)",kind:"wiggle"},{id:"bounce-2",label:"Bounce 2",ease:"wiggle(6,easeOut,0.26)",kind:"wiggle"},{id:"bounce-3",label:"Bounce 3",ease:"wiggle(9,uniform,0.32)",kind:"wiggle"},{id:"bounce-4",label:"Bounce 4",ease:"wiggle(5,anticipate,0.28)",kind:"wiggle"},{id:"hold",label:"Hold",ease:"hold",kind:"curve"},{id:"rebound-ease",label:"Ease In & Out Back",ease:"back.inOut",kind:"curve"},{id:"expo-in",label:"Expo In",ease:"expo.in",kind:"curve"},{id:"expo-out",label:"Expo Out",ease:"expo.out",kind:"curve"},{id:"spring-gentle",label:"Gentle",ease:"spring(0.15)",kind:"spring"},{id:"spring-quick",label:"Quick",ease:"spring(0.4)",kind:"spring"},{id:"spring-bouncy",label:"Bouncy",ease:"spring(0.6)",kind:"spring"},{id:"spring-slow",label:"Slow",ease:"spring(0.25)",kind:"spring"}];function mTe(t){var e;return((e=poe.find(n=>n.ease===t))==null?void 0:e.label)??null}const u_=".hyperframes/studio-motion.json",UP="studio-motion",moe="data-hf-studio-motion",zb={x1:.215,y1:.61,x2:.355,y2:1},gTe={none:{x1:0,y1:0,x2:1,y2:1},"power1.in":{x1:.55,y1:.085,x2:.68,y2:.53},"power1.out":{x1:.25,y1:.46,x2:.45,y2:.94},"power1.inOut":{x1:.455,y1:.03,x2:.515,y2:.955},"power2.in":{x1:.55,y1:.055,x2:.675,y2:.19},"power2.out":{x1:.215,y1:.61,x2:.355,y2:1},"power2.inOut":{x1:.645,y1:.045,x2:.355,y2:1},"power3.in":{x1:.895,y1:.03,x2:.685,y2:.22},"power3.out":{x1:.165,y1:.84,x2:.44,y2:1},"power3.inOut":{x1:.77,y1:0,x2:.175,y2:1},"power4.in":{x1:.755,y1:.05,x2:.855,y2:.06},"power4.out":{x1:.23,y1:1,x2:.32,y2:1},"power4.inOut":{x1:.86,y1:0,x2:.07,y2:1},"sine.in":{x1:.47,y1:0,x2:.745,y2:.715},"sine.out":{x1:.39,y1:.575,x2:.565,y2:1},"sine.inOut":{x1:.445,y1:.05,x2:.55,y2:.95},"expo.in":{x1:.95,y1:.05,x2:.795,y2:.035},"expo.out":{x1:.19,y1:1,x2:.22,y2:1},"expo.inOut":{x1:1,y1:0,x2:0,y2:1},"circ.in":{x1:.6,y1:.04,x2:.98,y2:.335},"circ.out":{x1:.075,y1:.82,x2:.165,y2:1},"circ.inOut":{x1:.785,y1:.135,x2:.15,y2:.86},"back.in(1.7)":{x1:.6,y1:-.28,x2:.735,y2:.045},"back.out(1.7)":{x1:.175,y1:.885,x2:.32,y2:1.275},"back.inOut(1.7)":{x1:.68,y1:-.55,x2:.265,y2:1.55},"elastic.out(1, 0.45)":{x1:.16,y1:1.32,x2:.28,y2:.86},"bounce.out":{x1:.34,y1:1.56,x2:.64,y2:.74}},yTe=/^M\s*0\s*,\s*0\s*C\s*(-?\d+(?:\.\d+)?)\s*,\s*(-?\d+(?:\.\d+)?)\s+(-?\d+(?:\.\d+)?)\s*,\s*(-?\d+(?:\.\d+)?)\s+1\s*,\s*1\s*$/i;function BO(t){return Xt(t)}function VO(t,e,n,r){return Number.isFinite(t)?Math.min(n,Math.max(e,t)):r}function f_(t){return typeof t=="number"&&Number.isFinite(t)?t:null}function xTe(t){return{x1:BO(VO(t.x1??zb.x1,0,1,.215)),y1:BO(VO(t.y1??zb.y1,-.6,1.6,.61)),x2:BO(VO(t.x2??zb.x2,0,1,.355)),y2:BO(VO(t.y2??zb.y2,-.6,1.6,1))}}function bTe(t){if(!t)return null;const e=t.trim().match(yTe);if(!e)return null;const n={x1:Number.parseFloat(e[1]??""),y1:Number.parseFloat(e[2]??""),x2:Number.parseFloat(e[3]??""),y2:Number.parseFloat(e[4]??"")};return Object.values(n).every(Number.isFinite)?xTe(n):null}function goe(t){return gTe[t]??zb}function tU(t){if(!t||typeof t!="object")return null;const e=t,n={};for(const r of["x","y","scale","rotation","opacity","autoAlpha"]){const i=f_(e[r]);i!=null&&(n[r]=i)}return Object.keys(n).length>0?n:null}function vTe(t){if(!t||typeof t!="object")return;const e=t,n=typeof e.id=="string"?e.id.trim():"",r=typeof e.data=="string"?e.data.trim():"";if(!(!n||!r))return{id:n,data:r}}function ATe(t){const e=t.getAttribute(moe);if(!e||e==="true")return null;try{const n=JSON.parse(e);if(!n||typeof n!="object")return null;const r=n,i=f_(r.start),s=f_(r.duration);if(i==null||s==null||i<0||s<=0)return null;const a=typeof r.ease=="string"&&r.ease.trim()?r.ease.trim():"none",o=tU(r.from),l=tU(r.to);return!o||!l?null:{start:i,duration:s,ease:a,customEase:vTe(r.customEase),from:o,to:l}}catch{return null}}function STe(t,e){var n,r,i,s;try{const a=(r=(n=t.__player)==null?void 0:n.getTime)==null?void 0:r.call(n);if(typeof a=="number"&&Number.isFinite(a))return Math.max(0,a)}catch{}try{const a=(s=(i=t.__timeline)==null?void 0:i.time)==null?void 0:s.call(i);if(typeof a=="number"&&Number.isFinite(a))return Math.max(0,a)}catch{}return 0}function wTe(t,e){var c,u,f,h,p,y;const n=t.defaultView;if(!n)return 0;const r=n.gsap;n.__timelines=n.__timelines??{},(u=(c=n.__timelines[UP])==null?void 0:c.kill)==null||u.call(c),delete n.__timelines[UP];const i=(f=t.defaultView)==null?void 0:f.HTMLElement;if(!i)return 0;const s=[];for(const m of Array.from(t.querySelectorAll(`[${moe}]`))){if(!(m instanceof i))continue;const v=ATe(m);v&&s.push({element:m,motion:v})}if(!(r!=null&&r.timeline)||s.length===0)return 0;const a=r.timeline({paused:!0,defaults:{overwrite:"auto"}});let o=0;for(const{element:m,motion:v}of s){if(!a.fromTo)continue;const b={...v.from},w=OTe(n,v),O={...v.to,duration:v.duration,ease:w,overwrite:"auto",immediateRender:!1};a.fromTo(m,b,O,v.start),o+=1}if(o===0)return(h=a.kill)==null||h.call(a),0;n.__timelines[UP]=a,(p=a.pause)==null||p.call(a);const l=STe(n);return a.totalTime?a.totalTime(l,!1):(y=a.time)==null||y.call(a,l),o}function OTe(t,e){var i,s;const n=e.customEase;if(!n)return e.ease;const r=t.CustomEase;if(typeof(r==null?void 0:r.create)!="function")return e.ease;try{return(s=(i=t.gsap)==null?void 0:i.registerPlugin)==null||s.call(i,r),r.create(n.id,n.data),n.id}catch{return e.ease}}const CTe={set:"Set",to:"Animate",from:"Animate In",fromTo:"From → To"},yoe={set:"Instantly snap to these values — no transition",to:"Smoothly animate the element to these target values",from:"Element starts at these values and transitions to its normal state",fromTo:"Animate from one state to another"},gd={x:"Move X",y:"Move Y",width:"Width",height:"Height",rotation:"Rotate",z:"Move Z",rotationX:"Rotate X",rotationY:"Rotate Y",rotationZ:"Rotate Z",perspective:"Perspective",transformPerspective:"Perspective",transformOrigin:"Transform Origin",opacity:"Opacity",scale:"Scale",scaleX:"Scale X",scaleY:"Scale Y",autoAlpha:"Visibility",visibility:"Visible",scaleX_alias:"Stretch X",filter:"Filter",clipPath:"Clip Path",color:"Color",backgroundColor:"Background",borderColor:"Border Color",borderRadius:"Radius",fontSize:"Font Size",letterSpacing:"Tracking",skewX:"Skew X",skewY:"Skew Y",innerText:"Counter Value"},xoe={x:"px",y:"px",width:"px",height:"px",rotation:"°",z:"px",rotationX:"°",rotationY:"°",rotationZ:"°",perspective:"px",transformPerspective:"px",transformOrigin:"",opacity:"%",scale:"×",scaleX:"×",scaleY:"×",autoAlpha:"%",visibility:""},kTe={x:"Move left/right (negative = left, positive = right)",y:"Move up/down (negative = up, positive = down)",opacity:"How visible (0 = invisible, 1 = fully visible)",scale:"Size multiplier (1 = normal, 2 = double, 0.5 = half)",scaleX:"Horizontal stretch (1 = normal)",scaleY:"Vertical stretch (1 = normal)",rotation:"Spin angle (360 = full rotation)",z:"Move forward/back along the Z axis",rotationX:"Rotate around the horizontal X axis",rotationY:"Rotate around the vertical Y axis",rotationZ:"Rotate around the screen-facing Z axis",perspective:"3D depth context for child elements; set it on a parent when rotating children in 3D",transformPerspective:"3D depth for THIS element's own X/Y rotation — lower = stronger perspective (try 600–1000)",transformOrigin:"Pivot point for transforms, for example center center or 50% 50%",width:"Element width",height:"Element height",autoAlpha:"Like opacity but hides element completely at 0",visibility:"Show or hide the element",innerText:"End value for a number roll-up (the number it counts up/down to)"},tA={},rL={none:[0,0,1,1],"power1.out":[0,0,.58,1],"power2.out":[.16,1,.3,1],"power3.out":[.08,.82,.17,1],"power4.out":[.06,.73,.09,1],"power1.in":[.42,0,1,1],"power2.in":[.55,.06,.68,.19],"power3.in":[.6,.04,.98,.34],"power4.in":[.7,0,.84,0],"power1.inOut":[.42,0,.58,1],"power2.inOut":[.45,.05,.55,.95],"power3.inOut":[.65,.05,.35,1],"power4.inOut":[.76,0,.24,1],"back.out":[.34,1.56,.64,1],"back.in":[.36,0,.66,-.56],"back.inOut":[.68,-.55,.27,1.55],"circ.inOut":[.785,.135,.15,.86],"expo.out":[.16,1,.3,1],"expo.in":[.7,0,.84,0],"expo.inOut":[.87,0,.13,1],"bounce.out":[.34,1.56,.64,.74],"bounce.in":[.36,.26,.66,-.56],"elastic.out(1,0.3)":[.16,1.45,.28,.82],"elastic.inOut(1,0.3)":[.68,-.55,.32,1.55],"ae-ease":[.333,0,.667,1],"ae-ease-in":[.333,.333,.667,1],"ae-ease-out":[.333,0,.667,.667]};function boe(t){var r;if(t.startsWith("custom(")){const i=bTe((r=t.match(/^custom\((.+)\)$/))==null?void 0:r[1]);if(i)return[i.x1,i.y1,i.x2,i.y2]}const e=rL[t];if(e)return e;const n=goe(t);return[n.x1,n.y1,n.x2,n.y2]}const voe=new Set(["opacity","autoAlpha"]),Aoe={opacity:{min:0,max:1,step:.01},autoAlpha:{min:0,max:1,step:.01},scale:{min:-10,max:10,step:.01},scaleX:{min:-10,max:10,step:.01},scaleY:{min:-10,max:10,step:.01},rotation:{step:1},z:{step:1},rotationX:{step:1},rotationY:{step:1},rotationZ:{step:1},perspective:{min:0,step:1},transformPerspective:{min:0,step:1},skewX:{min:-90,max:90,step:1},skewY:{min:-90,max:90,step:1},width:{min:0,step:1},height:{min:0,step:1},borderRadius:{min:0,step:1},x:{step:1},y:{step:1},fontSize:{min:1,step:1},letterSpacing:{step:.1},innerText:{step:1}};function nU(t,e){const n=Aoe[t];if(!n)return e;let r=e;return n.min!==void 0&&(r=Math.max(n.min,r)),n.max!==void 0&&(r=Math.min(n.max,r)),r}const ETe=["to","from","fromTo","set"],TTe={to:"Animate",from:"Animate In",fromTo:"From → To",set:"Set Instantly"};function _6(t,e,n,r){return Array.from({length:t+1},(i,s)=>{const a=s/t;return`${s===0?"M":"L"}${e(a)},${n(r(a))}`}).join(" ")}function Soe(t,e,n,r){return`M${t},${e} L${n},${e} L${n},${r}`}function TE({ease:t,active:e,size:n=24}){const r=tL(t),i=nL(t),s=boe(t),[a,o,l,c]=s,u=n,f=n/8,h=u-f*2,p=v=>f+h*v,y=v=>u-f-h*v,m=t==="hold"?Soe(f,u-f,u-f,f):i?_6(64,p,y,v=>doe(v,i.wiggles,i.type,i.amplitude)):r!==null?_6(24,p,v=>y(v/1.2),v=>hoe(v,r)):`M${f},${u-f} C${p(a)},${y(o)} ${p(l)},${y(c)} ${u-f},${f}`;return d.jsx("svg",{width:u,height:u,viewBox:`0 0 ${u} ${u}`,children:d.jsx("path",{d:m,fill:"none",stroke:e?"#3CE6AC":"#737373",strokeWidth:"1.5",strokeLinecap:"round"})})}const PTe=["curve","spring","wiggle"],M1=rL["power2.out"],iL={curve:"Curve",spring:"Spring",wiggle:"Wiggle"},MTe={curve:`custom(M0,0 C${M1[0]},${M1[1]} ${M1[2]},${M1[3]} 1,1)`,spring:"spring(0.42)",wiggle:"wiggle(3,easeInOut,0.12)"},NTe=function({kind:e,currentEase:n,onSelect:r}){return d.jsx("div",{className:"mb-2 grid max-h-56 grid-cols-4 gap-1 overflow-y-auto pr-0.5",children:poe.filter(i=>i.kind===e).map(i=>{const s=n===i.ease;return d.jsxs("button",{type:"button","data-ease-preset-id":i.id,role:"menuitemradio","aria-checked":s,tabIndex:s?0:-1,onClick:()=>r(i.ease),className:`flex flex-col items-center gap-0.5 rounded-md p-1 transition-colors ${s?"bg-panel-accent/10 ring-1 ring-panel-accent/30":"hover:bg-neutral-800"}`,title:i.label,children:[d.jsx(TE,{ease:i.ease,active:s}),d.jsx("span",{className:`text-center text-[8px] leading-none ${s?"text-panel-accent":"text-neutral-500"}`,children:i.label})]},i.id)})})};function DTe({mode:t,onCommit:e}){return d.jsx("div",{className:"mb-2 grid grid-cols-3 rounded-md bg-black/20 p-0.5",role:"radiogroup","aria-label":"Ease editor mode",children:PTe.map(n=>{const r=n===t;return d.jsx("button",{type:"button","data-ease-mode":n,role:"radio","aria-checked":r,onClick:()=>{r||e(MTe[n])},className:`rounded px-2 py-1 text-[10px] font-medium transition-colors ${r?"bg-neutral-700 text-neutral-100":"text-neutral-500 hover:text-neutral-300"}`,children:iL[n]},n)})})}const Zb=va,XP=-1,WP=2,woe=["easeOut","easeInOut","anticipate","uniform"],ITe={easeOut:.16,easeInOut:.08,anticipate:.12,uniform:.14};function _Te(t){return woe.some(e=>e===t)}function qP(t,e,n,r){const i=`wiggle(${e},${n},${va(r)})`;nL(i)&&t(i)}function RTe({tuple:t,onCommit:e}){const n=t.join(", "),r=x.useRef(null),i=x.useId(),[s,a]=x.useState(null);x.useEffect(()=>{r.current&&(r.current.value=n),a(null)},[n]);const o=l=>{const c=l.trim().split(/[\s,]+/),u=c.map(Number);if(c.length!==4||u.some(v=>!Number.isFinite(v))){a("Enter four finite numbers");return}const[f,h,p,y]=u;if(hWP||yWP){a(`Y values must be between ${XP} and ${WP}`);return}const m=v=>Math.max(0,Math.min(1,v));a(null),e(`custom(M0,0 C${Zb(m(f))},${Zb(h)} ${Zb(m(p))},${Zb(y)} 1,1)`)};return d.jsxs("div",{className:"mt-1.5 px-0.5",children:[d.jsxs("div",{className:"flex items-center gap-1.5",children:[d.jsx(TE,{ease:`custom(M0,0 C${t[0]},${t[1]} ${t[2]},${t[3]} 1,1)`,active:!0,size:14}),d.jsx("input",{ref:r,type:"text",defaultValue:n,"aria-label":"Cubic bezier control points","aria-invalid":s!==null,"aria-describedby":s?i:void 0,onInput:()=>a(null),onKeyDown:l=>{l.key==="Enter"&&l.currentTarget.blur(),l.key==="Escape"&&(l.currentTarget.value=n,a(null))},onBlur:l=>o(l.currentTarget.value),className:`w-full rounded border bg-black/20 px-1.5 py-1 font-mono text-[10px] text-neutral-300 outline-none ${s?"border-red-500/70 focus:border-red-400":"border-white/10 focus:border-panel-accent/50"}`})]}),d.jsx("p",{id:i,"aria-live":"polite",className:`mt-1 text-[9px] text-red-400 ${s?"":"sr-only"}`,children:s??"Valid bezier values"})]})}function h_({label:t,value:e,min:n,max:r,step:i,className:s,onCommit:a}){const[o,l]=x.useState(String(e));x.useEffect(()=>l(String(e)),[e]);const c=()=>{if(o.trim()===""){l(String(e));return}const u=Number(o);if(!Number.isFinite(u)||ur){l(String(e));return}a(u)};return d.jsx("input",{type:"number","aria-label":t,min:n,max:r,step:i,value:o,onChange:u=>l(u.currentTarget.value),onBlur:c,onKeyDown:u=>{u.key==="Enter"&&u.currentTarget.blur(),u.key==="Escape"&&l(String(e))},className:s})}function jTe({springBounce:t,onCommit:e}){return d.jsxs("div",{className:"mt-1.5 flex items-center gap-2 px-0.5 text-[10px] text-neutral-400",children:[d.jsx("span",{"aria-hidden":"true",children:"Bounce"}),d.jsx(h_,{label:"Spring bounce",value:t,min:0,max:1,step:.01,onCommit:n=>{const r=tL(`spring(${n})`);r!==null&&e(`spring(${Zb(r)})`)},className:"w-16 rounded border border-white/10 bg-black/20 px-1.5 py-1 font-mono text-[10px] text-neutral-300 outline-none focus:border-panel-accent/50"})]})}function LTe({config:t,onCommit:e}){const n=t.amplitude??ITe[t.type];return d.jsxs("div",{className:"mt-1.5 flex items-center gap-2 px-0.5 text-[10px] text-neutral-400",children:[d.jsxs("div",{className:"flex items-center gap-1",children:[d.jsx("span",{"aria-hidden":"true",children:"Count"}),d.jsx(h_,{label:"Wiggle count",value:t.wiggles,min:1,step:1,onCommit:r=>qP(e,r,t.type,n),className:"w-14 rounded border border-white/10 bg-black/20 px-1.5 py-1 font-mono text-[10px] text-neutral-300 outline-none focus:border-panel-accent/50"})]}),d.jsxs("div",{className:"flex items-center gap-1",children:[d.jsx("span",{"aria-hidden":"true",children:"Type"}),d.jsx("select",{"aria-label":"Wiggle type",value:t.type,onChange:r=>{_Te(r.currentTarget.value)&&qP(e,t.wiggles,r.currentTarget.value,n)},className:"rounded border border-white/10 bg-black/20 px-1.5 py-1 text-[10px] text-neutral-300 outline-none focus:border-panel-accent/50",children:woe.map(r=>d.jsx("option",{value:r,children:r},r))})]}),d.jsxs("div",{className:"flex items-center gap-1",children:[d.jsx("span",{"aria-hidden":"true",children:"Amplitude"}),d.jsx(h_,{label:"Wiggle amplitude",value:n,min:0,max:1,step:.01,onCommit:r=>qP(e,t.wiggles,t.type,r),className:"w-16 rounded border border-white/10 bg-black/20 px-1.5 py-1 font-mono text-[10px] text-neutral-300 outline-none focus:border-panel-accent/50"})]})]})}const N1=va,kf=184,dS=52,sL=16,YP=kf+sL*2,KP=kf+dS*2,FTe=1+dS/kf,$Te=-dS/kf,BTe=2,VTe=-1,zm="#3CE6AC";function HTe({kind:t,ease:e,label:n,onSelect:r}){const[i,s]=x.useState(!1),a=x.useRef(null),o=x.useRef(null),l=x.useId();x.useEffect(()=>{if(!i)return;const u=o.current,f=(u==null?void 0:u.querySelector('[role="menuitemradio"][aria-checked="true"]'))??(u==null?void 0:u.querySelector('[role="menuitemradio"]'));f==null||f.focus();const h=y=>{var v,b;const m=y.target;m instanceof Node&&!((v=o.current)!=null&&v.contains(m))&&!((b=a.current)!=null&&b.contains(m))&&s(!1)},p=y=>{var m;y.key==="Escape"&&(y.preventDefault(),s(!1),(m=a.current)==null||m.focus())};return document.addEventListener("pointerdown",h),document.addEventListener("keydown",p),()=>{document.removeEventListener("pointerdown",h),document.removeEventListener("keydown",p)}},[i]);const c=u=>{var v;if(u.key==="Tab"){s(!1);return}const h={ArrowLeft:-1,ArrowRight:1,ArrowUp:-4,ArrowDown:4}[u.key];if(h===void 0&&u.key!=="Home"&&u.key!=="End")return;u.preventDefault();const p=Array.from(u.currentTarget.querySelectorAll('[role="menuitemradio"]'));if(p.length===0)return;const y=Math.max(0,p.indexOf(document.activeElement)),m=u.key==="Home"?0:u.key==="End"?p.length-1:(y+(h??0)+p.length)%p.length;(v=p[m])==null||v.focus()};return d.jsxs("div",{className:"relative mb-2",children:[d.jsxs("button",{ref:a,type:"button","data-ease-type-dropdown":"","aria-haspopup":"menu","aria-expanded":i,"aria-controls":i?l:void 0,onClick:()=>s(u=>!u),className:"flex w-full items-center gap-2 rounded-md border border-white/10 bg-black/20 px-2 py-1.5 text-left transition-colors hover:border-white/20",children:[d.jsx(TE,{ease:e,active:!0,size:16}),d.jsx("span",{className:"text-[11px] text-neutral-200",children:n}),d.jsx("svg",{width:"8",height:"8",viewBox:"0 0 10 10",fill:"currentColor",className:`ml-auto text-neutral-500 transition-transform ${i?"rotate-180":""}`,children:d.jsx("path",{d:"M2 3l3 4 3-4z"})})]}),i&&d.jsx("div",{ref:o,id:l,role:"menu","aria-label":`${iL[t]} ease presets`,onKeyDown:c,className:"absolute inset-x-0 top-full z-20 mt-1 rounded-md border border-white/10 bg-neutral-900 p-2 shadow-xl",children:d.jsx(NTe,{kind:t,currentEase:e,onSelect:u=>{var f;r(u),s(!1),(f=a.current)==null||f.focus()}})})]})}function QTe(t,e){return e!==null?M1:t==="hold"?null:t.startsWith("custom(")||t in rL?boe(t):null}function zTe(t,e,n){const r=mTe(t);return r!==null?r:e!==null?"Custom spring":n?"Custom wiggle":t.startsWith("custom(")?"Custom bezier":tA[t]??t}const sa=t=>sL+kf*t,aa=t=>dS+kf*(1-t),rU=t=>Math.max($Te,Math.min(FTe,t)),Ooe=t=>Math.max(VTe,Math.min(BTe,t));function ZTe(t,e,n,r){const i=n==="ArrowLeft"?-r:n==="ArrowRight"?r:0,s=n==="ArrowDown"?-r:n==="ArrowUp"?r:0;if(i===0&&s===0)return null;const a=[...t],o=e==="p1"?0:2,l=e==="p1"?1:3;return a[o]=N1(Math.max(0,Math.min(1,a[o]+i))),a[l]=N1(Ooe(a[l]+s)),a}function GTe(t,e,n,r){if(t==="hold")return Soe(sa(0),aa(0),sa(1),aa(1));if(n!==null)return _6(64,sa,aa,l=>doe(l,n.wiggles,n.type,n.amplitude));if(e!==null)return _6(64,sa,aa,l=>hoe(l,e));const[i,s,a,o]=r;return`M${sa(0)},${aa(0)} C${sa(i)},${aa(s)} ${sa(a)},${aa(o)} ${sa(1)},${aa(1)}`}function UTe({springBounce:t,wiggleConfig:e,tuple:n,onCommit:r}){return t!==null?d.jsx(jTe,{springBounce:t,onCommit:r}):e!==null?d.jsx(LTe,{config:e,onCommit:r}):d.jsx(RTe,{tuple:n,onCommit:r})}const XTe=2e3;function Coe({ease:t,onCustomEaseCommit:e,collidingAnimationTargets:n}){const[r,i]=x.useState(null),s=x.useRef([]),a=r??t,o=tL(a),l=o!==null,c=nL(a),u=c!==null,f=l?"spring":u?"wiggle":"curve",h=QTe(a,o),[p,y]=x.useState(null),[m,v]=x.useState(null),b=x.useRef(null),w=x.useRef(null);x.useEffect(()=>{y(null);const ee=s.current,re=ee.indexOf(t);if(re<0){ee.length=0,i(null);return}ee.splice(0,re+1),ee.length===0&&i(null)},[t]),x.useEffect(()=>{if(r===null)return;const ee=setTimeout(()=>{s.current.length=0,i(null)},XTe);return()=>clearTimeout(ee)},[r]);const O=ee=>{s.current.push(ee),i(ee),e(ee)},k=p??h,E=k??M1,[T,N,_,I]=E,j={x:sa(0),y:aa(0)},L={x:sa(1),y:aa(1)},B={x:sa(T),y:aa(rU(N))},$={x:sa(_),y:aa(rU(I))},z=GTe(a,o,c,E),Y=k!==null||u||a==="hold",W=h!==null&&!l&&!u,J=(ee,re)=>{re.preventDefault(),re.stopPropagation(),b.current=ee,re.target.setPointerCapture(re.pointerId),p||y([T,N,_,I])},ne=ee=>{if(!b.current||!w.current)return;ee.preventDefault();const re=w.current.getBoundingClientRect(),Q=(ee.clientX-re.left)/re.width*YP,H=(ee.clientY-re.top)/re.height*KP,se=Math.max(0,Math.min(1,(Q-sL)/kf)),fe=Ooe(1-(H-dS)/kf),be=p??[T,N,_,I],me=b.current==="p1"?[N1(se),N1(fe),be[2],be[3]]:[be[0],be[1],N1(se),N1(fe)];y(me)},le=()=>{if(!b.current||!p)return;b.current=null;const ee=`M0,0 C${p[0]},${p[1]} ${p[2]},${p[3]} 1,1`;O(`custom(${ee})`)},ie=(ee,re)=>{const Q=ZTe(E,ee,re.key,re.shiftKey?.1:.01);Q&&(re.preventDefault(),re.stopPropagation(),y(Q),O(`custom(M0,0 C${Q[0]},${Q[1]} ${Q[2]},${Q[3]} 1,1)`))},q=aa(1),F=aa(0),U=sa(0),Z=sa(1),K=zTe(a,o,u);return d.jsxs("div",{className:"rounded-lg bg-neutral-900/50 p-2",children:[d.jsx(HTe,{kind:f,ease:a,label:K,onSelect:O}),n&&n.length>1&&d.jsxs("p",{className:"mb-1 text-[9px] text-neutral-500",children:["Applies to ",n.length," animations"]}),d.jsx(DTe,{mode:f,onCommit:O}),d.jsxs("span",{className:"sr-only","aria-live":"polite",children:[iL[f]," ease editor selected"]}),Y?d.jsxs(d.Fragment,{children:[d.jsx("div",{className:"mx-auto overflow-hidden rounded-md border border-white/5 bg-black/20",style:{aspectRatio:`${YP} / ${KP}`,width:"100%",maxWidth:230},children:d.jsxs("svg",{ref:w,width:"100%",height:"100%",viewBox:`0 0 ${YP} ${KP}`,preserveAspectRatio:"none",className:"touch-none select-none",onPointerMove:ne,onPointerUp:le,onPointerCancel:le,children:[[.25,.5,.75].map(ee=>d.jsx("line",{x1:sa(ee),y1:q,x2:sa(ee),y2:F,stroke:"white",strokeOpacity:"0.05",strokeWidth:"1"},`v${ee}`)),[.25,.5,.75].map(ee=>d.jsx("line",{x1:U,y1:aa(ee),x2:Z,y2:aa(ee),stroke:"white",strokeOpacity:"0.05",strokeWidth:"1"},`h${ee}`)),d.jsx("rect",{x:U,y:q,width:kf,height:F-q,fill:"none",stroke:"white",strokeOpacity:"0.1",strokeWidth:"1"}),d.jsx("line",{x1:j.x,y1:j.y,x2:L.x,y2:L.y,stroke:"white",strokeOpacity:"0.08",strokeWidth:"1",strokeDasharray:"3 4"}),W&&d.jsxs(d.Fragment,{children:[d.jsx("line",{x1:j.x,y1:j.y,x2:B.x,y2:B.y,stroke:zm,strokeOpacity:"0.5",strokeWidth:"1.5"}),d.jsx("line",{x1:L.x,y1:L.y,x2:$.x,y2:$.y,stroke:zm,strokeOpacity:"0.5",strokeWidth:"1.5"})]}),d.jsx("path",{d:z,fill:"none",stroke:zm,strokeWidth:"2.5",strokeLinecap:"round"}),d.jsx("circle",{cx:j.x,cy:j.y,r:"3",fill:zm}),d.jsx("circle",{cx:L.x,cy:L.y,r:"3",fill:zm}),W&&[["p1",B],["p2",$]].map(([ee,re])=>d.jsxs("g",{children:[d.jsx("circle",{cx:re.x,cy:re.y,r:"14",fill:"transparent",role:"slider",tabIndex:0,"aria-label":`${ee==="p1"?"First":"Second"} bezier control point`,"aria-valuemin":0,"aria-valuemax":1,"aria-valuenow":ee==="p1"?T:_,"aria-valuetext":`x ${ee==="p1"?T:_}, y ${ee==="p1"?N:I}`,className:"cursor-grab stroke-transparent outline-none active:cursor-grabbing focus-visible:stroke-white focus-visible:stroke-[2px]",onPointerDown:Q=>J(ee,Q),onKeyDown:Q=>ie(ee,Q),onPointerEnter:()=>v(ee),onPointerLeave:()=>v(Q=>Q===ee?null:Q)}),d.jsx("circle",{cx:re.x,cy:re.y,r:m===ee||b.current===ee?7:5.5,fill:"#0a0a1a",stroke:zm,strokeWidth:"2.5",className:"pointer-events-none transition-[r]"})]},ee))]})}),d.jsx(UTe,{springBounce:o,wiggleConfig:c,tuple:E,onCommit:O})]}):d.jsxs("p",{className:"px-0.5 py-1.5 text-[10px] leading-relaxed text-neutral-500",children:[K," preset: switch to Curve, Spring, or Wiggle above to shape it by hand."]})]})}const WTe=.8;function koe(t,e,n){return`${Number((t+e*n/100).toFixed(2))}s`}function HO(t){return{percentage:t.percentage,tweenPercentage:t.tweenPercentage,propertyGroup:t.propertyGroup,animationId:t.animationId,collidingAnimationTargets:t.collidingAnimationTargets}}function qTe({markers:t,centerY:e,elementId:n,clipStart:r,clipDuration:i,rovingTargetId:s,baseColor:a,baseOpacity:o,groupAware:l,globalEase:c,keyframeTarget:u,onSelectSegment:f}){return d.jsx(d.Fragment,{children:t.map((h,p)=>{const y=t[p-1];if(!y)return null;const m=h.keyframe,v=y.centerX,b=h.centerX;if(b-v<1)return null;const w=v+y.visualSize/2,O=b-v-y.visualSize/2-h.visualSize/2,k=u(m);return d.jsxs(x.Fragment,{children:[d.jsx("div",{className:"absolute","data-keyframe-connector":l?"":void 0,style:{left:w,top:e,width:Math.max(0,O),height:2,transform:"translateY(-1px)",background:a,opacity:o,borderRadius:1}}),f&&YTe(m)&&d.jsx(KTe,{left:v,width:b-v,centerY:e,ease:m.ease??c,target:k,focusId:loe(n,k),rovingTargetId:s,afterLabel:koe(r,i,y.keyframe.percentage),roomForFullTarget:O>=24,onSelectSegment:f})]},`line-${p}-${y.keyframe.percentage}-${m.percentage}`)})})}function YTe(t){return t.animationId!==void 0}function KTe({left:t,width:e,centerY:n,ease:r,target:i,focusId:s,rovingTargetId:a,afterLabel:o,roomForFullTarget:l,onSelectSegment:c}){const u=x.useRef(null);return d.jsx("div",{className:"group absolute","data-keyframe-ease-segment":"",style:{left:t,top:n,width:e,height:18,transform:"translateY(-50%)",zIndex:3,pointerEvents:"none"},children:d.jsx("button",{type:"button","data-keyframe-ease-button":"","data-timeline-focus-id":s,tabIndex:s===a?0:-1,"aria-label":`Edit ${r} easing after ${o}`,title:`Edit ${r} easing`,className:`absolute flex items-center justify-center rounded opacity-0 transition-opacity group-hover:opacity-100 focus-visible:opacity-100 ${l?"before:absolute before:left-1/2 before:top-1/2 before:h-6 before:w-6 before:-translate-x-1/2 before:-translate-y-1/2 before:content-['']":""}`,style:{left:"50%",top:"50%",width:16,height:16,transform:"translate(-50%, -50%)",zIndex:3,pointerEvents:"auto",padding:0,border:"1px solid rgba(255, 255, 255, 0.14)",background:"#171717",cursor:"pointer"},onPointerDown:f=>{u.current=f.clientX},onClick:f=>{f.stopPropagation();const h=u.current;u.current=null,!(h!==null&&Math.abs(f.clientX-h)>=eL)&&c(i)},children:d.jsx(TE,{ease:r,active:!0,size:12})})})}const JTe=x.memo(function({state:e,onClick:n,title:r,size:i=10,isHold:s=!1}){const a=e==="active",o=e==="ghost"?.25:e==="inactive"?.6:1,l=e==="active"?"#3CE6AC":"#a3a3a3";return d.jsx("button",{type:"button",onClick:c=>{c.stopPropagation(),n()},className:"relative flex-shrink-0 p-0.5 transition-opacity hover:opacity-100 before:absolute before:-inset-1.5 before:content-['']",style:{color:l,opacity:o},title:r,"aria-label":r,"aria-pressed":e==="active",children:d.jsx("svg",{width:i,height:i,viewBox:"0 0 10 10",children:s?d.jsx("rect",{x:"2",y:"2",width:"6",height:"6",rx:"0.5",fill:a?"currentColor":"none",stroke:"currentColor",strokeWidth:"1.2"}):d.jsx("rect",{x:"5",y:"0.7",width:"6",height:"6",rx:"1",transform:"rotate(45 5 0.7)",fill:a?"currentColor":"none",stroke:"currentColor",strokeWidth:"1.2"})})})}),JP=.5;function Eoe(t,e,n){const r=n?t.filter(i=>n in i.properties):t;return{propertyKeyframes:r,prevKeyframe:r.filter(i=>i.percentagei.percentage>e+JP)??null,currentKeyframe:r.find(i=>Math.abs(i.percentage-e)<=JP)??null}}function aL(t,e){const n=t.filter(a=>typeof a.tweenPercentage=="number");if(n.length<2)return e;const r=n[0],i=n[n.length-1];if(i.percentage===r.percentage)return r.tweenPercentage;const s=(i.tweenPercentage-r.tweenPercentage)/(i.percentage-r.percentage);return r.tweenPercentage+(e-r.percentage)*s}function ePe({disabled:t}){return d.jsx("svg",{width:"6",height:"10",viewBox:"0 0 6 10",fill:"none",style:{opacity:t?.25:1},children:d.jsx("path",{d:"M5 1L1 5L5 9",stroke:"#a3a3a3",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round"})})}function tPe({disabled:t}){return d.jsx("svg",{width:"6",height:"10",viewBox:"0 0 6 10",fill:"none",style:{opacity:t?.25:1},children:d.jsx("path",{d:"M1 1L5 5L1 9",stroke:"#a3a3a3",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round"})})}const jp=x.memo(function({property:e,keyframes:n,currentPercentage:r,onSeek:i,onAddKeyframe:s,onRemoveKeyframe:a,onConvertToKeyframes:o}){const{propertyKeyframes:l,prevKeyframe:c,nextKeyframe:u,currentKeyframe:f}=Eoe(n??[],r,e);let h;!n||n.length===0?h="ghost":f?h="active":l.length>0?h="inactive":h="ghost";const p=()=>{h==="ghost"?o():h==="active"&&f?a(f.tweenPercentage??f.percentage,f.animationId):s(aL(l,r))};return d.jsxs("div",{className:"flex h-5 items-center gap-0.5",children:[d.jsx("button",{type:"button",disabled:!c,onClick:()=>c&&i(c.percentage),title:"Previous keyframe","aria-label":`Previous ${e} keyframe`,className:"relative flex h-5 w-3 items-center justify-center disabled:cursor-default before:absolute before:-inset-1.5 before:content-['']",children:d.jsx(ePe,{disabled:!c})}),d.jsx(JTe,{state:h,onClick:p,size:9,title:h==="ghost"?`Convert ${e} to keyframes`:h==="active"?`Remove ${e} keyframe`:`Add ${e} keyframe`}),d.jsx("button",{type:"button",disabled:!u,onClick:()=>u&&i(u.percentage),title:"Next keyframe","aria-label":`Next ${e} keyframe`,className:"relative flex h-5 w-3 items-center justify-center disabled:cursor-default before:absolute before:-inset-1.5 before:content-['']",children:d.jsx(tPe,{disabled:!u})})]})}),d_=new WeakMap;function oL(t){return t.closest("[data-timeline-scroll-viewport]")??t.ownerDocument}function Toe(t){const e=d_.get(t);if(e)return e;const n={actor:null,pending:new Map,preview:null,previewListeners:new Set,latest:null};return d_.set(t,n),n}function nPe(t){return Number.isFinite(t)?t:null}function rPe(t){var e;return t?((e=d_.get(oL(t)))==null?void 0:e.pending)??iU:iU}const iU=new Map;function eM(t,e){t.preview=e;for(const n of t.previewListeners)n(e)}function iPe(t,e){const n=Toe(oL(t));return n.previewListeners.add(e),e(n.preview),()=>n.previewListeners.delete(e)}function sPe(t,e){const n=t.target.animationId===void 0?t.keyframes:t.keyframes.filter(s=>s.animationId===t.target.animationId),r=n.map(s=>s.tweenPercentage).filter(s=>typeof s=="number"),i=aL(n,e);return r.length===0?i:Math.max(Math.min(...r),Math.min(Math.max(...r),i))}function aPe(t){const e=t.event.currentTarget,n=oL(e),r=n instanceof HTMLElement?n:null,i=Toe(n),s=ue.getState().timelineSessionEpoch,a=I=>{var j,L;if(I.phase==="active"){if(I.phase="cancelled",eM(i,null),I.scrollRaf&&cancelAnimationFrame(I.scrollRaf),(j=I.unsubscribeStore)==null||j.call(I),(L=I.teardownListeners)==null||L.call(I),r&&I.pointerId!==null)try{r.releasePointerCapture(I.pointerId)}catch{}i.actor===I&&(i.actor=null),I.phase="complete"}};i.actor&&a(i.actor);for(const[I,j]of i.pending)j.sessionEpoch!==s&&i.pending.delete(I);for(const[I,j]of i.pending)j.elementId===t.elementId&&t.keyframes.some(L=>t.keyframeKeyOf(L)===j.destinationKeyframeKey&&Math.abs(L.percentage-j.clipPercentage)<.2)&&i.pending.delete(I);const o=i.pending.get(t.keyframeKey),l={...t,phase:"active",pointerId:nPe(t.event.pointerId),pointerDownX:t.event.clientX,lastClientX:t.event.clientX,lastClientY:t.event.clientY,originScrollLeft:(r==null?void 0:r.scrollLeft)??0,fromClipPercentage:(o==null?void 0:o.clipPercentage)??t.target.percentage,moved:!1,sessionEpoch:s,sourceWasPresent:ue.getState().elements.some(I=>(I.key??I.id)===t.elementId),scrollRaf:0,unsubscribeStore:null,teardownListeners:null};i.actor=l;const c=I=>l.pointerId===null||I.pointerId===l.pointerId,u=()=>l.lastClientX+((r==null?void 0:r.scrollLeft)??0)-l.originScrollLeft,f=()=>{eM(i,{keyframeKey:l.keyframeKey,clipPercentage:fTe({pointerDownX:l.pointerDownX,pointerMoveX:u(),clipWidthPx:l.clipWidthPx,draggedClipPct:l.fromClipPercentage,draggedIndex:l.draggedIndex,sortedClipPcts:l.sortedClipPercentages})})},h=()=>{l.scrollRaf&&cancelAnimationFrame(l.scrollRaf),l.scrollRaf=0},p=()=>{l.scrollRaf=0,!(l.phase!=="active"||!r||!Hae(r,l.lastClientX))&&(f(),l.scrollRaf=requestAnimationFrame(p))},y=()=>{if(!r||!l.moved)return;const I=cS(r,l.lastClientX,l.lastClientY,l.scrollRaf!==0);I==="stop"?h():I==="start"&&(l.scrollRaf=requestAnimationFrame(p))},m=()=>{var I,j;h(),(I=l.unsubscribeStore)==null||I.call(l),l.unsubscribeStore=null,(j=l.teardownListeners)==null||j.call(l),l.teardownListeners=null},v=()=>{if(!(!r||l.pointerId===null))try{r.releasePointerCapture(l.pointerId)}catch{}},b=I=>l.phase!=="active"||!c(I)?!1:l.sessionEpoch!==ue.getState().timelineSessionEpoch?(a(l),!1):(l.phase="committing",l.lastClientX=I.clientX,l.lastClientY=I.clientY,m(),v(),eM(i,null),i.actor===l&&(i.actor=null),l.suppressNextClick(),!0),w=I=>{const j=sPe(l,I),L=i.pending.get(l.keyframeKey),B=L?{...l.target,percentage:L.clipPercentage,tweenPercentage:L.tweenPercentage}:l.target,$={elementId:l.elementId,clipPercentage:I,tweenPercentage:j,destinationKeyframeKey:Cf(l.elementId,{...l.target,percentage:I,tweenPercentage:j}),sessionEpoch:l.sessionEpoch};i.pending.set(l.keyframeKey,$),i.latest=$;const z=()=>{i.pending.get(l.keyframeKey)===$&&i.pending.delete(l.keyframeKey)},Y=()=>{const W=i.latest===$;z(),W&&l.onSelect(B,!1)};l.onMove(B,I).then(W=>{W||Y()},Y),l.onSelect({...l.target,percentage:I,tweenPercentage:j},!1)},O=I=>{if(!b(I))return;const j=uTe({pointerDownX:l.pointerDownX,pointerUpX:u(),clipWidthPx:l.clipWidthPx,draggedClipPct:l.fromClipPercentage,draggedIndex:l.draggedIndex,sortedClipPcts:l.sortedClipPercentages});j.kind==="move"&&j.toClipPct!==void 0?w(j.toClipPct):l.onSelect(l.target,I.shiftKey),l.phase="complete"},k=I=>{l.phase!=="active"||!c(I)||(l.lastClientX=I.clientX,l.lastClientY=I.clientY,!l.moved&&Math.abs(u()-l.pointerDownX)>=eL&&(l.moved=!0),l.moved&&f(),y())},E=I=>O(I),T=I=>{l.phase==="active"&&c(I)&&a(l)},N=I=>{l.phase==="active"&&c(I)&&a(l)},_=I=>{I.key==="Escape"&&a(l)};if(window.addEventListener("pointermove",k,!0),window.addEventListener("pointerup",E,!0),window.addEventListener("pointercancel",T,!0),window.addEventListener("keydown",_),r==null||r.addEventListener("lostpointercapture",N),l.teardownListeners=()=>{window.removeEventListener("pointermove",k,!0),window.removeEventListener("pointerup",E,!0),window.removeEventListener("pointercancel",T,!0),window.removeEventListener("keydown",_),r==null||r.removeEventListener("lostpointercapture",N)},l.unsubscribeStore=ue.subscribe(I=>{var L;const j=I.elements.some(B=>(B.key??B.id)===l.elementId);if(I.timelineSessionEpoch!==l.sessionEpoch)i.pending.clear(),i.latest=null,a(l);else if(l.sourceWasPresent&&!j){for(const[B,$]of i.pending)$.elementId===l.elementId&&i.pending.delete(B);((L=i.latest)==null?void 0:L.elementId)===l.elementId&&(i.latest=null),a(l)}}),r&&l.pointerId!==null)try{r.setPointerCapture(l.pointerId)}catch{}return{update:k,commit:E,cancel:T}}function oPe({expandedElements:t,keyframeCache:e,onSelectElement:n,onSeek:r,setSelectedElementId:i,setKfContextMenu:s,toggleSelectedKeyframe:a}){const o=x.useCallback((f,h,p)=>{ue.getState().clearSelectedKeyframes();const y=f.key??f.id;i(y),n==null||n(f),a(Cf(y,h)),(p==null?void 0:p.seek)!==!1&&(r==null||r(f.start+h.percentage/100*f.duration));const m=e.get(y),v=m==null?void 0:m.keyframes.find(b=>Math.abs(b.percentage-h.percentage)<.5);ue.getState().setActiveKeyframePct(h.tweenPercentage??(v==null?void 0:v.tweenPercentage)??null)},[e,r,n,i,a]),l=x.useCallback((f,h)=>{a(Cf(f,h))},[a]),c=x.useCallback((f,h)=>{const p=t.find(y=>(y.key??y.id)===f);p&&(o(p,h,{seek:!1}),h.animationId!==void 0&&h.tweenPercentage!==void 0&&(ue.getState().setFocusedEaseSegment({animationId:h.animationId,collidingAnimationTargets:h.collidingAnimationTargets,tweenPercentage:h.tweenPercentage,elementId:f}),tj({action:"open"})))},[t,o]),u=x.useCallback((f,h,p)=>{const y=t.find(b=>(b.key??b.id)===h);if(!y)return;i(h),n==null||n(y);const m=e.get(h),v=m==null?void 0:m.keyframes.find(b=>Math.abs(b.percentage-p.percentage)<.2);s({x:f.clientX+4,y:f.clientY+2,sessionEpoch:ue.getState().timelineSessionEpoch,element:y,elementId:h,percentage:p.percentage,tweenPercentage:p.tweenPercentage??(v==null?void 0:v.tweenPercentage),propertyGroup:p.propertyGroup,animationId:p.animationId,currentEase:(v==null?void 0:v.ease)??(m==null?void 0:m.ease)})},[t,e,n,s,i]);return{onClickKeyframe:o,onSelectSegment:c,onShiftClickKeyframe:l,onContextMenuKeyframe:u}}const lPe=12;function cPe(t){return Math.round(t*1e3)/1e3}function uPe(t,e,n){if(!Number.isFinite(e)||n<=0||t.length===0)return null;let r=0,i=t.length;for(;r>>1;t[l].percentage{const Q=E.current;if(Q)return iPe(Q,H=>{I(H===null?null:{kfKey:H.keyframeKey,clipPct:H.clipPercentage})})},[]);const j=()=>{w&&(w.current=!0,requestAnimationFrame(()=>{w.current=!1}))};if(n<20)return null;const L=Math.round(i?r*.45:Cg*WTe),B=i?q2+(r-q2)/2:r/2,$=i?L:24,z=[...e.keyframes].sort((Q,H)=>Q.percentage-H.percentage),Y=z.filter(Q=>Q.percentage<0),W=z.filter(Q=>Q.percentage>100),J=Math.max(6,Math.round(L*.55)),ne=Q=>Q.animationId===void 0?z:z.filter(H=>H.animationId===Q.animationId),le=Q=>{var H;return((H=N.get(Cf(l,HO(Q))))==null?void 0:H.clipPercentage)??Q.percentage},ie=new Map;for(const Q of z){if(ie.has(Q.animationId))continue;const H=ne(Q).map(se=>({keyframe:se,clipPct:le(se)})).sort((se,fe)=>se.clipPct-fe.clipPct);ie.set(Q.animationId,{keyframes:H.map(se=>se.keyframe),clipPcts:H.map(se=>se.clipPct)})}const q=(Q,H=Q.percentage)=>{if(H<0){const se=Y.indexOf(Q);return-(Y.length-Math.max(0,se))*J}if(H>100){const se=W.indexOf(Q);return n+(Math.max(0,se)+1)*J}return H/100*n},F=z.map((Q,H)=>{const se=q(Q);if(Q.percentage<0||Q.percentage>100)return{keyframe:Q,centerX:se,hitWidth:L,visualSize:L};const fe=z[H-1],be=z[H+1],me=fe?se-q(fe):1/0,pe=be?q(be)-se:1/0,ge=Math.max(1,Math.min(me,pe)),Pe=Math.min(L,ge);return{keyframe:Q,centerX:se,hitWidth:Math.max(lPe,Pe),visualSize:L}}),U=u&&u>0?50/Qd/u:0,Z=a&&U>0?uPe(z,o,U):null,K=a?s:"#a3a3a3",ee=a?.4:.25,re=a&&!!v;return d.jsxs("div",{ref:E,className:"absolute inset-0",style:{zIndex:5,pointerEvents:"none"},children:[d.jsx(qTe,{markers:F,centerY:B,elementId:l,clipStart:c,clipDuration:u,rovingTargetId:h,baseColor:K,baseOpacity:ee,groupAware:O,globalEase:k,keyframeTarget:HO,onSelectSegment:b}),F.map((Q,H)=>{const se=Q.keyframe,fe=HO(se),be=ooe(l,fe),me=Cf(l,fe),pe=se.percentage<0?"before":se.percentage>100?"after":null,ge=ie.get(se.animationId),Pe=(ge==null?void 0:ge.clipPcts)??[],ve=(ge==null?void 0:ge.keyframes.indexOf(se))??-1,xe=(_==null?void 0:_.kfKey)===me?_.clipPct:se.percentage,we=q(se,xe)-Q.hitWidth/2,Ce=f.has(me),Me=se===Z,Ve=Ce||Me,tt=Ce?s:"#a3a3a3",Ze=pt=>{pt.button===0&&(pt.stopPropagation(),re&&(T.current=aPe({event:pt,elementId:l,keyframeKey:me,target:fe,keyframes:e.keyframes,clipWidthPx:n,draggedIndex:ve,sortedClipPercentages:Pe,keyframeKeyOf:it=>Cf(l,HO(it)),onMove:(it,vt)=>(v==null?void 0:v(it,vt))??Promise.resolve(!1),onSelect:(it,vt)=>{vt?y==null||y(it):p==null||p(it)},suppressNextClick:j})))},qe=pt=>{var it;if(re){(it=T.current)==null||it.commit(pt),T.current=null,pt.stopPropagation();return}pt.button===0&&(j(),pt.shiftKey?y==null||y(fe):p==null||p(fe))};return d.jsx("button",{type:"button",className:"absolute","data-timeline-focus-id":be,"data-keyframe-group":O?se.propertyGroup:void 0,"data-keyframe-percentage":O?se.tweenPercentage??se.percentage:void 0,"data-keyframe-at-playhead":String(Me),"data-keyframe-selected":String(Ce),"aria-current":Me?"time":void 0,"data-keyframe-outside-clip":pe??void 0,tabIndex:be===h?0:-1,"aria-label":`${se.propertyGroup??"Motion"} keyframe at ${koe(c,u,se.percentage)}${pe?` (${pe} clip)`:""}`,"aria-pressed":Ce,style:{left:we,top:B,transform:"translateY(-50%)",width:Q.hitWidth,height:$,zIndex:Ve?2:1,pointerEvents:"auto",background:"none",border:"none",cursor:re?"ew-resize":"pointer",padding:0,touchAction:"none",display:"flex",alignItems:"center",justifyContent:"center",overflow:"visible"},onPointerDown:Ze,onPointerMove:re?pt=>{var it;return(it=T.current)==null?void 0:it.update(pt)}:void 0,onPointerUp:qe,onClick:pt=>{pt.detail===0&&(pt.stopPropagation(),j(),pt.shiftKey?y==null||y(fe):p==null||p(fe))},onPointerCancel:re?pt=>{var it;(it=T.current)==null||it.cancel(pt),T.current=null}:void 0,onContextMenu:pt=>{pt.preventDefault(),pt.stopPropagation(),m==null||m(pt,fe)},title:`${cPe(se.percentage)}%${pe?` · ${pe} clip`:""}`,children:d.jsxs("svg",{width:Q.visualSize,height:Q.visualSize,viewBox:"0 0 10 10",style:{flexShrink:0,pointerEvents:"none"},children:[(Ce||Me)&&d.jsx("path",{d:"M5 0L10 5L5 10L0 5Z",fill:"none",stroke:s,strokeWidth:"0.8",opacity:Ce?.5:1}),d.jsx("path",{d:"M5 1L9 5L5 9L1 5Z",fill:tt,opacity:Ce?1:Me?.9:.55})]})},`${se.animationId??H}:${se.propertyGroup??""}:${se.tweenPercentage??se.percentage}`)})]})}),fPe=x.memo(function(e){return d.jsx(Poe,{...e,globalEase:e.keyframesData.ease,onClickKeyframe:n=>{var r;return(r=e.onClickKeyframe)==null?void 0:r.call(e,e.elementId,n)},onShiftClickKeyframe:n=>{var r;return(r=e.onShiftClickKeyframe)==null?void 0:r.call(e,e.elementId,n)},onContextMenuKeyframe:(n,r)=>{var i;return(i=e.onContextMenuKeyframe)==null?void 0:i.call(e,n,e.elementId,r)},onMoveKeyframe:e.onMoveKeyframe?(n,r)=>{var i;return((i=e.onMoveKeyframe)==null?void 0:i.call(e,e.elementId,n,r))??Promise.resolve(!1)}:void 0,onSelectSegment:e.onSelectSegment?n=>{var r;return(r=e.onSelectSegment)==null?void 0:r.call(e,e.elementId,n)}:void 0})});function hPe({element:t,elementId:e,keyframesData:n,pixelsPerSecond:r,rowHeight:i,beatsActive:s,accentColor:a,isSelected:o,currentTime:l,selectedKeyframes:c,rovingTargetId:u,onClickKeyframe:f,onShiftClickKeyframe:h,onContextMenuKeyframe:p,onMoveKeyframe:y,onSelectSegment:m,suppressClickRef:v}){const b=Math.max(t.duration*r,4);return d.jsx("div",{className:"absolute pointer-events-none",style:{left:t.start*r,top:ha,width:b,height:i-2*ha,zIndex:o?11:6},children:d.jsx(fPe,{keyframesData:n,clipWidthPx:b,clipHeightPx:i-2*ha,beatsActive:s,accentColor:a,isSelected:o,currentPercentage:t.duration>0?(l-t.start)/t.duration*100:0,elementId:e,clipStart:t.start,clipDuration:t.duration,selectedKeyframes:c,rovingTargetId:u,onClickKeyframe:(w,O)=>f==null?void 0:f(t,O),onShiftClickKeyframe:h,onContextMenuKeyframe:p,onMoveKeyframe:y,onSelectSegment:m,suppressClickRef:v})})}const sU=["x","y","scale","scaleX","scaleY","rotation","skewX","skewY","z","rotationX","rotationY","rotationZ","perspective","transformPerspective","transformOrigin","opacity","visibility","autoAlpha","width","height","color","backgroundColor","borderColor","borderRadius","fontSize","letterSpacing","filter","clipPath","innerText"],dPe={position:new Set(["x","y","xPercent","yPercent"]),scale:new Set(["scale","scaleX","scaleY"]),size:new Set(["width","height"]),rotation:new Set(["rotation","skewX","skewY"]),visual:new Set(["opacity","autoAlpha"]),other:new Set},Moe=new Map;for(const[t,e]of Object.entries(dPe))for(const n of e)Moe.set(n,t);function rl(t){return Moe.get(t)??"other"}function aU(t){const e=new Set;for(const n of Object.keys(t)){if(n==="transformOrigin"||n==="_auto"||n==="data")continue;const r=rl(n);e.add(r)}if(e.size===1)return e.values().next().value}const pPe=["none","power1.in","power1.out","power1.inOut","power2.in","power2.out","power2.inOut","power3.in","power3.out","power3.inOut","power4.in","power4.out","power4.inOut","back.in","back.out","back.inOut","elastic.in","elastic.out","elastic.inOut","bounce.in","bounce.out","bounce.inOut","circ.inOut","expo.in","expo.out","expo.inOut","elastic.out(1,0.3)","elastic.inOut(1,0.3)","spring-gentle","spring-bouncy","spring-stiff","spring-wobbly","spring-heavy","hold","steps(1)"];function Noe(t){return!t||t.kind==="literal"?"direct":t.kind==="runtime-dynamic"?"source":"unroll"}function mPe(t){const e=new Map;for(const n of t){const r=e.get(n.percentage);if(!r){e.set(n.percentage,{...n,properties:{...n.properties}});continue}r.properties={...r.properties,...n.properties},n.ease!==void 0&&(r.ease=n.ease),n.auto!==void 0&&(r.auto=n.auto)}return[...e.values()].sort((n,r)=>n.percentage-r.percentage)}function Doe(t,e,n,r){const i=t[0];if(t.length<2||!i)return;const s=[];let a;if(r&&t.length>=4){a=[i];for(let o=1;o+2bPe(o.properties)).filter(o=>o!==null);if(e.length>=2)return e;const n=t.properties.x,r=t.properties.y;return typeof n!="number"&&typeof r!="number"?e:[{x:0,y:0},{x:typeof n=="number"?n:0,y:typeof r=="number"?r:0}]}function vPe(t){return t===!0?", autoRotate: true":typeof t=="number"?`, autoRotate: ${t}`:""}function APe(t,e,n){if(t.cp1&&t.cp2)return[`{x: ${t.cp1.x}, y: ${t.cp1.y}}`,`{x: ${t.cp2.x}, y: ${t.cp2.y}}`];const r=n.x-e.x,i=n.y-e.y,s=t.curviness??1;return[`{x: ${e.x+r*.33}, y: ${e.y+i*.33-s*Math.abs(r)*.25}}`,`{x: ${e.x+r*.66}, y: ${e.y+i*.66-s*Math.abs(r)*.25}}`]}function SPe(t,e){const n=t[0];if(!n)return[];const r=[`{x: ${n.x}, y: ${n.y}}`];for(let i=0;if.cp1&&f.cp2),a=n.some(f=>{var h;return(f.curviness??1)!==(((h=n[0])==null?void 0:h.curviness)??1)});if((s||a)&&e.length>=2)return`{ path: [${SPe(e,n).join(", ")}], type: "cubic"${i} }`;const o=e.map(f=>`{x: ${f.x}, y: ${f.y}}`),l=((u=n[0])==null?void 0:u.curviness)??1,c=l!==1?`, curviness: ${l}`:"";return`{ path: [${o.join(", ")}]${c}${i} }`}var tM={},p_=function(t,e){return p_=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,r){n.__proto__=r}||function(n,r){for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(n[i]=r[i])},p_(t,e)};function Ioe(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");p_(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}var R6=function(){return R6=Object.assign||function(e){for(var n,r=1,i=arguments.length;r=0;o--)(a=t[o])&&(s=(i<3?a(s):i>3?a(e,n,s):a(e,n))||s);return i>3&&s&&Object.defineProperty(e,n,s),s}function joe(t,e){return function(n,r){e(n,r,t)}}function Loe(t,e,n,r,i,s){function a(b){if(b!==void 0&&typeof b!="function")throw new TypeError("Function expected");return b}for(var o=r.kind,l=o==="getter"?"get":o==="setter"?"set":"value",c=!e&&t?r.static?t:t.prototype:null,u=e||(c?Object.getOwnPropertyDescriptor(c,r.name):{}),f,h=!1,p=n.length-1;p>=0;p--){var y={};for(var m in r)y[m]=m==="access"?{}:r[m];for(var m in r.access)y.access[m]=r.access[m];y.addInitializer=function(b){if(h)throw new TypeError("Cannot add initializers after decoration has completed");s.push(a(b||null))};var v=(0,n[p])(o==="accessor"?{get:u.get,set:u.set}:u[l],y);if(o==="accessor"){if(v===void 0)continue;if(v===null||typeof v!="object")throw new TypeError("Object expected");(f=a(v.get))&&(u.get=f),(f=a(v.set))&&(u.set=f),(f=a(v.init))&&i.unshift(f)}else(f=a(v))&&(o==="field"?i.unshift(f):u[l]=f)}c&&Object.defineProperty(c,r.name,u),h=!0}function Foe(t,e,n){for(var r=arguments.length>2,i=0;i0&&s[s.length-1])&&(c[0]===6||c[0]===2)){n=0;continue}if(c[0]===3&&(!s||c[1]>s[0]&&c[1]=t.length&&(t=void 0),{value:t&&t[r++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function cL(t,e){var n=typeof Symbol=="function"&&t[Symbol.iterator];if(!n)return t;var r=n.call(t),i,s=[],a;try{for(;(e===void 0||e-- >0)&&!(i=r.next()).done;)s.push(i.value)}catch(o){a={error:o}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(a)throw a.error}}return s}function Zoe(){for(var t=[],e=0;e1||l(p,m)})},y&&(i[p]=y(i[p])))}function l(p,y){try{c(r[p](y))}catch(m){h(s[0][3],m)}}function c(p){p.value instanceof Eg?Promise.resolve(p.value.v).then(u,f):h(s[0][2],p)}function u(p){l("next",p)}function f(p){l("throw",p)}function h(p,y){p(y),s.shift(),s.length&&l(s[0][0],s[0][1])}}function Woe(t){var e,n;return e={},r("next"),r("throw",function(i){throw i}),r("return"),e[Symbol.iterator]=function(){return this},e;function r(i,s){e[i]=t[i]?function(a){return(n=!n)?{value:Eg(t[i](a)),done:!1}:s?s(a):a}:s}}function qoe(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=t[Symbol.asyncIterator],n;return e?e.call(t):(t=typeof j6=="function"?j6(t):t[Symbol.iterator](),n={},r("next"),r("throw"),r("return"),n[Symbol.asyncIterator]=function(){return this},n);function r(s){n[s]=t[s]&&function(a){return new Promise(function(o,l){a=t[s](a),i(o,l,a.done,a.value)})}}function i(s,a,o,l){Promise.resolve(l).then(function(c){s({value:c,done:o})},a)}}function Yoe(t,e){return Object.defineProperty?Object.defineProperty(t,"raw",{value:e}):t.raw=e,t}var wPe=Object.create?(function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}):function(t,e){t.default=e},m_=function(t){return m_=Object.getOwnPropertyNames||function(e){var n=[];for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(n[n.length]=r);return n},m_(t)};function Koe(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var n=m_(t),r=0;r=p},l+" >= "+p)}var u={null:function(){return null},emptyArray:function(){return[]},false:function(){return!1},true:function(){return!0},undefined:function(){},"use strict":function(){return"use strict"}},f=a.or(o.string,o.number,o.boolean,o.null,o.undefined),h=a.from(function(p){if(p===null)return!0;var y=typeof p;return!(y==="object"||y==="function")},f.toString());return{geq:c,defaults:u,isPrimitive:h}}Zm.default=n;function r(i){try{var s=i(),a=s.exports,o=a.default}catch{return}o&&o!==a&&typeof a=="object"&&(Object.assign(o,a,{default:o}),a.__esModule&&Object.defineProperty(o,"__esModule",{value:!0}),s.exports=o)}return Zm.maybeSetModuleExports=r,Zm}Ub.exports;var cU;function Bi(){return cU||(cU=1,(function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.Def=void 0;var n=Bn,r=$r(),i=Object.prototype,s=i.toString,a=i.hasOwnProperty,o=(function(){function b(){}return b.prototype.assert=function(w,O){if(!this.check(w,O)){var k=m(w);throw new Error(k+" does not match type "+this)}return!0},b.prototype.arrayOf=function(){var w=this;return new l(w)},b})(),l=(function(b){n.__extends(w,b);function w(O){var k=b.call(this)||this;return k.elemType=O,k.kind="ArrayType",k}return w.prototype.toString=function(){return"["+this.elemType+"]"},w.prototype.check=function(O,k){var E=this;return Array.isArray(O)&&O.every(function(T){return E.elemType.check(T,k)})},w})(o),c=(function(b){n.__extends(w,b);function w(O){var k=b.call(this)||this;return k.value=O,k.kind="IdentityType",k}return w.prototype.toString=function(){return String(this.value)},w.prototype.check=function(O,k){var E=O===this.value;return!E&&typeof k=="function"&&k(this,O),E},w})(o),u=(function(b){n.__extends(w,b);function w(O){var k=b.call(this)||this;return k.fields=O,k.kind="ObjectType",k}return w.prototype.toString=function(){return"{ "+this.fields.join(", ")+" }"},w.prototype.check=function(O,k){return s.call(O)===s.call({})&&this.fields.every(function(E){return E.type.check(O[E.name],k)})},w})(o),f=(function(b){n.__extends(w,b);function w(O){var k=b.call(this)||this;return k.types=O,k.kind="OrType",k}return w.prototype.toString=function(){return this.types.join(" | ")},w.prototype.check=function(O,k){return this.types.some(function(E){return E.check(O,!!k)})?!0:(typeof k=="function"&&k(this,O),!1)},w})(o),h=(function(b){n.__extends(w,b);function w(O,k){var E=b.call(this)||this;return E.name=O,E.predicate=k,E.kind="PredicateType",E}return w.prototype.toString=function(){return this.name},w.prototype.check=function(O,k){var E=this.predicate(O,k);return!E&&typeof k=="function"&&k(this,O),E},w})(o),p=(function(){function b(w,O){this.type=w,this.typeName=O,this.baseNames=[],this.ownFields=Object.create(null),this.allSupertypes=Object.create(null),this.supertypeList=[],this.allFields=Object.create(null),this.fieldNames=[],this.finalized=!1,this.buildable=!1,this.buildParams=[]}return b.prototype.isSupertypeOf=function(w){if(w instanceof b){if(this.finalized!==!0||w.finalized!==!0)throw new Error("");return a.call(w.allSupertypes,this.typeName)}else throw new Error(w+" is not a Def")},b.prototype.checkAllFields=function(w,O){var k=this.allFields;if(this.finalized!==!0)throw new Error(""+this.typeName);function E(T){var N=k[T],_=N.type,I=N.getValue(w);return _.check(I,O)}return w!==null&&typeof w=="object"&&Object.keys(k).every(E)},b.prototype.bases=function(){for(var w=[],O=0;O=0)return k[we];if(typeof xe!="string")throw new Error("missing name");return new h(xe,ve)}return new c(ve)},def:function(ve){return a.call(ne,ve)?ne[ve]:ne[ve]=new ie(ve)},hasDef:function(ve){return a.call(ne,ve)}},O=[],k=[];function E(ve,xe){var we=s.call(xe),Ce=new h(ve,function(Me){return s.call(Me)===we});return xe&&typeof xe.constructor=="function"&&(O.push(xe.constructor),k.push(Ce)),Ce}var T=E("string","truthy"),N=E("function",function(){}),_=E("array",[]),I=E("object",{}),j=E("RegExp",/./),L=E("Date",new Date),B=E("number",3),$=E("boolean",!0),z=E("null",null),Y=E("undefined",void 0),W=typeof BigInt=="function"?E("BigInt",BigInt(1234)):new h("BigInt",function(){return!1}),J={string:T,function:N,array:_,object:I,RegExp:j,Date:L,number:B,boolean:$,null:z,undefined:Y,BigInt:W},ne=Object.create(null);function le(ve){if(ve&&typeof ve=="object"){var xe=ve.type;if(typeof xe=="string"&&a.call(ne,xe)){var we=ne[xe];if(we.finalized)return we}}return null}var ie=(function(ve){n.__extends(xe,ve);function xe(we){var Ce=ve.call(this,new h(we,function(Me,Ve){return Ce.check(Me,Ve)}),we)||this;return Ce}return xe.prototype.check=function(we,Ce){if(this.finalized!==!0)throw new Error("prematurely checking unfinalized type "+this.typeName);if(we===null||typeof we!="object")return!1;var Me=le(we);return Me?Ce&&Me===this?this.checkAllFields(we,Ce):this.isSupertypeOf(Me)?Ce?Me.checkAllFields(we,Ce)&&this.checkAllFields(we,!1):!0:!1:this.typeName==="SourceLocation"||this.typeName==="Position"?this.checkAllFields(we,Ce):!1},xe.prototype.build=function(){for(var we=this,Ce=[],Me=0;Me=0&&me(this.typeName)}},xe})(p);function q(ve){if(!a.call(ne,ve))throw new Error("");var xe=ne[ve];if(xe.finalized!==!0)throw new Error("");return xe.supertypeList.slice(1)}function F(ve){for(var xe={},we=Object.keys(ne),Ce=we.length,Me=0;Me=0&&(T[O.name=N]=O)}else E[O.name]=O.value,T[O.name]=O;if(E[O.name]!==O.value)throw new Error("");if(O.parentPath.get(O.name)!==O)throw new Error("");return O}return p.replace=function(k){var E=[],T=this.parentPath.value,N=y(this.parentPath),_=arguments.length;if(w(this),u.check(T)){for(var I=T.length,j=b(this.parentPath,_-1,this.name+1),L=[this.name,1],B=0;B<_;++B)L.push(arguments[B]);var $=T.splice.apply(T,L);if($[0]!==this.value)throw new Error("");if(T.length!==I-1+_)throw new Error("");if(j(),_===0)delete this.value,delete N[this.name],this.__childCache=null;else{if(T[this.name]!==k)throw new Error("");for(this.value!==k&&(this.value=k,this.__childCache=null),B=0;B<_;++B)E.push(this.parentPath.get(this.name+B));if(E[0]!==this)throw new Error("")}}else if(_===1)this.value!==k&&(this.__childCache=null),this.value=T[this.name]=k,E.push(this);else if(_===0)delete T[this.name],delete this.value,this.__childCache=null;else throw new Error("Could not replace path");return E},h}e.default=o,(0,r.maybeSetModuleExports)(function(){return t})})(qb,qb.exports)),qb.exports}var Yb={exports:{}};Yb.exports;var fU;function PPe(){return fU||(fU=1,(function(t,e){Object.defineProperty(e,"__esModule",{value:!0});var n=Bn,r=$r(),i=n.__importDefault(Bi()),s=Object.prototype.hasOwnProperty;function a(o){var l=o.use(i.default),c=l.Type,u=l.namedTypes,f=u.Node,h=u.Expression,p=l.builtInTypes.array,y=l.builders,m=function L(B,$){if(!(this instanceof L))throw new Error("Scope constructor cannot be invoked without 'new'");b.check(B.value)||v.assert(B.value);var z;if($){if(!($ instanceof L))throw new Error("");z=$.depth+1}else $=null,z=0;Object.defineProperties(this,{path:{value:B},node:{value:B.value},isGlobal:{value:!$,enumerable:!0},depth:{value:z},parent:{value:$},bindings:{value:{}},types:{value:{}}})},v=c.or(u.Program,u.Function,u.CatchClause),b=c.or(u.Function,u.ClassDeclaration,u.ClassExpression,u.InterfaceDeclaration,u.TSInterfaceDeclaration,u.TypeAlias,u.TSTypeAliasDeclaration),w=c.or(u.TypeParameter,u.TSTypeParameter);m.isEstablishedBy=function(L){return v.check(L)||b.check(L)};var O=m.prototype;O.didScan=!1,O.declares=function(L){return this.scan(),s.call(this.bindings,L)},O.declaresType=function(L){return this.scan(),s.call(this.types,L)},O.declareTemporary=function(L){if(L){if(!/^[a-z$_]/i.test(L))throw new Error("")}else L="t$";L+=this.depth.toString(36)+"$",this.scan();for(var B=0;this.declares(L+B);)++B;var $=L+B;return this.bindings[$]=l.builders.identifier($)},O.injectTemporary=function(L,B){L||(L=this.declareTemporary());var $=this.path.get("body");return u.BlockStatement.check($.value)&&($=$.get("body")),$.unshift(y.variableDeclaration("var",[y.variableDeclarator(L,B||null)])),L},O.scan=function(L){if(L||!this.didScan){for(var B in this.bindings)delete this.bindings[B];for(var B in this.types)delete this.types[B];k(this.path,this.bindings,this.types),this.didScan=!0}},O.getBindings=function(){return this.scan(),this.bindings},O.getTypes=function(){return this.scan(),this.types};function k(L,B,$){var z=L.value;if(b.check(z)){var Y=L.get("typeParameters","params");p.check(Y.value)&&Y.each(function(W){j(W,$)})}v.check(z)&&(u.CatchClause.check(z)?_(L.get("param"),B):E(L,B,$))}function E(L,B,$){var z=L.value;L.parent&&u.FunctionExpression.check(L.parent.node)&&L.parent.node.id&&_(L.parent.get("id"),B),z&&(p.check(z)?L.each(function(Y){N(Y,B,$)}):u.Function.check(z)?(L.get("params").each(function(Y){_(Y,B)}),N(L.get("body"),B,$),E(L.get("typeParameters"),B,$)):u.TypeAlias&&u.TypeAlias.check(z)||u.InterfaceDeclaration&&u.InterfaceDeclaration.check(z)||u.TSTypeAliasDeclaration&&u.TSTypeAliasDeclaration.check(z)||u.TSInterfaceDeclaration&&u.TSInterfaceDeclaration.check(z)?I(L.get("id"),$):u.VariableDeclarator.check(z)?(_(L.get("id"),B),N(L.get("init"),B,$)):z.type==="ImportSpecifier"||z.type==="ImportNamespaceSpecifier"||z.type==="ImportDefaultSpecifier"?_(L.get(z.local?"local":z.name?"name":"id"),B):f.check(z)&&!h.check(z)&&l.eachField(z,function(Y,W){var J=L.get(Y);if(!T(J,W))throw new Error("");N(J,B,$)}))}function T(L,B){return!!(L.value===B||Array.isArray(L.value)&&L.value.length===0&&Array.isArray(B)&&B.length===0)}function N(L,B,$){var z=L.value;if(!(!z||h.check(z)))if(u.FunctionDeclaration.check(z)&&z.id!==null)_(L.get("id"),B);else if(u.ClassDeclaration&&u.ClassDeclaration.check(z)&&z.id!==null)_(L.get("id"),B),E(L.get("typeParameters"),B,$);else if(u.InterfaceDeclaration&&u.InterfaceDeclaration.check(z)||u.TSInterfaceDeclaration&&u.TSInterfaceDeclaration.check(z))I(L.get("id"),$);else if(v.check(z)){if(u.CatchClause.check(z)&&u.Identifier.check(z.param)){var Y=z.param.name,W=s.call(B,Y);E(L.get("body"),B,$),W||delete B[Y]}}else E(L,B,$)}function _(L,B){var $=L.value;u.Pattern.assert($),u.Identifier.check($)?s.call(B,$.name)?B[$.name].push(L):B[$.name]=[L]:u.AssignmentPattern&&u.AssignmentPattern.check($)?_(L.get("left"),B):u.ObjectPattern&&u.ObjectPattern.check($)?L.get("properties").each(function(z){var Y=z.value;u.Pattern.check(Y)?_(z,B):u.Property.check(Y)||u.ObjectProperty&&u.ObjectProperty.check(Y)?_(z.get("value"),B):u.SpreadProperty&&u.SpreadProperty.check(Y)&&_(z.get("argument"),B)}):u.ArrayPattern&&u.ArrayPattern.check($)?L.get("elements").each(function(z){var Y=z.value;u.Pattern.check(Y)?_(z,B):u.SpreadElement&&u.SpreadElement.check(Y)&&_(z.get("argument"),B)}):u.PropertyPattern&&u.PropertyPattern.check($)?_(L.get("pattern"),B):(u.SpreadElementPattern&&u.SpreadElementPattern.check($)||u.RestElement&&u.RestElement.check($)||u.SpreadPropertyPattern&&u.SpreadPropertyPattern.check($))&&_(L.get("argument"),B)}function I(L,B){var $=L.value;u.Pattern.assert($),u.Identifier.check($)&&(s.call(B,$.name)?B[$.name].push(L):B[$.name]=[L])}function j(L,B){var $=L.value;w.assert($),s.call(B,$.name)?B[$.name].push(L):B[$.name]=[L]}return O.lookup=function(L){for(var B=this;B&&!B.declares(L);B=B.parent);return B},O.lookupType=function(L){for(var B=this;B&&!B.declaresType(L);B=B.parent);return B},O.getGlobalScope=function(){for(var L=this;!L.isGlobal;)L=L.parent;return L},m}e.default=a,(0,r.maybeSetModuleExports)(function(){return t})})(Yb,Yb.exports)),Yb.exports}Wb.exports;var hU;function lle(){return hU||(hU=1,(function(t,e){Object.defineProperty(e,"__esModule",{value:!0});var n=Bn,r=n.__importDefault(Bi()),i=n.__importDefault(ole()),s=n.__importDefault(PPe()),a=$r();function o(l){var c=l.use(r.default),u=c.namedTypes,f=c.builders,h=c.builtInTypes.number,p=c.builtInTypes.array,y=l.use(i.default),m=l.use(s.default),v=function _(I,j,L){if(!(this instanceof _))throw new Error("NodePath constructor cannot be invoked without 'new'");y.call(this,I,j,L)},b=v.prototype=Object.create(y.prototype,{constructor:{value:v,enumerable:!1,writable:!0,configurable:!0}});Object.defineProperties(b,{node:{get:function(){return Object.defineProperty(this,"node",{configurable:!0,value:this._computeNode()}),this.node}},parent:{get:function(){return Object.defineProperty(this,"parent",{configurable:!0,value:this._computeParent()}),this.parent}},scope:{get:function(){return Object.defineProperty(this,"scope",{configurable:!0,value:this._computeScope()}),this.scope}}}),b.replace=function(){return delete this.node,delete this.parent,delete this.scope,y.prototype.replace.apply(this,arguments)},b.prune=function(){var _=this.parent;return this.replace(),T(_)},b._computeNode=function(){var _=this.value;if(u.Node.check(_))return _;var I=this.parentPath;return I&&I.node||null},b._computeParent=function(){var _=this.value,I=this.parentPath;if(!u.Node.check(_)){for(;I&&!u.Node.check(I.value);)I=I.parentPath;I&&(I=I.parentPath)}for(;I&&!u.Node.check(I.value);)I=I.parentPath;return I||null},b._computeScope=function(){var _=this.value,I=this.parentPath,j=I&&I.scope;return u.Node.check(_)&&m.isEstablishedBy(_)&&(j=new m(this,j)),j||null},b.getValueProperty=function(_){return c.getFieldValue(this.value,_)},b.needsParens=function(_){var I=this.parentPath;if(!I)return!1;var j=this.value;if(!u.Expression.check(j)||j.type==="Identifier")return!1;for(;!u.Node.check(I.value);)if(I=I.parentPath,!I)return!1;var L=I.value;switch(j.type){case"UnaryExpression":case"SpreadElement":case"SpreadProperty":return L.type==="MemberExpression"&&this.name==="object"&&L.object===j;case"BinaryExpression":case"LogicalExpression":switch(L.type){case"CallExpression":return this.name==="callee"&&L.callee===j;case"UnaryExpression":case"SpreadElement":case"SpreadProperty":return!0;case"MemberExpression":return this.name==="object"&&L.object===j;case"BinaryExpression":case"LogicalExpression":{var B=j,$=L.operator,z=O[$],Y=B.operator,W=O[Y];if(z>W)return!0;if(z===W&&this.name==="right"){if(L.right!==B)throw new Error("Nodes must be equal");return!0}}default:return!1}case"SequenceExpression":switch(L.type){case"ForStatement":return!1;case"ExpressionStatement":return this.name!=="expression";default:return!0}case"YieldExpression":switch(L.type){case"BinaryExpression":case"LogicalExpression":case"UnaryExpression":case"SpreadElement":case"SpreadProperty":case"CallExpression":case"MemberExpression":case"NewExpression":case"ConditionalExpression":case"YieldExpression":return!0;default:return!1}case"Literal":return L.type==="MemberExpression"&&h.check(j.value)&&this.name==="object"&&L.object===j;case"AssignmentExpression":case"ConditionalExpression":switch(L.type){case"UnaryExpression":case"SpreadElement":case"SpreadProperty":case"BinaryExpression":case"LogicalExpression":return!0;case"CallExpression":return this.name==="callee"&&L.callee===j;case"ConditionalExpression":return this.name==="test"&&L.test===j;case"MemberExpression":return this.name==="object"&&L.object===j;default:return!1}default:if(L.type==="NewExpression"&&this.name==="callee"&&L.callee===j)return k(j)}return!!(_!==!0&&!this.canBeFirstInStatement()&&this.firstInStatement())};function w(_){return u.BinaryExpression.check(_)||u.LogicalExpression.check(_)}var O={};[["||"],["&&"],["|"],["^"],["&"],["==","===","!=","!=="],["<",">","<=",">=","in","instanceof"],[">>","<<",">>>"],["+","-"],["*","/","%"]].forEach(function(_,I){_.forEach(function(j){O[j]=I})});function k(_){return u.CallExpression.check(_)?!0:p.check(_)?_.some(k):u.Node.check(_)?c.someField(_,function(I,j){return k(j)}):!1}b.canBeFirstInStatement=function(){var _=this.node;return!u.FunctionExpression.check(_)&&!u.ObjectExpression.check(_)},b.firstInStatement=function(){return E(this)};function E(_){for(var I,j;_.parent;_=_.parent){if(I=_.node,j=_.parent.node,u.BlockStatement.check(j)&&_.parent.name==="body"&&_.name===0){if(j.body[0]!==I)throw new Error("Nodes must be equal");return!0}if(u.ExpressionStatement.check(j)&&_.name==="expression"){if(j.expression!==I)throw new Error("Nodes must be equal");return!0}if(u.SequenceExpression.check(j)&&_.parent.name==="expressions"&&_.name===0){if(j.expressions[0]!==I)throw new Error("Nodes must be equal");continue}if(u.CallExpression.check(j)&&_.name==="callee"){if(j.callee!==I)throw new Error("Nodes must be equal");continue}if(u.MemberExpression.check(j)&&_.name==="object"){if(j.object!==I)throw new Error("Nodes must be equal");continue}if(u.ConditionalExpression.check(j)&&_.name==="test"){if(j.test!==I)throw new Error("Nodes must be equal");continue}if(w(j)&&_.name==="left"){if(j.left!==I)throw new Error("Nodes must be equal");continue}if(u.UnaryExpression.check(j)&&!j.prefix&&_.name==="argument"){if(j.argument!==I)throw new Error("Nodes must be equal");continue}return!1}return!0}function T(_){if(u.VariableDeclaration.check(_.node)){var I=_.get("declarations").value;if(!I||I.length===0)return _.prune()}else if(u.ExpressionStatement.check(_.node)){if(!_.get("expression").value)return _.prune()}else u.IfStatement.check(_.node)&&N(_);return _}function N(_){var I=_.get("test").value,j=_.get("alternate").value,L=_.get("consequent").value;if(!L&&!j){var B=f.expressionStatement(I);_.replace(B)}else if(!L&&j){var $=f.unaryExpression("!",I,!0);u.UnaryExpression.check(I)&&I.operator==="!"&&($=I.argument),_.get("test").replace($),_.get("consequent").replace(j),_.get("alternate").replace()}}return v}e.default=o,(0,a.maybeSetModuleExports)(function(){return t})})(Wb,Wb.exports)),Wb.exports}Xb.exports;var dU;function MPe(){return dU||(dU=1,(function(t,e){Object.defineProperty(e,"__esModule",{value:!0});var n=Bn,r=n.__importDefault(Bi()),i=n.__importDefault(lle()),s=$r(),a=Object.prototype.hasOwnProperty;function o(l){var c=l.use(r.default),u=l.use(i.default),f=c.builtInTypes.array,h=c.builtInTypes.object,p=c.builtInTypes.function,y,m=function T(){if(!(this instanceof T))throw new Error("PathVisitor constructor cannot be invoked without 'new'");this._reusableContextStack=[],this._methodNameTable=v(this),this._shouldVisitComments=a.call(this._methodNameTable,"Block")||a.call(this._methodNameTable,"Line"),this.Context=k(this),this._visiting=!1,this._changeReported=!1};function v(T){var N=Object.create(null);for(var _ in T)/^visit[A-Z]/.test(_)&&(N[_.slice(5)]=!0);for(var I=c.computeSupertypeLookupTable(N),j=Object.create(null),L=Object.keys(I),B=L.length,$=0;$",">=","<<",">>",">>>","+","-","*","/","%","&","|","^","in","instanceof"],AssignmentOperators:["=","+=","-=","*=","/=","%=","<<=",">>=",">>>=","|=","^=","&="],LogicalOperators:["||","&&"]}}e.default=r,(0,n.maybeSetModuleExports)(function(){return t})})(s2,s2.exports)),s2.exports}i2.exports;var yU;function ule(){return yU||(yU=1,(function(t,e){Object.defineProperty(e,"__esModule",{value:!0});var n=Bn,r=$r(),i=n.__importDefault(cle());function s(a){var o=a.use(i.default);return o.BinaryOperators.indexOf("**")<0&&o.BinaryOperators.push("**"),o.AssignmentOperators.indexOf("**=")<0&&o.AssignmentOperators.push("**="),o}e.default=s,(0,r.maybeSetModuleExports)(function(){return t})})(i2,i2.exports)),i2.exports}r2.exports;var xU;function fle(){return xU||(xU=1,(function(t,e){Object.defineProperty(e,"__esModule",{value:!0});var n=Bn,r=$r(),i=n.__importDefault(ule());function s(a){var o=a.use(i.default);return o.LogicalOperators.indexOf("??")<0&&o.LogicalOperators.push("??"),o}e.default=s,(0,r.maybeSetModuleExports)(function(){return t})})(r2,r2.exports)),r2.exports}n2.exports;var bU;function IPe(){return bU||(bU=1,(function(t,e){Object.defineProperty(e,"__esModule",{value:!0});var n=Bn,r=$r(),i=n.__importDefault(fle());function s(a){var o=a.use(i.default);return o.LogicalOperators.forEach(function(l){var c=l+"=";o.AssignmentOperators.indexOf(c)<0&&o.AssignmentOperators.push(c)}),o}e.default=s,(0,r.maybeSetModuleExports)(function(){return t})})(n2,n2.exports)),n2.exports}var a2={exports:{}},o2={exports:{}},l2={exports:{}},c2={exports:{}},u2={exports:{}},f2={exports:{}},h2={exports:{}};h2.exports;var vU;function _Pe(){return vU||(vU=1,(function(t,e){Object.defineProperty(e,"__esModule",{value:!0});var n=Bn,r=n.__importDefault(cle()),i=n.__importDefault(Bi()),s=n.__importStar($r());function a(o){var l=o.use(i.default),c=l.Type,u=c.def,f=c.or,h=o.use(s.default),p=h.defaults,y=h.geq,m=o.use(r.default),v=m.BinaryOperators,b=m.AssignmentOperators,w=m.LogicalOperators;u("Printable").field("loc",f(u("SourceLocation"),null),p.null,!0),u("Node").bases("Printable").field("type",String).field("comments",f([u("Comment")],null),p.null,!0),u("SourceLocation").field("start",u("Position")).field("end",u("Position")).field("source",f(String,null),p.null),u("Position").field("line",y(1)).field("column",y(0)),u("File").bases("Node").build("program","name").field("program",u("Program")).field("name",f(String,null),p.null),u("Program").bases("Node").build("body").field("body",[u("Statement")]),u("Function").bases("Node").field("id",f(u("Identifier"),null),p.null).field("params",[u("Pattern")]).field("body",u("BlockStatement")).field("generator",Boolean,p.false).field("async",Boolean,p.false),u("Statement").bases("Node"),u("EmptyStatement").bases("Statement").build(),u("BlockStatement").bases("Statement").build("body").field("body",[u("Statement")]),u("ExpressionStatement").bases("Statement").build("expression").field("expression",u("Expression")),u("IfStatement").bases("Statement").build("test","consequent","alternate").field("test",u("Expression")).field("consequent",u("Statement")).field("alternate",f(u("Statement"),null),p.null),u("LabeledStatement").bases("Statement").build("label","body").field("label",u("Identifier")).field("body",u("Statement")),u("BreakStatement").bases("Statement").build("label").field("label",f(u("Identifier"),null),p.null),u("ContinueStatement").bases("Statement").build("label").field("label",f(u("Identifier"),null),p.null),u("WithStatement").bases("Statement").build("object","body").field("object",u("Expression")).field("body",u("Statement")),u("SwitchStatement").bases("Statement").build("discriminant","cases","lexical").field("discriminant",u("Expression")).field("cases",[u("SwitchCase")]).field("lexical",Boolean,p.false),u("ReturnStatement").bases("Statement").build("argument").field("argument",f(u("Expression"),null)),u("ThrowStatement").bases("Statement").build("argument").field("argument",u("Expression")),u("TryStatement").bases("Statement").build("block","handler","finalizer").field("block",u("BlockStatement")).field("handler",f(u("CatchClause"),null),function(){return this.handlers&&this.handlers[0]||null}).field("handlers",[u("CatchClause")],function(){return this.handler?[this.handler]:[]},!0).field("guardedHandlers",[u("CatchClause")],p.emptyArray).field("finalizer",f(u("BlockStatement"),null),p.null),u("CatchClause").bases("Node").build("param","guard","body").field("param",u("Pattern")).field("guard",f(u("Expression"),null),p.null).field("body",u("BlockStatement")),u("WhileStatement").bases("Statement").build("test","body").field("test",u("Expression")).field("body",u("Statement")),u("DoWhileStatement").bases("Statement").build("body","test").field("body",u("Statement")).field("test",u("Expression")),u("ForStatement").bases("Statement").build("init","test","update","body").field("init",f(u("VariableDeclaration"),u("Expression"),null)).field("test",f(u("Expression"),null)).field("update",f(u("Expression"),null)).field("body",u("Statement")),u("ForInStatement").bases("Statement").build("left","right","body").field("left",f(u("VariableDeclaration"),u("Expression"))).field("right",u("Expression")).field("body",u("Statement")),u("DebuggerStatement").bases("Statement").build(),u("Declaration").bases("Statement"),u("FunctionDeclaration").bases("Function","Declaration").build("id","params","body").field("id",u("Identifier")),u("FunctionExpression").bases("Function","Expression").build("id","params","body"),u("VariableDeclaration").bases("Declaration").build("kind","declarations").field("kind",f("var","let","const")).field("declarations",[u("VariableDeclarator")]),u("VariableDeclarator").bases("Node").build("id","init").field("id",u("Pattern")).field("init",f(u("Expression"),null),p.null),u("Expression").bases("Node"),u("ThisExpression").bases("Expression").build(),u("ArrayExpression").bases("Expression").build("elements").field("elements",[f(u("Expression"),null)]),u("ObjectExpression").bases("Expression").build("properties").field("properties",[u("Property")]),u("Property").bases("Node").build("kind","key","value").field("kind",f("init","get","set")).field("key",f(u("Literal"),u("Identifier"))).field("value",u("Expression")),u("SequenceExpression").bases("Expression").build("expressions").field("expressions",[u("Expression")]);var O=f("-","+","!","~","typeof","void","delete");u("UnaryExpression").bases("Expression").build("operator","argument","prefix").field("operator",O).field("argument",u("Expression")).field("prefix",Boolean,p.true);var k=f.apply(void 0,v);u("BinaryExpression").bases("Expression").build("operator","left","right").field("operator",k).field("left",u("Expression")).field("right",u("Expression"));var E=f.apply(void 0,b);u("AssignmentExpression").bases("Expression").build("operator","left","right").field("operator",E).field("left",f(u("Pattern"),u("MemberExpression"))).field("right",u("Expression"));var T=f("++","--");u("UpdateExpression").bases("Expression").build("operator","argument","prefix").field("operator",T).field("argument",u("Expression")).field("prefix",Boolean);var N=f.apply(void 0,w);u("LogicalExpression").bases("Expression").build("operator","left","right").field("operator",N).field("left",u("Expression")).field("right",u("Expression")),u("ConditionalExpression").bases("Expression").build("test","consequent","alternate").field("test",u("Expression")).field("consequent",u("Expression")).field("alternate",u("Expression")),u("NewExpression").bases("Expression").build("callee","arguments").field("callee",u("Expression")).field("arguments",[u("Expression")]),u("CallExpression").bases("Expression").build("callee","arguments").field("callee",u("Expression")).field("arguments",[u("Expression")]),u("MemberExpression").bases("Expression").build("object","property","computed").field("object",u("Expression")).field("property",f(u("Identifier"),u("Expression"))).field("computed",Boolean,function(){var _=this.property.type;return _==="Literal"||_==="MemberExpression"||_==="BinaryExpression"}),u("Pattern").bases("Node"),u("SwitchCase").bases("Node").build("test","consequent").field("test",f(u("Expression"),null)).field("consequent",[u("Statement")]),u("Identifier").bases("Expression","Pattern").build("name").field("name",String).field("optional",Boolean,p.false),u("Literal").bases("Expression").build("value").field("value",f(String,Boolean,null,Number,RegExp,BigInt)),u("Comment").bases("Printable").field("value",String).field("leading",Boolean,p.true).field("trailing",Boolean,p.false)}e.default=a,(0,s.maybeSetModuleExports)(function(){return t})})(h2,h2.exports)),h2.exports}f2.exports;var AU;function RPe(){return AU||(AU=1,(function(t,e){Object.defineProperty(e,"__esModule",{value:!0});var n=Bn,r=n.__importDefault(_Pe()),i=n.__importDefault(Bi()),s=n.__importStar($r());function a(o){o.use(r.default);var l=o.use(i.default),c=l.Type.def,u=l.Type.or,f=o.use(s.default).defaults;c("Function").field("generator",Boolean,f.false).field("expression",Boolean,f.false).field("defaults",[u(c("Expression"),null)],f.emptyArray).field("rest",u(c("Identifier"),null),f.null),c("RestElement").bases("Pattern").build("argument").field("argument",c("Pattern")).field("typeAnnotation",u(c("TypeAnnotation"),c("TSTypeAnnotation"),null),f.null),c("SpreadElementPattern").bases("Pattern").build("argument").field("argument",c("Pattern")),c("FunctionDeclaration").build("id","params","body","generator","expression").field("id",u(c("Identifier"),null)),c("FunctionExpression").build("id","params","body","generator","expression"),c("ArrowFunctionExpression").bases("Function","Expression").build("params","body","expression").field("id",null,f.null).field("body",u(c("BlockStatement"),c("Expression"))).field("generator",!1,f.false),c("ForOfStatement").bases("Statement").build("left","right","body").field("left",u(c("VariableDeclaration"),c("Pattern"))).field("right",c("Expression")).field("body",c("Statement")),c("YieldExpression").bases("Expression").build("argument","delegate").field("argument",u(c("Expression"),null)).field("delegate",Boolean,f.false),c("GeneratorExpression").bases("Expression").build("body","blocks","filter").field("body",c("Expression")).field("blocks",[c("ComprehensionBlock")]).field("filter",u(c("Expression"),null)),c("ComprehensionExpression").bases("Expression").build("body","blocks","filter").field("body",c("Expression")).field("blocks",[c("ComprehensionBlock")]).field("filter",u(c("Expression"),null)),c("ComprehensionBlock").bases("Node").build("left","right","each").field("left",c("Pattern")).field("right",c("Expression")).field("each",Boolean),c("Property").field("key",u(c("Literal"),c("Identifier"),c("Expression"))).field("value",u(c("Expression"),c("Pattern"))).field("method",Boolean,f.false).field("shorthand",Boolean,f.false).field("computed",Boolean,f.false),c("ObjectProperty").field("shorthand",Boolean,f.false),c("PropertyPattern").bases("Pattern").build("key","pattern").field("key",u(c("Literal"),c("Identifier"),c("Expression"))).field("pattern",c("Pattern")).field("computed",Boolean,f.false),c("ObjectPattern").bases("Pattern").build("properties").field("properties",[u(c("PropertyPattern"),c("Property"))]),c("ArrayPattern").bases("Pattern").build("elements").field("elements",[u(c("Pattern"),null)]),c("SpreadElement").bases("Node").build("argument").field("argument",c("Expression")),c("ArrayExpression").field("elements",[u(c("Expression"),c("SpreadElement"),c("RestElement"),null)]),c("NewExpression").field("arguments",[u(c("Expression"),c("SpreadElement"))]),c("CallExpression").field("arguments",[u(c("Expression"),c("SpreadElement"))]),c("AssignmentPattern").bases("Pattern").build("left","right").field("left",c("Pattern")).field("right",c("Expression")),c("MethodDefinition").bases("Declaration").build("kind","key","value","static").field("kind",u("constructor","method","get","set")).field("key",c("Expression")).field("value",c("Function")).field("computed",Boolean,f.false).field("static",Boolean,f.false);var h=u(c("MethodDefinition"),c("VariableDeclarator"),c("ClassPropertyDefinition"),c("ClassProperty"),c("StaticBlock"));c("ClassProperty").bases("Declaration").build("key").field("key",u(c("Literal"),c("Identifier"),c("Expression"))).field("computed",Boolean,f.false),c("ClassPropertyDefinition").bases("Declaration").build("definition").field("definition",h),c("ClassBody").bases("Declaration").build("body").field("body",[h]),c("ClassDeclaration").bases("Declaration").build("id","body","superClass").field("id",u(c("Identifier"),null)).field("body",c("ClassBody")).field("superClass",u(c("Expression"),null),f.null),c("ClassExpression").bases("Expression").build("id","body","superClass").field("id",u(c("Identifier"),null),f.null).field("body",c("ClassBody")).field("superClass",u(c("Expression"),null),f.null),c("Super").bases("Expression").build(),c("Specifier").bases("Node"),c("ModuleSpecifier").bases("Specifier").field("local",u(c("Identifier"),null),f.null).field("id",u(c("Identifier"),null),f.null).field("name",u(c("Identifier"),null),f.null),c("ImportSpecifier").bases("ModuleSpecifier").build("imported","local").field("imported",c("Identifier")),c("ImportDefaultSpecifier").bases("ModuleSpecifier").build("local"),c("ImportNamespaceSpecifier").bases("ModuleSpecifier").build("local"),c("ImportDeclaration").bases("Declaration").build("specifiers","source","importKind").field("specifiers",[u(c("ImportSpecifier"),c("ImportNamespaceSpecifier"),c("ImportDefaultSpecifier"))],f.emptyArray).field("source",c("Literal")).field("importKind",u("value","type"),function(){return"value"}),c("ExportNamedDeclaration").bases("Declaration").build("declaration","specifiers","source").field("declaration",u(c("Declaration"),null)).field("specifiers",[c("ExportSpecifier")],f.emptyArray).field("source",u(c("Literal"),null),f.null),c("ExportSpecifier").bases("ModuleSpecifier").build("local","exported").field("exported",c("Identifier")),c("ExportDefaultDeclaration").bases("Declaration").build("declaration").field("declaration",u(c("Declaration"),c("Expression"))),c("ExportAllDeclaration").bases("Declaration").build("source").field("source",c("Literal")),c("TaggedTemplateExpression").bases("Expression").build("tag","quasi").field("tag",c("Expression")).field("quasi",c("TemplateLiteral")),c("TemplateLiteral").bases("Expression").build("quasis","expressions").field("quasis",[c("TemplateElement")]).field("expressions",[c("Expression")]),c("TemplateElement").bases("Node").build("value","tail").field("value",{cooked:String,raw:String}).field("tail",Boolean),c("MetaProperty").bases("Expression").build("meta","property").field("meta",c("Identifier")).field("property",c("Identifier"))}e.default=a,(0,s.maybeSetModuleExports)(function(){return t})})(f2,f2.exports)),f2.exports}u2.exports;var SU;function jPe(){return SU||(SU=1,(function(t,e){Object.defineProperty(e,"__esModule",{value:!0});var n=Bn,r=n.__importDefault(ule()),i=n.__importDefault(RPe()),s=$r();function a(o){o.use(r.default),o.use(i.default)}e.default=a,(0,s.maybeSetModuleExports)(function(){return t})})(u2,u2.exports)),u2.exports}c2.exports;var wU;function LPe(){return wU||(wU=1,(function(t,e){Object.defineProperty(e,"__esModule",{value:!0});var n=Bn,r=n.__importDefault(jPe()),i=n.__importDefault(Bi()),s=n.__importStar($r());function a(o){o.use(r.default);var l=o.use(i.default),c=l.Type.def,u=o.use(s.default).defaults;c("Function").field("async",Boolean,u.false),c("AwaitExpression").bases("Expression").build("argument").field("argument",c("Expression"))}e.default=a,(0,s.maybeSetModuleExports)(function(){return t})})(c2,c2.exports)),c2.exports}l2.exports;var OU;function FPe(){return OU||(OU=1,(function(t,e){Object.defineProperty(e,"__esModule",{value:!0});var n=Bn,r=n.__importDefault(LPe()),i=n.__importDefault(Bi()),s=n.__importStar($r());function a(o){o.use(r.default);var l=o.use(i.default),c=l.Type.def,u=l.Type.or,f=o.use(s.default).defaults;c("ForOfStatement").field("await",Boolean,f.false),c("SpreadProperty").bases("Node").build("argument").field("argument",c("Expression")),c("ObjectExpression").field("properties",[u(c("Property"),c("SpreadProperty"),c("SpreadElement"))]),c("TemplateElement").field("value",{cooked:u(String,null),raw:String}),c("SpreadPropertyPattern").bases("Pattern").build("argument").field("argument",c("Pattern")),c("ObjectPattern").field("properties",[u(c("PropertyPattern"),c("Property"),c("RestElement"),c("SpreadPropertyPattern"))])}e.default=a,(0,s.maybeSetModuleExports)(function(){return t})})(l2,l2.exports)),l2.exports}o2.exports;var CU;function $Pe(){return CU||(CU=1,(function(t,e){Object.defineProperty(e,"__esModule",{value:!0});var n=Bn,r=n.__importDefault(FPe()),i=n.__importDefault(Bi()),s=n.__importStar($r());function a(o){o.use(r.default);var l=o.use(i.default),c=l.Type.def,u=l.Type.or,f=o.use(s.default).defaults;c("CatchClause").field("param",u(c("Pattern"),null),f.null)}e.default=a,(0,s.maybeSetModuleExports)(function(){return t})})(o2,o2.exports)),o2.exports}a2.exports;var kU;function BPe(){return kU||(kU=1,(function(t,e){Object.defineProperty(e,"__esModule",{value:!0});var n=Bn,r=n.__importDefault(fle()),i=n.__importDefault($Pe()),s=n.__importDefault(Bi()),a=n.__importStar($r());function o(l){l.use(r.default),l.use(i.default);var c=l.use(s.default),u=c.Type.def,f=c.Type.or,h=l.use(a.default),p=h.defaults;u("ImportExpression").bases("Expression").build("source").field("source",u("Expression")),u("ExportAllDeclaration").bases("Declaration").build("source","exported").field("source",u("Literal")).field("exported",f(u("Identifier"),null,void 0),p.null),u("ChainElement").bases("Node").field("optional",Boolean,p.false),u("CallExpression").bases("Expression","ChainElement"),u("MemberExpression").bases("Expression","ChainElement"),u("ChainExpression").bases("Expression").build("expression").field("expression",u("ChainElement")),u("OptionalCallExpression").bases("CallExpression").build("callee","arguments","optional").field("optional",Boolean,p.true),u("OptionalMemberExpression").bases("MemberExpression").build("object","property","computed","optional").field("optional",Boolean,p.true)}e.default=o,(0,a.maybeSetModuleExports)(function(){return t})})(a2,a2.exports)),a2.exports}t2.exports;var EU;function VPe(){return EU||(EU=1,(function(t,e){Object.defineProperty(e,"__esModule",{value:!0});var n=Bn,r=n.__importDefault(IPe()),i=n.__importDefault(BPe()),s=$r();function a(o){o.use(r.default),o.use(i.default)}e.default=a,(0,s.maybeSetModuleExports)(function(){return t})})(t2,t2.exports)),t2.exports}e2.exports;var TU;function HPe(){return TU||(TU=1,(function(t,e){Object.defineProperty(e,"__esModule",{value:!0});var n=Bn,r=n.__importDefault(VPe()),i=n.__importDefault(Bi()),s=$r();function a(o){o.use(r.default);var l=o.use(i.default),c=l.Type.def;c("StaticBlock").bases("Declaration").build("body").field("body",[c("Statement")])}e.default=a,(0,s.maybeSetModuleExports)(function(){return t})})(e2,e2.exports)),e2.exports}Jb.exports;var PU;function pS(){return PU||(PU=1,(function(t,e){Object.defineProperty(e,"__esModule",{value:!0});var n=Bn,r=n.__importDefault(Bi()),i=n.__importStar($r()),s=n.__importDefault(HPe());function a(o){o.use(s.default);var l=o.use(r.default),c=l.Type,u=l.Type.def,f=c.or,h=o.use(i.default),p=h.defaults;u("AwaitExpression").build("argument","all").field("argument",f(u("Expression"),null)).field("all",Boolean,p.false),u("Decorator").bases("Node").build("expression").field("expression",u("Expression")),u("Property").field("decorators",f([u("Decorator")],null),p.null),u("MethodDefinition").field("decorators",f([u("Decorator")],null),p.null),u("PrivateName").bases("Expression","Pattern").build("id").field("id",u("Identifier")),u("ClassPrivateProperty").bases("ClassProperty").build("key","value").field("key",u("PrivateName")).field("value",f(u("Expression"),null),p.null),u("ImportAttribute").bases("Node").build("key","value").field("key",f(u("Identifier"),u("Literal"))).field("value",u("Expression")),["ImportDeclaration","ExportAllDeclaration","ExportNamedDeclaration"].forEach(function(y){u(y).field("assertions",[u("ImportAttribute")],p.emptyArray)}),u("RecordExpression").bases("Expression").build("properties").field("properties",[f(u("ObjectProperty"),u("ObjectMethod"),u("SpreadElement"))]),u("TupleExpression").bases("Expression").build("elements").field("elements",[f(u("Expression"),u("SpreadElement"),null)]),u("ModuleExpression").bases("Node").build("body").field("body",u("Program"))}e.default=a,(0,i.maybeSetModuleExports)(function(){return t})})(Jb,Jb.exports)),Jb.exports}var d2={exports:{}};d2.exports;var MU;function QPe(){return MU||(MU=1,(function(t,e){Object.defineProperty(e,"__esModule",{value:!0});var n=Bn,r=n.__importDefault(pS()),i=n.__importDefault(Bi()),s=n.__importStar($r());function a(o){o.use(r.default);var l=o.use(i.default),c=l.Type.def,u=l.Type.or,f=o.use(s.default).defaults;c("JSXAttribute").bases("Node").build("name","value").field("name",u(c("JSXIdentifier"),c("JSXNamespacedName"))).field("value",u(c("Literal"),c("JSXExpressionContainer"),c("JSXElement"),c("JSXFragment"),null),f.null),c("JSXIdentifier").bases("Identifier").build("name").field("name",String),c("JSXNamespacedName").bases("Node").build("namespace","name").field("namespace",c("JSXIdentifier")).field("name",c("JSXIdentifier")),c("JSXMemberExpression").bases("MemberExpression").build("object","property").field("object",u(c("JSXIdentifier"),c("JSXMemberExpression"))).field("property",c("JSXIdentifier")).field("computed",Boolean,f.false);var h=u(c("JSXIdentifier"),c("JSXNamespacedName"),c("JSXMemberExpression"));c("JSXSpreadAttribute").bases("Node").build("argument").field("argument",c("Expression"));var p=[u(c("JSXAttribute"),c("JSXSpreadAttribute"))];c("JSXExpressionContainer").bases("Expression").build("expression").field("expression",u(c("Expression"),c("JSXEmptyExpression")));var y=[u(c("JSXText"),c("JSXExpressionContainer"),c("JSXSpreadChild"),c("JSXElement"),c("JSXFragment"),c("Literal"))];c("JSXElement").bases("Expression").build("openingElement","closingElement","children").field("openingElement",c("JSXOpeningElement")).field("closingElement",u(c("JSXClosingElement"),null),f.null).field("children",y,f.emptyArray).field("name",h,function(){return this.openingElement.name},!0).field("selfClosing",Boolean,function(){return this.openingElement.selfClosing},!0).field("attributes",p,function(){return this.openingElement.attributes},!0),c("JSXOpeningElement").bases("Node").build("name","attributes","selfClosing").field("name",h).field("attributes",p,f.emptyArray).field("selfClosing",Boolean,f.false),c("JSXClosingElement").bases("Node").build("name").field("name",h),c("JSXFragment").bases("Expression").build("openingFragment","closingFragment","children").field("openingFragment",c("JSXOpeningFragment")).field("closingFragment",c("JSXClosingFragment")).field("children",y,f.emptyArray),c("JSXOpeningFragment").bases("Node").build(),c("JSXClosingFragment").bases("Node").build(),c("JSXText").bases("Literal").build("value","raw").field("value",String).field("raw",String,function(){return this.value}),c("JSXEmptyExpression").bases("Node").build(),c("JSXSpreadChild").bases("Node").build("expression").field("expression",c("Expression"))}e.default=a,(0,s.maybeSetModuleExports)(function(){return t})})(d2,d2.exports)),d2.exports}var p2={exports:{}},m2={exports:{}};m2.exports;var NU;function hle(){return NU||(NU=1,(function(t,e){Object.defineProperty(e,"__esModule",{value:!0});var n=Bn,r=n.__importDefault(Bi()),i=n.__importStar($r());function s(a){var o=a.use(r.default),l=o.Type.def,c=o.Type.or,u=a.use(i.default).defaults,f=c(l("TypeAnnotation"),l("TSTypeAnnotation"),null),h=c(l("TypeParameterDeclaration"),l("TSTypeParameterDeclaration"),null);l("Identifier").field("typeAnnotation",f,u.null),l("ObjectPattern").field("typeAnnotation",f,u.null),l("Function").field("returnType",f,u.null).field("typeParameters",h,u.null),l("ClassProperty").build("key","value","typeAnnotation","static").field("value",c(l("Expression"),null)).field("static",Boolean,u.false).field("typeAnnotation",f,u.null),["ClassDeclaration","ClassExpression"].forEach(function(p){l(p).field("typeParameters",h,u.null).field("superTypeParameters",c(l("TypeParameterInstantiation"),l("TSTypeParameterInstantiation"),null),u.null).field("implements",c([l("ClassImplements")],[l("TSExpressionWithTypeArguments")]),u.emptyArray)})}e.default=s,(0,i.maybeSetModuleExports)(function(){return t})})(m2,m2.exports)),m2.exports}p2.exports;var DU;function dle(){return DU||(DU=1,(function(t,e){Object.defineProperty(e,"__esModule",{value:!0});var n=Bn,r=n.__importDefault(pS()),i=n.__importDefault(hle()),s=n.__importDefault(Bi()),a=n.__importStar($r());function o(l){l.use(r.default),l.use(i.default);var c=l.use(s.default),u=c.Type.def,f=c.Type.or,h=l.use(a.default).defaults;u("Flow").bases("Node"),u("FlowType").bases("Flow"),u("AnyTypeAnnotation").bases("FlowType").build(),u("EmptyTypeAnnotation").bases("FlowType").build(),u("MixedTypeAnnotation").bases("FlowType").build(),u("VoidTypeAnnotation").bases("FlowType").build(),u("SymbolTypeAnnotation").bases("FlowType").build(),u("NumberTypeAnnotation").bases("FlowType").build(),u("BigIntTypeAnnotation").bases("FlowType").build(),u("NumberLiteralTypeAnnotation").bases("FlowType").build("value","raw").field("value",Number).field("raw",String),u("NumericLiteralTypeAnnotation").bases("FlowType").build("value","raw").field("value",Number).field("raw",String),u("BigIntLiteralTypeAnnotation").bases("FlowType").build("value","raw").field("value",null).field("raw",String),u("StringTypeAnnotation").bases("FlowType").build(),u("StringLiteralTypeAnnotation").bases("FlowType").build("value","raw").field("value",String).field("raw",String),u("BooleanTypeAnnotation").bases("FlowType").build(),u("BooleanLiteralTypeAnnotation").bases("FlowType").build("value","raw").field("value",Boolean).field("raw",String),u("TypeAnnotation").bases("Node").build("typeAnnotation").field("typeAnnotation",u("FlowType")),u("NullableTypeAnnotation").bases("FlowType").build("typeAnnotation").field("typeAnnotation",u("FlowType")),u("NullLiteralTypeAnnotation").bases("FlowType").build(),u("NullTypeAnnotation").bases("FlowType").build(),u("ThisTypeAnnotation").bases("FlowType").build(),u("ExistsTypeAnnotation").bases("FlowType").build(),u("ExistentialTypeParam").bases("FlowType").build(),u("FunctionTypeAnnotation").bases("FlowType").build("params","returnType","rest","typeParameters").field("params",[u("FunctionTypeParam")]).field("returnType",u("FlowType")).field("rest",f(u("FunctionTypeParam"),null)).field("typeParameters",f(u("TypeParameterDeclaration"),null)),u("FunctionTypeParam").bases("Node").build("name","typeAnnotation","optional").field("name",f(u("Identifier"),null)).field("typeAnnotation",u("FlowType")).field("optional",Boolean),u("ArrayTypeAnnotation").bases("FlowType").build("elementType").field("elementType",u("FlowType")),u("ObjectTypeAnnotation").bases("FlowType").build("properties","indexers","callProperties").field("properties",[f(u("ObjectTypeProperty"),u("ObjectTypeSpreadProperty"))]).field("indexers",[u("ObjectTypeIndexer")],h.emptyArray).field("callProperties",[u("ObjectTypeCallProperty")],h.emptyArray).field("inexact",f(Boolean,void 0),h.undefined).field("exact",Boolean,h.false).field("internalSlots",[u("ObjectTypeInternalSlot")],h.emptyArray),u("Variance").bases("Node").build("kind").field("kind",f("plus","minus"));var p=f(u("Variance"),"plus","minus",null);u("ObjectTypeProperty").bases("Node").build("key","value","optional").field("key",f(u("Literal"),u("Identifier"))).field("value",u("FlowType")).field("optional",Boolean).field("variance",p,h.null),u("ObjectTypeIndexer").bases("Node").build("id","key","value").field("id",u("Identifier")).field("key",u("FlowType")).field("value",u("FlowType")).field("variance",p,h.null).field("static",Boolean,h.false),u("ObjectTypeCallProperty").bases("Node").build("value").field("value",u("FunctionTypeAnnotation")).field("static",Boolean,h.false),u("QualifiedTypeIdentifier").bases("Node").build("qualification","id").field("qualification",f(u("Identifier"),u("QualifiedTypeIdentifier"))).field("id",u("Identifier")),u("GenericTypeAnnotation").bases("FlowType").build("id","typeParameters").field("id",f(u("Identifier"),u("QualifiedTypeIdentifier"))).field("typeParameters",f(u("TypeParameterInstantiation"),null)),u("MemberTypeAnnotation").bases("FlowType").build("object","property").field("object",u("Identifier")).field("property",f(u("MemberTypeAnnotation"),u("GenericTypeAnnotation"))),u("IndexedAccessType").bases("FlowType").build("objectType","indexType").field("objectType",u("FlowType")).field("indexType",u("FlowType")),u("OptionalIndexedAccessType").bases("FlowType").build("objectType","indexType","optional").field("objectType",u("FlowType")).field("indexType",u("FlowType")).field("optional",Boolean),u("UnionTypeAnnotation").bases("FlowType").build("types").field("types",[u("FlowType")]),u("IntersectionTypeAnnotation").bases("FlowType").build("types").field("types",[u("FlowType")]),u("TypeofTypeAnnotation").bases("FlowType").build("argument").field("argument",u("FlowType")),u("ObjectTypeSpreadProperty").bases("Node").build("argument").field("argument",u("FlowType")),u("ObjectTypeInternalSlot").bases("Node").build("id","value","optional","static","method").field("id",u("Identifier")).field("value",u("FlowType")).field("optional",Boolean).field("static",Boolean).field("method",Boolean),u("TypeParameterDeclaration").bases("Node").build("params").field("params",[u("TypeParameter")]),u("TypeParameterInstantiation").bases("Node").build("params").field("params",[u("FlowType")]),u("TypeParameter").bases("FlowType").build("name","variance","bound","default").field("name",String).field("variance",p,h.null).field("bound",f(u("TypeAnnotation"),null),h.null).field("default",f(u("FlowType"),null),h.null),u("ClassProperty").field("variance",p,h.null),u("ClassImplements").bases("Node").build("id").field("id",u("Identifier")).field("superClass",f(u("Expression"),null),h.null).field("typeParameters",f(u("TypeParameterInstantiation"),null),h.null),u("InterfaceTypeAnnotation").bases("FlowType").build("body","extends").field("body",u("ObjectTypeAnnotation")).field("extends",f([u("InterfaceExtends")],null),h.null),u("InterfaceDeclaration").bases("Declaration").build("id","body","extends").field("id",u("Identifier")).field("typeParameters",f(u("TypeParameterDeclaration"),null),h.null).field("body",u("ObjectTypeAnnotation")).field("extends",[u("InterfaceExtends")]),u("DeclareInterface").bases("InterfaceDeclaration").build("id","body","extends"),u("InterfaceExtends").bases("Node").build("id").field("id",u("Identifier")).field("typeParameters",f(u("TypeParameterInstantiation"),null),h.null),u("TypeAlias").bases("Declaration").build("id","typeParameters","right").field("id",u("Identifier")).field("typeParameters",f(u("TypeParameterDeclaration"),null)).field("right",u("FlowType")),u("DeclareTypeAlias").bases("TypeAlias").build("id","typeParameters","right"),u("OpaqueType").bases("Declaration").build("id","typeParameters","impltype","supertype").field("id",u("Identifier")).field("typeParameters",f(u("TypeParameterDeclaration"),null)).field("impltype",u("FlowType")).field("supertype",f(u("FlowType"),null)),u("DeclareOpaqueType").bases("OpaqueType").build("id","typeParameters","supertype").field("impltype",f(u("FlowType"),null)),u("TypeCastExpression").bases("Expression").build("expression","typeAnnotation").field("expression",u("Expression")).field("typeAnnotation",u("TypeAnnotation")),u("TupleTypeAnnotation").bases("FlowType").build("types").field("types",[u("FlowType")]),u("DeclareVariable").bases("Statement").build("id").field("id",u("Identifier")),u("DeclareFunction").bases("Statement").build("id").field("id",u("Identifier")).field("predicate",f(u("FlowPredicate"),null),h.null),u("DeclareClass").bases("InterfaceDeclaration").build("id"),u("DeclareModule").bases("Statement").build("id","body").field("id",f(u("Identifier"),u("Literal"))).field("body",u("BlockStatement")),u("DeclareModuleExports").bases("Statement").build("typeAnnotation").field("typeAnnotation",u("TypeAnnotation")),u("DeclareExportDeclaration").bases("Declaration").build("default","declaration","specifiers","source").field("default",Boolean).field("declaration",f(u("DeclareVariable"),u("DeclareFunction"),u("DeclareClass"),u("FlowType"),u("TypeAlias"),u("DeclareOpaqueType"),u("InterfaceDeclaration"),null)).field("specifiers",[f(u("ExportSpecifier"),u("ExportBatchSpecifier"))],h.emptyArray).field("source",f(u("Literal"),null),h.null),u("DeclareExportAllDeclaration").bases("Declaration").build("source").field("source",f(u("Literal"),null),h.null),u("ImportDeclaration").field("importKind",f("value","type","typeof"),function(){return"value"}),u("FlowPredicate").bases("Flow"),u("InferredPredicate").bases("FlowPredicate").build(),u("DeclaredPredicate").bases("FlowPredicate").build("value").field("value",u("Expression")),u("Function").field("predicate",f(u("FlowPredicate"),null),h.null),u("CallExpression").field("typeArguments",f(null,u("TypeParameterInstantiation")),h.null),u("NewExpression").field("typeArguments",f(null,u("TypeParameterInstantiation")),h.null),u("EnumDeclaration").bases("Declaration").build("id","body").field("id",u("Identifier")).field("body",f(u("EnumBooleanBody"),u("EnumNumberBody"),u("EnumStringBody"),u("EnumSymbolBody"))),u("EnumBooleanBody").build("members","explicitType").field("members",[u("EnumBooleanMember")]).field("explicitType",Boolean),u("EnumNumberBody").build("members","explicitType").field("members",[u("EnumNumberMember")]).field("explicitType",Boolean),u("EnumStringBody").build("members","explicitType").field("members",f([u("EnumStringMember")],[u("EnumDefaultedMember")])).field("explicitType",Boolean),u("EnumSymbolBody").build("members").field("members",[u("EnumDefaultedMember")]),u("EnumBooleanMember").build("id","init").field("id",u("Identifier")).field("init",f(u("Literal"),Boolean)),u("EnumNumberMember").build("id","init").field("id",u("Identifier")).field("init",u("Literal")),u("EnumStringMember").build("id","init").field("id",u("Identifier")).field("init",u("Literal")),u("EnumDefaultedMember").build("id").field("id",u("Identifier"))}e.default=o,(0,a.maybeSetModuleExports)(function(){return t})})(p2,p2.exports)),p2.exports}var g2={exports:{}};g2.exports;var IU;function zPe(){return IU||(IU=1,(function(t,e){Object.defineProperty(e,"__esModule",{value:!0});var n=Bn,r=n.__importDefault(pS()),i=n.__importDefault(Bi()),s=n.__importStar($r());function a(o){o.use(r.default);var l=o.use(i.default),c=o.use(s.default).defaults,u=l.Type.def,f=l.Type.or;u("VariableDeclaration").field("declarations",[f(u("VariableDeclarator"),u("Identifier"))]),u("Property").field("value",f(u("Expression"),u("Pattern"))),u("ArrayPattern").field("elements",[f(u("Pattern"),u("SpreadElement"),null)]),u("ObjectPattern").field("properties",[f(u("Property"),u("PropertyPattern"),u("SpreadPropertyPattern"),u("SpreadProperty"))]),u("ExportSpecifier").bases("ModuleSpecifier").build("id","name"),u("ExportBatchSpecifier").bases("Specifier").build(),u("ExportDeclaration").bases("Declaration").build("default","declaration","specifiers","source").field("default",Boolean).field("declaration",f(u("Declaration"),u("Expression"),null)).field("specifiers",[f(u("ExportSpecifier"),u("ExportBatchSpecifier"))],c.emptyArray).field("source",f(u("Literal"),null),c.null),u("Block").bases("Comment").build("value","leading","trailing"),u("Line").bases("Comment").build("value","leading","trailing")}e.default=a,(0,s.maybeSetModuleExports)(function(){return t})})(g2,g2.exports)),g2.exports}var y2={exports:{}},x2={exports:{}};x2.exports;var _U;function ple(){return _U||(_U=1,(function(t,e){Object.defineProperty(e,"__esModule",{value:!0});var n=Bn,r=n.__importDefault(pS()),i=n.__importDefault(Bi()),s=n.__importStar($r());function a(o){var l,c,u,f,h;o.use(r.default);var p=o.use(i.default),y=o.use(s.default).defaults,m=p.Type.def,v=p.Type.or,b=p.builtInTypes.undefined;m("Noop").bases("Statement").build(),m("DoExpression").bases("Expression").build("body").field("body",[m("Statement")]),m("BindExpression").bases("Expression").build("object","callee").field("object",v(m("Expression"),null)).field("callee",m("Expression")),m("ParenthesizedExpression").bases("Expression").build("expression").field("expression",m("Expression")),m("ExportNamespaceSpecifier").bases("Specifier").build("exported").field("exported",m("Identifier")),m("ExportDefaultSpecifier").bases("Specifier").build("exported").field("exported",m("Identifier")),m("CommentBlock").bases("Comment").build("value","leading","trailing"),m("CommentLine").bases("Comment").build("value","leading","trailing"),m("Directive").bases("Node").build("value").field("value",m("DirectiveLiteral")),m("DirectiveLiteral").bases("Node","Expression").build("value").field("value",String,y["use strict"]),m("InterpreterDirective").bases("Node").build("value").field("value",String),m("BlockStatement").bases("Statement").build("body").field("body",[m("Statement")]).field("directives",[m("Directive")],y.emptyArray),m("Program").bases("Node").build("body").field("body",[m("Statement")]).field("directives",[m("Directive")],y.emptyArray).field("interpreter",v(m("InterpreterDirective"),null),y.null);function w(T,N){return T===void 0&&(T=String),["extra",{rawValue:T,raw:String},function(){var I=p.getFieldValue(this,"value");return{rawValue:I,raw:N?N(I):String(I)}}]}(l=m("StringLiteral").bases("Literal").build("value").field("value",String)).field.apply(l,w(String,function(T){return JSON.stringify(T)})),(c=m("NumericLiteral").bases("Literal").build("value").field("value",Number).field("raw",v(String,null),y.null)).field.apply(c,w(Number)),(u=m("BigIntLiteral").bases("Literal").build("value").field("value",v(String,Number))).field.apply(u,w(String,function(T){return T+"n"})),(f=m("DecimalLiteral").bases("Literal").build("value").field("value",String)).field.apply(f,w(String,function(T){return T+"m"})),m("NullLiteral").bases("Literal").build().field("value",null,y.null),m("BooleanLiteral").bases("Literal").build("value").field("value",Boolean),(h=m("RegExpLiteral").bases("Literal").build("pattern","flags").field("pattern",String).field("flags",String).field("value",RegExp,function(){return new RegExp(this.pattern,this.flags)})).field.apply(h,w(v(RegExp,b),function(T){return"/".concat(T.pattern,"/").concat(T.flags||"")})).field("regex",{pattern:String,flags:String},function(){return{pattern:this.pattern,flags:this.flags}});var O=v(m("Property"),m("ObjectMethod"),m("ObjectProperty"),m("SpreadProperty"),m("SpreadElement"));m("ObjectExpression").bases("Expression").build("properties").field("properties",[O]),m("ObjectMethod").bases("Node","Function").build("kind","key","params","body","computed").field("kind",v("method","get","set")).field("key",v(m("Literal"),m("Identifier"),m("Expression"))).field("params",[m("Pattern")]).field("body",m("BlockStatement")).field("computed",Boolean,y.false).field("generator",Boolean,y.false).field("async",Boolean,y.false).field("accessibility",v(m("Literal"),null),y.null).field("decorators",v([m("Decorator")],null),y.null),m("ObjectProperty").bases("Node").build("key","value").field("key",v(m("Literal"),m("Identifier"),m("Expression"))).field("value",v(m("Expression"),m("Pattern"))).field("accessibility",v(m("Literal"),null),y.null).field("computed",Boolean,y.false);var k=v(m("MethodDefinition"),m("VariableDeclarator"),m("ClassPropertyDefinition"),m("ClassProperty"),m("ClassPrivateProperty"),m("ClassMethod"),m("ClassPrivateMethod"),m("ClassAccessorProperty"),m("StaticBlock"));m("ClassBody").bases("Declaration").build("body").field("body",[k]),m("ClassMethod").bases("Declaration","Function").build("kind","key","params","body","computed","static").field("key",v(m("Literal"),m("Identifier"),m("Expression"))),m("ClassPrivateMethod").bases("Declaration","Function").build("key","params","body","kind","computed","static").field("key",m("PrivateName")),m("ClassAccessorProperty").bases("Declaration").build("key","value","decorators","computed","static").field("key",v(m("Literal"),m("Identifier"),m("PrivateName"),m("Expression"))).field("value",v(m("Expression"),null),y.null),["ClassMethod","ClassPrivateMethod"].forEach(function(T){m(T).field("kind",v("get","set","method","constructor"),function(){return"method"}).field("body",m("BlockStatement")).field("access",v("public","private","protected",null),y.null)}),["ClassMethod","ClassPrivateMethod","ClassAccessorProperty"].forEach(function(T){m(T).field("computed",Boolean,y.false).field("static",Boolean,y.false).field("abstract",Boolean,y.false).field("accessibility",v("public","private","protected",null),y.null).field("decorators",v([m("Decorator")],null),y.null).field("definite",Boolean,y.false).field("optional",Boolean,y.false).field("override",Boolean,y.false).field("readonly",Boolean,y.false)});var E=v(m("Property"),m("PropertyPattern"),m("SpreadPropertyPattern"),m("SpreadProperty"),m("ObjectProperty"),m("RestProperty"),m("RestElement"));m("ObjectPattern").bases("Pattern").build("properties").field("properties",[E]).field("decorators",v([m("Decorator")],null),y.null),m("SpreadProperty").bases("Node").build("argument").field("argument",m("Expression")),m("RestProperty").bases("Node").build("argument").field("argument",m("Expression")),m("ForAwaitStatement").bases("Statement").build("left","right","body").field("left",v(m("VariableDeclaration"),m("Expression"))).field("right",m("Expression")).field("body",m("Statement")),m("Import").bases("Expression").build()}e.default=a,(0,s.maybeSetModuleExports)(function(){return t})})(x2,x2.exports)),x2.exports}y2.exports;var RU;function ZPe(){return RU||(RU=1,(function(t,e){Object.defineProperty(e,"__esModule",{value:!0});var n=Bn,r=n.__importDefault(Bi()),i=n.__importDefault(ple()),s=n.__importDefault(dle()),a=$r();function o(l){var c=l.use(r.default),u=c.Type.def;l.use(i.default),l.use(s.default),u("V8IntrinsicIdentifier").bases("Expression").build("name").field("name",String),u("TopicReference").bases("Expression").build()}e.default=o,(0,a.maybeSetModuleExports)(function(){return t})})(y2,y2.exports)),y2.exports}var b2={exports:{}};b2.exports;var jU;function GPe(){return jU||(jU=1,(function(t,e){Object.defineProperty(e,"__esModule",{value:!0});var n=Bn,r=n.__importDefault(ple()),i=n.__importDefault(hle()),s=n.__importDefault(Bi()),a=n.__importStar($r());function o(l){l.use(r.default),l.use(i.default);var c=l.use(s.default),u=c.namedTypes,f=c.Type.def,h=c.Type.or,p=l.use(a.default).defaults,y=c.Type.from(function(w,O){return!!(u.StringLiteral&&u.StringLiteral.check(w,O)||u.Literal&&u.Literal.check(w,O)&&typeof w.value=="string")},"StringLiteral");f("TSType").bases("Node");var m=h(f("Identifier"),f("TSQualifiedName"));f("TSTypeReference").bases("TSType","TSHasOptionalTypeParameterInstantiation").build("typeName","typeParameters").field("typeName",m),f("TSHasOptionalTypeParameterInstantiation").field("typeParameters",h(f("TSTypeParameterInstantiation"),null),p.null),f("TSHasOptionalTypeParameters").field("typeParameters",h(f("TSTypeParameterDeclaration"),null,void 0),p.null),f("TSHasOptionalTypeAnnotation").field("typeAnnotation",h(f("TSTypeAnnotation"),null),p.null),f("TSQualifiedName").bases("Node").build("left","right").field("left",m).field("right",m),f("TSAsExpression").bases("Expression","Pattern").build("expression","typeAnnotation").field("expression",f("Expression")).field("typeAnnotation",f("TSType")).field("extra",h({parenthesized:Boolean},null),p.null),f("TSTypeCastExpression").bases("Expression").build("expression","typeAnnotation").field("expression",f("Expression")).field("typeAnnotation",f("TSType")),f("TSSatisfiesExpression").bases("Expression","Pattern").build("expression","typeAnnotation").field("expression",f("Expression")).field("typeAnnotation",f("TSType")),f("TSNonNullExpression").bases("Expression","Pattern").build("expression").field("expression",f("Expression")),["TSAnyKeyword","TSBigIntKeyword","TSBooleanKeyword","TSNeverKeyword","TSNullKeyword","TSNumberKeyword","TSObjectKeyword","TSStringKeyword","TSSymbolKeyword","TSUndefinedKeyword","TSUnknownKeyword","TSVoidKeyword","TSIntrinsicKeyword","TSThisType"].forEach(function(w){f(w).bases("TSType").build()}),f("TSArrayType").bases("TSType").build("elementType").field("elementType",f("TSType")),f("TSLiteralType").bases("TSType").build("literal").field("literal",h(f("NumericLiteral"),f("StringLiteral"),f("BooleanLiteral"),f("TemplateLiteral"),f("UnaryExpression"),f("BigIntLiteral"))),f("TemplateLiteral").field("expressions",h([f("Expression")],[f("TSType")])),["TSUnionType","TSIntersectionType"].forEach(function(w){f(w).bases("TSType").build("types").field("types",[f("TSType")])}),f("TSConditionalType").bases("TSType").build("checkType","extendsType","trueType","falseType").field("checkType",f("TSType")).field("extendsType",f("TSType")).field("trueType",f("TSType")).field("falseType",f("TSType")),f("TSInferType").bases("TSType").build("typeParameter").field("typeParameter",f("TSTypeParameter")),f("TSParenthesizedType").bases("TSType").build("typeAnnotation").field("typeAnnotation",f("TSType"));var v=[h(f("Identifier"),f("RestElement"),f("ArrayPattern"),f("ObjectPattern"))];["TSFunctionType","TSConstructorType"].forEach(function(w){f(w).bases("TSType","TSHasOptionalTypeParameters","TSHasOptionalTypeAnnotation").build("parameters").field("parameters",v)}),f("TSDeclareFunction").bases("Declaration","TSHasOptionalTypeParameters").build("id","params","returnType").field("declare",Boolean,p.false).field("async",Boolean,p.false).field("generator",Boolean,p.false).field("id",h(f("Identifier"),null),p.null).field("params",[f("Pattern")]).field("returnType",h(f("TSTypeAnnotation"),f("Noop"),null),p.null),f("TSDeclareMethod").bases("Declaration","TSHasOptionalTypeParameters").build("key","params","returnType").field("async",Boolean,p.false).field("generator",Boolean,p.false).field("params",[f("Pattern")]).field("abstract",Boolean,p.false).field("accessibility",h("public","private","protected",void 0),p.undefined).field("static",Boolean,p.false).field("computed",Boolean,p.false).field("optional",Boolean,p.false).field("key",h(f("Identifier"),f("StringLiteral"),f("NumericLiteral"),f("Expression"))).field("kind",h("get","set","method","constructor"),function(){return"method"}).field("access",h("public","private","protected",void 0),p.undefined).field("decorators",h([f("Decorator")],null),p.null).field("returnType",h(f("TSTypeAnnotation"),f("Noop"),null),p.null),f("TSMappedType").bases("TSType").build("typeParameter","typeAnnotation").field("readonly",h(Boolean,"+","-"),p.false).field("typeParameter",f("TSTypeParameter")).field("optional",h(Boolean,"+","-"),p.false).field("typeAnnotation",h(f("TSType"),null),p.null),f("TSTupleType").bases("TSType").build("elementTypes").field("elementTypes",[h(f("TSType"),f("TSNamedTupleMember"))]),f("TSNamedTupleMember").bases("TSType").build("label","elementType","optional").field("label",f("Identifier")).field("optional",Boolean,p.false).field("elementType",f("TSType")),f("TSRestType").bases("TSType").build("typeAnnotation").field("typeAnnotation",f("TSType")),f("TSOptionalType").bases("TSType").build("typeAnnotation").field("typeAnnotation",f("TSType")),f("TSIndexedAccessType").bases("TSType").build("objectType","indexType").field("objectType",f("TSType")).field("indexType",f("TSType")),f("TSTypeOperator").bases("TSType").build("operator").field("operator",String).field("typeAnnotation",f("TSType")),f("TSTypeAnnotation").bases("Node").build("typeAnnotation").field("typeAnnotation",h(f("TSType"),f("TSTypeAnnotation"))),f("TSIndexSignature").bases("Declaration","TSHasOptionalTypeAnnotation").build("parameters","typeAnnotation").field("parameters",[f("Identifier")]).field("readonly",Boolean,p.false),f("TSPropertySignature").bases("Declaration","TSHasOptionalTypeAnnotation").build("key","typeAnnotation","optional").field("key",f("Expression")).field("computed",Boolean,p.false).field("readonly",Boolean,p.false).field("optional",Boolean,p.false).field("initializer",h(f("Expression"),null),p.null),f("TSMethodSignature").bases("Declaration","TSHasOptionalTypeParameters","TSHasOptionalTypeAnnotation").build("key","parameters","typeAnnotation").field("key",f("Expression")).field("computed",Boolean,p.false).field("optional",Boolean,p.false).field("parameters",v),f("TSTypePredicate").bases("TSTypeAnnotation","TSType").build("parameterName","typeAnnotation","asserts").field("parameterName",h(f("Identifier"),f("TSThisType"))).field("typeAnnotation",h(f("TSTypeAnnotation"),null),p.null).field("asserts",Boolean,p.false),["TSCallSignatureDeclaration","TSConstructSignatureDeclaration"].forEach(function(w){f(w).bases("Declaration","TSHasOptionalTypeParameters","TSHasOptionalTypeAnnotation").build("parameters","typeAnnotation").field("parameters",v)}),f("TSEnumMember").bases("Node").build("id","initializer").field("id",h(f("Identifier"),y)).field("initializer",h(f("Expression"),null),p.null),f("TSTypeQuery").bases("TSType").build("exprName").field("exprName",h(m,f("TSImportType")));var b=h(f("TSCallSignatureDeclaration"),f("TSConstructSignatureDeclaration"),f("TSIndexSignature"),f("TSMethodSignature"),f("TSPropertySignature"));f("TSTypeLiteral").bases("TSType").build("members").field("members",[b]),f("TSTypeParameter").bases("Identifier").build("name","constraint","default").field("name",h(f("Identifier"),String)).field("constraint",h(f("TSType"),void 0),p.undefined).field("default",h(f("TSType"),void 0),p.undefined),f("TSTypeAssertion").bases("Expression","Pattern").build("typeAnnotation","expression").field("typeAnnotation",f("TSType")).field("expression",f("Expression")).field("extra",h({parenthesized:Boolean},null),p.null),f("TSTypeParameterDeclaration").bases("Declaration").build("params").field("params",[f("TSTypeParameter")]),f("TSInstantiationExpression").bases("Expression","TSHasOptionalTypeParameterInstantiation").build("expression","typeParameters").field("expression",f("Expression")),f("TSTypeParameterInstantiation").bases("Node").build("params").field("params",[f("TSType")]),f("TSEnumDeclaration").bases("Declaration").build("id","members").field("id",f("Identifier")).field("const",Boolean,p.false).field("declare",Boolean,p.false).field("members",[f("TSEnumMember")]).field("initializer",h(f("Expression"),null),p.null),f("TSTypeAliasDeclaration").bases("Declaration","TSHasOptionalTypeParameters").build("id","typeAnnotation").field("id",f("Identifier")).field("declare",Boolean,p.false).field("typeAnnotation",f("TSType")),f("TSModuleBlock").bases("Node").build("body").field("body",[f("Statement")]),f("TSModuleDeclaration").bases("Declaration").build("id","body").field("id",h(y,m)).field("declare",Boolean,p.false).field("global",Boolean,p.false).field("body",h(f("TSModuleBlock"),f("TSModuleDeclaration"),null),p.null),f("TSImportType").bases("TSType","TSHasOptionalTypeParameterInstantiation").build("argument","qualifier","typeParameters").field("argument",y).field("qualifier",h(m,void 0),p.undefined),f("TSImportEqualsDeclaration").bases("Declaration").build("id","moduleReference").field("id",f("Identifier")).field("isExport",Boolean,p.false).field("moduleReference",h(m,f("TSExternalModuleReference"))),f("TSExternalModuleReference").bases("Declaration").build("expression").field("expression",y),f("TSExportAssignment").bases("Statement").build("expression").field("expression",f("Expression")),f("TSNamespaceExportDeclaration").bases("Declaration").build("id").field("id",f("Identifier")),f("TSInterfaceBody").bases("Node").build("body").field("body",[b]),f("TSExpressionWithTypeArguments").bases("TSType","TSHasOptionalTypeParameterInstantiation").build("expression","typeParameters").field("expression",m),f("TSInterfaceDeclaration").bases("Declaration","TSHasOptionalTypeParameters").build("id","body").field("id",m).field("declare",Boolean,p.false).field("extends",h([f("TSExpressionWithTypeArguments")],null),p.null).field("body",f("TSInterfaceBody")),f("TSParameterProperty").bases("Pattern").build("parameter").field("accessibility",h("public","private","protected",void 0),p.undefined).field("readonly",Boolean,p.false).field("parameter",h(f("Identifier"),f("AssignmentPattern"))),f("ClassProperty").field("access",h("public","private","protected",void 0),p.undefined),f("ClassAccessorProperty").bases("Declaration","TSHasOptionalTypeAnnotation"),f("ClassBody").field("body",[h(f("MethodDefinition"),f("VariableDeclarator"),f("ClassPropertyDefinition"),f("ClassProperty"),f("ClassPrivateProperty"),f("ClassAccessorProperty"),f("ClassMethod"),f("ClassPrivateMethod"),f("StaticBlock"),f("TSDeclareMethod"),b)])}e.default=o,(0,a.maybeSetModuleExports)(function(){return t})})(b2,b2.exports)),b2.exports}var rM={},LU;function UPe(){return LU||(LU=1,(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.namedTypes=void 0,t.namedTypes||(t.namedTypes={})})(rM)),rM}var FU;function Md(){return FU||(FU=1,(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.visit=t.use=t.Type=t.someField=t.PathVisitor=t.Path=t.NodePath=t.namedTypes=t.getSupertypeNames=t.getFieldValue=t.getFieldNames=t.getBuilderName=t.finalize=t.eachField=t.defineMethod=t.builtInTypes=t.builders=t.astNodesAreEquivalent=void 0;var e=Bn,n=e.__importDefault(DPe()),r=e.__importDefault(pS()),i=e.__importDefault(QPe()),s=e.__importDefault(dle()),a=e.__importDefault(zPe()),o=e.__importDefault(ZPe()),l=e.__importDefault(GPe()),c=UPe();Object.defineProperty(t,"namedTypes",{enumerable:!0,get:function(){return c.namedTypes}});var u=(0,n.default)([r.default,i.default,s.default,a.default,o.default,l.default]),f=u.astNodesAreEquivalent,h=u.builders,p=u.builtInTypes,y=u.defineMethod,m=u.eachField,v=u.finalize,b=u.getBuilderName,w=u.getFieldNames,O=u.getFieldValue,k=u.getSupertypeNames,E=u.namedTypes,T=u.NodePath,N=u.Path,_=u.PathVisitor,I=u.someField,j=u.Type,L=u.use,B=u.visit;t.astNodesAreEquivalent=f,t.builders=h,t.builtInTypes=p,t.defineMethod=y,t.eachField=m,t.finalize=v,t.getBuilderName=b,t.getFieldNames=w,t.getFieldValue=O,t.getSupertypeNames=k,t.NodePath=T,t.Path=N,t.PathVisitor=_,t.someField=I,t.Type=j,t.use=L,t.visit=B,Object.assign(c.namedTypes,E)})(nM)),nM}var Wx={},iM,$U;function Gd(){if($U)return iM;$U=1;var t="Invariant failed";function e(n,r){if(!n)throw new Error(t)}return iM=e,iM}var qx={},zr={},Yx={},sM={},QO={},zO={},BU;function XPe(){if(BU)return zO;BU=1;var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split("");return zO.encode=function(e){if(0<=e&&e>1;return l?-c:c}return QO.encode=function(l){var c="",u,f=s(l);do u=f&r,f>>>=e,f>0&&(u|=i),c+=t.encode(u);while(f>0);return c},QO.decode=function(l,c,u){var f=l.length,h=0,p=0,y,m;do{if(c>=f)throw new Error("Expected more digits in base 64 VLQ value.");if(m=t.decode(l.charCodeAt(c++)),m===-1)throw new Error("Invalid base64 digit: "+l.charAt(c-1));y=!!(m&i),m&=r,h=h+(m<=0;L--)I=_[L],I==="."?_.splice(L,1):I===".."?j++:j>0&&(I===""?(_.splice(L+1,j),j=0):(_.splice(L,2),j--));return E=_.join("/"),E===""&&(E=N?"/":"."),T?(T.path=E,s(T)):E}t.normalize=a;function o(k,E){k===""&&(k="."),E===""&&(E=".");var T=i(E),N=i(k);if(N&&(k=N.path||"/"),T&&!T.scheme)return N&&(T.scheme=N.scheme),s(T);if(T||E.match(r))return E;if(N&&!N.host&&!N.path)return N.host=E,s(N);var _=E.charAt(0)==="/"?E:a(k.replace(/\/+$/,"")+"/"+E);return N?(N.path=_,s(N)):_}t.join=o,t.isAbsolute=function(k){return k.charAt(0)==="/"||n.test(k)};function l(k,E){k===""&&(k="."),k=k.replace(/\/$/,"");for(var T=0;E.indexOf(k+"/")!==0;){var N=k.lastIndexOf("/");if(N<0||(k=k.slice(0,N),k.match(/^([^\/]+:\/)?\/*$/)))return E;++T}return Array(T+1).join("../")+E.substr(k.length+1)}t.relative=l;var c=(function(){var k=Object.create(null);return!("__proto__"in k)})();function u(k){return k}function f(k){return p(k)?"$"+k:k}t.toSetString=c?u:f;function h(k){return p(k)?k.slice(1):k}t.fromSetString=c?u:h;function p(k){if(!k)return!1;var E=k.length;if(E<9||k.charCodeAt(E-1)!==95||k.charCodeAt(E-2)!==95||k.charCodeAt(E-3)!==111||k.charCodeAt(E-4)!==116||k.charCodeAt(E-5)!==111||k.charCodeAt(E-6)!==114||k.charCodeAt(E-7)!==112||k.charCodeAt(E-8)!==95||k.charCodeAt(E-9)!==95)return!1;for(var T=E-10;T>=0;T--)if(k.charCodeAt(T)!==36)return!1;return!0}function y(k,E,T){var N=v(k.source,E.source);return N!==0||(N=k.originalLine-E.originalLine,N!==0)||(N=k.originalColumn-E.originalColumn,N!==0||T)||(N=k.generatedColumn-E.generatedColumn,N!==0)||(N=k.generatedLine-E.generatedLine,N!==0)?N:v(k.name,E.name)}t.compareByOriginalPositions=y;function m(k,E,T){var N=k.generatedLine-E.generatedLine;return N!==0||(N=k.generatedColumn-E.generatedColumn,N!==0||T)||(N=v(k.source,E.source),N!==0)||(N=k.originalLine-E.originalLine,N!==0)||(N=k.originalColumn-E.originalColumn,N!==0)?N:v(k.name,E.name)}t.compareByGeneratedPositionsDeflated=m;function v(k,E){return k===E?0:k===null?1:E===null?-1:k>E?1:-1}function b(k,E){var T=k.generatedLine-E.generatedLine;return T!==0||(T=k.generatedColumn-E.generatedColumn,T!==0)||(T=v(k.source,E.source),T!==0)||(T=k.originalLine-E.originalLine,T!==0)||(T=k.originalColumn-E.originalColumn,T!==0)?T:v(k.name,E.name)}t.compareByGeneratedPositionsInflated=b;function w(k){return JSON.parse(k.replace(/^\)]}'[^\n]*\n/,""))}t.parseSourceMapInput=w;function O(k,E,T){if(E=E||"",k&&(k[k.length-1]!=="/"&&E[0]!=="/"&&(k+="/"),E=k+E),T){var N=i(T);if(!N)throw new Error("sourceMapURL could not be parsed");if(N.path){var _=N.path.lastIndexOf("/");_>=0&&(N.path=N.path.substring(0,_+1))}E=o(s(N),E)}return a(E)}t.computeSourceURL=O})(aM)),aM}var oM={},QU;function gle(){if(QU)return oM;QU=1;var t=mS(),e=Object.prototype.hasOwnProperty,n=typeof Map<"u";function r(){this._array=[],this._set=n?new Map:Object.create(null)}return r.fromArray=function(s,a){for(var o=new r,l=0,c=s.length;l=0)return a}else{var o=t.toSetString(s);if(e.call(this._set,o))return this._set[o]}throw new Error('"'+s+'" is not in the set.')},r.prototype.at=function(s){if(s>=0&&ss||a==s&&l>=o||t.compareByGeneratedPositionsInflated(r,i)<=0}function n(){this._array=[],this._sorted=!0,this._last={generatedLine:-1,generatedColumn:0}}return n.prototype.unsortedForEach=function(i,s){this._array.forEach(i,s)},n.prototype.add=function(i){e(this._last,i)?(this._last=i,this._array.push(i)):(this._sorted=!1,this._array.push(i))},n.prototype.toArray=function(){return this._sorted||(this._array.sort(t.compareByGeneratedPositionsInflated),this._sorted=!0),this._array},lM.MappingList=n,lM}var ZU;function yle(){if(ZU)return sM;ZU=1;var t=mle(),e=mS(),n=gle().ArraySet,r=WPe().MappingList;function i(s){s||(s={}),this._file=e.getArg(s,"file",null),this._sourceRoot=e.getArg(s,"sourceRoot",null),this._skipValidation=e.getArg(s,"skipValidation",!1),this._sources=new n,this._names=new n,this._mappings=new r,this._sourcesContents=null}return i.prototype._version=3,i.fromSourceMap=function(a){var o=a.sourceRoot,l=new i({file:a.file,sourceRoot:o});return a.eachMapping(function(c){var u={generated:{line:c.generatedLine,column:c.generatedColumn}};c.source!=null&&(u.source=c.source,o!=null&&(u.source=e.relative(o,u.source)),u.original={line:c.originalLine,column:c.originalColumn},c.name!=null&&(u.name=c.name)),l.addMapping(u)}),a.sources.forEach(function(c){var u=c;o!==null&&(u=e.relative(o,c)),l._sources.has(u)||l._sources.add(u);var f=a.sourceContentFor(c);f!=null&&l.setSourceContent(c,f)}),l},i.prototype.addMapping=function(a){var o=e.getArg(a,"generated"),l=e.getArg(a,"original",null),c=e.getArg(a,"source",null),u=e.getArg(a,"name",null);this._skipValidation||this._validateMapping(o,l,c,u),c!=null&&(c=String(c),this._sources.has(c)||this._sources.add(c)),u!=null&&(u=String(u),this._names.has(u)||this._names.add(u)),this._mappings.add({generatedLine:o.line,generatedColumn:o.column,originalLine:l!=null&&l.line,originalColumn:l!=null&&l.column,source:c,name:u})},i.prototype.setSourceContent=function(a,o){var l=a;this._sourceRoot!=null&&(l=e.relative(this._sourceRoot,l)),o!=null?(this._sourcesContents||(this._sourcesContents=Object.create(null)),this._sourcesContents[e.toSetString(l)]=o):this._sourcesContents&&(delete this._sourcesContents[e.toSetString(l)],Object.keys(this._sourcesContents).length===0&&(this._sourcesContents=null))},i.prototype.applySourceMap=function(a,o,l){var c=o;if(o==null){if(a.file==null)throw new Error(`SourceMapGenerator.prototype.applySourceMap requires either an explicit source file, or the source map's "file" property. Both were omitted.`);c=a.file}var u=this._sourceRoot;u!=null&&(c=e.relative(u,c));var f=new n,h=new n;this._mappings.unsortedForEach(function(p){if(p.source===c&&p.originalLine!=null){var y=a.originalPositionFor({line:p.originalLine,column:p.originalColumn});y.source!=null&&(p.source=y.source,l!=null&&(p.source=e.join(l,p.source)),u!=null&&(p.source=e.relative(u,p.source)),p.originalLine=y.line,p.originalColumn=y.column,y.name!=null&&(p.name=y.name))}var m=p.source;m!=null&&!f.has(m)&&f.add(m);var v=p.name;v!=null&&!h.has(v)&&h.add(v)},this),this._sources=f,this._names=h,a.sources.forEach(function(p){var y=a.sourceContentFor(p);y!=null&&(l!=null&&(p=e.join(l,p)),u!=null&&(p=e.relative(u,p)),this.setSourceContent(p,y))},this)},i.prototype._validateMapping=function(a,o,l,c){if(o&&typeof o.line!="number"&&typeof o.column!="number")throw new Error("original.line and original.column are not numbers -- you probably meant to omit the original mapping entirely and only map the generated position. If so, pass null for the original mapping instead of an object with empty or null values.");if(!(a&&"line"in a&&"column"in a&&a.line>0&&a.column>=0&&!o&&!l&&!c)){if(a&&"line"in a&&"column"in a&&o&&"line"in o&&"column"in o&&a.line>0&&a.column>=0&&o.line>0&&o.column>=0&&l)return;throw new Error("Invalid mapping: "+JSON.stringify({generated:a,source:l,original:o,name:c}))}},i.prototype._serializeMappings=function(){for(var a=0,o=1,l=0,c=0,u=0,f=0,h="",p,y,m,v,b=this._mappings.toArray(),w=0,O=b.length;w0){if(!e.compareByGeneratedPositionsInflated(y,b[w-1]))continue;p+=","}p+=t.encode(y.generatedColumn-a),a=y.generatedColumn,y.source!=null&&(v=this._sources.indexOf(y.source),p+=t.encode(v-f),f=v,p+=t.encode(y.originalLine-1-c),c=y.originalLine-1,p+=t.encode(y.originalColumn-l),l=y.originalColumn,y.name!=null&&(m=this._names.indexOf(y.name),p+=t.encode(m-u),u=m)),h+=p}return h},i.prototype._generateSourcesContent=function(a,o){return a.map(function(l){if(!this._sourcesContents)return null;o!=null&&(l=e.relative(o,l));var c=e.toSetString(l);return Object.prototype.hasOwnProperty.call(this._sourcesContents,c)?this._sourcesContents[c]:null},this)},i.prototype.toJSON=function(){var a={version:this._version,sources:this._sources.toArray(),names:this._names.toArray(),mappings:this._serializeMappings()};return this._file!=null&&(a.file=this._file),this._sourceRoot!=null&&(a.sourceRoot=this._sourceRoot),this._sourcesContents&&(a.sourcesContent=this._generateSourcesContent(a.sources,a.sourceRoot)),a},i.prototype.toString=function(){return JSON.stringify(this.toJSON())},sM.SourceMapGenerator=i,sM}var Kx={},cM={},GU;function qPe(){return GU||(GU=1,(function(t){t.GREATEST_LOWER_BOUND=1,t.LEAST_UPPER_BOUND=2;function e(n,r,i,s,a,o){var l=Math.floor((r-n)/2)+n,c=a(i,s[l],!0);return c===0?l:c>0?r-l>1?e(l,r,i,s,a,o):o==t.LEAST_UPPER_BOUND?r1?e(n,l,i,s,a,o):o==t.LEAST_UPPER_BOUND?l:n<0?-1:n}t.search=function(r,i,s,a){if(i.length===0)return-1;var o=e(-1,i.length,r,i,s,a||t.GREATEST_LOWER_BOUND);if(o<0)return-1;for(;o-1>=0&&s(i[o],i[o-1],!0)===0;)--o;return o}})(cM)),cM}var uM={},UU;function YPe(){if(UU)return uM;UU=1;function t(r,i,s){var a=r[i];r[i]=r[s],r[s]=a}function e(r,i){return Math.round(r+Math.random()*(i-r))}function n(r,i,s,a){if(s=0){var m=this._originalMappings[y];if(u.column===void 0)for(var v=m.originalLine;m&&m.originalLine===v;)p.push({line:t.getArg(m,"generatedLine",null),column:t.getArg(m,"generatedColumn",null),lastColumn:t.getArg(m,"lastGeneratedColumn",null)}),m=this._originalMappings[++y];else for(var b=m.originalColumn;m&&m.originalLine===f&&m.originalColumn==b;)p.push({line:t.getArg(m,"generatedLine",null),column:t.getArg(m,"generatedColumn",null),lastColumn:t.getArg(m,"lastGeneratedColumn",null)}),m=this._originalMappings[++y]}return p},Kx.SourceMapConsumer=s;function a(c,u){var f=c;typeof c=="string"&&(f=t.parseSourceMapInput(c));var h=t.getArg(f,"version"),p=t.getArg(f,"sources"),y=t.getArg(f,"names",[]),m=t.getArg(f,"sourceRoot",null),v=t.getArg(f,"sourcesContent",null),b=t.getArg(f,"mappings"),w=t.getArg(f,"file",null);if(h!=this._version)throw new Error("Unsupported version: "+h);m&&(m=t.normalize(m)),p=p.map(String).map(t.normalize).map(function(O){return m&&t.isAbsolute(m)&&t.isAbsolute(O)?t.relative(m,O):O}),this._names=n.fromArray(y.map(String),!0),this._sources=n.fromArray(p,!0),this._absoluteSources=this._sources.toArray().map(function(O){return t.computeSourceURL(m,O,u)}),this.sourceRoot=m,this.sourcesContent=v,this._mappings=b,this._sourceMapURL=u,this.file=w}a.prototype=Object.create(s.prototype),a.prototype.consumer=s,a.prototype._findSourceIndex=function(c){var u=c;if(this.sourceRoot!=null&&(u=t.relative(this.sourceRoot,u)),this._sources.has(u))return this._sources.indexOf(u);var f;for(f=0;f1&&(_.source=v+j[1],v+=j[1],_.originalLine=y+j[2],y=_.originalLine,_.originalLine+=1,_.originalColumn=m+j[3],m=_.originalColumn,j.length>4&&(_.name=b+j[4],b+=j[4])),N.push(_),typeof _.originalLine=="number"&&T.push(_)}i(N,t.compareByGeneratedPositionsDeflated),this.__generatedMappings=N,i(T,t.compareByOriginalPositions),this.__originalMappings=T},a.prototype._findMapping=function(u,f,h,p,y,m){if(u[h]<=0)throw new TypeError("Line must be greater than or equal to 1, got "+u[h]);if(u[p]<0)throw new TypeError("Column must be greater than or equal to 0, got "+u[p]);return e.search(u,f,y,m)},a.prototype.computeColumnSpans=function(){for(var u=0;u=0){var p=this._generatedMappings[h];if(p.generatedLine===f.generatedLine){var y=t.getArg(p,"source",null);y!==null&&(y=this._sources.at(y),y=t.computeSourceURL(this.sourceRoot,y,this._sourceMapURL));var m=t.getArg(p,"name",null);return m!==null&&(m=this._names.at(m)),{source:y,line:t.getArg(p,"originalLine",null),column:t.getArg(p,"originalColumn",null),name:m}}}return{source:null,line:null,column:null,name:null}},a.prototype.hasContentsOfAllSources=function(){return this.sourcesContent?this.sourcesContent.length>=this._sources.size()&&!this.sourcesContent.some(function(u){return u==null}):!1},a.prototype.sourceContentFor=function(u,f){if(!this.sourcesContent)return null;var h=this._findSourceIndex(u);if(h>=0)return this.sourcesContent[h];var p=u;this.sourceRoot!=null&&(p=t.relative(this.sourceRoot,p));var y;if(this.sourceRoot!=null&&(y=t.urlParse(this.sourceRoot))){var m=p.replace(/^file:\/\//,"");if(y.scheme=="file"&&this._sources.has(m))return this.sourcesContent[this._sources.indexOf(m)];if((!y.path||y.path=="/")&&this._sources.has("/"+p))return this.sourcesContent[this._sources.indexOf("/"+p)]}if(f)return null;throw new Error('"'+p+'" is not in the SourceMap.')},a.prototype.generatedPositionFor=function(u){var f=t.getArg(u,"source");if(f=this._findSourceIndex(f),f<0)return{line:null,column:null,lastColumn:null};var h={source:f,originalLine:t.getArg(u,"line"),originalColumn:t.getArg(u,"column")},p=this._findMapping(h,this._originalMappings,"originalLine","originalColumn",t.compareByOriginalPositions,t.getArg(u,"bias",s.GREATEST_LOWER_BOUND));if(p>=0){var y=this._originalMappings[p];if(y.source===h.source)return{line:t.getArg(y,"generatedLine",null),column:t.getArg(y,"generatedColumn",null),lastColumn:t.getArg(y,"lastGeneratedColumn",null)}}return{line:null,column:null,lastColumn:null}},Kx.BasicSourceMapConsumer=a;function l(c,u){var f=c;typeof c=="string"&&(f=t.parseSourceMapInput(c));var h=t.getArg(f,"version"),p=t.getArg(f,"sections");if(h!=this._version)throw new Error("Unsupported version: "+h);this._sources=new n,this._names=new n;var y={line:-1,column:0};this._sections=p.map(function(m){if(m.url)throw new Error("Support for url field in sections not implemented.");var v=t.getArg(m,"offset"),b=t.getArg(v,"line"),w=t.getArg(v,"column");if(b=0;l--)this.prepend(o[l]);else if(o[i]||typeof o=="string")this.children.unshift(o);else throw new TypeError("Expected a SourceNode, string, or an array of SourceNodes and strings. Got "+o);return this},s.prototype.walk=function(o){for(var l,c=0,u=this.children.length;c0){for(l=[],c=0;c=0;--f){var h=this.leading[f];c.end.offset>=h.start&&(u.unshift(h.comment),this.leading.splice(f,1),this.trailing.splice(f,1))}u.length&&(l.innerComments=u)}},o.prototype.findTrailingComments=function(l){var c=[];if(this.trailing.length>0){for(var u=this.trailing.length-1;u>=0;--u){var f=this.trailing[u];f.start>=l.end.offset&&c.unshift(f.comment)}return this.trailing.length=0,c}var h=this.stack[this.stack.length-1];if(h&&h.node.trailingComments){var p=h.node.trailingComments[0];p&&p.range[0]>=l.end.offset&&(c=h.node.trailingComments,delete h.node.trailingComments)}return c},o.prototype.findLeadingComments=function(l){for(var c=[],u;this.stack.length>0;){var f=this.stack[this.stack.length-1];if(f&&f.start>=l.start.offset)u=f.node,this.stack.pop();else break}if(u){for(var h=u.leadingComments?u.leadingComments.length:0,p=h-1;p>=0;--p){var y=u.leadingComments[p];y.range[1]<=l.start.offset&&(c.unshift(y),u.leadingComments.splice(p,1))}return u.leadingComments&&u.leadingComments.length===0&&delete u.leadingComments,c}for(var p=this.leading.length-1;p>=0;--p){var f=this.leading[p];f.start<=l.start.offset&&(c.unshift(f.comment),this.leading.splice(p,1))}return c},o.prototype.visitNode=function(l,c){if(!(l.type===s.Syntax.Program&&l.body.length>0)){this.insertInnerComments(l,c);var u=this.findTrailingComments(c),f=this.findLeadingComments(c);f.length>0&&(l.leadingComments=f),u.length>0&&(l.trailingComments=u),this.stack.push({node:l,start:c.start.offset})}},o.prototype.visitComment=function(l,c){var u=l.type[0]==="L"?"Line":"Block",f={type:u,value:l.value};if(l.range&&(f.range=l.range),l.loc&&(f.loc=l.loc),this.comments.push(f),this.attach){var h={comment:{type:u,value:l.value,range:[c.start.offset,c.end.offset]},start:c.start.offset};l.loc&&(h.comment.loc=l.loc),l.type=u,this.leading.push(h),this.trailing.push(h)}},o.prototype.visit=function(l,c){l.type==="LineComment"?this.visitComment(l,c):l.type==="BlockComment"?this.visitComment(l,c):this.attach&&this.visitNode(l,c)},o})();r.CommentHandler=a},function(n,r){Object.defineProperty(r,"__esModule",{value:!0}),r.Syntax={AssignmentExpression:"AssignmentExpression",AssignmentPattern:"AssignmentPattern",ArrayExpression:"ArrayExpression",ArrayPattern:"ArrayPattern",ArrowFunctionExpression:"ArrowFunctionExpression",AwaitExpression:"AwaitExpression",BlockStatement:"BlockStatement",BinaryExpression:"BinaryExpression",BreakStatement:"BreakStatement",CallExpression:"CallExpression",CatchClause:"CatchClause",ClassBody:"ClassBody",ClassDeclaration:"ClassDeclaration",ClassExpression:"ClassExpression",ConditionalExpression:"ConditionalExpression",ContinueStatement:"ContinueStatement",DoWhileStatement:"DoWhileStatement",DebuggerStatement:"DebuggerStatement",EmptyStatement:"EmptyStatement",ExportAllDeclaration:"ExportAllDeclaration",ExportDefaultDeclaration:"ExportDefaultDeclaration",ExportNamedDeclaration:"ExportNamedDeclaration",ExportSpecifier:"ExportSpecifier",ExpressionStatement:"ExpressionStatement",ForStatement:"ForStatement",ForOfStatement:"ForOfStatement",ForInStatement:"ForInStatement",FunctionDeclaration:"FunctionDeclaration",FunctionExpression:"FunctionExpression",Identifier:"Identifier",IfStatement:"IfStatement",ImportDeclaration:"ImportDeclaration",ImportDefaultSpecifier:"ImportDefaultSpecifier",ImportNamespaceSpecifier:"ImportNamespaceSpecifier",ImportSpecifier:"ImportSpecifier",Literal:"Literal",LabeledStatement:"LabeledStatement",LogicalExpression:"LogicalExpression",MemberExpression:"MemberExpression",MetaProperty:"MetaProperty",MethodDefinition:"MethodDefinition",NewExpression:"NewExpression",ObjectExpression:"ObjectExpression",ObjectPattern:"ObjectPattern",Program:"Program",Property:"Property",RestElement:"RestElement",ReturnStatement:"ReturnStatement",SequenceExpression:"SequenceExpression",SpreadElement:"SpreadElement",Super:"Super",SwitchCase:"SwitchCase",SwitchStatement:"SwitchStatement",TaggedTemplateExpression:"TaggedTemplateExpression",TemplateElement:"TemplateElement",TemplateLiteral:"TemplateLiteral",ThisExpression:"ThisExpression",ThrowStatement:"ThrowStatement",TryStatement:"TryStatement",UnaryExpression:"UnaryExpression",UpdateExpression:"UpdateExpression",VariableDeclaration:"VariableDeclaration",VariableDeclarator:"VariableDeclarator",WhileStatement:"WhileStatement",WithStatement:"WithStatement",YieldExpression:"YieldExpression"}},function(n,r,i){var s=this&&this.__extends||(function(){var m=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(v,b){v.__proto__=b}||function(v,b){for(var w in b)b.hasOwnProperty(w)&&(v[w]=b[w])};return function(v,b){m(v,b);function w(){this.constructor=v}v.prototype=b===null?Object.create(b):(w.prototype=b.prototype,new w)}})();Object.defineProperty(r,"__esModule",{value:!0});var a=i(4),o=i(5),l=i(6),c=i(7),u=i(8),f=i(13),h=i(14);f.TokenName[100]="JSXIdentifier",f.TokenName[101]="JSXText";function p(m){var v;switch(m.type){case l.JSXSyntax.JSXIdentifier:var b=m;v=b.name;break;case l.JSXSyntax.JSXNamespacedName:var w=m;v=p(w.namespace)+":"+p(w.name);break;case l.JSXSyntax.JSXMemberExpression:var O=m;v=p(O.object)+"."+p(O.property);break}return v}var y=(function(m){s(v,m);function v(b,w,O){return m.call(this,b,w,O)||this}return v.prototype.parsePrimaryExpression=function(){return this.match("<")?this.parseJSXRoot():m.prototype.parsePrimaryExpression.call(this)},v.prototype.startJSX=function(){this.scanner.index=this.startMarker.index,this.scanner.lineNumber=this.startMarker.line,this.scanner.lineStart=this.startMarker.index-this.startMarker.column},v.prototype.finishJSX=function(){this.nextToken()},v.prototype.reenterJSX=function(){this.startJSX(),this.expectJSX("}"),this.config.tokens&&this.tokens.pop()},v.prototype.createJSXNode=function(){return this.collectComments(),{index:this.scanner.index,line:this.scanner.lineNumber,column:this.scanner.index-this.scanner.lineStart}},v.prototype.createJSXChildNode=function(){return{index:this.scanner.index,line:this.scanner.lineNumber,column:this.scanner.index-this.scanner.lineStart}},v.prototype.scanXHTMLEntity=function(b){for(var w="&",O=!0,k=!1,E=!1,T=!1;!this.scanner.eof()&&O&&!k;){var N=this.scanner.source[this.scanner.index];if(N===b)break;if(k=N===";",w+=N,++this.scanner.index,!k)switch(w.length){case 2:E=N==="#";break;case 3:E&&(T=N==="x",O=T||a.Character.isDecimalDigit(N.charCodeAt(0)),E=E&&!T);break;default:O=O&&!(E&&!a.Character.isDecimalDigit(N.charCodeAt(0))),O=O&&!(T&&!a.Character.isHexDigit(N.charCodeAt(0)));break}}if(O&&k&&w.length>2){var _=w.substr(1,w.length-2);E&&_.length>1?w=String.fromCharCode(parseInt(_.substr(1),10)):T&&_.length>2?w=String.fromCharCode(parseInt("0"+_.substr(1),16)):!E&&!T&&h.XHTMLEntities[_]&&(w=h.XHTMLEntities[_])}return w},v.prototype.lexJSX=function(){var b=this.scanner.source.charCodeAt(this.scanner.index);if(b===60||b===62||b===47||b===58||b===61||b===123||b===125){var w=this.scanner.source[this.scanner.index++];return{type:7,value:w,lineNumber:this.scanner.lineNumber,lineStart:this.scanner.lineStart,start:this.scanner.index-1,end:this.scanner.index}}if(b===34||b===39){for(var O=this.scanner.index,k=this.scanner.source[this.scanner.index++],E="";!this.scanner.eof();){var T=this.scanner.source[this.scanner.index++];if(T===k)break;T==="&"?E+=this.scanXHTMLEntity(k):E+=T}return{type:8,value:E,lineNumber:this.scanner.lineNumber,lineStart:this.scanner.lineStart,start:O,end:this.scanner.index}}if(b===46){var N=this.scanner.source.charCodeAt(this.scanner.index+1),_=this.scanner.source.charCodeAt(this.scanner.index+2),w=N===46&&_===46?"...":".",O=this.scanner.index;return this.scanner.index+=w.length,{type:7,value:w,lineNumber:this.scanner.lineNumber,lineStart:this.scanner.lineStart,start:O,end:this.scanner.index}}if(b===96)return{type:10,value:"",lineNumber:this.scanner.lineNumber,lineStart:this.scanner.lineStart,start:this.scanner.index,end:this.scanner.index};if(a.Character.isIdentifierStart(b)&&b!==92){var O=this.scanner.index;for(++this.scanner.index;!this.scanner.eof();){var T=this.scanner.source.charCodeAt(this.scanner.index);if(a.Character.isIdentifierPart(T)&&T!==92)++this.scanner.index;else if(T===45)++this.scanner.index;else break}var I=this.scanner.source.slice(O,this.scanner.index);return{type:100,value:I,lineNumber:this.scanner.lineNumber,lineStart:this.scanner.lineStart,start:O,end:this.scanner.index}}return this.scanner.lex()},v.prototype.nextJSXToken=function(){this.collectComments(),this.startMarker.index=this.scanner.index,this.startMarker.line=this.scanner.lineNumber,this.startMarker.column=this.scanner.index-this.scanner.lineStart;var b=this.lexJSX();return this.lastMarker.index=this.scanner.index,this.lastMarker.line=this.scanner.lineNumber,this.lastMarker.column=this.scanner.index-this.scanner.lineStart,this.config.tokens&&this.tokens.push(this.convertToken(b)),b},v.prototype.nextJSXText=function(){this.startMarker.index=this.scanner.index,this.startMarker.line=this.scanner.lineNumber,this.startMarker.column=this.scanner.index-this.scanner.lineStart;for(var b=this.scanner.index,w="";!this.scanner.eof();){var O=this.scanner.source[this.scanner.index];if(O==="{"||O==="<")break;++this.scanner.index,w+=O,a.Character.isLineTerminator(O.charCodeAt(0))&&(++this.scanner.lineNumber,O==="\r"&&this.scanner.source[this.scanner.index]===` `&&++this.scanner.index,this.scanner.lineStart=this.scanner.index)}this.lastMarker.index=this.scanner.index,this.lastMarker.line=this.scanner.lineNumber,this.lastMarker.column=this.scanner.index-this.scanner.lineStart;var k={type:101,value:w,lineNumber:this.scanner.lineNumber,lineStart:this.scanner.lineStart,start:b,end:this.scanner.index};return w.length>0&&this.config.tokens&&this.tokens.push(this.convertToken(k)),k},v.prototype.peekJSXToken=function(){var b=this.scanner.saveState();this.scanner.scanComments();var w=this.lexJSX();return this.scanner.restoreState(b),w},v.prototype.expectJSX=function(b){var w=this.nextJSXToken();(w.type!==7||w.value!==b)&&this.throwUnexpectedToken(w)},v.prototype.matchJSX=function(b){var w=this.peekJSXToken();return w.type===7&&w.value===b},v.prototype.parseJSXIdentifier=function(){var b=this.createJSXNode(),w=this.nextJSXToken();return w.type!==100&&this.throwUnexpectedToken(w),this.finalize(b,new o.JSXIdentifier(w.value))},v.prototype.parseJSXElementName=function(){var b=this.createJSXNode(),w=this.parseJSXIdentifier();if(this.matchJSX(":")){var O=w;this.expectJSX(":");var k=this.parseJSXIdentifier();w=this.finalize(b,new o.JSXNamespacedName(O,k))}else if(this.matchJSX("."))for(;this.matchJSX(".");){var E=w;this.expectJSX(".");var T=this.parseJSXIdentifier();w=this.finalize(b,new o.JSXMemberExpression(E,T))}return w},v.prototype.parseJSXAttributeName=function(){var b=this.createJSXNode(),w,O=this.parseJSXIdentifier();if(this.matchJSX(":")){var k=O;this.expectJSX(":");var E=this.parseJSXIdentifier();w=this.finalize(b,new o.JSXNamespacedName(k,E))}else w=O;return w},v.prototype.parseJSXStringLiteralAttribute=function(){var b=this.createJSXNode(),w=this.nextJSXToken();w.type!==8&&this.throwUnexpectedToken(w);var O=this.getTokenRaw(w);return this.finalize(b,new c.Literal(w.value,O))},v.prototype.parseJSXExpressionAttribute=function(){var b=this.createJSXNode();this.expectJSX("{"),this.finishJSX(),this.match("}")&&this.tolerateError("JSX attributes must only be assigned a non-empty expression");var w=this.parseAssignmentExpression();return this.reenterJSX(),this.finalize(b,new o.JSXExpressionContainer(w))},v.prototype.parseJSXAttributeValue=function(){return this.matchJSX("{")?this.parseJSXExpressionAttribute():this.matchJSX("<")?this.parseJSXElement():this.parseJSXStringLiteralAttribute()},v.prototype.parseJSXNameValueAttribute=function(){var b=this.createJSXNode(),w=this.parseJSXAttributeName(),O=null;return this.matchJSX("=")&&(this.expectJSX("="),O=this.parseJSXAttributeValue()),this.finalize(b,new o.JSXAttribute(w,O))},v.prototype.parseJSXSpreadAttribute=function(){var b=this.createJSXNode();this.expectJSX("{"),this.expectJSX("..."),this.finishJSX();var w=this.parseAssignmentExpression();return this.reenterJSX(),this.finalize(b,new o.JSXSpreadAttribute(w))},v.prototype.parseJSXAttributes=function(){for(var b=[];!this.matchJSX("/")&&!this.matchJSX(">");){var w=this.matchJSX("{")?this.parseJSXSpreadAttribute():this.parseJSXNameValueAttribute();b.push(w)}return b},v.prototype.parseJSXOpeningElement=function(){var b=this.createJSXNode();this.expectJSX("<");var w=this.parseJSXElementName(),O=this.parseJSXAttributes(),k=this.matchJSX("/");return k&&this.expectJSX("/"),this.expectJSX(">"),this.finalize(b,new o.JSXOpeningElement(w,k,O))},v.prototype.parseJSXBoundaryElement=function(){var b=this.createJSXNode();if(this.expectJSX("<"),this.matchJSX("/")){this.expectJSX("/");var w=this.parseJSXElementName();return this.expectJSX(">"),this.finalize(b,new o.JSXClosingElement(w))}var O=this.parseJSXElementName(),k=this.parseJSXAttributes(),E=this.matchJSX("/");return E&&this.expectJSX("/"),this.expectJSX(">"),this.finalize(b,new o.JSXOpeningElement(O,E,k))},v.prototype.parseJSXEmptyExpression=function(){var b=this.createJSXChildNode();return this.collectComments(),this.lastMarker.index=this.scanner.index,this.lastMarker.line=this.scanner.lineNumber,this.lastMarker.column=this.scanner.index-this.scanner.lineStart,this.finalize(b,new o.JSXEmptyExpression)},v.prototype.parseJSXExpressionContainer=function(){var b=this.createJSXNode();this.expectJSX("{");var w;return this.matchJSX("}")?(w=this.parseJSXEmptyExpression(),this.expectJSX("}")):(this.finishJSX(),w=this.parseAssignmentExpression(),this.reenterJSX()),this.finalize(b,new o.JSXExpressionContainer(w))},v.prototype.parseJSXChildren=function(){for(var b=[];!this.scanner.eof();){var w=this.createJSXChildNode(),O=this.nextJSXText();if(O.start0){var T=this.finalize(b.node,new o.JSXElement(b.opening,b.children,b.closing));b=w[w.length-1],b.children.push(T),w.pop()}else break}}return b},v.prototype.parseJSXElement=function(){var b=this.createJSXNode(),w=this.parseJSXOpeningElement(),O=[],k=null;if(!w.selfClosing){var E=this.parseComplexJSXElement({node:b,opening:w,closing:k,children:O});O=E.children,k=E.closing}return this.finalize(b,new o.JSXElement(w,O,k))},v.prototype.parseJSXRoot=function(){this.config.tokens&&this.tokens.pop(),this.startJSX();var b=this.parseJSXElement();return this.finishJSX(),b},v.prototype.isStartOfExpression=function(){return m.prototype.isStartOfExpression.call(this)||this.match("<")},v})(u.Parser);r.JSXParser=y},function(n,r){Object.defineProperty(r,"__esModule",{value:!0});var i={NonAsciiIdentifierStart:/[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u08A0-\u08B4\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C60\u0C61\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2118-\u211D\u2124\u2126\u2128\u212A-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309B-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FD5\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AD\uA7B0-\uA7B7\uA7F7-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDE80-\uDE9C\uDEA0-\uDED0\uDF00-\uDF1F\uDF30-\uDF4A\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC03-\uDC37\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE2B\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61]|\uD805[\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE80-\uDEAA\uDF00-\uDF19]|\uD806[\uDCA0-\uDCDF\uDCFF\uDEC0-\uDEF8]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50\uDF93-\uDF9F]|\uD82C[\uDC00\uDC01]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB]|\uD83A[\uDC00-\uDCC4]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1]|\uD87E[\uDC00-\uDE1D]/,NonAsciiIdentifierPart:/[\xAA\xB5\xB7\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0300-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u0483-\u0487\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u05D0-\u05EA\u05F0-\u05F2\u0610-\u061A\u0620-\u0669\u066E-\u06D3\u06D5-\u06DC\u06DF-\u06E8\u06EA-\u06FC\u06FF\u0710-\u074A\u074D-\u07B1\u07C0-\u07F5\u07FA\u0800-\u082D\u0840-\u085B\u08A0-\u08B4\u08E3-\u0963\u0966-\u096F\u0971-\u0983\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BC-\u09C4\u09C7\u09C8\u09CB-\u09CE\u09D7\u09DC\u09DD\u09DF-\u09E3\u09E6-\u09F1\u0A01-\u0A03\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A59-\u0A5C\u0A5E\u0A66-\u0A75\u0A81-\u0A83\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABC-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AD0\u0AE0-\u0AE3\u0AE6-\u0AEF\u0AF9\u0B01-\u0B03\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3C-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B5C\u0B5D\u0B5F-\u0B63\u0B66-\u0B6F\u0B71\u0B82\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD0\u0BD7\u0BE6-\u0BEF\u0C00-\u0C03\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C58-\u0C5A\u0C60-\u0C63\u0C66-\u0C6F\u0C81-\u0C83\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBC-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CDE\u0CE0-\u0CE3\u0CE6-\u0CEF\u0CF1\u0CF2\u0D01-\u0D03\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D-\u0D44\u0D46-\u0D48\u0D4A-\u0D4E\u0D57\u0D5F-\u0D63\u0D66-\u0D6F\u0D7A-\u0D7F\u0D82\u0D83\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2\u0DF3\u0E01-\u0E3A\u0E40-\u0E4E\u0E50-\u0E59\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB9\u0EBB-\u0EBD\u0EC0-\u0EC4\u0EC6\u0EC8-\u0ECD\u0ED0-\u0ED9\u0EDC-\u0EDF\u0F00\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E-\u0F47\u0F49-\u0F6C\u0F71-\u0F84\u0F86-\u0F97\u0F99-\u0FBC\u0FC6\u1000-\u1049\u1050-\u109D\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u135D-\u135F\u1369-\u1371\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1714\u1720-\u1734\u1740-\u1753\u1760-\u176C\u176E-\u1770\u1772\u1773\u1780-\u17D3\u17D7\u17DC\u17DD\u17E0-\u17E9\u180B-\u180D\u1810-\u1819\u1820-\u1877\u1880-\u18AA\u18B0-\u18F5\u1900-\u191E\u1920-\u192B\u1930-\u193B\u1946-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19DA\u1A00-\u1A1B\u1A20-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AA7\u1AB0-\u1ABD\u1B00-\u1B4B\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1BF3\u1C00-\u1C37\u1C40-\u1C49\u1C4D-\u1C7D\u1CD0-\u1CD2\u1CD4-\u1CF6\u1CF8\u1CF9\u1D00-\u1DF5\u1DFC-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u200C\u200D\u203F\u2040\u2054\u2071\u207F\u2090-\u209C\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2102\u2107\u210A-\u2113\u2115\u2118-\u211D\u2124\u2126\u2128\u212A-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D7F-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2DE0-\u2DFF\u3005-\u3007\u3021-\u302F\u3031-\u3035\u3038-\u303C\u3041-\u3096\u3099-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FD5\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA62B\uA640-\uA66F\uA674-\uA67D\uA67F-\uA6F1\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AD\uA7B0-\uA7B7\uA7F7-\uA827\uA840-\uA873\uA880-\uA8C4\uA8D0-\uA8D9\uA8E0-\uA8F7\uA8FB\uA8FD\uA900-\uA92D\uA930-\uA953\uA960-\uA97C\uA980-\uA9C0\uA9CF-\uA9D9\uA9E0-\uA9FE\uAA00-\uAA36\uAA40-\uAA4D\uAA50-\uAA59\uAA60-\uAA76\uAA7A-\uAAC2\uAADB-\uAADD\uAAE0-\uAAEF\uAAF2-\uAAF6\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABEA\uABEC\uABED\uABF0-\uABF9\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE00-\uFE0F\uFE20-\uFE2F\uFE33\uFE34\uFE4D-\uFE4F\uFE70-\uFE74\uFE76-\uFEFC\uFF10-\uFF19\uFF21-\uFF3A\uFF3F\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDDFD\uDE80-\uDE9C\uDEA0-\uDED0\uDEE0\uDF00-\uDF1F\uDF30-\uDF4A\uDF50-\uDF7A\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCA0-\uDCA9\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00-\uDE03\uDE05\uDE06\uDE0C-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE38-\uDE3A\uDE3F\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE6\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC00-\uDC46\uDC66-\uDC6F\uDC7F-\uDCBA\uDCD0-\uDCE8\uDCF0-\uDCF9\uDD00-\uDD34\uDD36-\uDD3F\uDD50-\uDD73\uDD76\uDD80-\uDDC4\uDDCA-\uDDCC\uDDD0-\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE37\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEEA\uDEF0-\uDEF9\uDF00-\uDF03\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3C-\uDF44\uDF47\uDF48\uDF4B-\uDF4D\uDF50\uDF57\uDF5D-\uDF63\uDF66-\uDF6C\uDF70-\uDF74]|\uD805[\uDC80-\uDCC5\uDCC7\uDCD0-\uDCD9\uDD80-\uDDB5\uDDB8-\uDDC0\uDDD8-\uDDDD\uDE00-\uDE40\uDE44\uDE50-\uDE59\uDE80-\uDEB7\uDEC0-\uDEC9\uDF00-\uDF19\uDF1D-\uDF2B\uDF30-\uDF39]|\uD806[\uDCA0-\uDCE9\uDCFF\uDEC0-\uDEF8]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE60-\uDE69\uDED0-\uDEED\uDEF0-\uDEF4\uDF00-\uDF36\uDF40-\uDF43\uDF50-\uDF59\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50-\uDF7E\uDF8F-\uDF9F]|\uD82C[\uDC00\uDC01]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99\uDC9D\uDC9E]|\uD834[\uDD65-\uDD69\uDD6D-\uDD72\uDD7B-\uDD82\uDD85-\uDD8B\uDDAA-\uDDAD\uDE42-\uDE44]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB\uDFCE-\uDFFF]|\uD836[\uDE00-\uDE36\uDE3B-\uDE6C\uDE75\uDE84\uDE9B-\uDE9F\uDEA1-\uDEAF]|\uD83A[\uDC00-\uDCC4\uDCD0-\uDCD6]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1]|\uD87E[\uDC00-\uDE1D]|\uDB40[\uDD00-\uDDEF]/};r.Character={fromCodePoint:function(s){return s<65536?String.fromCharCode(s):String.fromCharCode(55296+(s-65536>>10))+String.fromCharCode(56320+(s-65536&1023))},isWhiteSpace:function(s){return s===32||s===9||s===11||s===12||s===160||s>=5760&&[5760,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8239,8287,12288,65279].indexOf(s)>=0},isLineTerminator:function(s){return s===10||s===13||s===8232||s===8233},isIdentifierStart:function(s){return s===36||s===95||s>=65&&s<=90||s>=97&&s<=122||s===92||s>=128&&i.NonAsciiIdentifierStart.test(r.Character.fromCodePoint(s))},isIdentifierPart:function(s){return s===36||s===95||s>=65&&s<=90||s>=97&&s<=122||s>=48&&s<=57||s===92||s>=128&&i.NonAsciiIdentifierPart.test(r.Character.fromCodePoint(s))},isDecimalDigit:function(s){return s>=48&&s<=57},isHexDigit:function(s){return s>=48&&s<=57||s>=65&&s<=70||s>=97&&s<=102},isOctalDigit:function(s){return s>=48&&s<=55}}},function(n,r,i){Object.defineProperty(r,"__esModule",{value:!0});var s=i(6),a=(function(){function b(w){this.type=s.JSXSyntax.JSXClosingElement,this.name=w}return b})();r.JSXClosingElement=a;var o=(function(){function b(w,O,k){this.type=s.JSXSyntax.JSXElement,this.openingElement=w,this.children=O,this.closingElement=k}return b})();r.JSXElement=o;var l=(function(){function b(){this.type=s.JSXSyntax.JSXEmptyExpression}return b})();r.JSXEmptyExpression=l;var c=(function(){function b(w){this.type=s.JSXSyntax.JSXExpressionContainer,this.expression=w}return b})();r.JSXExpressionContainer=c;var u=(function(){function b(w){this.type=s.JSXSyntax.JSXIdentifier,this.name=w}return b})();r.JSXIdentifier=u;var f=(function(){function b(w,O){this.type=s.JSXSyntax.JSXMemberExpression,this.object=w,this.property=O}return b})();r.JSXMemberExpression=f;var h=(function(){function b(w,O){this.type=s.JSXSyntax.JSXAttribute,this.name=w,this.value=O}return b})();r.JSXAttribute=h;var p=(function(){function b(w,O){this.type=s.JSXSyntax.JSXNamespacedName,this.namespace=w,this.name=O}return b})();r.JSXNamespacedName=p;var y=(function(){function b(w,O,k){this.type=s.JSXSyntax.JSXOpeningElement,this.name=w,this.selfClosing=O,this.attributes=k}return b})();r.JSXOpeningElement=y;var m=(function(){function b(w){this.type=s.JSXSyntax.JSXSpreadAttribute,this.argument=w}return b})();r.JSXSpreadAttribute=m;var v=(function(){function b(w,O){this.type=s.JSXSyntax.JSXText,this.value=w,this.raw=O}return b})();r.JSXText=v},function(n,r){Object.defineProperty(r,"__esModule",{value:!0}),r.JSXSyntax={JSXAttribute:"JSXAttribute",JSXClosingElement:"JSXClosingElement",JSXElement:"JSXElement",JSXEmptyExpression:"JSXEmptyExpression",JSXExpressionContainer:"JSXExpressionContainer",JSXIdentifier:"JSXIdentifier",JSXMemberExpression:"JSXMemberExpression",JSXNamespacedName:"JSXNamespacedName",JSXOpeningElement:"JSXOpeningElement",JSXSpreadAttribute:"JSXSpreadAttribute",JSXText:"JSXText"}},function(n,r,i){Object.defineProperty(r,"__esModule",{value:!0});var s=i(2),a=(function(){function Te(De){this.type=s.Syntax.ArrayExpression,this.elements=De}return Te})();r.ArrayExpression=a;var o=(function(){function Te(De){this.type=s.Syntax.ArrayPattern,this.elements=De}return Te})();r.ArrayPattern=o;var l=(function(){function Te(De,ze,st){this.type=s.Syntax.ArrowFunctionExpression,this.id=null,this.params=De,this.body=ze,this.generator=!1,this.expression=st,this.async=!1}return Te})();r.ArrowFunctionExpression=l;var c=(function(){function Te(De,ze,st){this.type=s.Syntax.AssignmentExpression,this.operator=De,this.left=ze,this.right=st}return Te})();r.AssignmentExpression=c;var u=(function(){function Te(De,ze){this.type=s.Syntax.AssignmentPattern,this.left=De,this.right=ze}return Te})();r.AssignmentPattern=u;var f=(function(){function Te(De,ze,st){this.type=s.Syntax.ArrowFunctionExpression,this.id=null,this.params=De,this.body=ze,this.generator=!1,this.expression=st,this.async=!0}return Te})();r.AsyncArrowFunctionExpression=f;var h=(function(){function Te(De,ze,st){this.type=s.Syntax.FunctionDeclaration,this.id=De,this.params=ze,this.body=st,this.generator=!1,this.expression=!1,this.async=!0}return Te})();r.AsyncFunctionDeclaration=h;var p=(function(){function Te(De,ze,st){this.type=s.Syntax.FunctionExpression,this.id=De,this.params=ze,this.body=st,this.generator=!1,this.expression=!1,this.async=!0}return Te})();r.AsyncFunctionExpression=p;var y=(function(){function Te(De){this.type=s.Syntax.AwaitExpression,this.argument=De}return Te})();r.AwaitExpression=y;var m=(function(){function Te(De,ze,st){var Gt=De==="||"||De==="&&";this.type=Gt?s.Syntax.LogicalExpression:s.Syntax.BinaryExpression,this.operator=De,this.left=ze,this.right=st}return Te})();r.BinaryExpression=m;var v=(function(){function Te(De){this.type=s.Syntax.BlockStatement,this.body=De}return Te})();r.BlockStatement=v;var b=(function(){function Te(De){this.type=s.Syntax.BreakStatement,this.label=De}return Te})();r.BreakStatement=b;var w=(function(){function Te(De,ze){this.type=s.Syntax.CallExpression,this.callee=De,this.arguments=ze}return Te})();r.CallExpression=w;var O=(function(){function Te(De,ze){this.type=s.Syntax.CatchClause,this.param=De,this.body=ze}return Te})();r.CatchClause=O;var k=(function(){function Te(De){this.type=s.Syntax.ClassBody,this.body=De}return Te})();r.ClassBody=k;var E=(function(){function Te(De,ze,st){this.type=s.Syntax.ClassDeclaration,this.id=De,this.superClass=ze,this.body=st}return Te})();r.ClassDeclaration=E;var T=(function(){function Te(De,ze,st){this.type=s.Syntax.ClassExpression,this.id=De,this.superClass=ze,this.body=st}return Te})();r.ClassExpression=T;var N=(function(){function Te(De,ze){this.type=s.Syntax.MemberExpression,this.computed=!0,this.object=De,this.property=ze}return Te})();r.ComputedMemberExpression=N;var _=(function(){function Te(De,ze,st){this.type=s.Syntax.ConditionalExpression,this.test=De,this.consequent=ze,this.alternate=st}return Te})();r.ConditionalExpression=_;var I=(function(){function Te(De){this.type=s.Syntax.ContinueStatement,this.label=De}return Te})();r.ContinueStatement=I;var j=(function(){function Te(){this.type=s.Syntax.DebuggerStatement}return Te})();r.DebuggerStatement=j;var L=(function(){function Te(De,ze){this.type=s.Syntax.ExpressionStatement,this.expression=De,this.directive=ze}return Te})();r.Directive=L;var B=(function(){function Te(De,ze){this.type=s.Syntax.DoWhileStatement,this.body=De,this.test=ze}return Te})();r.DoWhileStatement=B;var $=(function(){function Te(){this.type=s.Syntax.EmptyStatement}return Te})();r.EmptyStatement=$;var z=(function(){function Te(De){this.type=s.Syntax.ExportAllDeclaration,this.source=De}return Te})();r.ExportAllDeclaration=z;var Y=(function(){function Te(De){this.type=s.Syntax.ExportDefaultDeclaration,this.declaration=De}return Te})();r.ExportDefaultDeclaration=Y;var W=(function(){function Te(De,ze,st){this.type=s.Syntax.ExportNamedDeclaration,this.declaration=De,this.specifiers=ze,this.source=st}return Te})();r.ExportNamedDeclaration=W;var J=(function(){function Te(De,ze){this.type=s.Syntax.ExportSpecifier,this.exported=ze,this.local=De}return Te})();r.ExportSpecifier=J;var ne=(function(){function Te(De){this.type=s.Syntax.ExpressionStatement,this.expression=De}return Te})();r.ExpressionStatement=ne;var le=(function(){function Te(De,ze,st){this.type=s.Syntax.ForInStatement,this.left=De,this.right=ze,this.body=st,this.each=!1}return Te})();r.ForInStatement=le;var ie=(function(){function Te(De,ze,st){this.type=s.Syntax.ForOfStatement,this.left=De,this.right=ze,this.body=st}return Te})();r.ForOfStatement=ie;var q=(function(){function Te(De,ze,st,Gt){this.type=s.Syntax.ForStatement,this.init=De,this.test=ze,this.update=st,this.body=Gt}return Te})();r.ForStatement=q;var F=(function(){function Te(De,ze,st,Gt){this.type=s.Syntax.FunctionDeclaration,this.id=De,this.params=ze,this.body=st,this.generator=Gt,this.expression=!1,this.async=!1}return Te})();r.FunctionDeclaration=F;var U=(function(){function Te(De,ze,st,Gt){this.type=s.Syntax.FunctionExpression,this.id=De,this.params=ze,this.body=st,this.generator=Gt,this.expression=!1,this.async=!1}return Te})();r.FunctionExpression=U;var Z=(function(){function Te(De){this.type=s.Syntax.Identifier,this.name=De}return Te})();r.Identifier=Z;var K=(function(){function Te(De,ze,st){this.type=s.Syntax.IfStatement,this.test=De,this.consequent=ze,this.alternate=st}return Te})();r.IfStatement=K;var ee=(function(){function Te(De,ze){this.type=s.Syntax.ImportDeclaration,this.specifiers=De,this.source=ze}return Te})();r.ImportDeclaration=ee;var re=(function(){function Te(De){this.type=s.Syntax.ImportDefaultSpecifier,this.local=De}return Te})();r.ImportDefaultSpecifier=re;var Q=(function(){function Te(De){this.type=s.Syntax.ImportNamespaceSpecifier,this.local=De}return Te})();r.ImportNamespaceSpecifier=Q;var H=(function(){function Te(De,ze){this.type=s.Syntax.ImportSpecifier,this.local=De,this.imported=ze}return Te})();r.ImportSpecifier=H;var se=(function(){function Te(De,ze){this.type=s.Syntax.LabeledStatement,this.label=De,this.body=ze}return Te})();r.LabeledStatement=se;var fe=(function(){function Te(De,ze){this.type=s.Syntax.Literal,this.value=De,this.raw=ze}return Te})();r.Literal=fe;var be=(function(){function Te(De,ze){this.type=s.Syntax.MetaProperty,this.meta=De,this.property=ze}return Te})();r.MetaProperty=be;var me=(function(){function Te(De,ze,st,Gt,ln){this.type=s.Syntax.MethodDefinition,this.key=De,this.computed=ze,this.value=st,this.kind=Gt,this.static=ln}return Te})();r.MethodDefinition=me;var pe=(function(){function Te(De){this.type=s.Syntax.Program,this.body=De,this.sourceType="module"}return Te})();r.Module=pe;var ge=(function(){function Te(De,ze){this.type=s.Syntax.NewExpression,this.callee=De,this.arguments=ze}return Te})();r.NewExpression=ge;var Pe=(function(){function Te(De){this.type=s.Syntax.ObjectExpression,this.properties=De}return Te})();r.ObjectExpression=Pe;var ve=(function(){function Te(De){this.type=s.Syntax.ObjectPattern,this.properties=De}return Te})();r.ObjectPattern=ve;var xe=(function(){function Te(De,ze,st,Gt,ln,Yt){this.type=s.Syntax.Property,this.key=ze,this.computed=st,this.value=Gt,this.kind=De,this.method=ln,this.shorthand=Yt}return Te})();r.Property=xe;var we=(function(){function Te(De,ze,st,Gt){this.type=s.Syntax.Literal,this.value=De,this.raw=ze,this.regex={pattern:st,flags:Gt}}return Te})();r.RegexLiteral=we;var Ce=(function(){function Te(De){this.type=s.Syntax.RestElement,this.argument=De}return Te})();r.RestElement=Ce;var Me=(function(){function Te(De){this.type=s.Syntax.ReturnStatement,this.argument=De}return Te})();r.ReturnStatement=Me;var Ve=(function(){function Te(De){this.type=s.Syntax.Program,this.body=De,this.sourceType="script"}return Te})();r.Script=Ve;var tt=(function(){function Te(De){this.type=s.Syntax.SequenceExpression,this.expressions=De}return Te})();r.SequenceExpression=tt;var Ze=(function(){function Te(De){this.type=s.Syntax.SpreadElement,this.argument=De}return Te})();r.SpreadElement=Ze;var qe=(function(){function Te(De,ze){this.type=s.Syntax.MemberExpression,this.computed=!1,this.object=De,this.property=ze}return Te})();r.StaticMemberExpression=qe;var pt=(function(){function Te(){this.type=s.Syntax.Super}return Te})();r.Super=pt;var it=(function(){function Te(De,ze){this.type=s.Syntax.SwitchCase,this.test=De,this.consequent=ze}return Te})();r.SwitchCase=it;var vt=(function(){function Te(De,ze){this.type=s.Syntax.SwitchStatement,this.discriminant=De,this.cases=ze}return Te})();r.SwitchStatement=vt;var Ot=(function(){function Te(De,ze){this.type=s.Syntax.TaggedTemplateExpression,this.tag=De,this.quasi=ze}return Te})();r.TaggedTemplateExpression=Ot;var Kt=(function(){function Te(De,ze){this.type=s.Syntax.TemplateElement,this.value=De,this.tail=ze}return Te})();r.TemplateElement=Kt;var qt=(function(){function Te(De,ze){this.type=s.Syntax.TemplateLiteral,this.quasis=De,this.expressions=ze}return Te})();r.TemplateLiteral=qt;var fn=(function(){function Te(){this.type=s.Syntax.ThisExpression}return Te})();r.ThisExpression=fn;var Jt=(function(){function Te(De){this.type=s.Syntax.ThrowStatement,this.argument=De}return Te})();r.ThrowStatement=Jt;var Je=(function(){function Te(De,ze,st){this.type=s.Syntax.TryStatement,this.block=De,this.handler=ze,this.finalizer=st}return Te})();r.TryStatement=Je;var St=(function(){function Te(De,ze){this.type=s.Syntax.UnaryExpression,this.operator=De,this.argument=ze,this.prefix=!0}return Te})();r.UnaryExpression=St;var At=(function(){function Te(De,ze,st){this.type=s.Syntax.UpdateExpression,this.operator=De,this.argument=ze,this.prefix=st}return Te})();r.UpdateExpression=At;var Ke=(function(){function Te(De,ze){this.type=s.Syntax.VariableDeclaration,this.declarations=De,this.kind=ze}return Te})();r.VariableDeclaration=Ke;var Be=(function(){function Te(De,ze){this.type=s.Syntax.VariableDeclarator,this.id=De,this.init=ze}return Te})();r.VariableDeclarator=Be;var We=(function(){function Te(De,ze){this.type=s.Syntax.WhileStatement,this.test=De,this.body=ze}return Te})();r.WhileStatement=We;var Ye=(function(){function Te(De,ze){this.type=s.Syntax.WithStatement,this.object=De,this.body=ze}return Te})();r.WithStatement=Ye;var Zt=(function(){function Te(De,ze){this.type=s.Syntax.YieldExpression,this.argument=De,this.delegate=ze}return Te})();r.YieldExpression=Zt},function(n,r,i){Object.defineProperty(r,"__esModule",{value:!0});var s=i(9),a=i(10),o=i(11),l=i(7),c=i(12),u=i(2),f=i(13),h="ArrowParameterPlaceHolder",p=(function(){function y(m,v,b){v===void 0&&(v={}),this.config={range:typeof v.range=="boolean"&&v.range,loc:typeof v.loc=="boolean"&&v.loc,source:null,tokens:typeof v.tokens=="boolean"&&v.tokens,comment:typeof v.comment=="boolean"&&v.comment,tolerant:typeof v.tolerant=="boolean"&&v.tolerant},this.config.loc&&v.source&&v.source!==null&&(this.config.source=String(v.source)),this.delegate=b,this.errorHandler=new a.ErrorHandler,this.errorHandler.tolerant=this.config.tolerant,this.scanner=new c.Scanner(m,this.errorHandler),this.scanner.trackComment=this.config.comment,this.operatorPrecedence={")":0,";":0,",":0,"=":0,"]":0,"||":1,"&&":2,"|":3,"^":4,"&":5,"==":6,"!=":6,"===":6,"!==":6,"<":7,">":7,"<=":7,">=":7,"<<":8,">>":8,">>>":8,"+":9,"-":9,"*":11,"/":11,"%":11},this.lookahead={type:2,value:"",lineNumber:this.scanner.lineNumber,lineStart:0,start:0,end:0},this.hasLineTerminator=!1,this.context={isModule:!1,await:!1,allowIn:!0,allowStrictDirective:!0,allowYield:!0,firstCoverInitializedNameError:null,isAssignmentTarget:!1,isBindingElement:!1,inFunctionBody:!1,inIteration:!1,inSwitch:!1,labelSet:{},strict:!1},this.tokens=[],this.startMarker={index:0,line:this.scanner.lineNumber,column:0},this.lastMarker={index:0,line:this.scanner.lineNumber,column:0},this.nextToken(),this.lastMarker={index:this.scanner.index,line:this.scanner.lineNumber,column:this.scanner.index-this.scanner.lineStart}}return y.prototype.throwError=function(m){var v=Array.prototype.slice.call(arguments,1),b=m.replace(/%(\d)/g,function(E,T){return s.assert(T0&&this.delegate)for(var v=0;v>="||m===">>>="||m==="&="||m==="^="||m==="|="},y.prototype.isolateCoverGrammar=function(m){var v=this.context.isBindingElement,b=this.context.isAssignmentTarget,w=this.context.firstCoverInitializedNameError;this.context.isBindingElement=!0,this.context.isAssignmentTarget=!0,this.context.firstCoverInitializedNameError=null;var O=m.call(this);return this.context.firstCoverInitializedNameError!==null&&this.throwUnexpectedToken(this.context.firstCoverInitializedNameError),this.context.isBindingElement=v,this.context.isAssignmentTarget=b,this.context.firstCoverInitializedNameError=w,O},y.prototype.inheritCoverGrammar=function(m){var v=this.context.isBindingElement,b=this.context.isAssignmentTarget,w=this.context.firstCoverInitializedNameError;this.context.isBindingElement=!0,this.context.isAssignmentTarget=!0,this.context.firstCoverInitializedNameError=null;var O=m.call(this);return this.context.isBindingElement=this.context.isBindingElement&&v,this.context.isAssignmentTarget=this.context.isAssignmentTarget&&b,this.context.firstCoverInitializedNameError=w||this.context.firstCoverInitializedNameError,O},y.prototype.consumeSemicolon=function(){this.match(";")?this.nextToken():this.hasLineTerminator||(this.lookahead.type!==2&&!this.match("}")&&this.throwUnexpectedToken(this.lookahead),this.lastMarker.index=this.startMarker.index,this.lastMarker.line=this.startMarker.line,this.lastMarker.column=this.startMarker.column)},y.prototype.parsePrimaryExpression=function(){var m=this.createNode(),v,b,w;switch(this.lookahead.type){case 3:(this.context.isModule||this.context.await)&&this.lookahead.value==="await"&&this.tolerateUnexpectedToken(this.lookahead),v=this.matchAsyncFunction()?this.parseFunctionExpression():this.finalize(m,new l.Identifier(this.nextToken().value));break;case 6:case 8:this.context.strict&&this.lookahead.octal&&this.tolerateUnexpectedToken(this.lookahead,o.Messages.StrictOctalLiteral),this.context.isAssignmentTarget=!1,this.context.isBindingElement=!1,b=this.nextToken(),w=this.getTokenRaw(b),v=this.finalize(m,new l.Literal(b.value,w));break;case 1:this.context.isAssignmentTarget=!1,this.context.isBindingElement=!1,b=this.nextToken(),w=this.getTokenRaw(b),v=this.finalize(m,new l.Literal(b.value==="true",w));break;case 5:this.context.isAssignmentTarget=!1,this.context.isBindingElement=!1,b=this.nextToken(),w=this.getTokenRaw(b),v=this.finalize(m,new l.Literal(null,w));break;case 10:v=this.parseTemplateLiteral();break;case 7:switch(this.lookahead.value){case"(":this.context.isBindingElement=!1,v=this.inheritCoverGrammar(this.parseGroupExpression);break;case"[":v=this.inheritCoverGrammar(this.parseArrayInitializer);break;case"{":v=this.inheritCoverGrammar(this.parseObjectInitializer);break;case"/":case"/=":this.context.isAssignmentTarget=!1,this.context.isBindingElement=!1,this.scanner.index=this.startMarker.index,b=this.nextRegexToken(),w=this.getTokenRaw(b),v=this.finalize(m,new l.RegexLiteral(b.regex,w,b.pattern,b.flags));break;default:v=this.throwUnexpectedToken(this.nextToken())}break;case 4:!this.context.strict&&this.context.allowYield&&this.matchKeyword("yield")?v=this.parseIdentifierName():!this.context.strict&&this.matchKeyword("let")?v=this.finalize(m,new l.Identifier(this.nextToken().value)):(this.context.isAssignmentTarget=!1,this.context.isBindingElement=!1,this.matchKeyword("function")?v=this.parseFunctionExpression():this.matchKeyword("this")?(this.nextToken(),v=this.finalize(m,new l.ThisExpression)):this.matchKeyword("class")?v=this.parseClassExpression():v=this.throwUnexpectedToken(this.nextToken()));break;default:v=this.throwUnexpectedToken(this.nextToken())}return v},y.prototype.parseSpreadElement=function(){var m=this.createNode();this.expect("...");var v=this.inheritCoverGrammar(this.parseAssignmentExpression);return this.finalize(m,new l.SpreadElement(v))},y.prototype.parseArrayInitializer=function(){var m=this.createNode(),v=[];for(this.expect("[");!this.match("]");)if(this.match(","))this.nextToken(),v.push(null);else if(this.match("...")){var b=this.parseSpreadElement();this.match("]")||(this.context.isAssignmentTarget=!1,this.context.isBindingElement=!1,this.expect(",")),v.push(b)}else v.push(this.inheritCoverGrammar(this.parseAssignmentExpression)),this.match("]")||this.expect(",");return this.expect("]"),this.finalize(m,new l.ArrayExpression(v))},y.prototype.parsePropertyMethod=function(m){this.context.isAssignmentTarget=!1,this.context.isBindingElement=!1;var v=this.context.strict,b=this.context.allowStrictDirective;this.context.allowStrictDirective=m.simple;var w=this.isolateCoverGrammar(this.parseFunctionSourceElements);return this.context.strict&&m.firstRestricted&&this.tolerateUnexpectedToken(m.firstRestricted,m.message),this.context.strict&&m.stricted&&this.tolerateUnexpectedToken(m.stricted,m.message),this.context.strict=v,this.context.allowStrictDirective=b,w},y.prototype.parsePropertyMethodFunction=function(){var m=!1,v=this.createNode(),b=this.context.allowYield;this.context.allowYield=!0;var w=this.parseFormalParameters(),O=this.parsePropertyMethod(w);return this.context.allowYield=b,this.finalize(v,new l.FunctionExpression(null,w.params,O,m))},y.prototype.parsePropertyMethodAsyncFunction=function(){var m=this.createNode(),v=this.context.allowYield,b=this.context.await;this.context.allowYield=!1,this.context.await=!0;var w=this.parseFormalParameters(),O=this.parsePropertyMethod(w);return this.context.allowYield=v,this.context.await=b,this.finalize(m,new l.AsyncFunctionExpression(null,w.params,O))},y.prototype.parseObjectPropertyKey=function(){var m=this.createNode(),v=this.nextToken(),b;switch(v.type){case 8:case 6:this.context.strict&&v.octal&&this.tolerateUnexpectedToken(v,o.Messages.StrictOctalLiteral);var w=this.getTokenRaw(v);b=this.finalize(m,new l.Literal(v.value,w));break;case 3:case 1:case 5:case 4:b=this.finalize(m,new l.Identifier(v.value));break;case 7:v.value==="["?(b=this.isolateCoverGrammar(this.parseAssignmentExpression),this.expect("]")):b=this.throwUnexpectedToken(v);break;default:b=this.throwUnexpectedToken(v)}return b},y.prototype.isPropertyKey=function(m,v){return m.type===u.Syntax.Identifier&&m.name===v||m.type===u.Syntax.Literal&&m.value===v},y.prototype.parseObjectProperty=function(m){var v=this.createNode(),b=this.lookahead,w,O=null,k=null,E=!1,T=!1,N=!1,_=!1;if(b.type===3){var I=b.value;this.nextToken(),E=this.match("["),_=!this.hasLineTerminator&&I==="async"&&!this.match(":")&&!this.match("(")&&!this.match("*")&&!this.match(","),O=_?this.parseObjectPropertyKey():this.finalize(v,new l.Identifier(I))}else this.match("*")?this.nextToken():(E=this.match("["),O=this.parseObjectPropertyKey());var j=this.qualifiedPropertyName(this.lookahead);if(b.type===3&&!_&&b.value==="get"&&j)w="get",E=this.match("["),O=this.parseObjectPropertyKey(),this.context.allowYield=!1,k=this.parseGetterMethod();else if(b.type===3&&!_&&b.value==="set"&&j)w="set",E=this.match("["),O=this.parseObjectPropertyKey(),k=this.parseSetterMethod();else if(b.type===7&&b.value==="*"&&j)w="init",E=this.match("["),O=this.parseObjectPropertyKey(),k=this.parseGeneratorMethod(),T=!0;else if(O||this.throwUnexpectedToken(this.lookahead),w="init",this.match(":")&&!_)!E&&this.isPropertyKey(O,"__proto__")&&(m.value&&this.tolerateError(o.Messages.DuplicateProtoProperty),m.value=!0),this.nextToken(),k=this.inheritCoverGrammar(this.parseAssignmentExpression);else if(this.match("("))k=_?this.parsePropertyMethodAsyncFunction():this.parsePropertyMethodFunction(),T=!0;else if(b.type===3){var I=this.finalize(v,new l.Identifier(b.value));if(this.match("=")){this.context.firstCoverInitializedNameError=this.lookahead,this.nextToken(),N=!0;var L=this.isolateCoverGrammar(this.parseAssignmentExpression);k=this.finalize(v,new l.AssignmentPattern(I,L))}else N=!0,k=I}else this.throwUnexpectedToken(this.nextToken());return this.finalize(v,new l.Property(w,O,E,k,T,N))},y.prototype.parseObjectInitializer=function(){var m=this.createNode();this.expect("{");for(var v=[],b={value:!1};!this.match("}");)v.push(this.parseObjectProperty(b)),this.match("}")||this.expectCommaSeparator();return this.expect("}"),this.finalize(m,new l.ObjectExpression(v))},y.prototype.parseTemplateHead=function(){s.assert(this.lookahead.head,"Template literal must start with a template head");var m=this.createNode(),v=this.nextToken(),b=v.value,w=v.cooked;return this.finalize(m,new l.TemplateElement({raw:b,cooked:w},v.tail))},y.prototype.parseTemplateElement=function(){this.lookahead.type!==10&&this.throwUnexpectedToken();var m=this.createNode(),v=this.nextToken(),b=v.value,w=v.cooked;return this.finalize(m,new l.TemplateElement({raw:b,cooked:w},v.tail))},y.prototype.parseTemplateLiteral=function(){var m=this.createNode(),v=[],b=[],w=this.parseTemplateHead();for(b.push(w);!w.tail;)v.push(this.parseExpression()),w=this.parseTemplateElement(),b.push(w);return this.finalize(m,new l.TemplateLiteral(b,v))},y.prototype.reinterpretExpressionAsPattern=function(m){switch(m.type){case u.Syntax.Identifier:case u.Syntax.MemberExpression:case u.Syntax.RestElement:case u.Syntax.AssignmentPattern:break;case u.Syntax.SpreadElement:m.type=u.Syntax.RestElement,this.reinterpretExpressionAsPattern(m.argument);break;case u.Syntax.ArrayExpression:m.type=u.Syntax.ArrayPattern;for(var v=0;v")||this.expect("=>"),m={type:h,params:[],async:!1};else{var v=this.lookahead,b=[];if(this.match("..."))m=this.parseRestElement(b),this.expect(")"),this.match("=>")||this.expect("=>"),m={type:h,params:[m],async:!1};else{var w=!1;if(this.context.isBindingElement=!0,m=this.inheritCoverGrammar(this.parseAssignmentExpression),this.match(",")){var O=[];for(this.context.isAssignmentTarget=!1,O.push(m);this.lookahead.type!==2&&this.match(",");){if(this.nextToken(),this.match(")")){this.nextToken();for(var k=0;k")||this.expect("=>"),this.context.isBindingElement=!1;for(var k=0;k")&&(m.type===u.Syntax.Identifier&&m.name==="yield"&&(w=!0,m={type:h,params:[m],async:!1}),!w)){if(this.context.isBindingElement||this.throwUnexpectedToken(this.lookahead),m.type===u.Syntax.SequenceExpression)for(var k=0;k")){for(var T=0;T0){this.nextToken(),this.context.isAssignmentTarget=!1,this.context.isBindingElement=!1;for(var O=[m,this.lookahead],k=v,E=this.isolateCoverGrammar(this.parseExponentiationExpression),T=[k,b.value,E],N=[w];w=this.binaryPrecedence(this.lookahead),!(w<=0);){for(;T.length>2&&w<=N[N.length-1];){E=T.pop();var _=T.pop();N.pop(),k=T.pop(),O.pop();var I=this.startNode(O[O.length-1]);T.push(this.finalize(I,new l.BinaryExpression(_,k,E)))}T.push(this.nextToken().value),N.push(w),O.push(this.lookahead),T.push(this.isolateCoverGrammar(this.parseExponentiationExpression))}var j=T.length-1;v=T[j];for(var L=O.pop();j>1;){var B=O.pop(),$=L&&L.lineStart,I=this.startNode(B,$),_=T[j-1];v=this.finalize(I,new l.BinaryExpression(_,T[j-2],v)),j-=2,L=B}}return v},y.prototype.parseConditionalExpression=function(){var m=this.lookahead,v=this.inheritCoverGrammar(this.parseBinaryExpression);if(this.match("?")){this.nextToken();var b=this.context.allowIn;this.context.allowIn=!0;var w=this.isolateCoverGrammar(this.parseAssignmentExpression);this.context.allowIn=b,this.expect(":");var O=this.isolateCoverGrammar(this.parseAssignmentExpression);v=this.finalize(this.startNode(m),new l.ConditionalExpression(v,w,O)),this.context.isAssignmentTarget=!1,this.context.isBindingElement=!1}return v},y.prototype.checkPatternParam=function(m,v){switch(v.type){case u.Syntax.Identifier:this.validateParam(m,v,v.name);break;case u.Syntax.RestElement:this.checkPatternParam(m,v.argument);break;case u.Syntax.AssignmentPattern:this.checkPatternParam(m,v.left);break;case u.Syntax.ArrayPattern:for(var b=0;b")){this.context.isAssignmentTarget=!1,this.context.isBindingElement=!1;var O=m.async,k=this.reinterpretAsCoverFormalsList(m);if(k){this.hasLineTerminator&&this.tolerateUnexpectedToken(this.lookahead),this.context.firstCoverInitializedNameError=null;var E=this.context.strict,T=this.context.allowStrictDirective;this.context.allowStrictDirective=k.simple;var N=this.context.allowYield,_=this.context.await;this.context.allowYield=!0,this.context.await=O;var I=this.startNode(v);this.expect("=>");var j=void 0;if(this.match("{")){var L=this.context.allowIn;this.context.allowIn=!0,j=this.parseFunctionSourceElements(),this.context.allowIn=L}else j=this.isolateCoverGrammar(this.parseAssignmentExpression);var B=j.type!==u.Syntax.BlockStatement;this.context.strict&&k.firstRestricted&&this.throwUnexpectedToken(k.firstRestricted,k.message),this.context.strict&&k.stricted&&this.tolerateUnexpectedToken(k.stricted,k.message),m=O?this.finalize(I,new l.AsyncArrowFunctionExpression(k.params,j,B)):this.finalize(I,new l.ArrowFunctionExpression(k.params,j,B)),this.context.strict=E,this.context.allowStrictDirective=T,this.context.allowYield=N,this.context.await=_}}else if(this.matchAssign()){if(this.context.isAssignmentTarget||this.tolerateError(o.Messages.InvalidLHSInAssignment),this.context.strict&&m.type===u.Syntax.Identifier){var $=m;this.scanner.isRestrictedWord($.name)&&this.tolerateUnexpectedToken(b,o.Messages.StrictLHSAssignment),this.scanner.isStrictModeReservedWord($.name)&&this.tolerateUnexpectedToken(b,o.Messages.StrictReservedWord)}this.match("=")?this.reinterpretExpressionAsPattern(m):(this.context.isAssignmentTarget=!1,this.context.isBindingElement=!1),b=this.nextToken();var z=b.value,Y=this.isolateCoverGrammar(this.parseAssignmentExpression);m=this.finalize(this.startNode(v),new l.AssignmentExpression(z,m,Y)),this.context.firstCoverInitializedNameError=null}}return m},y.prototype.parseExpression=function(){var m=this.lookahead,v=this.isolateCoverGrammar(this.parseAssignmentExpression);if(this.match(",")){var b=[];for(b.push(v);this.lookahead.type!==2&&this.match(",");)this.nextToken(),b.push(this.isolateCoverGrammar(this.parseAssignmentExpression));v=this.finalize(this.startNode(m),new l.SequenceExpression(b))}return v},y.prototype.parseStatementListItem=function(){var m;if(this.context.isAssignmentTarget=!0,this.context.isBindingElement=!0,this.lookahead.type===4)switch(this.lookahead.value){case"export":this.context.isModule||this.tolerateUnexpectedToken(this.lookahead,o.Messages.IllegalExportDeclaration),m=this.parseExportDeclaration();break;case"import":this.context.isModule||this.tolerateUnexpectedToken(this.lookahead,o.Messages.IllegalImportDeclaration),m=this.parseImportDeclaration();break;case"const":m=this.parseLexicalDeclaration({inFor:!1});break;case"function":m=this.parseFunctionDeclaration();break;case"class":m=this.parseClassDeclaration();break;case"let":m=this.isLexicalDeclaration()?this.parseLexicalDeclaration({inFor:!1}):this.parseStatement();break;default:m=this.parseStatement();break}else m=this.parseStatement();return m},y.prototype.parseBlock=function(){var m=this.createNode();this.expect("{");for(var v=[];!this.match("}");)v.push(this.parseStatementListItem());return this.expect("}"),this.finalize(m,new l.BlockStatement(v))},y.prototype.parseLexicalBinding=function(m,v){var b=this.createNode(),w=[],O=this.parsePattern(w,m);this.context.strict&&O.type===u.Syntax.Identifier&&this.scanner.isRestrictedWord(O.name)&&this.tolerateError(o.Messages.StrictVarName);var k=null;return m==="const"?!this.matchKeyword("in")&&!this.matchContextualKeyword("of")&&(this.match("=")?(this.nextToken(),k=this.isolateCoverGrammar(this.parseAssignmentExpression)):this.throwError(o.Messages.DeclarationMissingInitializer,"const")):(!v.inFor&&O.type!==u.Syntax.Identifier||this.match("="))&&(this.expect("="),k=this.isolateCoverGrammar(this.parseAssignmentExpression)),this.finalize(b,new l.VariableDeclarator(O,k))},y.prototype.parseBindingList=function(m,v){for(var b=[this.parseLexicalBinding(m,v)];this.match(",");)this.nextToken(),b.push(this.parseLexicalBinding(m,v));return b},y.prototype.isLexicalDeclaration=function(){var m=this.scanner.saveState();this.scanner.scanComments();var v=this.scanner.lex();return this.scanner.restoreState(m),v.type===3||v.type===7&&v.value==="["||v.type===7&&v.value==="{"||v.type===4&&v.value==="let"||v.type===4&&v.value==="yield"},y.prototype.parseLexicalDeclaration=function(m){var v=this.createNode(),b=this.nextToken().value;s.assert(b==="let"||b==="const","Lexical declaration must be either let or const");var w=this.parseBindingList(b,m);return this.consumeSemicolon(),this.finalize(v,new l.VariableDeclaration(w,b))},y.prototype.parseBindingRestElement=function(m,v){var b=this.createNode();this.expect("...");var w=this.parsePattern(m,v);return this.finalize(b,new l.RestElement(w))},y.prototype.parseArrayPattern=function(m,v){var b=this.createNode();this.expect("[");for(var w=[];!this.match("]");)if(this.match(","))this.nextToken(),w.push(null);else{if(this.match("...")){w.push(this.parseBindingRestElement(m,v));break}else w.push(this.parsePatternWithDefault(m,v));this.match("]")||this.expect(",")}return this.expect("]"),this.finalize(b,new l.ArrayPattern(w))},y.prototype.parsePropertyPattern=function(m,v){var b=this.createNode(),w=!1,O=!1,k=!1,E,T;if(this.lookahead.type===3){var N=this.lookahead;E=this.parseVariableIdentifier();var _=this.finalize(b,new l.Identifier(N.value));if(this.match("=")){m.push(N),O=!0,this.nextToken();var I=this.parseAssignmentExpression();T=this.finalize(this.startNode(N),new l.AssignmentPattern(_,I))}else this.match(":")?(this.expect(":"),T=this.parsePatternWithDefault(m,v)):(m.push(N),O=!0,T=_)}else w=this.match("["),E=this.parseObjectPropertyKey(),this.expect(":"),T=this.parsePatternWithDefault(m,v);return this.finalize(b,new l.Property("init",E,w,T,k,O))},y.prototype.parseObjectPattern=function(m,v){var b=this.createNode(),w=[];for(this.expect("{");!this.match("}");)w.push(this.parsePropertyPattern(m,v)),this.match("}")||this.expect(",");return this.expect("}"),this.finalize(b,new l.ObjectPattern(w))},y.prototype.parsePattern=function(m,v){var b;return this.match("[")?b=this.parseArrayPattern(m,v):this.match("{")?b=this.parseObjectPattern(m,v):(this.matchKeyword("let")&&(v==="const"||v==="let")&&this.tolerateUnexpectedToken(this.lookahead,o.Messages.LetInLexicalBinding),m.push(this.lookahead),b=this.parseVariableIdentifier(v)),b},y.prototype.parsePatternWithDefault=function(m,v){var b=this.lookahead,w=this.parsePattern(m,v);if(this.match("=")){this.nextToken();var O=this.context.allowYield;this.context.allowYield=!0;var k=this.isolateCoverGrammar(this.parseAssignmentExpression);this.context.allowYield=O,w=this.finalize(this.startNode(b),new l.AssignmentPattern(w,k))}return w},y.prototype.parseVariableIdentifier=function(m){var v=this.createNode(),b=this.nextToken();return b.type===4&&b.value==="yield"?this.context.strict?this.tolerateUnexpectedToken(b,o.Messages.StrictReservedWord):this.context.allowYield||this.throwUnexpectedToken(b):b.type!==3?this.context.strict&&b.type===4&&this.scanner.isStrictModeReservedWord(b.value)?this.tolerateUnexpectedToken(b,o.Messages.StrictReservedWord):(this.context.strict||b.value!=="let"||m!=="var")&&this.throwUnexpectedToken(b):(this.context.isModule||this.context.await)&&b.type===3&&b.value==="await"&&this.tolerateUnexpectedToken(b),this.finalize(v,new l.Identifier(b.value))},y.prototype.parseVariableDeclaration=function(m){var v=this.createNode(),b=[],w=this.parsePattern(b,"var");this.context.strict&&w.type===u.Syntax.Identifier&&this.scanner.isRestrictedWord(w.name)&&this.tolerateError(o.Messages.StrictVarName);var O=null;return this.match("=")?(this.nextToken(),O=this.isolateCoverGrammar(this.parseAssignmentExpression)):w.type!==u.Syntax.Identifier&&!m.inFor&&this.expect("="),this.finalize(v,new l.VariableDeclarator(w,O))},y.prototype.parseVariableDeclarationList=function(m){var v={inFor:m.inFor},b=[];for(b.push(this.parseVariableDeclaration(v));this.match(",");)this.nextToken(),b.push(this.parseVariableDeclaration(v));return b},y.prototype.parseVariableStatement=function(){var m=this.createNode();this.expectKeyword("var");var v=this.parseVariableDeclarationList({inFor:!1});return this.consumeSemicolon(),this.finalize(m,new l.VariableDeclaration(v,"var"))},y.prototype.parseEmptyStatement=function(){var m=this.createNode();return this.expect(";"),this.finalize(m,new l.EmptyStatement)},y.prototype.parseExpressionStatement=function(){var m=this.createNode(),v=this.parseExpression();return this.consumeSemicolon(),this.finalize(m,new l.ExpressionStatement(v))},y.prototype.parseIfClause=function(){return this.context.strict&&this.matchKeyword("function")&&this.tolerateError(o.Messages.StrictFunction),this.parseStatement()},y.prototype.parseIfStatement=function(){var m=this.createNode(),v,b=null;this.expectKeyword("if"),this.expect("(");var w=this.parseExpression();return!this.match(")")&&this.config.tolerant?(this.tolerateUnexpectedToken(this.nextToken()),v=this.finalize(this.createNode(),new l.EmptyStatement)):(this.expect(")"),v=this.parseIfClause(),this.matchKeyword("else")&&(this.nextToken(),b=this.parseIfClause())),this.finalize(m,new l.IfStatement(w,v,b))},y.prototype.parseDoWhileStatement=function(){var m=this.createNode();this.expectKeyword("do");var v=this.context.inIteration;this.context.inIteration=!0;var b=this.parseStatement();this.context.inIteration=v,this.expectKeyword("while"),this.expect("(");var w=this.parseExpression();return!this.match(")")&&this.config.tolerant?this.tolerateUnexpectedToken(this.nextToken()):(this.expect(")"),this.match(";")&&this.nextToken()),this.finalize(m,new l.DoWhileStatement(b,w))},y.prototype.parseWhileStatement=function(){var m=this.createNode(),v;this.expectKeyword("while"),this.expect("(");var b=this.parseExpression();if(!this.match(")")&&this.config.tolerant)this.tolerateUnexpectedToken(this.nextToken()),v=this.finalize(this.createNode(),new l.EmptyStatement);else{this.expect(")");var w=this.context.inIteration;this.context.inIteration=!0,v=this.parseStatement(),this.context.inIteration=w}return this.finalize(m,new l.WhileStatement(b,v))},y.prototype.parseForStatement=function(){var m=null,v=null,b=null,w=!0,O,k,E=this.createNode();if(this.expectKeyword("for"),this.expect("("),this.match(";"))this.nextToken();else if(this.matchKeyword("var")){m=this.createNode(),this.nextToken();var T=this.context.allowIn;this.context.allowIn=!1;var N=this.parseVariableDeclarationList({inFor:!0});if(this.context.allowIn=T,N.length===1&&this.matchKeyword("in")){var _=N[0];_.init&&(_.id.type===u.Syntax.ArrayPattern||_.id.type===u.Syntax.ObjectPattern||this.context.strict)&&this.tolerateError(o.Messages.ForInOfLoopInitializer,"for-in"),m=this.finalize(m,new l.VariableDeclaration(N,"var")),this.nextToken(),O=m,k=this.parseExpression(),m=null}else N.length===1&&N[0].init===null&&this.matchContextualKeyword("of")?(m=this.finalize(m,new l.VariableDeclaration(N,"var")),this.nextToken(),O=m,k=this.parseAssignmentExpression(),m=null,w=!1):(m=this.finalize(m,new l.VariableDeclaration(N,"var")),this.expect(";"))}else if(this.matchKeyword("const")||this.matchKeyword("let")){m=this.createNode();var I=this.nextToken().value;if(!this.context.strict&&this.lookahead.value==="in")m=this.finalize(m,new l.Identifier(I)),this.nextToken(),O=m,k=this.parseExpression(),m=null;else{var T=this.context.allowIn;this.context.allowIn=!1;var N=this.parseBindingList(I,{inFor:!0});this.context.allowIn=T,N.length===1&&N[0].init===null&&this.matchKeyword("in")?(m=this.finalize(m,new l.VariableDeclaration(N,I)),this.nextToken(),O=m,k=this.parseExpression(),m=null):N.length===1&&N[0].init===null&&this.matchContextualKeyword("of")?(m=this.finalize(m,new l.VariableDeclaration(N,I)),this.nextToken(),O=m,k=this.parseAssignmentExpression(),m=null,w=!1):(this.consumeSemicolon(),m=this.finalize(m,new l.VariableDeclaration(N,I)))}}else{var j=this.lookahead,T=this.context.allowIn;if(this.context.allowIn=!1,m=this.inheritCoverGrammar(this.parseAssignmentExpression),this.context.allowIn=T,this.matchKeyword("in"))(!this.context.isAssignmentTarget||m.type===u.Syntax.AssignmentExpression)&&this.tolerateError(o.Messages.InvalidLHSInForIn),this.nextToken(),this.reinterpretExpressionAsPattern(m),O=m,k=this.parseExpression(),m=null;else if(this.matchContextualKeyword("of"))(!this.context.isAssignmentTarget||m.type===u.Syntax.AssignmentExpression)&&this.tolerateError(o.Messages.InvalidLHSInForLoop),this.nextToken(),this.reinterpretExpressionAsPattern(m),O=m,k=this.parseAssignmentExpression(),m=null,w=!1;else{if(this.match(",")){for(var L=[m];this.match(",");)this.nextToken(),L.push(this.isolateCoverGrammar(this.parseAssignmentExpression));m=this.finalize(this.startNode(j),new l.SequenceExpression(L))}this.expect(";")}}typeof O>"u"&&(this.match(";")||(v=this.parseExpression()),this.expect(";"),this.match(")")||(b=this.parseExpression()));var B;if(!this.match(")")&&this.config.tolerant)this.tolerateUnexpectedToken(this.nextToken()),B=this.finalize(this.createNode(),new l.EmptyStatement);else{this.expect(")");var $=this.context.inIteration;this.context.inIteration=!0,B=this.isolateCoverGrammar(this.parseStatement),this.context.inIteration=$}return typeof O>"u"?this.finalize(E,new l.ForStatement(m,v,b,B)):w?this.finalize(E,new l.ForInStatement(O,k,B)):this.finalize(E,new l.ForOfStatement(O,k,B))},y.prototype.parseContinueStatement=function(){var m=this.createNode();this.expectKeyword("continue");var v=null;if(this.lookahead.type===3&&!this.hasLineTerminator){var b=this.parseVariableIdentifier();v=b;var w="$"+b.name;Object.prototype.hasOwnProperty.call(this.context.labelSet,w)||this.throwError(o.Messages.UnknownLabel,b.name)}return this.consumeSemicolon(),v===null&&!this.context.inIteration&&this.throwError(o.Messages.IllegalContinue),this.finalize(m,new l.ContinueStatement(v))},y.prototype.parseBreakStatement=function(){var m=this.createNode();this.expectKeyword("break");var v=null;if(this.lookahead.type===3&&!this.hasLineTerminator){var b=this.parseVariableIdentifier(),w="$"+b.name;Object.prototype.hasOwnProperty.call(this.context.labelSet,w)||this.throwError(o.Messages.UnknownLabel,b.name),v=b}return this.consumeSemicolon(),v===null&&!this.context.inIteration&&!this.context.inSwitch&&this.throwError(o.Messages.IllegalBreak),this.finalize(m,new l.BreakStatement(v))},y.prototype.parseReturnStatement=function(){this.context.inFunctionBody||this.tolerateError(o.Messages.IllegalReturn);var m=this.createNode();this.expectKeyword("return");var v=!this.match(";")&&!this.match("}")&&!this.hasLineTerminator&&this.lookahead.type!==2||this.lookahead.type===8||this.lookahead.type===10,b=v?this.parseExpression():null;return this.consumeSemicolon(),this.finalize(m,new l.ReturnStatement(b))},y.prototype.parseWithStatement=function(){this.context.strict&&this.tolerateError(o.Messages.StrictModeWith);var m=this.createNode(),v;this.expectKeyword("with"),this.expect("(");var b=this.parseExpression();return!this.match(")")&&this.config.tolerant?(this.tolerateUnexpectedToken(this.nextToken()),v=this.finalize(this.createNode(),new l.EmptyStatement)):(this.expect(")"),v=this.parseStatement()),this.finalize(m,new l.WithStatement(b,v))},y.prototype.parseSwitchCase=function(){var m=this.createNode(),v;this.matchKeyword("default")?(this.nextToken(),v=null):(this.expectKeyword("case"),v=this.parseExpression()),this.expect(":");for(var b=[];!(this.match("}")||this.matchKeyword("default")||this.matchKeyword("case"));)b.push(this.parseStatementListItem());return this.finalize(m,new l.SwitchCase(v,b))},y.prototype.parseSwitchStatement=function(){var m=this.createNode();this.expectKeyword("switch"),this.expect("(");var v=this.parseExpression();this.expect(")");var b=this.context.inSwitch;this.context.inSwitch=!0;var w=[],O=!1;for(this.expect("{");!this.match("}");){var k=this.parseSwitchCase();k.test===null&&(O&&this.throwError(o.Messages.MultipleDefaultsInSwitch),O=!0),w.push(k)}return this.expect("}"),this.context.inSwitch=b,this.finalize(m,new l.SwitchStatement(v,w))},y.prototype.parseLabelledStatement=function(){var m=this.createNode(),v=this.parseExpression(),b;if(v.type===u.Syntax.Identifier&&this.match(":")){this.nextToken();var w=v,O="$"+w.name;Object.prototype.hasOwnProperty.call(this.context.labelSet,O)&&this.throwError(o.Messages.Redeclaration,"Label",w.name),this.context.labelSet[O]=!0;var k=void 0;if(this.matchKeyword("class"))this.tolerateUnexpectedToken(this.lookahead),k=this.parseClassDeclaration();else if(this.matchKeyword("function")){var E=this.lookahead,T=this.parseFunctionDeclaration();this.context.strict?this.tolerateUnexpectedToken(E,o.Messages.StrictFunction):T.generator&&this.tolerateUnexpectedToken(E,o.Messages.GeneratorInLegacyContext),k=T}else k=this.parseStatement();delete this.context.labelSet[O],b=new l.LabeledStatement(w,k)}else this.consumeSemicolon(),b=new l.ExpressionStatement(v);return this.finalize(m,b)},y.prototype.parseThrowStatement=function(){var m=this.createNode();this.expectKeyword("throw"),this.hasLineTerminator&&this.throwError(o.Messages.NewlineAfterThrow);var v=this.parseExpression();return this.consumeSemicolon(),this.finalize(m,new l.ThrowStatement(v))},y.prototype.parseCatchClause=function(){var m=this.createNode();this.expectKeyword("catch"),this.expect("("),this.match(")")&&this.throwUnexpectedToken(this.lookahead);for(var v=[],b=this.parsePattern(v),w={},O=0;O0&&this.tolerateError(o.Messages.BadGetterArity);var O=this.parsePropertyMethod(w);return this.context.allowYield=b,this.finalize(m,new l.FunctionExpression(null,w.params,O,v))},y.prototype.parseSetterMethod=function(){var m=this.createNode(),v=!1,b=this.context.allowYield;this.context.allowYield=!v;var w=this.parseFormalParameters();w.params.length!==1?this.tolerateError(o.Messages.BadSetterArity):w.params[0]instanceof l.RestElement&&this.tolerateError(o.Messages.BadSetterRestParameter);var O=this.parsePropertyMethod(w);return this.context.allowYield=b,this.finalize(m,new l.FunctionExpression(null,w.params,O,v))},y.prototype.parseGeneratorMethod=function(){var m=this.createNode(),v=!0,b=this.context.allowYield;this.context.allowYield=!0;var w=this.parseFormalParameters();this.context.allowYield=!1;var O=this.parsePropertyMethod(w);return this.context.allowYield=b,this.finalize(m,new l.FunctionExpression(null,w.params,O,v))},y.prototype.isStartOfExpression=function(){var m=!0,v=this.lookahead.value;switch(this.lookahead.type){case 7:m=v==="["||v==="("||v==="{"||v==="+"||v==="-"||v==="!"||v==="~"||v==="++"||v==="--"||v==="/"||v==="/=";break;case 4:m=v==="class"||v==="delete"||v==="function"||v==="let"||v==="new"||v==="super"||v==="this"||v==="typeof"||v==="void"||v==="yield";break}return m},y.prototype.parseYieldExpression=function(){var m=this.createNode();this.expectKeyword("yield");var v=null,b=!1;if(!this.hasLineTerminator){var w=this.context.allowYield;this.context.allowYield=!1,b=this.match("*"),b?(this.nextToken(),v=this.parseAssignmentExpression()):this.isStartOfExpression()&&(v=this.parseAssignmentExpression()),this.context.allowYield=w}return this.finalize(m,new l.YieldExpression(v,b))},y.prototype.parseClassElement=function(m){var v=this.lookahead,b=this.createNode(),w="",O=null,k=null,E=!1,T=!1,N=!1,_=!1;if(this.match("*"))this.nextToken();else{E=this.match("["),O=this.parseObjectPropertyKey();var I=O;if(I.name==="static"&&(this.qualifiedPropertyName(this.lookahead)||this.match("*"))&&(v=this.lookahead,N=!0,E=this.match("["),this.match("*")?this.nextToken():O=this.parseObjectPropertyKey()),v.type===3&&!this.hasLineTerminator&&v.value==="async"){var j=this.lookahead.value;j!==":"&&j!=="("&&j!=="*"&&(_=!0,v=this.lookahead,O=this.parseObjectPropertyKey(),v.type===3&&v.value==="constructor"&&this.tolerateUnexpectedToken(v,o.Messages.ConstructorIsAsync))}}var L=this.qualifiedPropertyName(this.lookahead);return v.type===3?v.value==="get"&&L?(w="get",E=this.match("["),O=this.parseObjectPropertyKey(),this.context.allowYield=!1,k=this.parseGetterMethod()):v.value==="set"&&L&&(w="set",E=this.match("["),O=this.parseObjectPropertyKey(),k=this.parseSetterMethod()):v.type===7&&v.value==="*"&&L&&(w="init",E=this.match("["),O=this.parseObjectPropertyKey(),k=this.parseGeneratorMethod(),T=!0),!w&&O&&this.match("(")&&(w="init",k=_?this.parsePropertyMethodAsyncFunction():this.parsePropertyMethodFunction(),T=!0),w||this.throwUnexpectedToken(this.lookahead),w==="init"&&(w="method"),E||(N&&this.isPropertyKey(O,"prototype")&&this.throwUnexpectedToken(v,o.Messages.StaticPrototype),!N&&this.isPropertyKey(O,"constructor")&&((w!=="method"||!T||k&&k.generator)&&this.throwUnexpectedToken(v,o.Messages.ConstructorSpecialMethod),m.value?this.throwUnexpectedToken(v,o.Messages.DuplicateConstructor):m.value=!0,w="constructor")),this.finalize(b,new l.MethodDefinition(O,E,k,w,N))},y.prototype.parseClassElementList=function(){var m=[],v={value:!1};for(this.expect("{");!this.match("}");)this.match(";")?this.nextToken():m.push(this.parseClassElement(v));return this.expect("}"),m},y.prototype.parseClassBody=function(){var m=this.createNode(),v=this.parseClassElementList();return this.finalize(m,new l.ClassBody(v))},y.prototype.parseClassDeclaration=function(m){var v=this.createNode(),b=this.context.strict;this.context.strict=!0,this.expectKeyword("class");var w=m&&this.lookahead.type!==3?null:this.parseVariableIdentifier(),O=null;this.matchKeyword("extends")&&(this.nextToken(),O=this.isolateCoverGrammar(this.parseLeftHandSideExpressionAllowCall));var k=this.parseClassBody();return this.context.strict=b,this.finalize(v,new l.ClassDeclaration(w,O,k))},y.prototype.parseClassExpression=function(){var m=this.createNode(),v=this.context.strict;this.context.strict=!0,this.expectKeyword("class");var b=this.lookahead.type===3?this.parseVariableIdentifier():null,w=null;this.matchKeyword("extends")&&(this.nextToken(),w=this.isolateCoverGrammar(this.parseLeftHandSideExpressionAllowCall));var O=this.parseClassBody();return this.context.strict=v,this.finalize(m,new l.ClassExpression(b,w,O))},y.prototype.parseModule=function(){this.context.strict=!0,this.context.isModule=!0,this.scanner.isModule=!0;for(var m=this.createNode(),v=this.parseDirectivePrologues();this.lookahead.type!==2;)v.push(this.parseStatementListItem());return this.finalize(m,new l.Module(v))},y.prototype.parseScript=function(){for(var m=this.createNode(),v=this.parseDirectivePrologues();this.lookahead.type!==2;)v.push(this.parseStatementListItem());return this.finalize(m,new l.Script(v))},y.prototype.parseModuleSpecifier=function(){var m=this.createNode();this.lookahead.type!==8&&this.throwError(o.Messages.InvalidModuleSpecifier);var v=this.nextToken(),b=this.getTokenRaw(v);return this.finalize(m,new l.Literal(v.value,b))},y.prototype.parseImportSpecifier=function(){var m=this.createNode(),v,b;return this.lookahead.type===3?(v=this.parseVariableIdentifier(),b=v,this.matchContextualKeyword("as")&&(this.nextToken(),b=this.parseVariableIdentifier())):(v=this.parseIdentifierName(),b=v,this.matchContextualKeyword("as")?(this.nextToken(),b=this.parseVariableIdentifier()):this.throwUnexpectedToken(this.nextToken())),this.finalize(m,new l.ImportSpecifier(b,v))},y.prototype.parseNamedImports=function(){this.expect("{");for(var m=[];!this.match("}");)m.push(this.parseImportSpecifier()),this.match("}")||this.expect(",");return this.expect("}"),m},y.prototype.parseImportDefaultSpecifier=function(){var m=this.createNode(),v=this.parseIdentifierName();return this.finalize(m,new l.ImportDefaultSpecifier(v))},y.prototype.parseImportNamespaceSpecifier=function(){var m=this.createNode();this.expect("*"),this.matchContextualKeyword("as")||this.throwError(o.Messages.NoAsAfterImportNamespace),this.nextToken();var v=this.parseIdentifierName();return this.finalize(m,new l.ImportNamespaceSpecifier(v))},y.prototype.parseImportDeclaration=function(){this.context.inFunctionBody&&this.throwError(o.Messages.IllegalImportDeclaration);var m=this.createNode();this.expectKeyword("import");var v,b=[];if(this.lookahead.type===8)v=this.parseModuleSpecifier();else{if(this.match("{")?b=b.concat(this.parseNamedImports()):this.match("*")?b.push(this.parseImportNamespaceSpecifier()):this.isIdentifierName(this.lookahead)&&!this.matchKeyword("default")?(b.push(this.parseImportDefaultSpecifier()),this.match(",")&&(this.nextToken(),this.match("*")?b.push(this.parseImportNamespaceSpecifier()):this.match("{")?b=b.concat(this.parseNamedImports()):this.throwUnexpectedToken(this.lookahead))):this.throwUnexpectedToken(this.nextToken()),!this.matchContextualKeyword("from")){var w=this.lookahead.value?o.Messages.UnexpectedToken:o.Messages.MissingFromClause;this.throwError(w,this.lookahead.value)}this.nextToken(),v=this.parseModuleSpecifier()}return this.consumeSemicolon(),this.finalize(m,new l.ImportDeclaration(b,v))},y.prototype.parseExportSpecifier=function(){var m=this.createNode(),v=this.parseIdentifierName(),b=v;return this.matchContextualKeyword("as")&&(this.nextToken(),b=this.parseIdentifierName()),this.finalize(m,new l.ExportSpecifier(v,b))},y.prototype.parseExportDeclaration=function(){this.context.inFunctionBody&&this.throwError(o.Messages.IllegalExportDeclaration);var m=this.createNode();this.expectKeyword("export");var v;if(this.matchKeyword("default"))if(this.nextToken(),this.matchKeyword("function")){var b=this.parseFunctionDeclaration(!0);v=this.finalize(m,new l.ExportDefaultDeclaration(b))}else if(this.matchKeyword("class")){var b=this.parseClassDeclaration(!0);v=this.finalize(m,new l.ExportDefaultDeclaration(b))}else if(this.matchContextualKeyword("async")){var b=this.matchAsyncFunction()?this.parseFunctionDeclaration(!0):this.parseAssignmentExpression();v=this.finalize(m,new l.ExportDefaultDeclaration(b))}else{this.matchContextualKeyword("from")&&this.throwError(o.Messages.UnexpectedToken,this.lookahead.value);var b=this.match("{")?this.parseObjectInitializer():this.match("[")?this.parseArrayInitializer():this.parseAssignmentExpression();this.consumeSemicolon(),v=this.finalize(m,new l.ExportDefaultDeclaration(b))}else if(this.match("*")){if(this.nextToken(),!this.matchContextualKeyword("from")){var w=this.lookahead.value?o.Messages.UnexpectedToken:o.Messages.MissingFromClause;this.throwError(w,this.lookahead.value)}this.nextToken();var O=this.parseModuleSpecifier();this.consumeSemicolon(),v=this.finalize(m,new l.ExportAllDeclaration(O))}else if(this.lookahead.type===4){var b=void 0;switch(this.lookahead.value){case"let":case"const":b=this.parseLexicalDeclaration({inFor:!1});break;case"var":case"class":case"function":b=this.parseStatementListItem();break;default:this.throwUnexpectedToken(this.lookahead)}v=this.finalize(m,new l.ExportNamedDeclaration(b,[],null))}else if(this.matchAsyncFunction()){var b=this.parseFunctionDeclaration();v=this.finalize(m,new l.ExportNamedDeclaration(b,[],null))}else{var k=[],E=null,T=!1;for(this.expect("{");!this.match("}");)T=T||this.matchKeyword("default"),k.push(this.parseExportSpecifier()),this.match("}")||this.expect(",");if(this.expect("}"),this.matchContextualKeyword("from"))this.nextToken(),E=this.parseModuleSpecifier(),this.consumeSemicolon();else if(T){var w=this.lookahead.value?o.Messages.UnexpectedToken:o.Messages.MissingFromClause;this.throwError(w,this.lookahead.value)}else this.consumeSemicolon();v=this.finalize(m,new l.ExportNamedDeclaration(null,k,E))}return v},y})();r.Parser=p},function(n,r){Object.defineProperty(r,"__esModule",{value:!0});function i(s,a){if(!s)throw new Error("ASSERT: "+a)}r.assert=i},function(n,r){Object.defineProperty(r,"__esModule",{value:!0});var i=(function(){function s(){this.errors=[],this.tolerant=!1}return s.prototype.recordError=function(a){this.errors.push(a)},s.prototype.tolerate=function(a){if(this.tolerant)this.recordError(a);else throw a},s.prototype.constructError=function(a,o){var l=new Error(a);try{throw l}catch(c){Object.create&&Object.defineProperty&&(l=Object.create(c),Object.defineProperty(l,"column",{value:o}))}return l},s.prototype.createError=function(a,o,l,c){var u="Line "+o+": "+c,f=this.constructError(u,l);return f.index=a,f.lineNumber=o,f.description=c,f},s.prototype.throwError=function(a,o,l,c){throw this.createError(a,o,l,c)},s.prototype.tolerateError=function(a,o,l,c){var u=this.createError(a,o,l,c);if(this.tolerant)this.recordError(u);else throw u},s})();r.ErrorHandler=i},function(n,r){Object.defineProperty(r,"__esModule",{value:!0}),r.Messages={BadGetterArity:"Getter must not have any formal parameters",BadSetterArity:"Setter must have exactly one formal parameter",BadSetterRestParameter:"Setter function argument must not be a rest parameter",ConstructorIsAsync:"Class constructor may not be an async method",ConstructorSpecialMethod:"Class constructor may not be an accessor",DeclarationMissingInitializer:"Missing initializer in %0 declaration",DefaultRestParameter:"Unexpected token =",DuplicateBinding:"Duplicate binding %0",DuplicateConstructor:"A class may only have one constructor",DuplicateProtoProperty:"Duplicate __proto__ fields are not allowed in object literals",ForInOfLoopInitializer:"%0 loop variable declaration may not have an initializer",GeneratorInLegacyContext:"Generator declarations are not allowed in legacy contexts",IllegalBreak:"Illegal break statement",IllegalContinue:"Illegal continue statement",IllegalExportDeclaration:"Unexpected token",IllegalImportDeclaration:"Unexpected token",IllegalLanguageModeDirective:"Illegal 'use strict' directive in function with non-simple parameter list",IllegalReturn:"Illegal return statement",InvalidEscapedReservedWord:"Keyword must not contain escaped characters",InvalidHexEscapeSequence:"Invalid hexadecimal escape sequence",InvalidLHSInAssignment:"Invalid left-hand side in assignment",InvalidLHSInForIn:"Invalid left-hand side in for-in",InvalidLHSInForLoop:"Invalid left-hand side in for-loop",InvalidModuleSpecifier:"Unexpected token",InvalidRegExp:"Invalid regular expression",LetInLexicalBinding:"let is disallowed as a lexically bound name",MissingFromClause:"Unexpected token",MultipleDefaultsInSwitch:"More than one default clause in switch statement",NewlineAfterThrow:"Illegal newline after throw",NoAsAfterImportNamespace:"Unexpected token",NoCatchOrFinally:"Missing catch or finally after try",ParameterAfterRestParameter:"Rest parameter must be last formal parameter",Redeclaration:"%0 '%1' has already been declared",StaticPrototype:"Classes may not have static property named prototype",StrictCatchVariable:"Catch variable may not be eval or arguments in strict mode",StrictDelete:"Delete of an unqualified identifier in strict mode.",StrictFunction:"In strict mode code, functions can only be declared at top level or inside a block",StrictFunctionName:"Function name may not be eval or arguments in strict mode",StrictLHSAssignment:"Assignment to eval or arguments is not allowed in strict mode",StrictLHSPostfix:"Postfix increment/decrement may not have eval or arguments operand in strict mode",StrictLHSPrefix:"Prefix increment/decrement may not have eval or arguments operand in strict mode",StrictModeWith:"Strict mode code may not include a with statement",StrictOctalLiteral:"Octal literals are not allowed in strict mode.",StrictParamDupe:"Strict mode function may not have duplicate parameter names",StrictParamName:"Parameter name eval or arguments is not allowed in strict mode",StrictReservedWord:"Use of future reserved word in strict mode",StrictVarName:"Variable name may not be eval or arguments in strict mode",TemplateOctalLiteral:"Octal literals are not allowed in template strings.",UnexpectedEOS:"Unexpected end of input",UnexpectedIdentifier:"Unexpected identifier",UnexpectedNumber:"Unexpected number",UnexpectedReserved:"Unexpected reserved word",UnexpectedString:"Unexpected string",UnexpectedTemplate:"Unexpected quasi %0",UnexpectedToken:"Unexpected token %0",UnexpectedTokenIllegal:"Unexpected token ILLEGAL",UnknownLabel:"Undefined label '%0'",UnterminatedRegExp:"Invalid regular expression: missing /"}},function(n,r,i){Object.defineProperty(r,"__esModule",{value:!0});var s=i(9),a=i(4),o=i(11);function l(f){return"0123456789abcdef".indexOf(f.toLowerCase())}function c(f){return"01234567".indexOf(f)}var u=(function(){function f(h,p){this.source=h,this.errorHandler=p,this.trackComment=!1,this.isModule=!1,this.length=h.length,this.index=0,this.lineNumber=h.length>0?1:0,this.lineStart=0,this.curlyStack=[]}return f.prototype.saveState=function(){return{index:this.index,lineNumber:this.lineNumber,lineStart:this.lineStart}},f.prototype.restoreState=function(h){this.index=h.index,this.lineNumber=h.lineNumber,this.lineStart=h.lineStart},f.prototype.eof=function(){return this.index>=this.length},f.prototype.throwUnexpectedToken=function(h){return h===void 0&&(h=o.Messages.UnexpectedTokenIllegal),this.errorHandler.throwError(this.index,this.lineNumber,this.index-this.lineStart+1,h)},f.prototype.tolerateUnexpectedToken=function(h){h===void 0&&(h=o.Messages.UnexpectedTokenIllegal),this.errorHandler.tolerateError(this.index,this.lineNumber,this.index-this.lineStart+1,h)},f.prototype.skipSingleLineComment=function(h){var p=[],y,m;for(this.trackComment&&(p=[],y=this.index-h,m={start:{line:this.lineNumber,column:this.index-this.lineStart-h},end:{}});!this.eof();){var v=this.source.charCodeAt(this.index);if(++this.index,a.Character.isLineTerminator(v)){if(this.trackComment){m.end={line:this.lineNumber,column:this.index-this.lineStart-1};var b={multiLine:!1,slice:[y+h,this.index-1],range:[y,this.index-1],loc:m};p.push(b)}return v===13&&this.source.charCodeAt(this.index)===10&&++this.index,++this.lineNumber,this.lineStart=this.index,p}}if(this.trackComment){m.end={line:this.lineNumber,column:this.index-this.lineStart};var b={multiLine:!1,slice:[y+h,this.index],range:[y,this.index],loc:m};p.push(b)}return p},f.prototype.skipMultiLineComment=function(){var h=[],p,y;for(this.trackComment&&(h=[],p=this.index-2,y={start:{line:this.lineNumber,column:this.index-this.lineStart-2},end:{}});!this.eof();){var m=this.source.charCodeAt(this.index);if(a.Character.isLineTerminator(m))m===13&&this.source.charCodeAt(this.index+1)===10&&++this.index,++this.lineNumber,++this.index,this.lineStart=this.index;else if(m===42){if(this.source.charCodeAt(this.index+1)===47){if(this.index+=2,this.trackComment){y.end={line:this.lineNumber,column:this.index-this.lineStart};var v={multiLine:!0,slice:[p+2,this.index-2],range:[p,this.index],loc:y};h.push(v)}return h}++this.index}else++this.index}if(this.trackComment){y.end={line:this.lineNumber,column:this.index-this.lineStart};var v={multiLine:!0,slice:[p+2,this.index],range:[p,this.index],loc:y};h.push(v)}return this.tolerateUnexpectedToken(),h},f.prototype.scanComments=function(){var h;this.trackComment&&(h=[]);for(var p=this.index===0;!this.eof();){var y=this.source.charCodeAt(this.index);if(a.Character.isWhiteSpace(y))++this.index;else if(a.Character.isLineTerminator(y))++this.index,y===13&&this.source.charCodeAt(this.index)===10&&++this.index,++this.lineNumber,this.lineStart=this.index,p=!0;else if(y===47)if(y=this.source.charCodeAt(this.index+1),y===47){this.index+=2;var m=this.skipSingleLineComment(2);this.trackComment&&(h=h.concat(m)),p=!0}else if(y===42){this.index+=2;var m=this.skipMultiLineComment();this.trackComment&&(h=h.concat(m))}else break;else if(p&&y===45)if(this.source.charCodeAt(this.index+1)===45&&this.source.charCodeAt(this.index+2)===62){this.index+=3;var m=this.skipSingleLineComment(3);this.trackComment&&(h=h.concat(m))}else break;else if(y===60&&!this.isModule)if(this.source.slice(this.index+1,this.index+4)==="!--"){this.index+=4;var m=this.skipSingleLineComment(4);this.trackComment&&(h=h.concat(m))}else break;else break}return h},f.prototype.isFutureReservedWord=function(h){switch(h){case"enum":case"export":case"import":case"super":return!0;default:return!1}},f.prototype.isStrictModeReservedWord=function(h){switch(h){case"implements":case"interface":case"package":case"private":case"protected":case"public":case"static":case"yield":case"let":return!0;default:return!1}},f.prototype.isRestrictedWord=function(h){return h==="eval"||h==="arguments"},f.prototype.isKeyword=function(h){switch(h.length){case 2:return h==="if"||h==="in"||h==="do";case 3:return h==="var"||h==="for"||h==="new"||h==="try"||h==="let";case 4:return h==="this"||h==="else"||h==="case"||h==="void"||h==="with"||h==="enum";case 5:return h==="while"||h==="break"||h==="catch"||h==="throw"||h==="const"||h==="yield"||h==="class"||h==="super";case 6:return h==="return"||h==="typeof"||h==="delete"||h==="switch"||h==="export"||h==="import";case 7:return h==="default"||h==="finally"||h==="extends";case 8:return h==="function"||h==="continue"||h==="debugger";case 10:return h==="instanceof";default:return!1}},f.prototype.codePointAt=function(h){var p=this.source.charCodeAt(h);if(p>=55296&&p<=56319){var y=this.source.charCodeAt(h+1);if(y>=56320&&y<=57343){var m=p;p=(m-55296)*1024+y-56320+65536}}return p},f.prototype.scanHexEscape=function(h){for(var p=h==="u"?4:2,y=0,m=0;m1114111||h!=="}")&&this.throwUnexpectedToken(),a.Character.fromCodePoint(p)},f.prototype.getIdentifier=function(){for(var h=this.index++;!this.eof();){var p=this.source.charCodeAt(this.index);if(p===92)return this.index=h,this.getComplexIdentifier();if(p>=55296&&p<57343)return this.index=h,this.getComplexIdentifier();if(a.Character.isIdentifierPart(p))++this.index;else break}return this.source.slice(h,this.index)},f.prototype.getComplexIdentifier=function(){var h=this.codePointAt(this.index),p=a.Character.fromCodePoint(h);this.index+=p.length;var y;for(h===92&&(this.source.charCodeAt(this.index)!==117&&this.throwUnexpectedToken(),++this.index,this.source[this.index]==="{"?(++this.index,y=this.scanUnicodeCodePointEscape()):(y=this.scanHexEscape("u"),(y===null||y==="\\"||!a.Character.isIdentifierStart(y.charCodeAt(0)))&&this.throwUnexpectedToken()),p=y);!this.eof()&&(h=this.codePointAt(this.index),!!a.Character.isIdentifierPart(h));)y=a.Character.fromCodePoint(h),p+=y,this.index+=y.length,h===92&&(p=p.substr(0,p.length-1),this.source.charCodeAt(this.index)!==117&&this.throwUnexpectedToken(),++this.index,this.source[this.index]==="{"?(++this.index,y=this.scanUnicodeCodePointEscape()):(y=this.scanHexEscape("u"),(y===null||y==="\\"||!a.Character.isIdentifierPart(y.charCodeAt(0)))&&this.throwUnexpectedToken()),p+=y);return p},f.prototype.octalToDecimal=function(h){var p=h!=="0",y=c(h);return!this.eof()&&a.Character.isOctalDigit(this.source.charCodeAt(this.index))&&(p=!0,y=y*8+c(this.source[this.index++]),"0123".indexOf(h)>=0&&!this.eof()&&a.Character.isOctalDigit(this.source.charCodeAt(this.index))&&(y=y*8+c(this.source[this.index++]))),{code:y,octal:p}},f.prototype.scanIdentifier=function(){var h,p=this.index,y=this.source.charCodeAt(p)===92?this.getComplexIdentifier():this.getIdentifier();if(y.length===1?h=3:this.isKeyword(y)?h=4:y==="null"?h=5:y==="true"||y==="false"?h=1:h=3,h!==3&&p+y.length!==this.index){var m=this.index;this.index=p,this.tolerateUnexpectedToken(o.Messages.InvalidEscapedReservedWord),this.index=m}return{type:h,value:y,lineNumber:this.lineNumber,lineStart:this.lineStart,start:p,end:this.index}},f.prototype.scanPunctuator=function(){var h=this.index,p=this.source[this.index];switch(p){case"(":case"{":p==="{"&&this.curlyStack.push("{"),++this.index;break;case".":++this.index,this.source[this.index]==="."&&this.source[this.index+1]==="."&&(this.index+=2,p="...");break;case"}":++this.index,this.curlyStack.pop();break;case")":case";":case",":case"[":case"]":case":":case"?":case"~":++this.index;break;default:p=this.source.substr(this.index,4),p===">>>="?this.index+=4:(p=p.substr(0,3),p==="==="||p==="!=="||p===">>>"||p==="<<="||p===">>="||p==="**="?this.index+=3:(p=p.substr(0,2),p==="&&"||p==="||"||p==="=="||p==="!="||p==="+="||p==="-="||p==="*="||p==="/="||p==="++"||p==="--"||p==="<<"||p===">>"||p==="&="||p==="|="||p==="^="||p==="%="||p==="<="||p===">="||p==="=>"||p==="**"?this.index+=2:(p=this.source[this.index],"<>=!+-*%&|^/".indexOf(p)>=0&&++this.index)))}return this.index===h&&this.throwUnexpectedToken(),{type:7,value:p,lineNumber:this.lineNumber,lineStart:this.lineStart,start:h,end:this.index}},f.prototype.scanHexLiteral=function(h){for(var p="";!this.eof()&&a.Character.isHexDigit(this.source.charCodeAt(this.index));)p+=this.source[this.index++];return p.length===0&&this.throwUnexpectedToken(),a.Character.isIdentifierStart(this.source.charCodeAt(this.index))&&this.throwUnexpectedToken(),{type:6,value:parseInt("0x"+p,16),lineNumber:this.lineNumber,lineStart:this.lineStart,start:h,end:this.index}},f.prototype.scanBinaryLiteral=function(h){for(var p="",y;!this.eof()&&(y=this.source[this.index],!(y!=="0"&&y!=="1"));)p+=this.source[this.index++];return p.length===0&&this.throwUnexpectedToken(),this.eof()||(y=this.source.charCodeAt(this.index),(a.Character.isIdentifierStart(y)||a.Character.isDecimalDigit(y))&&this.throwUnexpectedToken()),{type:6,value:parseInt(p,2),lineNumber:this.lineNumber,lineStart:this.lineStart,start:h,end:this.index}},f.prototype.scanOctalLiteral=function(h,p){var y="",m=!1;for(a.Character.isOctalDigit(h.charCodeAt(0))?(m=!0,y="0"+this.source[this.index++]):++this.index;!this.eof()&&a.Character.isOctalDigit(this.source.charCodeAt(this.index));)y+=this.source[this.index++];return!m&&y.length===0&&this.throwUnexpectedToken(),(a.Character.isIdentifierStart(this.source.charCodeAt(this.index))||a.Character.isDecimalDigit(this.source.charCodeAt(this.index)))&&this.throwUnexpectedToken(),{type:6,value:parseInt(y,8),octal:m,lineNumber:this.lineNumber,lineStart:this.lineStart,start:p,end:this.index}},f.prototype.isImplicitOctalLiteral=function(){for(var h=this.index+1;h=48&&e<=55){var r=this.input.substr(this.pos-1,3).match(/^[0-7]+/)[0],i=parseInt(r,8);return i>255&&(r=r.slice(0,-1),i=parseInt(r,8)),this.pos+=r.length-1,e=this.input.charCodeAt(this.pos),(r!=="0"||e===56||e===57)&&(this.strict||t)&&this.invalidStringToken(this.pos-1-r.length,t?"Octal literal in template string":"Octal literal in strict mode"),String.fromCharCode(i)}return yy(e)?(this.options.locations&&(this.lineStart=this.pos,++this.curLine),""):String.fromCharCode(e)}};Gn.readHexChar=function(t){var e=this.pos,n=this.readInt(16,t);return n===null&&this.invalidStringToken(e,"Bad character escape sequence"),n};Gn.readWord1=function(){this.containsEsc=!1;for(var t="",e=!0,n=this.pos,r=this.options.ecmaVersion>=6;this.pos{if(!$E(r))return r;for(const i of tNe(r))v_(i,e);return ace(r,n),r};return n(t),e}function oce(t,e){return t.computed?!1:t.type==="MemberExpression"&&e==="property"||t.type==="Property"&&e==="key"}function lce(t,e){const n=nNe(t);let r=e;if(n.size>0){r=new Map(e);for(const i of n)r.delete(i)}return r.size===0?t:cce(t,r)}function cce(t,e){return $E(t)?t.type==="Identifier"&&e.has(t.name)?SL(e.get(t.name)):(ace(t,n=>cce(n,e)),t):t}function uce(t,e){return t&&typeof t=="object"&&(t.__hfProvenance=e),t}function E4(t){return t==null?void 0:t.__hfProvenance}function fce(t){return{type:"Literal",value:t,raw:String(t)}}function Tg(t,e){if($E(t)){e(t);for(const n of Object.keys(t)){if(vL.has(n))continue;const r=t[n];if(Array.isArray(r))for(const i of r)Tg(i,e);else Tg(r,e)}}}function rNe(t){var n,r;let e=(n=t.callee)==null?void 0:n.object;for(;(e==null?void 0:e.type)==="CallExpression";)e=(r=e.callee)==null?void 0:r.object;return(e==null?void 0:e.type)==="Identifier"?e.name:null}function hce(t,e){var n,r;return rNe(t)!==e?!1:((r=(n=t.callee)==null?void 0:n.property)==null?void 0:r.type)==="Identifier"&&KMe.has(t.callee.property.name)}function iNe(t,e){let n=!1;return Tg(t,r=>{r.type==="CallExpression"&&hce(r,e)&&(n=!0)}),n}function BE(t){return typeof t.start=="number"&&typeof t.end=="number"?[t.start,t.end]:void 0}const sNe=new Set(["ArrayExpression","BinaryExpression","ChainExpression","ConditionalExpression","Identifier","Literal","LogicalExpression","MemberExpression","ObjectExpression","Property","SpreadElement","TemplateElement","TemplateLiteral","UnaryExpression"]);function aNe(t,e){let n=!0;const r=(i,s,a)=>{if(!(!$E(i)||!n)){if(!sNe.has(i.type)){n=!1;return}if(i.type==="UnaryExpression"&&i.operator==="delete"){n=!1;return}if(i.type==="Identifier"){!(s&&a?oce(s,a):!1)&&i.name!=="undefined"&&!e.has(i.name)&&(n=!1);return}for(const o of Object.keys(i)){if(vL.has(o))continue;const l=i[o];if(Array.isArray(l))for(const c of l)r(c,i,o);else r(l,i,o)}}};return r(t),n}const UO=new WeakMap;function oNe(t,e){var n;return t.type==="Identifier"?{name:t.name}:t.type!=="AssignmentPattern"||((n=t.left)==null?void 0:n.type)!=="Identifier"||!aNe(t.right,e)?null:{name:t.left.name,defaultExpression:t.right}}function wL(t){if(UO.has(t))return UO.get(t)??null;const e=[],n=new Set;for(const r of t.params??[]){const i=oNe(r,n);if(!i)return UO.set(t,null),null;e.push(i),n.add(i.name)}return UO.set(t,e),e}function dce(t){var e;return AL(t)&&((e=t.body)==null?void 0:e.type)==="BlockStatement"&&wL(t)!==null}function lNe(t,e){let n=!1;return Tg(t,r=>{var i;r.type==="CallExpression"&&((i=r.callee)==null?void 0:i.type)==="Identifier"&&e.has(r.callee.name)&&(n=!0)}),n}function cNe(t){var n,r;if(((n=t.declarations)==null?void 0:n.length)!==1)return null;const e=t.declarations[0];return((r=e.id)==null?void 0:r.type)==="Identifier"&&dce(e.init)?[e.id.name,e.init]:null}function uNe(t){return t.type==="FunctionDeclaration"?t.id&&dce(t)?[t.id.name,t]:null:t.type==="VariableDeclaration"?cNe(t):null}function fNe(t){const e=new Map;for(const n of t.body??[]){const r=uNe(n);r&&e.set(r[0],r[1])}return e}function hNe(t,e){const n=new Set;for(const[r,i]of t)iNe(i.body,e)&&n.add(r);for(let r=!0;r;){r=!1;for(const[i,s]of t)!n.has(i)&&lNe(s.body,n)&&(n.add(i),r=!0)}return n}function gX(t,e){t.set(e,(t.get(e)??0)+1)}function dNe(){return{type:"Identifier",name:"undefined"}}function pNe(t){var e;return(t==null?void 0:t.type)==="Identifier"&&t.name==="undefined"||(t==null?void 0:t.type)==="UnaryExpression"&&t.operator==="void"&&((e=t.argument)==null?void 0:e.type)==="Literal"&&t.argument.value===0}function pce(t,e){var r,i;if((r=t.arguments)!=null&&r.some(s=>(s==null?void 0:s.type)==="SpreadElement"))return null;const n=new Map;for(let s=0;s{o.type==="Identifier"&&n.has(o.name)&&gX(r,o.name);const l=mNe(o,n);if(!l)return;gX(i,l.callee.name);const c=e.get(l.callee.name),u=c&&wL(c);(!u||!pce(l,u))&&s.add(l.callee.name)});const a=new Map;for(const[o,l]of e)!s.has(o)&&(r.get(o)??0)===1+(i.get(o)??0)&&a.set(o,l);return a}function yNe(t,e){const n=fNe(t);if(n.size===0)return n;const r=hNe(n,e);for(const i of[...n.keys()])r.has(i)||n.delete(i);return n.size===0?n:gNe(t,n)}function xNe(t,e){var n,r;if(t.type==="FunctionDeclaration")return!!t.id&&e.get(t.id.name)===t;if(t.type==="VariableDeclaration"&&((n=t.declarations)==null?void 0:n.length)===1){const i=t.declarations[0];return((r=i.id)==null?void 0:r.type)==="Identifier"&&e.get(i.id.name)===i.init}return!1}function OL(t){return(t==null?void 0:t.type)==="BlockStatement"?t.body??[]:t?[{type:"ExpressionStatement",expression:t}]:[]}function bNe(t,e,n){for(const r of t)Tg(r,i=>{i.type==="CallExpression"&&hce(i,n.timelineVar)&&(uce(i,{...e}),i.__hfOrder=n.order.n++)})}function CL(t,e,n,r){const i=lce(SL({type:"BlockStatement",body:t}),e);return uce(i,n),bNe(i.body,n,r),i.body=gce(i.body,{...r,depth:r.depth+1}),[i]}function vNe(t,e){const n=e.helpers.get(t.callee.name);if(!n)return null;const r=wL(n);if(!r)return null;const i=pce(t,r);if(!i)return null;const s={kind:"helper",fn:t.callee.name,callSite:++e.site.n,sourceRange:BE(t)};return CL(n.body.body,i,s,e)}function ANe(t,e){var n;if(t.operator==="+=")return ev(e(t.right));if(t.operator==="-="){const r=ev(e(t.right));return r===void 0?void 0:-r}if(t.operator==="="&&((n=t.right)==null?void 0:n.type)==="BinaryExpression")return ev(e(t.right.right))}function SNe(t){var e,n;return(t==null?void 0:t.type)==="UpdateExpression"?((e=t.argument)==null?void 0:e.name)??null:(t==null?void 0:t.type)==="AssignmentExpression"?((n=t.left)==null?void 0:n.name)??null:null}function wNe(t,e,n){if(SNe(t)===e)return t.type==="UpdateExpression"?t.operator==="++"?1:-1:ANe(t,n)}function ev(t){return typeof t=="number"&&Number.isFinite(t)?t:void 0}function ONe(t,e,n){return t==="<"?e"?e>n:t===">="?e>=n:!1}function CNe(t){var n,r;if((t==null?void 0:t.type)!=="VariableDeclaration"||((n=t.declarations)==null?void 0:n.length)!==1)return null;const e=t.declarations[0];return((r=e.id)==null?void 0:r.type)==="Identifier"?{name:e.id.name,initExpr:e.init}:null}function kNe(t,e){var o;const n=CNe(t.init),r=t.test;if(!n||(r==null?void 0:r.type)!=="BinaryExpression"||((o=r.left)==null?void 0:o.name)!==n.name)return null;const i=ev(e(n.initExpr)),s=ev(e(r.right)),a=wNe(t.update,n.name,e);return i===void 0||s===void 0||!a?null:{v:n.name,start:i,end:s,op:r.operator,step:a}}function ENe(t,e){const n=kNe(t,e.resolve);if(!n)return null;const r=OL(t.body),i=[],s=++e.site.n;let a=0;for(let o=n.start;ONe(n.op,o,n.end);o+=n.step){if(a>=eNe)return null;const l={kind:"loop",callSite:s,iteration:a,sourceRange:BE(t)};i.push(...CL(r,new Map([[n.v,fce(o)]]),l,e)),a++}return i}function TNe(t){var e,n;if((t==null?void 0:t.type)==="VariableDeclaration"){const r=(n=(e=t.declarations)==null?void 0:e[0])==null?void 0:n.id;return(r==null?void 0:r.type)==="Identifier"?r.name:null}return(t==null?void 0:t.type)==="Identifier"?t.name:null}function mce(t,e,n,r,i,s){const a=[],o=++s.site.n;return t.forEach((l,c)=>{if(!l)return;const u=new Map;n&&u.set(n,l),r&&u.set(r,fce(c));const f={kind:"loop",callSite:o,iteration:c,sourceRange:i};a.push(...CL(e,u,f,s))}),a}function PNe(t,e){var r;if(((r=t.right)==null?void 0:r.type)!=="ArrayExpression")return null;const n=TNe(t.left);return n?mce(t.right.elements??[],OL(t.body),n,null,BE(t),e):null}function MNe(t){var n,r;const e=[];for(const i of[(n=t.params)==null?void 0:n[0],(r=t.params)==null?void 0:r[1]])if(!i)e.push(null);else{if(i.type!=="Identifier")return null;e.push(i.name)}return{el:e[0],idx:e[1]}}function NNe(t){var e,n;return(t==null?void 0:t.type)==="MemberExpression"&&((e=t.property)==null?void 0:e.name)==="forEach"&&((n=t.object)==null?void 0:n.type)==="ArrayExpression"}function DNe(t){var n;if(!NNe(t.callee))return null;const e=(n=t.arguments)==null?void 0:n[0];return AL(e)?{elements:t.callee.object.elements??[],cb:e}:null}function INe(t,e){const n=DNe(t);if(!n)return null;const r=MNe(n.cb);return r?mce(n.elements,OL(n.cb.body),r.el,r.idx,BE(t),e):null}function _Ne(t,e){var n;return((n=t.callee)==null?void 0:n.type)==="Identifier"&&e.helpers.has(t.callee.name)?vNe(t,e):INe(t,e)}function RNe(t,e){var n;return e.depth>=JMe?null:t.type==="ForStatement"?ENe(t,e):t.type==="ForOfStatement"?PNe(t,e):t.type==="ExpressionStatement"&&((n=t.expression)==null?void 0:n.type)==="CallExpression"?_Ne(t.expression,e):null}function gce(t,e){const n=[];for(const r of t){const i=RNe(r,e);i?n.push(...i):n.push(r)}return n}function jNe(t,e,n){const r=yNe(t,e),i={helpers:r,timelineVar:e,resolve:n,depth:0,site:{n:0},order:{n:0}},s=(t.body??[]).filter(a=>!xNe(a,r));t.body=gce(s,i)}const LNe=new Set(["set","to","from","fromTo"]),FNe=new Set(["querySelector","querySelectorAll"]),$Ne=new Set(["forEach","map"]),yce=new Set(["Program","BlockStatement","FunctionDeclaration","FunctionExpression","ArrowFunctionExpression"]);function BNe(t){try{return rA(t,{ecmaVersion:"latest",sourceType:"script",locations:!0})}catch{return rA(t,{ecmaVersion:"latest",sourceType:"module",locations:!0})}}const xce=Symbol("hf.constNodes");function VNe(t){return t[xce]}const HNe=new Set(["min","max","round","floor","ceil","abs","sqrt","sign","trunc"]),QNe={PI:Math.PI,E:Math.E,SQRT2:Math.SQRT2};function zNe(t,e){var i,s,a,o,l;if(((i=t.object)==null?void 0:i.type)==="Identifier"&&t.object.name==="Math"){const c=(s=t.property)==null?void 0:s.name;return typeof c=="string"?QNe[c]:void 0}const n=kL(t.object,e);if(!n)return;let r;if(t.computed){const c=ls(t.property,e);n.type==="ArrayExpression"&&typeof c=="number"?r=(a=n.elements)==null?void 0:a[c]:n.type==="ObjectExpression"&&(typeof c=="string"||typeof c=="number")&&(r=Dd(n,String(c)))}else n.type==="ObjectExpression"&&(r=Dd(n,((o=t.property)==null?void 0:o.name)??((l=t.property)==null?void 0:l.value)));return r?ls(r,e):void 0}function ZNe(t,e,n){var i,s,a;if(!e.computed)return t.type==="ObjectExpression"?Dd(t,((i=e.property)==null?void 0:i.name)??((s=e.property)==null?void 0:s.value)):void 0;const r=ls(e.property,n);if(t.type==="ArrayExpression"&&typeof r=="number")return(a=t.elements)==null?void 0:a[r];if(t.type==="ObjectExpression")return Dd(t,String(r))}function kL(t,e){var r;if(!t)return;if(t.type==="ArrayExpression"||t.type==="ObjectExpression")return t;if(t.type==="Identifier")return(r=VNe(e))==null?void 0:r.get(t.name);if(t.type!=="MemberExpression")return;const n=kL(t.object,e);return n?ZNe(n,t,e):void 0}function ls(t,e){var n,r,i,s,a,o,l;if(t){if(t.type==="NumericLiteral"||t.type==="Literal"&&typeof t.value=="number"||t.type==="StringLiteral"||t.type==="Literal"&&typeof t.value=="string"||t.type==="BooleanLiteral"||t.type==="Literal"&&typeof t.value=="boolean")return t.value;if(t.type==="UnaryExpression"&&t.operator==="-"&&t.argument){const c=ls(t.argument,e);return typeof c=="number"?-c:void 0}if(t.type==="BinaryExpression"){const c=ls(t.left,e),u=ls(t.right,e);if(typeof c=="number"&&typeof u=="number")switch(t.operator){case"+":return c+u;case"-":return c-u;case"*":return c*u;case"/":return u!==0?c/u:void 0}if(typeof c=="string"&&t.operator==="+")return c+String(u??"");if(typeof u=="string"&&t.operator==="+")return String(c??"")+u}if(t.type==="Identifier"&&e.has(t.name))return e.get(t.name);if(t.type==="TemplateLiteral"&&((n=t.expressions)==null?void 0:n.length)===0)return((s=(i=(r=t.quasis)==null?void 0:r[0])==null?void 0:i.value)==null?void 0:s.cooked)??void 0;if(t.type==="MemberExpression")return zNe(t,e);if(t.type==="CallExpression"&&((a=t.callee)==null?void 0:a.type)==="MemberExpression"&&((o=t.callee.object)==null?void 0:o.type)==="Identifier"&&t.callee.object.name==="Math"&&HNe.has((l=t.callee.property)==null?void 0:l.name)){const c=(t.arguments??[]).map(u=>ls(u,e));if(c.every(u=>typeof u=="number"))return Math[t.callee.property.name](...c)}}}function GNe(t,e){return ls(t,e)}function V6(t,e){var s,a;if((t==null?void 0:t.type)!=="CallExpression")return null;const n=t.callee;if((n==null?void 0:n.type)!=="MemberExpression"||((s=n.property)==null?void 0:s.type)!=="Identifier")return null;const r=n.property.name,i=ls((a=t.arguments)==null?void 0:a[0],e);return typeof i!="string"||i.length===0?null:FNe.has(r)||r==="toArray"?i:r==="getElementById"?`#${i}`:null}function T4(t,e=!0){for(let n=t.length-2;n>=0;n--){const r=t[n];if(r&&yce.has(r.type)&&(e||r.type!=="BlockStatement"))return r}return null}function bce(t){const e=[];for(let n=t.length-1;n>=0;n--){const r=t[n];r&&yce.has(r.type)&&e.push(r)}return e}function EL(t){for(let e=t.length-2;e>=0;e--){const n=t[e];if((n==null?void 0:n.type)==="BlockStatement"&&E4(n))return n}}function TL(t,e,n,r=Number.POSITIVE_INFINITY){const i=n.declarationsByName.get(t)??[],s=EL(e);for(const a of bce(e)){const o=i.filter(l=>l.scopeNode===a&&(!l.expandedScopeNode||l.expandedScopeNode===s)&&(l.kind==="var"||l.kind==="param"||l.node.startc.node.start-l.node.start);if(o[0])return o[0]}}function vce(t){const e=new Map,n=new Set;Ef(t,{VariableDeclarator(s,a,o){var m;const l=(m=s.id)==null?void 0:m.name;if(!l)return;const c=o.at(-2),u=c==null?void 0:c.kind;if(!u)return;const f=(c==null?void 0:c.type)!=="VariableDeclaration"||u!=="var",h=T4(o,f),p=EL(o),y=e.get(l)??[];y.push({node:s,scopeNode:h,expandedScopeNode:p,name:l,kind:u}),e.set(l,y)},FunctionDeclaration:i,FunctionExpression:i,ArrowFunctionExpression:i});const r={declarationsByName:e,reassignedDeclarations:n};return Ef(t,{AssignmentExpression(s,a,o){var u;const l=((u=s.left)==null?void 0:u.type)==="Identifier"?s.left.name:void 0;if(!l)return;const c=TL(l,o,r,s.start);c&&n.add(c.node)}}),r;function i(s){for(const a of s.params??[]){if((a==null?void 0:a.type)!=="Identifier")continue;const o=e.get(a.name)??[];o.push({node:a,scopeNode:s,name:a.name,kind:"param"}),e.set(a.name,o)}}}function XO(t,e,n,r){let i=t.get(e);i||(i=new Map,t.set(e,i)),i.has(n)||i.set(n,r)}function H6(t,e,n){var r,i;for(const s of bce(e)){const a=(r=n.get(s))==null?void 0:r.get(t);if(a!==void 0)return a}return((i=n.get(null))==null?void 0:i.get(t))??null}function UNe(t){return(t==null?void 0:t.type)==="ArrowFunctionExpression"||(t==null?void 0:t.type)==="FunctionExpression"||(t==null?void 0:t.type)==="FunctionDeclaration"}function XNe(t,e,n,r){return(t==null?void 0:t.type)==="Identifier"?H6(t.name,e,r):(t==null?void 0:t.type)==="CallExpression"?V6(t,n):null}function PL(t){const e=new Map,n=new Set,r=new Map;return Object.defineProperty(e,xce,{value:r,enumerable:!1}),G0(t,{VariableDeclarator(i){var c;const s=(c=i.id)==null?void 0:c.name,a=i.init;if(!s||!a)return;if(a.type==="ArrayExpression"||a.type==="ObjectExpression"){r.set(s,a);return}const o=ls(a,e);if(o===void 0||n.has(s))return;const l=e.get(s);l!==void 0&&l!==o?(e.delete(s),n.add(s)):l===void 0&&e.set(s,o)}}),e}function Ace(t,e,n){const r=new Map;Ef(t,{VariableDeclarator(s,a,o){var u;const l=(u=s.id)==null?void 0:u.name,c=V6(s.init,e);if(l&&c!==null){const f=o.at(-2),h=(f==null?void 0:f.type)!=="VariableDeclaration"||f.kind!=="var";XO(r,T4(o,h),l,c)}},AssignmentExpression(s,a,o){const l=s.left,c=V6(s.right,e);if((l==null?void 0:l.type)==="Identifier"&&c!==null){const u=TL(l.name,o,n,s.start);XO(r,(u==null?void 0:u.scopeNode)??EL(o)??T4(o),l.name,c)}}}),Ef(t,{CallExpression(s,a,o){var c,u,f;const l=s.callee;if((l==null?void 0:l.type)==="MemberExpression"&&((c=l.property)==null?void 0:c.type)==="Identifier"&&$Ne.has(l.property.name)){const h=XNe(l.object,o,e,r),p=(u=s.arguments)==null?void 0:u[0],y=(f=p==null?void 0:p.params)==null?void 0:f[0];h&&(y==null?void 0:y.type)==="Identifier"&&UNe(p)&&XO(r,p,y.name,h)}}});const i=new Set(["slice","filter","concat","reverse"]);return Ef(t,{VariableDeclarator(s,a,o){var h,p,y,m,v;const l=(h=s.id)==null?void 0:h.name,c=s.init;if(!l||!c)return;let u;if(c.type==="MemberExpression"&&((p=c.object)==null?void 0:p.type)==="Identifier"?u=c.object.name:c.type==="CallExpression"&&((y=c.callee)==null?void 0:y.type)==="MemberExpression"&&((m=c.callee.object)==null?void 0:m.type)==="Identifier"&&((v=c.callee.property)==null?void 0:v.type)==="Identifier"&&i.has(c.callee.property.name)&&(u=c.callee.object.name),!u)return;const f=H6(u,o,r);f&&XO(r,T4(o),l,f)}}),r}function ML(t,e,n,r){var i;if(!t)return null;if(t.type==="StringLiteral"||t.type==="Literal")return typeof t.value=="string"?t.value:null;if(t.type==="Identifier")return H6(t.name,e,r);if(t.type==="CallExpression")return V6(t,n);if(t.type==="ArrayExpression"){const s=t.elements.map(a=>ML(a,e,n,r)).filter(a=>typeof a=="string"&&a.length>0);return s.length>0?s.join(", "):null}return t.type==="MemberExpression"&&((i=t.object)==null?void 0:i.type)==="Identifier"?H6(t.object.name,e,r):null}function WNe(t,e,n){const r=(t==null?void 0:t.type)==="ObjectExpression"?t:(t==null?void 0:t.type)==="Identifier"?kL(t,n):void 0;if((r==null?void 0:r.type)!=="ObjectExpression")return null;const i=Dd(e,"onUpdate"),s=i?YNe(i):void 0;return s?`proxy → ${s}`:"dwell/hold"}function qNe(t){var e,n,r;return(t==null?void 0:t.type)==="MemberExpression"&&((e=t.object)==null?void 0:e.type)==="MemberExpression"&&((n=t.object.property)==null?void 0:n.name)==="style"&&!!((r=t.property)!=null&&r.name)}function YNe(t){let e;return G0(t,{CallExpression(n){var r,i,s,a;((r=n.callee)==null?void 0:r.type)==="MemberExpression"&&((i=n.callee.property)==null?void 0:i.name)==="setAttribute"&&typeof((a=(s=n.arguments)==null?void 0:s[0])==null?void 0:a.value)=="string"&&(e??(e=n.arguments[0].value))},AssignmentExpression(n){const r=n.left;qNe(r)&&(e??(e=`style.${r.property.name}`))}}),e}function iA(t){return(t==null?void 0:t.type)==="ObjectProperty"||(t==null?void 0:t.type)==="Property"}function Q6(t){var e,n;return((e=t==null?void 0:t.key)==null?void 0:e.name)??((n=t==null?void 0:t.key)==null?void 0:n.value)}function Dd(t,e){if((t==null?void 0:t.type)==="ObjectExpression"){for(const n of t.properties??[])if(iA(n)&&Q6(n)===e)return n.value}}function KNe(t,e,n){const r=Dd(t,e);return r?n.slice(r.start,r.end):void 0}function A0(t,e,n){var i,s;const r={};if((t==null?void 0:t.type)!=="ObjectExpression")return r;for(const a of t.properties??[]){if(!iA(a))continue;const o=((i=a.key)==null?void 0:i.name)??((s=a.key)==null?void 0:s.value);if(!o)continue;const l=ls(a.value,e);l!==void 0?r[o]=l:r[o]=`__raw:${n.slice(a.value.start,a.value.end)}`}return r}function yX(t){var e,n,r;return(t==null?void 0:t.type)==="CallExpression"&&((e=t.callee)==null?void 0:e.type)==="MemberExpression"&&((n=t.callee.object)==null?void 0:n.name)==="gsap"&&((r=t.callee.property)==null?void 0:r.name)==="timeline"}function P4(t){var e;if(!t||t.type!=="MemberExpression")return null;if(t.computed){const n=t.property;return(n==null?void 0:n.type)==="Literal"&&typeof n.value=="string"?n.value:null}return((e=t.property)==null?void 0:e.type)==="Identifier"?t.property.name:null}function JNe(t){return(t==null?void 0:t.type)==="MemberExpression"&&P4(t)!==null}function VE(t,e){if((t==null?void 0:t.type)!=="MemberExpression"||(e==null?void 0:e.type)!=="MemberExpression"||P4(t)!==P4(e)||P4(t)===null)return!1;const n=t.object,r=e.object;return(n==null?void 0:n.type)==="Identifier"&&(r==null?void 0:r.type)==="Identifier"?n.name===r.name:(n==null?void 0:n.type)==="MemberExpression"&&(r==null?void 0:r.type)==="MemberExpression"?VE(n,r):!1}function Sce(t,e){return t.kind==="identifier"?t.name:e.slice(t.node.start,t.node.end)}function eDe(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function mM(t,e){var s,a;const n=(s=t.arguments)==null?void 0:s[0];if(!n||n.type!=="ObjectExpression")return;const r=(a=n.properties)==null?void 0:a.find(o=>iA(o)&&Q6(o)==="defaults");if(!(r!=null&&r.value)||r.value.type!=="ObjectExpression")return;const i={};for(const o of r.value.properties??[]){if(!iA(o))continue;const l=Q6(o),c=ls(o.value,e);l==="ease"&&typeof c=="string"&&(i.ease=c),l==="duration"&&typeof c=="number"&&(i.duration=c)}return Object.keys(i).length>0?i:void 0}function NL(t,e){let n=null,r=null,i=0,s;const a=e??new Map;return G0(t,{VariableDeclarator(o){var l;yX(o.init)&&(i+=1,!r&&((l=o.id)==null?void 0:l.type)==="Identifier"&&(n=o.id.name,r={kind:"identifier",name:o.id.name},s=mM(o.init,a)))},AssignmentExpression(o){if(yX(o.right)&&(i+=1,!r)){const l=o.left;(l==null?void 0:l.type)==="Identifier"?(n=l.name,r={kind:"identifier",name:l.name},s=mM(o.right,a)):JNe(l)&&(r={kind:"member",node:l},s=mM(o.right,a))}}}),{timelineVar:n,ref:r,timelineCount:i,defaults:s}}const tDe=new Set(["duration","ease","delay"]),nDe=new Set(["onComplete","onStart","onUpdate","onRepeat"]),rDe=new Set(["stagger","yoyo","repeat","repeatDelay","snap","overwrite","immediateRender"]);function iDe(t,e){var r,i;let n=(r=t.callee)==null?void 0:r.object;for(;(n==null?void 0:n.type)==="CallExpression";)n=(i=n.callee)==null?void 0:i.object;return e.kind==="identifier"?(n==null?void 0:n.type)==="Identifier"&&n.name===e.name:VE(n,e.node)}function wce(t,e,n,r){const i=[];function s(a,o){var c,u,f,h;if(!a||typeof a!="object")return;const l=[...o,a];if(a.type==="CallExpression"){const p=a.callee,y=(c=a.arguments)==null?void 0:c[0],m=(p==null?void 0:p.type)==="MemberExpression"&&((u=p.object)==null?void 0:u.type)==="Identifier"&&p.object.name==="gsap"&&((f=p.property)==null?void 0:f.type)==="Identifier"&&p.property.name==="set"&&((y==null?void 0:y.type)==="StringLiteral"||(y==null?void 0:y.type)==="Literal"&&typeof y.value=="string");if((p==null?void 0:p.type)==="MemberExpression"&&((h=p.property)==null?void 0:h.type)==="Identifier"&&(iDe(a,e)||m)&&LNe.has(p.property.name)){const v=p.property.name,b=a.arguments,w=b.length>=1?ML(b[0],l,n,r)??"__unresolved__":"__unresolved__";v==="fromTo"&&b.length>=3?i.push({node:a,ancestors:l,method:"fromTo",selector:w,fromArg:b[1],varsArg:b[2],positionArg:b[3]}):v!=="fromTo"&&b.length>=2&&i.push({node:a,ancestors:l,method:v,selector:w,varsArg:b[1],positionArg:b[2],...m?{global:!0}:{}})}}for(const p of Object.keys(a)){if(p==="type"||p==="start"||p==="end"||p==="loc")continue;const y=a[p];if(Array.isArray(y))for(const m of y)m&&typeof m=="object"&&m.type&&s(m,l);else y&&typeof y=="object"&&y.type&&s(y,l)}}return s(t,[]),i}const Oce=/^(\d+(?:\.\d+)?)%$/;function z6(t,e){const n=ls(t,e);return typeof n=="string"?n:void 0}function sDe(t,e,n){var a,o;const r=[];let i,s;for(const l of t.properties??[]){if(l.type!=="ObjectProperty"&&l.type!=="Property")continue;const c=((a=l.key)==null?void 0:a.value)??((o=l.key)==null?void 0:o.name);if(typeof c!="string")continue;const u=Oce.exec(c);if(u){const f=Number.parseFloat(u[1]??"0"),h=A0(l.value,e,n),p={};let y;for(const[m,v]of Object.entries(h))if(m==="ease"&&typeof v=="string")y=v;else{if(m==="duration")continue;(typeof v=="number"||typeof v=="string")&&(p[m]=v)}r.push({percentage:f,properties:p,...y?{ease:y}:{}})}else c==="ease"?i=z6(l.value,e)??i:c==="easeEach"&&(s=z6(l.value,e)??s)}return r.sort((l,c)=>l.percentage-c.percentage),{format:"percentage",keyframes:r,...i?{ease:i}:{},...s?{easeEach:s}:{}}}function aDe(t,e,n){var s,a;const r=(s=(t.properties??[]).find(o=>{var l,c;return(((l=o.key)==null?void 0:l.name)??((c=o.key)==null?void 0:c.value))==="keyframes"}))==null?void 0:s.value;if(!r||r.type!=="ArrayExpression")return;const i=[];for(const o of r.elements??[]){if(!o||o.type!=="ObjectExpression")continue;const l=A0(o,e,n);i.push(l.duration)}return(a=DE(i))==null?void 0:a.totalDuration}function oDe(t,e,n){const r=t.elements??[],i=[];for(const o of r){if(!o||o.type!=="ObjectExpression")continue;const l=A0(o,e,n),c={};let u,f;for(const[h,p]of Object.entries(l))h==="duration"?u=p:h==="ease"&&typeof p=="string"?f=p:(typeof p=="number"||typeof p=="string")&&(c[h]=p);i.push({properties:c,duration:u,ease:f})}const s=DE(i.map(o=>o.duration));return s?{format:"object-array",keyframes:i.map((o,l)=>({percentage:s.percentages[l],properties:o.properties,...o.ease?{ease:o.ease}:{}}))}:void 0}function lDe(t,e){var o,l,c;const n=new Map;let r,i;for(const u of t.properties??[]){if(u.type!=="ObjectProperty"&&u.type!=="Property")continue;const f=((o=u.key)==null?void 0:o.name)??((l=u.key)==null?void 0:l.value);if(typeof f=="string")if(((c=u.value)==null?void 0:c.type)==="ArrayExpression"){const h=[];for(const p of u.value.elements??[]){const y=ls(p,e);(typeof y=="number"||typeof y=="string")&&h.push(y)}h.length>0&&n.set(f,h)}else f==="ease"?r=z6(u.value,e)??r:f==="easeEach"&&(i=z6(u.value,e)??i)}const s=Math.max(...[...n.values()].map(u=>u.length),0),a=[];for(let u=0;u1?Math.round(u/(s-1)*100):0,h={};for(const[p,y]of n)u({percentage:N.length>1?Math.round(j/(N.length-1)*100):0,properties:{x:I.x,y:I.y}}))};else{const _=l.keyframes;if(_.length===N.length)for(let I=0;I<_.length;I++){const j=_[I],L=N[I];j&&L&&(j.properties.x=L.x,j.properties.y=L.y)}}}let f;if(t.method==="fromTo"&&t.fromArg){f={};const N=A0(t.fromArg,e,n);for(const[_,I]of Object.entries(N))(typeof I=="number"||typeof I=="string")&&(f[_]=I)}const h=!!t.positionArg,p=h?GNe(t.positionArg,e):0,y=typeof p=="number"||typeof p=="string"?p:h?`__raw:${n.slice(t.positionArg.start,t.positionArg.end)}`:0;let m=typeof s.duration=="number"?s.duration:void 0;const v=typeof s.ease=="string"?s.ease:void 0;m===void 0&&l&&(m=aDe(t.varsArg,e,n));let b=t.selector,w;if(b==="__unresolved__"){const N=(E=t.node.arguments)==null?void 0:E[0],_=WNe(N,t.varsArg,e);if(_&&(b=_,(N==null?void 0:N.type)==="Identifier")){const I=TL(N.name,t.ancestors,r,t.node.start);if(((T=I==null?void 0:I.node.init)==null?void 0:T.type)==="ObjectExpression"&&!r.reassignedDeclarations.has(I.node)){const j=E4(I.scopeNode)??E4(I.expandedScopeNode),L=j&&(j.kind==="helper"||j.kind==="loop")?`:${j.kind}:${j.callSite??""}:${j.iteration??""}`:"";w=`proxy:${N.name}@${I.node.start}${L}`}}}const O={targetSelector:b,method:t.method,position:y,properties:a,fromProperties:f,duration:m,ease:v};w&&(O.targetIdentity=w),h||(O.implicitPosition=!0);let k=aU(a);if(!k&&l){const N={};for(const _ of l.keyframes)for(const I of Object.keys(_.properties))N[I]=!0;k=aU(N)}return k&&(O.propertyGroup=k),t.global&&(O.global=!0),Object.keys(o).length>0&&(O.extras=o),l&&(O.keyframes=l),u&&(O.arcPath=u.arcPath),c&&(O.hasUnresolvedKeyframes=!0),b==="__unresolved__"&&(O.hasUnresolvedSelector=!0),i&&(O.provenance=i),O}function fDe(t){if(typeof t=="number")return t;if(typeof t!="string")return;const e=t.startsWith("__raw:")?t.slice(6):t,n=/(?:each\s*:\s*)?(-?\d+(?:\.\d+)?)/.exec(e);if(!n)return;const r=Number.parseFloat(n[1]);return Number.isFinite(r)?r:void 0}function xX(t){return t==="opacity"||t.startsWith("scale")?1:0}function hDe(t,e){const n={...t.properties};let r,i;if(t.method==="fromTo")r={...t.fromProperties??{}},i=n;else if(t.method==="from"){r=n,i={};for(const s of Object.keys(n))i[s]=xX(s)}else{r={...t.fromProperties??{}};for(const s of Object.keys(n))r[s]===void 0&&(r[s]=xX(s));i=n}return[{percentage:0,properties:{...r,stagger:e}},{percentage:100,properties:{...i,stagger:e}}]}function dDe(t){var e;for(const n of t){if(n.keyframes||n.arcPath)continue;const r=fDe((e=n.extras)==null?void 0:e.stagger);r!==void 0&&(n.keyframes={format:"percentage",keyframes:hDe(n,r)})}}const pDe=.5;function mDe(t,e,n){const r=t.trim();if(r==="")return e;if(r.startsWith("+=")){const s=Number.parseFloat(r.slice(2));return Number.isFinite(s)?e+s:null}if(r.startsWith("-=")){const s=Number.parseFloat(r.slice(2));return Number.isFinite(s)?e-s:null}if(r==="<")return n;if(r===">")return e;if(r.startsWith("<")){const s=Number.parseFloat(r.slice(1));return Number.isFinite(s)?n+s:null}if(r.startsWith(">")){const s=Number.parseFloat(r.slice(1));return Number.isFinite(s)?e+s:null}const i=Number.parseFloat(r);return Number.isFinite(i)?i:null}function gDe(t,e,n,r){const i=new Map;return Ef(t,{CallExpression(s,a,o){var h,p,y,m;const l=s.callee;if((l==null?void 0:l.type)!=="MemberExpression"||((h=l.object)==null?void 0:h.name)!=="gsap"||((p=l.property)==null?void 0:p.name)!=="set")return;const c=ML((y=s.arguments)==null?void 0:y[0],o,e,n);if(!c)return;const u=A0((m=s.arguments)==null?void 0:m[1],e,r),f=i.get(c)??{};for(const[v,b]of Object.entries(u))(typeof b=="number"||typeof b=="string")&&(f[v]=b);i.set(c,f)}}),i}function bX(t,e){for(const[n,r]of Object.entries(e))t[n]=r;return t}function yDe(t,e){const n={...t.fromProperties??{}};let r=!1;for(const i of Object.keys(t.properties))n[i]===void 0&&e[i]!==void 0&&(n[i]=e[i],r=!0);r&&(t.fromProperties=n)}function xDe(t,e){const n=new Map;for(const[r,i]of e)n.set(r,{...i});for(const r of t){const i=r.targetSelector;if(r.method==="set"){n.set(i,bX(n.get(i)??{},r.properties));continue}const s=n.get(i);r.method==="to"&&s&&yDe(r,s),n.set(i,bX(n.get(i)??{},r.properties))}}function kce(t,e){if(e)for(const n of t)n.method!=="set"&&(n.duration===void 0&&e.duration!==void 0&&(n.duration=e.duration),n.ease===void 0&&e.ease!==void 0&&(n.ease=e.ease))}function Ece(t,e,n){const r=/^([A-Za-z_$][\w$]*)\s*(?:([+-])=\s*([\d.]+))?$/.exec(t.trim());if(!r)return null;const i=r[1];let s=e.get(i);if(s===void 0&&(s=n,e.set(i,s)),r[2]&&r[3]){const a=Number.parseFloat(r[3]);if(Number.isFinite(a))return r[2]==="+"?s+a:s-a}return s}function bDe(t,e,n,r){return t.implicitPosition?e:typeof t.position=="number"?t.position:typeof t.position=="string"?Ece(t.position,r,e)??mDe(t.position,e,n):e}function Tce(t,e=[]){let n=0,r=0;const i=new Map;let s=0;const a=[...e].sort((l,c)=>l.order-c.order),o=l=>{let c;typeof l.position=="number"?c=l.position:typeof l.position=="string"?c=Ece(l.position,i,n)??n:c=n,i.set(l.name,Math.max(0,c))};for(t.forEach((l,c)=>{for(;s{var o,l,c;return(c=(l=(o=a.node.callee)==null?void 0:o.property)==null?void 0:l.loc)==null?void 0:c.start}),s=[];return G0(t,{CallExpression(a){var m,v,b,w,O,k;const o=a.callee,l=e.kind==="identifier"?((m=o.object)==null?void 0:m.type)==="Identifier"&&o.object.name===e.name:VE(o.object,e.node);if((o==null?void 0:o.type)!=="MemberExpression"||!l||((v=o.property)==null?void 0:v.name)!=="addLabel")return;const c=(b=a.arguments)==null?void 0:b[0],u=typeof(c==null?void 0:c.value)=="string"?c.value:void 0;if(!u)return;const f=ls((w=a.arguments)==null?void 0:w[1],n),h=typeof f=="number"||typeof f=="string"?f:void 0,p=(k=(O=o.property)==null?void 0:O.loc)==null?void 0:k.start;let y=r.length;p&&(y=i.findIndex(E=>E&&(E.line>p.line||E.line===p.line&&E.column>p.column)),y===-1&&(y=r.length)),s.push({name:u,position:h,order:y})}}),s}function ADe(t,e){var i,s,a,o,l,c;const n=(a=(s=(i=t.node.callee)==null?void 0:i.property)==null?void 0:s.loc)==null?void 0:a.start,r=(c=(l=(o=e.node.callee)==null?void 0:o.property)==null?void 0:l.loc)==null?void 0:c.start;return!n||!r?0:n.line-r.line||n.column-r.column}function SDe(t,e){const n=t.node.__hfOrder,r=e.node.__hfOrder;return n===void 0&&r===void 0?ADe(t,e):n===void 0?-1:r===void 0?1:n-r}function Pce(t){t.sort(SDe)}function Mce(t){const e=new Map;return t.map(n=>{const r=typeof n.position=="number"?String(Math.round(n.position*1e3)):String(n.position),i=n.propertyGroup?`-${n.propertyGroup}`:"",s=`${n.targetSelector}-${n.method}-${r}${i}`,a=(e.get(s)??0)+1;e.set(s,a);const o=a===1?s:`${s}-${a}`;return{...n,id:o}})}function or(t){try{const e=rA(t,{ecmaVersion:"latest",sourceType:"script",locations:!0}),n=PL(e),r=vce(e),i=Ace(e,n,r),s=NL(e,n),a=s.ref??{kind:"identifier",name:"tl"},o=Sce(a,t),l=wce(e,a,n,i);Pce(l);const c=l.map(h=>Cce(h,n,t,r));kce(c,s.defaults),Tce(c);const u=Mce(c),f=l.map((h,p)=>({id:u[p].id,call:h,animation:u[p]}));return{ast:e,timelineVar:o,hasTimeline:s.ref!==null,located:f}}catch{return null}}function wDe(t){try{const e=BNe(t),n=PL(e),r=NL(e,n),i=r.ref??{kind:"identifier",name:"tl"},s=Sce(i,t);if(i.kind==="identifier")try{jNe(e,s,O=>ls(O,n))}catch{}const a=vce(e),o=Ace(e,n,a),l=wce(e,i,n,o);Pce(l);const c=l.map(O=>Cce(O,n,t,a));kce(c,r.defaults),xDe(c,gDe(e,n,o,t));const u=vDe(e,i,n,l);Tce(c,u),dDe(c);const f=Mce(c),h=i.kind==="identifier"?`(?:const|let|var)\\s+${s}\\s*=\\s*gsap\\.timeline\\s*\\([^)]*\\)\\s*;?`:`${eDe(s)}\\s*=\\s*gsap\\.timeline\\s*\\([^)]*\\)\\s*;?`,p=t.match(new RegExp(`^[\\s\\S]*?${h}`)),y=i.kind==="identifier"?`const ${s} = gsap.timeline({ paused: true });`:`${s} = gsap.timeline({ paused: true });`,m=(p==null?void 0:p[0])??y,v=t.lastIndexOf(`${s}.`);let b="";if(v!==-1){const k=t.slice(v).indexOf(";");k!==-1&&(b=t.slice(v+k+1).trim())}const w={animations:f,timelineVar:s,preamble:m,postamble:b};return r.timelineCount>1&&(w.multipleTimelines=!0),r.timelineCount>0&&r.ref===null&&(w.unsupportedTimelinePattern=!0),w}catch{return{animations:[],timelineVar:"tl",preamble:"",postamble:""}}}function ODe(t){try{const e=rA(t,{ecmaVersion:"latest",sourceType:"script",locations:!0}),n=PL(e),i=NL(e,n).ref??{kind:"identifier",name:"tl"},s=[];return G0(e,{ExpressionStatement(a){var y,m;const o=a.expression;if(!o||o.type!=="CallExpression")return;const l=o.callee,c=i.kind==="identifier"?((y=l.object)==null?void 0:y.type)==="Identifier"&&l.object.name===i.name:VE(l.object,i.node);if((l==null?void 0:l.type)!=="MemberExpression"||!c||((m=l.property)==null?void 0:m.name)!=="addLabel")return;const u=o.arguments??[],f=u[0],h=u[1];if((f==null?void 0:f.type)!=="Literal"||typeof f.value!="string"||!h)return;const p=ls(h,n);typeof p!="number"||!Number.isFinite(p)||s.push({name:f.value,position:p})}}),s}catch{return[]}}function sA(t,e,n){if(n<=0)return 0;const r=(t-e)/n*100;return Math.max(0,Math.min(100,Math.round(r*1e3)/1e3))}function xS(t,e,n){return t>=e&&t<=e+n}function ai(t){if(t.resolvedStart!=null)return t.resolvedStart;if(typeof t.position=="number")return t.position;const e=Number.parseFloat(t.position);return Number.isNaN(e)?null:e}function Yi(t,e=.5){return t.duration??e}function CDe(t,e,n){for(const r of e){if(!kDe(r.targetSelector,n))continue;const i=ai(r);if(i===null)continue;const s=Yi(r);if(xS(t,i,s))return r}return null}function Nce(t,e){const n=ai(e);if(n===null)return null;const r=Yi(e);return sA(t,n,r)}function kDe(t,e){return t.split(",").some(n=>n.trim()===e)}const Pg={opacity:1,x:0,y:0,scale:1,scaleX:1,scaleY:1,rotation:0,width:100,height:100};function Xo(t){return t.method==="set"||(t.method==="to"||t.method==="fromTo")&&Yi(t)===0}const EDe=/^-?[A-Za-z_][\w-]*$/,S0=1;function Mg(t){return EDe.test(t)?`#${t}`:`[id="${t.replace(/(["\\])/g,"\\$1")}"]`}function Dce(t){if(!t)return null;const e=t.match(/^#([\w-]+)/);if(e)return e[1]??null;const n=t.match(/^\[id="((?:\\.|[^"\\])*)"\]/);return n?(n[1]??"").replace(/\\(["\\])/g,"$1"):null}const TDe=/^(#[\w-]+|\[id="(?:\\.|[^"\\])*"\])$/;function vX(t){const e=t.trim();return TDe.test(e)?Dce(e):null}function A_(t,e){const n=vX(t);if(n)return[n];const r=new Set;for(const i of t.split(",")){const s=i.trim();if(s){if(!e){const a=vX(s);a&&r.add(a);continue}try{for(const a of Array.from(e.querySelectorAll(s)))a.id&&r.add(a.id)}catch{const a=Dce(s);a&&r.add(a)}}}return Array.from(r)}function Ice(t){return t.start-(t.expandedParentStart??0)}function vc(t){return t.id?Mg(t.id):t.selector?t.selector:null}function _ce(t,e){return`[${t}="${e.replace(/(["\\])/g,"\\$1")}"]`}function HE(t,e,n){try{const r=t.querySelectorAll(e);return r.length===1&&r[0]===n}catch{return!1}}function PDe(t){const e=t.ownerDocument;if(!e)return null;const n=[];for(let i=t;i;i=i.parentElement){if(i!==t){const o=i instanceof HTMLElement?i.id:"",l=i.getAttribute("data-hf-id");if(o){n.unshift(Mg(o));break}if(l){n.unshift(_ce("data-hf-id",l));break}}const s=i.parentElement;if(!s)break;const a=[...s.children].indexOf(i)+1;if(a<1)return null;n.unshift(`${i.tagName.toLowerCase()}:nth-child(${a})`)}if(n.length===0)return null;const r=n.join(" > ");return HE(e,r,t)?r:null}function Ec(t){if(t.id)return Mg(t.id);if(t.hfId)return _ce("data-hf-id",t.hfId);const e=t.element,n=e==null?void 0:e.ownerDocument;return e&&n?t.selector&&HE(n,t.selector,e)?t.selector:PDe(e):t.selector??null}function DL(t,e){return t.targetSelector&&!t.hasUnresolvedSelector?t.targetSelector:vc(e)}function vy(t,e,n){if(t===e)return!0;const r=n==null?void 0:n.ownerDocument;return!n||!r?!1:HE(r,t,n)}function bf(t,e){var r;const n=Number.parseFloat(((r=e.dataAttributes)==null?void 0:r.duration)??"");return Yi(t,Number.isFinite(n)&&n>0?n:.5)}function bS(t,e,n){var s,a;if(n){const o=ai(n),l=bf(n,e);if(l<=0)return 0;if(o!==null)return sA(t,o,l)}const r=Number.parseFloat(((s=e.dataAttributes)==null?void 0:s.start)??"0")||0,i=Number.parseFloat(((a=e.dataAttributes)==null?void 0:a.duration)??"1")||1;return sA(t,r,i)}function IL(t){if(!(t!=null&&t.contentWindow))return null;try{const e=t.contentWindow.gsap;return e!=null&&e.getProperty?e:null}catch{return null}}function _L(t,e){var n;try{return((n=t==null?void 0:t.contentDocument)==null?void 0:n.querySelector(e))??null}catch{return null}}function AX(t){const e={};for(const[n,r]of Object.entries(t))n!=="ease"&&(typeof r=="number"?e[n]=Math.round(r*1e3)/1e3:typeof r=="string"&&(e[n]=r));return e}function MDe(t){const e=[];let n;if(Array.isArray(t)){const r=t;return r.forEach((i,s)=>{if(!i||typeof i!="object")return;const a=r.length>1?Math.round(s/(r.length-1)*1e3)/10:0,o=AX(i);Object.keys(o).length>0&&e.push({percentage:a,properties:o})}),e.length>0?{keyframes:e}:null}for(const[r,i]of Object.entries(t)){if(r==="easeEach"){typeof i=="string"&&(n=i);continue}const s=r.match(/^(\d+(?:\.\d+)?)%$/);if(!s||!i||typeof i!="object")continue;const a=parseFloat(s[1]),o=AX(i);Object.keys(o).length>0&&e.push({percentage:a,properties:o})}return e.length===0?null:(e.sort((r,i)=>r.percentage-i.percentage),{keyframes:e,easeEach:n})}function RL(t,e,n){return t+n/100*e}function QE(t,e,n,r){var o;const i=n.find(l=>l.domId===t||(l.key??l.id)===`${e}#${t}`);if(i){const l=i.parentCompositionId,c=l?n.find(f=>f.domId===l||f.id===l):void 0,u=i.expandedParentStart??(c==null?void 0:c.start);return u!==void 0?{elStart:i.start-u,elDuration:i.duration}:l?{elStart:0,elDuration:i.duration}:{elStart:i.start,elDuration:i.duration}}const s=(o=r.find(l=>l.id===t))==null?void 0:o.hostId,a=s?n.find(l=>l.domId===s||(l.key??l.id)===`index.html#${s}`):void 0;return{elStart:0,elDuration:(a==null?void 0:a.duration)??1}}function Rce(t,e,n,r){return n<=0?r:Math.round((t-e)/n*1e5)/1e3}function jL(t,e,n,r){const i=e.resolvedStart??(typeof e.position=="number"?e.position:0),s=e.duration??r;return t.map(a=>({...a,percentage:Rce(RL(i,s,a.percentage),n,r,a.percentage),tweenPercentage:a.percentage,propertyGroup:e.propertyGroup,animationId:e.id}))}function S_(t){if(t.keyframes||t.method!=="set"&&(t.duration??0)!==0)return!1;const e=Object.keys(t.properties).filter(n=>n!=="immediateRender");return e.length>0&&e.every(n=>n==="x"||n==="y")}function NDe(t,e){const n=t.animationId;if(n===e.animationId)return;const r=t.collidingAnimationTargets;r!=null&&r.some(i=>i.animationId===e.animationId)||(t.collidingAnimationTargets=[...r===void 0||r.length===0?[{animationId:n,tweenPercentage:t.tweenPercentage}]:r,{animationId:e.animationId,tweenPercentage:e.tweenPercentage}])}function LL(t){var n;const e=new Map;for(const r of t){const i=e.get(r.percentage);i?(i.properties={...i.properties,...r.properties},NDe(i,r),(((n=i.collidingAnimationTargets)==null?void 0:n.length)??0)>1?delete i.ease:r.ease&&(i.ease=r.ease)):e.set(r.percentage,{...r,properties:{...r.properties}})}return Array.from(e.values()).sort((r,i)=>r.percentage-i.percentage)}function Ng(t){var c;const e=((c=t.extras)==null?void 0:c.immediateRender)==="__raw:true";if(t.method==="set"||t.duration===0&&e)return null;const n=t.properties,r=t.fromProperties;if(!n||Object.keys(n).length===0)return null;const i={},s={};if(t.method==="from")for(const[u,f]of Object.entries(n))i[u]=f,s[u]=Pg[u]??0;else if(t.method==="fromTo"&&r)Object.assign(i,r),Object.assign(s,n);else for(const[u,f]of Object.entries(n))i[u]=Pg[u]??0,s[u]=f;const a=Object.keys(s).filter(u=>typeof i[u]=="number"&&typeof s[u]=="number");if(a.length===0)return null;const o=Object.fromEntries(a.map(u=>[u,i[u]])),l=Object.fromEntries(a.map(u=>[u,s[u]]));return{format:"percentage",keyframes:[{percentage:0,properties:o},{percentage:100,properties:l,...t.ease?{ease:t.ease}:{}}],...t.ease?{ease:t.ease}:{}}}const DDe=new Set(["transformOrigin","_auto","data"]);function jce(t){return!DDe.has(t)}function IDe(t,e){return Object.keys(t).some(n=>jce(n)&&rl(n)===e)}function Lce(t){var e,n;return((e=t.keyframes)==null?void 0:e.keyframes)??((n=Ng(t))==null?void 0:n.keyframes)??[]}function zE(t){const e=new Set;for(const n of Lce(t))for(const r of Object.keys(n.properties))jce(r)&&e.add(rl(r));return Array.from(e)}function _De(t,e,n){const r=rl(t),i=e==null?void 0:e.find(s=>zE(s).includes(r));return(i==null?void 0:i.id)??n??""}function Fce(t){return zE(t).length>0}function RDe(t){const e=new Map;for(const n of t)for(const r of zE(n)){const i=e.get(r)??[];i.push(n),e.set(r,i)}return e}function jDe(t,e){var n;return t.ease??((n=e.keyframes)==null?void 0:n.easeEach)??e.ease}function LDe(t,e,n,r){const i=[];for(const s of t){const a=Lce(s).filter(o=>IDe(o.properties,e));for(const o of jL(a,s,n,r))i.push({...o,propertyGroup:e,ease:jDe(o,s)})}return i}function FL(t,e,n){return n<=0?[]:Array.from(RDe(t),([r,i])=>({group:r,animations:i,keyframes:LDe(i,r,e,n)})).filter(r=>r.keyframes.length>0)}function FDe({id:t,animations:e,clipStart:n,clipDuration:r,clipLeftPx:i,clipWidthPx:s,accentColor:a,isSelected:o,currentPercentage:l,elementId:c,selectedKeyframes:u,rovingTargetId:f=null,onSelectSegment:h,onClickKeyframe:p,onShiftClickKeyframe:y,onContextMenuKeyframe:m,onMoveKeyframe:v,suppressClickRef:b}){const w=x.useMemo(()=>s<20||r<=0?[]:FL(e,n,r),[e,n,r,s]),O=x.useMemo(()=>w.map(k=>({...k,keyframesData:{format:"percentage",keyframes:k.keyframes}})),[w]);return d.jsx("div",{id:t,children:O.map(({group:k,keyframesData:E},T)=>d.jsx("div",{id:I6(t,K2(c,k),"content"),role:"group","aria-label":`${k} keyframes`,"data-property-group":k,"data-timeline-element-id":c,"data-timeline-property-lane":"","data-timeline-lane-top":kg(T),className:"absolute",style:{left:i,top:kg(T),width:s,height:Cg},children:d.jsx(Poe,{keyframesData:E,clipWidthPx:s,clipHeightPx:Cg,accentColor:a,isSelected:o,currentPercentage:l,elementId:c,clipStart:n,clipDuration:r,selectedKeyframes:u,rovingTargetId:f,onSelectSegment:h,onClickKeyframe:p,onShiftClickKeyframe:y,onContextMenuKeyframe:m,onMoveKeyframe:v,suppressClickRef:b,groupAware:!0})},k))})}const w_=.02,O_=.001,$ce=7,$De=5,SX=64,wl=$ce+2;function Ac(t,e){const{min:n,max:r}=t;return r<=n?0:t.scale==="log"&&n>0&&e>0?(Math.log(e)-Math.log(n))/(Math.log(r)-Math.log(n)):(e-n)/(r-n)}function ZE(t,e){const n=Math.min(1,Math.max(0,e)),{min:r,max:i}=t;return t.scale==="log"&&r>0?Math.exp(Math.log(r)+n*(Math.log(i)-Math.log(r))):r+n*(i-r)}function BDe(t,e){const n=t.step>=1?0:t.step>=.1?1:2,r=t.unit===""&&t.max===1?`${Math.round(e*100)}%`:e.toFixed(n);return t.unit?`${r} ${t.unit}`:r}function VDe(t){const{range:e,a:n,b:r,t:i,v:s}=t,a=r.t-n.t;if(a<=0)return null;const o=(i-n.t)/a;if(o<=.001||o>=.999)return null;const l=Ac(e,n.v),c=Ac(e,r.v);if(Math.abs(c-l)<.001)return null;const u=(Ac(e,s)-l)/(c-l);return u<=.001||u>=.999?null:uCe(o,u)}function Bce(t){const{origin:e,raw:n,xOf:r,yOf:i}=t;return Math.abs(r(n.t)-r(e.t))>Math.abs(i(n.v)-i(e.v))?"time":"value"}function HDe(t){const{range:e,origin:n,raw:r}=t;if((t.axis??Bce(t))==="time")return{t:r.t,v:n.v};const s=Ac(e,n.v);return{t:n.t,v:ZE(e,s+(Ac(e,r.v)-s)*.25)}}function $L(t,e,n){let r=t,i=n;for(const s of e){const a=Math.abs(s-t);a{const u=a.t+(o.t-a.t)*(c+1)/SX;return`L ${i(u)} ${s(Bf(e,u,n.scale))}`})}function QDe(t){const{lane:e,range:n,widthPx:r,xOf:i,yOf:s}=t,a=e.points[0],o=e.points[e.points.length-1];if(!a||!o){const c=s(n.default??(n.min+n.max)/2);return`M ${wl} ${c} L ${wl+r} ${c}`}const l=[`M ${wl} ${s(a.v)}`,`L ${i(a.t)} ${s(a.v)}`];for(let c=0;c+1n.target===e)??{target:e,points:[]}}function VL(t,e){const n=e.points.length===0,r=t.lanes.some(s=>s.target===e.target),i=t.lanes.map(s=>s.target===e.target?e:s).filter(s=>s.points.length>0);return!r&&!n&&i.push(e),{version:1,lanes:i}}function Z6(t,e,n){return t.points.filter(r=>r.t>=e&&r.t<=n)}function wX(t,e,n,r){return r.some(i=>Math.abs(i.t-n)<=w_)?[]:[{t:n,v:Bf(t,n,e.scale)}]}function ZDe(t,e){if(e<=0)return[];if(t.length<=e)return[...t];if(e===1){const i=t[0];return i?[i]:[]}const n=[],r=(t.length-1)/(e-1);for(let i=0;iu.ti),o=e.points.length===0?[]:[...wX(e,n,r,s),...wX(e,n,i,s)],l=Math.max(0,Lse-a.length-o.length),c=s.length<=l?s:ZDe(s,l);return[...a,...o,...c].sort((u,f)=>u.t-f.t)}function Dg(t,e){return t.t>=e.t0&&t.t<=e.t1&&t.v>=e.v0&&t.v<=e.v1}function GDe(t){const{lane:e,range:n,t0:r,t1:i,newT0:s,newT1:a}=t,o=i-r,l=a-s;if(o<=0||l<=0)return e.points;const c=Z6(e,r,i).map(u=>({...u,t:s+(u.t-r)*l/o}));return G6({lane:e,range:n,t0:Math.min(r,s),t1:Math.max(i,a),inner:c})}function HL(t){var e,n;(n=(e=t.currentTarget).setPointerCapture)==null||n.call(e,t.pointerId)}const OX=8,UDe=3,CX=.02;function XDe(t,e,n,r){return t==="t0"?Math.max(0,Math.min(e,n.t1-CX)):Math.min(r,Math.max(e,n.t0+CX))}function WDe({getBox:t,lane:e,range:n,pointAt:r,xOf:i,commitPoints:s,duration:a,readOnly:o,rangeSelection:l,pointInSelectionAt:c,onRangeSelect:u,onRangeClear:f,onHint:h}){const[p,y]=x.useState(null),m=x.useRef(!1),[v,b]=x.useState(!1),w=x.useCallback(_=>{if(!l)return null;const I=t();if(!I)return null;const j=_-I.left,L=i(l.t0),B=i(l.t1),$=Math.abs(L-j)<=OX,z=Math.abs(B-j)<=OX;return $&&z?j<=(L+B)/2?"t0":"t1":$?"t0":z?"t1":null},[l,t,i]),O=x.useCallback(_=>{if(o||!l)return!1;const I=w(_.clientX);return!I||c!=null&&c(_.clientX,_.clientY)?!1:(_.preventDefault(),HL(_),b(!1),m.current=!1,y({edge:I,origin:l,current:I==="t0"?l.t0:l.t1,points:e.points}),!0)},[o,l,w,e,c]),k=x.useCallback(_=>{if(p===null)return;const{edge:I,origin:j,points:L}=p,B=XDe(I,r(_.clientX,_.clientY).t,j,a);if(y({edge:I,origin:j,current:B,points:L}),!m.current){const Y=I==="t0"?j.t0:j.t1;if(Math.abs(i(B)-i(Y))<=UDe)return;m.current=!0}const $=I==="t0"?B:j.t0,z=I==="t1"?B:j.t1;h(`${$.toFixed(2)}s → ${z.toFixed(2)}s`),u==null||u($,z,j.v0,j.v1),s(GDe({lane:{target:e.target,points:L},range:n,t0:j.t0,t1:j.t1,newT0:$,newT1:z}),!1)},[p,r,a,i,h,u,s,e.target,n]),E=x.useCallback(()=>{if(p===null)return;const{edge:_,origin:I,current:j}=p;if(y(null),h(null),!m.current){f==null||f();return}m.current=!1,s(e.points,!0),u==null||u(_==="t0"?j:I.t0,_==="t1"?j:I.t1,I.v0,I.v1)},[p,h,f,s,e,u]),T=x.useCallback(()=>{if(p===null)return;const{origin:_,points:I}=p;y(null),h(null),m.current&&(m.current=!1,s(I,!1),u==null||u(_.t0,_.t1,_.v0,_.v1))},[p,h,s,u]),N=x.useCallback(_=>{o||b(w(_.clientX)!==null)},[o,w]);return{edge:(p==null?void 0:p.edge)??null,hover:v,arm:O,move:k,finish:E,cancel:T,updateHover:N}}const QL=.04;function qDe(t,e,n){return!n||!e||!Dg(e,n)?[]:t.points.flatMap((r,i)=>Dg(r,n)?[i]:[])}function YDe(t,e,n){const r=qDe(t,e,n);return r.length<=1||!e?null:{points:t.points.map(i=>({...i})),indices:r,anchor:{t:e.t,v:e.v},selection:n?{...n}:{t0:0,t1:0,v0:0,v1:0}}}function KDe(t,e,n){const r=t.points[e],i=t.points[e+1];return!r||!i?null:{points:t.points.map(s=>({...s})),indices:[e,e+1],anchor:{...n},selection:{t0:r.t,t1:i.t,v0:Math.min(r.v,i.v),v1:Math.max(r.v,i.v)}}}function Hce(t){const{group:e,raw:n,shiftKey:r,altKey:i,range:s,duration:a,snapTimes:o,xOf:l,yOf:c}=t,u=e.indices.map(b=>e.points[b]);let f=n.t-e.anchor.t,h=n.v-e.anchor.v;if(r){const b=Math.abs(f*(l(1)-l(0))),w=Math.abs(h*(c(s.min)-c(s.max))/(s.max-s.min));b>=w?h=0:f=0}else if(!i){const b=e.points.filter((w,O)=>!e.indices.includes(O)).map(w=>w.t);f=$L(e.anchor.t+f,[...o??[],...b],QL)-e.anchor.t}const p=u.map(b=>b.t),y=u.map(b=>b.v),m=b=>e.indices.flatMap(w=>{const O=e.points[w+b];return!O||e.indices.includes(w+b)?[]:[Math.max(0,Math.abs(O.t-e.points[w].t)-O_)]});return f=Math.min(Math.max(f,-Math.min(Math.min(...p),...m(-1))),Math.min(a-Math.max(...p),...m(1))),h=Math.min(Math.max(h,s.min-Math.min(...y)),s.max-Math.max(...y)),{points:e.points.map((b,w)=>e.indices.includes(w)?{...b,t:b.t+f,v:b.v+h}:b),selection:{t0:e.selection.t0+f,t1:e.selection.t1+f,v0:e.selection.v0+h,v1:e.selection.v1+h},hint:`${e.indices.length} points ${f>=0?"+":""}${f.toFixed(2)}s`}}function JDe(t){var w,O,k;const{raw:e,origin:n,shiftKey:r,altKey:i,range:s,duration:a,snapTimes:o,lane:l,dragIndex:c,xOf:u,yOf:f}=t;let h=r?t.shiftAxis:null,{t:p,v:y}=e;if(r&&n&&(h??(h=Bce({origin:n,raw:e,xOf:u,yOf:f})),{t:p,v:y}=HDe({range:s,origin:n,raw:e,xOf:u,yOf:f,axis:h})),!i&&!r){const E=l.points.filter((T,N)=>N!==c).map(T=>T.t);p=$L(p,[...o??[],...E],QL)}const m=(((w=l.points[c-1])==null?void 0:w.t)??-1/0)+O_,v=(((O=l.points[c+1])==null?void 0:O.t)??1/0)-O_,b=((k=l.points[c])==null?void 0:k.t)??p;return p=v>=m?Math.min(v,Math.max(m,Math.min(a,Math.max(0,p)))):b,{t:p,v:y,shiftAxis:h}}function kX(t,e){const n=e.pointAt(t.clientX,t.clientY),r=Math.min(e.duration,Math.max(0,n.t));return{t:t.altKey?r:$L(r,e.snapTimes??[],QL),v:n.v}}function eIe({pointAt:t,xOf:e,yOf:n,duration:r,snapTimes:i,onRangeSelect:s,onRangeClear:a}){const[o,l]=x.useState(null),c=x.useRef(!1),u=x.useCallback(p=>{if(!s)return;p.preventDefault(),HL(p);const y=kX(p,{pointAt:t,duration:r,snapTimes:i});c.current=!1,l({from:y,to:y})},[s,t,r,i]),f=x.useCallback(p=>{if(o===null)return;const y=kX(p,{pointAt:t,duration:r,snapTimes:i}),{from:m}=o;l({from:m,to:y}),!(Math.max(Math.abs(e(y.t)-e(m.t)),Math.abs(n(y.v)-n(m.v)))<=3)&&(c.current=!0,s==null||s(Math.min(m.t,y.t),Math.max(m.t,y.t),Math.min(m.v,y.v),Math.max(m.v,y.v)))},[o,t,r,i,e,n,s]),h=x.useCallback(()=>{c.current||a==null||a(),c.current=!1,l(null)},[a]);return{dragging:o!==null,arm:u,move:f,finish:h}}function tIe({getBox:t,lane:e,range:n,pointAt:r,xOf:i,yOf:s,segmentIndex:a,commitPoints:o,duration:l,snapTimes:c,readOnly:u,onHint:f}){const[h,p]=x.useState(null),[y,m]=x.useState(null),v=x.useRef(null),b=x.useCallback((N,_)=>{const I=t();if(!I)return null;const j=a(N,_);if(j===null)return null;const{t:L}=r(N,_),B=Bf(e,L,n.scale);return Math.abs(s(B)-(_-I.top))<=$De?j:null},[t,e,r,n.scale,a,s]),w=x.useCallback((N,_,I)=>{v.current=KDe(e,N,r(_,I)),m(null),p(N)},[e,r]),O=x.useCallback(N=>{const _=v.current;if(!_)return;const I=Hce({group:_,raw:r(N.clientX,N.clientY),shiftKey:N.shiftKey,altKey:N.altKey,range:n,duration:l,snapTimes:c,xOf:i,yOf:s});f(I.hint),o(I.points,!1)},[o,l,f,r,n,c,i,s]),k=x.useCallback(()=>{v.current=null,p(null)},[]),E=x.useCallback((N,_)=>{m(u?null:b(N,_))},[b,u]),T=x.useCallback(()=>m(null),[]);return{dragIndex:h,hoverIndex:y,hitIndex:b,arm:w,move:O,finish:k,updateHover:E,clearHover:T}}const nIe=3;function rIe(t){return t?{t:t.t,v:t.v}:{t:0,v:0}}function iIe({getBox:t,lane:e,range:n,pointAt:r,xOf:i,yOf:s,commitPoints:a,snapTimes:o,readOnly:l,onSelect:c,onRangeSelect:u,onRangeClear:f,duration:h,rangeSelection:p}){const[y,m]=x.useState(null),[v,b]=x.useState(null),[w,O]=x.useState(null),k=WDe({getBox:t,lane:e,range:n,pointAt:r,xOf:i,commitPoints:a,duration:h,readOnly:l,rangeSelection:p,pointInSelectionAt:(H,se)=>{if(!p)return!1;const fe=W(H,se),be=fe===null?null:e.points[fe];return be?Dg(be,p):!1},onRangeSelect:u,onRangeClear:f,onHint:O}),E=x.useRef(null),T=x.useRef(null),[N,_]=x.useState(null),I=eIe({pointAt:r,xOf:i,yOf:s,duration:h,snapTimes:o,onRangeSelect:u,onRangeClear:f}),j=x.useRef(null),L=x.useRef(!1),B=x.useRef(null),$=x.useCallback(H=>{_(se=>se?{index:se.index,text:H}:null)},[]),z=x.useCallback(()=>_(null),[]),Y=x.useCallback(()=>{const H=N;if(_(null),!H)return;const se=Number(H.text);if(!Number.isFinite(se))return;const fe=Math.min(n.max,Math.max(n.min,se));a(e.points.map((be,me)=>me===H.index?{...be,v:fe}:be),!0)},[N,e,n,a]),W=x.useCallback((H,se)=>{const fe=t();if(!fe)return null;const be=H-fe.left,me=se-fe.top;for(let pe=0;pe{const{t:fe}=r(H,se);for(let be=0;be+1me.t&&fe{const se=W(H.clientX,H.clientY);if(se!==null)return{kind:"point",index:se};const fe=H.altKey?J(H.clientX,H.clientY):ne.hitIndex(H.clientX,H.clientY);return fe===null?null:{kind:H.altKey?"curve":"segment",index:fe}},[W,ne,J]),ie=x.useCallback(H=>{if(H.button!==0)return;if(H.stopPropagation(),N&&Y(),l){c==null||c(),I.arm(H);return}if(k.arm(H))return;const se=le(H);if(!se){I.arm(H);return}if(H.preventDefault(),HL(H),ne.clearHover(),se.kind==="curve"){b(se.index);return}if(se.kind==="segment"){ne.arm(se.index,H.clientX,H.clientY);return}E.current=rIe(e.points[se.index]),T.current=YDe(e,e.points[se.index],p),j.current={x:H.clientX,y:H.clientY},L.current=!1,m(se.index)},[le,e,l,c,I,N,Y,p,k,ne]),q=x.useCallback((H,se)=>{if(v===null)return;const fe=e.points[v],be=e.points[v+1];if(!fe||!be)return;const{t:me,v:pe}=r(H,se),ge=VDe({range:n,a:fe,b:be,t:me,v:pe});ge!==null&&(O(`bend ${Math.round(ge.viaX*100)}%`),a(e.points.map((Pe,ve)=>ve===v?{...Pe,curve:void 0,viaX:ge.viaX,viaY:ge.viaY}:Pe),!1))},[v,e,r,n,a]),F=x.useCallback((H,se)=>{const{points:fe,selection:be,hint:me}=Hce({group:se,raw:r(H.clientX,H.clientY),shiftKey:H.shiftKey,altKey:H.altKey,range:n,duration:h,snapTimes:o,xOf:i,yOf:s});u==null||u(be.t0,be.t1,be.v0,be.v1),O(me),a(fe,!1)},[a,h,u,r,n,o,i,s]),U=x.useCallback(H=>{if(y===null)return;const se=T.current;if(se){F(H,se);return}H.shiftKey||(B.current=null);const{t:fe,v:be,shiftAxis:me}=JDe({raw:r(H.clientX,H.clientY),origin:E.current,shiftKey:H.shiftKey,altKey:H.altKey,shiftAxis:B.current,range:n,duration:h,snapTimes:o,lane:e,dragIndex:y,xOf:i,yOf:s});B.current=me;const pe=e.points.map((ge,Pe)=>Pe===y?{...ge,t:fe,v:be}:ge);O(`${BDe(n,be)} @ ${fe.toFixed(2)}s`),a(pe,!1)},[y,h,e,r,n,a,o,i,s,F]),Z=x.useCallback(H=>{const se=j.current;se&&Math.hypot(H.clientX-se.x,H.clientY-se.y)>nIe&&(L.current=!0),v!==null?q(H.clientX,H.clientY):ne.dragIndex!==null?ne.move(H):U(H)},[q,v,U,ne]),K=x.useCallback(H=>{if(k.edge!==null){H.stopPropagation(),H.buttons===0?k.cancel():k.move(H);return}if(I.dragging){H.stopPropagation(),I.move(H);return}if(v===null&&y===null&&ne.dragIndex===null){k.updateHover(H),ne.updateHover(H.clientX,H.clientY);return}H.stopPropagation(),Z(H)},[I,v,y,ne,Z,k]),ee=x.useCallback(H=>{if(k.edge!==null){H.stopPropagation(),k.finish();return}if(I.dragging){H.stopPropagation(),I.finish();return}if(y===null&&v===null&&ne.dragIndex===null)return;H.stopPropagation();const se=y,fe=se!==null&&H.shiftKey&&!L.current;if(m(null),b(null),ne.finish(),E.current=null,T.current=null,B.current=null,j.current=null,O(null),fe){a(e.points.filter((be,me)=>me!==se),!0);return}a(e.points,!0)},[I,v,y,ne,e,a,k]),re=x.useCallback(H=>{if(k.edge!==null){H.stopPropagation(),k.cancel();return}ee(H)},[k,ee]),Q=x.useCallback(H=>{if(l)return;H.stopPropagation(),H.preventDefault();const se=W(H.clientX,H.clientY);if(H.altKey){const ge=se??J(H.clientX,H.clientY);if(ge===null)return;a(e.points.map((Pe,ve)=>ve===ge?{t:Pe.t,v:Pe.v}:Pe),!0);return}if(se!==null){const ge=e.points[se];ge&&_({index:se,text:String(Number(ge.v.toFixed(3)))});return}const{t:fe,v:be}=r(H.clientX,H.clientY),me=e.points.filter(ge=>Math.abs(ge.t-fe)>w_),pe=e.points.length===0&&fe>w_?[{t:0,v:be}]:[];a([...pe,...me,{t:fe,v:be}].sort((ge,Pe)=>ge.t-Pe.t),!0)},[e,r,a,l,W,J]);return{dragIndex:y,curveIndex:v,segmentDragIndex:ne.dragIndex,segmentHoverIndex:ne.hoverIndex,edgeDrag:k.edge,edgeHover:k.hover,cancelDrag:re,hint:w,hitIndex:W,segmentIndex:J,onPointerLeave:ne.clearHover,onPointerDown:ie,onPointerMove:K,endDrag:ee,onDoubleClick:Q,editing:N,setEditingText:$,commitEdit:Y,cancelEdit:z}}function sIe({text:t,leftPx:e,label:n,onChange:r,onCommit:i,onCancel:s}){return d.jsx("input",{className:"hf-automation-value pointer-events-auto absolute rounded-[3px] border border-panel-border-input bg-panel-bg-2 px-1 font-mono text-[9px] text-panel-text-1",style:{left:e,top:1,width:44,zIndex:4},onPointerDown:a=>a.stopPropagation(),onKeyDown:a=>{a.stopPropagation(),a.key==="Enter"&&i(),a.key==="Escape"&&s()},onChange:a=>r(a.target.value),onBlur:i,value:t,"aria-label":`${n} value`,autoFocus:!0})}const EX=[{id:"ramp-up",label:"Ramp up"},{id:"ramp-down",label:"Ramp down"},{id:"swell",label:"Swell"},{id:"dip",label:"Dip"}],WO=.4,aIe=.25;function TX(t,e,n){return t.points.length===0?e.default??(e.min+e.max)/2:Bf(t,n,e.scale)}function oIe(t){const{shape:e,lane:n,range:r,t0:i,t1:s}=t,a=TX(n,r,i),o=TX(n,r,s),l=(i+s)/2;switch(e){case"ramp-up":return[{t:i,v:r.min},{t:s,v:o}];case"ramp-down":return[{t:i,v:a},{t:s,v:r.min}];case"swell":return[{t:i,v:a,curve:WO},{t:l,v:r.max,curve:-WO},{t:s,v:o}];case"dip":return[{t:i,v:a,curve:-WO},{t:l,v:ZE(r,Ac(r,a)*aIe),curve:WO},{t:s,v:o}]}}const lIe=x.memo(function({x:e,y:n,onClose:r,onInsertShape:i,onSimplify:s,canSimplify:a}){const o=V0(r),l="block w-full px-2 py-1 text-left text-[11px] text-panel-text-1 hover:bg-panel-bg-3 disabled:opacity-40",c=140,u=EX.length*24+32,f=n+u-window.innerHeight,h=e+c>window.innerWidth?e-c:e,p=f>0?n-f-8:n;return Bl.createPortal(d.jsxs("div",{ref:o,className:"hf-automation-menu fixed z-[200] min-w-[140px] rounded border border-panel-border-input bg-panel-bg-2 py-1 shadow-lg",style:{left:h,top:p},children:[EX.map(y=>d.jsx("button",{type:"button",className:l,onClick:()=>{i(y.id),r()},children:y.label},y.id)),d.jsx("div",{className:"my-1 border-t border-panel-border-input"}),d.jsx("button",{type:"button",className:l,disabled:!a,title:a?void 0:"Fewer than three points in the selection",onClick:()=>{s(),r()},children:"Simplify"})]}),document.body)});function cIe(t,e,n=.02){if(t.length<=2)return t;const r=new Array(t.length).fill(!1),i=r.length-1;r[0]=!0,r[i]=!0;const s=[[0,i]];for(;s.length>0;){const a=s.pop();if(!a)break;const[o,l]=a,c=t[o],u=t[l];if(!c||!u||l-o<2)continue;const f=Ac(e,c.v),h=Ac(e,u.v),p=u.t-c.t;let y=-1,m=n;for(let v=o+1;v0?(b.t-c.t)/p:0,O=Math.abs(Ac(e,b.v)-(f+w*(h-f)));O>m&&(m=O,y=v)}y>=0&&(r[y]=!0,s.push([o,y],[y,l]))}return t.filter((a,o)=>r[o])}function uIe({path:t,lane:e,range:n,accentColor:r,activeSegment:i,xOf:s,yOf:a}){const o=i===null?null:zDe({lane:e,range:n,index:i,xOf:s,yOf:a});return d.jsxs(d.Fragment,{children:[d.jsx("path",{"data-automation-envelope":"",d:t,fill:"none",stroke:r,strokeWidth:1.5,opacity:e.points.length===0?.35:.95}),o?d.jsx("path",{"data-automation-segment-active":i??void 0,d:o,fill:"none",stroke:r,strokeWidth:3,strokeLinecap:"round",opacity:1,pointerEvents:"none"}):null]})}const fIe=4.9,hIe=Fj.rowBorder;function dIe(t,e){return!!e&&Dg(t,e)}function pIe(t,e){return{radius:fIe*(e?1.3:t?1.15:1),stroke:t?"#fff":"rgba(0,0,0,0.5)",strokeWidth:t?1.5:1}}function mIe(t){return t?"Drag a box to select points, which also selects this clip; then double-click to add a point":"Double-click to add a point, drag to shape, double-click a point to type a value, right-click or Shift+click to remove it. Drag a line segment to move both endpoints. Drag the background to draw a box around points, then Delete to remove them or drag one to move them all. Alt-drag the line to curve it. Shift locks an axis mid-drag; Alt ignores the grid."}function gIe({readOnly:t,note:e,hovered:n,hasRange:r,leftPx:i,widthPx:s}){return!t||!e||!n||r?null:d.jsx("div",{"data-automation-readonly-note":"",className:"hf-automation-readonly-note pointer-events-none absolute rounded-[3px] bg-black/85 px-1.5 py-0.5 text-[9px] text-white/80",style:{left:i+6,top:2,zIndex:3,maxWidth:Math.max(120,s-12)},children:e})}function yIe(t){return t.dragging||t.hasRange||!t.readOnly&&t.hovered?1:0}function xIe(t,e,n,r){return n?"col-resize":t?"pointer":e?"grabbing":r?"grab":"crosshair"}function bIe({duration:t,widthPx:e,leftPx:n,topPx:r,automation:i,target:s,range:a,accentColor:o,playheadSec:l,onPreview:c,onCommit:u,snapTimes:f,readOnly:h,readOnlyNote:p,onSelect:y,rangeSelection:m,onRangeSelect:v,onRangeClear:b}){var pe;const w=BL(i,s),O=x.useRef(null),[k,E]=x.useState(null),T=x.useMemo(()=>k?{target:s,points:k.points}:w,[k,s,w]);x.useEffect(()=>{k&&k.basedOn!==i&&E(null)},[i,k]),x.useEffect(()=>{E(null)},[s]);const N=Pd,_=6,I=N-_*2,j=x.useCallback(ge=>wl+(t>0?ge/t*e:0),[t,e]),L=x.useCallback(ge=>_+(1-Ac(a,ge))*I,[a,I]),B=x.useCallback((ge,Pe)=>{var Ce;const ve=(Ce=O.current)==null?void 0:Ce.getBoundingClientRect();if(!ve||ve.width<=0)return{t:0,v:a.default??a.min};const xe=Math.min(t,Math.max(0,(ge-ve.left-wl)/e*t)),we=1-(Pe-ve.top-_)/I;return{t:xe,v:ZE(a,we)}},[t,I,a,e]),$=x.useMemo(()=>QDe({lane:T,range:a,widthPx:e,xOf:j,yOf:L}),[T,a,e,j,L]),z=x.useCallback((ge,Pe)=>{E({points:ge,basedOn:i});const ve=VL(i,{target:s,points:ge});Pe?u(ve):c(ve)},[i,s,u,c]),Y=x.useCallback(()=>{var ge;return((ge=O.current)==null?void 0:ge.getBoundingClientRect())??null},[]),W=iIe({getBox:Y,lane:T,range:a,pointAt:B,xOf:j,yOf:L,commitPoints:z,snapTimes:f,readOnly:h,onSelect:y,onRangeSelect:v,onRangeClear:b,duration:t,rangeSelection:m}),{dragIndex:J,curveIndex:ne,segmentDragIndex:le,segmentHoverIndex:ie,edgeDrag:q,edgeHover:F,hint:U,editing:Z}=W,K=x.useCallback(ge=>{h||z(T.points.filter((Pe,ve)=>ve!==ge),!0)},[T,z,h]),[ee,re]=x.useState(null),[Q,H]=x.useState(!1),se=x.useCallback(ge=>{if(!m)return;const Pe=oIe({shape:ge,lane:T,range:a,t0:m.t0,t1:m.t1});z(G6({lane:T,range:a,t0:m.t0,t1:m.t1,inner:Pe}),!0)},[m,T,a,z]),fe=x.useCallback(()=>{if(!m)return;const ge=cIe(Z6(T,m.t0,m.t1),a);z(G6({lane:T,range:a,t0:m.t0,t1:m.t1,inner:ge}),!0)},[m,T,a,z]),be=x.useCallback(ge=>{h||!m||Dg(B(ge.clientX,ge.clientY),m)&&(ge.preventDefault(),re({x:ge.clientX,y:ge.clientY}))},[h,m,B]),me=T.points.length>0&&l!==null?Bf(T,l,a.scale):null;return d.jsxs("div",{className:"hf-automation-lane pointer-events-none absolute",style:{top:r,left:0,right:0,height:N},"data-automation-lane":s,children:[d.jsx("div",{"data-automation-lane-border":"",className:"hf-automation-lane-border pointer-events-none absolute",style:{top:0,left:0,right:0,height:1,background:hIe,zIndex:1}}),d.jsxs("svg",{ref:O,className:"hf-automation-svg pointer-events-auto absolute",style:{left:n-wl,top:0,width:e+wl*2,height:N,cursor:xIe(h,J!==null||ne!==null||le!==null,q!==null||F,ie!==null),opacity:h?.55:1,touchAction:"none"},width:e+wl*2,height:N,onPointerEnter:()=>H(!0),onPointerLeave:()=>{H(!1),W.onPointerLeave()},onPointerDown:W.onPointerDown,onPointerMove:W.onPointerMove,onPointerUp:W.endDrag,onPointerCancel:W.cancelDrag,onDoubleClick:W.onDoubleClick,onContextMenu:be,role:"group","aria-label":`${a.label} automation`,children:[d.jsx("title",{children:mIe(h)}),d.jsx("line",{x1:wl,x2:wl+e,y1:_+I/2,y2:_+I/2,stroke:"rgba(255,255,255,0.08)",strokeDasharray:"3 4"}),m?d.jsx("rect",{"data-automation-selection":"",x:j(m.t0),y:L(m.v1),width:Math.max(0,j(m.t1)-j(m.t0)),height:Math.max(0,L(m.v0)-L(m.v1)),fill:o,opacity:.15,stroke:o,strokeOpacity:.6,pointerEvents:"none"}):null,d.jsx(uIe,{path:$,lane:T,range:a,accentColor:o,activeSegment:le??ie,xOf:j,yOf:L}),T.points.map((ge,Pe)=>{const ve=dIe(ge,m),{radius:xe,stroke:we,strokeWidth:Ce}=pIe(ve,Pe===J);return d.jsx("circle",{"data-automation-point":Pe,...ve?{"data-automation-point-in-range":""}:{},cx:j(ge.t),cy:L(ge.v),r:xe,fill:o,stroke:we,strokeWidth:Ce,style:{cursor:h?"default":"grab",opacity:yIe({readOnly:h,hovered:Q,dragging:J!==null,hasRange:!!m})},onContextMenu:Me=>{Me.preventDefault(),Me.stopPropagation(),K(Pe)}},`${Pe}-${ge.t}`)}),l!==null&&me!==null?d.jsx("circle",{"data-automation-playhead":"",cx:j(l),cy:L(me),r:2.5,fill:"#fff",opacity:.8,pointerEvents:"none"}):null]}),Z?d.jsx(sIe,{text:Z.text,leftPx:n+j(((pe=T.points[Z.index])==null?void 0:pe.t)??0)-wl-18,label:a.label,onChange:W.setEditingText,onCommit:W.commitEdit,onCancel:W.cancelEdit}):null,U?d.jsx("div",{className:"hf-automation-hint pointer-events-none absolute rounded-[3px] bg-black/80 px-1 py-0.5 font-mono text-[9px] text-white",style:{left:n+6,top:2,zIndex:3},children:U}):null,d.jsx(gIe,{readOnly:h,note:p,hovered:Q,hasRange:!!m,leftPx:n,widthPx:e}),ee&&m?d.jsx(lIe,{x:ee.x,y:ee.y,onClose:()=>re(null),onInsertShape:se,onSimplify:fe,canSimplify:Z6(T,m.t0,m.t1).length>=3}):null]})}const PX={version:1,lanes:[]},vIe=new Map,AIe=new Map,SIe=64;function Qce(t,e,n){const r=t.get(e);if(r!==void 0)return t.delete(e),t.set(e,r),r;const i=n();if(t.size>=SIe){const s=t.keys().next();s.done||t.delete(s.value)}return t.set(e,i),i}function GE(t){const e=t.fxChain;return e?Qce(vIe,e,()=>{try{return pE(e)}catch{return null}}):null}function zce(t){const e=t.automation;if(!e)return PX;const n=GE(t);return Qce(AIe,`${e}\0${t.fxChain??""}`,()=>{try{const r=Vse(Hse(e),n??void 0);return{...r,lanes:wIe(r.lanes,n)}}catch{return PX}})}function C_(t,e){return((e==null?void 0:e.nodes)??[]).some(n=>n.fromCarve&&n.id&&t.startsWith(`fx.${n.id}.`))}function Zce(t){return zce(t).lanes}function Gce(t,e){var s;const n=py(t);if(!n||n.kind!=="fx")return null;const r=e==null?void 0:e.nodes.find(a=>a.id===n.nodeId),i=(s=r==null?void 0:r.params)==null?void 0:s.frequency;return typeof i=="number"?i:null}function wIe(t,e){const n=[],r=[];for(const i of t){const s=Gce(i.target,e);s===null?r.push(i):n.push({lane:i,freq:s})}return n.sort((i,s)=>s.freq-i.freq),[...n.map(i=>i.lane),...r]}function Uce(t){if(t<1e3)return`${Math.round(t)} Hz`;const e=t/1e3;return`${e>=10?Math.round(e):Number(e.toFixed(1))} kHz`}function Xce(t,e){const n=d0(t,e??void 0);if(!n)return null;const r=n.label.split(" · "),i=r.at(-1)??n.label,s=r.length>1?r.slice(0,-1).join(" · "):null,a=Gce(t,e),o=[s,a===null?null:Uce(a)].filter(Boolean).join(" ");return{name:o||i,param:o?i:""}}function OIe(t,e){return CIe(t,e)}function zf(t){const e=new Map;for(const n of t){if(!Jo(n))continue;const r=GE(n);for(const i of Zce(n)){const s=OIe(i.target,r),a=Xce(i.target,r);if(!s||!a)continue;const o=e.get(s);o?o.entries.push({element:n,lane:i}):e.set(s,{key:s,name:a.name,param:a.param,entries:[{element:n,lane:i}]})}}return[...e.values()]}function CIe(t,e){const n=Xce(t,e);return n?n.param?`${n.name} · ${n.param}`:n.name:null}function kIe({element:t,rows:e,isSelected:n,lanes:r,pps:i,top:s,accentColor:a,currentTime:o,beatTimes:l}){const c=x.useMemo(()=>(l??[]).filter(h=>h>=t.start&&h<=t.start+t.duration).map(h=>h-t.start),[l,t.start,t.duration]),u=r.bind(t,n);if(x.useEffect(()=>{var p;const h=(p=u.selection)==null?void 0:p.target;h!==void 0&&!u.lanes.some(y=>y.target===h)&&u.onRangeClear()},[u]),e.length===0)return null;const f=o>=t.start&&o<=t.start+t.duration;return d.jsx(d.Fragment,{children:e.map(({lane:h,rowIndex:p})=>{var m;const y=d0(h.target,u.chain??void 0);return y?d.jsx(bIe,{duration:t.duration,widthPx:Math.max(t.duration*i,4),leftPx:t.start*i,topPx:s+p*Pd,automation:u.automation,target:h.target,range:y,accentColor:a,playheadSec:f?o-t.start:null,onPreview:u.onPreview,onCommit:u.onCommit,onSelect:u.onSelect,snapTimes:c,readOnly:u.readOnly||C_(h.target,u.chain),readOnlyNote:C_(h.target,u.chain)?"Owned by the voiceover carve — re-derived on every analysis. Change strength in the FX rack, or turn the carve off to edit these by hand.":u.readOnly?"Read-only here.":void 0,rangeSelection:((m=u.selection)==null?void 0:m.target)===h.target?{t0:u.selection.t0,t1:u.selection.t1,v0:u.selection.v0,v1:u.selection.v1}:null,onRangeSelect:(v,b,w,O)=>u.onRangeSelect(h.target,v,b,w,O),onRangeClear:u.onRangeClear},h.target):null})})}function Wce({elements:t,isSelected:e,lanes:n,pps:r,laneCount:i,topOffset:s,accentColor:a,currentTime:o,beatTimes:l}){const c=t.filter(Jo),u=new Map;zf(c).forEach((h,p)=>{for(const y of h.entries){const m=Zn(y.element),v=u.get(m);v?v.push({lane:y.lane,rowIndex:p}):u.set(m,[{lane:y.lane,rowIndex:p}])}});const f=s??kg(i);return d.jsx(d.Fragment,{children:c.map(h=>d.jsx(kIe,{element:h,rows:u.get(Zn(h))??[],isSelected:e(h),lanes:n,pps:r,top:f,accentColor:a,currentTime:o,beatTimes:l},Zn(h)))})}const zL=Rc("DomEditActionsContext",null),ZL=Rc("DomEditSelectionContext",null);function vS(){const t=x.useContext(zL);if(!t)throw new Error("useDomEditActionsContext must be used within DomEditProvider");return t}function AS(){return x.useContext(zL)}function Ay(){const t=x.useContext(ZL);if(!t)throw new Error("useDomEditSelectionContext must be used within DomEditProvider");return t}function qce(){return x.useContext(ZL)}function UE(){return{...vS(),...Ay()}}function EIe({value:{domEditSelection:t,domEditGroupSelections:e,domEditHoverSelection:n,agentModalOpen:r,agentModalAnchorPoint:i,copiedAgentPrompt:s,agentPromptSelectionContext:a,domEditSelectionRef:o,handleTimelineElementSelect:l,handlePreviewCanvasMouseDown:c,handlePreviewCanvasPointerMove:u,handlePreviewCanvasPointerLeave:f,applyDomSelection:h,clearDomSelection:p,handleDomStyleCommit:y,handleDomAttributeCommit:m,handleDomAttributeLiveCommit:v,handleDomAttributeQuietCommit:b,handleDomHtmlAttributeCommit:w,handleDomAttributesCommit:O,handleDomPathOffsetCommit:k,handleDomGroupPathOffsetCommit:E,handleDomZIndexReorderCommit:T,handleDomBoxSizeCommit:N,handleDomRotationCommit:_,handleDomManualEditsReset:I,handleDomTextCommit:j,handleDomRichTextCommit:L,handleDomTextFieldStyleCommit:B,handleDomAddTextField:$,handleDomRemoveTextField:z,handleAskAgent:Y,handleAgentModalSubmit:W,handleBlockedDomMove:J,handleDomManualDragStart:ne,handleDomEditElementDelete:le,handleGroupSelection:ie,handleUngroupSelection:q,setActiveGroupElement:F,activeGroupElement:U,buildDomSelectionFromTarget:Z,buildDomSelectionForTimelineElement:K,updateDomEditHoverSelection:ee,resolveImportedFontAsset:re,setAgentModalOpen:Q,setAgentPromptSelectionContext:H,setAgentModalAnchorPoint:se,selectedGsapAnimations:fe,gsapMultipleTimelines:be,gsapUnsupportedTimelinePattern:me,handleGsapUpdateProperty:pe,handleGsapUpdateMeta:ge,handleGsapDeleteAnimation:Pe,handleGsapDeleteAllForElement:ve,handleGsapAddAnimation:xe,handleGsapAddProperty:we,handleGsapRemoveProperty:Ce,handleGsapUpdateFromProperty:Me,handleGsapAddFromProperty:Ve,handleGsapRemoveFromProperty:tt,handleGsapAddKeyframe:Ze,handleGsapAddKeyframeBatch:qe,handleGsapRemoveKeyframe:pt,handleGsapMoveKeyframeToPlayhead:it,handleGsapMoveKeyframe:vt,handleGsapResizeKeyframedTween:Ot,handleGsapConvertToKeyframes:Kt,handleGsapRemoveAllKeyframes:qt,handleResetSelectedElementKeyframes:fn,commitAnimatedProperty:Jt,commitAnimatedProperties:Je,handleSetArcPath:St,handleUpdateArcSegment:At,handleUnroll:Ke,invalidateGsapCache:Be,previewIframeRef:We,commitMutation:Ye,applyMarqueeSelection:Zt,handleUpdateKeyframeEase:Te,handleUpdateSegmentEase:De,handleSetAllKeyframeEases:ze},children:st}){const Gt=x.useRef(Ye);Gt.current=Ye;const ln=x.useCallback((Mr,mt)=>Gt.current(Mr,mt),[]),Yt=x.useMemo(()=>({handleTimelineElementSelect:l,handlePreviewCanvasMouseDown:c,handlePreviewCanvasPointerMove:u,handlePreviewCanvasPointerLeave:f,applyDomSelection:h,clearDomSelection:p,handleDomStyleCommit:y,handleDomAttributeCommit:m,handleDomAttributeLiveCommit:v,handleDomAttributeQuietCommit:b,handleDomHtmlAttributeCommit:w,handleDomAttributesCommit:O,handleDomPathOffsetCommit:k,handleDomGroupPathOffsetCommit:E,handleDomZIndexReorderCommit:T,handleDomBoxSizeCommit:N,handleDomRotationCommit:_,handleDomManualEditsReset:I,handleDomTextCommit:j,handleDomRichTextCommit:L,handleDomTextFieldStyleCommit:B,handleDomAddTextField:$,handleDomRemoveTextField:z,handleAskAgent:Y,handleAgentModalSubmit:W,handleBlockedDomMove:J,handleDomManualDragStart:ne,handleDomEditElementDelete:le,handleGroupSelection:ie,handleUngroupSelection:q,setActiveGroupElement:F,buildDomSelectionFromTarget:Z,buildDomSelectionForTimelineElement:K,updateDomEditHoverSelection:ee,resolveImportedFontAsset:re,setAgentModalOpen:Q,setAgentPromptSelectionContext:H,setAgentModalAnchorPoint:se,handleGsapUpdateProperty:pe,handleGsapUpdateMeta:ge,handleGsapDeleteAnimation:Pe,handleGsapDeleteAllForElement:ve,handleGsapAddAnimation:xe,handleGsapAddProperty:we,handleGsapRemoveProperty:Ce,handleGsapUpdateFromProperty:Me,handleGsapAddFromProperty:Ve,handleGsapRemoveFromProperty:tt,handleGsapAddKeyframe:Ze,handleGsapAddKeyframeBatch:qe,handleGsapRemoveKeyframe:pt,handleGsapMoveKeyframeToPlayhead:it,handleGsapMoveKeyframe:vt,handleGsapResizeKeyframedTween:Ot,handleGsapConvertToKeyframes:Kt,handleGsapRemoveAllKeyframes:qt,handleResetSelectedElementKeyframes:fn,commitAnimatedProperty:Jt,commitAnimatedProperties:Je,handleSetArcPath:St,handleUpdateArcSegment:At,handleUnroll:Ke,invalidateGsapCache:Be,previewIframeRef:We,commitMutation:ln,applyMarqueeSelection:Zt,handleUpdateKeyframeEase:Te,handleUpdateSegmentEase:De,handleSetAllKeyframeEases:ze}),[l,c,u,f,h,p,y,m,v,b,w,O,k,E,T,N,_,I,j,L,B,$,z,Y,W,J,ne,le,ie,q,F,Z,K,ee,re,Q,H,se,pe,ge,Pe,ve,xe,we,Ce,Me,Ve,tt,Ze,qe,pt,it,vt,Ot,Kt,qt,fn,Jt,Je,St,At,Ke,Be,We,ln,Zt,Te,De,ze]),Nn=x.useMemo(()=>({domEditSelection:t,domEditGroupSelections:e,domEditHoverSelection:n,activeGroupElement:U,domEditSelectionRef:o,selectedGsapAnimations:fe,gsapMultipleTimelines:be,gsapUnsupportedTimelinePattern:me,agentModalOpen:r,agentModalAnchorPoint:i,copiedAgentPrompt:s,agentPromptSelectionContext:a}),[t,e,n,U,o,fe,be,me,r,i,s,a]);return d.jsx(zL,{value:Yt,children:d.jsx(ZL,{value:Nn,children:st})})}function Zf(t){const e=PIe(t);return e?e.isContentEditable?!0:e.closest(TIe)!==null:!1}const TIe=["input","textarea","select","[contenteditable]:not([contenteditable='false'])","[role='textbox']","[role='searchbox']","[role='combobox']",".cm-editor"].join(",");function PIe(t){return!t||typeof t!="object"?null:typeof t.closest=="function"?t:null}function Yce(t){return t.label||t.id||t.tag}function MX(t){const e=t.trim(),n=/^[a-z]+:\/\//i.test(e)?new URL(e).pathname:e;return decodeURIComponent(n).replace(/\\/g,"/").replace(/^\.?\//,"")}function MIe(t,e){const n=MX(t).split("/").filter(Boolean),r=MX(e).split("/").filter(Boolean);for(n.pop();n.length>0&&r.length>0&&n[0]===r[0];)n.shift(),r.shift();return[...n.map(()=>".."),...r].join("/")||e}function NIe(t){return/^(?:\/|[A-Za-z]:[\\/]|\\\\)/.test(t)}function DIe(t,e){const n=e.trim();if(!n)return;const r=n.replace(/\\/g,"/");if(NIe(r))return r;const i=t==null?void 0:t.trim().replace(/\\/g,"/").replace(/\/+$/,"");if(i)return`${i}/${r.replace(/^\.?\//,"")}`}function k_(t,e){const n=e.trim();return n&&(["border-radius","border-width","font-size","letter-spacing"].includes(t)&&/^-?\d+(\.\d+)?$/.test(n)?`${n}px`:n)}function IIe(t){return/^url\(/i.test(t.trim())}function _Ie(t){return t==="left"||t==="top"||t==="width"||t==="height"}function Kce(t){if(!t||typeof t!="object")return null;const e=t;return e.nodeType===1?t:e.nodeType===3&&e.parentElement?e.parentElement:null}function Jce(t){return Zf(t)}function qO(t){const n=typeof navigator<"u"&&/Mac|iPhone|iPad|iPod/i.test(navigator.platform)?"Cmd":"Ctrl";return t==="undo"?`${n}+Z`:`${n}+Shift+Z`}function RIe(t,e,n){return t.id?e.domId===t.id&&(e.sourceFile||"index.html")===n:!1}function jIe(t,e){return!t.isCompositionHost||!t.compositionSrc?!1:e.compositionSrc===t.compositionSrc}function LIe(t,e){return t.selector?e.selector===t.selector&&(e.selectorIndex??0)===(t.selectorIndex??0)&&(e.sourceFile??"index.html")===t.sourceFile:!1}function GL(t,e){const n=t.sourceFile||"index.html",r=t.id?e.find(a=>RIe(t,a,n)):void 0;if(r)return r.key??r.id;const i=t.selector?e.find(a=>LIe(t,a)):void 0;if(i)return i.key??i.id;const s=e.find(a=>jIe(t,a));return s?s.key??s.id:t.id&&n!=="index.html"?`${n}#${t.id}`:null}function eue(t,e,n){let r=(t==null?void 0:t.parentElement)??null;for(;r;){const i=r.id;if(i){const s=e.find(a=>a.domId===i&&(a.sourceFile??"index.html")===n);if(s)return s.key??s.id}r=r.parentElement}return null}function U6(t,e,n){return GL(t,e)??eue(t.element,e,t.sourceFile||n||"index.html")}function FIe(t,e,n){return t.map(r=>U6(r,e,n)).filter(r=>r!==null)}function $Ie(t,e){if(!e||!Number.isFinite(e.start)||!Number.isFinite(e.duration))return null;const n=Math.max(0,e.start),r=Math.max(n,n+Math.max(0,e.duration)),i=Number.isFinite(t)?t:n;return Tr(i,n,r)}function Tr(t,e,n){return ne[1]??"")}const YO={image:3,video:5,audio:5};async function NX(t,e,n){if(n==="image")return YO.image;const r=document.createElement(n==="video"?"video":"audio");r.preload="metadata",r.src=`/api/projects/${t}/preview/${e}`;const i=await new Promise(s=>{const a=window.setTimeout(()=>s(YO[n]),3e3),o=l=>{window.clearTimeout(a),s(l)};r.addEventListener("loadedmetadata",()=>{const l=Number(r.duration);o(Number.isFinite(l)&&l>0?va(l):YO[n])},{once:!0}),r.addEventListener("error",()=>o(YO[n]),{once:!0})});return r.src="",r.load(),i}function BIe(t=()=>`automation-gesture:${++VIe}`){let e=null;const n=r=>({key:r,ms:Number.POSITIVE_INFINITY});return{live:()=>(e??(e=t()),n(e)),commit:()=>{const r=e??t();return e=null,n(r)}}}let VIe=0;function HIe(){var c;const t=x.useRef(BIe()),e=AS(),n=((c=qce())==null?void 0:c.domEditSelection)??null,r=ue(u=>u.elements),i=ue(u=>u.automationSelection),s=ue(u=>u.setAutomationSelection),a=ue(u=>u.clearAutomationSelection),o=x.useMemo(()=>n?U6(n,r,null):null,[n,r]),l=x.useCallback((u,f)=>{const h=GE(u),p=zce(u),y=Zn(u),m=(v,b)=>{if(!e||!f)return;const w=v.lanes.length>0?Qse(v):"",O=b?t.current.commit():t.current.live();b?e.handleDomAttributeQuietCommit(so,w,O):e.handleDomAttributeLiveCommit(so,w||null,void 0,{coalesce:O,previewOnly:!0})};return{automation:p,lanes:p.lanes,chain:h,onPreview:v=>m(v,!1),onCommit:v=>m(v,!0),onSelect:()=>void(e==null?void 0:e.handleTimelineElementSelect(u)),readOnly:!e||!f,commitTargetKey:e?o:null,selection:(i==null?void 0:i.elementKey)===y?i:null,onRangeSelect:(v,b,w,O,k)=>{e&&s({elementKey:y,target:v,t0:b,t1:w,v0:O,v1:k})},onRangeClear:()=>a()}},[e,o,i,s,a]);return x.useMemo(()=>({bind:l}),[l])}let DX=null,XL=null,Lp=null;function tue(t){t!==DX&&(DX=t,XL=null,Lp=null)}function QIe(t,e,n,r,i){const s=Z6(e,r,i).map(a=>({...a,t:a.t-r}));return s.length===0&&e.points.length===0?!1:(tue(t),XL={sourceRange:n,span:i-r,points:s.length>0?s:[{t:0,v:Bf(e,r,n.scale)},{t:i-r,v:Bf(e,i,n.scale)}]},!0)}function nue(t){return tue(t),XL}function zIe(t,e,n){return t.points.map(r=>({...r,t:n+r.t,v:ZE(e,Ac(t.sourceRange,r.v))}))}function ZIe(t){Lp={...t}}function GIe(t){return Lp?Lp.elementKey===t.elementKey&&Lp.target===t.target&&Lp.t0===t.t0&&Lp.t1===t.t1:!1}function rue(t){if(!t)return!1;const e=t.tagName;return e==="INPUT"||e==="TEXTAREA"||e==="SELECT"?!0:t instanceof HTMLElement&&t.isContentEditable}function X6(t,e){return(t.metaKey||t.ctrlKey)&&!t.shiftKey&&!t.altKey&&t.key.toLowerCase()===e}function WL(t){return t.key??t.id}function qL(t,e){return e?t.find(n=>WL(n)===e)??null:null}function iue(t,e,n){const r=qL(t.elements,n.elementKey);if(!r)return null;const i=e.bind(r,n.elementKey===t.selectedElementId);if(i.readOnly)return null;const s=d0(n.target,i.chain??void 0);return s?{binding:i,lane:BL(i.automation,n.target),range:s}:null}function UIe(t,e,n){const r=iue(t,e,n);if(!r)return null;const i=r.lane.points.filter(s=>!Dg(s,n));return i.length===r.lane.points.length?null:{onCommit:r.binding.onCommit,next:VL(r.binding.automation,{target:n.target,points:i})}}function XIe(t,e,n){var r;return n&&n.elementKey===e?n.target:(r=t.lanes[0])==null?void 0:r.target}function WIe(t,e,n){const r=qL(t.elements,t.selectedElementId);if(!r)return null;const i=WL(r),s=e.bind(r,!0);if(s.readOnly||s.commitTargetKey!==i)return null;const a=XIe(s,i,n);if(!a)return null;const o=d0(a,s.chain??void 0);return o?{elementKey:i,element:r,target:a,binding:s,lane:BL(s.automation,a),range:o}:null}function qIe(t,e){return t.currentTime>=e.start&&t.currentTime<=e.start+e.duration}function sue(t,e,n,r){if(n>e.duration)return null;const s=r!==null&&r.elementKey===WL(e)?GIe(r)?r.t1:r.t0:qIe(t,e)?t.currentTime-e.start:null;return s===null?null:Tr(s,0,e.duration-n)}function YIe(t,e,n){if(!X6(t,"v"))return!1;const r=nue(e.timelineProjectId);if(!r)return!1;const i=e.automationSelection,s=WIe(e,n,i);if(!s)return!1;const a=sue(e,s.element,r.span,i);if(a===null)return!1;const o=a+r.span,l=zIe(r,s.range,a),c=G6({lane:s.lane,range:s.range,t0:a,t1:o,inner:l});t.preventDefault(),t.stopImmediatePropagation(),s.binding.onCommit(VL(s.binding.automation,{target:s.target,points:c}));const u={elementKey:s.elementKey,target:s.target,t0:a,t1:o,v0:s.range.min,v1:s.range.max};return e.setAutomationSelection(u),ZIe(u),!0}function KIe(t,e,n,r){if(!X6(t,"c"))return!1;const i=iue(e,n,r);return!i||!QIe(e.timelineProjectId,i.lane,i.range,r.t0,r.t1)?!1:(t.preventDefault(),t.stopImmediatePropagation(),!0)}function JIe(t){if(rue(document.activeElement))return!1;const e=ue.getState();if(X6(t,"c"))return e.automationSelection!==null;if(!X6(t,"v"))return!1;const n=nue(e.timelineProjectId);if(!n)return!1;const r=qL(e.elements,e.selectedElementId);return r?sue(e,r,n.span,e.automationSelection)!==null:!1}function e_e(t,e,n,r){if(!(t.key==="Delete"||t.key==="Backspace")||t.metaKey||t.ctrlKey)return!1;const s=UIe(e,n,r);return s?(t.preventDefault(),t.stopImmediatePropagation(),s.onCommit(s.next),!0):!1}function t_e({lanes:t}){x.useEffect(()=>{const e=n=>{if(rue(document.activeElement)||n.defaultPrevented)return;const r=ue.getState();if(YIe(n,r,t))return;const i=r.automationSelection;if(i){if(n.key==="Escape"){r.clearAutomationSelection();return}KIe(n,r,t,i)||e_e(n,r,t,i)}};return document.addEventListener("keydown",e,!0),()=>document.removeEventListener("keydown",e,!0)},[t])}const XE="data-fx-carve",n_e=[160,250,400,630,1e3,1600,2500,4e3,6e3],ei=4096,r_e=2048,i_e=/sfx|foley|whoosh|impact|riser|stinger|swoosh|thud|boom|click|ding|beep|ambien|room[-_ ]?tone/i,s_e="(?`${s_e}${t}${a_e}`,o_e=new RegExp(`music|bgm|${tv("bed")}|soundtrack|score|${tv("song")}|theme|instrumental|track\\d`,"i"),l_e=new RegExp(`voice|${tv("vo")}|${tv("vox")}|narrat|speech|dialog|monolog|announce|${tv("tts")}|talk|interview|podcast|recap|script`,"i");function w0(...t){const e=t.filter(Boolean).join(" ");return l_e.test(e)?"voice":i_e.test(e)?"sfx":o_e.test(e)?"music":"unknown"}function c_e(t,e){const n=r=>typeof r.duration=="number"&&Number.isFinite(r.duration)?r.start+Math.max(0,r.duration):Number.POSITIVE_INFINITY;return t.start{const l=typeof o=="number"?o:Number(o);return Number.isFinite(l)?l:null};if(t==null)return{...Ig};const r=n(t==null?void 0:t.strength),i=n(t==null?void 0:t.maxCutDb),s=r!==null?r:i!==null?(i-2)/16:Ig.strength,a=Array.isArray(t==null?void 0:t.sources)?t.sources:typeof(e==null?void 0:e.source)=="string"?[e.source]:[];return{enabled:(t==null?void 0:t.enabled)!==!1,sources:a.filter(o=>typeof o=="string"&&o!==""),strength:Math.min(1,Math.max(0,s))}}function d_e(t,e){const n=t.map(s=>({samples:s.samples,at:Math.round(s.offsetSeconds*e)})),r=n.reduce((s,a)=>Math.max(s,a.at+a.samples.length),0);if(r<=0)return new Float32Array(0);const i=new Float32Array(r);for(const{samples:s,at:a}of n){const o=a<0?-a:0;for(let l=o;l=r||(i[c]=(i[c]??0)+(s[l]??0))}}return i}function p_e(t,e){const n=Math.max(t.length,ei),r=t.length>=ei?t:(()=>{const h=new Float32Array(ei);return h.set(t),h})(),i=new Float32Array(ei);for(let h=0;h>1;for(;i&s;s>>=1)i^=s;i^=s,r=r&&t[o]0?s/a:0}const m_e=30;function g_e(t,e){const n=Math.log2(t/2e3),r=Math.exp(-(n*n)/2);return e*m_e*(1-r)}function y_e(t,e,n){if(t.length===0)return[];const{freqs:r,power:i}=p_e(t,e),a=n_e.map(l=>{const c=lue(r,i,l);return{center:l,hasEnergy:c>0,scoreDb:c>0?10*Math.log10(c)-g_e(l,n.intelligibilityBias):Number.NEGATIVE_INFINITY}}).sort((l,c)=>c.scoreDb-l.scoreDb).slice(0,Math.max(1,n.bands)).filter(l=>l.hasEnergy);if(a.length===0)return[];const o=a[0].scoreDb;return a.map(({center:l,scoreDb:c})=>{const u=Math.pow(10,(c-o)/10),f=Math.min(n.maxCutDb,Math.max(n.maxCutDb/2,n.maxCutDb*u));return{freq:l,gainDb:-Number(f.toFixed(2)),q:n.q}}).sort((l,c)=>l.freq-c.freq)}const cue=30,uue=.05,x_e=.25,b_e=1.6,fue=400,M4=.2,hue=.5;function due(t,e){const n=[{t:0,v:0}];let r=0,i=-1;return t.forEach((s,a)=>{a!==t.length-1&&Math.abs(s.v-r)0&&i!==a-1&&n.push(t[a-1]),n.push(s),r=s.v,i=a)}),n}function v_e(t,e,n){if(t.length===0||n.length===0)return[];const r=new Float32Array(ei);for(let y=0;y[]),c=new Float64Array(ei),u=new Float64Array(ei);for(let y=0;yl[b].push(lue(a,m,v.freq)))}const f=t.length/e,h=1-Math.exp(-(i/e)/uue),p=1-Math.exp(-(i/e)/x_e);return n.map((y,m)=>{const v=l[m],b=Math.max(...v);let w=0;const O=[];v.forEach((E,T)=>{const N=E>0&&b>0?Math.max(0,1+10*Math.log10(E/b)/cue):0;w+=(N>w?h:p)*(N-w);const _=y.gainDb*w,I=Math.abs(_)0?20*Math.log10(s):Number.NEGATIVE_INFINITY}function A_e(t,e,n,r,i){if(t.length===0||r.duckDb<=0)return[];const s=Math.max(ei,Math.ceil(t.length/fue)),a=Math.round(i*n),o=[],l=[],c=[];for(let T=0;T{const _=l[N]??Number.NEGATIVE_INFINITY,I=T>f&&Number.isFinite(_)?_-(T-r.headroomDb):0,j=Math.min(r.duckDb,Math.max(0,I));y+=(j>y?h:p)*(j-y);const L=y=M4;)y+=p*-y,b+=v,m.push({t:Number(b.toFixed(3)),v:y=E||w.push({t:E,v:0}),w}function S_e(t){const e=t.map(n=>({type:"peaking",enabled:!0,params:{...$f("peaking"),frequency:n.freq,gain:n.gainDb,q:n.q}}));return{version:h0,nodes:e}}const w_e=new Map([["bold",x.createElement(x.Fragment,null,x.createElement("path",{d:"M244,56v48a12,12,0,0,1-12,12H184a12,12,0,1,1,0-24H201.1l-19-17.38c-.13-.12-.26-.24-.38-.37A76,76,0,1,0,127,204h1a75.53,75.53,0,0,0,52.15-20.72,12,12,0,0,1,16.49,17.45A99.45,99.45,0,0,1,128,228h-1.37A100,100,0,1,1,198.51,57.06L220,76.72V56a12,12,0,0,1,24,0Z"}))],["duotone",x.createElement(x.Fragment,null,x.createElement("path",{d:"M216,128a88,88,0,1,1-88-88A88,88,0,0,1,216,128Z",opacity:"0.2"}),x.createElement("path",{d:"M240,56v48a8,8,0,0,1-8,8H184a8,8,0,0,1,0-16H211.4L184.81,71.64l-.25-.24a80,80,0,1,0-1.67,114.78,8,8,0,0,1,11,11.63A95.44,95.44,0,0,1,128,224h-1.32A96,96,0,1,1,195.75,60L224,85.8V56a8,8,0,1,1,16,0Z"}))],["fill",x.createElement(x.Fragment,null,x.createElement("path",{d:"M240,56v48a8,8,0,0,1-8,8H184a8,8,0,0,1-5.66-13.66l17-17-10.55-9.65-.25-.24a80,80,0,1,0-1.67,114.78,8,8,0,1,1,11,11.63A95.44,95.44,0,0,1,128,224h-1.32A96,96,0,1,1,195.75,60l10.93,10L226.34,50.3A8,8,0,0,1,240,56Z"}))],["light",x.createElement(x.Fragment,null,x.createElement("path",{d:"M238,56v48a6,6,0,0,1-6,6H184a6,6,0,0,1,0-12h32.55l-30.38-27.8c-.06-.06-.12-.13-.19-.19a82,82,0,1,0-1.7,117.65,6,6,0,0,1,8.24,8.73A93.46,93.46,0,0,1,128,222h-1.28A94,94,0,1,1,194.37,61.4L226,90.35V56a6,6,0,1,1,12,0Z"}))],["regular",x.createElement(x.Fragment,null,x.createElement("path",{d:"M240,56v48a8,8,0,0,1-8,8H184a8,8,0,0,1,0-16H211.4L184.81,71.64l-.25-.24a80,80,0,1,0-1.67,114.78,8,8,0,0,1,11,11.63A95.44,95.44,0,0,1,128,224h-1.32A96,96,0,1,1,195.75,60L224,85.8V56a8,8,0,1,1,16,0Z"}))],["thin",x.createElement(x.Fragment,null,x.createElement("path",{d:"M236,56v48a4,4,0,0,1-4,4H184a4,4,0,0,1,0-8h37.7L187.53,68.69l-.13-.12a84,84,0,1,0-1.75,120.51,4,4,0,0,1,5.5,5.82A91.43,91.43,0,0,1,128,220h-1.26A92,92,0,1,1,193,62.84l35,32.05V56a4,4,0,1,1,8,0Z"}))]]),O_e=new Map([["bold",x.createElement(x.Fragment,null,x.createElement("path",{d:"M228,128a100,100,0,0,1-98.66,100H128a99.39,99.39,0,0,1-68.62-27.29,12,12,0,0,1,16.48-17.45,76,76,0,1,0-1.57-109c-.13.13-.25.25-.39.37L54.89,92H72a12,12,0,0,1,0,24H24a12,12,0,0,1-12-12V56a12,12,0,0,1,24,0V76.72L57.48,57.06A100,100,0,0,1,228,128Z"}))],["duotone",x.createElement(x.Fragment,null,x.createElement("path",{d:"M216,128a88,88,0,1,1-88-88A88,88,0,0,1,216,128Z",opacity:"0.2"}),x.createElement("path",{d:"M224,128a96,96,0,0,1-94.71,96H128A95.38,95.38,0,0,1,62.1,197.8a8,8,0,0,1,11-11.63A80,80,0,1,0,71.43,71.39a3.07,3.07,0,0,1-.26.25L44.59,96H72a8,8,0,0,1,0,16H24a8,8,0,0,1-8-8V56a8,8,0,0,1,16,0V85.8L60.25,60A96,96,0,0,1,224,128Z"}))],["fill",x.createElement(x.Fragment,null,x.createElement("path",{d:"M224,128a96,96,0,0,1-94.71,96H128A95.38,95.38,0,0,1,62.1,197.8a8,8,0,0,1,11-11.63A80,80,0,1,0,71.43,71.39a3.07,3.07,0,0,1-.26.25L60.63,81.29l17,17A8,8,0,0,1,72,112H24a8,8,0,0,1-8-8V56A8,8,0,0,1,29.66,50.3L49.31,70,60.25,60A96,96,0,0,1,224,128Z"}))],["light",x.createElement(x.Fragment,null,x.createElement("path",{d:"M222,128a94,94,0,0,1-92.74,94H128a93.43,93.43,0,0,1-64.5-25.65,6,6,0,1,1,8.24-8.72A82,82,0,1,0,70,70l-.19.19L39.44,98H72a6,6,0,0,1,0,12H24a6,6,0,0,1-6-6V56a6,6,0,0,1,12,0V90.34L61.63,61.4A94,94,0,0,1,222,128Z"}))],["regular",x.createElement(x.Fragment,null,x.createElement("path",{d:"M224,128a96,96,0,0,1-94.71,96H128A95.38,95.38,0,0,1,62.1,197.8a8,8,0,0,1,11-11.63A80,80,0,1,0,71.43,71.39a3.07,3.07,0,0,1-.26.25L44.59,96H72a8,8,0,0,1,0,16H24a8,8,0,0,1-8-8V56a8,8,0,0,1,16,0V85.8L60.25,60A96,96,0,0,1,224,128Z"}))],["thin",x.createElement(x.Fragment,null,x.createElement("path",{d:"M220,128a92,92,0,0,1-90.77,92H128a91.47,91.47,0,0,1-63.13-25.1,4,4,0,1,1,5.5-5.82A84,84,0,1,0,68.6,68.57l-.13.12L34.3,100H72a4,4,0,0,1,0,8H24a4,4,0,0,1-4-4V56a4,4,0,0,1,8,0V94.89l35-32A92,92,0,0,1,220,128Z"}))]]),C_e=new Map([["bold",x.createElement(x.Fragment,null,x.createElement("path",{d:"M228,128a12,12,0,0,1-12,12H69l51.52,51.51a12,12,0,0,1-17,17l-72-72a12,12,0,0,1,0-17l72-72a12,12,0,0,1,17,17L69,116H216A12,12,0,0,1,228,128Z"}))],["duotone",x.createElement(x.Fragment,null,x.createElement("path",{d:"M112,56V200L40,128Z",opacity:"0.2"}),x.createElement("path",{d:"M216,120H120V56a8,8,0,0,0-13.66-5.66l-72,72a8,8,0,0,0,0,11.32l72,72A8,8,0,0,0,120,200V136h96a8,8,0,0,0,0-16ZM104,180.69,51.31,128,104,75.31Z"}))],["fill",x.createElement(x.Fragment,null,x.createElement("path",{d:"M224,128a8,8,0,0,1-8,8H120v64a8,8,0,0,1-13.66,5.66l-72-72a8,8,0,0,1,0-11.32l72-72A8,8,0,0,1,120,56v64h96A8,8,0,0,1,224,128Z"}))],["light",x.createElement(x.Fragment,null,x.createElement("path",{d:"M222,128a6,6,0,0,1-6,6H54.49l61.75,61.76a6,6,0,1,1-8.48,8.48l-72-72a6,6,0,0,1,0-8.48l72-72a6,6,0,0,1,8.48,8.48L54.49,122H216A6,6,0,0,1,222,128Z"}))],["regular",x.createElement(x.Fragment,null,x.createElement("path",{d:"M224,128a8,8,0,0,1-8,8H59.31l58.35,58.34a8,8,0,0,1-11.32,11.32l-72-72a8,8,0,0,1,0-11.32l72-72a8,8,0,0,1,11.32,11.32L59.31,120H216A8,8,0,0,1,224,128Z"}))],["thin",x.createElement(x.Fragment,null,x.createElement("path",{d:"M220,128a4,4,0,0,1-4,4H49.66l65.17,65.17a4,4,0,0,1-5.66,5.66l-72-72a4,4,0,0,1,0-5.66l72-72a4,4,0,0,1,5.66,5.66L49.66,124H216A4,4,0,0,1,220,128Z"}))]]),k_e=new Map([["bold",x.createElement(x.Fragment,null,x.createElement("path",{d:"M87.51,64.49a12,12,0,0,1,0-17l32-32a12,12,0,0,1,17,0l32,32a12,12,0,0,1-17,17L140,53V96a12,12,0,0,1-24,0V53L104.49,64.49A12,12,0,0,1,87.51,64.49Zm64,127L140,203V160a12,12,0,0,0-24,0v43l-11.51-11.52a12,12,0,0,0-17,17l32,32a12,12,0,0,0,17,0l32-32a12,12,0,0,0-17-17Zm89-72-32-32a12,12,0,0,0-17,17L203,116H160a12,12,0,0,0,0,24h43l-11.52,11.51a12,12,0,0,0,17,17l32-32A12,12,0,0,0,240.49,119.51ZM53,140H96a12,12,0,0,0,0-24H53l11.52-11.51a12,12,0,1,0-17-17l-32,32a12,12,0,0,0,0,17l32,32a12,12,0,1,0,17-17Z"}))],["duotone",x.createElement(x.Fragment,null,x.createElement("path",{d:"M232,128,128,232,24,128,128,24Z",opacity:"0.2"}),x.createElement("path",{d:"M90.34,61.66a8,8,0,0,1,0-11.32l32-32a8,8,0,0,1,11.32,0l32,32a8,8,0,0,1-11.32,11.32L136,43.31V96a8,8,0,0,1-16,0V43.31L101.66,61.66A8,8,0,0,1,90.34,61.66Zm64,132.68L136,212.69V160a8,8,0,0,0-16,0v52.69l-18.34-18.35a8,8,0,0,0-11.32,11.32l32,32a8,8,0,0,0,11.32,0l32-32a8,8,0,0,0-11.32-11.32Zm83.32-72-32-32a8,8,0,0,0-11.32,11.32L212.69,120H160a8,8,0,0,0,0,16h52.69l-18.35,18.34a8,8,0,0,0,11.32,11.32l32-32A8,8,0,0,0,237.66,122.34ZM43.31,136H96a8,8,0,0,0,0-16H43.31l18.35-18.34A8,8,0,0,0,50.34,90.34l-32,32a8,8,0,0,0,0,11.32l32,32a8,8,0,0,0,11.32-11.32Z"}))],["fill",x.createElement(x.Fragment,null,x.createElement("path",{d:"M96,136H64v24a8,8,0,0,1-13.66,5.66l-32-32a8,8,0,0,1,0-11.32l32-32A8,8,0,0,1,64,96v24H96a8,8,0,0,1,0,16Zm0-72h24V96a8,8,0,0,0,16,0V64h24a8,8,0,0,0,5.66-13.66l-32-32a8,8,0,0,0-11.32,0l-32,32A8,8,0,0,0,96,64Zm141.66,58.34-32-32A8,8,0,0,0,192,96v24H160a8,8,0,0,0,0,16h32v24a8,8,0,0,0,13.66,5.66l32-32A8,8,0,0,0,237.66,122.34ZM160,192H136V160a8,8,0,0,0-16,0v32H96a8,8,0,0,0-5.66,13.66l32,32a8,8,0,0,0,11.32,0l32-32A8,8,0,0,0,160,192Z"}))],["light",x.createElement(x.Fragment,null,x.createElement("path",{d:"M91.76,60.24a6,6,0,0,1,0-8.48l32-32a6,6,0,0,1,8.48,0l32,32a6,6,0,1,1-8.48,8.48L134,38.49V96a6,6,0,0,1-12,0V38.49L100.24,60.24A6,6,0,0,1,91.76,60.24Zm64,135.52L134,217.51V160a6,6,0,0,0-12,0v57.51l-21.76-21.75a6,6,0,0,0-8.48,8.48l32,32a6,6,0,0,0,8.48,0l32-32a6,6,0,0,0-8.48-8.48Zm80.48-72-32-32a6,6,0,0,0-8.48,8.48L217.51,122H160a6,6,0,0,0,0,12h57.51l-21.75,21.76a6,6,0,1,0,8.48,8.48l32-32A6,6,0,0,0,236.24,123.76ZM38.49,134H96a6,6,0,0,0,0-12H38.49l21.75-21.76a6,6,0,0,0-8.48-8.48l-32,32a6,6,0,0,0,0,8.48l32,32a6,6,0,0,0,8.48-8.48Z"}))],["regular",x.createElement(x.Fragment,null,x.createElement("path",{d:"M90.34,61.66a8,8,0,0,1,0-11.32l32-32a8,8,0,0,1,11.32,0l32,32a8,8,0,0,1-11.32,11.32L136,43.31V96a8,8,0,0,1-16,0V43.31L101.66,61.66A8,8,0,0,1,90.34,61.66Zm64,132.68L136,212.69V160a8,8,0,0,0-16,0v52.69l-18.34-18.35a8,8,0,0,0-11.32,11.32l32,32a8,8,0,0,0,11.32,0l32-32a8,8,0,0,0-11.32-11.32Zm83.32-72-32-32a8,8,0,0,0-11.32,11.32L212.69,120H160a8,8,0,0,0,0,16h52.69l-18.35,18.34a8,8,0,0,0,11.32,11.32l32-32A8,8,0,0,0,237.66,122.34ZM43.31,136H96a8,8,0,0,0,0-16H43.31l18.35-18.34A8,8,0,0,0,50.34,90.34l-32,32a8,8,0,0,0,0,11.32l32,32a8,8,0,0,0,11.32-11.32Z"}))],["thin",x.createElement(x.Fragment,null,x.createElement("path",{d:"M93.17,58.83a4,4,0,0,1,0-5.66l32-32a4,4,0,0,1,5.66,0l32,32a4,4,0,0,1-5.66,5.66L132,33.66V96a4,4,0,0,1-8,0V33.66L98.83,58.83A4,4,0,0,1,93.17,58.83Zm64,138.34L132,222.34V160a4,4,0,0,0-8,0v62.34L98.83,197.17a4,4,0,0,0-5.66,5.66l32,32a4,4,0,0,0,5.66,0l32-32a4,4,0,0,0-5.66-5.66Zm77.66-72-32-32a4,4,0,0,0-5.66,5.66L222.34,124H160a4,4,0,0,0,0,8h62.34l-25.17,25.17a4,4,0,0,0,5.66,5.66l32-32A4,4,0,0,0,234.83,125.17ZM33.66,132H96a4,4,0,0,0,0-8H33.66L58.83,98.83a4,4,0,0,0-5.66-5.66l-32,32a4,4,0,0,0,0,5.66l32,32a4,4,0,1,0,5.66-5.66Z"}))]]),E_e=new Map([["bold",x.createElement(x.Fragment,null,x.createElement("path",{d:"M208,52H182.42L170,33.34A12,12,0,0,0,160,28H96a12,12,0,0,0-10,5.34L73.57,52H48A28,28,0,0,0,20,80V192a28,28,0,0,0,28,28H208a28,28,0,0,0,28-28V80A28,28,0,0,0,208,52Zm4,140a4,4,0,0,1-4,4H48a4,4,0,0,1-4-4V80a4,4,0,0,1,4-4H80a12,12,0,0,0,10-5.34L102.42,52h51.15L166,70.66A12,12,0,0,0,176,76h32a4,4,0,0,1,4,4ZM128,84a48,48,0,1,0,48,48A48.05,48.05,0,0,0,128,84Zm0,72a24,24,0,1,1,24-24A24,24,0,0,1,128,156Z"}))],["duotone",x.createElement(x.Fragment,null,x.createElement("path",{d:"M208,64H176L160,40H96L80,64H48A16,16,0,0,0,32,80V192a16,16,0,0,0,16,16H208a16,16,0,0,0,16-16V80A16,16,0,0,0,208,64ZM128,168a36,36,0,1,1,36-36A36,36,0,0,1,128,168Z",opacity:"0.2"}),x.createElement("path",{d:"M208,56H180.28L166.65,35.56A8,8,0,0,0,160,32H96a8,8,0,0,0-6.65,3.56L75.71,56H48A24,24,0,0,0,24,80V192a24,24,0,0,0,24,24H208a24,24,0,0,0,24-24V80A24,24,0,0,0,208,56Zm8,136a8,8,0,0,1-8,8H48a8,8,0,0,1-8-8V80a8,8,0,0,1,8-8H80a8,8,0,0,0,6.66-3.56L100.28,48h55.43l13.63,20.44A8,8,0,0,0,176,72h32a8,8,0,0,1,8,8ZM128,88a44,44,0,1,0,44,44A44.05,44.05,0,0,0,128,88Zm0,72a28,28,0,1,1,28-28A28,28,0,0,1,128,160Z"}))],["fill",x.createElement(x.Fragment,null,x.createElement("path",{d:"M208,56H180.28L166.65,35.56A8,8,0,0,0,160,32H96a8,8,0,0,0-6.65,3.56L75.71,56H48A24,24,0,0,0,24,80V192a24,24,0,0,0,24,24H208a24,24,0,0,0,24-24V80A24,24,0,0,0,208,56Zm-44,76a36,36,0,1,1-36-36A36,36,0,0,1,164,132Z"}))],["light",x.createElement(x.Fragment,null,x.createElement("path",{d:"M208,58H179.21L165,36.67A6,6,0,0,0,160,34H96a6,6,0,0,0-5,2.67L76.78,58H48A22,22,0,0,0,26,80V192a22,22,0,0,0,22,22H208a22,22,0,0,0,22-22V80A22,22,0,0,0,208,58Zm10,134a10,10,0,0,1-10,10H48a10,10,0,0,1-10-10V80A10,10,0,0,1,48,70H80a6,6,0,0,0,5-2.67L99.21,46h57.57L171,67.33A6,6,0,0,0,176,70h32a10,10,0,0,1,10,10ZM128,90a42,42,0,1,0,42,42A42,42,0,0,0,128,90Zm0,72a30,30,0,1,1,30-30A30,30,0,0,1,128,162Z"}))],["regular",x.createElement(x.Fragment,null,x.createElement("path",{d:"M208,56H180.28L166.65,35.56A8,8,0,0,0,160,32H96a8,8,0,0,0-6.65,3.56L75.71,56H48A24,24,0,0,0,24,80V192a24,24,0,0,0,24,24H208a24,24,0,0,0,24-24V80A24,24,0,0,0,208,56Zm8,136a8,8,0,0,1-8,8H48a8,8,0,0,1-8-8V80a8,8,0,0,1,8-8H80a8,8,0,0,0,6.66-3.56L100.28,48h55.43l13.63,20.44A8,8,0,0,0,176,72h32a8,8,0,0,1,8,8ZM128,88a44,44,0,1,0,44,44A44.05,44.05,0,0,0,128,88Zm0,72a28,28,0,1,1,28-28A28,28,0,0,1,128,160Z"}))],["thin",x.createElement(x.Fragment,null,x.createElement("path",{d:"M208,60H178.13L163.32,37.78A4,4,0,0,0,160,36H96a4,4,0,0,0-3.32,1.78L77.85,60H48A20,20,0,0,0,28,80V192a20,20,0,0,0,20,20H208a20,20,0,0,0,20-20V80A20,20,0,0,0,208,60Zm12,132a12,12,0,0,1-12,12H48a12,12,0,0,1-12-12V80A12,12,0,0,1,48,68H80a4,4,0,0,0,3.33-1.78L98.13,44h59.72l14.82,22.22A4,4,0,0,0,176,68h32a12,12,0,0,1,12,12ZM128,92a40,40,0,1,0,40,40A40,40,0,0,0,128,92Zm0,72a32,32,0,1,1,32-32A32,32,0,0,1,128,164Z"}))]]),T_e=new Map([["bold",x.createElement(x.Fragment,null,x.createElement("path",{d:"M184.49,136.49l-80,80a12,12,0,0,1-17-17L159,128,87.51,56.49a12,12,0,1,1,17-17l80,80A12,12,0,0,1,184.49,136.49Z"}))],["duotone",x.createElement(x.Fragment,null,x.createElement("path",{d:"M176,128,96,208V48Z",opacity:"0.2"}),x.createElement("path",{d:"M181.66,122.34l-80-80A8,8,0,0,0,88,48V208a8,8,0,0,0,13.66,5.66l80-80A8,8,0,0,0,181.66,122.34ZM104,188.69V67.31L164.69,128Z"}))],["fill",x.createElement(x.Fragment,null,x.createElement("path",{d:"M181.66,133.66l-80,80A8,8,0,0,1,88,208V48a8,8,0,0,1,13.66-5.66l80,80A8,8,0,0,1,181.66,133.66Z"}))],["light",x.createElement(x.Fragment,null,x.createElement("path",{d:"M180.24,132.24l-80,80a6,6,0,0,1-8.48-8.48L167.51,128,91.76,52.24a6,6,0,0,1,8.48-8.48l80,80A6,6,0,0,1,180.24,132.24Z"}))],["regular",x.createElement(x.Fragment,null,x.createElement("path",{d:"M181.66,133.66l-80,80a8,8,0,0,1-11.32-11.32L164.69,128,90.34,53.66a8,8,0,0,1,11.32-11.32l80,80A8,8,0,0,1,181.66,133.66Z"}))],["thin",x.createElement(x.Fragment,null,x.createElement("path",{d:"M178.83,130.83l-80,80a4,4,0,0,1-5.66-5.66L170.34,128,93.17,50.83a4,4,0,0,1,5.66-5.66l80,80A4,4,0,0,1,178.83,130.83Z"}))]]),P_e=new Map([["bold",x.createElement(x.Fragment,null,x.createElement("path",{d:"M232.49,80.49l-128,128a12,12,0,0,1-17,0l-56-56a12,12,0,1,1,17-17L96,183,215.51,63.51a12,12,0,0,1,17,17Z"}))],["duotone",x.createElement(x.Fragment,null,x.createElement("path",{d:"M232,56V200a16,16,0,0,1-16,16H40a16,16,0,0,1-16-16V56A16,16,0,0,1,40,40H216A16,16,0,0,1,232,56Z",opacity:"0.2"}),x.createElement("path",{d:"M205.66,85.66l-96,96a8,8,0,0,1-11.32,0l-40-40a8,8,0,0,1,11.32-11.32L104,164.69l90.34-90.35a8,8,0,0,1,11.32,11.32Z"}))],["fill",x.createElement(x.Fragment,null,x.createElement("path",{d:"M216,40H40A16,16,0,0,0,24,56V200a16,16,0,0,0,16,16H216a16,16,0,0,0,16-16V56A16,16,0,0,0,216,40ZM205.66,85.66l-96,96a8,8,0,0,1-11.32,0l-40-40a8,8,0,0,1,11.32-11.32L104,164.69l90.34-90.35a8,8,0,0,1,11.32,11.32Z"}))],["light",x.createElement(x.Fragment,null,x.createElement("path",{d:"M228.24,76.24l-128,128a6,6,0,0,1-8.48,0l-56-56a6,6,0,0,1,8.48-8.48L96,191.51,219.76,67.76a6,6,0,0,1,8.48,8.48Z"}))],["regular",x.createElement(x.Fragment,null,x.createElement("path",{d:"M229.66,77.66l-128,128a8,8,0,0,1-11.32,0l-56-56a8,8,0,0,1,11.32-11.32L96,188.69,218.34,66.34a8,8,0,0,1,11.32,11.32Z"}))],["thin",x.createElement(x.Fragment,null,x.createElement("path",{d:"M226.83,74.83l-128,128a4,4,0,0,1-5.66,0l-56-56a4,4,0,0,1,5.66-5.66L96,194.34,221.17,69.17a4,4,0,1,1,5.66,5.66Z"}))]]),M_e=new Map([["bold",x.createElement(x.Fragment,null,x.createElement("path",{d:"M176.49,95.51a12,12,0,0,1,0,17l-56,56a12,12,0,0,1-17,0l-24-24a12,12,0,1,1,17-17L112,143l47.51-47.52A12,12,0,0,1,176.49,95.51ZM236,128A108,108,0,1,1,128,20,108.12,108.12,0,0,1,236,128Zm-24,0a84,84,0,1,0-84,84A84.09,84.09,0,0,0,212,128Z"}))],["duotone",x.createElement(x.Fragment,null,x.createElement("path",{d:"M224,128a96,96,0,1,1-96-96A96,96,0,0,1,224,128Z",opacity:"0.2"}),x.createElement("path",{d:"M173.66,98.34a8,8,0,0,1,0,11.32l-56,56a8,8,0,0,1-11.32,0l-24-24a8,8,0,0,1,11.32-11.32L112,148.69l50.34-50.35A8,8,0,0,1,173.66,98.34ZM232,128A104,104,0,1,1,128,24,104.11,104.11,0,0,1,232,128Zm-16,0a88,88,0,1,0-88,88A88.1,88.1,0,0,0,216,128Z"}))],["fill",x.createElement(x.Fragment,null,x.createElement("path",{d:"M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm45.66,85.66-56,56a8,8,0,0,1-11.32,0l-24-24a8,8,0,0,1,11.32-11.32L112,148.69l50.34-50.35a8,8,0,0,1,11.32,11.32Z"}))],["light",x.createElement(x.Fragment,null,x.createElement("path",{d:"M172.24,99.76a6,6,0,0,1,0,8.48l-56,56a6,6,0,0,1-8.48,0l-24-24a6,6,0,0,1,8.48-8.48L112,151.51l51.76-51.75A6,6,0,0,1,172.24,99.76ZM230,128A102,102,0,1,1,128,26,102.12,102.12,0,0,1,230,128Zm-12,0a90,90,0,1,0-90,90A90.1,90.1,0,0,0,218,128Z"}))],["regular",x.createElement(x.Fragment,null,x.createElement("path",{d:"M173.66,98.34a8,8,0,0,1,0,11.32l-56,56a8,8,0,0,1-11.32,0l-24-24a8,8,0,0,1,11.32-11.32L112,148.69l50.34-50.35A8,8,0,0,1,173.66,98.34ZM232,128A104,104,0,1,1,128,24,104.11,104.11,0,0,1,232,128Zm-16,0a88,88,0,1,0-88,88A88.1,88.1,0,0,0,216,128Z"}))],["thin",x.createElement(x.Fragment,null,x.createElement("path",{d:"M170.83,101.17a4,4,0,0,1,0,5.66l-56,56a4,4,0,0,1-5.66,0l-24-24a4,4,0,0,1,5.66-5.66L112,154.34l53.17-53.17A4,4,0,0,1,170.83,101.17ZM228,128A100,100,0,1,1,128,28,100.11,100.11,0,0,1,228,128Zm-8,0a92,92,0,1,0-92,92A92.1,92.1,0,0,0,220,128Z"}))]]),N_e=new Map([["bold",x.createElement(x.Fragment,null,x.createElement("path",{d:"M172,164a12,12,0,0,1-12,12H96a12,12,0,0,1,0-24h64A12,12,0,0,1,172,164Zm-12-52H96a12,12,0,0,0,0,24h64a12,12,0,0,0,0-24Zm60-64V216a20,20,0,0,1-20,20H56a20,20,0,0,1-20-20V48A20,20,0,0,1,56,28H90.53a51.88,51.88,0,0,1,74.94,0H200A20,20,0,0,1,220,48ZM100.29,60h55.42a28,28,0,0,0-55.42,0ZM196,52H178.59A52.13,52.13,0,0,1,180,64v8a12,12,0,0,1-12,12H88A12,12,0,0,1,76,72V64a52.13,52.13,0,0,1,1.41-12H60V212H196Z"}))],["duotone",x.createElement(x.Fragment,null,x.createElement("path",{d:"M208,48V216a8,8,0,0,1-8,8H56a8,8,0,0,1-8-8V48a8,8,0,0,1,8-8H96a39.83,39.83,0,0,0-8,24v8h80V64a39.83,39.83,0,0,0-8-24h40A8,8,0,0,1,208,48Z",opacity:"0.2"}),x.createElement("path",{d:"M168,152a8,8,0,0,1-8,8H96a8,8,0,0,1,0-16h64A8,8,0,0,1,168,152Zm-8-40H96a8,8,0,0,0,0,16h64a8,8,0,0,0,0-16Zm56-64V216a16,16,0,0,1-16,16H56a16,16,0,0,1-16-16V48A16,16,0,0,1,56,32H92.26a47.92,47.92,0,0,1,71.48,0H200A16,16,0,0,1,216,48ZM96,64h64a32,32,0,0,0-64,0ZM200,48H173.25A47.93,47.93,0,0,1,176,64v8a8,8,0,0,1-8,8H88a8,8,0,0,1-8-8V64a47.93,47.93,0,0,1,2.75-16H56V216H200Z"}))],["fill",x.createElement(x.Fragment,null,x.createElement("path",{d:"M200,32H163.74a47.92,47.92,0,0,0-71.48,0H56A16,16,0,0,0,40,48V216a16,16,0,0,0,16,16H200a16,16,0,0,0,16-16V48A16,16,0,0,0,200,32Zm-72,0a32,32,0,0,1,32,32H96A32,32,0,0,1,128,32Zm32,128H96a8,8,0,0,1,0-16h64a8,8,0,0,1,0,16Zm0-32H96a8,8,0,0,1,0-16h64a8,8,0,0,1,0,16Z"}))],["light",x.createElement(x.Fragment,null,x.createElement("path",{d:"M166,152a6,6,0,0,1-6,6H96a6,6,0,0,1,0-12h64A6,6,0,0,1,166,152Zm-6-38H96a6,6,0,0,0,0,12h64a6,6,0,0,0,0-12Zm54-66V216a14,14,0,0,1-14,14H56a14,14,0,0,1-14-14V48A14,14,0,0,1,56,34H93.17a45.91,45.91,0,0,1,69.66,0H200A14,14,0,0,1,214,48ZM94,64v2h68V64a34,34,0,0,0-68,0ZM202,48a2,2,0,0,0-2-2H170.33A45.77,45.77,0,0,1,174,64v8a6,6,0,0,1-6,6H88a6,6,0,0,1-6-6V64a45.77,45.77,0,0,1,3.67-18H56a2,2,0,0,0-2,2V216a2,2,0,0,0,2,2H200a2,2,0,0,0,2-2Z"}))],["regular",x.createElement(x.Fragment,null,x.createElement("path",{d:"M168,152a8,8,0,0,1-8,8H96a8,8,0,0,1,0-16h64A8,8,0,0,1,168,152Zm-8-40H96a8,8,0,0,0,0,16h64a8,8,0,0,0,0-16Zm56-64V216a16,16,0,0,1-16,16H56a16,16,0,0,1-16-16V48A16,16,0,0,1,56,32H92.26a47.92,47.92,0,0,1,71.48,0H200A16,16,0,0,1,216,48ZM96,64h64a32,32,0,0,0-64,0ZM200,48H173.25A47.93,47.93,0,0,1,176,64v8a8,8,0,0,1-8,8H88a8,8,0,0,1-8-8V64a47.93,47.93,0,0,1,2.75-16H56V216H200Z"}))],["thin",x.createElement(x.Fragment,null,x.createElement("path",{d:"M164,152a4,4,0,0,1-4,4H96a4,4,0,0,1,0-8h64A4,4,0,0,1,164,152Zm-4-36H96a4,4,0,0,0,0,8h64a4,4,0,0,0,0-8Zm52-68V216a12,12,0,0,1-12,12H56a12,12,0,0,1-12-12V48A12,12,0,0,1,56,36H94.08a44,44,0,0,1,67.84,0H200A12,12,0,0,1,212,48ZM92,64v4h72V64a36,36,0,0,0-72,0ZM204,48a4,4,0,0,0-4-4H167.17A43.71,43.71,0,0,1,172,64v8a4,4,0,0,1-4,4H88a4,4,0,0,1-4-4V64a43.71,43.71,0,0,1,4.83-20H56a4,4,0,0,0-4,4V216a4,4,0,0,0,4,4H200a4,4,0,0,0,4-4Z"}))]]),D_e=new Map([["bold",x.createElement(x.Fragment,null,x.createElement("path",{d:"M128,20A108,108,0,1,0,236,128,108.12,108.12,0,0,0,128,20Zm0,192a84,84,0,1,1,84-84A84.09,84.09,0,0,1,128,212Zm68-84a12,12,0,0,1-12,12H128a12,12,0,0,1-12-12V72a12,12,0,0,1,24,0v44h44A12,12,0,0,1,196,128Z"}))],["duotone",x.createElement(x.Fragment,null,x.createElement("path",{d:"M224,128a96,96,0,1,1-96-96A96,96,0,0,1,224,128Z",opacity:"0.2"}),x.createElement("path",{d:"M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm0,192a88,88,0,1,1,88-88A88.1,88.1,0,0,1,128,216Zm64-88a8,8,0,0,1-8,8H128a8,8,0,0,1-8-8V72a8,8,0,0,1,16,0v48h48A8,8,0,0,1,192,128Z"}))],["fill",x.createElement(x.Fragment,null,x.createElement("path",{d:"M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm56,112H128a8,8,0,0,1-8-8V72a8,8,0,0,1,16,0v48h48a8,8,0,0,1,0,16Z"}))],["light",x.createElement(x.Fragment,null,x.createElement("path",{d:"M128,26A102,102,0,1,0,230,128,102.12,102.12,0,0,0,128,26Zm0,192a90,90,0,1,1,90-90A90.1,90.1,0,0,1,128,218Zm62-90a6,6,0,0,1-6,6H128a6,6,0,0,1-6-6V72a6,6,0,0,1,12,0v50h50A6,6,0,0,1,190,128Z"}))],["regular",x.createElement(x.Fragment,null,x.createElement("path",{d:"M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm0,192a88,88,0,1,1,88-88A88.1,88.1,0,0,1,128,216Zm64-88a8,8,0,0,1-8,8H128a8,8,0,0,1-8-8V72a8,8,0,0,1,16,0v48h48A8,8,0,0,1,192,128Z"}))],["thin",x.createElement(x.Fragment,null,x.createElement("path",{d:"M128,28A100,100,0,1,0,228,128,100.11,100.11,0,0,0,128,28Zm0,192a92,92,0,1,1,92-92A92.1,92.1,0,0,1,128,220Zm60-92a4,4,0,0,1-4,4H128a4,4,0,0,1-4-4V72a4,4,0,0,1,8,0v52h52A4,4,0,0,1,188,128Z"}))]]),I_e=new Map([["bold",x.createElement(x.Fragment,null,x.createElement("path",{d:"M216,28H88A12,12,0,0,0,76,40V76H40A12,12,0,0,0,28,88V216a12,12,0,0,0,12,12H168a12,12,0,0,0,12-12V180h36a12,12,0,0,0,12-12V40A12,12,0,0,0,216,28ZM156,204H52V100H156Zm48-48H180V88a12,12,0,0,0-12-12H100V52H204Z"}))],["duotone",x.createElement(x.Fragment,null,x.createElement("path",{d:"M216,40V168H168V88H88V40Z",opacity:"0.2"}),x.createElement("path",{d:"M216,32H88a8,8,0,0,0-8,8V80H40a8,8,0,0,0-8,8V216a8,8,0,0,0,8,8H168a8,8,0,0,0,8-8V176h40a8,8,0,0,0,8-8V40A8,8,0,0,0,216,32ZM160,208H48V96H160Zm48-48H176V88a8,8,0,0,0-8-8H96V48H208Z"}))],["fill",x.createElement(x.Fragment,null,x.createElement("path",{d:"M216,32H88a8,8,0,0,0-8,8V80H40a8,8,0,0,0-8,8V216a8,8,0,0,0,8,8H168a8,8,0,0,0,8-8V176h40a8,8,0,0,0,8-8V40A8,8,0,0,0,216,32Zm-8,128H176V88a8,8,0,0,0-8-8H96V48H208Z"}))],["light",x.createElement(x.Fragment,null,x.createElement("path",{d:"M216,34H88a6,6,0,0,0-6,6V82H40a6,6,0,0,0-6,6V216a6,6,0,0,0,6,6H168a6,6,0,0,0,6-6V174h42a6,6,0,0,0,6-6V40A6,6,0,0,0,216,34ZM162,210H46V94H162Zm48-48H174V88a6,6,0,0,0-6-6H94V46H210Z"}))],["regular",x.createElement(x.Fragment,null,x.createElement("path",{d:"M216,32H88a8,8,0,0,0-8,8V80H40a8,8,0,0,0-8,8V216a8,8,0,0,0,8,8H168a8,8,0,0,0,8-8V176h40a8,8,0,0,0,8-8V40A8,8,0,0,0,216,32ZM160,208H48V96H160Zm48-48H176V88a8,8,0,0,0-8-8H96V48H208Z"}))],["thin",x.createElement(x.Fragment,null,x.createElement("path",{d:"M216,36H88a4,4,0,0,0-4,4V84H40a4,4,0,0,0-4,4V216a4,4,0,0,0,4,4H168a4,4,0,0,0,4-4V172h44a4,4,0,0,0,4-4V40A4,4,0,0,0,216,36ZM164,212H44V92H164Zm48-48H172V88a4,4,0,0,0-4-4H92V44H212Z"}))]]),__e=new Map([["bold",x.createElement(x.Fragment,null,x.createElement("path",{d:"M251,123.13c-.37-.81-9.13-20.26-28.48-39.61C196.63,57.67,164,44,128,44S59.37,57.67,33.51,83.52C14.16,102.87,5.4,122.32,5,123.13a12.08,12.08,0,0,0,0,9.75c.37.82,9.13,20.26,28.49,39.61C59.37,198.34,92,212,128,212s68.63-13.66,94.48-39.51c19.36-19.35,28.12-38.79,28.49-39.61A12.08,12.08,0,0,0,251,123.13Zm-46.06,33C183.47,177.27,157.59,188,128,188s-55.47-10.73-76.91-31.88A130.36,130.36,0,0,1,29.52,128,130.45,130.45,0,0,1,51.09,99.89C72.54,78.73,98.41,68,128,68s55.46,10.73,76.91,31.89A130.36,130.36,0,0,1,226.48,128,130.45,130.45,0,0,1,204.91,156.12ZM128,84a44,44,0,1,0,44,44A44.05,44.05,0,0,0,128,84Zm0,64a20,20,0,1,1,20-20A20,20,0,0,1,128,148Z"}))],["duotone",x.createElement(x.Fragment,null,x.createElement("path",{d:"M128,56C48,56,16,128,16,128s32,72,112,72,112-72,112-72S208,56,128,56Zm0,112a40,40,0,1,1,40-40A40,40,0,0,1,128,168Z",opacity:"0.2"}),x.createElement("path",{d:"M247.31,124.76c-.35-.79-8.82-19.58-27.65-38.41C194.57,61.26,162.88,48,128,48S61.43,61.26,36.34,86.35C17.51,105.18,9,124,8.69,124.76a8,8,0,0,0,0,6.5c.35.79,8.82,19.57,27.65,38.4C61.43,194.74,93.12,208,128,208s66.57-13.26,91.66-38.34c18.83-18.83,27.3-37.61,27.65-38.4A8,8,0,0,0,247.31,124.76ZM128,192c-30.78,0-57.67-11.19-79.93-33.25A133.47,133.47,0,0,1,25,128,133.33,133.33,0,0,1,48.07,97.25C70.33,75.19,97.22,64,128,64s57.67,11.19,79.93,33.25A133.46,133.46,0,0,1,231.05,128C223.84,141.46,192.43,192,128,192Zm0-112a48,48,0,1,0,48,48A48.05,48.05,0,0,0,128,80Zm0,80a32,32,0,1,1,32-32A32,32,0,0,1,128,160Z"}))],["fill",x.createElement(x.Fragment,null,x.createElement("path",{d:"M247.31,124.76c-.35-.79-8.82-19.58-27.65-38.41C194.57,61.26,162.88,48,128,48S61.43,61.26,36.34,86.35C17.51,105.18,9,124,8.69,124.76a8,8,0,0,0,0,6.5c.35.79,8.82,19.57,27.65,38.4C61.43,194.74,93.12,208,128,208s66.57-13.26,91.66-38.34c18.83-18.83,27.3-37.61,27.65-38.4A8,8,0,0,0,247.31,124.76ZM128,168a40,40,0,1,1,40-40A40,40,0,0,1,128,168Z"}))],["light",x.createElement(x.Fragment,null,x.createElement("path",{d:"M245.48,125.57c-.34-.78-8.66-19.23-27.24-37.81C201,70.54,171.38,50,128,50S55,70.54,37.76,87.76c-18.58,18.58-26.9,37-27.24,37.81a6,6,0,0,0,0,4.88c.34.77,8.66,19.22,27.24,37.8C55,185.47,84.62,206,128,206s73-20.53,90.24-37.75c18.58-18.58,26.9-37,27.24-37.8A6,6,0,0,0,245.48,125.57ZM128,194c-31.38,0-58.78-11.42-81.45-33.93A134.77,134.77,0,0,1,22.69,128,134.56,134.56,0,0,1,46.55,95.94C69.22,73.42,96.62,62,128,62s58.78,11.42,81.45,33.94A134.56,134.56,0,0,1,233.31,128C226.94,140.21,195,194,128,194Zm0-112a46,46,0,1,0,46,46A46.06,46.06,0,0,0,128,82Zm0,80a34,34,0,1,1,34-34A34,34,0,0,1,128,162Z"}))],["regular",x.createElement(x.Fragment,null,x.createElement("path",{d:"M247.31,124.76c-.35-.79-8.82-19.58-27.65-38.41C194.57,61.26,162.88,48,128,48S61.43,61.26,36.34,86.35C17.51,105.18,9,124,8.69,124.76a8,8,0,0,0,0,6.5c.35.79,8.82,19.57,27.65,38.4C61.43,194.74,93.12,208,128,208s66.57-13.26,91.66-38.34c18.83-18.83,27.3-37.61,27.65-38.4A8,8,0,0,0,247.31,124.76ZM128,192c-30.78,0-57.67-11.19-79.93-33.25A133.47,133.47,0,0,1,25,128,133.33,133.33,0,0,1,48.07,97.25C70.33,75.19,97.22,64,128,64s57.67,11.19,79.93,33.25A133.46,133.46,0,0,1,231.05,128C223.84,141.46,192.43,192,128,192Zm0-112a48,48,0,1,0,48,48A48.05,48.05,0,0,0,128,80Zm0,80a32,32,0,1,1,32-32A32,32,0,0,1,128,160Z"}))],["thin",x.createElement(x.Fragment,null,x.createElement("path",{d:"M243.66,126.38c-.34-.76-8.52-18.89-26.83-37.2C199.87,72.22,170.7,52,128,52S56.13,72.22,39.17,89.18c-18.31,18.31-26.49,36.44-26.83,37.2a4.08,4.08,0,0,0,0,3.25c.34.77,8.52,18.89,26.83,37.2,17,17,46.14,37.17,88.83,37.17s71.87-20.21,88.83-37.17c18.31-18.31,26.49-36.43,26.83-37.2A4.08,4.08,0,0,0,243.66,126.38Zm-32.7,35c-23.07,23-51,34.62-83,34.62s-59.89-11.65-83-34.62A135.71,135.71,0,0,1,20.44,128,135.69,135.69,0,0,1,45,94.62C68.11,71.65,96,60,128,60s59.89,11.65,83,34.62A135.79,135.79,0,0,1,235.56,128,135.71,135.71,0,0,1,211,161.38ZM128,84a44,44,0,1,0,44,44A44.05,44.05,0,0,0,128,84Zm0,80a36,36,0,1,1,36-36A36,36,0,0,1,128,164Z"}))]]),R_e=new Map([["bold",x.createElement(x.Fragment,null,x.createElement("path",{d:"M56.88,31.93A12,12,0,1,0,39.12,48.07l16,17.65C20.67,88.66,5.72,121.58,5,123.13a12.08,12.08,0,0,0,0,9.75c.37.82,9.13,20.26,28.49,39.61C59.37,198.34,92,212,128,212a131.34,131.34,0,0,0,51-10l20.09,22.1a12,12,0,0,0,17.76-16.14ZM128,188c-29.59,0-55.47-10.73-76.91-31.88A130.69,130.69,0,0,1,29.52,128c5.27-9.31,18.79-29.9,42-44.29l90.09,99.11A109.33,109.33,0,0,1,128,188Zm123-55.12c-.36.81-9,20-28,39.16a12,12,0,1,1-17-16.9A130.48,130.48,0,0,0,226.48,128a130.36,130.36,0,0,0-21.57-28.12C183.46,78.73,157.59,68,128,68c-3.35,0-6.7.14-10,.42a12,12,0,1,1-2-23.91c3.93-.34,8-.51,12-.51,36,0,68.63,13.67,94.49,39.52,19.35,19.35,28.11,38.8,28.48,39.61A12.08,12.08,0,0,1,251,132.88Z"}))],["duotone",x.createElement(x.Fragment,null,x.createElement("path",{d:"M128,56C48,56,16,128,16,128s32,72,112,72,112-72,112-72S208,56,128,56Zm0,112a40,40,0,1,1,40-40A40,40,0,0,1,128,168Z",opacity:"0.2"}),x.createElement("path",{d:"M53.92,34.62A8,8,0,1,0,42.08,45.38L61.32,66.55C25,88.84,9.38,123.2,8.69,124.76a8,8,0,0,0,0,6.5c.35.79,8.82,19.57,27.65,38.4C61.43,194.74,93.12,208,128,208a127.11,127.11,0,0,0,52.07-10.83l22,24.21a8,8,0,1,0,11.84-10.76Zm47.33,75.84,41.67,45.85a32,32,0,0,1-41.67-45.85ZM128,192c-30.78,0-57.67-11.19-79.93-33.25A133.16,133.16,0,0,1,25,128c4.69-8.79,19.66-33.39,47.35-49.38l18,19.75a48,48,0,0,0,63.66,70l14.73,16.2A112,112,0,0,1,128,192Zm6-95.43a8,8,0,0,1,3-15.72,48.16,48.16,0,0,1,38.77,42.64,8,8,0,0,1-7.22,8.71,6.39,6.39,0,0,1-.75,0,8,8,0,0,1-8-7.26A32.09,32.09,0,0,0,134,96.57Zm113.28,34.69c-.42.94-10.55,23.37-33.36,43.8a8,8,0,1,1-10.67-11.92A132.77,132.77,0,0,0,231.05,128a133.15,133.15,0,0,0-23.12-30.77C185.67,75.19,158.78,64,128,64a118.37,118.37,0,0,0-19.36,1.57A8,8,0,1,1,106,49.79,134,134,0,0,1,128,48c34.88,0,66.57,13.26,91.66,38.35,18.83,18.83,27.3,37.62,27.65,38.41A8,8,0,0,1,247.31,131.26Z"}))],["fill",x.createElement(x.Fragment,null,x.createElement("path",{d:"M96.68,57.87a4,4,0,0,1,2.08-6.6A130.13,130.13,0,0,1,128,48c34.88,0,66.57,13.26,91.66,38.35,18.83,18.83,27.3,37.62,27.65,38.41a8,8,0,0,1,0,6.5c-.35.79-8.82,19.57-27.65,38.4q-4.28,4.26-8.79,8.07a4,4,0,0,1-5.55-.36ZM213.92,210.62a8,8,0,1,1-11.84,10.76L180,197.13A127.21,127.21,0,0,1,128,208c-34.88,0-66.57-13.26-91.66-38.34C17.51,150.83,9,132.05,8.69,131.26a8,8,0,0,1,0-6.5C9,124,17.51,105.18,36.34,86.35a135,135,0,0,1,25-19.78L42.08,45.38A8,8,0,1,1,53.92,34.62Zm-65.49-48.25-52.69-58a40,40,0,0,0,52.69,58Z"}))],["light",x.createElement(x.Fragment,null,x.createElement("path",{d:"M52.44,36A6,6,0,0,0,43.56,44L64.44,67c-37.28,21.9-53.23,57-53.92,58.57a6,6,0,0,0,0,4.88c.34.77,8.66,19.22,27.24,37.8C55,185.47,84.62,206,128,206a124.91,124.91,0,0,0,52.57-11.25l23,25.29a6,6,0,0,0,8.88-8.08Zm48.62,71.32,45,49.52a34,34,0,0,1-45-49.52ZM128,194c-31.38,0-58.78-11.42-81.45-33.93A134.57,134.57,0,0,1,22.69,128c4.29-8.2,20.1-35.18,50-51.91L92.89,98.3a46,46,0,0,0,61.35,67.48l17.81,19.6A113.47,113.47,0,0,1,128,194Zm6.4-99.4a6,6,0,0,1,2.25-11.79,46.17,46.17,0,0,1,37.15,40.87,6,6,0,0,1-5.42,6.53l-.56,0a6,6,0,0,1-6-5.45A34.1,34.1,0,0,0,134.4,94.6Zm111.08,35.85c-.41.92-10.37,23-32.86,43.12a6,6,0,1,1-8-8.94A134.07,134.07,0,0,0,233.31,128a134.67,134.67,0,0,0-23.86-32.07C186.78,73.42,159.38,62,128,62a120.19,120.19,0,0,0-19.69,1.6,6,6,0,1,1-2-11.83A131.12,131.12,0,0,1,128,50c43.38,0,73,20.54,90.24,37.76,18.58,18.58,26.9,37,27.24,37.81A6,6,0,0,1,245.48,130.45Z"}))],["regular",x.createElement(x.Fragment,null,x.createElement("path",{d:"M53.92,34.62A8,8,0,1,0,42.08,45.38L61.32,66.55C25,88.84,9.38,123.2,8.69,124.76a8,8,0,0,0,0,6.5c.35.79,8.82,19.57,27.65,38.4C61.43,194.74,93.12,208,128,208a127.11,127.11,0,0,0,52.07-10.83l22,24.21a8,8,0,1,0,11.84-10.76Zm47.33,75.84,41.67,45.85a32,32,0,0,1-41.67-45.85ZM128,192c-30.78,0-57.67-11.19-79.93-33.25A133.16,133.16,0,0,1,25,128c4.69-8.79,19.66-33.39,47.35-49.38l18,19.75a48,48,0,0,0,63.66,70l14.73,16.2A112,112,0,0,1,128,192Zm6-95.43a8,8,0,0,1,3-15.72,48.16,48.16,0,0,1,38.77,42.64,8,8,0,0,1-7.22,8.71,6.39,6.39,0,0,1-.75,0,8,8,0,0,1-8-7.26A32.09,32.09,0,0,0,134,96.57Zm113.28,34.69c-.42.94-10.55,23.37-33.36,43.8a8,8,0,1,1-10.67-11.92A132.77,132.77,0,0,0,231.05,128a133.15,133.15,0,0,0-23.12-30.77C185.67,75.19,158.78,64,128,64a118.37,118.37,0,0,0-19.36,1.57A8,8,0,1,1,106,49.79,134,134,0,0,1,128,48c34.88,0,66.57,13.26,91.66,38.35,18.83,18.83,27.3,37.62,27.65,38.41A8,8,0,0,1,247.31,131.26Z"}))],["thin",x.createElement(x.Fragment,null,x.createElement("path",{d:"M51,37.31A4,4,0,0,0,45,42.69L67.59,67.5C29.34,89,13,124.81,12.34,126.38a4.08,4.08,0,0,0,0,3.25c.34.77,8.52,18.89,26.83,37.2,17,17,46.14,37.17,88.83,37.17a122.59,122.59,0,0,0,53.06-11.69l24,26.38a4,4,0,1,0,5.92-5.38ZM149.1,157.16A36,36,0,0,1,101,104.22ZM128,196c-32,0-59.89-11.65-83-34.62A135.81,135.81,0,0,1,20.44,128c3.65-7.23,20.09-36.81,52.68-54.43l22.45,24.7a44,44,0,0,0,59,64.83l20.89,23A114.94,114.94,0,0,1,128,196Zm6.78-103.36a4,4,0,0,1,1.49-7.86,44.15,44.15,0,0,1,35.54,39.09,4,4,0,0,1-3.61,4.35l-.38,0a4,4,0,0,1-4-3.63A36.1,36.1,0,0,0,134.78,92.64Zm108.88,37c-.41.91-10.2,22.58-32.38,42.45a4,4,0,0,1-2.67,1,4,4,0,0,1-2.67-7A136.71,136.71,0,0,0,235.56,128,136.07,136.07,0,0,0,211,94.62C187.89,71.65,160,60,128,60a122,122,0,0,0-20,1.63,4,4,0,0,1-1.32-7.89A129.3,129.3,0,0,1,128,52c42.7,0,71.87,20.22,88.83,37.18,18.31,18.31,26.49,36.44,26.83,37.2A4.08,4.08,0,0,1,243.66,129.63Z"}))]]),j_e=new Map([["bold",x.createElement(x.Fragment,null,x.createElement("path",{d:"M228,67.24a39.77,39.77,0,0,0-12.51-28.52C199.91,24,174.71,24.5,159.29,39.93L142.48,56.84a28,28,0,0,0-35.64,3.29l-9,9a20,20,0,0,0-.73,27.49L48.9,144.84A43.76,43.76,0,0,0,37,185.28l-7.5,17.19a17.66,17.66,0,0,0,3.71,19.65,19.9,19.9,0,0,0,22.15,4.19l16.31-7.13a43.88,43.88,0,0,0,39.45-12.09l48.24-48.26a20,20,0,0,0,27.47-.73l9-9a28.06,28.06,0,0,0,3.26-35.72l17.23-17.33A39.69,39.69,0,0,0,228,67.24ZM94.15,190.11a20,20,0,0,1-20,5,11.93,11.93,0,0,0-8.32.47L57,199.38,60.69,191a12,12,0,0,0,.37-8.64,19.92,19.92,0,0,1,4.81-20.55l48.2-48.22,28.28,28.3Zm105.14-111-25.37,25.52a12,12,0,0,0,0,16.95l4.88,4.89a4,4,0,0,1,0,5.66l-6.14,6.15-55-55.05,6.14-6.14a4,4,0,0,1,5.65,0L134.35,82a12,12,0,0,0,8.49,3.51h0A12,12,0,0,0,151.34,82l24.94-25.08c6.3-6.3,16.48-6.63,22.71-.74a16,16,0,0,1,.3,23Z"}))],["duotone",x.createElement(x.Fragment,null,x.createElement("path",{d:"M207.8,87.6l-25.37,25.53,4.89,4.88a16,16,0,0,1,0,22.64l-9,9a8,8,0,0,1-11.32,0l-60.68-60.7a8,8,0,0,1,0-11.32l9-9a16,16,0,0,1,22.63,0l4.88,4.89,25-25.11c10.79-10.79,28.37-11.45,39.45-1A28,28,0,0,1,207.8,87.6Z",opacity:"0.2"}),x.createElement("path",{d:"M224,67.3a35.79,35.79,0,0,0-11.26-25.66c-14-13.28-36.72-12.78-50.62,1.13L142.8,62.2a24,24,0,0,0-33.14.77l-9,9a16,16,0,0,0,0,22.64l2,2.06-51,51a39.75,39.75,0,0,0-10.53,38l-8,18.41A13.68,13.68,0,0,0,36,219.3a15.92,15.92,0,0,0,17.71,3.35L71.23,215a39.89,39.89,0,0,0,37.06-10.75l51-51,2.06,2.06a16,16,0,0,0,22.62,0l9-9a24,24,0,0,0,.74-33.18l19.75-19.87A35.75,35.75,0,0,0,224,67.3ZM97,193a24,24,0,0,1-24,6,8,8,0,0,0-5.55.31l-18.1,7.91L57,189.41a8,8,0,0,0,.25-5.75A23.88,23.88,0,0,1,63,159l51-51,33.94,34ZM202.13,82l-25.37,25.52a8,8,0,0,0,0,11.3l4.89,4.89a8,8,0,0,1,0,11.32l-9,9L112,83.26l9-9a8,8,0,0,1,11.31,0l4.89,4.89a8,8,0,0,0,5.65,2.34h0a8,8,0,0,0,5.66-2.36l24.94-25.09c7.81-7.82,20.5-8.18,28.29-.81a20,20,0,0,1,.39,28.7Z"}))],["fill",x.createElement(x.Fragment,null,x.createElement("path",{d:"M224,67.3a35.79,35.79,0,0,0-11.26-25.66c-14-13.28-36.72-12.78-50.62,1.13L138.8,66.2a24,24,0,0,0-33.14.77l-5,5a16,16,0,0,0,0,22.64l2,2.06-51,51a39.75,39.75,0,0,0-10.53,38l-8,18.41A13.68,13.68,0,0,0,36,219.3a15.92,15.92,0,0,0,17.71,3.35L71.23,215a39.89,39.89,0,0,0,37.06-10.75l51-51,2.06,2.06a16,16,0,0,0,22.62,0l5-5a24,24,0,0,0,.74-33.18l23.75-23.87A35.75,35.75,0,0,0,224,67.3ZM97,193a24,24,0,0,1-24,6,8,8,0,0,0-5.55.31l-18.1,7.91L57,189.41a8,8,0,0,0,.25-5.75A23.88,23.88,0,0,1,63,159l51-51,33.94,34Z"}))],["light",x.createElement(x.Fragment,null,x.createElement("path",{d:"M222,67.34a33.81,33.81,0,0,0-10.64-24.25C198.12,30.56,176.68,31,163.54,44.18L142.82,65l-.63-.63a22,22,0,0,0-31.11,0l-9,9a14,14,0,0,0,0,19.81l3.47,3.47L53.14,149.1a37.79,37.79,0,0,0-9.84,36.73l-8.31,19a11.68,11.68,0,0,0,2.46,13A13.91,13.91,0,0,0,47.32,222,14.15,14.15,0,0,0,53,220.82L71,212.92a37.92,37.92,0,0,0,35.84-10.07l52.44-52.46,3.47,3.48a14,14,0,0,0,19.8,0l9-9a22,22,0,0,0,0-31.12l-.66-.66L212,91.85A33.76,33.76,0,0,0,222,67.34Zm-123.61,127a26,26,0,0,1-26,6.47,6,6,0,0,0-4.16.24l-20,8.75a2,2,0,0,1-2.09-.31l9.12-20.9a5.94,5.94,0,0,0,.19-4.31,25.88,25.88,0,0,1,6.26-26.72l52.44-52.45,36.76,36.78Zm105.16-111L178.17,108.9a6,6,0,0,0,0,8.47l4.88,4.89a10,10,0,0,1,0,14.15l-9,9a2,2,0,0,1-2.82,0l-60.69-60.7a2,2,0,0,1,0-2.83l9-9a10,10,0,0,1,14.14,0l4.89,4.89a6,6,0,0,0,4.24,1.75h0a6,6,0,0,0,4.25-1.77L172,52.66c8.58-8.58,22.52-9,31.08-.85a22,22,0,0,1,.44,31.57Z"}))],["regular",x.createElement(x.Fragment,null,x.createElement("path",{d:"M224,67.3a35.79,35.79,0,0,0-11.26-25.66c-14-13.28-36.72-12.78-50.62,1.13L142.8,62.2a24,24,0,0,0-33.14.77l-9,9a16,16,0,0,0,0,22.64l2,2.06-51,51a39.75,39.75,0,0,0-10.53,38l-8,18.41A13.68,13.68,0,0,0,36,219.3a15.92,15.92,0,0,0,17.71,3.35L71.23,215a39.89,39.89,0,0,0,37.06-10.75l51-51,2.06,2.06a16,16,0,0,0,22.62,0l9-9a24,24,0,0,0,.74-33.18l19.75-19.87A35.75,35.75,0,0,0,224,67.3ZM97,193a24,24,0,0,1-24,6,8,8,0,0,0-5.55.31l-18.1,7.91L57,189.41a8,8,0,0,0,.25-5.75A23.88,23.88,0,0,1,63,159l51-51,33.94,34ZM202.13,82l-25.37,25.52a8,8,0,0,0,0,11.3l4.89,4.89a8,8,0,0,1,0,11.32l-9,9L112,83.26l9-9a8,8,0,0,1,11.31,0l4.89,4.89a8,8,0,0,0,11.33,0l24.94-25.09c7.81-7.82,20.5-8.18,28.29-.81a20,20,0,0,1,.39,28.7Z"}))],["thin",x.createElement(x.Fragment,null,x.createElement("path",{d:"M220,67.37a31.82,31.82,0,0,0-10-22.82c-12.46-11.8-32.66-11.33-45,1.05L142.82,67.86l-2-2a20,20,0,0,0-28.28,0l-9,9a12,12,0,0,0,0,17l4.89,4.89L54.55,150.52A35.81,35.81,0,0,0,45.42,186l-8.6,19.7a9.7,9.7,0,0,0,2,10.79A12,12,0,0,0,52.15,219l18.72-8.18a35.9,35.9,0,0,0,34.59-9.37l53.86-53.87,4.88,4.89a12,12,0,0,0,17,0l9-9a20,20,0,0,0,0-28.3l-2.06-2.06,22.55-22.69A31.75,31.75,0,0,0,220,67.37ZM99.81,195.78a28,28,0,0,1-28,7,4,4,0,0,0-2.78.15l-20,8.75a4,4,0,0,1-4.43-.84,1.73,1.73,0,0,1-.36-1.93l9.19-21.06a4,4,0,0,0,.12-2.88,27.87,27.87,0,0,1,6.74-28.77l53.85-53.87,39.6,39.61Zm79.78-85.47a4,4,0,0,0,0,5.65l4.89,4.89a12,12,0,0,1,0,17l-9,9a4,4,0,0,1-5.66,0L109.18,86.1a4,4,0,0,1,0-5.66l9-9a12,12,0,0,1,17,0L140,76.36a4,4,0,0,0,2.83,1.17h0a4,4,0,0,0,2.83-1.18l25-25.1c9.33-9.34,24.52-9.73,33.87-.89A24,24,0,0,1,205,84.79Z"}))]]),L_e=new Map([["bold",x.createElement(x.Fragment,null,x.createElement("path",{d:"M216.49,79.52l-56-56A12,12,0,0,0,152,20H56A20,20,0,0,0,36,40V216a20,20,0,0,0,20,20H200a20,20,0,0,0,20-20V88A12,12,0,0,0,216.49,79.52ZM160,57l23,23H160ZM60,212V44h76V92a12,12,0,0,0,12,12h48V212Z"}))],["duotone",x.createElement(x.Fragment,null,x.createElement("path",{d:"M208,88H152V32Z",opacity:"0.2"}),x.createElement("path",{d:"M213.66,82.34l-56-56A8,8,0,0,0,152,24H56A16,16,0,0,0,40,40V216a16,16,0,0,0,16,16H200a16,16,0,0,0,16-16V88A8,8,0,0,0,213.66,82.34ZM160,51.31,188.69,80H160ZM200,216H56V40h88V88a8,8,0,0,0,8,8h48V216Z"}))],["fill",x.createElement(x.Fragment,null,x.createElement("path",{d:"M213.66,82.34l-56-56A8,8,0,0,0,152,24H56A16,16,0,0,0,40,40V216a16,16,0,0,0,16,16H200a16,16,0,0,0,16-16V88A8,8,0,0,0,213.66,82.34ZM152,88V44l44,44Z"}))],["light",x.createElement(x.Fragment,null,x.createElement("path",{d:"M212.24,83.76l-56-56A6,6,0,0,0,152,26H56A14,14,0,0,0,42,40V216a14,14,0,0,0,14,14H200a14,14,0,0,0,14-14V88A6,6,0,0,0,212.24,83.76ZM158,46.48,193.52,82H158ZM200,218H56a2,2,0,0,1-2-2V40a2,2,0,0,1,2-2h90V88a6,6,0,0,0,6,6h50V216A2,2,0,0,1,200,218Z"}))],["regular",x.createElement(x.Fragment,null,x.createElement("path",{d:"M213.66,82.34l-56-56A8,8,0,0,0,152,24H56A16,16,0,0,0,40,40V216a16,16,0,0,0,16,16H200a16,16,0,0,0,16-16V88A8,8,0,0,0,213.66,82.34ZM160,51.31,188.69,80H160ZM200,216H56V40h88V88a8,8,0,0,0,8,8h48V216Z"}))],["thin",x.createElement(x.Fragment,null,x.createElement("path",{d:"M210.83,85.17l-56-56A4,4,0,0,0,152,28H56A12,12,0,0,0,44,40V216a12,12,0,0,0,12,12H200a12,12,0,0,0,12-12V88A4,4,0,0,0,210.83,85.17ZM156,41.65,198.34,84H156ZM200,220H56a4,4,0,0,1-4-4V40a4,4,0,0,1,4-4h92V88a4,4,0,0,0,4,4h52V216A4,4,0,0,1,200,220Z"}))]]),F_e=new Map([["bold",x.createElement(x.Fragment,null,x.createElement("path",{d:"M180.49,143.51a12,12,0,0,1,0,17l-24,24a12,12,0,0,1-17-17L155,152l-15.52-15.51a12,12,0,1,1,17-17Zm-64-24a12,12,0,0,0-17,0l-24,24a12,12,0,0,0,0,17l24,24a12,12,0,0,0,17-17L101,152l15.52-15.51A12,12,0,0,0,116.49,119.51ZM220,88V216a20,20,0,0,1-20,20H56a20,20,0,0,1-20-20V40A20,20,0,0,1,56,20h96a12,12,0,0,1,8.49,3.52l56,56A12,12,0,0,1,220,88ZM160,57V80h23Zm36,155V104H148a12,12,0,0,1-12-12V44H60V212Z"}))],["duotone",x.createElement(x.Fragment,null,x.createElement("path",{d:"M208,88H152V32Z",opacity:"0.2"}),x.createElement("path",{d:"M181.66,146.34a8,8,0,0,1,0,11.32l-24,24a8,8,0,0,1-11.32-11.32L164.69,152l-18.35-18.34a8,8,0,0,1,11.32-11.32Zm-72-24a8,8,0,0,0-11.32,0l-24,24a8,8,0,0,0,0,11.32l24,24a8,8,0,0,0,11.32-11.32L91.31,152l18.35-18.34A8,8,0,0,0,109.66,122.34ZM216,88V216a16,16,0,0,1-16,16H56a16,16,0,0,1-16-16V40A16,16,0,0,1,56,24h96a8,8,0,0,1,5.66,2.34l56,56A8,8,0,0,1,216,88Zm-56-8h28.69L160,51.31Zm40,136V96H152a8,8,0,0,1-8-8V40H56V216H200Z"}))],["fill",x.createElement(x.Fragment,null,x.createElement("path",{d:"M213.66,82.34l-56-56A8,8,0,0,0,152,24H56A16,16,0,0,0,40,40V216a16,16,0,0,0,16,16H200a16,16,0,0,0,16-16V88A8,8,0,0,0,213.66,82.34Zm-104,88a8,8,0,0,1-11.32,11.32l-24-24a8,8,0,0,1,0-11.32l24-24a8,8,0,0,1,11.32,11.32L91.31,152Zm72-12.68-24,24a8,8,0,0,1-11.32-11.32L164.69,152l-18.35-18.34a8,8,0,0,1,11.32-11.32l24,24A8,8,0,0,1,181.66,157.66ZM152,88V44l44,44Z"}))],["light",x.createElement(x.Fragment,null,x.createElement("path",{d:"M180.24,147.76a6,6,0,0,1,0,8.48l-24,24a6,6,0,0,1-8.48-8.48L167.51,152l-19.75-19.76a6,6,0,1,1,8.48-8.48Zm-72-24a6,6,0,0,0-8.48,0l-24,24a6,6,0,0,0,0,8.48l24,24a6,6,0,1,0,8.48-8.48L88.49,152l19.75-19.76A6,6,0,0,0,108.24,123.76ZM214,88V216a14,14,0,0,1-14,14H56a14,14,0,0,1-14-14V40A14,14,0,0,1,56,26h96a6,6,0,0,1,4.25,1.76l56,56A6,6,0,0,1,214,88Zm-56-6h35.52L158,46.48Zm44,134V94H152a6,6,0,0,1-6-6V38H56a2,2,0,0,0-2,2V216a2,2,0,0,0,2,2H200A2,2,0,0,0,202,216Z"}))],["regular",x.createElement(x.Fragment,null,x.createElement("path",{d:"M181.66,146.34a8,8,0,0,1,0,11.32l-24,24a8,8,0,0,1-11.32-11.32L164.69,152l-18.35-18.34a8,8,0,0,1,11.32-11.32Zm-72-24a8,8,0,0,0-11.32,0l-24,24a8,8,0,0,0,0,11.32l24,24a8,8,0,0,0,11.32-11.32L91.31,152l18.35-18.34A8,8,0,0,0,109.66,122.34ZM216,88V216a16,16,0,0,1-16,16H56a16,16,0,0,1-16-16V40A16,16,0,0,1,56,24h96a8,8,0,0,1,5.66,2.34l56,56A8,8,0,0,1,216,88Zm-56-8h28.69L160,51.31Zm40,136V96H152a8,8,0,0,1-8-8V40H56V216H200Z"}))],["thin",x.createElement(x.Fragment,null,x.createElement("path",{d:"M178.83,149.17a4,4,0,0,1,0,5.66l-24,24a4,4,0,0,1-5.66-5.66L170.34,152l-21.17-21.17a4,4,0,1,1,5.66-5.66Zm-72-24a4,4,0,0,0-5.66,0l-24,24a4,4,0,0,0,0,5.66l24,24a4,4,0,1,0,5.66-5.66L85.66,152l21.17-21.17A4,4,0,0,0,106.83,125.17ZM212,88V216a12,12,0,0,1-12,12H56a12,12,0,0,1-12-12V40A12,12,0,0,1,56,28h96a4,4,0,0,1,2.83,1.17l56,56A4,4,0,0,1,212,88Zm-56-4h42.34L156,41.65Zm48,132V92H152a4,4,0,0,1-4-4V36H56a4,4,0,0,0-4,4V216a4,4,0,0,0,4,4H200A4,4,0,0,0,204,216Z"}))]]),$_e=new Map([["bold",x.createElement(x.Fragment,null,x.createElement("path",{d:"M48,180c0,8.67,5.5,16,12,16a10.27,10.27,0,0,0,7.33-3.43,12,12,0,1,1,17.34,16.6A34,34,0,0,1,60,220C40.15,220,24,202,24,180s16.15-40,36-40a34,34,0,0,1,24.67,10.83,12,12,0,1,1-17.34,16.6A10.27,10.27,0,0,0,60,164C53.5,164,48,171.31,48,180Zm97.51-5.71c-5.12-3.45-11.32-5.24-16.8-6.82a79.5,79.5,0,0,1-7.91-2.59c2.45-1.18,9.71-1.3,16.07.33A12,12,0,0,0,143,142a69,69,0,0,0-12-1.86c-9.93-.66-18,1.08-24.1,5.17a24.45,24.45,0,0,0-10.69,17.76c-1.1,8.74,2.49,16.27,10.11,21.19,4.78,3.09,10.36,4.7,15.75,6.26,3,.89,7.94,2.3,9.88,3.53a2.48,2.48,0,0,1-.21.71c-1.37,1.55-9.58,1.79-16.39-.06a12,12,0,1,0-6.46,23.11A63.75,63.75,0,0,0,125.1,220c6.46,0,13.73-1.17,19.73-5.15a24.73,24.73,0,0,0,10.95-18C157,187.53,153.33,179.53,145.51,174.27Zm68,0c-5.12-3.45-11.32-5.24-16.8-6.82a79.5,79.5,0,0,1-7.91-2.59c2.45-1.18,9.71-1.3,16.07.33A12,12,0,0,0,211,142a69,69,0,0,0-12-1.86c-9.93-.66-18,1.08-24.1,5.17a24.45,24.45,0,0,0-10.69,17.76c-1.1,8.74,2.49,16.27,10.11,21.19,4.78,3.09,10.36,4.7,15.75,6.26,3,.89,7.94,2.3,9.88,3.53a2.48,2.48,0,0,1-.21.71c-1.37,1.55-9.58,1.79-16.39-.06a12,12,0,1,0-6.46,23.11A63.75,63.75,0,0,0,193.1,220c6.46,0,13.73-1.17,19.73-5.15a24.73,24.73,0,0,0,10.95-18C225,187.53,221.33,179.53,213.51,174.27ZM36,108V40A20,20,0,0,1,56,20h96a12,12,0,0,1,8.49,3.51l56,56A12,12,0,0,1,220,88v20a12,12,0,1,1-24,0v-4H148a12,12,0,0,1-12-12V44H60v64a12,12,0,1,1-24,0ZM160,80h23L160,57Z"}))],["duotone",x.createElement(x.Fragment,null,x.createElement("path",{d:"M208,88H152V32Z",opacity:"0.2"}),x.createElement("path",{d:"M48,180c0,11,7.18,20,16,20a14.2,14.2,0,0,0,10.22-4.66A8,8,0,1,1,85.77,206.4,30,30,0,0,1,64,216c-17.65,0-32-16.15-32-36s14.35-36,32-36a30,30,0,0,1,21.77,9.6,8,8,0,1,1-11.55,11.06A14.24,14.24,0,0,0,64,160C55.18,160,48,169,48,180Zm79.6-8.69c-4-1.16-8.14-2.35-10.45-3.84-1.26-.81-1.23-1-1.12-1.9a4.54,4.54,0,0,1,2-3.67c4.6-3.12,15.35-1.73,19.83-.56a8,8,0,0,0,4.07-15.48c-2.12-.55-21-5.22-32.83,2.76a20.55,20.55,0,0,0-9,14.95c-2,15.88,13.64,20.41,23,23.11,12.07,3.49,13.13,4.92,12.78,7.59-.31,2.41-1.26,3.34-2.14,3.93-4.6,3.06-15.17,1.56-19.55.36a8,8,0,0,0-4.3,15.41,61.23,61.23,0,0,0,15.18,2c5.83,0,12.3-1,17.49-4.46a20.82,20.82,0,0,0,9.19-15.23C154,179,137.48,174.17,127.6,171.31Zm64,0c-4-1.16-8.14-2.35-10.45-3.84-1.25-.81-1.23-1-1.12-1.9a4.54,4.54,0,0,1,2-3.67c4.6-3.12,15.34-1.73,19.82-.56a8,8,0,0,0,4.07-15.48c-2.11-.55-21-5.22-32.83,2.76a20.58,20.58,0,0,0-8.95,14.95c-2,15.88,13.65,20.41,23,23.11,12.06,3.49,13.12,4.92,12.78,7.59-.31,2.41-1.26,3.34-2.15,3.93-4.6,3.06-15.16,1.56-19.54.36A8,8,0,0,0,173.93,214a61.34,61.34,0,0,0,15.19,2c5.82,0,12.3-1,17.49-4.46a20.81,20.81,0,0,0,9.18-15.23C218,179,201.48,174.17,191.59,171.31ZM40,112V40A16,16,0,0,1,56,24h96a8,8,0,0,1,5.66,2.34l56,56A8,8,0,0,1,216,88v24a8,8,0,1,1-16,0V96H152a8,8,0,0,1-8-8V40H56v72a8,8,0,0,1-16,0ZM160,80h28.68L160,51.31Z"}))],["fill",x.createElement(x.Fragment,null,x.createElement("path",{d:"M48,180c0,11,7.18,20,16,20a14.18,14.18,0,0,0,10.06-4.5,8.2,8.2,0,0,1,10.9-.91,8,8,0,0,1,.81,11.81A30,30,0,0,1,64,216c-17.65,0-32-16.15-32-36s14.35-36,32-36a30,30,0,0,1,21.38,9.19,8.26,8.26,0,0,1,.74,11.09,8,8,0,0,1-11.9.38A14.2,14.2,0,0,0,64,160C55.18,160,48,169,48,180Zm79.6-8.69c-4-1.16-8.14-2.35-10.45-3.84-1.26-.81-1.23-1-1.12-1.9a4.54,4.54,0,0,1,2-3.67c4.6-3.12,15.35-1.73,19.83-.56a8,8,0,0,0,4.07-15.48c-2.12-.55-21-5.22-32.83,2.76a20.55,20.55,0,0,0-9,14.95c-2,15.88,13.64,20.41,23,23.11,12.07,3.49,13.13,4.92,12.78,7.59-.31,2.41-1.26,3.34-2.14,3.93-4.6,3.06-15.17,1.56-19.55.36a8,8,0,0,0-4.3,15.41,61.23,61.23,0,0,0,15.18,2c5.83,0,12.3-1,17.49-4.46a20.82,20.82,0,0,0,9.19-15.23C154,179,137.48,174.17,127.6,171.31Zm64,0c-4-1.16-8.14-2.35-10.45-3.84-1.25-.81-1.23-1-1.12-1.9a4.54,4.54,0,0,1,2-3.67c4.6-3.12,15.34-1.73,19.82-.56a8,8,0,0,0,4.07-15.48c-2.11-.55-21-5.22-32.83,2.76a20.58,20.58,0,0,0-8.95,14.95c-2,15.88,13.65,20.41,23,23.11,12.06,3.49,13.12,4.92,12.78,7.59-.31,2.41-1.26,3.34-2.15,3.93-4.6,3.06-15.16,1.56-19.54.36A8,8,0,0,0,173.93,214a61.34,61.34,0,0,0,15.19,2c5.82,0,12.3-1,17.49-4.46a20.81,20.81,0,0,0,9.18-15.23C218,179,201.48,174.17,191.59,171.31ZM40,116V40A16,16,0,0,1,56,24h96a8,8,0,0,1,5.66,2.34l56,56A8,8,0,0,1,216,88v28a4,4,0,0,1-4,4H44A4,4,0,0,1,40,116ZM152,88h44L152,44Z"}))],["light",x.createElement(x.Fragment,null,x.createElement("path",{d:"M46,180c0,12.13,8.07,22,18,22a16.21,16.21,0,0,0,11.66-5.28,6,6,0,0,1,8.67,8.3A28.09,28.09,0,0,1,64,214c-16.54,0-30-15.25-30-34s13.46-34,30-34a28.09,28.09,0,0,1,20.33,9,6,6,0,0,1-8.67,8.3A16.21,16.21,0,0,0,64,158C54.07,158,46,167.86,46,180Zm81-6.77c-10.85-3.13-13.4-4.69-13-7.91a6.56,6.56,0,0,1,2.88-5.08c5.59-3.79,17.66-1.82,21.44-.84a6,6,0,1,0,3.06-11.6c-2-.53-20.09-5-31.2,2.48a18.62,18.62,0,0,0-8.09,13.54c-1.79,14.19,12.27,18.25,21.57,20.94,12.12,3.5,14.78,5.33,14.21,9.76a6.89,6.89,0,0,1-3,5.34c-5.6,3.73-17.48,1.64-21.18.62A6,6,0,1,0,110.48,212a59.29,59.29,0,0,0,14.67,2c5.49,0,11.55-.95,16.36-4.14a18.89,18.89,0,0,0,8.31-13.81C151.83,180.39,136.92,176.08,127,173.22Zm64,0c-10.85-3.13-13.41-4.69-13-7.91a6.59,6.59,0,0,1,2.88-5.08c5.6-3.79,17.65-1.83,21.44-.84a6,6,0,0,0,3.07-11.6c-2-.54-20.1-5-31.21,2.48a18.64,18.64,0,0,0-8.08,13.54c-1.8,14.19,12.26,18.25,21.57,20.94,12.12,3.5,14.77,5.33,14.2,9.76a6.85,6.85,0,0,1-3,5.34c-5.61,3.73-17.48,1.64-21.19.62A6,6,0,0,0,174.47,212a59.41,59.41,0,0,0,14.68,2c5.49,0,11.54-.95,16.36-4.14a18.89,18.89,0,0,0,8.31-13.81C215.83,180.39,200.91,176.08,191,173.22ZM202,94H152a6,6,0,0,1-6-6V38H56a2,2,0,0,0-2,2v72a6,6,0,1,1-12,0V40A14,14,0,0,1,56,26h96a6,6,0,0,1,4.24,1.76l56,56A6,6,0,0,1,214,88v24a6,6,0,1,1-12,0ZM193.5,82,158,46.48V82Z"}))],["regular",x.createElement(x.Fragment,null,x.createElement("path",{d:"M48,180c0,11,7.18,20,16,20a14.24,14.24,0,0,0,10.22-4.66A8,8,0,1,1,85.77,206.4,30,30,0,0,1,64,216c-17.65,0-32-16.15-32-36s14.35-36,32-36a30,30,0,0,1,21.77,9.6,8,8,0,1,1-11.55,11.06A14.24,14.24,0,0,0,64,160C55.18,160,48,169,48,180Zm79.6-8.69c-4-1.16-8.14-2.35-10.45-3.84-1.26-.81-1.23-1-1.12-1.9a4.54,4.54,0,0,1,2-3.67c4.6-3.12,15.34-1.73,19.83-.56a8,8,0,0,0,4.07-15.48c-2.12-.55-21-5.22-32.83,2.76a20.55,20.55,0,0,0-9,14.95c-2,15.88,13.64,20.41,23,23.11,12.07,3.49,13.13,4.92,12.78,7.59-.31,2.41-1.26,3.34-2.14,3.93-4.6,3.06-15.17,1.56-19.55.36a8,8,0,0,0-4.3,15.41,61.23,61.23,0,0,0,15.18,2c5.83,0,12.3-1,17.49-4.46a20.82,20.82,0,0,0,9.19-15.23C154,179,137.48,174.17,127.6,171.31Zm64,0c-4-1.16-8.14-2.35-10.45-3.84-1.25-.81-1.23-1-1.12-1.9a4.54,4.54,0,0,1,2-3.67c4.6-3.12,15.34-1.73,19.82-.56a8,8,0,0,0,4.07-15.48c-2.11-.55-21-5.22-32.83,2.76a20.58,20.58,0,0,0-8.95,14.95c-2,15.88,13.65,20.41,23,23.11,12.06,3.49,13.12,4.92,12.78,7.59-.31,2.41-1.26,3.34-2.15,3.93-4.6,3.06-15.16,1.56-19.54.36A8,8,0,0,0,173.93,214a61.34,61.34,0,0,0,15.19,2c5.82,0,12.3-1,17.49-4.46a20.81,20.81,0,0,0,9.18-15.23C218,179,201.48,174.17,191.59,171.31ZM40,112V40A16,16,0,0,1,56,24h96a8,8,0,0,1,5.66,2.34l56,56A8,8,0,0,1,216,88v24a8,8,0,1,1-16,0V96H152a8,8,0,0,1-8-8V40H56v72a8,8,0,0,1-16,0ZM160,80h28.68L160,51.31Z"}))],["thin",x.createElement(x.Fragment,null,x.createElement("path",{d:"M44,180c0,13.23,9,24,20,24a18.15,18.15,0,0,0,13.11-5.9,4,4,0,0,1,5.78,5.54A26.13,26.13,0,0,1,64,212c-15.44,0-28-14.36-28-32s12.56-32,28-32a26.13,26.13,0,0,1,18.89,8.36,4,4,0,0,1-5.78,5.54A18.15,18.15,0,0,0,64,156C53,156,44,166.77,44,180Zm82.49-4.85c-10.53-3-15.08-4.91-14.43-10.08a8.57,8.57,0,0,1,3.75-6.49c6.26-4.23,18.77-2.24,23.07-1.11a4,4,0,0,0,2-7.74,61.11,61.11,0,0,0-10.47-1.61c-8.12-.54-14.54.75-19.1,3.82a16.63,16.63,0,0,0-7.22,12.13c-1.58,12.49,10.46,16,20.14,18.77,11.25,3.25,16.47,5.49,15.63,11.94a8.93,8.93,0,0,1-3.9,6.75c-6.28,4.17-18.61,2.05-22.83.88a4,4,0,1,0-2.15,7.7A57.79,57.79,0,0,0,125.19,212c5.18,0,10.83-.86,15.22-3.77a17,17,0,0,0,7.43-12.41C149.64,181.84,136.26,178,126.49,175.15Zm64,0c-10.53-3-15.08-4.91-14.43-10.08a8.57,8.57,0,0,1,3.75-6.49c6.26-4.23,18.77-2.24,23.07-1.11a4,4,0,0,0,2-7.74,61.33,61.33,0,0,0-10.48-1.61c-8.11-.54-14.54.75-19.09,3.82a16.63,16.63,0,0,0-7.22,12.13c-1.59,12.49,10.46,16,20.14,18.77,11.25,3.25,16.46,5.49,15.63,11.94a8.93,8.93,0,0,1-3.9,6.75c-6.28,4.17-18.61,2.05-22.83.88a4,4,0,1,0-2.15,7.7A57.7,57.7,0,0,0,189.19,212c5.17,0,10.83-.86,15.22-3.77a17,17,0,0,0,7.43-12.41C213.63,181.84,200.26,178,190.49,175.15ZM204,92H152a4,4,0,0,1-4-4V36H56a4,4,0,0,0-4,4v72a4,4,0,0,1-8,0V40A12,12,0,0,1,56,28h96a4,4,0,0,1,2.83,1.17l56,56A4,4,0,0,1,212,88v24a4,4,0,0,1-8,0Zm-5.65-8L156,41.65V84Z"}))]]),B_e=new Map([["bold",x.createElement(x.Fragment,null,x.createElement("path",{d:"M48,128a12,12,0,0,0,12-12V44h76V92a12,12,0,0,0,12,12h48v12a12,12,0,0,0,24,0V88a12,12,0,0,0-3.51-8.49l-56-56A12,12,0,0,0,152,20H56A20,20,0,0,0,36,40v76A12,12,0,0,0,48,128ZM183,80H160V57ZM68,160v48a12,12,0,0,1-24,0V196H32v12a12,12,0,0,1-24,0V160a12,12,0,0,1,24,0v12H44V160a12,12,0,0,1,24,0Zm60,0a12,12,0,0,1-12,12h-4v36a12,12,0,0,1-24,0V172H84a12,12,0,0,1,0-24h32A12,12,0,0,1,128,160Zm72,0v48a12,12,0,0,1-24,0v-9.36l-.11.16a12,12,0,0,1-19.78,0l-.11-.16V208a12,12,0,0,1-24,0V160a12,12,0,0,1,21.89-6.8L166,170.82l12.11-17.62A12,12,0,0,1,200,160Zm56,48a12,12,0,0,1-12,12H220a12,12,0,0,1-12-12V160a12,12,0,0,1,24,0v36h12A12,12,0,0,1,256,208Z"}))],["duotone",x.createElement(x.Fragment,null,x.createElement("path",{d:"M208,88H152V32Z",opacity:"0.2"}),x.createElement("path",{d:"M216,120V88a8,8,0,0,0-2.34-5.66l-56-56A8,8,0,0,0,152,24H56A16,16,0,0,0,40,40v80a8,8,0,0,0,16,0V40h88V88a8,8,0,0,0,8,8h48v24a8,8,0,0,0,16,0ZM160,51.31,188.69,80H160ZM68,160v48a8,8,0,0,1-16,0V192H32v16a8,8,0,0,1-16,0V160a8,8,0,0,1,16,0v16H52V160a8,8,0,0,1,16,0Zm56,0a8,8,0,0,1-8,8h-8v40a8,8,0,0,1-16,0V168H84a8,8,0,0,1,0-16h32A8,8,0,0,1,124,160Zm72,0v48a8,8,0,0,1-16,0V184l-9.6,12.8a8,8,0,0,1-12.8,0L148,184v24a8,8,0,0,1-16,0V160a8,8,0,0,1,14.4-4.8L164,178.67l17.6-23.47A8,8,0,0,1,196,160Zm56,48a8,8,0,0,1-8,8H216a8,8,0,0,1-8-8V160a8,8,0,0,1,16,0v40h20A8,8,0,0,1,252,208Z"}))],["fill",x.createElement(x.Fragment,null,x.createElement("path",{d:"M44,128H212a4,4,0,0,0,4-4V88a8,8,0,0,0-2.34-5.66l-56-56A8,8,0,0,0,152,24H56A16,16,0,0,0,40,40v84A4,4,0,0,0,44,128ZM152,44l44,44H152ZM68,160v48a8,8,0,0,1-16,0V192H32v16a8,8,0,0,1-16,0V160a8,8,0,0,1,16,0v16H52V160a8,8,0,0,1,16,0Zm56,0a8,8,0,0,1-8,8h-8v40a8,8,0,0,1-16,0V168H84a8,8,0,0,1,0-16h32A8,8,0,0,1,124,160Zm72,0v48a8,8,0,0,1-16,0V184l-9.6,12.8a8,8,0,0,1-12.8,0L148,184v24a8,8,0,0,1-16,0V160a8,8,0,0,1,14.4-4.8L164,178.67l17.6-23.47A8,8,0,0,1,196,160Zm56,48a8,8,0,0,1-8,8H216a8,8,0,0,1-8-8V160a8,8,0,0,1,16,0v40h20A8,8,0,0,1,252,208Z"}))],["light",x.createElement(x.Fragment,null,x.createElement("path",{d:"M214,120V88a6,6,0,0,0-1.76-4.24l-56-56A6,6,0,0,0,152,26H56A14,14,0,0,0,42,40v80a6,6,0,0,0,12,0V40a2,2,0,0,1,2-2h90V88a6,6,0,0,0,6,6h50v26a6,6,0,0,0,12,0ZM158,46.48,193.52,82H158ZM66,160v48a6,6,0,0,1-12,0V190H30v18a6,6,0,0,1-12,0V160a6,6,0,0,1,12,0v18H54V160a6,6,0,0,1,12,0Zm56,0a6,6,0,0,1-6,6H106v42a6,6,0,0,1-12,0V166H84a6,6,0,0,1,0-12h32A6,6,0,0,1,122,160Zm72,0v48a6,6,0,0,1-12,0V178l-13.2,17.6a6,6,0,0,1-9.6,0L146,178v30a6,6,0,0,1-12,0V160a6,6,0,0,1,10.8-3.6L164,182l19.2-25.6A6,6,0,0,1,194,160Zm56,48a6,6,0,0,1-6,6H216a6,6,0,0,1-6-6V160a6,6,0,0,1,12,0v42h22A6,6,0,0,1,250,208Z"}))],["regular",x.createElement(x.Fragment,null,x.createElement("path",{d:"M216,120V88a8,8,0,0,0-2.34-5.66l-56-56A8,8,0,0,0,152,24H56A16,16,0,0,0,40,40v80a8,8,0,0,0,16,0V40h88V88a8,8,0,0,0,8,8h48v24a8,8,0,0,0,16,0ZM160,51.31,188.69,80H160ZM68,160v48a8,8,0,0,1-16,0V192H32v16a8,8,0,0,1-16,0V160a8,8,0,0,1,16,0v16H52V160a8,8,0,0,1,16,0Zm56,0a8,8,0,0,1-8,8h-8v40a8,8,0,0,1-16,0V168H84a8,8,0,0,1,0-16h32A8,8,0,0,1,124,160Zm72,0v48a8,8,0,0,1-16,0V184l-9.6,12.8a8,8,0,0,1-12.8,0L148,184v24a8,8,0,0,1-16,0V160a8,8,0,0,1,14.4-4.8L164,178.67l17.6-23.47A8,8,0,0,1,196,160Zm56,48a8,8,0,0,1-8,8H216a8,8,0,0,1-8-8V160a8,8,0,0,1,16,0v40h20A8,8,0,0,1,252,208Z"}))],["thin",x.createElement(x.Fragment,null,x.createElement("path",{d:"M212,88a4,4,0,0,0-1.17-2.83l-2-2h0l-54-54A4,4,0,0,0,152,28H56A12,12,0,0,0,44,40v80a4,4,0,0,0,8,0V40a4,4,0,0,1,4-4h92V88a4,4,0,0,0,4,4h52v28a4,4,0,0,0,8,0ZM156,41.65,198.34,84H156ZM64,160v48a4,4,0,0,1-8,0V188H28v20a4,4,0,0,1-8,0V160a4,4,0,0,1,8,0v20H56V160a4,4,0,0,1,8,0Zm56,0a4,4,0,0,1-4,4H104v44a4,4,0,0,1-8,0V164H84a4,4,0,0,1,0-8h32A4,4,0,0,1,120,160Zm72,0v48a4,4,0,0,1-8,0V172l-16.8,22.4a4,4,0,0,1-6.4,0L144,172v36a4,4,0,0,1-8,0V160a4,4,0,0,1,7.2-2.4L164,185.33l20.8-27.73A4,4,0,0,1,192,160Zm56,48a4,4,0,0,1-4,4H216a4,4,0,0,1-4-4V160a4,4,0,0,1,8,0v44h24A4,4,0,0,1,248,208Z"}))]]),V_e=new Map([["bold",x.createElement(x.Fragment,null,x.createElement("path",{d:"M120,140H104a12,12,0,0,0-12,12v56a12,12,0,0,0,24,0v-4h4a32,32,0,0,0,0-64Zm0,40h-4V164h4a8,8,0,0,1,0,16Zm104,20.87a12,12,0,0,1-3.33,8.3A34,34,0,0,1,196,220c-19.85,0-36-17.94-36-40s16.15-40,36-40a33.39,33.39,0,0,1,18.71,5.8,12,12,0,1,1-13.42,19.89A9.39,9.39,0,0,0,196,164c-6.5,0-12,7.33-12,16s5.5,16,12,16a9,9,0,0,0,2.7-.42A12,12,0,0,1,208,176h4a12,12,0,0,1,12,12ZM80,152v38a30,30,0,0,1-60,0,12,12,0,0,1,24,0,6,6,0,0,0,12,0V152a12,12,0,0,1,24,0ZM48,120a12,12,0,0,0,12-12V44h76V92a12,12,0,0,0,12,12h48v4a12,12,0,0,0,24,0V88a12,12,0,0,0-3.51-8.48l-56-56A12,12,0,0,0,152,20H56A20,20,0,0,0,36,40v68A12,12,0,0,0,48,120ZM160,57l23,23H160Z"}))],["duotone",x.createElement(x.Fragment,null,x.createElement("path",{d:"M208,88H152V32Z",opacity:"0.2"}),x.createElement("path",{d:"M120,144H104a8,8,0,0,0-8,8v56a8,8,0,0,0,16,0v-8h8a28,28,0,0,0,0-56Zm0,40h-8V160h8a12,12,0,0,1,0,24Zm96,0v16.87a8,8,0,0,1-2.22,5.53A30.06,30.06,0,0,1,192,216c-17.64,0-32-16.15-32-36s14.36-36,32-36a29.38,29.38,0,0,1,16.48,5.12,8,8,0,0,1-9,13.26A13.21,13.21,0,0,0,192,160c-8.82,0-16,9-16,20s7.18,20,16,20a13.63,13.63,0,0,0,8-2.71V192a8,8,0,0,1,0-16h8A8,8,0,0,1,216,184ZM80,152v38a26,26,0,0,1-52,0,8,8,0,0,1,16,0,10,10,0,0,0,20,0V152a8,8,0,0,1,16,0ZM213.66,82.34l-56-56A8,8,0,0,0,152,24H56A16,16,0,0,0,40,40v72a8,8,0,0,0,16,0V40h88V88a8,8,0,0,0,8,8h48v16a8,8,0,0,0,16,0V88A8,8,0,0,0,213.66,82.34ZM160,80V51.31L188.69,80Z"}))],["fill",x.createElement(x.Fragment,null,x.createElement("path",{d:"M44,120H212a4,4,0,0,0,4-4V88a8,8,0,0,0-2.34-5.66l-56-56A8,8,0,0,0,152,24H56A16,16,0,0,0,40,40v76A4,4,0,0,0,44,120ZM152,44l44,44H152ZM120,144H104a8,8,0,0,0-8,8v55.73a8.17,8.17,0,0,0,7.47,8.25,8,8,0,0,0,8.53-8v-8h7.4c15.24,0,28.13-11.92,28.59-27.15A28,28,0,0,0,120,144Zm-.35,40H112V160h8a12,12,0,0,1,11.94,13.16A12.23,12.23,0,0,1,119.65,184ZM216,200.87a8,8,0,0,1-2.26,5.57A30,30,0,0,1,192,216c-17.64,0-32-16.15-32-36s14.36-36,32-36a29.36,29.36,0,0,1,16.09,4.86,8.21,8.21,0,0,1,3,10.64,8,8,0,0,1-11.55,2.88A13.21,13.21,0,0,0,192,160c-8.82,0-16,9-16,20s7.18,20,16,20a13.63,13.63,0,0,0,8-2.71V192a8,8,0,0,1-8-8.53,8.17,8.17,0,0,1,8.25-7.47H208a8,8,0,0,1,8,8ZM80,152v37.41c0,14.22-11.18,26.26-25.41,26.58A26,26,0,0,1,28,190.37,8.17,8.17,0,0,1,35.31,182,8,8,0,0,1,44,190.22a8.89,8.89,0,0,0,4,8c7.85,4.82,16-.75,16-8.2V152.27A8.17,8.17,0,0,1,71.47,144,8,8,0,0,1,80,152Z"}))],["light",x.createElement(x.Fragment,null,x.createElement("path",{d:"M120,146H104a6,6,0,0,0-6,6v56a6,6,0,0,0,12,0V198h10a26,26,0,0,0,0-52Zm0,40H110V158h10a14,14,0,0,1,0,28Zm94-2v16.87a6,6,0,0,1-1.67,4.15A28.06,28.06,0,0,1,192,214c-16.54,0-30-15.25-30-34s13.46-34,30-34a27.43,27.43,0,0,1,15.36,4.77,6,6,0,0,1-6.72,9.95A15.25,15.25,0,0,0,192,158c-9.93,0-18,9.87-18,22s8.07,22,18,22a15.75,15.75,0,0,0,10-3.73V190h-2a6,6,0,0,1,0-12h8A6,6,0,0,1,214,184ZM78,152v38a24,24,0,0,1-48,0,6,6,0,0,1,12,0,12,12,0,0,0,24,0V152a6,6,0,0,1,12,0ZM212.24,83.76l-56-56A6,6,0,0,0,152,26H56A14,14,0,0,0,42,40v72a6,6,0,0,0,12,0V40a2,2,0,0,1,2-2h90V88a6,6,0,0,0,6,6h50v18a6,6,0,0,0,12,0V88A6,6,0,0,0,212.24,83.76ZM158,82V46.48L193.52,82Z"}))],["regular",x.createElement(x.Fragment,null,x.createElement("path",{d:"M120,144H104a8,8,0,0,0-8,8v56a8,8,0,0,0,16,0v-8h8a28,28,0,0,0,0-56Zm0,40h-8V160h8a12,12,0,0,1,0,24Zm96,0v16.87a8,8,0,0,1-2.22,5.53A30.06,30.06,0,0,1,192,216c-17.65,0-32-16.15-32-36s14.35-36,32-36a29.38,29.38,0,0,1,16.48,5.12,8,8,0,0,1-9,13.26A13.21,13.21,0,0,0,192,160c-8.82,0-16,9-16,20s7.18,20,16,20a13.63,13.63,0,0,0,8-2.71V192a8,8,0,0,1,0-16h8A8,8,0,0,1,216,184ZM80,152v38a26,26,0,0,1-52,0,8,8,0,0,1,16,0,10,10,0,0,0,20,0V152a8,8,0,0,1,16,0ZM213.66,82.34l-56-56A8,8,0,0,0,152,24H56A16,16,0,0,0,40,40v72a8,8,0,0,0,16,0V40h88V88a8,8,0,0,0,8,8h48v16a8,8,0,0,0,16,0V88A8,8,0,0,0,213.66,82.34ZM160,80V51.31L188.69,80Z"}))],["thin",x.createElement(x.Fragment,null,x.createElement("path",{d:"M120,148H104a4,4,0,0,0-4,4v56a4,4,0,0,0,8,0V196h12a24,24,0,0,0,0-48Zm0,40H108V156h12a16,16,0,0,1,0,32Zm92-4v16.87a4,4,0,0,1-1.11,2.77A26.11,26.11,0,0,1,192,212c-15.44,0-28-14.36-28-32s12.56-32,28-32a25.41,25.41,0,0,1,14.24,4.43,4,4,0,1,1-4.48,6.63A17.45,17.45,0,0,0,192,156c-11,0-20,10.77-20,24s9,24,20,24a17.87,17.87,0,0,0,12-4.82V188h-4a4,4,0,0,1,0-8h8A4,4,0,0,1,212,184ZM76,152v38a22,22,0,0,1-44,0,4,4,0,0,1,8,0,14,14,0,0,0,28,0V152a4,4,0,0,1,8,0ZM210.83,85.17l-56-56A4,4,0,0,0,152,28H56A12,12,0,0,0,44,40v72a4,4,0,0,0,8,0V40a4,4,0,0,1,4-4h92V88a4,4,0,0,0,4,4h52v20a4,4,0,0,0,8,0V88A4,4,0,0,0,210.83,85.17ZM156,84V41.65L198.34,84Z"}))]]),H_e=new Map([["bold",x.createElement(x.Fragment,null,x.createElement("path",{d:"M216.49,79.51l-56-56A12,12,0,0,0,152,20H56A20,20,0,0,0,36,40v68a12,12,0,0,0,24,0V44h76V92a12,12,0,0,0,12,12h48V212H180a12,12,0,0,0,0,24h20a20,20,0,0,0,20-20V88A12,12,0,0,0,216.49,79.51ZM160,57l23,23H160Zm-4.22,139.85a24.75,24.75,0,0,1-10.95,18.06c-6,4-13.27,5.15-19.73,5.15a63.75,63.75,0,0,1-16.23-2.21,12,12,0,0,1,6.46-23.12c6.81,1.86,15,1.61,16.39.06a2.48,2.48,0,0,0,.21-.71c-1.94-1.23-6.83-2.64-9.88-3.52-5.39-1.56-11-3.18-15.75-6.27-7.62-4.92-11.21-12.45-10.11-21.2a24.45,24.45,0,0,1,10.69-17.75c6.06-4.09,14.17-5.84,24.1-5.18A68.53,68.53,0,0,1,143,142a12,12,0,0,1-6.1,23.21c-6.36-1.63-13.62-1.51-16.07-.33a79.5,79.5,0,0,0,7.91,2.59c5.48,1.58,11.68,3.37,16.8,6.82C153.33,179.55,157,187.55,155.78,196.82ZM84,152v38a30,30,0,0,1-60,0,12,12,0,0,1,24,0,6,6,0,0,0,12,0V152a12,12,0,0,1,24,0Z"}))],["duotone",x.createElement(x.Fragment,null,x.createElement("path",{d:"M208,88H152V32Z",opacity:"0.2"}),x.createElement("path",{d:"M213.66,82.34l-56-56A8,8,0,0,0,152,24H56A16,16,0,0,0,40,40v72a8,8,0,0,0,16,0V40h88V88a8,8,0,0,0,8,8h48V216H176a8,8,0,0,0,0,16h24a16,16,0,0,0,16-16V88A8,8,0,0,0,213.66,82.34ZM160,51.31,188.69,80H160Zm-12.19,145a20.82,20.82,0,0,1-9.19,15.23C133.43,215,127,216,121.13,216A61.14,61.14,0,0,1,106,214a8,8,0,1,1,4.3-15.41c4.38,1.2,15,2.7,19.55-.36.88-.59,1.83-1.52,2.14-3.93.35-2.67-.71-4.1-12.78-7.59-9.35-2.7-25-7.23-23-23.11a20.56,20.56,0,0,1,9-14.95c11.84-8,30.71-3.31,32.83-2.76a8,8,0,0,1-4.07,15.48c-4.49-1.17-15.23-2.56-19.83.56a4.54,4.54,0,0,0-2,3.67c-.12.9-.14,1.09,1.11,1.9,2.31,1.49,6.45,2.68,10.45,3.84C133.49,174.17,150.05,179,147.81,196.31ZM80,152v38a26,26,0,0,1-52,0,8,8,0,0,1,16,0,10,10,0,0,0,20,0V152a8,8,0,0,1,16,0Z"}))],["fill",x.createElement(x.Fragment,null,x.createElement("path",{d:"M213.66,82.34l-56-56A8,8,0,0,0,152,24H56A16,16,0,0,0,40,40v76a4,4,0,0,0,4,4H164a4,4,0,0,1,4,4V228a4,4,0,0,0,4,4h28a16,16,0,0,0,16-16V88A8,8,0,0,0,213.66,82.34ZM152,88V44l44,44Zm-4.19,108.31a20.82,20.82,0,0,1-9.19,15.23C133.43,215,127,216,121.13,216a61.34,61.34,0,0,1-15.19-2,8,8,0,0,1,4.31-15.41c4.38,1.2,15,2.7,19.55-.36.88-.59,1.83-1.52,2.14-3.93.34-2.67-.72-4.1-12.78-7.59-9.35-2.7-25-7.23-23-23.11a20.58,20.58,0,0,1,9-14.95c11.85-8,30.72-3.31,32.84-2.76a8,8,0,0,1-4.07,15.48c-4.49-1.17-15.23-2.56-19.83.56a4.57,4.57,0,0,0-2,3.67c-.11.9-.13,1.09,1.12,1.9,2.31,1.49,6.45,2.68,10.45,3.84C133.49,174.17,150,179,147.81,196.31ZM80,152v37.41c0,14.22-11.18,26.26-25.41,26.58A26,26,0,0,1,28,190.37,8.17,8.17,0,0,1,35.31,182,8,8,0,0,1,44,190.22a8.89,8.89,0,0,0,4,8c7.85,4.82,16-.75,16-8.2V152.27A8.17,8.17,0,0,1,71.47,144,8,8,0,0,1,80,152Z"}))],["light",x.createElement(x.Fragment,null,x.createElement("path",{d:"M212.24,83.76l-56-56A6,6,0,0,0,152,26H56A14,14,0,0,0,42,40v72a6,6,0,0,0,12,0V40a2,2,0,0,1,2-2h90V88a6,6,0,0,0,6,6h50V216a2,2,0,0,1-2,2H176a6,6,0,0,0,0,12h24a14,14,0,0,0,14-14V88A6,6,0,0,0,212.24,83.76ZM158,46.48,193.52,82H158ZM145.83,196.06a18.89,18.89,0,0,1-8.31,13.81c-4.82,3.19-10.87,4.14-16.36,4.14a58.89,58.89,0,0,1-14.68-2,6,6,0,0,1,3.23-11.56c3.71,1,15.58,3.11,21.19-.62a6.85,6.85,0,0,0,3-5.34c.58-4.43-2.08-6.26-14.2-9.76-9.31-2.69-23.37-6.75-21.57-20.94a18.61,18.61,0,0,1,8.08-13.54c11.11-7.49,29.18-3,31.21-2.48a6,6,0,0,1-3.06,11.6c-3.78-1-15.85-3-21.45.84a6.59,6.59,0,0,0-2.88,5.08c-.41,3.22,2.14,4.78,13,7.91C132.92,176.09,147.84,180.4,145.83,196.06ZM78,152v38a24,24,0,0,1-48,0,6,6,0,0,1,12,0,12,12,0,0,0,24,0V152a6,6,0,0,1,12,0Z"}))],["regular",x.createElement(x.Fragment,null,x.createElement("path",{d:"M213.66,82.34l-56-56A8,8,0,0,0,152,24H56A16,16,0,0,0,40,40v72a8,8,0,0,0,16,0V40h88V88a8,8,0,0,0,8,8h48V216H176a8,8,0,0,0,0,16h24a16,16,0,0,0,16-16V88A8,8,0,0,0,213.66,82.34ZM160,51.31,188.69,80H160Zm-12.19,145a20.82,20.82,0,0,1-9.19,15.23C133.43,215,127,216,121.13,216a61.34,61.34,0,0,1-15.19-2,8,8,0,0,1,4.31-15.41c4.38,1.2,15,2.7,19.55-.36.88-.59,1.83-1.52,2.14-3.93.34-2.67-.71-4.1-12.78-7.59-9.35-2.7-25-7.23-23-23.11a20.56,20.56,0,0,1,9-14.95c11.84-8,30.71-3.31,32.83-2.76a8,8,0,0,1-4.07,15.48c-4.49-1.17-15.23-2.56-19.83.56a4.54,4.54,0,0,0-2,3.67c-.12.9-.14,1.09,1.11,1.9,2.31,1.49,6.45,2.68,10.45,3.84C133.49,174.17,150.05,179,147.81,196.31ZM80,152v38a26,26,0,0,1-52,0,8,8,0,0,1,16,0,10,10,0,0,0,20,0V152a8,8,0,0,1,16,0Z"}))],["thin",x.createElement(x.Fragment,null,x.createElement("path",{d:"M210.83,85.17l-56-56A4,4,0,0,0,152,28H56A12,12,0,0,0,44,40v72a4,4,0,0,0,8,0V40a4,4,0,0,1,4-4h92V88a4,4,0,0,0,4,4h52V216a4,4,0,0,1-4,4H176a4,4,0,0,0,0,8h24a12,12,0,0,0,12-12V88A4,4,0,0,0,210.83,85.17ZM156,41.65,198.34,84H156ZM143.84,195.8a17,17,0,0,1-7.43,12.41c-4.39,2.91-10,3.77-15.22,3.77A57.89,57.89,0,0,1,107,210.11a4,4,0,0,1,2.15-7.7c4.22,1.17,16.56,3.29,22.83-.88a8.94,8.94,0,0,0,3.91-6.75c.83-6.45-4.38-8.69-15.64-11.94-9.68-2.8-21.72-6.28-20.14-18.77a16.66,16.66,0,0,1,7.22-12.13c4.56-3.07,11-4.36,19.1-3.82a61.33,61.33,0,0,1,10.48,1.61,4,4,0,0,1-2.05,7.74c-4.29-1.13-16.81-3.12-23.06,1.11a8.51,8.51,0,0,0-3.75,6.49c-.66,5.17,3.89,7,14.42,10.08C132.26,178,145.64,181.84,143.84,195.8ZM76,152v38a22,22,0,0,1-44,0,4,4,0,0,1,8,0,14,14,0,0,0,28,0V152a4,4,0,0,1,8,0Z"}))]]),Q_e=new Map([["bold",x.createElement(x.Fragment,null,x.createElement("path",{d:"M151.78,196.8a24.73,24.73,0,0,1-10.95,18c-6,4-13.27,5.15-19.73,5.15a63.75,63.75,0,0,1-16.23-2.21,12,12,0,1,1,6.46-23.11c6.81,1.85,15,1.61,16.39.06a2.48,2.48,0,0,0,.21-.71c-1.94-1.23-6.83-2.64-9.88-3.53-5.39-1.56-11-3.17-15.75-6.26-7.63-4.92-11.21-12.45-10.11-21.19a24.45,24.45,0,0,1,10.69-17.76c6.06-4.09,14.17-5.83,24.1-5.17A69,69,0,0,1,139,142a12,12,0,0,1-6.1,23.21c-6.36-1.63-13.62-1.51-16.07-.33a79.5,79.5,0,0,0,7.91,2.59c5.47,1.58,11.68,3.37,16.8,6.82C149.33,179.53,153,187.53,151.78,196.8ZM68,140a12,12,0,0,0-12,12v38a6,6,0,0,1-12,0,12,12,0,0,0-24,0,30,30,0,0,0,60,0V152A12,12,0,0,0,68,140Zm138.75,40,15-21a12,12,0,0,0-19.53-14L192,159.34,181.76,145a12,12,0,0,0-19.53,14l15,21-15,21A12,12,0,1,0,181.76,215L192,200.62,202.23,215A12,12,0,0,0,221.76,201ZM36,108V40A20,20,0,0,1,56,20h96a12,12,0,0,1,8.49,3.51l56,56A12,12,0,0,1,220,88v20a12,12,0,1,1-24,0v-4H148a12,12,0,0,1-12-12V44H60v64a12,12,0,1,1-24,0ZM160,80h23L160,57Z"}))],["duotone",x.createElement(x.Fragment,null,x.createElement("path",{d:"M208,88H152V32Z",opacity:"0.2"}),x.createElement("path",{d:"M147.81,196.31a20.82,20.82,0,0,1-9.19,15.23C133.43,215,127,216,121.13,216A60.43,60.43,0,0,1,106,214a8,8,0,1,1,4.3-15.41c4.38,1.21,15,2.71,19.55-.35.88-.6,1.83-1.52,2.14-3.93.34-2.67-.72-4.1-12.78-7.59-9.35-2.7-25-7.23-23-23.12a20.58,20.58,0,0,1,9-14.94c11.85-8,30.72-3.31,32.84-2.76a8,8,0,0,1-4.07,15.48c-4.49-1.17-15.23-2.56-19.83.56a4.54,4.54,0,0,0-2,3.67c-.12.9-.14,1.08,1.11,1.9,2.31,1.49,6.45,2.68,10.45,3.84C133.49,174.17,150,179,147.81,196.31ZM72,144a8,8,0,0,0-8,8v38a10,10,0,0,1-20,0,8,8,0,0,0-16,0,26,26,0,0,0,52,0V152A8,8,0,0,0,72,144Zm140.65,1.49a8,8,0,0,0-11.16,1.86L188,166.24l-13.49-18.89a8,8,0,0,0-13,9.3L178.17,180l-16.68,23.35a8,8,0,0,0,13,9.3L188,193.76l13.49,18.89a8,8,0,0,0,13-9.3L197.83,180l16.68-23.35A8,8,0,0,0,212.65,145.49ZM216,88v24a8,8,0,0,1-16,0V96H152a8,8,0,0,1-8-8V40H56v72a8,8,0,0,1-16,0V40A16,16,0,0,1,56,24h96a8,8,0,0,1,5.66,2.34l56,56A8,8,0,0,1,216,88Zm-27.31-8L160,51.31V80Z"}))],["fill",x.createElement(x.Fragment,null,x.createElement("path",{d:"M213.66,82.34l-56-56A8,8,0,0,0,152,24H56A16,16,0,0,0,40,40v76a4,4,0,0,0,4,4H212a4,4,0,0,0,4-4V88A8,8,0,0,0,213.66,82.34ZM152,88V44l44,44Zm-4.19,108.31a20.82,20.82,0,0,1-9.19,15.23C133.43,215,127,216,121.13,216a60.63,60.63,0,0,1-15.19-2,8,8,0,0,1,4.31-15.41c4.38,1.21,15,2.71,19.55-.35.88-.6,1.83-1.52,2.14-3.93.34-2.67-.72-4.1-12.78-7.59-9.35-2.7-25-7.23-23-23.12a20.58,20.58,0,0,1,9-14.94c11.85-8,30.72-3.31,32.84-2.76a8,8,0,0,1-4.07,15.48c-4.49-1.17-15.23-2.56-19.83.56a4.57,4.57,0,0,0-2,3.67c-.11.9-.13,1.08,1.12,1.9,2.31,1.49,6.45,2.68,10.45,3.84C133.49,174.17,150,179,147.81,196.31ZM80,152v37.4c0,14.23-11.18,26.27-25.41,26.59A26,26,0,0,1,28,190.37,8.17,8.17,0,0,1,35.31,182,8,8,0,0,1,44,190.22a8.89,8.89,0,0,0,4,8c7.85,4.82,16-.76,16-8.2V152.27A8.17,8.17,0,0,1,71.47,144,8,8,0,0,1,80,152Zm134.51,4.65L197.83,180l16.68,23.35a8,8,0,0,1-13,9.3L188,193.76l-13.49,18.89a8,8,0,1,1-13-9.3L178.17,180l-16.68-23.35a8,8,0,0,1,13-9.3L188,166.24l13.49-18.89a8,8,0,0,1,13,9.3Z"}))],["light",x.createElement(x.Fragment,null,x.createElement("path",{d:"M145.83,196.05a18.89,18.89,0,0,1-8.31,13.81c-4.82,3.19-10.87,4.14-16.36,4.14a59.41,59.41,0,0,1-14.68-2,6,6,0,0,1,3.23-11.56c3.71,1,15.58,3.11,21.19-.62a6.85,6.85,0,0,0,3-5.34c.58-4.43-2.08-6.26-14.2-9.76-9.31-2.69-23.37-6.75-21.57-20.94a18.61,18.61,0,0,1,8.08-13.54c11.11-7.49,29.18-3,31.21-2.48a6,6,0,0,1-3.06,11.6c-3.79-1-15.85-2.95-21.45.84a6.59,6.59,0,0,0-2.88,5.08c-.41,3.22,2.14,4.78,13,7.91C132.92,176.08,147.84,180.39,145.83,196.05ZM72,146a6,6,0,0,0-6,6v38a12,12,0,0,1-24,0,6,6,0,0,0-12,0,24,24,0,0,0,48,0V152A6,6,0,0,0,72,146Zm139.49,1.12a6,6,0,0,0-8.37,1.39L188,169.67,172.88,148.5a6,6,0,0,0-9.76,7L180.63,180,163.12,204.5a6,6,0,1,0,9.76,7L188,190.31l15.12,21.16a6,6,0,1,0,9.76-7L195.37,180l17.51-24.51A6,6,0,0,0,211.49,147.11ZM214,88v24a6,6,0,1,1-12,0V94H152a6,6,0,0,1-6-6V38H56a2,2,0,0,0-2,2v72a6,6,0,1,1-12,0V40A14,14,0,0,1,56,26h96a6,6,0,0,1,4.25,1.76l56,56A6,6,0,0,1,214,88Zm-20.49-6L158,46.48V82Z"}))],["regular",x.createElement(x.Fragment,null,x.createElement("path",{d:"M147.81,196.31a20.82,20.82,0,0,1-9.19,15.23C133.43,215,127,216,121.13,216a60.63,60.63,0,0,1-15.19-2,8,8,0,0,1,4.31-15.41c4.38,1.21,15,2.71,19.55-.35.88-.6,1.83-1.52,2.14-3.93.34-2.67-.72-4.1-12.78-7.59-9.35-2.7-25-7.23-23-23.11a20.58,20.58,0,0,1,9-14.95c11.85-8,30.72-3.31,32.84-2.76a8,8,0,0,1-4.07,15.48c-4.49-1.17-15.23-2.56-19.83.56a4.54,4.54,0,0,0-2,3.67c-.12.9-.14,1.08,1.11,1.9,2.31,1.49,6.45,2.68,10.45,3.84C133.49,174.17,150,179,147.81,196.31ZM72,144a8,8,0,0,0-8,8v38a10,10,0,0,1-20,0,8,8,0,0,0-16,0,26,26,0,0,0,52,0V152A8,8,0,0,0,72,144Zm140.65,1.49a8,8,0,0,0-11.16,1.86L188,166.24l-13.49-18.89a8,8,0,0,0-13,9.3L178.17,180l-16.68,23.35a8,8,0,0,0,13,9.3L188,193.76l13.49,18.89a8,8,0,0,0,13-9.3L197.83,180l16.68-23.35A8,8,0,0,0,212.65,145.49ZM216,88v24a8,8,0,0,1-16,0V96H152a8,8,0,0,1-8-8V40H56v72a8,8,0,0,1-16,0V40A16,16,0,0,1,56,24h96a8,8,0,0,1,5.66,2.34l56,56A8,8,0,0,1,216,88Zm-27.31-8L160,51.31V80Z"}))],["thin",x.createElement(x.Fragment,null,x.createElement("path",{d:"M143.84,195.8a17,17,0,0,1-7.43,12.41c-4.39,2.91-10,3.77-15.22,3.77A57.89,57.89,0,0,1,107,210.11a4,4,0,1,1,2.15-7.7c4.22,1.17,16.56,3.29,22.83-.88a8.94,8.94,0,0,0,3.91-6.75c.83-6.45-4.38-8.69-15.64-11.94-9.68-2.8-21.72-6.28-20.14-18.77a16.66,16.66,0,0,1,7.22-12.13c4.56-3.07,11-4.36,19.1-3.82a61.33,61.33,0,0,1,10.48,1.61,4,4,0,0,1-2.05,7.74c-4.29-1.13-16.81-3.12-23.06,1.11a8.51,8.51,0,0,0-3.75,6.49c-.66,5.17,3.89,7,14.42,10.08C132.26,178,145.64,181.84,143.84,195.8ZM72,148a4,4,0,0,0-4,4v38a14,14,0,0,1-28,0,4,4,0,0,0-8,0,22,22,0,0,0,44,0V152A4,4,0,0,0,72,148Zm138.32.75a4,4,0,0,0-5.58.92L188,173.12l-16.75-23.45a4,4,0,0,0-6.51,4.66L183.08,180l-18.34,25.67a4,4,0,0,0,.93,5.58,4,4,0,0,0,5.58-.92L188,186.88l16.74,23.45A4,4,0,0,0,208,212a3.91,3.91,0,0,0,2.32-.75,4,4,0,0,0,.93-5.58L192.92,180l18.33-25.67A4,4,0,0,0,210.32,148.75ZM212,88v24a4,4,0,0,1-8,0V92H152a4,4,0,0,1-4-4V36H56a4,4,0,0,0-4,4v72a4,4,0,0,1-8,0V40A12,12,0,0,1,56,28h96a4,4,0,0,1,2.83,1.17l56,56A4,4,0,0,1,212,88Zm-13.66-4L156,41.65V84Z"}))]]),z_e=new Map([["bold",x.createElement(x.Fragment,null,x.createElement("path",{d:"M100,152v56a12,12,0,0,1-24,0V190.07l-6.17,8.81a12,12,0,0,1-19.66,0L44,190.07V208a12,12,0,0,1-24,0V152a12,12,0,0,1,21.83-6.88L60,171.07l18.17-25.95A12,12,0,0,1,100,152Zm84,28a40,40,0,0,1-40,40H128a12,12,0,0,1-12-12V152a12,12,0,0,1,12-12h16A40,40,0,0,1,184,180Zm-24,0a16,16,0,0,0-16-16h-4v32h4A16,16,0,0,0,160,180Zm60-92V224a12,12,0,0,1-24,0V104H148a12,12,0,0,1-12-12V44H60v64a12,12,0,0,1-24,0V40A20,20,0,0,1,56,20h96a12,12,0,0,1,8.49,3.52l56,56A12,12,0,0,1,220,88Zm-60-8h23L160,57Z"}))],["duotone",x.createElement(x.Fragment,null,x.createElement("path",{d:"M208,88H152V32Z",opacity:"0.2"}),x.createElement("path",{d:"M213.66,82.34l-56-56A8,8,0,0,0,152,24H56A16,16,0,0,0,40,40v72a8,8,0,0,0,16,0V40h88V88a8,8,0,0,0,8,8h48V224a8,8,0,0,0,16,0V88A8,8,0,0,0,213.66,82.34ZM160,51.31,188.69,80H160ZM144,144H128a8,8,0,0,0-8,8v56a8,8,0,0,0,8,8h16a36,36,0,0,0,0-72Zm0,56h-8V160h8a20,20,0,0,1,0,40Zm-40-48v56a8,8,0,0,1-16,0V177.38L74.55,196.59a8,8,0,0,1-13.1,0L48,177.38V208a8,8,0,0,1-16,0V152a8,8,0,0,1,14.55-4.59L68,178.05l21.45-30.64A8,8,0,0,1,104,152Z"}))],["fill",x.createElement(x.Fragment,null,x.createElement("path",{d:"M213.66,82.34l-56-56A8,8,0,0,0,152,24H56A16,16,0,0,0,40,40v76a4,4,0,0,0,4,4H196a4,4,0,0,1,4,4V224a8,8,0,0,0,9.19,7.91,8.15,8.15,0,0,0,6.81-8.16V88A8,8,0,0,0,213.66,82.34ZM152,88V44l44,44Zm-8,56H128a8,8,0,0,0-8,8v56a8,8,0,0,0,8,8h15.32c19.66,0,36.21-15.48,36.67-35.13A36,36,0,0,0,144,144Zm-.49,56H136V160h8a20,20,0,0,1,20,20.77C163.58,191.59,154.34,200,143.51,200ZM104,152v55.73A8.17,8.17,0,0,1,96.53,216,8,8,0,0,1,88,208V177.38l-13.32,19a8.3,8.3,0,0,1-4.2,3.2,8,8,0,0,1-9-3L48,177.38v30.35A8.17,8.17,0,0,1,40.53,216,8,8,0,0,1,32,208V152.31a8.27,8.27,0,0,1,4.56-7.53,8,8,0,0,1,10,2.63L68,178.05l21.27-30.39a8.28,8.28,0,0,1,8.06-3.55A8,8,0,0,1,104,152Z"}))],["light",x.createElement(x.Fragment,null,x.createElement("path",{d:"M212.24,83.76l-56-56A6,6,0,0,0,152,26H56A14,14,0,0,0,42,40v72a6,6,0,0,0,12,0V40a2,2,0,0,1,2-2h90V88a6,6,0,0,0,6,6h50V224a6,6,0,0,0,12,0V88A6,6,0,0,0,212.24,83.76ZM158,46.48,193.52,82H158ZM144,146H128a6,6,0,0,0-6,6v56a6,6,0,0,0,6,6h16a34,34,0,0,0,0-68Zm0,56H134V158h10a22,22,0,0,1,0,44Zm-42-50v56a6,6,0,0,1-12,0V171L72.92,195.44a6,6,0,0,1-9.84,0L46,171v37a6,6,0,0,1-12,0V152a6,6,0,0,1,10.92-3.44l23.08,33,23.08-33A6,6,0,0,1,102,152Z"}))],["regular",x.createElement(x.Fragment,null,x.createElement("path",{d:"M213.66,82.34l-56-56A8,8,0,0,0,152,24H56A16,16,0,0,0,40,40v72a8,8,0,0,0,16,0V40h88V88a8,8,0,0,0,8,8h48V224a8,8,0,0,0,16,0V88A8,8,0,0,0,213.66,82.34ZM160,51.31,188.69,80H160ZM144,144H128a8,8,0,0,0-8,8v56a8,8,0,0,0,8,8h16a36,36,0,0,0,0-72Zm0,56h-8V160h8a20,20,0,0,1,0,40Zm-40-48v56a8,8,0,0,1-16,0V177.38L74.55,196.59a8,8,0,0,1-13.1,0L48,177.38V208a8,8,0,0,1-16,0V152a8,8,0,0,1,14.55-4.59L68,178.05l21.45-30.64A8,8,0,0,1,104,152Z"}))],["thin",x.createElement(x.Fragment,null,x.createElement("path",{d:"M210.83,85.17l-56-56A4,4,0,0,0,152,28H56A12,12,0,0,0,44,40v72a4,4,0,0,0,8,0V40a4,4,0,0,1,4-4h92V88a4,4,0,0,0,4,4h52V224a4,4,0,0,0,8,0V88A4,4,0,0,0,210.83,85.17ZM156,41.65,198.34,84H156ZM144,148H128a4,4,0,0,0-4,4v56a4,4,0,0,0,4,4h16a32,32,0,0,0,0-64Zm0,56H132V156h12a24,24,0,0,1,0,48Zm-44-52v56a4,4,0,0,1-8,0V164.69l-20.72,29.6a4,4,0,0,1-6.56,0L44,164.69V208a4,4,0,0,1-8,0V152a4,4,0,0,1,7.28-2.29L68,185l24.72-35.31A4,4,0,0,1,100,152Z"}))]]),Z_e=new Map([["bold",x.createElement(x.Fragment,null,x.createElement("path",{d:"M216.49,79.51l-56-56A12,12,0,0,0,152,20H56A20,20,0,0,0,36,40V216a20,20,0,0,0,20,20H200a20,20,0,0,0,20-20V88A12,12,0,0,0,216.49,79.51ZM160,57l23,23H160ZM60,212V44h76V92a12,12,0,0,0,12,12h48V212Zm104-60a12,12,0,0,1-12,12H140v12a12,12,0,0,1-24,0V164H104a12,12,0,0,1,0-24h12V128a12,12,0,0,1,24,0v12h12A12,12,0,0,1,164,152Z"}))],["duotone",x.createElement(x.Fragment,null,x.createElement("path",{d:"M208,88H152V32Z",opacity:"0.2"}),x.createElement("path",{d:"M213.66,82.34l-56-56A8,8,0,0,0,152,24H56A16,16,0,0,0,40,40V216a16,16,0,0,0,16,16H200a16,16,0,0,0,16-16V88A8,8,0,0,0,213.66,82.34ZM160,51.31,188.69,80H160ZM200,216H56V40h88V88a8,8,0,0,0,8,8h48V216Zm-40-64a8,8,0,0,1-8,8H136v16a8,8,0,0,1-16,0V160H104a8,8,0,0,1,0-16h16V128a8,8,0,0,1,16,0v16h16A8,8,0,0,1,160,152Z"}))],["fill",x.createElement(x.Fragment,null,x.createElement("path",{d:"M213.66,82.34l-56-56A8,8,0,0,0,152,24H56A16,16,0,0,0,40,40V216a16,16,0,0,0,16,16H200a16,16,0,0,0,16-16V88A8,8,0,0,0,213.66,82.34ZM152,160H136v16a8,8,0,0,1-16,0V160H104a8,8,0,0,1,0-16h16V128a8,8,0,0,1,16,0v16h16a8,8,0,0,1,0,16Zm0-72V43.31L196.69,88Z"}))],["light",x.createElement(x.Fragment,null,x.createElement("path",{d:"M212.24,83.76l-56-56A6,6,0,0,0,152,26H56A14,14,0,0,0,42,40V216a14,14,0,0,0,14,14H200a14,14,0,0,0,14-14V88A6,6,0,0,0,212.24,83.76ZM158,46.48,193.52,82H158ZM200,218H56a2,2,0,0,1-2-2V40a2,2,0,0,1,2-2h90V88a6,6,0,0,0,6,6h50V216A2,2,0,0,1,200,218Zm-42-66a6,6,0,0,1-6,6H134v18a6,6,0,0,1-12,0V158H104a6,6,0,0,1,0-12h18V128a6,6,0,0,1,12,0v18h18A6,6,0,0,1,158,152Z"}))],["regular",x.createElement(x.Fragment,null,x.createElement("path",{d:"M213.66,82.34l-56-56A8,8,0,0,0,152,24H56A16,16,0,0,0,40,40V216a16,16,0,0,0,16,16H200a16,16,0,0,0,16-16V88A8,8,0,0,0,213.66,82.34ZM160,51.31,188.69,80H160ZM200,216H56V40h88V88a8,8,0,0,0,8,8h48V216Zm-40-64a8,8,0,0,1-8,8H136v16a8,8,0,0,1-16,0V160H104a8,8,0,0,1,0-16h16V128a8,8,0,0,1,16,0v16h16A8,8,0,0,1,160,152Z"}))],["thin",x.createElement(x.Fragment,null,x.createElement("path",{d:"M210.83,85.17l-56-56A4,4,0,0,0,152,28H56A12,12,0,0,0,44,40V216a12,12,0,0,0,12,12H200a12,12,0,0,0,12-12V88A4,4,0,0,0,210.83,85.17ZM156,41.65,198.34,84H156ZM200,220H56a4,4,0,0,1-4-4V40a4,4,0,0,1,4-4h92V88a4,4,0,0,0,4,4h52V216A4,4,0,0,1,200,220Zm-44-68a4,4,0,0,1-4,4H132v20a4,4,0,0,1-8,0V156H104a4,4,0,0,1,0-8h20V128a4,4,0,0,1,8,0v20h20A4,4,0,0,1,156,152Z"}))]]),G_e=new Map([["bold",x.createElement(x.Fragment,null,x.createElement("path",{d:"M56,140H40a12,12,0,0,0-12,12v56a12,12,0,0,0,24,0v-4h4a32,32,0,0,0,0-64Zm0,40H52V164h4a8,8,0,0,1,0,16Zm176,20.87a12,12,0,0,1-3.33,8.3A34,34,0,0,1,204,220c-19.85,0-36-17.95-36-40s16.15-40,36-40a33.39,33.39,0,0,1,18.71,5.8,12,12,0,1,1-13.42,19.89A9.39,9.39,0,0,0,204,164c-6.5,0-12,7.33-12,16s5.5,16,12,16a9,9,0,0,0,2.7-.42A12,12,0,0,1,216,176h4a12,12,0,0,1,12,12ZM160,152v56a12,12,0,0,1-8.34,11.43A12.15,12.15,0,0,1,148,220a12,12,0,0,1-9.76-5L120,189.44V208a12,12,0,0,1-24,0V152a12,12,0,0,1,21.76-7L136,170.55V152a12,12,0,0,1,24,0ZM48,120a12,12,0,0,0,12-12V44h76V92a12,12,0,0,0,12,12h48v4a12,12,0,0,0,24,0V88a12,12,0,0,0-3.51-8.49l-56-56A12,12,0,0,0,152,20H56A20,20,0,0,0,36,40v68A12,12,0,0,0,48,120ZM160,57l23,23H160Z"}))],["duotone",x.createElement(x.Fragment,null,x.createElement("path",{d:"M208,88H152V32Z",opacity:"0.2"}),x.createElement("path",{d:"M60,144H44a8,8,0,0,0-8,8v56a8,8,0,0,0,16,0v-8h8a28,28,0,0,0,0-56Zm0,40H52V160h8a12,12,0,0,1,0,24Zm164,16.87a8,8,0,0,1-2.22,5.53A30.06,30.06,0,0,1,200,216c-17.64,0-32-16.15-32-36s14.36-36,32-36a29.45,29.45,0,0,1,16.48,5.11,8,8,0,0,1-9,13.27A13.21,13.21,0,0,0,200,160c-8.82,0-16,9-16,20s7.18,20,16,20a13.57,13.57,0,0,0,8-2.72V192a8,8,0,0,1,0-16h8a8,8,0,0,1,8,8ZM156,152v56a8,8,0,0,1-5.56,7.62A7.91,7.91,0,0,1,148,216a8,8,0,0,1-6.51-3.35L116,177v31a8,8,0,0,1-16,0V152a8,8,0,0,1,14.51-4.65L140,183V152a8,8,0,0,1,16,0ZM48,120a8,8,0,0,0,8-8V40h88V88a8,8,0,0,0,8,8h48v16a8,8,0,0,0,16,0V88a8,8,0,0,0-2.34-5.66l-56-56A8,8,0,0,0,152,24H56A16,16,0,0,0,40,40v72A8,8,0,0,0,48,120ZM160,51.31,188.69,80H160Z"}))],["fill",x.createElement(x.Fragment,null,x.createElement("path",{d:"M44,120H212a4,4,0,0,0,4-4V88a8,8,0,0,0-2.34-5.66l-56-56A8,8,0,0,0,152,24H56A16,16,0,0,0,40,40v76A4,4,0,0,0,44,120ZM152,44l44,44H152ZM60,144H44a8,8,0,0,0-8,8v55.72A8.17,8.17,0,0,0,43.47,216,8,8,0,0,0,52,208v-8h7.4c15.24,0,28.14-11.92,28.59-27.15A28,28,0,0,0,60,144Zm-.35,40H52V160h8a12,12,0,0,1,12,13.16A12.25,12.25,0,0,1,59.65,184ZM224,200.87a8,8,0,0,1-2.26,5.57A30.07,30.07,0,0,1,200,216c-17.64,0-32-16.15-32-36s14.36-36,32-36a29.36,29.36,0,0,1,16.09,4.86,8.21,8.21,0,0,1,3,10.64,8,8,0,0,1-11.55,2.88A13.21,13.21,0,0,0,200,160c-8.82,0-16,9-16,20s7.18,20,16,20a13.57,13.57,0,0,0,8-2.72V192a8,8,0,0,1-8-8.53,8.17,8.17,0,0,1,8.25-7.47H216a8,8,0,0,1,8,8ZM156,152v55.76a8.22,8.22,0,0,1-4.12,7.24,8,8,0,0,1-10.39-2.35L116,177v30.76a8.17,8.17,0,0,1-7.47,8.26,8,8,0,0,1-8.53-8V152.31a8.27,8.27,0,0,1,4.53-7.52,8,8,0,0,1,10,2.56L140,183V152.27a8.17,8.17,0,0,1,7.47-8.25A8,8,0,0,1,156,152Z"}))],["light",x.createElement(x.Fragment,null,x.createElement("path",{d:"M60,146H44a6,6,0,0,0-6,6v56a6,6,0,0,0,12,0V198H60a26,26,0,0,0,0-52Zm0,40H50V158H60a14,14,0,0,1,0,28Zm162,14.87a6,6,0,0,1-1.67,4.15A28.06,28.06,0,0,1,200,214c-16.54,0-30-15.25-30-34s13.46-34,30-34a27.43,27.43,0,0,1,15.36,4.77,6,6,0,0,1-6.72,9.95A15.25,15.25,0,0,0,200,158c-9.93,0-18,9.87-18,22s8.07,22,18,22a15.75,15.75,0,0,0,10-3.73V190h-2a6,6,0,0,1,0-12h8a6,6,0,0,1,6,6ZM154,152v56a6,6,0,0,1-4.17,5.71A5.78,5.78,0,0,1,148,214a6,6,0,0,1-4.88-2.51L114,170.72V208a6,6,0,0,1-12,0V152a6,6,0,0,1,10.88-3.49L142,189.28V152a6,6,0,0,1,12,0ZM48,118a6,6,0,0,0,6-6V40a2,2,0,0,1,2-2h90V88a6,6,0,0,0,6,6h50v18a6,6,0,0,0,12,0V88a6,6,0,0,0-1.76-4.24l-56-56A6,6,0,0,0,152,26H56A14,14,0,0,0,42,40v72A6,6,0,0,0,48,118ZM158,46.48,193.52,82H158Z"}))],["regular",x.createElement(x.Fragment,null,x.createElement("path",{d:"M60,144H44a8,8,0,0,0-8,8v56a8,8,0,0,0,16,0v-8h8a28,28,0,0,0,0-56Zm0,40H52V160h8a12,12,0,0,1,0,24Zm164,16.87a8,8,0,0,1-2.22,5.53A30.06,30.06,0,0,1,200,216c-17.65,0-32-16.15-32-36s14.35-36,32-36a29.45,29.45,0,0,1,16.48,5.11,8,8,0,0,1-9,13.27A13.21,13.21,0,0,0,200,160c-8.82,0-16,9-16,20s7.18,20,16,20a13.57,13.57,0,0,0,8-2.72V192a8,8,0,0,1,0-16h8a8,8,0,0,1,8,8ZM156,152v56a8,8,0,0,1-5.56,7.62A7.91,7.91,0,0,1,148,216a8,8,0,0,1-6.51-3.35L116,177v31a8,8,0,0,1-16,0V152a8,8,0,0,1,14.51-4.65L140,183V152a8,8,0,0,1,16,0ZM48,120a8,8,0,0,0,8-8V40h88V88a8,8,0,0,0,8,8h48v16a8,8,0,0,0,16,0V88a8,8,0,0,0-2.34-5.66l-56-56A8,8,0,0,0,152,24H56A16,16,0,0,0,40,40v72A8,8,0,0,0,48,120ZM160,51.31,188.69,80H160Z"}))],["thin",x.createElement(x.Fragment,null,x.createElement("path",{d:"M60,148H44a4,4,0,0,0-4,4v56a4,4,0,0,0,8,0V196H60a24,24,0,0,0,0-48Zm0,40H48V156H60a16,16,0,0,1,0,32Zm160,12.87a4,4,0,0,1-1.11,2.77A26.11,26.11,0,0,1,200,212c-15.44,0-28-14.36-28-32s12.56-32,28-32a25.41,25.41,0,0,1,14.24,4.43,4,4,0,1,1-4.48,6.63A17.45,17.45,0,0,0,200,156c-11,0-20,10.77-20,24s9,24,20,24a17.87,17.87,0,0,0,12-4.82V188h-4a4,4,0,0,1,0-8h8a4,4,0,0,1,4,4ZM152,152v56a4,4,0,0,1-2.78,3.81A3.93,3.93,0,0,1,148,212a4,4,0,0,1-3.25-1.67L112,164.48V208a4,4,0,0,1-8,0V152a4,4,0,0,1,7.25-2.33L144,195.52V152a4,4,0,0,1,8,0Zm52-40a4,4,0,0,0,8,0V88a4,4,0,0,0-1.17-2.83l-56-56A4,4,0,0,0,152,28H56A12,12,0,0,0,44,40v72a4,4,0,0,0,8,0V40a4,4,0,0,1,4-4h92V88a4,4,0,0,0,4,4h52ZM156,84V41.65L198.34,84Z"}))]]),U_e=new Map([["bold",x.createElement(x.Fragment,null,x.createElement("path",{d:"M48,120a12,12,0,0,0,12-12V44h76V92a12,12,0,0,0,12,12h48v4a12,12,0,1,0,24,0V88a12,12,0,0,0-3.51-8.48l-56-56A12,12,0,0,0,152,20H56A20,20,0,0,0,36,40v68A12,12,0,0,0,48,120ZM183,80H160V57ZM87.78,196.8a24.72,24.72,0,0,1-10.94,18c-6,4-13.27,5.15-19.74,5.15a63.75,63.75,0,0,1-16.23-2.21,12,12,0,1,1,6.46-23.11c6.82,1.85,15,1.61,16.39.06a2.48,2.48,0,0,0,.21-.71c-1.94-1.23-6.82-2.64-9.88-3.53-5.39-1.56-11-3.17-15.75-6.26-7.62-4.92-11.21-12.45-10.1-21.19a24.44,24.44,0,0,1,10.68-17.76c6.07-4.09,14.17-5.82,24.1-5.17A69,69,0,0,1,75,142a12,12,0,0,1-6.1,23.21c-6.35-1.63-13.61-1.51-16.07-.33a79.69,79.69,0,0,0,7.92,2.59c5.47,1.58,11.67,3.37,16.8,6.82C85.33,179.53,89,187.53,87.78,196.8ZM155.3,156l-20,56a12,12,0,0,1-22.6,0l-20-56A12,12,0,1,1,115.3,148L124,172.3,132.7,148A12,12,0,1,1,155.3,156ZM224,188v12.87a12,12,0,0,1-3.33,8.3A34,34,0,0,1,196,220c-19.85,0-36-17.94-36-40s16.15-40,36-40a33.39,33.39,0,0,1,18.71,5.8,12,12,0,1,1-13.42,19.89A9.39,9.39,0,0,0,196,164c-6.5,0-12,7.33-12,16s5.5,16,12,16a9,9,0,0,0,2.7-.42A12,12,0,0,1,208,176h4A12,12,0,0,1,224,188Z"}))],["duotone",x.createElement(x.Fragment,null,x.createElement("path",{d:"M208,88H152V32Z",opacity:"0.2"}),x.createElement("path",{d:"M213.66,82.34l-56-56A8,8,0,0,0,152,24H56A16,16,0,0,0,40,40v72a8,8,0,1,0,16,0V40h88V88a8,8,0,0,0,8,8h48v16a8,8,0,0,0,16,0V88A8,8,0,0,0,213.66,82.34ZM160,51.31,188.69,80H160Zm-72.18,145a20.82,20.82,0,0,1-9.19,15.23C73.44,215,67,216,61.14,216A61.23,61.23,0,0,1,46,214a8,8,0,0,1,4.3-15.41c4.38,1.2,14.95,2.7,19.55-.36.88-.59,1.83-1.52,2.14-3.93.35-2.67-.71-4.1-12.78-7.59-9.35-2.7-25-7.23-23-23.11a20.55,20.55,0,0,1,9-14.95c11.84-8,30.72-3.31,32.83-2.76a8,8,0,0,1-4.07,15.48c-4.48-1.17-15.23-2.56-19.83.56a4.54,4.54,0,0,0-2,3.67c-.11.9-.14,1.09,1.12,1.9,2.31,1.49,6.44,2.68,10.45,3.84C73.5,174.17,90.06,179,87.82,196.31Zm63.72-41.62-20,56a8,8,0,0,1-15.07,0l-20-56a8,8,0,1,1,15.06-5.38L124,184.21l12.46-34.9a8,8,0,0,1,15.07,5.38ZM216,184v16.87a8,8,0,0,1-2.22,5.53A30.06,30.06,0,0,1,192,216c-17.64,0-32-16.15-32-36s14.36-36,32-36a29.38,29.38,0,0,1,16.48,5.12,8,8,0,0,1-8.95,13.26A13.27,13.27,0,0,0,192,160c-8.82,0-16,9-16,20s7.18,20,16,20a13.38,13.38,0,0,0,8-2.71V192a8,8,0,0,1,0-16h8A8,8,0,0,1,216,184Z"}))],["fill",x.createElement(x.Fragment,null,x.createElement("path",{d:"M213.66,82.34l-56-56A8,8,0,0,0,152,24H56A16,16,0,0,0,40,40v76a4,4,0,0,0,4,4H212a4,4,0,0,0,4-4V88A8,8,0,0,0,213.66,82.34ZM152,88V44l44,44ZM87.82,196.31a20.82,20.82,0,0,1-9.19,15.23C73.44,215,67,216,61.14,216A61.23,61.23,0,0,1,46,214a8,8,0,0,1,4.3-15.41c4.38,1.2,14.95,2.7,19.55-.36.88-.59,1.83-1.52,2.14-3.93.35-2.67-.71-4.1-12.78-7.59-9.35-2.7-25-7.23-23-23.11a20.55,20.55,0,0,1,9-14.95c11.84-8,30.72-3.31,32.83-2.76a8,8,0,0,1-4.07,15.48c-4.48-1.17-15.23-2.56-19.83.56a4.54,4.54,0,0,0-2,3.67c-.11.9-.14,1.09,1.12,1.9,2.31,1.49,6.44,2.68,10.45,3.84C73.5,174.17,90.06,179,87.82,196.31Zm63.72-41.62-19.9,55.72a8.25,8.25,0,0,1-6.5,5.51,8,8,0,0,1-8.67-5.23L96.59,155a8.21,8.21,0,0,1,4.5-10.45,8,8,0,0,1,10.45,4.76L124,184.21l12.46-34.9a8,8,0,0,1,15.07,5.38ZM216,184v16.87a8,8,0,0,1-2.26,5.57A30,30,0,0,1,192,216c-17.64,0-32-16.15-32-36s14.36-36,32-36a29.36,29.36,0,0,1,16.09,4.86,8.22,8.22,0,0,1,3,10.64,8,8,0,0,1-11.54,2.88A13.27,13.27,0,0,0,192,160c-8.82,0-16,9-16,20s7.18,20,16,20a13.38,13.38,0,0,0,8-2.71V192a8,8,0,0,1-8-8.53,8.18,8.18,0,0,1,8.26-7.47H208A8,8,0,0,1,216,184Z"}))],["light",x.createElement(x.Fragment,null,x.createElement("path",{d:"M212.24,83.75l-56-56A6,6,0,0,0,152,26H56A14,14,0,0,0,42,40v72a6,6,0,0,0,12,0V40a2,2,0,0,1,2-2h90V88a6,6,0,0,0,6,6h50v18a6,6,0,1,0,12,0V88A6,6,0,0,0,212.24,83.75ZM158,46.48,193.52,82H158ZM85.83,196.05a18.85,18.85,0,0,1-8.3,13.81C72.71,213.05,66.66,214,61.16,214a59.38,59.38,0,0,1-14.67-2,6,6,0,0,1,3.23-11.56c3.71,1,15.58,3.11,21.19-.62a6.85,6.85,0,0,0,3-5.34c.57-4.43-2.08-6.26-14.2-9.76-9.31-2.69-23.37-6.75-21.57-20.94a18.61,18.61,0,0,1,8.08-13.54c11.11-7.49,29.18-3,31.2-2.48a6,6,0,0,1-3,11.6c-3.79-1-15.85-2.95-21.45.84a6.59,6.59,0,0,0-2.88,5.08c-.41,3.22,2.14,4.78,13,7.91C72.93,176.08,87.85,180.39,85.83,196.05Zm63.82-42-20,56a6,6,0,0,1-11.3,0l-20-56a6,6,0,1,1,11.3-4L124,190.15,138.35,150a6,6,0,0,1,11.3,4ZM214,184v16.87a6,6,0,0,1-1.67,4.15A28.06,28.06,0,0,1,192,214c-16.54,0-30-15.25-30-34s13.46-34,30-34a27.43,27.43,0,0,1,15.36,4.77,6,6,0,0,1-6.72,10A15.25,15.25,0,0,0,192,158c-9.92,0-18,9.87-18,22s8.08,22,18,22a15.7,15.7,0,0,0,10-3.74V190h-2a6,6,0,0,1,0-12h8A6,6,0,0,1,214,184Z"}))],["regular",x.createElement(x.Fragment,null,x.createElement("path",{d:"M87.82,196.31a20.82,20.82,0,0,1-9.19,15.23C73.44,215,67,216,61.14,216A61.23,61.23,0,0,1,46,214a8,8,0,0,1,4.3-15.41c4.38,1.2,14.95,2.7,19.55-.36.88-.59,1.83-1.52,2.14-3.93.35-2.67-.71-4.1-12.78-7.59-9.35-2.7-25-7.23-23-23.11a20.55,20.55,0,0,1,9-14.95c11.84-8,30.72-3.31,32.83-2.76a8,8,0,0,1-4.07,15.48c-4.48-1.17-15.23-2.56-19.83.56a4.54,4.54,0,0,0-2,3.67c-.11.9-.14,1.09,1.12,1.9,2.31,1.49,6.44,2.68,10.45,3.84C73.5,174.17,90.06,179,87.82,196.31ZM216,88v24a8,8,0,0,1-16,0V96H152a8,8,0,0,1-8-8V40H56v72a8,8,0,1,1-16,0V40A16,16,0,0,1,56,24h96a8,8,0,0,1,5.65,2.34l56,56A8,8,0,0,1,216,88Zm-56-8h28.69L160,51.31Zm-13.3,64.47a8,8,0,0,0-10.23,4.84L124,184.21l-12.47-34.9a8,8,0,1,0-15.06,5.38l20,56a8,8,0,0,0,15.07,0l20-56A8,8,0,0,0,146.7,144.47ZM208,176h-8a8,8,0,0,0,0,16v5.29a13.38,13.38,0,0,1-8,2.71c-8.82,0-16-9-16-20s7.18-20,16-20a13.27,13.27,0,0,1,7.53,2.38,8,8,0,0,0,8.95-13.26A29.38,29.38,0,0,0,192,144c-17.64,0-32,16.15-32,36s14.36,36,32,36a30.06,30.06,0,0,0,21.78-9.6,8,8,0,0,0,2.22-5.53V184A8,8,0,0,0,208,176Z"}))],["thin",x.createElement(x.Fragment,null,x.createElement("path",{d:"M210.83,85.17l-56-56A4,4,0,0,0,152,28H56A12,12,0,0,0,44,40v72a4,4,0,1,0,8,0V40a4,4,0,0,1,4-4h92V88a4,4,0,0,0,4,4h52v20a4,4,0,0,0,8,0V88A4,4,0,0,0,210.83,85.17ZM156,41.65,198.34,84H156ZM83.85,195.8a17,17,0,0,1-7.43,12.41C72,211.12,66.38,212,61.2,212A57.89,57.89,0,0,1,47,210.11a4,4,0,1,1,2.15-7.7c4.22,1.17,16.56,3.29,22.83-.88a8.94,8.94,0,0,0,3.91-6.75c.83-6.45-4.38-8.69-15.64-11.94-9.68-2.8-21.72-6.28-20.14-18.77a16.66,16.66,0,0,1,7.22-12.13c4.56-3.07,11-4.36,19.1-3.82a61.11,61.11,0,0,1,10.47,1.61,4,4,0,0,1-2,7.74c-4.29-1.13-16.81-3.12-23.06,1.11a8.51,8.51,0,0,0-3.75,6.49c-.66,5.17,3.89,7,14.42,10.08C72.27,178,85.65,181.84,83.85,195.8Zm63.92-42.45-20,56a4,4,0,0,1-7.53,0l-20-56a4,4,0,1,1,7.53-2.7L124,196.11l16.23-45.46a4,4,0,1,1,7.53,2.7ZM212,184v16.87a4,4,0,0,1-1.11,2.77A26.11,26.11,0,0,1,192,212c-15.44,0-28-14.36-28-32s12.56-32,28-32a25.41,25.41,0,0,1,14.24,4.43,4,4,0,1,1-4.48,6.63A17.43,17.43,0,0,0,192,156c-11,0-20,10.77-20,24s9,24,20,24a17.87,17.87,0,0,0,12-4.82V188h-4a4,4,0,0,1,0-8h8A4,4,0,0,1,212,184Z"}))]]),X_e=new Map([["bold",x.createElement(x.Fragment,null,x.createElement("path",{d:"M216.49,79.51l-56-56A12,12,0,0,0,152,20H56A20,20,0,0,0,36,40v68a12,12,0,0,0,24,0V44h76V92a12,12,0,0,0,12,12h48V212H180a12,12,0,0,0,0,24h20a20,20,0,0,0,20-20V88A12,12,0,0,0,216.49,79.51ZM160,57l23,23H160Zm-4.22,139.85a24.75,24.75,0,0,1-10.95,18.06c-6,4-13.27,5.15-19.73,5.15a63.75,63.75,0,0,1-16.23-2.21,12,12,0,0,1,6.46-23.12c6.81,1.86,15,1.61,16.39.06a2.48,2.48,0,0,0,.21-.71c-1.94-1.23-6.83-2.64-9.88-3.52-5.39-1.56-11-3.18-15.75-6.27-7.62-4.92-11.21-12.45-10.11-21.2a24.45,24.45,0,0,1,10.69-17.75c6.06-4.09,14.17-5.83,24.1-5.18A68.53,68.53,0,0,1,143,142a12,12,0,0,1-6.1,23.21c-6.36-1.63-13.62-1.51-16.07-.33a79.5,79.5,0,0,0,7.91,2.59c5.48,1.58,11.68,3.37,16.8,6.82C153.33,179.55,157,187.55,155.78,196.82ZM92,152a12,12,0,0,1-12,12H72v44a12,12,0,0,1-24,0V164H40a12,12,0,0,1,0-24H80A12,12,0,0,1,92,152Z"}))],["duotone",x.createElement(x.Fragment,null,x.createElement("path",{d:"M208,88H152V32Z",opacity:"0.2"}),x.createElement("path",{d:"M213.66,82.34l-56-56A8,8,0,0,0,152,24H56A16,16,0,0,0,40,40v72a8,8,0,0,0,16,0V40h88V88a8,8,0,0,0,8,8h48V216H176a8,8,0,0,0,0,16h24a16,16,0,0,0,16-16V88A8,8,0,0,0,213.66,82.34ZM160,51.31,188.69,80H160Zm-12.19,145a20.82,20.82,0,0,1-9.19,15.23C133.43,215,127,216,121.13,216A61.14,61.14,0,0,1,106,214a8,8,0,1,1,4.3-15.41c4.38,1.2,15,2.7,19.55-.36.88-.59,1.83-1.52,2.14-3.93.35-2.67-.71-4.1-12.78-7.59-9.35-2.7-25-7.23-23-23.11a20.56,20.56,0,0,1,9-14.95c11.84-8,30.71-3.31,32.83-2.76a8,8,0,0,1-4.07,15.48c-4.49-1.17-15.23-2.56-19.83.56a4.54,4.54,0,0,0-2,3.67c-.12.9-.14,1.09,1.11,1.9,2.31,1.49,6.45,2.68,10.45,3.84C133.49,174.17,150.05,179,147.81,196.31ZM88,152a8,8,0,0,1-8,8H68v48a8,8,0,0,1-16,0V160H40a8,8,0,0,1,0-16H80A8,8,0,0,1,88,152Z"}))],["fill",x.createElement(x.Fragment,null,x.createElement("path",{d:"M213.66,82.34l-56-56A8,8,0,0,0,152,24H56A16,16,0,0,0,40,40v76a4,4,0,0,0,4,4H164a4,4,0,0,1,4,4V228a4,4,0,0,0,4,4h28a16,16,0,0,0,16-16V88A8,8,0,0,0,213.66,82.34ZM152,88V44l44,44Zm-4.19,108.31a20.82,20.82,0,0,1-9.19,15.23C133.43,215,127,216,121.13,216A61.14,61.14,0,0,1,106,214a8,8,0,1,1,4.3-15.41c4.38,1.2,15,2.7,19.55-.36.88-.59,1.83-1.52,2.14-3.93.35-2.67-.71-4.1-12.78-7.59-9.35-2.7-25-7.23-23-23.11a20.56,20.56,0,0,1,9-14.95c11.84-8,30.71-3.31,32.83-2.76a8,8,0,0,1-4.07,15.48c-4.49-1.17-15.23-2.56-19.83.56a4.54,4.54,0,0,0-2,3.67c-.12.9-.14,1.09,1.11,1.9,2.31,1.49,6.45,2.68,10.45,3.84C133.49,174.17,150.05,179,147.81,196.31ZM88,152.53A8.17,8.17,0,0,1,79.73,160H68v47.73A8.17,8.17,0,0,1,60.53,216,8,8,0,0,1,52,208V160H40.27A8.17,8.17,0,0,1,32,152.53,8,8,0,0,1,40,144H80A8,8,0,0,1,88,152.53Z"}))],["light",x.createElement(x.Fragment,null,x.createElement("path",{d:"M212.24,83.76l-56-56A6,6,0,0,0,152,26H56A14,14,0,0,0,42,40v72a6,6,0,0,0,12,0V40a2,2,0,0,1,2-2h90V88a6,6,0,0,0,6,6h50V216a2,2,0,0,1-2,2H176a6,6,0,0,0,0,12h24a14,14,0,0,0,14-14V88A6,6,0,0,0,212.24,83.76ZM158,46.48,193.52,82H158ZM145.83,196.06a18.89,18.89,0,0,1-8.31,13.81c-4.82,3.19-10.87,4.14-16.36,4.14a58.89,58.89,0,0,1-14.68-2,6,6,0,0,1,3.23-11.56c3.71,1,15.58,3.11,21.19-.62a6.85,6.85,0,0,0,3-5.34c.58-4.43-2.08-6.26-14.2-9.76-9.31-2.69-23.37-6.75-21.57-20.94a18.61,18.61,0,0,1,8.08-13.54c11.11-7.49,29.18-3,31.21-2.48a6,6,0,0,1-3.06,11.6c-3.78-1-15.85-3-21.45.84a6.59,6.59,0,0,0-2.88,5.08c-.41,3.22,2.14,4.78,13,7.91C132.92,176.09,147.84,180.4,145.83,196.06ZM86,152a6,6,0,0,1-6,6H66v50a6,6,0,0,1-12,0V158H40a6,6,0,0,1,0-12H80A6,6,0,0,1,86,152Z"}))],["regular",x.createElement(x.Fragment,null,x.createElement("path",{d:"M147.81,196.31a20.82,20.82,0,0,1-9.19,15.23C133.43,215,127,216,121.13,216a61.34,61.34,0,0,1-15.19-2,8,8,0,0,1,4.31-15.41c4.38,1.2,15,2.7,19.55-.36.88-.59,1.83-1.52,2.14-3.93.34-2.67-.71-4.1-12.78-7.59-9.35-2.7-25-7.23-23-23.11a20.56,20.56,0,0,1,9-14.95c11.84-8,30.71-3.31,32.83-2.76a8,8,0,0,1-4.07,15.48c-4.49-1.17-15.23-2.56-19.83.56a4.54,4.54,0,0,0-2,3.67c-.12.9-.14,1.09,1.11,1.9,2.31,1.49,6.45,2.68,10.45,3.84C133.49,174.17,150.05,179,147.81,196.31ZM216,88V216a16,16,0,0,1-16,16H176a8,8,0,0,1,0-16h24V96H152a8,8,0,0,1-8-8V40H56v72a8,8,0,0,1-16,0V40A16,16,0,0,1,56,24h96a8,8,0,0,1,5.66,2.34l56,56A8,8,0,0,1,216,88Zm-56-8h28.69L160,51.31ZM80,144H40a8,8,0,0,0,0,16H52v48a8,8,0,0,0,16,0V160H80a8,8,0,0,0,0-16Z"}))],["thin",x.createElement(x.Fragment,null,x.createElement("path",{d:"M210.83,85.17l-56-56A4,4,0,0,0,152,28H56A12,12,0,0,0,44,40v72a4,4,0,0,0,8,0V40a4,4,0,0,1,4-4h92V88a4,4,0,0,0,4,4h52V216a4,4,0,0,1-4,4H176a4,4,0,0,0,0,8h24a12,12,0,0,0,12-12V88A4,4,0,0,0,210.83,85.17ZM156,41.65,198.34,84H156ZM143.84,195.8a17,17,0,0,1-7.43,12.41c-4.39,2.91-10,3.77-15.22,3.77A57.89,57.89,0,0,1,107,210.11a4,4,0,0,1,2.15-7.7c4.22,1.17,16.56,3.29,22.83-.88a8.94,8.94,0,0,0,3.91-6.75c.83-6.45-4.38-8.69-15.64-11.94-9.68-2.8-21.72-6.28-20.14-18.77a16.66,16.66,0,0,1,7.22-12.13c4.56-3.07,11-4.36,19.1-3.82a61.33,61.33,0,0,1,10.48,1.61,4,4,0,0,1-2.05,7.74c-4.29-1.13-16.81-3.12-23.06,1.11a8.51,8.51,0,0,0-3.75,6.49c-.66,5.17,3.89,7,14.42,10.08C132.26,178,145.64,181.84,143.84,195.8ZM84,152a4,4,0,0,1-4,4H64v52a4,4,0,0,1-8,0V156H40a4,4,0,0,1,0-8H80A4,4,0,0,1,84,152Z"}))]]),W_e=new Map([["bold",x.createElement(x.Fragment,null,x.createElement("path",{d:"M221.76,201A12,12,0,1,1,202.23,215L192,200.62,181.76,215A12,12,0,1,1,162.23,201l15-21-15-21a12,12,0,0,1,19.53-14L192,159.34,202.23,145a12,12,0,0,1,19.53,14l-15,21Zm-80.25-26.73c-5.12-3.45-11.33-5.24-16.8-6.82a79.5,79.5,0,0,1-7.91-2.59c2.45-1.18,9.71-1.3,16.07.33A12,12,0,0,0,139,142a69,69,0,0,0-12-1.86c-9.93-.66-18,1.08-24.1,5.17a24.45,24.45,0,0,0-10.69,17.76c-1.1,8.74,2.48,16.27,10.11,21.19,4.78,3.09,10.36,4.7,15.75,6.26,3,.89,7.94,2.3,9.88,3.53a2.48,2.48,0,0,1-.21.71c-1.37,1.55-9.58,1.79-16.39-.06a12,12,0,1,0-6.46,23.11A63.75,63.75,0,0,0,121.1,220c6.46,0,13.73-1.17,19.73-5.15a24.73,24.73,0,0,0,10.95-18C153,187.53,149.33,179.53,141.51,174.27ZM76,140H36a12,12,0,0,0,0,24h8v44a12,12,0,0,0,24,0V164h8a12,12,0,0,0,0-24ZM36,108V40A20,20,0,0,1,56,20h96a12,12,0,0,1,8.49,3.51l56,56A12,12,0,0,1,220,88v20a12,12,0,1,1-24,0v-4H148a12,12,0,0,1-12-12V44H60v64a12,12,0,1,1-24,0ZM160,80h23L160,57Z"}))],["duotone",x.createElement(x.Fragment,null,x.createElement("path",{d:"M208,88H152V32Z",opacity:"0.2"}),x.createElement("path",{d:"M214.51,156.65,197.83,180l16.68,23.35a8,8,0,0,1-13,9.3L188,193.76l-13.49,18.89a8,8,0,1,1-13-9.3L178.17,180l-16.68-23.35a8,8,0,0,1,13-9.3L188,166.24l13.49-18.89a8,8,0,0,1,13,9.3ZM123.6,171.31c-4-1.16-8.14-2.35-10.45-3.84-1.25-.82-1.23-1-1.11-1.9a4.54,4.54,0,0,1,2-3.67c4.6-3.12,15.34-1.73,19.83-.56A8,8,0,0,0,138,145.86c-2.12-.55-21-5.22-32.84,2.76a20.58,20.58,0,0,0-9,14.94c-2,15.89,13.65,20.42,23,23.12,12.06,3.49,13.12,4.92,12.78,7.59-.31,2.41-1.26,3.33-2.14,3.93-4.6,3.06-15.17,1.56-19.55.35A8,8,0,1,0,106,214a60.43,60.43,0,0,0,15.18,2c5.82,0,12.3-1,17.49-4.46a20.82,20.82,0,0,0,9.19-15.23C150,179,133.49,174.17,123.6,171.31ZM80,144H40a8,8,0,0,0,0,16H52v48a8,8,0,0,0,16,0V160H80a8,8,0,0,0,0-16ZM216,88v24a8,8,0,0,1-16,0V96H152a8,8,0,0,1-8-8V40H56v72a8,8,0,0,1-16,0V40A16,16,0,0,1,56,24h96a8,8,0,0,1,5.66,2.34l56,56A8,8,0,0,1,216,88Zm-27.31-8L160,51.31V80Z"}))],["fill",x.createElement(x.Fragment,null,x.createElement("path",{d:"M213.66,82.34l-56-56A8,8,0,0,0,152,24H56A16,16,0,0,0,40,40v76a4,4,0,0,0,4,4H212a4,4,0,0,0,4-4V88A8,8,0,0,0,213.66,82.34ZM152,88V44l44,44Zm62.51,68.65L197.83,180l16.68,23.35a8,8,0,0,1-13,9.3L188,193.76l-13.49,18.89a8,8,0,1,1-13-9.3L178.17,180l-16.68-23.35a8,8,0,0,1,2.3-11.46,8.19,8.19,0,0,1,10.88,2.38L188,166.24l13.49-18.89a8,8,0,0,1,13,9.3Zm-66.7,39.66a20.82,20.82,0,0,1-9.19,15.23C133.43,215,127,216,121.13,216A60.43,60.43,0,0,1,106,214a8,8,0,1,1,4.3-15.41c4.38,1.21,15,2.71,19.55-.35.88-.6,1.83-1.52,2.14-3.93.34-2.67-.72-4.1-12.78-7.59-9.35-2.7-25-7.23-23-23.12a20.58,20.58,0,0,1,9-14.94c11.85-8,30.72-3.31,32.84-2.76a8,8,0,0,1-4.07,15.48c-4.49-1.17-15.23-2.56-19.83.56a4.54,4.54,0,0,0-2,3.67c-.12.9-.14,1.08,1.11,1.9,2.31,1.49,6.45,2.68,10.45,3.84C133.49,174.17,150,179,147.81,196.31ZM88,152.53A8.18,8.18,0,0,1,79.73,160H68v47.72A8.18,8.18,0,0,1,60.53,216,8,8,0,0,1,52,208V160H40.27A8.18,8.18,0,0,1,32,152.53,8,8,0,0,1,40,144H80A8,8,0,0,1,88,152.53Z"}))],["light",x.createElement(x.Fragment,null,x.createElement("path",{d:"M212.88,155.48,195.37,180l17.51,24.51a6,6,0,1,1-9.76,7L188,190.31l-15.12,21.16a6,6,0,1,1-9.76-7L180.63,180l-17.51-24.51a6,6,0,0,1,9.76-7L188,169.67l15.12-21.17a6,6,0,1,1,9.76,7Zm-89.83,17.74c-10.86-3.13-13.41-4.69-13-7.91a6.59,6.59,0,0,1,2.88-5.08c5.6-3.79,17.66-1.83,21.45-.84a6,6,0,0,0,3.06-11.6c-2-.53-20.1-5-31.21,2.48a18.61,18.61,0,0,0-8.08,13.54c-1.8,14.19,12.26,18.25,21.57,20.94,12.12,3.5,14.78,5.33,14.2,9.76a6.85,6.85,0,0,1-3,5.34c-5.61,3.73-17.48,1.64-21.19.62A6,6,0,0,0,106.48,212a59.41,59.41,0,0,0,14.68,2c5.49,0,11.54-.95,16.36-4.14a18.89,18.89,0,0,0,8.31-13.81C147.84,180.39,132.92,176.08,123.05,173.22ZM80,146H40a6,6,0,0,0,0,12H54v50a6,6,0,0,0,12,0V158H80a6,6,0,0,0,0-12ZM214,88v24a6,6,0,1,1-12,0V94H152a6,6,0,0,1-6-6V38H56a2,2,0,0,0-2,2v72a6,6,0,1,1-12,0V40A14,14,0,0,1,56,26h96a6,6,0,0,1,4.25,1.76l56,56A6,6,0,0,1,214,88Zm-20.49-6L158,46.48V82Z"}))],["regular",x.createElement(x.Fragment,null,x.createElement("path",{d:"M214.51,156.65,197.83,180l16.68,23.35a8,8,0,0,1-13,9.3L188,193.76l-13.49,18.89a8,8,0,1,1-13-9.3L178.17,180l-16.68-23.35a8,8,0,0,1,13-9.3L188,166.24l13.49-18.89a8,8,0,0,1,13,9.3ZM123.6,171.31c-4-1.16-8.14-2.35-10.45-3.84-1.25-.82-1.23-1-1.11-1.9a4.54,4.54,0,0,1,2-3.67c4.6-3.12,15.34-1.73,19.83-.56A8,8,0,0,0,138,145.86c-2.12-.55-21-5.22-32.84,2.76a20.58,20.58,0,0,0-9,14.95c-2,15.88,13.65,20.41,23,23.11,12.06,3.49,13.12,4.92,12.78,7.59-.31,2.41-1.26,3.33-2.14,3.93-4.6,3.06-15.17,1.56-19.55.35A8,8,0,0,0,105.94,214a60.63,60.63,0,0,0,15.19,2c5.82,0,12.3-1,17.49-4.46a20.82,20.82,0,0,0,9.19-15.23C150,179,133.49,174.17,123.6,171.31ZM80,144H40a8,8,0,0,0,0,16H52v48a8,8,0,0,0,16,0V160H80a8,8,0,0,0,0-16ZM216,88v24a8,8,0,0,1-16,0V96H152a8,8,0,0,1-8-8V40H56v72a8,8,0,0,1-16,0V40A16,16,0,0,1,56,24h96a8,8,0,0,1,5.66,2.34l56,56A8,8,0,0,1,216,88Zm-27.31-8L160,51.31V80Z"}))],["thin",x.createElement(x.Fragment,null,x.createElement("path",{d:"M211.25,154.33,192.92,180l18.33,25.67a4,4,0,0,1-.93,5.58A3.91,3.91,0,0,1,208,212a4,4,0,0,1-3.26-1.67L188,186.88l-16.75,23.45a4,4,0,0,1-6.51-4.66L183.08,180l-18.34-25.67a4,4,0,0,1,6.51-4.66L188,173.12l16.74-23.45a4,4,0,0,1,6.51,4.66Zm-88.76,20.82c-10.53-3-15.08-4.91-14.42-10.08a8.51,8.51,0,0,1,3.75-6.49c6.25-4.23,18.77-2.24,23.06-1.11a4,4,0,0,0,2.05-7.74,61.33,61.33,0,0,0-10.48-1.61c-8.12-.54-14.54.75-19.1,3.82a16.66,16.66,0,0,0-7.22,12.13c-1.58,12.49,10.46,16,20.14,18.77,11.26,3.25,16.47,5.49,15.64,11.94a8.94,8.94,0,0,1-3.91,6.75c-6.27,4.17-18.61,2.05-22.83.88a4,4,0,1,0-2.15,7.7A57.89,57.89,0,0,0,121.19,212c5.18,0,10.83-.86,15.22-3.77a17,17,0,0,0,7.43-12.41C145.64,181.84,132.26,178,122.49,175.15ZM80,148H40a4,4,0,0,0,0,8H56v52a4,4,0,0,0,8,0V156H80a4,4,0,0,0,0-8ZM212,88v24a4,4,0,0,1-8,0V92H152a4,4,0,0,1-4-4V36H56a4,4,0,0,0-4,4v72a4,4,0,0,1-8,0V40A12,12,0,0,1,56,28h96a4,4,0,0,1,2.83,1.17l56,56A4,4,0,0,1,212,88Zm-13.66-4L156,41.65V84Z"}))]]),q_e=new Map([["bold",x.createElement(x.Fragment,null,x.createElement("path",{d:"M48,120a12,12,0,0,0,12-12V44h76V92a12,12,0,0,0,12,12h48v4a12,12,0,0,0,24,0V88a12,12,0,0,0-3.51-8.49l-56-56A12,12,0,0,0,152,20H56A20,20,0,0,0,36,40v68A12,12,0,0,0,48,120ZM183,80H160V57Zm-25.27,79-15,21,15,21A12,12,0,1,1,138.24,215L128,200.65,117.76,215A12,12,0,1,1,98.24,201l15-21-15-21A12,12,0,1,1,117.76,145L128,159.35,138.24,145A12,12,0,1,1,157.76,159ZM92,152a12,12,0,0,1-12,12H72v44a12,12,0,0,1-24,0V164H40a12,12,0,0,1,0-24H80A12,12,0,0,1,92,152Zm136,0a12,12,0,0,1-12,12h-8v44a12,12,0,0,1-24,0V164h-8a12,12,0,0,1,0-24h40A12,12,0,0,1,228,152Z"}))],["duotone",x.createElement(x.Fragment,null,x.createElement("path",{d:"M208,88H152V32Z",opacity:"0.2"}),x.createElement("path",{d:"M48,120a8,8,0,0,0,8-8V40h88V88a8,8,0,0,0,8,8h48v16a8,8,0,0,0,16,0V88a8,8,0,0,0-2.34-5.66l-56-56A8,8,0,0,0,152,24H56A16,16,0,0,0,40,40v72A8,8,0,0,0,48,120ZM160,51.31,188.69,80H160Zm-5.49,105.34L137.83,180l16.68,23.35a8,8,0,0,1-13,9.3L128,193.76l-13.49,18.89a8,8,0,1,1-13-9.3L118.17,180l-16.68-23.35a8,8,0,1,1,13-9.3L128,166.24l13.49-18.89a8,8,0,0,1,13,9.3ZM92,152a8,8,0,0,1-8,8H72v48a8,8,0,0,1-16,0V160H44a8,8,0,0,1,0-16H84A8,8,0,0,1,92,152Zm128,0a8,8,0,0,1-8,8H200v48a8,8,0,0,1-16,0V160H172a8,8,0,0,1,0-16h40A8,8,0,0,1,220,152Z"}))],["fill",x.createElement(x.Fragment,null,x.createElement("path",{d:"M154.31,156.92,137.83,180l16.53,23.14a8.18,8.18,0,0,1-1.22,11,8,8,0,0,1-11.65-1.48L128,193.76l-13.49,18.89a8,8,0,0,1-11.64,1.49,8.17,8.17,0,0,1-1.23-11L118.17,180l-16.48-23.08a8.22,8.22,0,0,1,1.46-11.28,8,8,0,0,1,11.36,1.71L128,166.24l13.49-18.89a8,8,0,0,1,11.36-1.71A8.22,8.22,0,0,1,154.31,156.92ZM84,144H44.27A8.18,8.18,0,0,0,36,151.47,8,8,0,0,0,44,160H56v47.73A8.17,8.17,0,0,0,63.47,216,8,8,0,0,0,72,208V160H83.73A8.18,8.18,0,0,0,92,152.53,8,8,0,0,0,84,144Zm128,0H172.27a8.18,8.18,0,0,0-8.25,7.47,8,8,0,0,0,8,8.53h12v47.73a8.17,8.17,0,0,0,7.47,8.25,8,8,0,0,0,8.53-8V160h11.73a8.18,8.18,0,0,0,8.25-7.47A8,8,0,0,0,212,144ZM40,116V40A16,16,0,0,1,56,24h96a8,8,0,0,1,5.66,2.34l56,56A8,8,0,0,1,216,88v28a4,4,0,0,1-4,4H44A4,4,0,0,1,40,116ZM152,88h44L152,44Z"}))],["light",x.createElement(x.Fragment,null,x.createElement("path",{d:"M48,118a6,6,0,0,0,6-6V40a2,2,0,0,1,2-2h90V88a6,6,0,0,0,6,6h50v18a6,6,0,0,0,12,0V88a6,6,0,0,0-1.76-4.24l-56-56A6,6,0,0,0,152,26H56A14,14,0,0,0,42,40v72A6,6,0,0,0,48,118ZM158,46.48,193.52,82H158Zm-5.12,109L135.37,180l17.51,24.51a6,6,0,1,1-9.76,7L128,190.32l-15.12,21.17a6,6,0,0,1-9.76-7L120.63,180l-17.51-24.51a6,6,0,1,1,9.76-7L128,169.68l15.12-21.17a6,6,0,0,1,9.76,7ZM90,152a6,6,0,0,1-6,6H70v50a6,6,0,0,1-12,0V158H44a6,6,0,0,1,0-12H84A6,6,0,0,1,90,152Zm128,0a6,6,0,0,1-6,6H198v50a6,6,0,0,1-12,0V158H172a6,6,0,0,1,0-12h40A6,6,0,0,1,218,152Z"}))],["regular",x.createElement(x.Fragment,null,x.createElement("path",{d:"M48,120a8,8,0,0,0,8-8V40h88V88a8,8,0,0,0,8,8h48v16a8,8,0,0,0,16,0V88a8,8,0,0,0-2.34-5.66l-56-56A8,8,0,0,0,152,24H56A16,16,0,0,0,40,40v72A8,8,0,0,0,48,120ZM160,51.31,188.69,80H160Zm-5.49,105.34L137.83,180l16.68,23.35a8,8,0,0,1-13,9.3L128,193.76l-13.49,18.89a8,8,0,1,1-13-9.3L118.17,180l-16.68-23.35a8,8,0,1,1,13-9.3L128,166.24l13.49-18.89a8,8,0,0,1,13,9.3ZM92,152a8,8,0,0,1-8,8H72v48a8,8,0,0,1-16,0V160H44a8,8,0,0,1,0-16H84A8,8,0,0,1,92,152Zm128,0a8,8,0,0,1-8,8H200v48a8,8,0,0,1-16,0V160H172a8,8,0,0,1,0-16h40A8,8,0,0,1,220,152Z"}))],["thin",x.createElement(x.Fragment,null,x.createElement("path",{d:"M204,112a4,4,0,0,0,8,0V88a4,4,0,0,0-1.17-2.83l-56-56A4,4,0,0,0,152,28H56A12,12,0,0,0,44,40v72a4,4,0,0,0,8,0V40a4,4,0,0,1,4-4h92V88a4,4,0,0,0,4,4h52ZM156,41.65,198.34,84H156Zm-4.75,112.67L132.92,180l18.33,25.67a4,4,0,1,1-6.5,4.65L128,186.88l-16.75,23.44a4,4,0,1,1-6.5-4.65L123.08,180l-18.33-25.68a4,4,0,1,1,6.5-4.65L128,173.12l16.75-23.45a4,4,0,1,1,6.5,4.65ZM88,152a4,4,0,0,1-4,4H68v52a4,4,0,0,1-8,0V156H44a4,4,0,0,1,0-8H84A4,4,0,0,1,88,152Zm128,0a4,4,0,0,1-4,4H196v52a4,4,0,0,1-8,0V156H172a4,4,0,0,1,0-8h40A4,4,0,0,1,216,152Z"}))]]),Y_e=new Map([["bold",x.createElement(x.Fragment,null,x.createElement("path",{d:"M216.49,79.51l-56-56A12,12,0,0,0,152,20H56A20,20,0,0,0,36,40v68a12,12,0,0,0,24,0V44h76V92a12,12,0,0,0,12,12h48V212a12,12,0,0,0,0,24h4a20,20,0,0,0,20-20V88A12,12,0,0,0,216.49,79.51ZM160,57l23,23H160Zm-1.91,84.69a12,12,0,0,0-11.92-.15L126.5,152.44A20,20,0,0,0,108,140H48a20,20,0,0,0-20,20v48a20,20,0,0,0,20,20h60a20,20,0,0,0,18.5-12.44l19.67,10.93A12,12,0,0,0,164,216V152A12,12,0,0,0,158.09,141.66ZM104,204H52V164h52Zm36-8.39-12-6.67v-9.88l12-6.67Z"}))],["duotone",x.createElement(x.Fragment,null,x.createElement("path",{d:"M208,88H152V32Zm-88,72a8,8,0,0,0-8-8H48a8,8,0,0,0-8,8v48a8,8,0,0,0,8,8h64a8,8,0,0,0,8-8V196l32,20V152l-32,20Z",opacity:"0.2"}),x.createElement("path",{d:"M213.66,82.34l-56-56A8,8,0,0,0,152,24H56A16,16,0,0,0,40,40v72a8,8,0,0,0,16,0V40h88V88a8,8,0,0,0,8,8h48V216h-8a8,8,0,0,0,0,16h8a16,16,0,0,0,16-16V88A8,8,0,0,0,213.66,82.34ZM160,51.31,188.69,80H160ZM155.88,145a8,8,0,0,0-8.12.22l-19.95,12.46A16,16,0,0,0,112,144H48a16,16,0,0,0-16,16v48a16,16,0,0,0,16,16h64a16,16,0,0,0,15.81-13.68l19.95,12.46A8,8,0,0,0,160,216V152A8,8,0,0,0,155.88,145ZM112,208H48V160h64v48Zm32-6.43-16-10V176.43l16-10Z"}))],["fill",x.createElement(x.Fragment,null,x.createElement("path",{d:"M213.66,82.34l-56-56A8,8,0,0,0,152,24H56A16,16,0,0,0,40,40v72a8,8,0,0,0,16,0V40h88V88a8,8,0,0,0,8,8h48V216h-8a8,8,0,0,0,0,16h8a16,16,0,0,0,16-16V88A8,8,0,0,0,213.66,82.34ZM160,51.31,188.69,80H160ZM155.88,145a8,8,0,0,0-8.12.22l-19.95,12.46A16,16,0,0,0,112,144H48a16,16,0,0,0-16,16v48a16,16,0,0,0,16,16h64a16,16,0,0,0,15.81-13.68l19.95,12.46A8,8,0,0,0,160,216V152A8,8,0,0,0,155.88,145ZM144,201.57l-16-10V176.43l16-10Z"}))],["light",x.createElement(x.Fragment,null,x.createElement("path",{d:"M212.24,83.76l-56-56A6,6,0,0,0,152,26H56A14,14,0,0,0,42,40v72a6,6,0,0,0,12,0V40a2,2,0,0,1,2-2h90V88a6,6,0,0,0,6,6h50V216a2,2,0,0,1-2,2h-8a6,6,0,0,0,0,12h8a14,14,0,0,0,14-14V88A6,6,0,0,0,212.24,83.76ZM158,46.48,193.52,82H158Zm-3.09,100.27a6,6,0,0,0-6.09.16L126,161.17V160a14,14,0,0,0-14-14H48a14,14,0,0,0-14,14v48a14,14,0,0,0,14,14h64a14,14,0,0,0,14-14v-1.17l22.82,14.26A6,6,0,0,0,158,216V152A6,6,0,0,0,154.91,146.75ZM114,208a2,2,0,0,1-2,2H48a2,2,0,0,1-2-2V160a2,2,0,0,1,2-2h64a2,2,0,0,1,2,2Zm32-2.83-20-12.5V175.33l20-12.5Z"}))],["regular",x.createElement(x.Fragment,null,x.createElement("path",{d:"M213.66,82.34l-56-56A8,8,0,0,0,152,24H56A16,16,0,0,0,40,40v72a8,8,0,0,0,16,0V40h88V88a8,8,0,0,0,8,8h48V216h-8a8,8,0,0,0,0,16h8a16,16,0,0,0,16-16V88A8,8,0,0,0,213.66,82.34ZM160,51.31,188.69,80H160ZM155.88,145a8,8,0,0,0-8.12.22l-19.95,12.46A16,16,0,0,0,112,144H48a16,16,0,0,0-16,16v48a16,16,0,0,0,16,16h64a16,16,0,0,0,15.81-13.68l19.95,12.46A8,8,0,0,0,160,216V152A8,8,0,0,0,155.88,145ZM112,208H48V160h64v48Zm32-6.43-16-10V176.43l16-10Z"}))],["thin",x.createElement(x.Fragment,null,x.createElement("path",{d:"M210.83,85.17l-56-56A4,4,0,0,0,152,28H56A12,12,0,0,0,44,40v72a4,4,0,0,0,8,0V40a4,4,0,0,1,4-4h92V88a4,4,0,0,0,4,4h52V216a4,4,0,0,1-4,4h-8a4,4,0,0,0,0,8h8a12,12,0,0,0,12-12V88A4,4,0,0,0,210.83,85.17ZM156,41.65,198.34,84H156ZM153.94,148.5a4,4,0,0,0-4.06.11L124,164.78V160a12,12,0,0,0-12-12H48a12,12,0,0,0-12,12v48a12,12,0,0,0,12,12h64a12,12,0,0,0,12-12v-4.78l25.88,16.17A4,4,0,0,0,152,220a4.06,4.06,0,0,0,1.94-.5A4,4,0,0,0,156,216V152A4,4,0,0,0,153.94,148.5ZM116,208a4,4,0,0,1-4,4H48a4,4,0,0,1-4-4V160a4,4,0,0,1,4-4h64a4,4,0,0,1,4,4Zm32,.78-24-15V174.22l24-15Z"}))]]),K_e=new Map([["bold",x.createElement(x.Fragment,null,x.createElement("path",{d:"M216,36H40A20,20,0,0,0,20,56V200a20,20,0,0,0,20,20H216a20,20,0,0,0,20-20V56A20,20,0,0,0,216,36ZM44,100h72v56H44Zm96-24V60h24V76Zm-24,0H92V60h24Zm0,104v16H92V180Zm24,0h24v16H140Zm0-24V100h72v56Zm72-80H188V60h24ZM68,60V76H44V60ZM44,180H68v16H44Zm144,16V180h24v16Z"}))],["duotone",x.createElement(x.Fragment,null,x.createElement("path",{d:"M32,176H224v24a8,8,0,0,1-8,8H40a8,8,0,0,1-8-8ZM216,48H40a8,8,0,0,0-8,8V80H224V56A8,8,0,0,0,216,48Z",opacity:"0.2"}),x.createElement("path",{d:"M216,40H40A16,16,0,0,0,24,56V200a16,16,0,0,0,16,16H216a16,16,0,0,0,16-16V56A16,16,0,0,0,216,40ZM40,88h80v80H40Zm96-16V56h32V72Zm-16,0H88V56h32Zm0,112v16H88V184Zm16,0h32v16H136Zm0-16V88h80v80Zm80-96H184V56h32ZM72,56V72H40V56ZM40,184H72v16H40Zm176,16H184V184h32v16Z"}))],["fill",x.createElement(x.Fragment,null,x.createElement("path",{d:"M216,40H40A16,16,0,0,0,24,56V200a16,16,0,0,0,16,16H216a16,16,0,0,0,16-16V56A16,16,0,0,0,216,40ZM184,56h32V72H184ZM72,200H40V184H72ZM72,72H40V56H72Zm48,128H88V184h32Zm0-128H88V56h32Zm48,128H136V184h32Zm0-128H136V56h32Zm48,128H184V184h32v16Z"}))],["light",x.createElement(x.Fragment,null,x.createElement("path",{d:"M216,42H40A14,14,0,0,0,26,56V200a14,14,0,0,0,14,14H216a14,14,0,0,0,14-14V56A14,14,0,0,0,216,42ZM38,86h84v84H38Zm96-12V54h36V74Zm-12,0H86V54h36Zm0,108v20H86V182Zm12,0h36v20H134Zm0-12V86h84v84ZM218,56V74H182V54h34A2,2,0,0,1,218,56ZM40,54H74V74H38V56A2,2,0,0,1,40,54ZM38,200V182H74v20H40A2,2,0,0,1,38,200Zm178,2H182V182h36v18A2,2,0,0,1,216,202Z"}))],["regular",x.createElement(x.Fragment,null,x.createElement("path",{d:"M216,40H40A16,16,0,0,0,24,56V200a16,16,0,0,0,16,16H216a16,16,0,0,0,16-16V56A16,16,0,0,0,216,40ZM40,88h80v80H40Zm96-16V56h32V72Zm-16,0H88V56h32Zm0,112v16H88V184Zm16,0h32v16H136Zm0-16V88h80v80Zm80-96H184V56h32ZM72,56V72H40V56ZM40,184H72v16H40Zm176,16H184V184h32v16Z"}))],["thin",x.createElement(x.Fragment,null,x.createElement("path",{d:"M216,44H40A12,12,0,0,0,28,56V200a12,12,0,0,0,12,12H216a12,12,0,0,0,12-12V56A12,12,0,0,0,216,44ZM36,84h88v88H36Zm96-8V52h40V76Zm-8,0H84V52h40Zm0,104v24H84V180Zm8,0h40v24H132Zm0-8V84h88v88ZM220,56V76H180V52h36A4,4,0,0,1,220,56ZM40,52H76V76H36V56A4,4,0,0,1,40,52ZM36,200V180H76v24H40A4,4,0,0,1,36,200Zm180,4H180V180h40v20A4,4,0,0,1,216,204Z"}))]]),J_e=new Map([["bold",x.createElement(x.Fragment,null,x.createElement("path",{d:"M216,68H132L105.33,48a20.12,20.12,0,0,0-12-4H40A20,20,0,0,0,20,64V200a20,20,0,0,0,20,20H216.89A19.13,19.13,0,0,0,236,200.89V88A20,20,0,0,0,216,68Zm-4,128H44V68H92l28.8,21.6A12,12,0,0,0,128,92h84Z"}))],["duotone",x.createElement(x.Fragment,null,x.createElement("path",{d:"M224,88V200.89a7.11,7.11,0,0,1-7.11,7.11H40a8,8,0,0,1-8-8V64a8,8,0,0,1,8-8H93.33a8,8,0,0,1,4.8,1.6L128,80h88A8,8,0,0,1,224,88Z",opacity:"0.2"}),x.createElement("path",{d:"M216,72H130.67L102.93,51.2a16.12,16.12,0,0,0-9.6-3.2H40A16,16,0,0,0,24,64V200a16,16,0,0,0,16,16H216.89A15.13,15.13,0,0,0,232,200.89V88A16,16,0,0,0,216,72Zm0,128H40V64H93.33L123.2,86.4A8,8,0,0,0,128,88h88Z"}))],["fill",x.createElement(x.Fragment,null,x.createElement("path",{d:"M232,88V200.89A15.13,15.13,0,0,1,216.89,216H40a16,16,0,0,1-16-16V64A16,16,0,0,1,40,48H93.33a16.12,16.12,0,0,1,9.6,3.2L130.67,72H216A16,16,0,0,1,232,88Z"}))],["light",x.createElement(x.Fragment,null,x.createElement("path",{d:"M216,74H130L101.73,52.8a14,14,0,0,0-8.4-2.8H40A14,14,0,0,0,26,64V200a14,14,0,0,0,14,14H216.89A13.12,13.12,0,0,0,230,200.89V88A14,14,0,0,0,216,74Zm2,126.89a1.11,1.11,0,0,1-1.11,1.11H40a2,2,0,0,1-2-2V64a2,2,0,0,1,2-2H93.33a2,2,0,0,1,1.2.4L124.4,84.8A6,6,0,0,0,128,86h88a2,2,0,0,1,2,2Z"}))],["regular",x.createElement(x.Fragment,null,x.createElement("path",{d:"M216,72H130.67L102.93,51.2a16.12,16.12,0,0,0-9.6-3.2H40A16,16,0,0,0,24,64V200a16,16,0,0,0,16,16H216.89A15.13,15.13,0,0,0,232,200.89V88A16,16,0,0,0,216,72Zm0,128H40V64H93.33L123.2,86.4A8,8,0,0,0,128,88h88Z"}))],["thin",x.createElement(x.Fragment,null,x.createElement("path",{d:"M216,76H129.33l-28.8-21.6a12.05,12.05,0,0,0-7.2-2.4H40A12,12,0,0,0,28,64V200a12,12,0,0,0,12,12H216.89A11.12,11.12,0,0,0,228,200.89V88A12,12,0,0,0,216,76Zm4,124.89a3.12,3.12,0,0,1-3.11,3.11H40a4,4,0,0,1-4-4V64a4,4,0,0,1,4-4H93.33a4,4,0,0,1,2.4.8L125.6,83.2a4,4,0,0,0,2.4.8h88a4,4,0,0,1,4,4Z"}))]]),eRe=new Map([["bold",x.createElement(x.Fragment,null,x.createElement("path",{d:"M216,68H132L105.33,48a20.12,20.12,0,0,0-12-4H40A20,20,0,0,0,20,64V200a20,20,0,0,0,20,20H216.89A19.13,19.13,0,0,0,236,200.89V88A20,20,0,0,0,216,68Zm-4,128H44V68H92l28.8,21.6A12,12,0,0,0,128,92h84Zm-84-88a12,12,0,0,1,12,12v12h12a12,12,0,0,1,0,24H140v12a12,12,0,0,1-24,0V156H104a12,12,0,0,1,0-24h12V120A12,12,0,0,1,128,108Z"}))],["duotone",x.createElement(x.Fragment,null,x.createElement("path",{d:"M224,88V200.89a7.11,7.11,0,0,1-7.11,7.11H40a8,8,0,0,1-8-8V64a8,8,0,0,1,8-8H93.33a8,8,0,0,1,4.8,1.6L128,80h88A8,8,0,0,1,224,88Z",opacity:"0.2"}),x.createElement("path",{d:"M216,72H130.67L102.93,51.2a16.12,16.12,0,0,0-9.6-3.2H40A16,16,0,0,0,24,64V200a16,16,0,0,0,16,16H216.89A15.13,15.13,0,0,0,232,200.89V88A16,16,0,0,0,216,72Zm0,128H40V64H93.33L123.2,86.4A8,8,0,0,0,128,88h88Zm-56-56a8,8,0,0,1-8,8H136v16a8,8,0,0,1-16,0V152H104a8,8,0,0,1,0-16h16V120a8,8,0,0,1,16,0v16h16A8,8,0,0,1,160,144Z"}))],["fill",x.createElement(x.Fragment,null,x.createElement("path",{d:"M216,72H130.67L102.93,51.2a16.12,16.12,0,0,0-9.6-3.2H40A16,16,0,0,0,24,64V200a16,16,0,0,0,16,16H216.89A15.13,15.13,0,0,0,232,200.89V88A16,16,0,0,0,216,72Zm-64,80H136v16a8,8,0,0,1-16,0V152H104a8,8,0,0,1,0-16h16V120a8,8,0,0,1,16,0v16h16a8,8,0,0,1,0,16Z"}))],["light",x.createElement(x.Fragment,null,x.createElement("path",{d:"M216,74H130L101.73,52.8a14,14,0,0,0-8.4-2.8H40A14,14,0,0,0,26,64V200a14,14,0,0,0,14,14H216.89A13.12,13.12,0,0,0,230,200.89V88A14,14,0,0,0,216,74Zm2,126.89a1.11,1.11,0,0,1-1.11,1.11H40a2,2,0,0,1-2-2V64a2,2,0,0,1,2-2H93.33a2,2,0,0,1,1.2.4L124.4,84.8A6,6,0,0,0,128,86h88a2,2,0,0,1,2,2ZM158,144a6,6,0,0,1-6,6H134v18a6,6,0,0,1-12,0V150H104a6,6,0,0,1,0-12h18V120a6,6,0,0,1,12,0v18h18A6,6,0,0,1,158,144Z"}))],["regular",x.createElement(x.Fragment,null,x.createElement("path",{d:"M216,72H130.67L102.93,51.2a16.12,16.12,0,0,0-9.6-3.2H40A16,16,0,0,0,24,64V200a16,16,0,0,0,16,16H216.89A15.13,15.13,0,0,0,232,200.89V88A16,16,0,0,0,216,72Zm0,128H40V64H93.33L123.2,86.4A8,8,0,0,0,128,88h88Zm-56-56a8,8,0,0,1-8,8H136v16a8,8,0,0,1-16,0V152H104a8,8,0,0,1,0-16h16V120a8,8,0,0,1,16,0v16h16A8,8,0,0,1,160,144Z"}))],["thin",x.createElement(x.Fragment,null,x.createElement("path",{d:"M216,76H129.33l-28.8-21.6a12.05,12.05,0,0,0-7.2-2.4H40A12,12,0,0,0,28,64V200a12,12,0,0,0,12,12H216.89A11.12,11.12,0,0,0,228,200.89V88A12,12,0,0,0,216,76Zm4,124.89a3.12,3.12,0,0,1-3.11,3.11H40a4,4,0,0,1-4-4V64a4,4,0,0,1,4-4H93.33a4,4,0,0,1,2.4.8L125.6,83.2a4,4,0,0,0,2.4.8h88a4,4,0,0,1,4,4ZM156,144a4,4,0,0,1-4,4H132v20a4,4,0,0,1-8,0V148H104a4,4,0,0,1,0-8h20V120a4,4,0,0,1,8,0v20h20A4,4,0,0,1,156,144Z"}))]]),tRe=new Map([["bold",x.createElement(x.Fragment,null,x.createElement("path",{d:"M128,76a52,52,0,1,0,52,52A52.06,52.06,0,0,0,128,76Zm0,80a28,28,0,1,1,28-28A28,28,0,0,1,128,156Zm92-27.21v-1.58l14-17.51a12,12,0,0,0,2.23-10.59A111.75,111.75,0,0,0,225,71.89,12,12,0,0,0,215.89,66L193.61,63.5l-1.11-1.11L190,40.1A12,12,0,0,0,184.11,31a111.67,111.67,0,0,0-27.23-11.27A12,12,0,0,0,146.3,22L128.79,36h-1.58L109.7,22a12,12,0,0,0-10.59-2.23A111.75,111.75,0,0,0,71.89,31.05,12,12,0,0,0,66,40.11L63.5,62.39,62.39,63.5,40.1,66A12,12,0,0,0,31,71.89,111.67,111.67,0,0,0,19.77,99.12,12,12,0,0,0,22,109.7l14,17.51v1.58L22,146.3a12,12,0,0,0-2.23,10.59,111.75,111.75,0,0,0,11.29,27.22A12,12,0,0,0,40.11,190l22.28,2.48,1.11,1.11L66,215.9A12,12,0,0,0,71.89,225a111.67,111.67,0,0,0,27.23,11.27A12,12,0,0,0,109.7,234l17.51-14h1.58l17.51,14a12,12,0,0,0,10.59,2.23A111.75,111.75,0,0,0,184.11,225a12,12,0,0,0,5.91-9.06l2.48-22.28,1.11-1.11L215.9,190a12,12,0,0,0,9.06-5.91,111.67,111.67,0,0,0,11.27-27.23A12,12,0,0,0,234,146.3Zm-24.12-4.89a70.1,70.1,0,0,1,0,8.2,12,12,0,0,0,2.61,8.22l12.84,16.05A86.47,86.47,0,0,1,207,166.86l-20.43,2.27a12,12,0,0,0-7.65,4,69,69,0,0,1-5.8,5.8,12,12,0,0,0-4,7.65L166.86,207a86.47,86.47,0,0,1-10.49,4.35l-16.05-12.85a12,12,0,0,0-7.5-2.62c-.24,0-.48,0-.72,0a70.1,70.1,0,0,1-8.2,0,12.06,12.06,0,0,0-8.22,2.6L99.63,211.33A86.47,86.47,0,0,1,89.14,207l-2.27-20.43a12,12,0,0,0-4-7.65,69,69,0,0,1-5.8-5.8,12,12,0,0,0-7.65-4L49,166.86a86.47,86.47,0,0,1-4.35-10.49l12.84-16.05a12,12,0,0,0,2.61-8.22,70.1,70.1,0,0,1,0-8.2,12,12,0,0,0-2.61-8.22L44.67,99.63A86.47,86.47,0,0,1,49,89.14l20.43-2.27a12,12,0,0,0,7.65-4,69,69,0,0,1,5.8-5.8,12,12,0,0,0,4-7.65L89.14,49a86.47,86.47,0,0,1,10.49-4.35l16.05,12.85a12.06,12.06,0,0,0,8.22,2.6,70.1,70.1,0,0,1,8.2,0,12,12,0,0,0,8.22-2.6l16.05-12.85A86.47,86.47,0,0,1,166.86,49l2.27,20.43a12,12,0,0,0,4,7.65,69,69,0,0,1,5.8,5.8,12,12,0,0,0,7.65,4L207,89.14a86.47,86.47,0,0,1,4.35,10.49l-12.84,16.05A12,12,0,0,0,195.88,123.9Z"}))],["duotone",x.createElement(x.Fragment,null,x.createElement("path",{d:"M207.86,123.18l16.78-21a99.14,99.14,0,0,0-10.07-24.29l-26.7-3a81,81,0,0,0-6.81-6.81l-3-26.71a99.43,99.43,0,0,0-24.3-10l-21,16.77a81.59,81.59,0,0,0-9.64,0l-21-16.78A99.14,99.14,0,0,0,77.91,41.43l-3,26.7a81,81,0,0,0-6.81,6.81l-26.71,3a99.43,99.43,0,0,0-10,24.3l16.77,21a81.59,81.59,0,0,0,0,9.64l-16.78,21a99.14,99.14,0,0,0,10.07,24.29l26.7,3a81,81,0,0,0,6.81,6.81l3,26.71a99.43,99.43,0,0,0,24.3,10l21-16.77a81.59,81.59,0,0,0,9.64,0l21,16.78a99.14,99.14,0,0,0,24.29-10.07l3-26.7a81,81,0,0,0,6.81-6.81l26.71-3a99.43,99.43,0,0,0,10-24.3l-16.77-21A81.59,81.59,0,0,0,207.86,123.18ZM128,168a40,40,0,1,1,40-40A40,40,0,0,1,128,168Z",opacity:"0.2"}),x.createElement("path",{d:"M128,80a48,48,0,1,0,48,48A48.05,48.05,0,0,0,128,80Zm0,80a32,32,0,1,1,32-32A32,32,0,0,1,128,160Zm88-29.84q.06-2.16,0-4.32l14.92-18.64a8,8,0,0,0,1.48-7.06,107.6,107.6,0,0,0-10.88-26.25,8,8,0,0,0-6-3.93l-23.72-2.64q-1.48-1.56-3-3L186,40.54a8,8,0,0,0-3.94-6,107.29,107.29,0,0,0-26.25-10.86,8,8,0,0,0-7.06,1.48L130.16,40Q128,40,125.84,40L107.2,25.11a8,8,0,0,0-7.06-1.48A107.6,107.6,0,0,0,73.89,34.51a8,8,0,0,0-3.93,6L67.32,64.27q-1.56,1.49-3,3L40.54,70a8,8,0,0,0-6,3.94,107.71,107.71,0,0,0-10.87,26.25,8,8,0,0,0,1.49,7.06L40,125.84Q40,128,40,130.16L25.11,148.8a8,8,0,0,0-1.48,7.06,107.6,107.6,0,0,0,10.88,26.25,8,8,0,0,0,6,3.93l23.72,2.64q1.49,1.56,3,3L70,215.46a8,8,0,0,0,3.94,6,107.71,107.71,0,0,0,26.25,10.87,8,8,0,0,0,7.06-1.49L125.84,216q2.16.06,4.32,0l18.64,14.92a8,8,0,0,0,7.06,1.48,107.21,107.21,0,0,0,26.25-10.88,8,8,0,0,0,3.93-6l2.64-23.72q1.56-1.48,3-3L215.46,186a8,8,0,0,0,6-3.94,107.71,107.71,0,0,0,10.87-26.25,8,8,0,0,0-1.49-7.06Zm-16.1-6.5a73.93,73.93,0,0,1,0,8.68,8,8,0,0,0,1.74,5.48l14.19,17.73a91.57,91.57,0,0,1-6.23,15L187,173.11a8,8,0,0,0-5.1,2.64,74.11,74.11,0,0,1-6.14,6.14,8,8,0,0,0-2.64,5.1l-2.51,22.58a91.32,91.32,0,0,1-15,6.23l-17.74-14.19a8,8,0,0,0-5-1.75h-.48a73.93,73.93,0,0,1-8.68,0,8.06,8.06,0,0,0-5.48,1.74L100.45,215.8a91.57,91.57,0,0,1-15-6.23L82.89,187a8,8,0,0,0-2.64-5.1,74.11,74.11,0,0,1-6.14-6.14,8,8,0,0,0-5.1-2.64L46.43,170.6a91.32,91.32,0,0,1-6.23-15l14.19-17.74a8,8,0,0,0,1.74-5.48,73.93,73.93,0,0,1,0-8.68,8,8,0,0,0-1.74-5.48L40.2,100.45a91.57,91.57,0,0,1,6.23-15L69,82.89a8,8,0,0,0,5.1-2.64,74.11,74.11,0,0,1,6.14-6.14A8,8,0,0,0,82.89,69L85.4,46.43a91.32,91.32,0,0,1,15-6.23l17.74,14.19a8,8,0,0,0,5.48,1.74,73.93,73.93,0,0,1,8.68,0,8.06,8.06,0,0,0,5.48-1.74L155.55,40.2a91.57,91.57,0,0,1,15,6.23L173.11,69a8,8,0,0,0,2.64,5.1,74.11,74.11,0,0,1,6.14,6.14,8,8,0,0,0,5.1,2.64l22.58,2.51a91.32,91.32,0,0,1,6.23,15l-14.19,17.74A8,8,0,0,0,199.87,123.66Z"}))],["fill",x.createElement(x.Fragment,null,x.createElement("path",{d:"M216,130.16q.06-2.16,0-4.32l14.92-18.64a8,8,0,0,0,1.48-7.06,107.6,107.6,0,0,0-10.88-26.25,8,8,0,0,0-6-3.93l-23.72-2.64q-1.48-1.56-3-3L186,40.54a8,8,0,0,0-3.94-6,107.29,107.29,0,0,0-26.25-10.86,8,8,0,0,0-7.06,1.48L130.16,40Q128,40,125.84,40L107.2,25.11a8,8,0,0,0-7.06-1.48A107.6,107.6,0,0,0,73.89,34.51a8,8,0,0,0-3.93,6L67.32,64.27q-1.56,1.49-3,3L40.54,70a8,8,0,0,0-6,3.94,107.71,107.71,0,0,0-10.87,26.25,8,8,0,0,0,1.49,7.06L40,125.84Q40,128,40,130.16L25.11,148.8a8,8,0,0,0-1.48,7.06,107.6,107.6,0,0,0,10.88,26.25,8,8,0,0,0,6,3.93l23.72,2.64q1.49,1.56,3,3L70,215.46a8,8,0,0,0,3.94,6,107.71,107.71,0,0,0,26.25,10.87,8,8,0,0,0,7.06-1.49L125.84,216q2.16.06,4.32,0l18.64,14.92a8,8,0,0,0,7.06,1.48,107.21,107.21,0,0,0,26.25-10.88,8,8,0,0,0,3.93-6l2.64-23.72q1.56-1.48,3-3L215.46,186a8,8,0,0,0,6-3.94,107.71,107.71,0,0,0,10.87-26.25,8,8,0,0,0-1.49-7.06ZM128,168a40,40,0,1,1,40-40A40,40,0,0,1,128,168Z"}))],["light",x.createElement(x.Fragment,null,x.createElement("path",{d:"M128,82a46,46,0,1,0,46,46A46.06,46.06,0,0,0,128,82Zm0,80a34,34,0,1,1,34-34A34,34,0,0,1,128,162ZM214,130.84c.06-1.89.06-3.79,0-5.68L229.33,106a6,6,0,0,0,1.11-5.29A105.34,105.34,0,0,0,219.76,74.9a6,6,0,0,0-4.53-3l-24.45-2.71q-1.93-2.07-4-4l-2.72-24.46a6,6,0,0,0-3-4.53,105.65,105.65,0,0,0-25.77-10.66A6,6,0,0,0,150,26.68l-19.2,15.37c-1.89-.06-3.79-.06-5.68,0L106,26.67a6,6,0,0,0-5.29-1.11A105.34,105.34,0,0,0,74.9,36.24a6,6,0,0,0-3,4.53L69.23,65.22q-2.07,1.94-4,4L40.76,72a6,6,0,0,0-4.53,3,105.65,105.65,0,0,0-10.66,25.77A6,6,0,0,0,26.68,106l15.37,19.2c-.06,1.89-.06,3.79,0,5.68L26.67,150.05a6,6,0,0,0-1.11,5.29A105.34,105.34,0,0,0,36.24,181.1a6,6,0,0,0,4.53,3l24.45,2.71q1.94,2.07,4,4L72,215.24a6,6,0,0,0,3,4.53,105.65,105.65,0,0,0,25.77,10.66,6,6,0,0,0,5.29-1.11L125.16,214c1.89.06,3.79.06,5.68,0l19.21,15.38a6,6,0,0,0,3.75,1.31,6.2,6.2,0,0,0,1.54-.2,105.34,105.34,0,0,0,25.76-10.68,6,6,0,0,0,3-4.53l2.71-24.45q2.07-1.93,4-4l24.46-2.72a6,6,0,0,0,4.53-3,105.49,105.49,0,0,0,10.66-25.77,6,6,0,0,0-1.11-5.29Zm-3.1,41.63-23.64,2.63a6,6,0,0,0-3.82,2,75.14,75.14,0,0,1-6.31,6.31,6,6,0,0,0-2,3.82l-2.63,23.63A94.28,94.28,0,0,1,155.14,218l-18.57-14.86a6,6,0,0,0-3.75-1.31h-.36a78.07,78.07,0,0,1-8.92,0,6,6,0,0,0-4.11,1.3L100.87,218a94.13,94.13,0,0,1-17.34-7.17L80.9,187.21a6,6,0,0,0-2-3.82,75.14,75.14,0,0,1-6.31-6.31,6,6,0,0,0-3.82-2l-23.63-2.63A94.28,94.28,0,0,1,38,155.14l14.86-18.57a6,6,0,0,0,1.3-4.11,78.07,78.07,0,0,1,0-8.92,6,6,0,0,0-1.3-4.11L38,100.87a94.13,94.13,0,0,1,7.17-17.34L68.79,80.9a6,6,0,0,0,3.82-2,75.14,75.14,0,0,1,6.31-6.31,6,6,0,0,0,2-3.82l2.63-23.63A94.28,94.28,0,0,1,100.86,38l18.57,14.86a6,6,0,0,0,4.11,1.3,78.07,78.07,0,0,1,8.92,0,6,6,0,0,0,4.11-1.3L155.13,38a94.13,94.13,0,0,1,17.34,7.17l2.63,23.64a6,6,0,0,0,2,3.82,75.14,75.14,0,0,1,6.31,6.31,6,6,0,0,0,3.82,2l23.63,2.63A94.28,94.28,0,0,1,218,100.86l-14.86,18.57a6,6,0,0,0-1.3,4.11,78.07,78.07,0,0,1,0,8.92,6,6,0,0,0,1.3,4.11L218,155.13A94.13,94.13,0,0,1,210.85,172.47Z"}))],["regular",x.createElement(x.Fragment,null,x.createElement("path",{d:"M128,80a48,48,0,1,0,48,48A48.05,48.05,0,0,0,128,80Zm0,80a32,32,0,1,1,32-32A32,32,0,0,1,128,160Zm88-29.84q.06-2.16,0-4.32l14.92-18.64a8,8,0,0,0,1.48-7.06,107.21,107.21,0,0,0-10.88-26.25,8,8,0,0,0-6-3.93l-23.72-2.64q-1.48-1.56-3-3L186,40.54a8,8,0,0,0-3.94-6,107.71,107.71,0,0,0-26.25-10.87,8,8,0,0,0-7.06,1.49L130.16,40Q128,40,125.84,40L107.2,25.11a8,8,0,0,0-7.06-1.48A107.6,107.6,0,0,0,73.89,34.51a8,8,0,0,0-3.93,6L67.32,64.27q-1.56,1.49-3,3L40.54,70a8,8,0,0,0-6,3.94,107.71,107.71,0,0,0-10.87,26.25,8,8,0,0,0,1.49,7.06L40,125.84Q40,128,40,130.16L25.11,148.8a8,8,0,0,0-1.48,7.06,107.21,107.21,0,0,0,10.88,26.25,8,8,0,0,0,6,3.93l23.72,2.64q1.49,1.56,3,3L70,215.46a8,8,0,0,0,3.94,6,107.71,107.71,0,0,0,26.25,10.87,8,8,0,0,0,7.06-1.49L125.84,216q2.16.06,4.32,0l18.64,14.92a8,8,0,0,0,7.06,1.48,107.21,107.21,0,0,0,26.25-10.88,8,8,0,0,0,3.93-6l2.64-23.72q1.56-1.48,3-3L215.46,186a8,8,0,0,0,6-3.94,107.71,107.71,0,0,0,10.87-26.25,8,8,0,0,0-1.49-7.06Zm-16.1-6.5a73.93,73.93,0,0,1,0,8.68,8,8,0,0,0,1.74,5.48l14.19,17.73a91.57,91.57,0,0,1-6.23,15L187,173.11a8,8,0,0,0-5.1,2.64,74.11,74.11,0,0,1-6.14,6.14,8,8,0,0,0-2.64,5.1l-2.51,22.58a91.32,91.32,0,0,1-15,6.23l-17.74-14.19a8,8,0,0,0-5-1.75h-.48a73.93,73.93,0,0,1-8.68,0,8,8,0,0,0-5.48,1.74L100.45,215.8a91.57,91.57,0,0,1-15-6.23L82.89,187a8,8,0,0,0-2.64-5.1,74.11,74.11,0,0,1-6.14-6.14,8,8,0,0,0-5.1-2.64L46.43,170.6a91.32,91.32,0,0,1-6.23-15l14.19-17.74a8,8,0,0,0,1.74-5.48,73.93,73.93,0,0,1,0-8.68,8,8,0,0,0-1.74-5.48L40.2,100.45a91.57,91.57,0,0,1,6.23-15L69,82.89a8,8,0,0,0,5.1-2.64,74.11,74.11,0,0,1,6.14-6.14A8,8,0,0,0,82.89,69L85.4,46.43a91.32,91.32,0,0,1,15-6.23l17.74,14.19a8,8,0,0,0,5.48,1.74,73.93,73.93,0,0,1,8.68,0,8,8,0,0,0,5.48-1.74L155.55,40.2a91.57,91.57,0,0,1,15,6.23L173.11,69a8,8,0,0,0,2.64,5.1,74.11,74.11,0,0,1,6.14,6.14,8,8,0,0,0,5.1,2.64l22.58,2.51a91.32,91.32,0,0,1,6.23,15l-14.19,17.74A8,8,0,0,0,199.87,123.66Z"}))],["thin",x.createElement(x.Fragment,null,x.createElement("path",{d:"M128,84a44,44,0,1,0,44,44A44.05,44.05,0,0,0,128,84Zm0,80a36,36,0,1,1,36-36A36,36,0,0,1,128,164Zm83.93-32.49q.13-3.51,0-7l15.83-19.79a4,4,0,0,0,.75-3.53A103.64,103.64,0,0,0,218,75.9a4,4,0,0,0-3-2l-25.19-2.8c-1.58-1.71-3.24-3.37-4.95-4.95L182.07,41a4,4,0,0,0-2-3A104,104,0,0,0,154.82,27.5a4,4,0,0,0-3.53.74L131.51,44.07q-3.51-.14-7,0L104.7,28.24a4,4,0,0,0-3.53-.75A103.64,103.64,0,0,0,75.9,38a4,4,0,0,0-2,3l-2.8,25.19c-1.71,1.58-3.37,3.24-4.95,4.95L41,73.93a4,4,0,0,0-3,2A104,104,0,0,0,27.5,101.18a4,4,0,0,0,.74,3.53l15.83,19.78q-.14,3.51,0,7L28.24,151.3a4,4,0,0,0-.75,3.53A103.64,103.64,0,0,0,38,180.1a4,4,0,0,0,3,2l25.19,2.8c1.58,1.71,3.24,3.37,4.95,4.95l2.8,25.2a4,4,0,0,0,2,3,104,104,0,0,0,25.28,10.46,4,4,0,0,0,3.53-.74l19.78-15.83q3.51.13,7,0l19.79,15.83a4,4,0,0,0,2.5.88,4,4,0,0,0,1-.13A103.64,103.64,0,0,0,180.1,218a4,4,0,0,0,2-3l2.8-25.19c1.71-1.58,3.37-3.24,4.95-4.95l25.2-2.8a4,4,0,0,0,3-2,104,104,0,0,0,10.46-25.28,4,4,0,0,0-.74-3.53Zm.17,42.83-24.67,2.74a4,4,0,0,0-2.55,1.32,76.2,76.2,0,0,1-6.48,6.48,4,4,0,0,0-1.32,2.55l-2.74,24.66a95.45,95.45,0,0,1-19.64,8.15l-19.38-15.51a4,4,0,0,0-2.5-.87h-.24a73.67,73.67,0,0,1-9.16,0,4,4,0,0,0-2.74.87l-19.37,15.5a95.33,95.33,0,0,1-19.65-8.13l-2.74-24.67a4,4,0,0,0-1.32-2.55,76.2,76.2,0,0,1-6.48-6.48,4,4,0,0,0-2.55-1.32l-24.66-2.74a95.45,95.45,0,0,1-8.15-19.64l15.51-19.38a4,4,0,0,0,.87-2.74,77.76,77.76,0,0,1,0-9.16,4,4,0,0,0-.87-2.74l-15.5-19.37A95.33,95.33,0,0,1,43.9,81.66l24.67-2.74a4,4,0,0,0,2.55-1.32,76.2,76.2,0,0,1,6.48-6.48,4,4,0,0,0,1.32-2.55l2.74-24.66a95.45,95.45,0,0,1,19.64-8.15l19.38,15.51a4,4,0,0,0,2.74.87,73.67,73.67,0,0,1,9.16,0,4,4,0,0,0,2.74-.87l19.37-15.5a95.33,95.33,0,0,1,19.65,8.13l2.74,24.67a4,4,0,0,0,1.32,2.55,76.2,76.2,0,0,1,6.48,6.48,4,4,0,0,0,2.55,1.32l24.66,2.74a95.45,95.45,0,0,1,8.15,19.64l-15.51,19.38a4,4,0,0,0-.87,2.74,77.76,77.76,0,0,1,0,9.16,4,4,0,0,0,.87,2.74l15.5,19.37A95.33,95.33,0,0,1,212.1,174.34Z"}))]]),nRe=new Map([["bold",x.createElement(x.Fragment,null,x.createElement("path",{d:"M200,36H56A20,20,0,0,0,36,56V200a20,20,0,0,0,20,20H200a20,20,0,0,0,20-20V56A20,20,0,0,0,200,36Zm-4,80H140V60h56ZM116,60v56H60V60ZM60,140h56v56H60Zm80,56V140h56v56Z"}))],["duotone",x.createElement(x.Fragment,null,x.createElement("path",{d:"M208,56V200a8,8,0,0,1-8,8H56a8,8,0,0,1-8-8V56a8,8,0,0,1,8-8H200A8,8,0,0,1,208,56Z",opacity:"0.2"}),x.createElement("path",{d:"M200,40H56A16,16,0,0,0,40,56V200a16,16,0,0,0,16,16H200a16,16,0,0,0,16-16V56A16,16,0,0,0,200,40Zm0,80H136V56h64ZM120,56v64H56V56ZM56,136h64v64H56Zm144,64H136V136h64v64Z"}))],["fill",x.createElement(x.Fragment,null,x.createElement("path",{d:"M216,56v60a4,4,0,0,1-4,4H136V44a4,4,0,0,1,4-4h60A16,16,0,0,1,216,56ZM116,40H56A16,16,0,0,0,40,56v60a4,4,0,0,0,4,4h76V44A4,4,0,0,0,116,40Zm96,96H136v76a4,4,0,0,0,4,4h60a16,16,0,0,0,16-16V140A4,4,0,0,0,212,136ZM40,140v60a16,16,0,0,0,16,16h60a4,4,0,0,0,4-4V136H44A4,4,0,0,0,40,140Z"}))],["light",x.createElement(x.Fragment,null,x.createElement("path",{d:"M200,42H56A14,14,0,0,0,42,56V200a14,14,0,0,0,14,14H200a14,14,0,0,0,14-14V56A14,14,0,0,0,200,42Zm2,14v66H134V54h66A2,2,0,0,1,202,56ZM56,54h66v68H54V56A2,2,0,0,1,56,54ZM54,200V134h68v68H56A2,2,0,0,1,54,200Zm146,2H134V134h68v66A2,2,0,0,1,200,202Z"}))],["regular",x.createElement(x.Fragment,null,x.createElement("path",{d:"M200,40H56A16,16,0,0,0,40,56V200a16,16,0,0,0,16,16H200a16,16,0,0,0,16-16V56A16,16,0,0,0,200,40Zm0,80H136V56h64ZM120,56v64H56V56ZM56,136h64v64H56Zm144,64H136V136h64v64Z"}))],["thin",x.createElement(x.Fragment,null,x.createElement("path",{d:"M200,44H56A12,12,0,0,0,44,56V200a12,12,0,0,0,12,12H200a12,12,0,0,0,12-12V56A12,12,0,0,0,200,44Zm4,12v68H132V52h68A4,4,0,0,1,204,56ZM56,52h68v72H52V56A4,4,0,0,1,56,52ZM52,200V132h72v72H56A4,4,0,0,1,52,200Zm148,4H132V132h72v68A4,4,0,0,1,200,204Z"}))]]),rRe=new Map([["bold",x.createElement(x.Fragment,null,x.createElement("path",{d:"M144,96a16,16,0,1,1,16,16A16,16,0,0,1,144,96Zm92-40V200a20,20,0,0,1-20,20H40a20,20,0,0,1-20-20V56A20,20,0,0,1,40,36H216A20,20,0,0,1,236,56ZM44,60v79.72l33.86-33.86a20,20,0,0,1,28.28,0L147.31,147l17.18-17.17a20,20,0,0,1,28.28,0L212,149.09V60Zm0,136H162.34L92,125.66l-48,48Zm168,0V183l-33.37-33.37L164.28,164l32,32Z"}))],["duotone",x.createElement(x.Fragment,null,x.createElement("path",{d:"M224,56V178.06l-39.72-39.72a8,8,0,0,0-11.31,0L147.31,164,97.66,114.34a8,8,0,0,0-11.32,0L32,168.69V56a8,8,0,0,1,8-8H216A8,8,0,0,1,224,56Z",opacity:"0.2"}),x.createElement("path",{d:"M216,40H40A16,16,0,0,0,24,56V200a16,16,0,0,0,16,16H216a16,16,0,0,0,16-16V56A16,16,0,0,0,216,40Zm0,16V158.75l-26.07-26.06a16,16,0,0,0-22.63,0l-20,20-44-44a16,16,0,0,0-22.62,0L40,149.37V56ZM40,172l52-52,80,80H40Zm176,28H194.63l-36-36,20-20L216,181.38V200ZM144,100a12,12,0,1,1,12,12A12,12,0,0,1,144,100Z"}))],["fill",x.createElement(x.Fragment,null,x.createElement("path",{d:"M216,40H40A16,16,0,0,0,24,56V200a16,16,0,0,0,16,16H216a16,16,0,0,0,16-16V56A16,16,0,0,0,216,40ZM156,88a12,12,0,1,1-12,12A12,12,0,0,1,156,88Zm60,112H40V160.69l46.34-46.35a8,8,0,0,1,11.32,0h0L165,181.66a8,8,0,0,0,11.32-11.32l-17.66-17.65L173,138.34a8,8,0,0,1,11.31,0L216,170.07V200Z"}))],["light",x.createElement(x.Fragment,null,x.createElement("path",{d:"M216,42H40A14,14,0,0,0,26,56V200a14,14,0,0,0,14,14H216a14,14,0,0,0,14-14V56A14,14,0,0,0,216,42ZM40,54H216a2,2,0,0,1,2,2V163.57L188.53,134.1a14,14,0,0,0-19.8,0l-21.42,21.42L101.9,110.1a14,14,0,0,0-19.8,0L38,154.2V56A2,2,0,0,1,40,54ZM38,200V171.17l52.58-52.58a2,2,0,0,1,2.84,0L176.83,202H40A2,2,0,0,1,38,200Zm178,2H193.8l-38-38,21.41-21.42a2,2,0,0,1,2.83,0l38,38V200A2,2,0,0,1,216,202ZM146,100a10,10,0,1,1,10,10A10,10,0,0,1,146,100Z"}))],["regular",x.createElement(x.Fragment,null,x.createElement("path",{d:"M216,40H40A16,16,0,0,0,24,56V200a16,16,0,0,0,16,16H216a16,16,0,0,0,16-16V56A16,16,0,0,0,216,40Zm0,16V158.75l-26.07-26.06a16,16,0,0,0-22.63,0l-20,20-44-44a16,16,0,0,0-22.62,0L40,149.37V56ZM40,172l52-52,80,80H40Zm176,28H194.63l-36-36,20-20L216,181.38V200ZM144,100a12,12,0,1,1,12,12A12,12,0,0,1,144,100Z"}))],["thin",x.createElement(x.Fragment,null,x.createElement("path",{d:"M216,44H40A12,12,0,0,0,28,56V200a12,12,0,0,0,12,12H216a12,12,0,0,0,12-12V56A12,12,0,0,0,216,44ZM40,52H216a4,4,0,0,1,4,4V168.4l-32.89-32.89a12,12,0,0,0-17,0l-22.83,22.83-46.82-46.83a12,12,0,0,0-17,0L36,159V56A4,4,0,0,1,40,52ZM36,200V170.34l53.17-53.17a4,4,0,0,1,5.66,0L181.66,204H40A4,4,0,0,1,36,200Zm180,4H193l-40-40,22.83-22.83a4,4,0,0,1,5.66,0L220,179.71V200A4,4,0,0,1,216,204ZM148,100a8,8,0,1,1,8,8A8,8,0,0,1,148,100Z"}))]]),iRe=new Map([["bold",x.createElement(x.Fragment,null,x.createElement("path",{d:"M219.71,117.38a12,12,0,0,0-7.25-8.52L161.28,88.39l10.59-70.61a12,12,0,0,0-20.64-10l-112,120a12,12,0,0,0,4.31,19.33l51.18,20.47L84.13,238.22a12,12,0,0,0,20.64,10l112-120A12,12,0,0,0,219.71,117.38ZM113.6,203.55l6.27-41.77a12,12,0,0,0-7.41-12.92L68.74,131.37,142.4,52.45l-6.27,41.77a12,12,0,0,0,7.41,12.92l43.72,17.49Z"}))],["duotone",x.createElement(x.Fragment,null,x.createElement("path",{d:"M96,240l16-80L48,136,160,16,144,96l64,24Z",opacity:"0.2"}),x.createElement("path",{d:"M215.79,118.17a8,8,0,0,0-5-5.66L153.18,90.9l14.66-73.33a8,8,0,0,0-13.69-7l-112,120a8,8,0,0,0,3,13l57.63,21.61L88.16,238.43a8,8,0,0,0,13.69,7l112-120A8,8,0,0,0,215.79,118.17ZM109.37,214l10.47-52.38a8,8,0,0,0-5-9.06L62,132.71l84.62-90.66L136.16,94.43a8,8,0,0,0,5,9.06l52.8,19.8Z"}))],["fill",x.createElement(x.Fragment,null,x.createElement("path",{d:"M213.85,125.46l-112,120a8,8,0,0,1-13.69-7l14.66-73.33L45.19,143.49a8,8,0,0,1-3-13l112-120a8,8,0,0,1,13.69,7L153.18,90.9l57.63,21.61a8,8,0,0,1,3,12.95Z"}))],["light",x.createElement(x.Fragment,null,x.createElement("path",{d:"M213.84,118.63a6,6,0,0,0-3.73-4.25L150.88,92.17l15-75a6,6,0,0,0-10.27-5.27l-112,120a6,6,0,0,0,2.28,9.71l59.23,22.21-15,75a6,6,0,0,0,3.14,6.52A6.07,6.07,0,0,0,96,246a6,6,0,0,0,4.39-1.91l112-120A6,6,0,0,0,213.84,118.63ZM106,220.46l11.85-59.28a6,6,0,0,0-3.77-6.8l-55.6-20.85,91.46-98L138.12,94.82a6,6,0,0,0,3.77,6.8l55.6,20.85Z"}))],["regular",x.createElement(x.Fragment,null,x.createElement("path",{d:"M215.79,118.17a8,8,0,0,0-5-5.66L153.18,90.9l14.66-73.33a8,8,0,0,0-13.69-7l-112,120a8,8,0,0,0,3,13l57.63,21.61L88.16,238.43a8,8,0,0,0,13.69,7l112-120A8,8,0,0,0,215.79,118.17ZM109.37,214l10.47-52.38a8,8,0,0,0-5-9.06L62,132.71l84.62-90.66L136.16,94.43a8,8,0,0,0,5,9.06l52.8,19.8Z"}))],["thin",x.createElement(x.Fragment,null,x.createElement("path",{d:"M211.89,119.09a4,4,0,0,0-2.49-2.84l-60.81-22.8,15.33-76.67a4,4,0,0,0-6.84-3.51l-112,120a4,4,0,0,0-1,3.64,4,4,0,0,0,2.49,2.84l60.81,22.8L92.08,239.22a4,4,0,0,0,6.84,3.51l112-120A4,4,0,0,0,211.89,119.09ZM102.68,227l13.24-66.2a4,4,0,0,0-2.52-4.53L55,134.36,153.32,29l-13.24,66.2a4,4,0,0,0,2.52,4.53L201,121.64Z"}))]]),sRe=new Map([["bold",x.createElement(x.Fragment,null,x.createElement("path",{d:"M209.84,47.44A91.42,91.42,0,0,0,144.62,20h-.35A91.44,91.44,0,0,0,79.15,47L17.76,109.17a20,20,0,0,0,.08,28.21L46.5,166a19.89,19.89,0,0,0,14.15,5.86h.11a19.86,19.86,0,0,0,14.2-6l60.87-62.39a12.07,12.07,0,0,1,16.77-.12,11.63,11.63,0,0,1,3.5,8.35,12.85,12.85,0,0,1-3.66,9.11L90.19,181a20,20,0,0,0-.21,28.5l28.66,28.66a20.08,20.08,0,0,0,28.15.14l61.76-60.44.09-.09C244.65,141.78,245.18,83.31,209.84,47.44ZM60.62,146.21l-23-23L55.81,104.8l22.88,22.88Zm72.2,72.18-23-23,18.61-18,22.88,22.87Zm58.89-57.62L168.48,183.5,145.7,160.73,169.21,138l.15-.14a37,37,0,0,0,10.74-26.37,35.44,35.44,0,0,0-10.85-25.41,36.2,36.2,0,0,0-50.44.48l-.1.11L95.46,110.49,72.68,87.72l23.5-23.8A67.55,67.55,0,0,1,144.27,44h.26a67.62,67.62,0,0,1,48.21,20.29C218.85,90.78,218.38,134.05,191.71,160.77Z"}))],["duotone",x.createElement(x.Fragment,null,x.createElement("path",{d:"M168.36,200.36l-30,29.35a8,8,0,0,1-11.26-.05L98.46,201a8,8,0,0,1,.08-11.4l30-29Zm-142-82.76a8,8,0,0,0,0,11.28L55,157.54a8,8,0,0,0,11.38-.06l29.18-29.92L55.77,87.77Z",opacity:"0.2"}),x.createElement("path",{d:"M207,50.25A87.46,87.46,0,0,0,144.6,24h-.33A87.48,87.48,0,0,0,82,49.81L50.11,82.11h0L20.61,112a16,16,0,0,0,.06,22.56l28.66,28.66a15.92,15.92,0,0,0,11.32,4.69h.09a16,16,0,0,0,11.36-4.82L133,100.69a16.08,16.08,0,0,1,22.41-.21,15.6,15.6,0,0,1,4.73,11.19,16.89,16.89,0,0,1-4.85,12L93,183.88a16,16,0,0,0-.17,22.79l28.66,28.66a16.06,16.06,0,0,0,22.52.12L205.81,175C240.26,140.5,240.79,84.56,207,50.25ZM60.65,151.89,32,123.24,55.8,99.12l28.52,28.52ZM132.79,224l-28.68-28.65,24.38-23.57L157,200.32Zm61.76-60.44-26.11,25.54L140,160.68l26.44-25.57.1-.09a33,33,0,0,0,9.57-23.5A31.44,31.44,0,0,0,166.47,89a32.2,32.2,0,0,0-44.9.5L95.49,116.18,67,87.74,93.35,61.09A71.51,71.51,0,0,1,144.27,40h.27a71.55,71.55,0,0,1,51.05,21.48C223.25,89.55,222.75,135.38,194.55,163.58Z"}))],["fill",x.createElement(x.Fragment,null,x.createElement("path",{d:"M207,50.25A87.46,87.46,0,0,0,144.6,24h-.33A87.48,87.48,0,0,0,82,49.81L20.61,112a16,16,0,0,0,.06,22.56l28.66,28.66a15.92,15.92,0,0,0,11.32,4.69h.09a16,16,0,0,0,11.36-4.82L133,100.69a16.08,16.08,0,0,1,22.41-.21,15.6,15.6,0,0,1,4.73,11.19,16.89,16.89,0,0,1-4.85,12L93,183.88a16,16,0,0,0-.17,22.79l28.66,28.66a16.06,16.06,0,0,0,22.52.12L205.81,175C240.26,140.5,240.79,84.56,207,50.25ZM60.65,151.89,32,123.24,61.42,93.43,89.9,121.91ZM132.79,224l-28.68-28.65,30.13-29.13,28.49,28.48Z"}))],["light",x.createElement(x.Fragment,null,x.createElement("path",{d:"M205.56,51.65A85.5,85.5,0,0,0,144.6,26h-.33A85.45,85.45,0,0,0,83.42,51.22L22,113.39a14,14,0,0,0,.06,19.74l28.66,28.66a13.89,13.89,0,0,0,9.9,4.1h.08a13.9,13.9,0,0,0,9.94-4.21l60.87-62.4A18.1,18.1,0,0,1,156.76,99a17.63,17.63,0,0,1,5.34,12.62,19,19,0,0,1-5.44,13.44L94.37,185.31a14,14,0,0,0-.15,19.95l28.67,28.66a14.05,14.05,0,0,0,19.7.1l61.8-60.49C238.07,139.86,238.6,85.18,205.56,51.65ZM62.08,153.29a2,2,0,0,1-1.42.6,2.15,2.15,0,0,1-1.42-.58L30.57,124.65a2,2,0,0,1,0-2.82L55.79,96.28l31.34,31.34Zm72.11,72.15a2,2,0,0,1-2.82,0l-28.66-28.66a2,2,0,0,1-.59-1.43,2,2,0,0,1,.6-1.41L128.51,169l31.34,31.33ZM196,165l-27.52,26.94-31.29-31.29,27.9-27,.07-.08a30.93,30.93,0,0,0,9-22.06,29.47,29.47,0,0,0-9-21.15,30.17,30.17,0,0,0-42.08.46L95.51,119,64.22,87.74,91.94,59.68A73.47,73.47,0,0,1,144.27,38h.28A73.52,73.52,0,0,1,197,60.08C225.44,88.92,224.94,136,196,165Z"}))],["regular",x.createElement(x.Fragment,null,x.createElement("path",{d:"M207,50.25A87.46,87.46,0,0,0,144.6,24h-.33A87.48,87.48,0,0,0,82,49.81L20.61,112a16,16,0,0,0,.06,22.56l28.66,28.66a15.92,15.92,0,0,0,11.32,4.69h.09a16,16,0,0,0,11.36-4.82L133,100.69a16.08,16.08,0,0,1,22.41-.21,15.6,15.6,0,0,1,4.73,11.19,16.89,16.89,0,0,1-4.85,12L93,183.88a16,16,0,0,0-.17,22.79l28.66,28.66a16.06,16.06,0,0,0,22.52.12L205.81,175C240.26,140.5,240.79,84.56,207,50.25ZM60.65,151.89,32,123.24,55.8,99.12l28.52,28.52ZM132.79,224l-28.68-28.65,24.38-23.57L157,200.32Zm61.76-60.44-26.11,25.54L140,160.68l26.44-25.57.1-.09a33,33,0,0,0,9.57-23.5A31.44,31.44,0,0,0,166.47,89a32.2,32.2,0,0,0-44.9.5L95.49,116.18,67,87.74,93.35,61.09A71.51,71.51,0,0,1,144.27,40h.27a71.55,71.55,0,0,1,51.05,21.48C223.25,89.55,222.75,135.38,194.55,163.58Z"}))],["thin",x.createElement(x.Fragment,null,x.createElement("path",{d:"M204.13,53.06A83.41,83.41,0,0,0,144.59,28h-.32A83.46,83.46,0,0,0,84.85,52.62L23.46,114.8a12,12,0,0,0,0,16.92l28.67,28.66a11.89,11.89,0,0,0,8.48,3.51h.07a12,12,0,0,0,8.52-3.61l60.89-62.42a20.1,20.1,0,0,1,28-.27,19.54,19.54,0,0,1,6,14,20.87,20.87,0,0,1-6,14.86L95.76,186.75a12,12,0,0,0-.12,17.09L124.3,232.5a12,12,0,0,0,16.89.08L203,172.12C235.88,139.21,236.4,85.8,204.13,53.06ZM63.51,154.69a3.93,3.93,0,0,1-2.83,1.2h0a4,4,0,0,1-2.83-1.17L29.16,126.06a4,4,0,0,1,0-5.64l26.63-27L89.94,127.6Zm72.08,72.18a4,4,0,0,1-5.63,0l-28.67-28.66a4,4,0,0,1,0-5.69l27.2-26.3,34.16,34.15Zm61.76-60.44-28.94,28.32-34.12-34.12,29.41-28.44a29,29,0,0,0,8.4-20.64,27.51,27.51,0,0,0-8.41-19.72,28.14,28.14,0,0,0-39.25.41L95.53,121.87,61.4,87.75,90.52,58.26A75.51,75.51,0,0,1,144.27,36h.29a75.53,75.53,0,0,1,53.87,22.67C227.63,88.3,227.13,136.65,197.35,166.43Z"}))]]),aRe=new Map([["bold",x.createElement(x.Fragment,null,x.createElement("path",{d:"M200,36H160a20,20,0,0,0-20,20v88a12,12,0,0,1-24,0V56A20,20,0,0,0,96,36H56A20,20,0,0,0,36,56v88a92,92,0,0,0,92,92h.71c50.34-.38,91.3-42.1,91.3-93V56A20,20,0,0,0,200,36Zm-4,24V84H164V60ZM92,60V84H60V60Zm36.52,152H128a68,68,0,0,1-68-68V108H92v36a36,36,0,0,0,72,0V108h32v35C196,180.77,165.73,211.72,128.52,212Z"}))],["duotone",x.createElement(x.Fragment,null,x.createElement("path",{d:"M104,56V96H48V56a8,8,0,0,1,8-8H96A8,8,0,0,1,104,56Zm96-8H160a8,8,0,0,0-8,8V96h56V56A8,8,0,0,0,200,48Z",opacity:"0.2"}),x.createElement("path",{d:"M200,40H160a16,16,0,0,0-16,16v88a16,16,0,0,1-32,0V56A16,16,0,0,0,96,40H56A16,16,0,0,0,40,56v88a88,88,0,0,0,88,88h.67c48.15-.36,87.33-40.29,87.33-89V56A16,16,0,0,0,200,40Zm0,16V88H160V56ZM96,56V88H56V56Zm32.55,160A72,72,0,0,1,56,144V104H96v40a32,32,0,0,0,64,0V104h40v39C200,183,168,215.71,128.55,216Z"}))],["fill",x.createElement(x.Fragment,null,x.createElement("path",{d:"M200,40H160a16,16,0,0,0-16,16v88a16,16,0,0,1-32,0V56A16,16,0,0,0,96,40H56A16,16,0,0,0,40,56v88a88,88,0,0,0,88,88h.67c48.15-.36,87.33-40.29,87.33-89V56A16,16,0,0,0,200,40Zm0,16V96H160V56ZM96,56V96H56V56Z"}))],["light",x.createElement(x.Fragment,null,x.createElement("path",{d:"M200,42H160a14,14,0,0,0-14,14v88a18,18,0,0,1-36,0V56A14,14,0,0,0,96,42H56A14,14,0,0,0,42,56v88a86,86,0,0,0,86,86h.65c47.06-.35,85.35-39.38,85.35-87V56A14,14,0,0,0,200,42ZM160,54h40a2,2,0,0,1,2,2V90H158V56A2,2,0,0,1,160,54ZM56,54H96a2,2,0,0,1,2,2V90H54V56A2,2,0,0,1,56,54Zm72.56,164H128a74,74,0,0,1-74-74V102H98v42a30,30,0,0,0,60,0V102h44v41C202,184.05,169.06,217.7,128.56,218Z"}))],["regular",x.createElement(x.Fragment,null,x.createElement("path",{d:"M200,40H160a16,16,0,0,0-16,16v88a16,16,0,0,1-32,0V56A16,16,0,0,0,96,40H56A16,16,0,0,0,40,56v88a88,88,0,0,0,88,88h.67c48.15-.36,87.33-40.29,87.33-89V56A16,16,0,0,0,200,40Zm0,16V88H160V56ZM96,56V88H56V56Zm32.55,160A72,72,0,0,1,56,144V104H96v40a32,32,0,0,0,64,0V104h40v39C200,183,168,215.71,128.55,216Z"}))],["thin",x.createElement(x.Fragment,null,x.createElement("path",{d:"M200,44H160a12,12,0,0,0-12,12v88a20,20,0,0,1-40,0V56A12,12,0,0,0,96,44H56A12,12,0,0,0,44,56v88a84,84,0,0,0,84,84h.64c46-.34,83.36-38.47,83.36-85V56A12,12,0,0,0,200,44Zm-40,8h40a4,4,0,0,1,4,4V92H156V56A4,4,0,0,1,160,52ZM56,52H96a4,4,0,0,1,4,4V92H52V56A4,4,0,0,1,56,52Zm72.58,168H128a76,76,0,0,1-76-76V100h48v44a28,28,0,0,0,56,0V100h48v43C204,185.15,170.17,219.69,128.58,220Z"}))]]),oRe=new Map([["bold",x.createElement(x.Fragment,null,x.createElement("path",{d:"M156,112a12,12,0,0,1-12,12H80a12,12,0,0,1,0-24h64A12,12,0,0,1,156,112Zm76.49,120.49a12,12,0,0,1-17,0L168,185a92.12,92.12,0,1,1,17-17l47.54,47.53A12,12,0,0,1,232.49,232.49ZM112,180a68,68,0,1,0-68-68A68.08,68.08,0,0,0,112,180Z"}))],["duotone",x.createElement(x.Fragment,null,x.createElement("path",{d:"M192,112a80,80,0,1,1-80-80A80,80,0,0,1,192,112Z",opacity:"0.2"}),x.createElement("path",{d:"M229.66,218.34,179.6,168.28a88.21,88.21,0,1,0-11.32,11.31l50.06,50.07a8,8,0,0,0,11.32-11.32ZM40,112a72,72,0,1,1,72,72A72.08,72.08,0,0,1,40,112Zm112,0a8,8,0,0,1-8,8H80a8,8,0,0,1,0-16h64A8,8,0,0,1,152,112Z"}))],["fill",x.createElement(x.Fragment,null,x.createElement("path",{d:"M229.66,218.34,179.6,168.28a88.21,88.21,0,1,0-11.32,11.31l50.06,50.07a8,8,0,0,0,11.32-11.32ZM144,120H80a8,8,0,0,1,0-16h64a8,8,0,0,1,0,16Z"}))],["light",x.createElement(x.Fragment,null,x.createElement("path",{d:"M150,112a6,6,0,0,1-6,6H80a6,6,0,0,1,0-12h64A6,6,0,0,1,150,112Zm78.24,116.24a6,6,0,0,1-8.48,0l-51.38-51.38a86.15,86.15,0,1,1,8.48-8.48l51.38,51.38A6,6,0,0,1,228.24,228.24ZM112,186a74,74,0,1,0-74-74A74.09,74.09,0,0,0,112,186Z"}))],["regular",x.createElement(x.Fragment,null,x.createElement("path",{d:"M152,112a8,8,0,0,1-8,8H80a8,8,0,0,1,0-16h64A8,8,0,0,1,152,112Zm77.66,117.66a8,8,0,0,1-11.32,0l-50.06-50.07a88.11,88.11,0,1,1,11.31-11.31l50.07,50.06A8,8,0,0,1,229.66,229.66ZM112,184a72,72,0,1,0-72-72A72.08,72.08,0,0,0,112,184Z"}))],["thin",x.createElement(x.Fragment,null,x.createElement("path",{d:"M148,112a4,4,0,0,1-4,4H80a4,4,0,0,1,0-8h64A4,4,0,0,1,148,112Zm78.83,114.83a4,4,0,0,1-5.66,0l-52.7-52.7a84.1,84.1,0,1,1,5.66-5.66l52.7,52.7A4,4,0,0,1,226.83,226.83ZM112,188a76,76,0,1,0-76-76A76.08,76.08,0,0,0,112,188Z"}))]]),lRe=new Map([["bold",x.createElement(x.Fragment,null,x.createElement("path",{d:"M156,112a12,12,0,0,1-12,12H124v20a12,12,0,0,1-24,0V124H80a12,12,0,0,1,0-24h20V80a12,12,0,0,1,24,0v20h20A12,12,0,0,1,156,112Zm76.49,120.49a12,12,0,0,1-17,0L168,185a92.12,92.12,0,1,1,17-17l47.54,47.53A12,12,0,0,1,232.49,232.49ZM112,180a68,68,0,1,0-68-68A68.08,68.08,0,0,0,112,180Z"}))],["duotone",x.createElement(x.Fragment,null,x.createElement("path",{d:"M192,112a80,80,0,1,1-80-80A80,80,0,0,1,192,112Z",opacity:"0.2"}),x.createElement("path",{d:"M229.66,218.34,179.6,168.28a88.21,88.21,0,1,0-11.32,11.31l50.06,50.07a8,8,0,0,0,11.32-11.32ZM40,112a72,72,0,1,1,72,72A72.08,72.08,0,0,1,40,112Zm112,0a8,8,0,0,1-8,8H120v24a8,8,0,0,1-16,0V120H80a8,8,0,0,1,0-16h24V80a8,8,0,0,1,16,0v24h24A8,8,0,0,1,152,112Z"}))],["fill",x.createElement(x.Fragment,null,x.createElement("path",{d:"M229.66,218.34,179.6,168.28a88.21,88.21,0,1,0-11.32,11.31l50.06,50.07a8,8,0,0,0,11.32-11.32ZM144,120H120v24a8,8,0,0,1-16,0V120H80a8,8,0,0,1,0-16h24V80a8,8,0,0,1,16,0v24h24a8,8,0,0,1,0,16Z"}))],["light",x.createElement(x.Fragment,null,x.createElement("path",{d:"M150,112a6,6,0,0,1-6,6H118v26a6,6,0,0,1-12,0V118H80a6,6,0,0,1,0-12h26V80a6,6,0,0,1,12,0v26h26A6,6,0,0,1,150,112Zm78.24,116.24a6,6,0,0,1-8.48,0l-51.38-51.38a86.15,86.15,0,1,1,8.48-8.48l51.38,51.38A6,6,0,0,1,228.24,228.24ZM112,186a74,74,0,1,0-74-74A74.09,74.09,0,0,0,112,186Z"}))],["regular",x.createElement(x.Fragment,null,x.createElement("path",{d:"M152,112a8,8,0,0,1-8,8H120v24a8,8,0,0,1-16,0V120H80a8,8,0,0,1,0-16h24V80a8,8,0,0,1,16,0v24h24A8,8,0,0,1,152,112Zm77.66,117.66a8,8,0,0,1-11.32,0l-50.06-50.07a88.11,88.11,0,1,1,11.31-11.31l50.07,50.06A8,8,0,0,1,229.66,229.66ZM112,184a72,72,0,1,0-72-72A72.08,72.08,0,0,0,112,184Z"}))],["thin",x.createElement(x.Fragment,null,x.createElement("path",{d:"M148,112a4,4,0,0,1-4,4H116v28a4,4,0,0,1-8,0V116H80a4,4,0,0,1,0-8h28V80a4,4,0,0,1,8,0v28h28A4,4,0,0,1,148,112Zm78.83,114.83a4,4,0,0,1-5.66,0l-52.7-52.7a84.1,84.1,0,1,1,5.66-5.66l52.7,52.7A4,4,0,0,1,226.83,226.83ZM112,188a76,76,0,1,0-76-76A76.08,76.08,0,0,0,112,188Z"}))]]),cRe=new Map([["bold",x.createElement(x.Fragment,null,x.createElement("path",{d:"M228,128a12,12,0,0,1-12,12H40a12,12,0,0,1,0-24H216A12,12,0,0,1,228,128Z"}))],["duotone",x.createElement(x.Fragment,null,x.createElement("path",{d:"M216,56V200a16,16,0,0,1-16,16H56a16,16,0,0,1-16-16V56A16,16,0,0,1,56,40H200A16,16,0,0,1,216,56Z",opacity:"0.2"}),x.createElement("path",{d:"M224,128a8,8,0,0,1-8,8H40a8,8,0,0,1,0-16H216A8,8,0,0,1,224,128Z"}))],["fill",x.createElement(x.Fragment,null,x.createElement("path",{d:"M208,32H48A16,16,0,0,0,32,48V208a16,16,0,0,0,16,16H208a16,16,0,0,0,16-16V48A16,16,0,0,0,208,32ZM184,136H72a8,8,0,0,1,0-16H184a8,8,0,0,1,0,16Z"}))],["light",x.createElement(x.Fragment,null,x.createElement("path",{d:"M222,128a6,6,0,0,1-6,6H40a6,6,0,0,1,0-12H216A6,6,0,0,1,222,128Z"}))],["regular",x.createElement(x.Fragment,null,x.createElement("path",{d:"M224,128a8,8,0,0,1-8,8H40a8,8,0,0,1,0-16H216A8,8,0,0,1,224,128Z"}))],["thin",x.createElement(x.Fragment,null,x.createElement("path",{d:"M220,128a4,4,0,0,1-4,4H40a4,4,0,0,1,0-8H216A4,4,0,0,1,220,128Z"}))]]),uRe=new Map([["bold",x.createElement(x.Fragment,null,x.createElement("path",{d:"M211.45,52.51l-80-24A12,12,0,0,0,116,40V140.22A52,52,0,1,0,140,184V104.13l64.55,19.36A12,12,0,0,0,220,112V64A12,12,0,0,0,211.45,52.51ZM88,212a28,28,0,1,1,28-28A28,28,0,0,1,88,212ZM196,95.87l-56-16.8V56.13l56,16.8Z"}))],["duotone",x.createElement(x.Fragment,null,x.createElement("path",{d:"M128,184a40,40,0,1,1-40-40A40,40,0,0,1,128,184Z",opacity:"0.2"}),x.createElement("path",{d:"M210.3,56.34l-80-24A8,8,0,0,0,120,40V148.26A48,48,0,1,0,136,184V98.75l69.7,20.91A8,8,0,0,0,216,112V64A8,8,0,0,0,210.3,56.34ZM88,216a32,32,0,1,1,32-32A32,32,0,0,1,88,216ZM200,101.25l-64-19.2V50.75L200,70Z"}))],["fill",x.createElement(x.Fragment,null,x.createElement("path",{d:"M210.3,56.34l-80-24A8,8,0,0,0,120,40V148.26A48,48,0,1,0,136,184V98.75l69.7,20.91A8,8,0,0,0,216,112V64A8,8,0,0,0,210.3,56.34Z"}))],["light",x.createElement(x.Fragment,null,x.createElement("path",{d:"M209.72,58.25l-80-24A6,6,0,0,0,122,40V153.05A46,46,0,1,0,134,184V96.06l72.28,21.69A6,6,0,0,0,214,112V64A6,6,0,0,0,209.72,58.25ZM88,218a34,34,0,1,1,34-34A34,34,0,0,1,88,218ZM202,103.94l-68-20.4V48.06l68,20.4Z"}))],["regular",x.createElement(x.Fragment,null,x.createElement("path",{d:"M210.3,56.34l-80-24A8,8,0,0,0,120,40V148.26A48,48,0,1,0,136,184V98.75l69.7,20.91A8,8,0,0,0,216,112V64A8,8,0,0,0,210.3,56.34ZM88,216a32,32,0,1,1,32-32A32,32,0,0,1,88,216ZM200,101.25l-64-19.2V50.75L200,70Z"}))],["thin",x.createElement(x.Fragment,null,x.createElement("path",{d:"M209.15,60.17l-80-24A4,4,0,0,0,124,40V158.75A44,44,0,1,0,132,184V93.38l74.85,22.45A4,4,0,0,0,212,112V64A4,4,0,0,0,209.15,60.17ZM88,220a36,36,0,1,1,36-36A36,36,0,0,1,88,220ZM204,106.62,132,85V45.38L204,67Z"}))]]),fRe=new Map([["bold",x.createElement(x.Fragment,null,x.createElement("path",{d:"M203.57,51A107.9,107.9,0,0,0,20,128c0,44.72,27.6,82.25,72,97.94A36,36,0,0,0,140,192a12,12,0,0,1,12-12h46.21a35.79,35.79,0,0,0,35.1-28A108.6,108.6,0,0,0,236,127.09,107.23,107.23,0,0,0,203.57,51Zm6.34,95.67a11.91,11.91,0,0,1-11.7,9.3H152a36,36,0,0,0-36,36,12,12,0,0,1-16,11.3c-16.65-5.88-30.65-15.76-40.48-28.56A76,76,0,0,1,44,128a84,84,0,0,1,83.13-84H128a84.35,84.35,0,0,1,84,83.29A84.72,84.72,0,0,1,209.91,146.71ZM144,76a16,16,0,1,1-16-16A16,16,0,0,1,144,76Zm-44,24A16,16,0,1,1,84,84,16,16,0,0,1,100,100Zm0,56a16,16,0,1,1-16-16A16,16,0,0,1,100,156Zm88-56a16,16,0,1,1-16-16A16,16,0,0,1,188,100Z"}))],["duotone",x.createElement(x.Fragment,null,x.createElement("path",{d:"M224,127.17a96.48,96.48,0,0,1-2.39,22.18A24,24,0,0,1,198.21,168H152a24,24,0,0,0-24,24,24,24,0,0,1-32,22.61C58.73,201.44,32,169.81,32,128a96,96,0,0,1,95-96C179.84,31.47,223.55,74.35,224,127.17Z",opacity:"0.2"}),x.createElement("path",{d:"M200.77,53.89A103.27,103.27,0,0,0,128,24h-1.07A104,104,0,0,0,24,128c0,43,26.58,79.06,69.36,94.17A32,32,0,0,0,136,192a16,16,0,0,1,16-16h46.21a31.81,31.81,0,0,0,31.2-24.88,104.43,104.43,0,0,0,2.59-24A103.28,103.28,0,0,0,200.77,53.89Zm13,93.71A15.89,15.89,0,0,1,198.21,160H152a32,32,0,0,0-32,32,16,16,0,0,1-21.31,15.07C62.49,194.3,40,164,40,128a88,88,0,0,1,87.09-88h.9a88.35,88.35,0,0,1,88,87.25A88.86,88.86,0,0,1,213.81,147.6ZM140,76a12,12,0,1,1-12-12A12,12,0,0,1,140,76ZM96,100A12,12,0,1,1,84,88,12,12,0,0,1,96,100Zm0,56a12,12,0,1,1-12-12A12,12,0,0,1,96,156Zm88-56a12,12,0,1,1-12-12A12,12,0,0,1,184,100Z"}))],["fill",x.createElement(x.Fragment,null,x.createElement("path",{d:"M200.77,53.89A103.27,103.27,0,0,0,128,24h-1.07A104,104,0,0,0,24,128c0,43,26.58,79.06,69.36,94.17A32,32,0,0,0,136,192a16,16,0,0,1,16-16h46.21a31.81,31.81,0,0,0,31.2-24.88,104.43,104.43,0,0,0,2.59-24A103.28,103.28,0,0,0,200.77,53.89ZM84,168a12,12,0,1,1,12-12A12,12,0,0,1,84,168Zm0-56a12,12,0,1,1,12-12A12,12,0,0,1,84,112Zm44-24a12,12,0,1,1,12-12A12,12,0,0,1,128,88Zm44,24a12,12,0,1,1,12-12A12,12,0,0,1,172,112Z"}))],["light",x.createElement(x.Fragment,null,x.createElement("path",{d:"M199.37,55.31A101.32,101.32,0,0,0,128,26h-1A102,102,0,0,0,26,128c0,42.09,26.07,77.44,68,92.26A30.21,30.21,0,0,0,104.11,222,30.06,30.06,0,0,0,134,192a18,18,0,0,1,18-18h46.21a29.82,29.82,0,0,0,29.25-23.31A102.71,102.71,0,0,0,230,127.11,101.25,101.25,0,0,0,199.37,55.31ZM215.76,148a17.89,17.89,0,0,1-17.55,14H152a30,30,0,0,0-30,30,18,18,0,0,1-24,17C61,195.86,38,164.85,38,128a90,90,0,0,1,89.07-90H128a90.34,90.34,0,0,1,90,89.22A90.46,90.46,0,0,1,215.76,148ZM138,76a10,10,0,1,1-10-10A10,10,0,0,1,138,76ZM94,100A10,10,0,1,1,84,90,10,10,0,0,1,94,100Zm0,56a10,10,0,1,1-10-10A10,10,0,0,1,94,156Zm88-56a10,10,0,1,1-10-10A10,10,0,0,1,182,100Z"}))],["regular",x.createElement(x.Fragment,null,x.createElement("path",{d:"M200.77,53.89A103.27,103.27,0,0,0,128,24h-1.07A104,104,0,0,0,24,128c0,43,26.58,79.06,69.36,94.17A32,32,0,0,0,136,192a16,16,0,0,1,16-16h46.21a31.81,31.81,0,0,0,31.2-24.88,104.43,104.43,0,0,0,2.59-24A103.28,103.28,0,0,0,200.77,53.89Zm13,93.71A15.89,15.89,0,0,1,198.21,160H152a32,32,0,0,0-32,32,16,16,0,0,1-21.31,15.07C62.49,194.3,40,164,40,128a88,88,0,0,1,87.09-88h.9a88.35,88.35,0,0,1,88,87.25A88.86,88.86,0,0,1,213.81,147.6ZM140,76a12,12,0,1,1-12-12A12,12,0,0,1,140,76ZM96,100A12,12,0,1,1,84,88,12,12,0,0,1,96,100Zm0,56a12,12,0,1,1-12-12A12,12,0,0,1,96,156Zm88-56a12,12,0,1,1-12-12A12,12,0,0,1,184,100Z"}))],["thin",x.createElement(x.Fragment,null,x.createElement("path",{d:"M198,56.74A99.31,99.31,0,0,0,128,28h-1A100,100,0,0,0,28,128c0,41.22,25.55,75.85,66.69,90.38a28.34,28.34,0,0,0,9.42,1.63A28,28,0,0,0,132,192a20,20,0,0,1,20-20h46.21a27.84,27.84,0,0,0,27.3-21.76,100.37,100.37,0,0,0,2.49-23.1A99.26,99.26,0,0,0,198,56.74Zm19.74,91.72A19.89,19.89,0,0,1,198.21,164H152a28,28,0,0,0-28,28,20,20,0,0,1-26.64,18.83C59.51,197.46,36,165.72,36,128a92,92,0,0,1,91.05-92H128a92,92,0,0,1,89.72,112.46ZM136,76a8,8,0,1,1-8-8A8,8,0,0,1,136,76ZM92,100a8,8,0,1,1-8-8A8,8,0,0,1,92,100Zm0,56a8,8,0,1,1-8-8A8,8,0,0,1,92,156Zm88-56a8,8,0,1,1-8-8A8,8,0,0,1,180,100Z"}))]]),hRe=new Map([["bold",x.createElement(x.Fragment,null,x.createElement("path",{d:"M200,164a36.07,36.07,0,0,0-33.94,24H72a28,28,0,0,1,0-56h96a44,44,0,0,0,0-88H72a12,12,0,0,0,0,24h96a20,20,0,0,1,0,40H72a52,52,0,0,0,0,104h94.06A36,36,0,1,0,200,164Zm0,48a12,12,0,1,1,12-12A12,12,0,0,1,200,212Z"}))],["duotone",x.createElement(x.Fragment,null,x.createElement("path",{d:"M224,200a24,24,0,1,1-24-24A24,24,0,0,1,224,200Z",opacity:"0.2"}),x.createElement("path",{d:"M200,168a32.06,32.06,0,0,0-31,24H72a32,32,0,0,1,0-64h96a40,40,0,0,0,0-80H72a8,8,0,0,0,0,16h96a24,24,0,0,1,0,48H72a48,48,0,0,0,0,96h97a32,32,0,1,0,31-40Zm0,48a16,16,0,1,1,16-16A16,16,0,0,1,200,216Z"}))],["fill",x.createElement(x.Fragment,null,x.createElement("path",{d:"M228,200a28,28,0,0,1-54.83,8H72a48,48,0,0,1,0-96h96a24,24,0,0,0,0-48H72a8,8,0,0,1,0-16h96a40,40,0,0,1,0,80H72a32,32,0,0,0,0,64H173.17A28,28,0,0,1,228,200Z"}))],["light",x.createElement(x.Fragment,null,x.createElement("path",{d:"M200,170a30.05,30.05,0,0,0-29.4,24H72a34,34,0,0,1,0-68h96a38,38,0,0,0,0-76H72a6,6,0,0,0,0,12h96a26,26,0,0,1,0,52H72a46,46,0,0,0,0,92h98.6A30,30,0,1,0,200,170Zm0,48a18,18,0,1,1,18-18A18,18,0,0,1,200,218Z"}))],["regular",x.createElement(x.Fragment,null,x.createElement("path",{d:"M200,168a32.06,32.06,0,0,0-31,24H72a32,32,0,0,1,0-64h96a40,40,0,0,0,0-80H72a8,8,0,0,0,0,16h96a24,24,0,0,1,0,48H72a48,48,0,0,0,0,96h97a32,32,0,1,0,31-40Zm0,48a16,16,0,1,1,16-16A16,16,0,0,1,200,216Z"}))],["thin",x.createElement(x.Fragment,null,x.createElement("path",{d:"M200,172a28,28,0,0,0-27.71,24H72a36,36,0,0,1,0-72h96a36,36,0,0,0,0-72H72a4,4,0,0,0,0,8h96a28,28,0,0,1,0,56H72a44,44,0,0,0,0,88H172.29A28,28,0,1,0,200,172Zm0,48a20,20,0,1,1,20-20A20,20,0,0,1,200,220Z"}))]]),dRe=new Map([["bold",x.createElement(x.Fragment,null,x.createElement("path",{d:"M230.14,70.54,185.46,25.85a20,20,0,0,0-28.29,0L33.86,149.17A19.85,19.85,0,0,0,28,163.31V208a20,20,0,0,0,20,20H92.69a19.86,19.86,0,0,0,14.14-5.86L230.14,98.82a20,20,0,0,0,0-28.28ZM91,204H52V165l84-84,39,39ZM192,103,153,64l18.34-18.34,39,39Z"}))],["duotone",x.createElement(x.Fragment,null,x.createElement("path",{d:"M221.66,90.34,192,120,136,64l29.66-29.66a8,8,0,0,1,11.31,0L221.66,79A8,8,0,0,1,221.66,90.34Z",opacity:"0.2"}),x.createElement("path",{d:"M227.31,73.37,182.63,28.68a16,16,0,0,0-22.63,0L36.69,152A15.86,15.86,0,0,0,32,163.31V208a16,16,0,0,0,16,16H92.69A15.86,15.86,0,0,0,104,219.31L227.31,96a16,16,0,0,0,0-22.63ZM92.69,208H48V163.31l88-88L180.69,120ZM192,108.68,147.31,64l24-24L216,84.68Z"}))],["fill",x.createElement(x.Fragment,null,x.createElement("path",{d:"M227.31,73.37,182.63,28.68a16,16,0,0,0-22.63,0L36.69,152A15.86,15.86,0,0,0,32,163.31V208a16,16,0,0,0,16,16H92.69A15.86,15.86,0,0,0,104,219.31L227.31,96a16,16,0,0,0,0-22.63ZM192,108.68,147.31,64l24-24L216,84.68Z"}))],["light",x.createElement(x.Fragment,null,x.createElement("path",{d:"M225.9,74.78,181.21,30.09a14,14,0,0,0-19.8,0L38.1,153.41a13.94,13.94,0,0,0-4.1,9.9V208a14,14,0,0,0,14,14H92.69a13.94,13.94,0,0,0,9.9-4.1L225.9,94.58a14,14,0,0,0,0-19.8ZM94.1,209.41a2,2,0,0,1-1.41.59H48a2,2,0,0,1-2-2V163.31a2,2,0,0,1,.59-1.41L136,72.48,183.51,120ZM217.41,86.1,192,111.51,144.49,64,169.9,38.58a2,2,0,0,1,2.83,0l44.68,44.69a2,2,0,0,1,0,2.83Z"}))],["regular",x.createElement(x.Fragment,null,x.createElement("path",{d:"M227.31,73.37,182.63,28.68a16,16,0,0,0-22.63,0L36.69,152A15.86,15.86,0,0,0,32,163.31V208a16,16,0,0,0,16,16H92.69A15.86,15.86,0,0,0,104,219.31L227.31,96a16,16,0,0,0,0-22.63ZM92.69,208H48V163.31l88-88L180.69,120ZM192,108.68,147.31,64l24-24L216,84.68Z"}))],["thin",x.createElement(x.Fragment,null,x.createElement("path",{d:"M224.49,76.2,179.8,31.51a12,12,0,0,0-17,0L133.17,61.17h0L39.52,154.83A11.9,11.9,0,0,0,36,163.31V208a12,12,0,0,0,12,12H92.69a12,12,0,0,0,8.48-3.51L224.48,93.17a12,12,0,0,0,0-17Zm-129,134.63A4,4,0,0,1,92.69,212H48a4,4,0,0,1-4-4V163.31a4,4,0,0,1,1.17-2.83L136,69.65,186.34,120ZM218.83,87.51,192,114.34,141.66,64l26.82-26.83a4,4,0,0,1,5.66,0l44.69,44.68a4,4,0,0,1,0,5.66Z"}))]]),pRe=new Map([["bold",x.createElement(x.Fragment,null,x.createElement("path",{d:"M228,128a12,12,0,0,1-12,12H140v76a12,12,0,0,1-24,0V140H40a12,12,0,0,1,0-24h76V40a12,12,0,0,1,24,0v76h76A12,12,0,0,1,228,128Z"}))],["duotone",x.createElement(x.Fragment,null,x.createElement("path",{d:"M216,56V200a16,16,0,0,1-16,16H56a16,16,0,0,1-16-16V56A16,16,0,0,1,56,40H200A16,16,0,0,1,216,56Z",opacity:"0.2"}),x.createElement("path",{d:"M224,128a8,8,0,0,1-8,8H136v80a8,8,0,0,1-16,0V136H40a8,8,0,0,1,0-16h80V40a8,8,0,0,1,16,0v80h80A8,8,0,0,1,224,128Z"}))],["fill",x.createElement(x.Fragment,null,x.createElement("path",{d:"M208,32H48A16,16,0,0,0,32,48V208a16,16,0,0,0,16,16H208a16,16,0,0,0,16-16V48A16,16,0,0,0,208,32ZM184,136H136v48a8,8,0,0,1-16,0V136H72a8,8,0,0,1,0-16h48V72a8,8,0,0,1,16,0v48h48a8,8,0,0,1,0,16Z"}))],["light",x.createElement(x.Fragment,null,x.createElement("path",{d:"M222,128a6,6,0,0,1-6,6H134v82a6,6,0,0,1-12,0V134H40a6,6,0,0,1,0-12h82V40a6,6,0,0,1,12,0v82h82A6,6,0,0,1,222,128Z"}))],["regular",x.createElement(x.Fragment,null,x.createElement("path",{d:"M224,128a8,8,0,0,1-8,8H136v80a8,8,0,0,1-16,0V136H40a8,8,0,0,1,0-16h80V40a8,8,0,0,1,16,0v80h80A8,8,0,0,1,224,128Z"}))],["thin",x.createElement(x.Fragment,null,x.createElement("path",{d:"M220,128a4,4,0,0,1-4,4H132v84a4,4,0,0,1-8,0V132H40a4,4,0,0,1,0-8h84V40a4,4,0,0,1,8,0v84h84A4,4,0,0,1,220,128Z"}))]]),mRe=new Map([["bold",x.createElement(x.Fragment,null,x.createElement("path",{d:"M238.78,183.79,98.28,87.65A40.18,40.18,0,0,0,100,76a40,40,0,1,0-15.29,31.45l30,20.56-30,20.56a40,40,0,1,0,3.57,59.74h0A39.73,39.73,0,0,0,100,180a40.18,40.18,0,0,0-1.72-11.66L136,142.54l89.22,61.06a12,12,0,0,0,13.56-19.81ZM71.31,191.33h0A16,16,0,1,1,76,180,16,16,0,0,1,71.31,191.33ZM48.69,87.3a16,16,0,1,1,22.62,0h0A16,16,0,0,1,48.69,87.3Zm112.82,23.24a12,12,0,0,1,3.13-16.68L225.22,52.4a12,12,0,0,1,13.56,19.81l-60.59,41.46a12,12,0,0,1-16.68-3.13Z"}))],["duotone",x.createElement(x.Fragment,null,x.createElement("path",{d:"M40.2,95.8a28,28,0,1,1,39.6,0A28,28,0,0,1,40.2,95.8Zm0,64.4a28,28,0,1,0,39.6,0A28,28,0,0,0,40.2,160.2Z",opacity:"0.2"}),x.createElement("path",{d:"M157.73,113.13A8,8,0,0,1,159.82,102L227.48,55.7a8,8,0,0,1,9,13.21l-67.67,46.3a7.92,7.92,0,0,1-4.51,1.4A8,8,0,0,1,157.73,113.13Zm80.87,85.09a8,8,0,0,1-11.12,2.08L136,137.7,93.49,166.78a36,36,0,1,1-9-13.19L121.83,128,84.44,102.41a35.86,35.86,0,1,1,9-13.19l143,97.87A8,8,0,0,1,238.6,198.22ZM80,180a20,20,0,1,0-5.86,14.14A19.85,19.85,0,0,0,80,180ZM74.14,90.13a20,20,0,1,0-28.28,0A19.85,19.85,0,0,0,74.14,90.13Z"}))],["fill",x.createElement(x.Fragment,null,x.createElement("path",{d:"M236.52,187.09l-143-97.87a36,36,0,1,0-14.38,17.27l21.39,21.69L79.15,149.54l0,0a35.91,35.91,0,1,0,14.38,17.27l26.91-18.41L170,198.64a32.26,32.26,0,0,0,22.7,9.37,31.52,31.52,0,0,0,4.11-.27l.28,0,36.27-6.11a8,8,0,0,0,3.19-14.5Zm-162.38-97A20,20,0,1,1,80,76,20,20,0,0,1,74.14,90.13Zm0,104A20,20,0,1,1,80,180,20,20,0,0,1,74.14,194.15Zm61-101.5L169.94,57.4a32.19,32.19,0,0,1,26.84-9.14l.28,0,36,6.07a8.21,8.21,0,0,1,6.09,4.42,8,8,0,0,1-2.67,10.12l-69.93,47.85a4,4,0,0,1-4.51,0l-26.31-18A4,4,0,0,1,135.18,92.65Z"}))],["light",x.createElement(x.Fragment,null,x.createElement("path",{d:"M159.38,112a6,6,0,0,1,1.57-8.34l67.66-46.31a6,6,0,0,1,6.78,9.91l-67.67,46.3a6,6,0,0,1-8.34-1.56ZM237,197.09a6,6,0,0,1-8.34,1.56L136,135.27,91,166.06A34,34,0,1,1,84,156a1.8,1.8,0,0,0,.19.2L125.37,128,84.23,99.84,84,100a34,34,0,1,1,7-10.1l144.38,98.8A6,6,0,0,1,237,197.09ZM75.56,91.55a22,22,0,1,0-31.12,0,21.88,21.88,0,0,0,31.12,0ZM82,180a22,22,0,1,0-6.44,15.56h0A21.88,21.88,0,0,0,82,180Z"}))],["regular",x.createElement(x.Fragment,null,x.createElement("path",{d:"M157.73,113.13A8,8,0,0,1,159.82,102L227.48,55.7a8,8,0,0,1,9,13.21l-67.67,46.3a7.92,7.92,0,0,1-4.51,1.4A8,8,0,0,1,157.73,113.13Zm80.87,85.09a8,8,0,0,1-11.12,2.08L136,137.7,93.49,166.78a36,36,0,1,1-9-13.19L121.83,128,84.44,102.41a35.86,35.86,0,1,1,9-13.19l143,97.87A8,8,0,0,1,238.6,198.22ZM80,180a20,20,0,1,0-5.86,14.14A19.85,19.85,0,0,0,80,180ZM74.14,90.13a20,20,0,1,0-28.28,0A19.85,19.85,0,0,0,74.14,90.13Z"}))],["thin",x.createElement(x.Fragment,null,x.createElement("path",{d:"M161,110.87a4,4,0,0,1,1.05-5.56L229.74,59a4,4,0,0,1,4.52,6.61l-67.67,46.3a4,4,0,0,1-5.56-1ZM235.3,196a4,4,0,0,1-5.56,1L136,132.85,88.47,165.38a32,32,0,1,1-5.84-8c.45.45.89.92,1.31,1.4l45-30.78-45-30.78c-.42.48-.86,1-1.31,1.4a31.86,31.86,0,1,1,5.84-8l49.69,34h0l96.09,65.76A4,4,0,0,1,235.3,196ZM77,93a24.42,24.42,0,0,0,2.82-3.38s0,0,0,0l0,0A24,24,0,1,0,77,93ZM84,180a23.75,23.75,0,0,0-4.15-13.49l0-.06,0,0A24.5,24.5,0,0,0,77,163,24,24,0,1,0,77,197h0A23.85,23.85,0,0,0,84,180Z"}))]]),gRe=new Map([["bold",x.createElement(x.Fragment,null,x.createElement("path",{d:"M208,28H48A20,20,0,0,0,28,48V208a20,20,0,0,0,20,20H208a20,20,0,0,0,20-20V48A20,20,0,0,0,208,28Zm-4,176H52V52H204Z"}))],["duotone",x.createElement(x.Fragment,null,x.createElement("path",{d:"M216,48V208a8,8,0,0,1-8,8H48a8,8,0,0,1-8-8V48a8,8,0,0,1,8-8H208A8,8,0,0,1,216,48Z",opacity:"0.2"}),x.createElement("path",{d:"M208,32H48A16,16,0,0,0,32,48V208a16,16,0,0,0,16,16H208a16,16,0,0,0,16-16V48A16,16,0,0,0,208,32Zm0,176H48V48H208V208Z"}))],["fill",x.createElement(x.Fragment,null,x.createElement("path",{d:"M224,48V208a16,16,0,0,1-16,16H48a16,16,0,0,1-16-16V48A16,16,0,0,1,48,32H208A16,16,0,0,1,224,48Z"}))],["light",x.createElement(x.Fragment,null,x.createElement("path",{d:"M208,34H48A14,14,0,0,0,34,48V208a14,14,0,0,0,14,14H208a14,14,0,0,0,14-14V48A14,14,0,0,0,208,34Zm2,174a2,2,0,0,1-2,2H48a2,2,0,0,1-2-2V48a2,2,0,0,1,2-2H208a2,2,0,0,1,2,2Z"}))],["regular",x.createElement(x.Fragment,null,x.createElement("path",{d:"M208,32H48A16,16,0,0,0,32,48V208a16,16,0,0,0,16,16H208a16,16,0,0,0,16-16V48A16,16,0,0,0,208,32Zm0,176H48V48H208V208Z"}))],["thin",x.createElement(x.Fragment,null,x.createElement("path",{d:"M208,36H48A12,12,0,0,0,36,48V208a12,12,0,0,0,12,12H208a12,12,0,0,0,12-12V48A12,12,0,0,0,208,36Zm4,172a4,4,0,0,1-4,4H48a4,4,0,0,1-4-4V48a4,4,0,0,1,4-4H208a4,4,0,0,1,4,4Z"}))]]),yRe=new Map([["bold",x.createElement(x.Fragment,null,x.createElement("path",{d:"M200,36H56A20,20,0,0,0,36,56V200a20,20,0,0,0,20,20H200a20,20,0,0,0,20-20V56A20,20,0,0,0,200,36Zm-4,24v56H60V60ZM60,196V140H196v56Z"}))],["duotone",x.createElement(x.Fragment,null,x.createElement("path",{d:"M208,56V200a8,8,0,0,1-8,8H56a8,8,0,0,1-8-8V56a8,8,0,0,1,8-8H200A8,8,0,0,1,208,56Z",opacity:"0.2"}),x.createElement("path",{d:"M200,40H56A16,16,0,0,0,40,56V200a16,16,0,0,0,16,16H200a16,16,0,0,0,16-16V56A16,16,0,0,0,200,40Zm0,16v64H56V56Zm0,144H56V136H200v64Z"}))],["fill",x.createElement(x.Fragment,null,x.createElement("path",{d:"M216,56v60a4,4,0,0,1-4,4H44a4,4,0,0,1-4-4V56A16,16,0,0,1,56,40H200A16,16,0,0,1,216,56Zm-4,80H44a4,4,0,0,0-4,4v60a16,16,0,0,0,16,16H200a16,16,0,0,0,16-16V140A4,4,0,0,0,212,136Z"}))],["light",x.createElement(x.Fragment,null,x.createElement("path",{d:"M200,42H56A14,14,0,0,0,42,56V200a14,14,0,0,0,14,14H200a14,14,0,0,0,14-14V56A14,14,0,0,0,200,42ZM56,54H200a2,2,0,0,1,2,2v66H54V56A2,2,0,0,1,56,54ZM200,202H56a2,2,0,0,1-2-2V134H202v66A2,2,0,0,1,200,202Z"}))],["regular",x.createElement(x.Fragment,null,x.createElement("path",{d:"M200,40H56A16,16,0,0,0,40,56V200a16,16,0,0,0,16,16H200a16,16,0,0,0,16-16V56A16,16,0,0,0,200,40Zm0,16v64H56V56Zm0,144H56V136H200v64Z"}))],["thin",x.createElement(x.Fragment,null,x.createElement("path",{d:"M200,44H56A12,12,0,0,0,44,56V200a12,12,0,0,0,12,12H200a12,12,0,0,0,12-12V56A12,12,0,0,0,200,44ZM56,52H200a4,4,0,0,1,4,4v68H52V56A4,4,0,0,1,56,52ZM200,204H56a4,4,0,0,1-4-4V132H204v68A4,4,0,0,1,200,204Z"}))]]),xRe=new Map([["bold",x.createElement(x.Fragment,null,x.createElement("path",{d:"M234.36,170A12,12,0,0,1,230,186.37l-96,56a12,12,0,0,1-12.1,0l-96-56a12,12,0,0,1,12.09-20.74l90,52.48L218,165.63A12,12,0,0,1,234.36,170ZM218,117.63,128,170.11,38.05,117.63A12,12,0,0,0,26,138.37l96,56a12,12,0,0,0,12.1,0l96-56A12,12,0,0,0,218,117.63ZM20,80a12,12,0,0,1,6-10.37l96-56a12.06,12.06,0,0,1,12.1,0l96,56a12,12,0,0,1,0,20.74l-96,56a12,12,0,0,1-12.1,0l-96-56A12,12,0,0,1,20,80Zm35.82,0L128,122.11,200.18,80,128,37.89Z"}))],["duotone",x.createElement(x.Fragment,null,x.createElement("path",{d:"M224,80l-96,56L32,80l96-56Z",opacity:"0.2"}),x.createElement("path",{d:"M230.91,172A8,8,0,0,1,228,182.91l-96,56a8,8,0,0,1-8.06,0l-96-56A8,8,0,0,1,36,169.09l92,53.65,92-53.65A8,8,0,0,1,230.91,172ZM220,121.09l-92,53.65L36,121.09A8,8,0,0,0,28,134.91l96,56a8,8,0,0,0,8.06,0l96-56A8,8,0,1,0,220,121.09ZM24,80a8,8,0,0,1,4-6.91l96-56a8,8,0,0,1,8.06,0l96,56a8,8,0,0,1,0,13.82l-96,56a8,8,0,0,1-8.06,0l-96-56A8,8,0,0,1,24,80Zm23.88,0L128,126.74,208.12,80,128,33.26Z"}))],["fill",x.createElement(x.Fragment,null,x.createElement("path",{d:"M220,169.09l-92,53.65L36,169.09A8,8,0,0,0,28,182.91l96,56a8,8,0,0,0,8.06,0l96-56A8,8,0,1,0,220,169.09Z"}),x.createElement("path",{d:"M220,121.09l-92,53.65L36,121.09A8,8,0,0,0,28,134.91l96,56a8,8,0,0,0,8.06,0l96-56A8,8,0,1,0,220,121.09Z"}),x.createElement("path",{d:"M28,86.91l96,56a8,8,0,0,0,8.06,0l96-56a8,8,0,0,0,0-13.82l-96-56a8,8,0,0,0-8.06,0l-96,56a8,8,0,0,0,0,13.82Z"}))],["light",x.createElement(x.Fragment,null,x.createElement("path",{d:"M229.18,173a6,6,0,0,1-2.16,8.2l-96,56a6,6,0,0,1-6,0l-96-56a6,6,0,0,1,6-10.36l93,54.23,93-54.23A6,6,0,0,1,229.18,173ZM221,122.82l-93,54.23L35,122.82a6,6,0,0,0-6,10.36l96,56a6,6,0,0,0,6,0l96-56a6,6,0,0,0-6-10.36ZM26,80a6,6,0,0,1,3-5.18l96-56a6,6,0,0,1,6,0l96,56a6,6,0,0,1,0,10.36l-96,56a6,6,0,0,1-6,0l-96-56A6,6,0,0,1,26,80Zm17.91,0L128,129.05,212.09,80,128,31Z"}))],["regular",x.createElement(x.Fragment,null,x.createElement("path",{d:"M230.91,172A8,8,0,0,1,228,182.91l-96,56a8,8,0,0,1-8.06,0l-96-56A8,8,0,0,1,36,169.09l92,53.65,92-53.65A8,8,0,0,1,230.91,172ZM220,121.09l-92,53.65L36,121.09A8,8,0,0,0,28,134.91l96,56a8,8,0,0,0,8.06,0l96-56A8,8,0,1,0,220,121.09ZM24,80a8,8,0,0,1,4-6.91l96-56a8,8,0,0,1,8.06,0l96,56a8,8,0,0,1,0,13.82l-96,56a8,8,0,0,1-8.06,0l-96-56A8,8,0,0,1,24,80Zm23.88,0L128,126.74,208.12,80,128,33.26Z"}))],["thin",x.createElement(x.Fragment,null,x.createElement("path",{d:"M227.45,174a4,4,0,0,1-1.44,5.48l-96,56a4,4,0,0,1-4,0l-96-56a4,4,0,0,1,4-6.92l94,54.83,94-54.83A4,4,0,0,1,227.45,174ZM222,124.54l-94,54.83L34,124.54a4,4,0,0,0-4,6.92l96,56a4,4,0,0,0,4,0l96-56a4,4,0,0,0-4-6.92ZM28,80a4,4,0,0,1,2-3.46l96-56a4,4,0,0,1,4,0l96,56a4,4,0,0,1,0,6.92l-96,56a4,4,0,0,1-4,0l-96-56A4,4,0,0,1,28,80Zm11.94,0L128,131.37,216.06,80,128,28.63Z"}))]]),bRe=new Map([["bold",x.createElement(x.Fragment,null,x.createElement("path",{d:"M90.86,50.89a12,12,0,0,0-21.72,0l-64,136a12,12,0,0,0,21.71,10.22L42.44,164h75.12l15.58,33.11a12,12,0,0,0,21.72-10.22ZM53.74,140,80,84.18,106.27,140ZM200,84c-13.85,0-24.77,3.86-32.45,11.48a12,12,0,1,0,16.9,17c3-3,8.26-4.52,15.55-4.52,11,0,20,7.18,20,16v4.39A47.28,47.28,0,0,0,200,124c-24.26,0-44,17.94-44,40s19.74,40,44,40a47.18,47.18,0,0,0,22-5.38A12,12,0,0,0,244,192V124C244,101.94,224.26,84,200,84Zm0,96c-11,0-20-7.18-20-16s9-16,20-16,20,7.18,20,16S211,180,200,180Z"}))],["duotone",x.createElement(x.Fragment,null,x.createElement("path",{d:"M232,164c0,15.46-14.33,28-32,28s-32-12.54-32-28,14.33-28,32-28S232,148.54,232,164ZM34.82,152h90.36L80,56Z",opacity:"0.2"}),x.createElement("path",{d:"M87.24,52.59a8,8,0,0,0-14.48,0l-64,136a8,8,0,1,0,14.48,6.81L39.9,160h80.2l16.66,35.4a8,8,0,1,0,14.48-6.81ZM47.43,144,80,74.79,112.57,144ZM200,96c-12.76,0-22.73,3.47-29.63,10.32a8,8,0,0,0,11.26,11.36c3.8-3.77,10-5.68,18.37-5.68,13.23,0,24,9,24,20v3.22A42.76,42.76,0,0,0,200,128c-22.06,0-40,16.15-40,36s17.94,36,40,36a42.73,42.73,0,0,0,24-7.25,8,8,0,0,0,16-.75V132C240,112.15,222.06,96,200,96Zm0,88c-13.23,0-24-9-24-20s10.77-20,24-20,24,9,24,20S213.23,184,200,184Z"}))],["fill",x.createElement(x.Fragment,null,x.createElement("path",{d:"M200,156c0,6.5-7.33,12-16,12s-16-5.5-16-12,7.33-12,16-12S200,149.5,200,156ZM232,56V200a16,16,0,0,1-16,16H40a16,16,0,0,1-16-16V56A16,16,0,0,1,40,40H216A16,16,0,0,1,232,56ZM143.37,172.88l-44-104a8,8,0,0,0-14.74,0l-44,104a8,8,0,0,0,14.74,6.24L66.84,152h50.32l11.47,27.12a8,8,0,0,0,14.74-6.24ZM216,124c0-15.44-14.36-28-32-28a34.86,34.86,0,0,0-20.78,6.68,8,8,0,0,0,9.56,12.83A18.84,18.84,0,0,1,184,112c8.56,0,15.8,5.36,16,11.76v8A35.24,35.24,0,0,0,184,128c-17.64,0-32,12.56-32,28s14.36,28,32,28a35.13,35.13,0,0,0,16.93-4.26A8,8,0,0,0,216,176ZM73.61,136h36.78L92,92.53Z"}))],["light",x.createElement(x.Fragment,null,x.createElement("path",{d:"M85.43,53.45a6,6,0,0,0-10.86,0l-64,136a6,6,0,1,0,10.86,5.11L38.63,158h82.74l17.2,36.55a6,6,0,1,0,10.86-5.11ZM44.28,146,80,70.09,115.72,146ZM200,98c-12.21,0-21.71,3.28-28.23,9.74a6,6,0,0,0,8.46,8.52c4.18-4.15,10.84-6.26,19.77-6.26,14.34,0,26,9.87,26,22v7.24A40.36,40.36,0,0,0,200,130c-20.95,0-38,15.25-38,34s17.05,34,38,34a40.36,40.36,0,0,0,26-9.24V192a6,6,0,0,0,12,0V132C238,113.25,221,98,200,98Zm0,88c-14.34,0-26-9.87-26-22s11.66-22,26-22,26,9.87,26,22S214.34,186,200,186Z"}))],["regular",x.createElement(x.Fragment,null,x.createElement("path",{d:"M87.24,52.59a8,8,0,0,0-14.48,0l-64,136a8,8,0,1,0,14.48,6.81L39.9,160h80.2l16.66,35.4a8,8,0,1,0,14.48-6.81ZM47.43,144,80,74.79,112.57,144ZM200,96c-12.76,0-22.73,3.47-29.63,10.32a8,8,0,0,0,11.26,11.36c3.8-3.77,10-5.68,18.37-5.68,13.23,0,24,9,24,20v3.22A42.76,42.76,0,0,0,200,128c-22.06,0-40,16.15-40,36s17.94,36,40,36a42.73,42.73,0,0,0,24-7.25,8,8,0,0,0,16-.75V132C240,112.15,222.06,96,200,96Zm0,88c-13.23,0-24-9-24-20s10.77-20,24-20,24,9,24,20S213.23,184,200,184Z"}))],["thin",x.createElement(x.Fragment,null,x.createElement("path",{d:"M83.62,54.3a4,4,0,0,0-7.24,0l-64,136a4,4,0,0,0,7.24,3.4L37.36,156h85.28l17.74,37.7a4,4,0,1,0,7.24-3.4ZM41.13,148,80,65.39,118.87,148ZM200,100c-11.67,0-20.69,3.08-26.82,9.16a4,4,0,1,0,5.64,5.68c4.57-4.54,11.7-6.84,21.18-6.84,15.44,0,28,10.77,28,24v11.92A37.78,37.78,0,0,0,200,132c-19.85,0-36,14.35-36,32s16.15,32,36,32a37.78,37.78,0,0,0,28-11.92V192a4,4,0,0,0,8,0V132C236,114.36,219.85,100,200,100Zm0,88c-15.44,0-28-10.77-28-24s12.56-24,28-24,28,10.77,28,24S215.44,188,200,188Z"}))]]),vRe=new Map([["bold",x.createElement(x.Fragment,null,x.createElement("path",{d:"M212,56V88a12,12,0,0,1-24,0V68H140V188h20a12,12,0,0,1,0,24H96a12,12,0,0,1,0-24h20V68H68V88a12,12,0,0,1-24,0V56A12,12,0,0,1,56,44H200A12,12,0,0,1,212,56Z"}))],["duotone",x.createElement(x.Fragment,null,x.createElement("path",{d:"M200,56V184a16,16,0,0,1-16,16H72a16,16,0,0,1-16-16V56Z",opacity:"0.2"}),x.createElement("path",{d:"M208,56V88a8,8,0,0,1-16,0V64H136V192h24a8,8,0,0,1,0,16H96a8,8,0,0,1,0-16h24V64H64V88a8,8,0,0,1-16,0V56a8,8,0,0,1,8-8H200A8,8,0,0,1,208,56Z"}))],["fill",x.createElement(x.Fragment,null,x.createElement("path",{d:"M208,32H48A16,16,0,0,0,32,48V208a16,16,0,0,0,16,16H208a16,16,0,0,0,16-16V48A16,16,0,0,0,208,32ZM184,96a8,8,0,0,1-16,0V88H136v88h12a8,8,0,0,1,0,16H108a8,8,0,0,1,0-16h12V88H88v8a8,8,0,0,1-16,0V80a8,8,0,0,1,8-8h96a8,8,0,0,1,8,8Z"}))],["light",x.createElement(x.Fragment,null,x.createElement("path",{d:"M206,56V88a6,6,0,0,1-12,0V62H134V194h26a6,6,0,0,1,0,12H96a6,6,0,0,1,0-12h26V62H62V88a6,6,0,0,1-12,0V56a6,6,0,0,1,6-6H200A6,6,0,0,1,206,56Z"}))],["regular",x.createElement(x.Fragment,null,x.createElement("path",{d:"M208,56V88a8,8,0,0,1-16,0V64H136V192h24a8,8,0,0,1,0,16H96a8,8,0,0,1,0-16h24V64H64V88a8,8,0,0,1-16,0V56a8,8,0,0,1,8-8H200A8,8,0,0,1,208,56Z"}))],["thin",x.createElement(x.Fragment,null,x.createElement("path",{d:"M204,56V88a4,4,0,0,1-8,0V60H132V196h28a4,4,0,0,1,0,8H96a4,4,0,0,1,0-8h28V60H60V88a4,4,0,0,1-8,0V56a4,4,0,0,1,4-4H200A4,4,0,0,1,204,56Z"}))]]),ARe=new Map([["bold",x.createElement(x.Fragment,null,x.createElement("path",{d:"M216,48H180V36A28,28,0,0,0,152,8H104A28,28,0,0,0,76,36V48H40a12,12,0,0,0,0,24h4V208a20,20,0,0,0,20,20H192a20,20,0,0,0,20-20V72h4a12,12,0,0,0,0-24ZM100,36a4,4,0,0,1,4-4h48a4,4,0,0,1,4,4V48H100Zm88,168H68V72H188ZM116,104v64a12,12,0,0,1-24,0V104a12,12,0,0,1,24,0Zm48,0v64a12,12,0,0,1-24,0V104a12,12,0,0,1,24,0Z"}))],["duotone",x.createElement(x.Fragment,null,x.createElement("path",{d:"M200,56V208a8,8,0,0,1-8,8H64a8,8,0,0,1-8-8V56Z",opacity:"0.2"}),x.createElement("path",{d:"M216,48H176V40a24,24,0,0,0-24-24H104A24,24,0,0,0,80,40v8H40a8,8,0,0,0,0,16h8V208a16,16,0,0,0,16,16H192a16,16,0,0,0,16-16V64h8a8,8,0,0,0,0-16ZM96,40a8,8,0,0,1,8-8h48a8,8,0,0,1,8,8v8H96Zm96,168H64V64H192ZM112,104v64a8,8,0,0,1-16,0V104a8,8,0,0,1,16,0Zm48,0v64a8,8,0,0,1-16,0V104a8,8,0,0,1,16,0Z"}))],["fill",x.createElement(x.Fragment,null,x.createElement("path",{d:"M216,48H176V40a24,24,0,0,0-24-24H104A24,24,0,0,0,80,40v8H40a8,8,0,0,0,0,16h8V208a16,16,0,0,0,16,16H192a16,16,0,0,0,16-16V64h8a8,8,0,0,0,0-16ZM112,168a8,8,0,0,1-16,0V104a8,8,0,0,1,16,0Zm48,0a8,8,0,0,1-16,0V104a8,8,0,0,1,16,0Zm0-120H96V40a8,8,0,0,1,8-8h48a8,8,0,0,1,8,8Z"}))],["light",x.createElement(x.Fragment,null,x.createElement("path",{d:"M216,50H174V40a22,22,0,0,0-22-22H104A22,22,0,0,0,82,40V50H40a6,6,0,0,0,0,12H50V208a14,14,0,0,0,14,14H192a14,14,0,0,0,14-14V62h10a6,6,0,0,0,0-12ZM94,40a10,10,0,0,1,10-10h48a10,10,0,0,1,10,10V50H94ZM194,208a2,2,0,0,1-2,2H64a2,2,0,0,1-2-2V62H194ZM110,104v64a6,6,0,0,1-12,0V104a6,6,0,0,1,12,0Zm48,0v64a6,6,0,0,1-12,0V104a6,6,0,0,1,12,0Z"}))],["regular",x.createElement(x.Fragment,null,x.createElement("path",{d:"M216,48H176V40a24,24,0,0,0-24-24H104A24,24,0,0,0,80,40v8H40a8,8,0,0,0,0,16h8V208a16,16,0,0,0,16,16H192a16,16,0,0,0,16-16V64h8a8,8,0,0,0,0-16ZM96,40a8,8,0,0,1,8-8h48a8,8,0,0,1,8,8v8H96Zm96,168H64V64H192ZM112,104v64a8,8,0,0,1-16,0V104a8,8,0,0,1,16,0Zm48,0v64a8,8,0,0,1-16,0V104a8,8,0,0,1,16,0Z"}))],["thin",x.createElement(x.Fragment,null,x.createElement("path",{d:"M216,52H172V40a20,20,0,0,0-20-20H104A20,20,0,0,0,84,40V52H40a4,4,0,0,0,0,8H52V208a12,12,0,0,0,12,12H192a12,12,0,0,0,12-12V60h12a4,4,0,0,0,0-8ZM92,40a12,12,0,0,1,12-12h48a12,12,0,0,1,12,12V52H92ZM196,208a4,4,0,0,1-4,4H64a4,4,0,0,1-4-4V60H196ZM108,104v64a4,4,0,0,1-8,0V104a4,4,0,0,1,8,0Zm48,0v64a4,4,0,0,1-8,0V104a4,4,0,0,1,8,0Z"}))]]),SRe=new Map([["bold",x.createElement(x.Fragment,null,x.createElement("path",{d:"M240.26,186.1,152.81,34.23h0a28.74,28.74,0,0,0-49.62,0L15.74,186.1a27.45,27.45,0,0,0,0,27.71A28.31,28.31,0,0,0,40.55,228h174.9a28.31,28.31,0,0,0,24.79-14.19A27.45,27.45,0,0,0,240.26,186.1Zm-20.8,15.7a4.46,4.46,0,0,1-4,2.2H40.55a4.46,4.46,0,0,1-4-2.2,3.56,3.56,0,0,1,0-3.73L124,46.2a4.77,4.77,0,0,1,8,0l87.44,151.87A3.56,3.56,0,0,1,219.46,201.8ZM116,136V104a12,12,0,0,1,24,0v32a12,12,0,0,1-24,0Zm28,40a16,16,0,1,1-16-16A16,16,0,0,1,144,176Z"}))],["duotone",x.createElement(x.Fragment,null,x.createElement("path",{d:"M215.46,216H40.54C27.92,216,20,202.79,26.13,192.09L113.59,40.22c6.3-11,22.52-11,28.82,0l87.46,151.87C236,202.79,228.08,216,215.46,216Z",opacity:"0.2"}),x.createElement("path",{d:"M236.8,188.09,149.35,36.22h0a24.76,24.76,0,0,0-42.7,0L19.2,188.09a23.51,23.51,0,0,0,0,23.72A24.35,24.35,0,0,0,40.55,224h174.9a24.35,24.35,0,0,0,21.33-12.19A23.51,23.51,0,0,0,236.8,188.09ZM222.93,203.8a8.5,8.5,0,0,1-7.48,4.2H40.55a8.5,8.5,0,0,1-7.48-4.2,7.59,7.59,0,0,1,0-7.72L120.52,44.21a8.75,8.75,0,0,1,15,0l87.45,151.87A7.59,7.59,0,0,1,222.93,203.8ZM120,144V104a8,8,0,0,1,16,0v40a8,8,0,0,1-16,0Zm20,36a12,12,0,1,1-12-12A12,12,0,0,1,140,180Z"}))],["fill",x.createElement(x.Fragment,null,x.createElement("path",{d:"M236.8,188.09,149.35,36.22h0a24.76,24.76,0,0,0-42.7,0L19.2,188.09a23.51,23.51,0,0,0,0,23.72A24.35,24.35,0,0,0,40.55,224h174.9a24.35,24.35,0,0,0,21.33-12.19A23.51,23.51,0,0,0,236.8,188.09ZM120,104a8,8,0,0,1,16,0v40a8,8,0,0,1-16,0Zm8,88a12,12,0,1,1,12-12A12,12,0,0,1,128,192Z"}))],["light",x.createElement(x.Fragment,null,x.createElement("path",{d:"M235.07,189.09,147.61,37.22h0a22.75,22.75,0,0,0-39.22,0L20.93,189.09a21.53,21.53,0,0,0,0,21.72A22.35,22.35,0,0,0,40.55,222h174.9a22.35,22.35,0,0,0,19.6-11.19A21.53,21.53,0,0,0,235.07,189.09ZM224.66,204.8a10.46,10.46,0,0,1-9.21,5.2H40.55a10.46,10.46,0,0,1-9.21-5.2,9.51,9.51,0,0,1,0-9.72L118.79,43.21a10.75,10.75,0,0,1,18.42,0l87.46,151.87A9.51,9.51,0,0,1,224.66,204.8ZM122,144V104a6,6,0,0,1,12,0v40a6,6,0,0,1-12,0Zm16,36a10,10,0,1,1-10-10A10,10,0,0,1,138,180Z"}))],["regular",x.createElement(x.Fragment,null,x.createElement("path",{d:"M236.8,188.09,149.35,36.22h0a24.76,24.76,0,0,0-42.7,0L19.2,188.09a23.51,23.51,0,0,0,0,23.72A24.35,24.35,0,0,0,40.55,224h174.9a24.35,24.35,0,0,0,21.33-12.19A23.51,23.51,0,0,0,236.8,188.09ZM222.93,203.8a8.5,8.5,0,0,1-7.48,4.2H40.55a8.5,8.5,0,0,1-7.48-4.2,7.59,7.59,0,0,1,0-7.72L120.52,44.21a8.75,8.75,0,0,1,15,0l87.45,151.87A7.59,7.59,0,0,1,222.93,203.8ZM120,144V104a8,8,0,0,1,16,0v40a8,8,0,0,1-16,0Zm20,36a12,12,0,1,1-12-12A12,12,0,0,1,140,180Z"}))],["thin",x.createElement(x.Fragment,null,x.createElement("path",{d:"M233.34,190.09,145.88,38.22h0a20.75,20.75,0,0,0-35.76,0L22.66,190.09a19.52,19.52,0,0,0,0,19.71A20.36,20.36,0,0,0,40.54,220H215.46a20.36,20.36,0,0,0,17.86-10.2A19.52,19.52,0,0,0,233.34,190.09ZM226.4,205.8a12.47,12.47,0,0,1-10.94,6.2H40.54a12.47,12.47,0,0,1-10.94-6.2,11.45,11.45,0,0,1,0-11.72L117.05,42.21a12.76,12.76,0,0,1,21.9,0L226.4,194.08A11.45,11.45,0,0,1,226.4,205.8ZM124,144V104a4,4,0,0,1,8,0v40a4,4,0,0,1-8,0Zm12,36a8,8,0,1,1-8-8A8,8,0,0,1,136,180Z"}))]]),wRe=new Map([["bold",x.createElement(x.Fragment,null,x.createElement("path",{d:"M60,96v64a12,12,0,0,1-24,0V96a12,12,0,0,1,24,0ZM88,20A12,12,0,0,0,76,32V224a12,12,0,0,0,24,0V32A12,12,0,0,0,88,20Zm40,32a12,12,0,0,0-12,12V192a12,12,0,0,0,24,0V64A12,12,0,0,0,128,52Zm40,32a12,12,0,0,0-12,12v64a12,12,0,0,0,24,0V96A12,12,0,0,0,168,84Zm40-16a12,12,0,0,0-12,12v96a12,12,0,0,0,24,0V80A12,12,0,0,0,208,68Z"}))],["duotone",x.createElement(x.Fragment,null,x.createElement("path",{d:"M208,96v64H48V96Z",opacity:"0.2"}),x.createElement("path",{d:"M56,96v64a8,8,0,0,1-16,0V96a8,8,0,0,1,16,0ZM88,24a8,8,0,0,0-8,8V224a8,8,0,0,0,16,0V32A8,8,0,0,0,88,24Zm40,32a8,8,0,0,0-8,8V192a8,8,0,0,0,16,0V64A8,8,0,0,0,128,56Zm40,32a8,8,0,0,0-8,8v64a8,8,0,0,0,16,0V96A8,8,0,0,0,168,88Zm40-16a8,8,0,0,0-8,8v96a8,8,0,0,0,16,0V80A8,8,0,0,0,208,72Z"}))],["fill",x.createElement(x.Fragment,null,x.createElement("path",{d:"M216,40H40A16,16,0,0,0,24,56V200a16,16,0,0,0,16,16H216a16,16,0,0,0,16-16V56A16,16,0,0,0,216,40ZM72,152a8,8,0,0,1-16,0V104a8,8,0,0,1,16,0Zm32,32a8,8,0,0,1-16,0V72a8,8,0,0,1,16,0Zm32-16a8,8,0,0,1-16,0V88a8,8,0,0,1,16,0Zm32-16a8,8,0,0,1-16,0V104a8,8,0,0,1,16,0Zm32,8a8,8,0,0,1-16,0V96a8,8,0,0,1,16,0Z"}))],["light",x.createElement(x.Fragment,null,x.createElement("path",{d:"M54,96v64a6,6,0,0,1-12,0V96a6,6,0,0,1,12,0ZM88,26a6,6,0,0,0-6,6V224a6,6,0,0,0,12,0V32A6,6,0,0,0,88,26Zm40,32a6,6,0,0,0-6,6V192a6,6,0,0,0,12,0V64A6,6,0,0,0,128,58Zm40,32a6,6,0,0,0-6,6v64a6,6,0,0,0,12,0V96A6,6,0,0,0,168,90Zm40-16a6,6,0,0,0-6,6v96a6,6,0,0,0,12,0V80A6,6,0,0,0,208,74Z"}))],["regular",x.createElement(x.Fragment,null,x.createElement("path",{d:"M56,96v64a8,8,0,0,1-16,0V96a8,8,0,0,1,16,0ZM88,24a8,8,0,0,0-8,8V224a8,8,0,0,0,16,0V32A8,8,0,0,0,88,24Zm40,32a8,8,0,0,0-8,8V192a8,8,0,0,0,16,0V64A8,8,0,0,0,128,56Zm40,32a8,8,0,0,0-8,8v64a8,8,0,0,0,16,0V96A8,8,0,0,0,168,88Zm40-16a8,8,0,0,0-8,8v96a8,8,0,0,0,16,0V80A8,8,0,0,0,208,72Z"}))],["thin",x.createElement(x.Fragment,null,x.createElement("path",{d:"M52,96v64a4,4,0,0,1-8,0V96a4,4,0,0,1,8,0ZM88,28a4,4,0,0,0-4,4V224a4,4,0,0,0,8,0V32A4,4,0,0,0,88,28Zm40,32a4,4,0,0,0-4,4V192a4,4,0,0,0,8,0V64A4,4,0,0,0,128,60Zm40,32a4,4,0,0,0-4,4v64a4,4,0,0,0,8,0V96A4,4,0,0,0,168,92Zm40-16a4,4,0,0,0-4,4v96a4,4,0,0,0,8,0V80A4,4,0,0,0,208,76Z"}))]]),ORe=new Map([["bold",x.createElement(x.Fragment,null,x.createElement("path",{d:"M208.49,191.51a12,12,0,0,1-17,17L128,145,64.49,208.49a12,12,0,0,1-17-17L111,128,47.51,64.49a12,12,0,0,1,17-17L128,111l63.51-63.52a12,12,0,0,1,17,17L145,128Z"}))],["duotone",x.createElement(x.Fragment,null,x.createElement("path",{d:"M216,56V200a16,16,0,0,1-16,16H56a16,16,0,0,1-16-16V56A16,16,0,0,1,56,40H200A16,16,0,0,1,216,56Z",opacity:"0.2"}),x.createElement("path",{d:"M205.66,194.34a8,8,0,0,1-11.32,11.32L128,139.31,61.66,205.66a8,8,0,0,1-11.32-11.32L116.69,128,50.34,61.66A8,8,0,0,1,61.66,50.34L128,116.69l66.34-66.35a8,8,0,0,1,11.32,11.32L139.31,128Z"}))],["fill",x.createElement(x.Fragment,null,x.createElement("path",{d:"M208,32H48A16,16,0,0,0,32,48V208a16,16,0,0,0,16,16H208a16,16,0,0,0,16-16V48A16,16,0,0,0,208,32ZM181.66,170.34a8,8,0,0,1-11.32,11.32L128,139.31,85.66,181.66a8,8,0,0,1-11.32-11.32L116.69,128,74.34,85.66A8,8,0,0,1,85.66,74.34L128,116.69l42.34-42.35a8,8,0,0,1,11.32,11.32L139.31,128Z"}))],["light",x.createElement(x.Fragment,null,x.createElement("path",{d:"M204.24,195.76a6,6,0,1,1-8.48,8.48L128,136.49,60.24,204.24a6,6,0,0,1-8.48-8.48L119.51,128,51.76,60.24a6,6,0,0,1,8.48-8.48L128,119.51l67.76-67.75a6,6,0,0,1,8.48,8.48L136.49,128Z"}))],["regular",x.createElement(x.Fragment,null,x.createElement("path",{d:"M205.66,194.34a8,8,0,0,1-11.32,11.32L128,139.31,61.66,205.66a8,8,0,0,1-11.32-11.32L116.69,128,50.34,61.66A8,8,0,0,1,61.66,50.34L128,116.69l66.34-66.35a8,8,0,0,1,11.32,11.32L139.31,128Z"}))],["thin",x.createElement(x.Fragment,null,x.createElement("path",{d:"M202.83,197.17a4,4,0,0,1-5.66,5.66L128,133.66,58.83,202.83a4,4,0,0,1-5.66-5.66L122.34,128,53.17,58.83a4,4,0,0,1,5.66-5.66L128,122.34l69.17-69.17a4,4,0,1,1,5.66,5.66L133.66,128Z"}))]]),CRe=x.createContext({color:"currentColor",size:"1em",weight:"regular",mirrored:!1}),zt=x.forwardRef((t,e)=>{const{alt:n,color:r,size:i,weight:s,mirrored:a,children:o,weights:l,...c}=t,{color:u="currentColor",size:f,weight:h="regular",mirrored:p=!1,...y}=x.useContext(CRe);return x.createElement("svg",{ref:e,xmlns:"http://www.w3.org/2000/svg",width:i??f,height:i??f,fill:r??u,viewBox:"0 0 256 256",transform:a||p?"scale(-1, 1)":void 0,...y,...c},!!n&&x.createElement("title",null,n),o,l.get(s??h))});zt.displayName="IconBase";const pue=x.forwardRef((t,e)=>x.createElement(zt,{ref:e,...t,weights:w_e}));pue.displayName="ArrowClockwiseIcon";const kRe=pue,mue=x.forwardRef((t,e)=>x.createElement(zt,{ref:e,...t,weights:O_e}));mue.displayName="ArrowCounterClockwiseIcon";const ERe=mue,gue=x.forwardRef((t,e)=>x.createElement(zt,{ref:e,...t,weights:C_e}));gue.displayName="ArrowLeftIcon";const TRe=gue,yue=x.forwardRef((t,e)=>x.createElement(zt,{ref:e,...t,weights:k_e}));yue.displayName="ArrowsOutCardinalIcon";const PRe=yue,xue=x.forwardRef((t,e)=>x.createElement(zt,{ref:e,...t,weights:E_e}));xue.displayName="CameraIcon";const MRe=xue,W6=x.forwardRef((t,e)=>x.createElement(zt,{ref:e,...t,weights:T_e}));W6.displayName="CaretRightIcon";const YL=W6,bue=x.forwardRef((t,e)=>x.createElement(zt,{ref:e,...t,weights:P_e}));bue.displayName="CheckIcon";const vue=bue,Aue=x.forwardRef((t,e)=>x.createElement(zt,{ref:e,...t,weights:M_e}));Aue.displayName="CheckCircleIcon";const Sue=x.forwardRef((t,e)=>x.createElement(zt,{ref:e,...t,weights:N_e}));Sue.displayName="ClipboardTextIcon";const NRe=Sue,wue=x.forwardRef((t,e)=>x.createElement(zt,{ref:e,...t,weights:D_e}));wue.displayName="ClockIcon";const DRe=wue,Oue=x.forwardRef((t,e)=>x.createElement(zt,{ref:e,...t,weights:I_e}));Oue.displayName="CopyIcon";const Cue=Oue,kue=x.forwardRef((t,e)=>x.createElement(zt,{ref:e,...t,weights:__e}));kue.displayName="EyeIcon";const WE=kue,Eue=x.forwardRef((t,e)=>x.createElement(zt,{ref:e,...t,weights:R_e}));Eue.displayName="EyeSlashIcon";const KL=Eue,Tue=x.forwardRef((t,e)=>x.createElement(zt,{ref:e,...t,weights:j_e}));Tue.displayName="EyedropperIcon";const IRe=Tue,Pue=x.forwardRef((t,e)=>x.createElement(zt,{ref:e,...t,weights:L_e}));Pue.displayName="FileIcon";const _Re=Pue,Mue=x.forwardRef((t,e)=>x.createElement(zt,{ref:e,...t,weights:F_e}));Mue.displayName="FileCodeIcon";const RRe=Mue,Nue=x.forwardRef((t,e)=>x.createElement(zt,{ref:e,...t,weights:$_e}));Nue.displayName="FileCssIcon";const jRe=Nue,Due=x.forwardRef((t,e)=>x.createElement(zt,{ref:e,...t,weights:B_e}));Due.displayName="FileHtmlIcon";const LRe=Due,Iue=x.forwardRef((t,e)=>x.createElement(zt,{ref:e,...t,weights:V_e}));Iue.displayName="FileJpgIcon";const FRe=Iue,_ue=x.forwardRef((t,e)=>x.createElement(zt,{ref:e,...t,weights:H_e}));_ue.displayName="FileJsIcon";const $Re=_ue,Rue=x.forwardRef((t,e)=>x.createElement(zt,{ref:e,...t,weights:Q_e}));Rue.displayName="FileJsxIcon";const BRe=Rue,jue=x.forwardRef((t,e)=>x.createElement(zt,{ref:e,...t,weights:z_e}));jue.displayName="FileMdIcon";const VRe=jue,Lue=x.forwardRef((t,e)=>x.createElement(zt,{ref:e,...t,weights:Z_e}));Lue.displayName="FilePlusIcon";const _X=Lue,Fue=x.forwardRef((t,e)=>x.createElement(zt,{ref:e,...t,weights:G_e}));Fue.displayName="FilePngIcon";const HRe=Fue,$ue=x.forwardRef((t,e)=>x.createElement(zt,{ref:e,...t,weights:U_e}));$ue.displayName="FileSvgIcon";const QRe=$ue,Bue=x.forwardRef((t,e)=>x.createElement(zt,{ref:e,...t,weights:X_e}));Bue.displayName="FileTsIcon";const zRe=Bue,Vue=x.forwardRef((t,e)=>x.createElement(zt,{ref:e,...t,weights:W_e}));Vue.displayName="FileTsxIcon";const ZRe=Vue,Hue=x.forwardRef((t,e)=>x.createElement(zt,{ref:e,...t,weights:q_e}));Hue.displayName="FileTxtIcon";const GRe=Hue,Que=x.forwardRef((t,e)=>x.createElement(zt,{ref:e,...t,weights:Y_e}));Que.displayName="FileVideoIcon";const URe=Que,zue=x.forwardRef((t,e)=>x.createElement(zt,{ref:e,...t,weights:K_e}));zue.displayName="FilmStripIcon";const XRe=zue,Zue=x.forwardRef((t,e)=>x.createElement(zt,{ref:e,...t,weights:J_e}));Zue.displayName="FolderSimpleIcon";const WRe=Zue,Gue=x.forwardRef((t,e)=>x.createElement(zt,{ref:e,...t,weights:eRe}));Gue.displayName="FolderSimplePlusIcon";const Uue=Gue,Xue=x.forwardRef((t,e)=>x.createElement(zt,{ref:e,...t,weights:tRe}));Xue.displayName="GearIcon";const qRe=Xue,Wue=x.forwardRef((t,e)=>x.createElement(zt,{ref:e,...t,weights:nRe}));Wue.displayName="GridFourIcon";const YRe=Wue,que=x.forwardRef((t,e)=>x.createElement(zt,{ref:e,...t,weights:rRe}));que.displayName="ImageIcon";const Yue=que,Kue=x.forwardRef((t,e)=>x.createElement(zt,{ref:e,...t,weights:iRe}));Kue.displayName="LightningIcon";const KRe=Kue,Jue=x.forwardRef((t,e)=>x.createElement(zt,{ref:e,...t,weights:sRe}));Jue.displayName="MagnetIcon";const JRe=Jue,efe=x.forwardRef((t,e)=>x.createElement(zt,{ref:e,...t,weights:aRe}));efe.displayName="MagnetStraightIcon";const e9e=efe,tfe=x.forwardRef((t,e)=>x.createElement(zt,{ref:e,...t,weights:oRe}));tfe.displayName="MagnifyingGlassMinusIcon";const t9e=tfe,nfe=x.forwardRef((t,e)=>x.createElement(zt,{ref:e,...t,weights:lRe}));nfe.displayName="MagnifyingGlassPlusIcon";const n9e=nfe,rfe=x.forwardRef((t,e)=>x.createElement(zt,{ref:e,...t,weights:cRe}));rfe.displayName="MinusIcon";const r9e=rfe,ife=x.forwardRef((t,e)=>x.createElement(zt,{ref:e,...t,weights:uRe}));ife.displayName="MusicNoteIcon";const i9e=ife,sfe=x.forwardRef((t,e)=>x.createElement(zt,{ref:e,...t,weights:fRe}));sfe.displayName="PaletteIcon";const s9e=sfe,afe=x.forwardRef((t,e)=>x.createElement(zt,{ref:e,...t,weights:hRe}));afe.displayName="PathIcon";const a9e=afe,ofe=x.forwardRef((t,e)=>x.createElement(zt,{ref:e,...t,weights:dRe}));ofe.displayName="PencilSimpleIcon";const o9e=ofe,lfe=x.forwardRef((t,e)=>x.createElement(zt,{ref:e,...t,weights:pRe}));lfe.displayName="PlusIcon";const cfe=lfe,ufe=x.forwardRef((t,e)=>x.createElement(zt,{ref:e,...t,weights:mRe}));ufe.displayName="ScissorsIcon";const l9e=ufe,ffe=x.forwardRef((t,e)=>x.createElement(zt,{ref:e,...t,weights:gRe}));ffe.displayName="SquareIcon";const c9e=ffe,hfe=x.forwardRef((t,e)=>x.createElement(zt,{ref:e,...t,weights:yRe}));hfe.displayName="SquareSplitVerticalIcon";const u9e=hfe,dfe=x.forwardRef((t,e)=>x.createElement(zt,{ref:e,...t,weights:xRe}));dfe.displayName="StackIcon";const f9e=dfe,pfe=x.forwardRef((t,e)=>x.createElement(zt,{ref:e,...t,weights:bRe}));pfe.displayName="TextAaIcon";const h9e=pfe,mfe=x.forwardRef((t,e)=>x.createElement(zt,{ref:e,...t,weights:vRe}));mfe.displayName="TextTIcon";const d9e=mfe,gfe=x.forwardRef((t,e)=>x.createElement(zt,{ref:e,...t,weights:ARe}));gfe.displayName="TrashIcon";const yfe=gfe,N4=x.forwardRef((t,e)=>x.createElement(zt,{ref:e,...t,weights:SRe}));N4.displayName="WarningIcon";const xfe=x.forwardRef((t,e)=>x.createElement(zt,{ref:e,...t,weights:wRe}));xfe.displayName="WaveformIcon";const p9e=xfe,JL=x.forwardRef((t,e)=>x.createElement(zt,{ref:e,...t,weights:ORe}));JL.displayName="XIcon";const m9e=JL,yi=t=>({title:n,...r})=>d.jsx(t,{alt:n,"aria-label":n,"aria-hidden":n?void 0:!0,...r}),bfe=yi(vue),g9e=yi(DRe),eF=yi(WE),qE=yi(XRe),_g=yi(f9e),y9e=yi(PRe),vfe=yi(i9e),Afe=yi(s9e),x9e=yi(r9e),Wo=yi(cfe),Sfe=yi(c9e),wfe=yi(u9e),E_=yi(d9e),Id=yi(m9e),b9e=yi(KRe),Ofe=({title:t,style:e,...n})=>{const r=e!=null&&e.transform?`${e.transform} rotate(90deg)`:"rotate(90deg)";return d.jsx(YL,{alt:t,"aria-label":t,"aria-hidden":t?void 0:!0,style:{...e,transform:r},...n})},Cfe=yi(YL),tF=yi(NRe),el=yi(ERe),v9e=yi(MRe),kfe=yi(kRe),q6=yi(qRe),Efe=yi(l9e),A9e=yi(IRe),S9e=yi(yfe);function Tfe({clipCount:t}){return t<2?null:d.jsx("span",{"aria-label":`${t} clips`,title:`${t} clips`,className:"shrink-0 rounded-full bg-white/10 px-1 text-[9px] leading-[14px] tabular-nums text-white/55",children:t})}function w9e(t){return[...new Set(t.map(e=>e.track))].sort((e,n)=>e-n)}function Pfe(t,e){const n=t.indexOf(e);return n<0?null:n+1}function YE(t){return t===null?"":` ${t}`}function O9e(t,e){return t?`Show track${e}`:`Hide track${e}`}function C9e(t){const e=t?KL:WE;return d.jsx(e,{size:14,weight:"bold","aria-hidden":"true"})}function Mfe({hidden:t,trackNumber:e,trackDisplayNumber:n,visible:r,onToggle:i}){if(!r)return d.jsx("span",{"aria-hidden":"true",className:"h-6 w-6 shrink-0"});const s=YE(n),a=O9e(t,s);return d.jsx("button",{type:"button","aria-label":a,title:a,className:`flex h-6 w-6 shrink-0 items-center justify-center rounded border-0 bg-transparent p-0 transition-colors focus-visible:outline focus-visible:outline-1 focus-visible:outline-offset-[-1px] focus-visible:outline-[#3CE6AC] ${t?"text-[#3CE6AC] hover:text-white":"text-white/35 hover:text-white/75"}`,onPointerDown:o=>o.stopPropagation(),onClick:o=>{o.stopPropagation(),i==null||i(e,!t,n)},children:C9e(t)})}function k9e({trackNumber:t,trackDisplayNumber:e,trackLabel:n,clipCount:r,showTrackLabel:i,isTrackHidden:s,isAudioTrack:a,onToggleTrackHidden:o,trailing:l}){return d.jsx(d.Fragment,{children:d.jsxs("div",{className:"flex min-w-0 items-center gap-1",children:[a&&d.jsx(vfe,{size:12,weight:"fill","aria-hidden":"true",className:"text-white/35"}),i&&d.jsx("span",{className:"min-w-0 break-words text-[11px] leading-tight",children:n}),i&&d.jsx(Tfe,{clipCount:r}),d.jsxs("div",{className:"ml-auto flex shrink-0 items-center gap-1",children:[d.jsx(Mfe,{hidden:s,trackNumber:t,trackDisplayNumber:e,visible:!a||s,onToggle:o}),l]})]})})}function Nfe(t){const e=new Set([...Zd(t).map(r=>r.id),...Array.from(t.querySelectorAll("[id]")).map(r=>r.id)]);if(!e.has("voiceover"))return"voiceover";let n=2;for(;e.has(`voiceover-${n}`);)n+=1;return`voiceover-${n}`}function Dfe(t){return typeof(t==null?void 0:t.then)=="function"}const Ife=Symbol("carve-aborted");function E9e(t,e,n){if(!n||e.sources.length<2)return e;const r=new Set(Zd(t).map(s=>s.id));if(e.sources.some(s=>r.has(s)))return e;const i=Nfe(t);return n(e.sources,i).then(()=>({...e,sources:[i]}))}function T9e(t,e,n){const r=t&&e?E9e(e,t,n):t;return Dfe(r)?r.catch(()=>Ife):r}function P9e(t,e){var r;const n=e?(r=t.get(e))==null?void 0:r.id:void 0;return new Set([e,n].filter(i=>!!i))}function M9e(t,e,n,r){const i=new Map(Zd(t).flatMap(l=>l.memberIds.map(c=>[c,l]))),s=P9e(i,r),a=new Set,o=[];for(const l of e){const c=i.get(l.id);if(s.has(l.id)||c&&s.has(c.id))continue;if(!c){n(l)&&o.push({id:l.id,label:l.id,kind:w0(l.id,l.getAttribute("src"))});continue}if(a.has(c.id))continue;const u=c.memberIds.map(f=>t.getElementById(f)).filter(f=>(f==null?void 0:f.tagName)==="AUDIO");u.some(n)&&(a.add(c.id),o.push({id:c.id,label:`${c.label} (${u.length})`,kind:w0(c.label,...u.flatMap(f=>[f.id,f.getAttribute("src")]))}))}return o}function N9e(t,e){var r;if(((r=e==null?void 0:e.tagName)==null?void 0:r.toLowerCase())===ya)return{couldBeBed:!1,autoBed:!1};const n=[t,e==null?void 0:e.getAttribute("src"),e==null?void 0:e.getAttribute("data-label")];return{couldBeBed:u_e(...n),autoBed:f_e(...n)}}function D9e(t,e,n){try{const r=e.getAttribute(XE);if(!r)return!1;const i=aue(JSON.parse(r)).sources;return zse(t,i).includes(n)}catch{return!1}}function I9e(t,e){if(!t||!e)return null;const r=Array.from(t.querySelectorAll(`[${XE}]`)).find(i=>i.id!==e&&D9e(t,i,e));return r?r.id||"another track":null}const Di=(t,e,n,r,i)=>({id:t,label:n,family:e,description:r,nodes:i}),RX=(t,e,n)=>[{type:t,label:n,params:{frequency:e,q:.707,poles:"2"}},{type:t,label:n,params:{frequency:e,q:.707,poles:"2"}}],nF=[Di("voice-clean","voice","Clean Voice","Cuts rumble and mud, evens out the level, adds a little clarity.",[{type:"highpass",label:"Remove Rumble",params:{frequency:80,q:.707,poles:"2"}},{type:"peaking",label:"Reduce Mud",params:{frequency:250,gain:-3,q:1.2}},{type:"compressor",label:"Even Out Loudness",params:{threshold:-20,ratio:3,attack:12,release:180,makeup:3}},{type:"peaking",label:"Add Clarity",params:{frequency:3e3,gain:2.5,q:1}},{type:"limiter",label:"Peak Ceiling",params:{limit:-1,attack:5,release:50}}]),Di("voice-broadcast","voice","Broadcast","Denser and more forward — a radio-presenter sound.",[{type:"highpass",label:"Remove Rumble",params:{frequency:90,q:.707,poles:"2"}},{type:"peaking",label:"Reduce Boxiness",params:{frequency:400,gain:-3,q:1.4}},{type:"compressor",label:"Even Out Loudness",params:{threshold:-24,ratio:4,attack:8,release:150,makeup:5}},{type:"peaking",label:"Add Clarity",params:{frequency:2500,gain:3,q:.9}},{type:"highshelf",label:"Add Air",params:{frequency:8e3,gain:2}},{type:"saturate",label:"Warmth",params:{type:"tanh",threshold:-12,output:0}},{type:"limiter",label:"Peak Ceiling",params:{limit:-1,attack:5,release:60}}]),Di("voice-warm","voice","Close & Warm","Intimate and lightly handled, for a voice close to the mic.",[{type:"highpass",label:"Remove Rumble",params:{frequency:70,q:.707,poles:"2"}},{type:"lowshelf",label:"Add Weight",params:{frequency:180,gain:2}},{type:"compressor",label:"Even Out Loudness",params:{threshold:-18,ratio:2.5,attack:20,release:250,makeup:2}},{type:"peaking",label:"Add Clarity",params:{frequency:3e3,gain:1.5,q:.8}},{type:"limiter",label:"Peak Ceiling",params:{limit:-1.5}}]),Di("rumble-cut","repair","Cut Rumble","Removes traffic, handling and air-conditioning from under a voice.",[{type:"highpass",label:"Cut Rumble",params:{frequency:100,q:.707,poles:"2"}}]),Di("room-gate","repair","Quiet Between Phrases","Silences the gaps between words. Room tone under speech stays — this closes the pauses, it does not remove noise.",[{type:"gate",label:"Silence the Gaps",params:{threshold:-45,range:-18,ratio:10,attack:2,release:180}}]),Di("boom-tame","repair","Tame Boominess","Takes out the chestiness of a voice too close to the mic.",[{type:"peaking",label:"Tame Boominess",params:{frequency:200,gain:-4,q:1.4}}]),Di("harsh-tame","repair","Soften Harshness","Rounds off a brittle upper-mid. Broad and always-on; sibilance proper wants the measuring version.",[{type:"peaking",label:"Soften Harshness",params:{frequency:3200,gain:-3,q:1.6}}]),Di("telephone","character","Telephone","Down the line — the narrow band of a phone call.",[...RX("highpass",300,"Strip the Bass"),...RX("lowpass",3400,"Strip the Treble"),{type:"peaking",label:"Phone Honk",params:{frequency:1200,gain:6,q:1.2}},{type:"peaking",label:"De-mud",params:{frequency:550,gain:-4,q:1}},{type:"saturate",label:"Circuit Grit",params:{type:"tanh",threshold:-9,output:-2}}]),Di("radio-am","character","AM Radio","Narrow, gritty and a little crushed.",[{type:"highpass",label:"Strip the Bass",params:{frequency:220,q:.707,poles:"2"}},{type:"lowpass",label:"Strip the Treble",params:{frequency:2200,q:.707,poles:"2"}},{type:"peaking",label:"IF Droop",params:{frequency:1200,gain:-5,q:.9}},{type:"lowshelf",label:"Boxy",params:{frequency:500,gain:4}},{type:"saturate",label:"Radio Grit",params:{type:"tanh",threshold:-8,output:-1}},{type:"bitcrush",label:"Carrier Hiss",params:{bits:8,samples:1,mix:.45}}]),Di("megaphone","character","Megaphone","Shouted through a horn, with the slap that comes with it.",[{type:"highpass",label:"Strip the Bass",params:{frequency:700,q:.707,poles:"2"}},{type:"lowpass",label:"Strip the Treble",params:{frequency:4e3,q:.707,poles:"2"}},{type:"peaking",label:"Horn Honk",params:{frequency:1900,gain:14,q:3}},{type:"peaking",label:"Horn Ring",params:{frequency:3200,gain:6,q:3}},{type:"saturate",label:"Overdrive",params:{type:"hard",threshold:-5,output:-3}},{type:"delay",label:"Horn Slap",params:{time:65,feedback:.2,mix:.28}}]),Di("lofi-tape","character","Tape","Worn, warm and slightly unsteady, like a played-out cassette.",[{type:"lowpass",label:"Tape Rolloff",params:{frequency:6500,q:.707,poles:"2"}},{type:"lowshelf",label:"Add Weight",params:{frequency:120,gain:2}},{type:"saturate",label:"Tape Warmth",params:{type:"tanh",threshold:-14,output:0}},{type:"bitcrush",label:"Tape Noise",params:{bits:12,samples:2,mix:.35}},{type:"chorus",label:"Wow & Flutter",params:{delay:6,depth:.6,speed:.4,mix:.15}}]),Di("pa-system","character","Tannoy","Announced across a concourse.",[{type:"highpass",label:"Strip the Bass",params:{frequency:250,q:.707,poles:"2"}},{type:"lowpass",label:"Strip the Treble",params:{frequency:5e3,q:.707,poles:"2"}},{type:"peaking",label:"Tannoy Honk",params:{frequency:2400,gain:9,q:2}},{type:"saturate",label:"Driver Grit",params:{type:"tanh",threshold:-10,output:-1}},{type:"reverb",label:"Concourse",params:{size:.54,damping:.48,wet:.25,dry:.8}}]),Di("intercom","character","Intercom","Buzzed through a door panel, squelch and all.",[{type:"gate",label:"Squelch",params:{threshold:-40,range:-30,ratio:10,attack:1,release:120}},{type:"highpass",label:"Strip the Bass",params:{frequency:500,q:.707,poles:"2"}},{type:"lowpass",label:"Strip the Treble",params:{frequency:3e3,q:.707,poles:"2"}},{type:"peaking",label:"Panel Honk",params:{frequency:2e3,gain:6,q:2}},{type:"bitcrush",label:"Crunch",params:{bits:11,samples:1,mix:.3}}]),Di("doofus-worble","character","Doofus Worble","Seasick and wobbling — no straight signal left.",[{type:"chorus",label:"Worble",params:{delay:14.6,depth:2.57,speed:10,mix:1}}]),Di("chipmunk","character","Chipmunk","Small, fast and squeaky.",[{type:"pitchshift",label:"Up High",params:{semitones:7,mix:1}},{type:"highshelf",label:"Extra Sparkle",params:{frequency:4e3,gain:3}}]),Di("giant","character","Giant","Huge, slow and deep.",[{type:"pitchshift",label:"Down Low",params:{semitones:-5,mix:1}},{type:"lowshelf",label:"Add Weight",params:{frequency:150,gain:4}},{type:"compressor",label:"Hold It Together",params:{threshold:-18,ratio:3,attack:10,release:120,knee:6,makeup:2,mix:1}}]),Di("monster","character","Monster","Deep, rough and too close.",[{type:"pitchshift",label:"Down Low",params:{semitones:-8,mix:1}},{type:"saturate",label:"Growl",params:{type:"tanh",threshold:-12,output:-1}},{type:"reverb",label:"Right Behind You",params:{size:.3,damping:.5,wet:.22,dry:.85}}]),Di("room-tight","space","Tight Room","A small hard room — presence without wash.",[{type:"reverb",label:"Tight Room",params:{size:.25,damping:.6,wet:.18,dry:.9}}]),Di("room-natural","space","Natural Room","Sounds recorded somewhere rather than nowhere.",[{type:"reverb",label:"Natural Room",params:{size:.5,damping:.5,wet:.25,dry:.85}}]),Di("hall","space","Hall","Long and open, for something that should sit far back.",[{type:"reverb",label:"Hall",params:{size:.9,damping:.3,wet:.4,dry:.75}}]),Di("slap-echo","space","Slap Echo","One quick repeat — rockabilly vocal, not a wash.",[{type:"delay",label:"Slap Echo",params:{time:110,feedback:.12,mix:.22}}]),Di("dub-throw","space","Dub Throw","Repeats that trail off well behind the beat.",[{type:"delay",label:"Dub Throw",params:{time:375,feedback:.55,mix:.3}}])];nF.map(t=>t.id);const _9e=new Map(nF.map(t=>[t.id,t]));function KE(t){return _9e.get(t)}const jX=["voice","repair","character","space"];function R9e(t){return nF.filter(e=>e.family===t)}function gM(t,e){const n=[];let r={...e,nodes:[...e.nodes]};for(const i of t.nodes){const s={type:i.type,id:dy(r),fromPreset:t.id,...i.label?{label:i.label}:{},enabled:!0,params:zd(i.type,i.params)};n.push(s),r={...r,nodes:[...r.nodes,s]}}return n}function rF(t,e,n={}){if(n.replaceChain)return{version:h0,nodes:gM(e,{version:h0,nodes:[]})};const r=t.nodes.findIndex(l=>l.fromPreset===e.id);if(r===-1)return{...t,nodes:[...t.nodes,...gM(e,t)]};const i=t.nodes.filter(l=>l.fromPreset!==e.id),s=i.slice(0,r),a=i.slice(r),o=gM(e,{...t,nodes:i});return{...t,nodes:[...s,...o,...a]}}const i0={gain:{title:"Volume",does:"Turns this track up or down.",reachFor:"It's too loud, or too quiet, against everything else.",primary:"gain",primaryEnds:{low:"Silent",high:"Louder"},params:{gain:{label:"Level",ends:{low:"Silent",high:"Louder"}}}},highpass:{title:"Remove Rumble",does:"Cuts the very bottom — traffic, footsteps, air conditioning, hands on the mic.",reachFor:"There's a low hum or thump under everything.",primary:"frequency",primaryEnds:{low:"Only the deepest",high:"Thins it out"},band:[20,300],params:{frequency:{label:"Cut below",hint:"Everything under this is removed.",ends:{low:"Only the deepest",high:"Thins it out"}},q:{label:"Sharpness",hint:"How abruptly the cut starts."},poles:{label:"Steepness",hint:"How fast it falls away below the point."}}},lowpass:{title:"Muffle",does:"Takes the top off, like the sound is coming through a door.",reachFor:"You want something to sound distant, or behind something else.",primary:"frequency",primaryEnds:{low:"Very muffled",high:"Barely changed"},band:[1e3,2e4],params:{frequency:{label:"Cut above",ends:{low:"Very muffled",high:"Barely changed"}},q:{label:"Sharpness"},poles:{label:"Steepness"}}},peaking:{title:"Shape One Range",does:"Lifts or lowers one part of the sound and leaves the rest alone.",reachFor:"One quality is wrong — boomy, boxy, harsh — but the rest is fine.",primary:"gain",primaryEnds:{low:"Take it out",high:"Bring it forward"},band:[20,2e4],params:{frequency:{label:"Where",hint:"Which part of the sound to change."},gain:{label:"How much",ends:{low:"Take it out",high:"Bring it forward"}},q:{label:"How wide",hint:"A narrow setting fixes one note; a wide one changes the whole character."}}},lowshelf:{title:"Bass",does:"More or less weight underneath everything.",reachFor:"It sounds thin, or too heavy.",primary:"gain",primaryEnds:{low:"Thinner",high:"Heavier"},band:[20,300],params:{frequency:{label:"Up to",hint:"Everything below this is lifted or dropped."},gain:{label:"How much",ends:{low:"Thinner",high:"Heavier"}}}},highshelf:{title:"Brightness",does:"More or less sparkle at the top.",reachFor:"It sounds dull, or too fizzy.",primary:"gain",primaryEnds:{low:"Duller",high:"Brighter"},band:[2e3,2e4],params:{frequency:{label:"From",hint:"Everything above this is lifted or dropped."},gain:{label:"How much",ends:{low:"Duller",high:"Brighter"}}}},compressor:{title:"Even Out Loudness",does:"Brings the quiet parts up and holds the loud parts down, so nothing jumps out at the listener.",reachFor:"Some parts are much louder than others.",primary:"strength",primaryEnds:{low:"Barely touched",high:"Very even, quite squashed"},params:{threshold:{label:"Starts working at",hint:"Anything louder than this gets held down."},ratio:{label:"How hard",hint:"How much of the excess is removed."},attack:{label:"How fast it grabs",ends:{low:"Instant",high:"Lets peaks through"}},release:{label:"How fast it lets go",ends:{low:"Snappy",high:"Smooth"}},knee:{label:"How gradual"},makeup:{label:"Volume back up",hint:"Compression makes things quieter; this puts the level back."},mix:{label:"Blend with the original"}}},limiter:{title:"Peak Ceiling",does:"Nothing gets louder than this, ever. A safety net at the end of the chain.",reachFor:"You want to be sure it never clips or spikes.",primary:"limit",primaryEnds:{low:"A lot of headroom",high:"Right up to the edge"},params:{limit:{label:"Never exceed",ends:{low:"A lot of headroom",high:"Right up to the edge"}},attack:{label:"How fast it catches"},release:{label:"How fast it recovers"},level_out:{label:"Level after"}}},gate:{title:"Silence the Gaps",does:"Mutes the pauses. Whatever sits underneath stays — this closes the gaps, it does not remove noise.",reachFor:"You can hear the room in the gaps.",primary:"strength",primaryEnds:{low:"Only true silence",high:"Cuts quiet parts too"},params:{threshold:{label:"Quieter than this is a gap"},range:{label:"How far to duck the gaps",hint:"Not all the way down, usually — total silence sounds broken."},ratio:{label:"How hard"},attack:{label:"How fast it opens"},release:{label:"How fast it closes",ends:{low:"Clips tails short",high:"Leaves tails intact"}},knee:{label:"How gradual"}}},saturate:{title:"Warmth",does:"Adds a little grit and density, the way analogue gear does.",reachFor:"It sounds clean but lifeless.",primary:"strength",primaryEnds:{low:"Just a sheen",high:"Openly distorted"},params:{type:{label:"Character",hint:"Different flavours of the same idea. Tanh is the gentle one."},threshold:{label:"How much drive",ends:{low:"Just a sheen",high:"Openly distorted"}},output:{label:"Level after",hint:"Drive makes things louder; this puts it back."},oversample:{label:"Quality",hint:"Higher costs more but sounds cleaner."}}},bitcrush:{title:"Lo-Fi",does:"Crushes the sound down to fewer steps, like an old sampler or a bad phone line.",reachFor:"You want it to sound cheap or digital on purpose.",primary:"strength",primaryEnds:{low:"Slightly gritty",high:"Destroyed"},params:{bits:{label:"How many steps",ends:{low:"Destroyed",high:"Clean"}},samples:{label:"How rough",hint:"Holds each value for longer, which dulls and grits it."},mix:{label:"Blend with the original"}}},pitchshift:{title:"Higher or Lower",does:"Shifts everything up or down without changing its speed.",reachFor:"It should sound squeakier, or deeper.",primary:"semitones",primaryEnds:{low:"Much deeper",high:"Much higher"},params:{semitones:{label:"How far",ends:{low:"Much deeper",high:"Much higher"}},mix:{label:"Blend with the original"}}},delay:{title:"Echo",does:"Repeats the sound after a gap.",reachFor:"You want space, or a rhythmic effect.",primary:"mix",primaryEnds:{low:"A hint",high:"Washed out"},params:{time:{label:"Gap between repeats"},feedback:{label:"How many repeats",ends:{low:"One",high:"Trails away for ages"}},mix:{label:"How loud",ends:{low:"A hint",high:"Washed out"}}}},reverb:{title:"Room",does:"Puts the sound somewhere, instead of nowhere.",reachFor:"It sounds dry and stuck to the speaker.",primary:"strength",primaryEnds:{low:"A small tight room",high:"A big open hall"},params:{size:{label:"How big the space is"},damping:{label:"How soft the walls are",ends:{low:"Hard and bright",high:"Soft and dark"}},wet:{label:"How much room"},dry:{label:"How much original"}}},chorus:{title:"Thicken",does:"Doubles the sound slightly out of tune, which makes it wider and less exact.",reachFor:"It sounds thin or too plain on its own.",primary:"mix",primaryEnds:{low:"Just wider",high:"Obviously wobbling"},params:{delay:{label:"Spread"},depth:{label:"How much wobble"},speed:{label:"How fast it wobbles"},mix:{label:"How much",ends:{low:"Just wider",high:"Obviously wobbling"}}}},phaser:{title:"Swirl",does:"A filter that sweeps up and down, giving a moving, hollow shimmer.",reachFor:"You want movement, or a 1970s flavour.",primary:"out_gain",primaryEnds:{low:"Subtle",high:"Strong"},params:{in_gain:{label:"Depth in"},out_gain:{label:"How strong",ends:{low:"Subtle",high:"Strong"}},delay:{label:"Where it sweeps"},decay:{label:"How resonant"},speed:{label:"How fast it sweeps"},type:{label:"Shape of the sweep"}}}},J1=[{from:20,to:80,name:"Rumble",says:"traffic, footsteps, handling"},{from:80,to:250,name:"Weight",says:"body, warmth, low end"},{from:250,to:600,name:"Mud",says:"boxy, muffled, cardboard"},{from:600,to:2e3,name:"Middle",says:"the body of the sound"},{from:2e3,to:5e3,name:"Presence",says:"definition, consonants"},{from:5e3,to:1e4,name:"Edge",says:"harshness, sibilance"},{from:1e4,to:2e4,name:"Air",says:"sparkle, openness"}];function j9e(t){if(!Number.isFinite(t))return;const e=J1[0],n=J1.at(-1);return e&&t=n.to?n:J1.find(r=>t>=r.from&&ttypeof t=="number"?t:e,Um=t=>{const e=ui(t);return e>=1e3?`${(e/1e3).toFixed(e%1e3===0?0:1)} kHz`:`${Math.round(e)} Hz`},KO=(t,e)=>t<.34?e[0]:t<.67?e[1]:e[2],yM={gain:t=>ui(t.gain)===0?"No change":ui(t.gain)>0?`Up ${ui(t.gain)} dB`:`Down ${Math.abs(ui(t.gain))} dB`,highpass:t=>`Cutting everything below ${Um(t.frequency)}`,lowpass:t=>`Muffled above ${Um(t.frequency)}`,peaking:t=>ui(t.gain)===0?`Sitting on ${Um(t.frequency)}, doing nothing yet`:`${ui(t.gain)>0?"Lifting":"Cutting"} ${Um(t.frequency)} by ${Math.abs(ui(t.gain))} dB`,lowshelf:t=>ui(t.gain)===0?"Doing nothing yet":`${ui(t.gain)>0?"More":"Less"} weight below ${Um(t.frequency)}`,highshelf:t=>ui(t.gain)===0?"Doing nothing yet":`${ui(t.gain)>0?"More":"Less"} sparkle above ${Um(t.frequency)}`,compressor:t=>`Evening out — ${KO(Math.min(1,(ui(t.ratio,3)-1)/7),["gentle","moderate","firm"])}`,limiter:t=>`Nothing louder than ${ui(t.limit,-1)} dB`,gate:t=>`Closing gaps quieter than ${ui(t.threshold,-45)} dB`,saturate:t=>`${KO(Math.min(1,Math.abs(ui(t.threshold,-6))/30),["A little","Some","Heavy"])} warmth`,bitcrush:t=>`Crushed to ${ui(t.bits,8)} bits`,pitchshift:t=>ui(t.semitones,0)===0?"Unchanged pitch":`${ui(t.semitones,0)>0?"Up":"Down"} ${Math.abs(ui(t.semitones,0))} semitones`,delay:t=>`Echo every ${ui(t.time,250)} ms`,reverb:t=>`${KO(ui(t.size,.7),["A small","A medium","A large"])} room, ${KO(ui(t.wet,.35),["lightly","moderately","heavily"])}`,chorus:t=>`Thickened${ui(t.mix,.5)>.6?", wobbling":""}`,phaser:()=>"Swirling"},F9e={voice:"Voice",repair:"Fix",character:"Character",space:"Space"};function _fe({trackKind:t,onPick:e,onAudition:n,onAuditionTracked:r}){const i=x.useRef(new Set),s=o=>{i.current.has(o)||(i.current.add(o),r==null||r(o))},a=t==="music"||t==="sfx"?jX.filter(o=>o!=="voice"):jX;return d.jsx("div",{className:"hf-fx-preset-menu space-y-1.5 rounded-[4px] border border-panel-border-input p-1.5",onMouseLeave:n?()=>n(null):void 0,onBlur:n?()=>n(null):void 0,children:a.map(o=>d.jsxs("div",{className:"hf-fx-preset-group space-y-0.5",children:[d.jsx("span",{className:"hf-fx-preset-group-label block font-mono text-[9px] uppercase tracking-wide text-panel-text-2",children:F9e[o]}),R9e(o).map(l=>d.jsxs("button",{type:"button",className:"hf-fx-preset-item block w-full rounded-[3px] bg-panel-surface py-1 pl-1.5 pr-8 text-left text-panel-text-1 hover:text-panel-text-0",title:`${l.description} (${l.nodes.length} effect${l.nodes.length===1?"":"s"})`,onClick:()=>e(l.id),onMouseEnter:()=>{s(l.id),n==null||n(l.id)},onFocus:()=>{s(l.id),n==null||n(l.id)},children:[d.jsx("span",{className:"hf-fx-preset-problem block truncate text-[10px]",children:L9e[l.id]??l.description}),d.jsxs("span",{className:"block truncate font-mono text-[9px] text-panel-text-2",children:[d.jsx("span",{className:"hf-fx-preset-name",children:l.label}),d.jsxs("span",{className:"hf-fx-preset-count",children:[" · ",l.nodes.length," effect",l.nodes.length===1?"":"s"]})]}),n?d.jsxs("span",{className:"hf-fx-preset-wave","aria-hidden":"true",children:[d.jsx("span",{}),d.jsx("span",{}),d.jsx("span",{}),d.jsx("span",{})]}):null]},l.id))]},o))})}function Ba(t,e={}){Pt(`audio_fx_${t}`,e)}function Rfe(t){return t.fromPreset?"preset":t.fromCarve?"carve":t.fromEq?"eq":t.fromLeveller?"leveller":"hand"}function $9e(t){const e=(t==null?void 0:t.nodes)??[],n=new Map;for(const r of e){const i=Rfe(r);n.set(i,(n.get(i)??0)+1)}return{node_count:e.length,nodes_from_preset:n.get("preset")??0,nodes_from_carve:n.get("carve")??0,nodes_from_eq:n.get("eq")??0,nodes_from_leveller:n.get("leveller")??0,nodes_by_hand:n.get("hand")??0,preset_count:new Set(e.map(r=>r.fromPreset).filter(Boolean)).size,bypassed_count:e.filter(r=>r.enabled===!1).length}}const zl=t=>({track_kind:t.trackKind??"unknown"});function B9e(t,e,n,r,i){Ba("preset_applied",{preset:t,family:e,node_count:n,mode:r,...zl(i)})}function V9e(t,e){Ba("preset_removed",{preset:t,...zl(e)})}function H9e(t,e,n){Ba("preset_amount",{preset:t,amount:e,...zl(n)})}function Q9e(t,e,n){Ba("preset_automated",{preset:t,enabled:e,...zl(n)})}function jfe(t,e){Ba("preset_auditioned",{preset:t,...zl(e)})}function xM(t,e,n,r){Ba("node_added",{effect:t,via:e,job:n??"none",...zl(r)})}function z9e(t,e,n){Ba("node_removed",{effect:t,origin:e,...zl(n)})}function Z9e(t,e,n){Ba("node_bypassed",{effect:t,bypassed:e,...zl(n)})}function G9e(t,e,n){Ba("node_moved",{effect:t,direction:e,...zl(n)})}function U9e(t,e,n,r,i){Ba("param_committed",{effect:t,param:e,value:n,surface:r,...zl(i)})}function X9e(t,e,n){Ba("profile_committed",{effect:t,strength:e,...zl(n)})}function W9e(t,e){Ba("carve_changed",{action:t,strength:e.strength,source_count:e.sourceCount})}function LX(t){Ba("leveller",{action:t})}function q9e(t,e){Ba("eq_changed",{band:t,value:e})}function Y9e(t,e,n){Ba("chain_observed",{...$9e(t),first_sight:e.firstSight,panel_edits:e.panelEdits,authored_outside:e.panelEdits===0,has_carve:e.hasCarve,has_automation:e.hasAutomation,...zl(n)})}function Lfe(t,e,n){const r=KE(e);if(!r)return null;const i=rF(t,r),s=t.nodes.some(a=>a.fromPreset===r.id);return B9e(r.id,r.family,r.nodes.length,s?"reapply":"append",{trackKind:n}),i}function Ffe(t,e,n){const r=x.useRef(null),i=x.useCallback(c=>{e&&(c?(r.current??(r.current=t),e(c(r.current)),n==null||n(!0)):r.current&&(n==null||n(!1),e(r.current),r.current=null))},[t,e,n]),s=x.useCallback(()=>r.current??t,[t]),a=x.useCallback(()=>{r.current=null,n==null||n(!1)},[n]),o=x.useRef(e);o.current=e;const l=x.useRef(n);return l.current=n,x.useEffect(()=>()=>{var c,u;r.current&&((c=l.current)==null||c.call(l,!1),(u=o.current)==null||u.call(o,r.current))},[]),{audition:i,clearAudition:a,storedChain:s}}const FX=260,Hh=8,K9e=160;function J9e(t){const e=Math.min(Math.max(t.left,Hh),Math.max(Hh,window.innerWidth-FX-Hh)),n=window.innerHeight-t.bottom,r=t.top,i=n<260&&r>n,s=(i?r:n)-Hh-4,a=Math.min(Math.max(K9e,s),window.innerHeight-Hh*2),o=l=>Math.max(Hh,Math.min(l,Math.max(Hh,window.innerHeight-a-Hh)));return{position:"fixed",left:e,width:FX,maxHeight:a,...i?{bottom:o(window.innerHeight-t.top+4)}:{top:o(t.bottom+4)}}}function e7e(t,e){const n=KE(e);return n?rF(t,n):t}function t7e({anchorRect:t,chain:e,trackKind:n,onClose:r,onChainChange:i,onChainPreview:s,onAuditionTransport:a,onOpenRack:o}){const l=x.useRef(null),{audition:c,clearAudition:u,storedChain:f}=Ffe(e,s,a);x.useEffect(()=>{const y=m=>{l.current&&!l.current.contains(m.target)&&r()};return document.addEventListener("pointerdown",y,!0),()=>document.removeEventListener("pointerdown",y,!0)},[r]);const h=y=>{const m=Lfe(f(),y,n);m&&(u(),i(m),r())},p=y=>{y.key==="Escape"&&(y.stopPropagation(),c(null),r())};return d.jsxs("div",{ref:l,role:"dialog","aria-label":"Effects",className:"z-[200] flex flex-col overflow-hidden rounded-md border border-white/10 bg-[#1b1b1f] p-2 shadow-xl",style:J9e(t),onKeyDown:p,onPointerDown:y=>y.stopPropagation(),children:[d.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto",children:d.jsx(_fe,{trackKind:n,onPick:h,onAudition:s?y=>c(y?m=>e7e(m,y):null):void 0,onAuditionTracked:y=>jfe(y,{trackKind:n})})}),d.jsxs("div",{className:"mt-2 flex shrink-0 items-center justify-between border-t border-white/10 pt-2 text-[10px] text-white/55",children:[d.jsx("button",{type:"button",className:"hover:text-white",onClick:()=>{r(),o()},children:"+ effect"}),d.jsx("button",{type:"button",className:"hover:text-white",onClick:()=>{r(),o()},children:"Open rack ›"})]})]})}function n7e(t,e){if(!t||t.length===0||t.some(r=>e>=r.start&&er.start).sort((r,i)=>r-i);return n.find(r=>r>e)??n[0]??null}function $fe(){const t=x.useRef(null);return(e,n)=>{const r=ue.getState();if(e){if(r.isPlaying||t.current!==null)return;t.current=r.currentTime;const s=n7e(n,r.currentTime);s!==null&&r.requestSeek(s),r.requestPlayback(!0);return}const i=t.current;i!==null&&(t.current=null,r.requestPlayback(!1,i))}}const r7e={width:256,height:160};function $X(t){const{left:e,top:n}=nj(t,{width:window.innerWidth,height:window.innerHeight},r7e,{offset:4});return{left:e,top:n}}function i7e({anchorRect:t,clipCount:e,defaultLabel:n,refusal:r,onCancel:i,onConfirm:s}){const[a,o]=x.useState(n??"Voiceover"),l=x.useRef(null);if(x.useEffect(()=>{var u;return(u=l.current)==null?void 0:u.select()},[]),r)return d.jsx("div",{role:"dialog","aria-label":"This track cannot be grouped",className:"z-[200] w-64 rounded-md border border-white/10 bg-[#1b1b1f] p-3 text-[11px] leading-snug text-white/75 shadow-xl",style:{position:"fixed",...$X(t)},onPointerDown:u=>u.stopPropagation(),onKeyDown:u=>{u.key==="Escape"&&(u.stopPropagation(),i())},children:d.jsx("p",{children:r})});const c=()=>s(a.trim()||n||"Voiceover");return d.jsxs("div",{role:"dialog","aria-label":"Name this group",className:"z-[200] w-64 rounded-md border border-white/10 bg-[#1b1b1f] p-3 text-[11px] text-white/75 shadow-xl",style:{position:"fixed",...$X(t)},onPointerDown:u=>u.stopPropagation(),onKeyDown:u=>{u.key==="Escape"&&(u.stopPropagation(),i()),u.key==="Enter"&&c()},children:[d.jsx("p",{className:"mb-1.5 font-medium text-white",children:"Name this group"}),d.jsx("input",{ref:l,type:"text","aria-label":"Group name",value:a,onChange:u=>o(u.currentTarget.value),className:"w-full rounded border border-white/20 bg-black/30 px-1.5 py-1 text-[11px] text-white outline-none focus:border-[#3CE6AC]"}),d.jsxs("p",{className:"mt-2 leading-snug",children:["Effects you add to the group apply to ",e===2?"both":`all ${e}`," clips at once, and they share one volume."]}),d.jsxs("div",{className:"mt-2.5 flex justify-end gap-1.5",children:[d.jsx("button",{type:"button",className:"rounded border border-white/20 px-2 py-1 text-[10px] text-white/75 hover:bg-white/10",onClick:i,children:"Cancel"}),d.jsx("button",{type:"button",className:"rounded border border-[#3CE6AC] bg-[#3CE6AC]/15 px-2 py-1 text-[10px] font-semibold text-[#3CE6AC] hover:bg-[#3CE6AC]/25",onClick:c,children:"Group"})]})]})}function s7e(t){if(!t)return{version:1,nodes:[]};try{return pE(t)}catch{return{version:1,nodes:[]}}}function T_(t){const[e,n]=x.useState(!1),r=x.useRef(null),[i,s]=x.useState(null),a=$fe(),o=x.useRef(!1),l=()=>{var f;s(((f=r.current)==null?void 0:f.getBoundingClientRect())??null),n(!0)};if(t.variant==="group-pointer")return d.jsxs("div",{className:"relative shrink-0",children:[d.jsx("button",{type:"button",tabIndex:-1,ref:r,"aria-label":"Effects — group these clips first",title:"Group these clips to add effects to all of them",className:"flex h-6 items-center justify-center rounded border-0 bg-transparent px-1 text-[10px] font-semibold text-white/35 hover:text-white/75",onPointerDown:f=>f.stopPropagation(),onClick:f=>{f.stopPropagation(),l()},children:"FX"}),e&&i&&Bl.createPortal(d.jsx(i7e,{refusal:t.refusal,anchorRect:i,clipCount:t.clipCount,defaultLabel:t.defaultLabel,onCancel:()=>n(!1),onConfirm:f=>{n(!1),t.onGroupClips(f)}}),document.body)]});const c=s7e(t.fxChainRaw),u=iCe(c).length;return d.jsxs("div",{className:"relative shrink-0",children:[d.jsxs("button",{type:"button",tabIndex:-1,ref:r,"aria-label":u>0?`Effects — ${u} applied`:"Effects",title:"Effects",className:`flex h-6 items-center justify-center gap-0.5 rounded border-0 bg-transparent px-1 text-[10px] font-semibold transition-colors ${e||u>0?"text-[#3CE6AC]":"text-white/35 hover:text-white/75"}`,onPointerDown:f=>f.stopPropagation(),onClick:f=>{f.stopPropagation(),l()},children:["FX",u>0?` ${u}`:""]}),e&&i&&Bl.createPortal(d.jsx(t7e,{anchorRect:i,chain:c,trackKind:t.trackKind,onClose:()=>n(!1),onChainChange:t.onChainChange,onChainPreview:t.onChainPreview,onAuditionTransport:f=>{var h;f&&(o.current=t.isMuted===!0),o.current&&((h=t.onSetMutedLive)==null||h.call(t,!f)),f||(o.current=!1),a(f,t.auditionSpans)},onOpenRack:t.onOpenRack}),document.body)]})}function Bfe({name:t,isExpanded:e,lanesId:n,onToggle:r}){return d.jsx("button",{type:"button",tabIndex:-1,"aria-expanded":e,"aria-controls":n,"aria-label":`${e?"Hide":"Show"} ${t} lanes`,title:`${e?"Hide":"Show"} lanes`,className:`ml-auto flex h-6 w-6 shrink-0 items-center justify-center rounded border-0 bg-transparent p-0 text-[11px] leading-none focus-visible:outline focus-visible:outline-1 focus-visible:outline-[#3CE6AC] ${e?"text-[#3CE6AC]":"text-white/55 hover:text-white"}`,onPointerDown:i=>i.stopPropagation(),onClick:i=>{i.stopPropagation(),r()},children:d.jsx("span",{"aria-hidden":"true",children:"∿"})})}function a7e({name:t,clipCount:e,isExpanded:n,gutterBackground:r,columnWidth:i,lanesId:s,onToggleClipExpanded:a,children:o}){return d.jsxs("div",{className:"absolute left-0 top-0 flex items-center gap-1.5 overflow-hidden px-1.5 text-[11px]",style:{width:i,height:Xi,color:"#ffffff",background:r},children:[d.jsx("span",{"aria-hidden":"true",className:"shrink-0 text-[13px] leading-none text-white/40",children:"◇"}),d.jsx("span",{className:"min-w-0 flex-1 break-words font-medium leading-tight",children:t}),d.jsx(Tfe,{clipCount:e}),o,d.jsx(Bfe,{name:t,isExpanded:n,lanesId:s,onToggle:a})]})}function aA(t){return String(Math.round(t*100)/100)}function o7e(t,e,n){var i,s;const r=n??((i=e.keyframes)==null?void 0:i.easeEach)??e.ease;return!r||r==="none"?t:((s=Qv.parseEase(r))==null?void 0:s(t))??t}function l7e(t,e){var n;return(((n=t.keyframes)==null?void 0:n.keyframes)??[]).filter(r=>e in r.properties).map(r=>({percentage:r.percentage,value:r.properties[e],ease:r.ease}))}function c7e(t,e){return typeof t.value!="number"||typeof e.value!="number"||t.percentage===e.percentage?null:{from:t.value,to:e.value}}function u7e(t,e,n){const r=l7e(t,e),i=r.filter(l=>l.percentage<=n).at(-1),s=r.find(l=>l.percentage>=n);if(!i)return s==null?void 0:s.value;if(!s)return i.value;const a=c7e(i,s);if(!a)return i.value;const o=(n-i.percentage)/(s.percentage-i.percentage);return a.from+(a.to-a.from)*o7e(o,t,s.ease)}function f7e(t,e,n){var s;const r=new Set;for(const a of((s=t.keyframes)==null?void 0:s.keyframes)??[])for(const o of Object.keys(a.properties))rl(o)===e&&r.add(o);const i={};for(const a of r){const o=u7e(t,a,n);o!==void 0&&(i[a]=o)}return i}function h7e(t,e){var r,i;if(t==="visual"&&("opacity"in e||"autoAlpha"in e))return"Opacity";if(t!=="other")return`${((r=t[0])==null?void 0:r.toUpperCase())??""}${t.slice(1)}`;const n=Object.keys(e)[0];return n?`${((i=n[0])==null?void 0:i.toUpperCase())??""}${n.slice(1)}`:"Other"}function d7e(t){return Object.values(t).map(e=>typeof e=="number"?aA(e):e).join(", ")}function p7e(t){const e=t.x,n=t.y;return typeof e=="number"&&typeof n=="number"?`${aA(e)}, ${aA(n)}`:null}function m7e(t){return typeof t.rotation=="number"?`${aA(t.rotation)}°`:null}function g7e(t){const e=t.opacity??t.autoAlpha;return typeof e=="number"?`${aA(Math.abs(e)<=1?e*100:e)}%`:null}const bM={position:p7e,rotation:m7e,visual:g7e};function BX(t,e){var n;return((n=bM[t])==null?void 0:n.call(bM,e))??d7e(e)}function y7e(t,e){return t.keyframes.reduce((n,r)=>!n||Math.abs(r.percentage-e){const r=ai(n);return r!==null&&xS(e,r,Yi(n))})}function b7e(t,e,n,r){var s;const i=((s=e.currentKeyframe)==null?void 0:s.animationId)??(n==null?void 0:n.animationId);return r??t.animations.find(a=>a.id===i)}function v7e(t,e,n,r,i){var s;return((s=t.currentKeyframe)==null?void 0:s.tweenPercentage)??(e?Nce(r,e):null)??aL(n,i)}function A7e(t,e,n,r,i){return t?{animationId:t.id,propertyGroup:e.group,tweenPercentage:n,properties:r,remove:i.currentKeyframe!==null}:null}function S7e(t,e,n){const r=Eoe(t.keyframes,n),i=y7e(t,n),s=x7e(t.animations,e),a=b7e(t,r,i,s),o=t.keyframes.filter(u=>u.animationId===(a==null?void 0:a.id)),l=v7e(r,a,o,e,n),c=a?f7e(a,t.group,l):{};return{navigation:r,values:c,label:h7e(t.group,c),toggleTarget:A7e(a,t,l,c,r)}}function w7e({navigation:t,label:e,expandedElement:n,onSeek:r,children:i}){const s="relative h-5 w-3 border-0 bg-transparent p-0 text-white/55 hover:text-white disabled:text-white/15 focus-visible:outline focus-visible:outline-1 focus-visible:outline-[#3CE6AC] before:absolute before:left-1/2 before:top-1/2 before:h-6 before:w-6 before:-translate-x-1/2 before:-translate-y-1/2 before:content-['']",a=o=>{o&&(r==null||r(n.start+o.percentage/100*n.duration))};return d.jsxs("span",{className:"flex shrink-0 items-center gap-0.5",children:[d.jsx("button",{type:"button","aria-label":`Previous ${e} keyframe`,disabled:!t.prevKeyframe,className:s,onClick:o=>{o.stopPropagation(),a(t.prevKeyframe)},children:"‹"}),i,d.jsx("button",{type:"button","aria-label":`Next ${e} keyframe`,disabled:!t.nextKeyframe,className:s,onClick:o=>{o.stopPropagation(),a(t.nextKeyframe)},children:"›"})]})}function O7e({lanesId:t,lane:e,laneIndex:n,isLastLane:r,expandedElement:i,currentTime:s,clipPercentage:a,gutterBackground:o,columnWidth:l,onTogglePropertyGroupKeyframe:c,onSeek:u,rovingTargetId:f=null}){const h=i.key??i.id,{navigation:p,values:y,label:m,toggleTarget:v}=S7e(e,s,a);return d.jsxs("div",{id:I6(t,K2(h,e.group),"header"),"data-timeline-focus-id":K2(h,e.group),"data-timeline-element-id":h,tabIndex:f===K2(h,e.group)?0:-1,"data-property-group":e.group,"data-timeline-lane-top":kg(n),className:"absolute left-0 flex items-center gap-1 overflow-hidden px-1.5 text-[10px] text-white/65",style:{top:kg(n),width:l,height:Cg,background:o},children:[d.jsxs("span",{className:"relative h-full w-3 shrink-0","aria-hidden":"true",children:[d.jsx("span",{className:"absolute left-1.5 top-0 w-px bg-white/15",style:{height:r?"50%":"100%"}}),d.jsx("span",{className:"absolute left-1.5 top-1/2 h-px w-1.5 bg-white/15"})]}),d.jsx("span",{className:"w-[46px] shrink-0 truncate text-white",title:m,children:m}),d.jsx(w7e,{navigation:p,label:m,expandedElement:i,onSeek:u,children:d.jsx("button",{type:"button","aria-pressed":!!p.currentKeyframe,"aria-label":`${p.currentKeyframe?"Remove":"Add"} ${m} keyframe`,title:`${p.currentKeyframe?"Remove":"Add"} ${m} keyframe`,className:"flex h-6 w-6 shrink-0 items-center justify-center border-0 bg-transparent p-0 text-[11px] text-[#3CE6AC] focus-visible:outline focus-visible:outline-1 focus-visible:outline-[#3CE6AC]",onClick:b=>{b.stopPropagation(),v&&(c==null||c(i,v))},children:p.currentKeyframe?"◆":"◇"})}),d.jsx("span",{className:"min-w-0 flex-1 truncate text-right tabular-nums text-white/45",title:BX(e.group,y),children:BX(e.group,y)})]})}function C7e({target:t,label:e,name:n,param:r,alsoAutomatedBy:i,top:s,isLastLane:a,gutterBackground:o,columnWidth:l,onRemove:c,isCarve:u,onReveal:f}){return d.jsxs("div",{"data-automation-lane-label":e,"data-timeline-lane-top":s,className:"absolute left-0 flex items-center gap-1 overflow-hidden px-1.5 text-[10px] text-white/65",style:{top:s,width:l,height:Pd,background:o},children:[d.jsxs("span",{className:"relative h-full w-3 shrink-0","aria-hidden":"true",children:[d.jsx("span",{className:"absolute left-1.5 top-0 w-px bg-white/15",style:{height:a?"50%":"100%"}}),d.jsx("span",{className:"absolute left-1.5 top-1/2 h-px w-1.5 bg-white/15"})]}),d.jsxs("button",{type:"button",tabIndex:-1,"aria-label":f?`Show ${e} in the effect rack`:void 0,title:f?`Show ${e} in the effect rack`:e,disabled:!f,className:"flex min-w-0 flex-1 flex-col justify-center rounded border-0 bg-transparent p-0 text-left leading-tight enabled:hover:text-white focus-visible:outline focus-visible:outline-1 focus-visible:outline-[#3CE6AC]",onPointerDown:h=>h.stopPropagation(),onClick:h=>{h.stopPropagation(),f==null||f()},children:[d.jsx("span",{"data-automation-lane-name":"",className:"truncate font-mono text-[9px] text-white/70",children:n}),r?d.jsx("span",{"data-automation-lane-param":"",className:"truncate font-mono text-[9px] text-white/40",children:r}):null,i?d.jsxs("span",{"data-automation-lane-also":"",className:"truncate text-[9px] text-[#F5C542]/80",title:`${i} is also fading this — the two multiply.`,children:[i," is also fading this."]}):null]}),c&&t!==null&&!u&&d.jsx("button",{type:"button","aria-label":`Remove ${e} automation`,title:`Remove ${e} automation`,className:"flex h-6 w-6 shrink-0 items-center justify-center border-0 bg-transparent p-0 text-[11px] text-white/35 hover:text-white focus-visible:outline focus-visible:outline-1 focus-visible:outline-[#3CE6AC]",onPointerDown:h=>h.stopPropagation(),onClick:h=>{h.stopPropagation(),c(t)},children:"×"})]})}const k7e="#3CE6AC59",E7e=14,VX="rgba(255,255,255,0.035)";function JO(t,e){return e?`linear-gradient(${VX}, ${VX}), ${t}`:t}function T7e({trackNumber:t,trackDisplayNumber:e,trackLabel:n,lanesId:r,contentOrigin:i,keyframeClip:s,trackElements:a,clipCount:o,isExpanded:l,animations:c,currentTime:u,isTrackHidden:f,isAudioTrack:h,isGroupMember:p=!1,theme:y,onToggleClipExpanded:m,onToggleTrackHidden:v,onTogglePropertyGroupKeyframe:b,onRemoveAutomationLane:w,onSeek:O,rovingTargetId:k=null}){const E=s?(u-s.start)/s.duration*100:0,T=s?FL(c,Ice(s),s.duration):[],N=i>=Fo,_=s?s.key??s.id:null,I=x.useMemo(()=>{var me;return(me=a.find(pe=>pe.audioGroup))==null?void 0:me.audioGroup},[a]),j=x.useMemo(()=>{var me;return(me=a.find(pe=>pe.audioGroupLabel))==null?void 0:me.audioGroupLabel},[a]),L=x.useMemo(()=>{var me;return(me=a.find(pe=>pe.audioGroupAutomation))==null?void 0:me.audioGroupAutomation},[a]),B=x.useMemo(()=>{var me;return(me=a.find(pe=>pe.audioGroupFxChain))==null?void 0:me.audioGroupFxChain},[a]),$=x.useMemo(()=>new Set(zf(I?[{id:I,tag:"audio",start:0,duration:0,track:0,...L?{automation:L}:{},...B?{fxChain:B}:{}}]:[]).map(me=>me.key)),[L,B,I]),z=ue(me=>me.setRevealedAudioFxTarget),Y=s?k6(s):null,W=x.useMemo(()=>zf(a).map(me=>{const pe=me.entries.find(ge=>(ge.element.key??ge.element.id)===_);return{key:me.key,label:me.key,name:me.name,param:me.param,target:(pe==null?void 0:pe.lane.target)??null,isCarve:(()=>{const ge=pe??me.entries[0];return ge?C_(ge.lane.target,GE(ge.element)):!1})()}}),[_,a]),J=T.length>0||W.length>0,ne=!!s&&J&&!h,le=o>1?`Track${YE(e)}`:(s==null?void 0:s.label)??(s==null?void 0:s.domId)??(s==null?void 0:s.id)??n,{onGroupClips:ie,onSetElementAttributeLive:q,onSetElementAttributeQuiet:F}=fS(),U=AS(),Z=h&&o===1&&a.length>0?a[0]:null,K=a.some(me=>me.audioGroup),ee=!h&&a.some(me=>me.tag.toLowerCase()==="video"),re=(me,pe,ge)=>{const Pe=pe.nodes.length?xu(pe):null;ge?q==null||q(me,Ws,Pe):F==null||F(me,Ws,Pe,"Apply preset")},Q=me=>{U==null||U.handleTimelineElementSelect(me)},H=a.map(k6),se=H.every(me=>me!==null)?H:null,fe=((se==null?void 0:se.length)??0)>=2,be=me=>{var ge;const pe=(ge=U==null?void 0:U.previewIframeRef.current)==null?void 0:ge.contentDocument;!pe||!ie||!se||se.length<2||ie(se,Nfe(pe),me)};return d.jsxs("div",{role:"rowheader","aria-colindex":1,className:"sticky left-0 z-[12] shrink-0",style:{width:N?Fo:i,background:JO(y.gutterBackground,p),borderRight:`1px solid ${y.gutterBorder}`,...p?{borderLeft:`2px solid ${k7e}`,paddingLeft:E7e}:{}},children:[ne?d.jsx(d.Fragment,{children:d.jsx(a7e,{name:le,clipCount:o,isExpanded:l,gutterBackground:JO(y.gutterBackground,p),columnWidth:N?Fo:i,lanesId:r,onToggleClipExpanded:m,children:d.jsx(Mfe,{hidden:f,trackNumber:t,trackDisplayNumber:e,visible:!h||f,onToggle:v})})}):d.jsx(d.Fragment,{children:d.jsx("div",{className:N?"flex flex-col justify-center gap-0.5 px-1.5 text-white/55":"flex flex-col items-center justify-center gap-0.5",style:{height:Xi},children:d.jsx(k9e,{trackNumber:t,trackDisplayNumber:e,trackLabel:n,clipCount:o,showTrackLabel:N,isTrackHidden:f,isAudioTrack:h,onToggleTrackHidden:v,trailing:d.jsxs(d.Fragment,{children:[Z&&d.jsx(T_,{variant:"chain",fxChainRaw:Z.fxChain,trackKind:w0(Z.id,Z.src),onChainChange:me=>re(Z,me,!1),onChainPreview:me=>re(Z,me,!0),auditionSpans:[Z],isMuted:f,onSetMutedLive:me=>q==null?void 0:q(Z,"data-hidden",me?"":null),onOpenRack:()=>Q(Z)}),o>1&&!K&&(h?fe:ee)&&d.jsx(T_,{variant:"group-pointer",clipCount:a.length,defaultLabel:n,refusal:h?void 0:"Video audio can't be grouped yet — only audio clips can join a group.",onGroupClips:be}),J&&d.jsx(Bfe,{name:le,isExpanded:l,lanesId:r,onToggle:m})]})})})}),l&&s&&T.map((me,pe)=>d.jsx(O7e,{lanesId:r,lane:me,laneIndex:pe,isLastLane:pe===T.length-1&&W.length===0,expandedElement:s,currentTime:u,clipPercentage:E,gutterBackground:JO(y.gutterBackground,p),columnWidth:N?Fo:i,onTogglePropertyGroupKeyframe:b,onSeek:O,rovingTargetId:k},me.group)),l&&W.map((me,pe)=>{const ge=me.target;return d.jsx(C7e,{target:me.target,label:me.label,name:me.name,param:me.param,alsoAutomatedBy:$.has(me.key)?j??I:void 0,top:kg(T.length)+pe*Pd,isLastLane:pe===W.length-1,gutterBackground:JO(y.gutterBackground,p),columnWidth:N?Fo:i,onRemove:w,isCarve:me.isCarve,onReveal:ge&&Y&&s?()=>{Q(s),z({elementKey:Y,automationTarget:ge})}:void 0},me.key)})]})}function Vfe({index:t,rowKey:e,logicalRow:n,propertyRows:r,lanesId:i,headerLanesId:s,top:a,height:o,virtualized:l,background:c,borderColor:u,rovingTargetId:f=null,children:h}){return d.jsxs("div",{role:"rowgroup","data-index":t,"data-timeline-row":t,"data-timeline-row-key":e,className:l?"absolute left-0 right-0":"relative",style:{top:l?a:void 0,height:o,background:c,borderBottom:`1px solid ${u}`},children:[d.jsx("div",{role:"row","aria-rowindex":n.logicalIndex+1,"aria-level":n.level,"aria-expanded":n.expandable?n.expanded:void 0,"data-timeline-logical-row-id":n.id,"data-timeline-focus-id":n.id,tabIndex:f===n.id?0:-1,className:"flex",style:{height:o},children:h}),r.map(p=>{const y=p.propertyGroup,m=p.items.filter(b=>b.kind==="keyframe").length,v=p.items.filter(b=>b.kind==="ease").length;return d.jsxs("div",{role:"row","aria-rowindex":p.logicalIndex+1,"aria-level":p.level,"data-property-group":y,"data-timeline-logical-row-id":p.id,className:"sr-only",children:[d.jsx("div",{role:"rowheader","aria-colindex":1,"aria-owns":I6(s,p.id,"header"),children:y}),d.jsxs("div",{role:"gridcell","aria-colindex":2,"aria-owns":I6(i,p.id,"content"),children:[m," keyframes, ",v," ease controls"]})]},p.id)})]})}function P7e({label:t,memberCount:e,onOpenFxRack:n}){return d.jsxs("button",{type:"button",tabIndex:-1,"aria-label":`Open ${t} effects`,title:"Open effects",className:"flex h-6 min-w-0 items-center gap-1.5 rounded border-0 bg-transparent p-0 text-left text-[11px] text-white hover:text-[#3CE6AC] focus-visible:outline focus-visible:outline-1 focus-visible:outline-[#3CE6AC]",onPointerDown:r=>r.stopPropagation(),onClick:r=>{r.stopPropagation(),n()},children:[d.jsx("span",{"aria-hidden":"true",className:"shrink-0 text-[12px] leading-none text-white/50",children:"▤"}),d.jsx("span",{className:"min-w-0 break-words text-left font-medium leading-tight",children:t}),d.jsx("span",{className:"shrink-0 rounded-full bg-white/10 px-1 text-[9px] leading-[14px] tabular-nums text-white/55","aria-hidden":"true",title:`${e} tracks`,children:e})]})}function M7e({label:t,memberCount:e,isExpanded:n,onToggleExpanded:r,laneCount:i,isLaneOpen:s,onToggleLanes:a,fxChain:o,onFxChainChange:l,onFxChainPreview:c,auditionSpans:u,onOpenFxRack:f,columnWidth:h,theme:p}){return d.jsxs("div",{role:"rowheader","aria-colindex":1,className:"sticky left-0 z-[12] flex shrink-0 items-center gap-1.5 overflow-hidden px-1.5 text-[11px]",style:{width:h,height:Xi,color:"#ffffff",background:p.gutterBackground,borderRight:`1px solid ${p.gutterBorder}`},children:[d.jsx("button",{type:"button",tabIndex:-1,"aria-expanded":n,"aria-label":`${n?"Hide":"Show"} ${t} tracks`,title:`${n?"Hide":"Show"} tracks`,className:`flex h-6 w-6 shrink-0 items-center justify-center rounded border-0 bg-transparent p-0 font-mono text-[13px] focus-visible:outline focus-visible:outline-1 focus-visible:outline-[#3CE6AC] ${n?"text-white":"text-white/55 hover:text-white"}`,onPointerDown:y=>y.stopPropagation(),onClick:y=>{y.stopPropagation(),r()},children:d.jsx("span",{"aria-hidden":"true",children:n?"▾":"▸"})}),d.jsx(P7e,{label:t,memberCount:e,onOpenFxRack:f}),d.jsxs("div",{className:"ml-auto flex shrink-0 items-center gap-1.5",children:[d.jsx(T_,{fxChainRaw:o,onChainChange:l,onChainPreview:c,auditionSpans:u,onOpenRack:f}),i>0&&d.jsxs("button",{type:"button",tabIndex:-1,"aria-expanded":s,"aria-label":`${s?"Hide":"Show"} ${t} lanes`,title:`${s?"Hide":"Show"} lanes`,className:`ml-auto flex h-6 items-center justify-center gap-0.5 rounded border-0 bg-transparent px-1 text-[11px] leading-none focus-visible:outline focus-visible:outline-1 focus-visible:outline-[#3CE6AC] ${s?"text-[#3CE6AC]":"text-white/55 hover:text-white"}`,onPointerDown:y=>y.stopPropagation(),onClick:y=>{y.stopPropagation(),a()},children:[d.jsx("span",{"aria-hidden":"true",children:"∿"}),d.jsx("span",{className:"text-[9px] tabular-nums text-white/55",children:i})]})]})]})}function Hfe(t,e){return{id:t.id,domId:t.id,label:t.label,tag:"audio",start:0,duration:e,track:t.anchorKey,...t.automation?{automation:t.automation}:{},...t.fxChain?{fxChain:t.fxChain}:{}}}const N7e=33;function iF(){const t=ue(i=>i.currentTime),e=ue(i=>i.isPlaying),n=x.useRef(t),[,r]=x.useState(0);return e||(n.current=t),x.useEffect(()=>{if(!e)return;let i=0;const s=xa.subscribe(a=>{n.current=a,i||(i=setTimeout(()=>{i=0,r(o=>o+1)},N7e))});return()=>{s(),i&&clearTimeout(i)}},[e]),e?n.current:t}function D7e({groupElement:t,groupLabel:e,top:n,columnWidth:r,gutterBackground:i,accentColor:s,onReveal:a}){const o=iF(),l=zf([t]);return d.jsx(d.Fragment,{children:l.map((c,u)=>{var y;const f=(y=c.entries[0])==null?void 0:y.lane;if(!f)return null;const h={name:c.name,param:c.param},p=Bf(f,o);return d.jsxs("button",{type:"button",tabIndex:-1,"data-group-lane-label":f.target,"aria-label":`Show ${e} ${h.name}${h.param?` ${h.param}`:""} in the effect rack`,className:"absolute left-0 flex items-center gap-1.5 overflow-hidden border-0 px-1.5 text-left text-[10px] text-white/65 hover:text-white focus-visible:outline focus-visible:outline-1 focus-visible:outline-[#3CE6AC]",style:{top:n+u*Pd,width:r,height:Pd,background:i,borderLeft:`2px solid ${s}`},title:`${e} · ${h.param?`${h.name} · ${h.param}`:h.name}`,onPointerDown:m=>m.stopPropagation(),onClick:m=>{m.stopPropagation(),a==null||a(f.target)},children:[d.jsx("span",{"aria-hidden":"true",className:"shrink-0 text-[11px] text-white/40",children:"▤"}),d.jsxs("span",{className:"flex min-w-0 flex-1 flex-col justify-center leading-tight",children:[d.jsx("span",{className:"truncate font-mono text-[9px] text-white/70",children:h.name}),h.param?d.jsx("span",{className:"truncate font-mono text-[9px] text-white/40",children:h.param}):null]}),d.jsx("span",{className:"shrink-0 font-mono text-[9px] tabular-nums text-white/55",children:p.toFixed(2)})]},f.target)})})}const HX="#3CE6AC";function I7e({index:t,rowKey:e,group:n,logicalRow:r,top:i,height:s,virtualized:a,contentOrigin:o,theme:l,rovingTargetId:c=null,collapsedGroupIds:u,expandedLaneOwnerIds:f,toggleGroupExpanded:h,toggleLaneOwnerExpanded:p,lanes:y,pps:m,currentTime:v,compositionDuration:b,beatTimes:w,contentGutter:O,trackContentWidth:k}){var W;const E=n.memberElements,T=Hfe(n,b),N=((W=qce())==null?void 0:W.domEditSelection)??null,_=(N==null?void 0:N.id)===n.id,I=f.has(n.id),{onSetAudioGroupAttributeLive:j,onSetAudioGroupAttributeQuiet:L}=fS(),B=AS(),$=ue(J=>J.setRevealedAudioFxTarget),z=(J,ne)=>{const le=J.nodes.length?xu(J):null;ne?j==null||j(n.id,Ws,le):L==null||L(n.id,Ws,le,"Apply preset")},Y=J=>{const ne=B==null?void 0:B.handleTimelineElementSelect(T);!ne||!J||ne.then(()=>$({elementKey:n.id,automationTarget:J}))};return d.jsxs(Vfe,{index:t,rowKey:e,logicalRow:r,propertyRows:[],lanesId:"",headerLanesId:"",top:i,height:s,virtualized:a,background:l.rowBackground,borderColor:l.rowBorder,rovingTargetId:c,children:[d.jsxs("div",{className:"sticky left-0 z-[12] shrink-0",style:{width:o>=Fo?Fo:o},children:[d.jsx(M7e,{label:n.label,memberCount:n.memberTracks.length,isExpanded:!u.has(n.id),onToggleExpanded:()=>h(n.id),laneCount:zf([T]).length,isLaneOpen:I,onToggleLanes:()=>p(n.id),fxChain:n.fxChain,onFxChainChange:J=>z(J,!1),onFxChainPreview:J=>z(J,!0),auditionSpans:E,onOpenFxRack:()=>Y(),columnWidth:o>=Fo?Fo:o,theme:l}),I&&d.jsx(D7e,{groupElement:T,groupLabel:n.label,top:Xi,columnWidth:o>=Fo?Fo:o,gutterBackground:l.gutterBackground,accentColor:HX,onReveal:Y})]}),I&&d.jsx("div",{role:"gridcell","aria-colindex":2,style:{width:k,marginLeft:O},className:"relative",children:d.jsx(Wce,{elements:[T],isSelected:()=>_,lanes:y,pps:m,laneCount:0,topOffset:Xi,accentColor:HX,currentTime:v,beatTimes:w})})]})}function _7e(){return{collapsedGroupIds:ue(t=>t.collapsedGroupIds),expandedLaneOwnerIds:ue(t=>t.expandedLaneOwnerIds),toggleGroupExpanded:ue(t=>t.toggleGroupExpanded),toggleLaneOwnerExpanded:ue(t=>t.toggleLaneOwnerExpanded)}}function R7e(t,e){const n=x.useMemo(()=>{const i=new Map;for(const s of t){const a=i.get(s.physicalTrackKey)??[];a.push(s),i.set(s.physicalTrackKey,a)}return i},[t]),r=x.useMemo(()=>new Map(e.map(i=>[i.anchorKey,i])),[e]);return{logicalRowsByTrack:n,groupByAnchor:r}}function j7e(){const t=ue(i=>i.expandedClipIds),e=ue(i=>i.expandClips),n=ue(i=>i.setClipExpanded),r=ue(i=>i.toggleClipExpanded);return{toggleRowExpanded:i=>{const s=!i.some(a=>t.has(a));if(PZ({expanded:s}),s)e(i);else for(const a of i)n(a,!1)},toggleClipExpanded:i=>{PZ({expanded:!t.has(i)}),r(i)}}}function Qfe(t){return o3e()}function L7e(t){const e=new Map,n=new Map,r=new Map,i=new Map,s=new Map,a=new Map,o=new Map;for(const[l,c]of t){const u=c.find(h=>h.audioGroup);if(!(u!=null&&u.audioGroup))continue;e.set(l,u.audioGroup),r.has(u.audioGroup)||(r.set(u.audioGroup,u.audioGroupLabel??u.audioGroup),i.set(u.audioGroup,u.audioGroupVolume??1),s.set(u.audioGroup,u.audioGroupHidden??!1),a.set(u.audioGroup,u.audioGroupFxChain),o.set(u.audioGroup,u.audioGroupAutomation));const f=n.get(u.audioGroup)??[];f.push(l),n.set(u.audioGroup,f)}return{trackToGroupId:e,memberTracksByGroup:n,labelByGroup:r,volumeByGroup:i,hiddenByGroup:s,fxChainByGroup:a,automationByGroup:o}}function F7e(t,e,n,r){const i=[...n.memberTracksByGroup.get(t)??[]].sort((o,l)=>o-l),s=n.fxChainByGroup.get(t),a=n.automationByGroup.get(t);return{id:t,label:n.labelByGroup.get(t)??t,anchorKey:(i[0]??e)-.5,memberTracks:i,memberElements:i.flatMap(o=>r.get(o)??[]),volume:n.volumeByGroup.get(t)??1,hidden:n.hiddenByGroup.get(t)??!1,...s?{fxChain:s}:{},...a?{automation:a}:{}}}function $7e(t,e,n,r,i){r.push([t.anchorKey,[]]);for(const s of t.memberTracks)n.set(s,t),i&&r.push([s,e.get(s)??[]])}function B7e(t,e){const n=L7e(t),r=new Map(t),i=[],s=new Map,a=new Set,o=[];for(const[l,c]of t){const u=n.trackToGroupId.get(l);if(!u){o.push([l,c]);continue}if(a.has(u))continue;a.add(u);const f=F7e(u,l,n,r);i.push(f),$7e(f,r,s,o,!e.has(u))}return{tracks:o,groups:i,trackGroupOf:s}}function V7e(t){const e=x.useMemo(()=>{const l=new Map;for(const c of t){const u=l.get(c.track)??[];u.push(c),l.set(c.track,u)}return Array.from(l.entries()).sort(([c],[u])=>c-u)},[t]),n=ue(l=>l.collapsedGroupIds),{tracks:r,groups:i,trackGroupOf:s}=x.useMemo(()=>B7e(e,n),[e,n]),a=x.useMemo(()=>{var c;const l=new Map;for(const[u,f]of r)l.set(u,Qfe(((c=f[0])==null?void 0:c.tag)??""));return l},[r]),o=x.useMemo(()=>r.map(([l])=>l),[r]);return{tracks:r,trackStyles:a,trackOrder:o,groups:i,trackGroupOf:s}}function H7e(t){return zf([Hfe(t,0)]).length}function Q7e(t,e,n){return((e==null?void 0:e.length)??0)<2?!1:n.selectedElementId?t.some(r=>(r.key??r.id)===n.selectedElementId):t.some(r=>n.isMusicTrack(r))}function z7e(t){return Jo(t)?Zce(t).length:0}function Z7e(t){return zf(t).length}function G7e(t,e){return t.some(n=>e.has(n.key??n.id))}function sF(t,e,n,r,i=z7e){const s=l=>(e.get(l.key??l.id)??0)+i(l),a=t.filter(l=>s(l)>=1);if(a.length===0)return null;const o=a.find(l=>{const c=l.key??l.id;return c===n||r.has(c)});return o||a.reduce((l,c)=>s(c)>s(l)?c:l)}function U7e(t,e){const n=new Map;for(const[,r]of t)for(const i of r){const s=i.key??i.id,a=new Set;for(const o of e.get(s)??[])for(const l of zE(o))a.add(l);n.set(s,a.size)}return n}function X7e(t,e,n,r){if(n.length===0)return e;const i=new Map(n.map(s=>[s.anchorKey,s]));return t.map(([s],a)=>{const o=i.get(s);return!o||!r.has(o.id)?e[a]??Xi:Xi+H7e(o)*Pd})}function W7e(t,e,n,r,i){const s=ue(u=>u.expandedClipIds),a=ue(u=>u.expandedLaneOwnerIds),{laneCounts:o,rowGeometry:l}=x.useMemo(()=>{const u=U7e(t,e),f=t.map(([,p])=>{const y=sF(p,u,n,r);if(!y)return[];const m=y.key??y.id,v=p.find(b=>s.has(b.key??b.id));return[{clipId:v?v.key??v.id:m,laneCount:u.get(m)??0,automationLaneCount:Z7e(p)}]}),h=X7e(t,T3e(f,s),i,a);return{laneCounts:u,rowGeometry:Bj(t.map(([p])=>p),h)}},[s,a,e,i,t,n,r]),c=x.useRef(l);return c.current=l,{laneCounts:o,rowGeometry:l,rowGeometryRef:c,rowHeights:l.rowHeights}}function q7e(t,e,n,r){const{tracks:i,trackStyles:s,trackOrder:a,groups:o,trackGroupOf:l}=V7e(t),c=x.useRef(a);c.current=a;const{laneCounts:u,rowGeometry:f,rowGeometryRef:h,rowHeights:p}=W7e(i,e,n,r,o);return{tracks:i,trackStyles:s,trackOrder:a,trackOrderRef:c,laneCounts:u,rowGeometry:f,rowGeometryRef:h,rowHeights:p,groups:o,trackGroupOf:l}}function Y7e(t,e){return x.useMemo(()=>t.map(n=>{const r=e.getRowIndex(n);return r<0?Xi:e.getRowHeight(r)}),[t,e])}function K7e(t,e){return x.useMemo(()=>{if(!(t!=null&&t.started)||e.includes(t.previewTrack))return e;const n=t.previewTrack,r=[];let i=!1;for(const s of e)!i&&Number.isInteger(s)&&s>n&&(r.push(n),i=!0),r.push(s);return i||r.push(n),r},[t,e])}function J7e(t,e,n){const r=K7e(t,e),i=Y7e(r,n),s=x.useMemo(()=>Bj(r,i),[r,i]);return{displayTrackOrder:r,displayRowHeights:s.rowHeights,rowGeometry:s,totalH:s.canvasHeight}}function aF(t){return t.dragStarted&&t.selectedKeys.size>1&&t.selectedKeys.has(t.draggedKey)}function zfe(t){return aF(t)?t.draggedPreviewStart-t.draggedOriginStart:0}function Zfe(t,e){return aF(e)&&t!==e.draggedKey&&e.selectedKeys.has(t)}function eje(t,e,n){if(!Zfe(t,n))return 0;const r=Number.isFinite(e)?e:0;return zfe(n)*r}function tje(t,e){if(e.length===0)return t;const n=Math.min(...e),r=n===0?0:-n;return t/g,">")}function rje(t){return t.replace(/"/g,'"').replace(/</g,"<").replace(/>/g,">").replace(/&/g,"&")}function ije(t){const e=[];let n="",r=null,i=!1,s=0;for(const a of t){if(i){n+=a,a===";"&&(i=!1);continue}if(a==="&"){i=!0,n+=a;continue}if(r){n+=a,a===r&&(r=null);continue}if(a==='"'||a==="'"){r=a,n+=a;continue}if(a==="("){s+=1,n+=a;continue}if(a===")"){s=Math.max(0,s-1),n+=a;continue}if(a===";"&&s===0){e.push(n),n="";continue}n+=a}return n&&e.push(n),e}function sje(t,e,n,r){const s=new RegExp(`(<[^>]*\\bid=(["'])${da(e)}\\2[^>]*)>`,"i").exec(t);if(!s)return t;const a=s[1];return Gfe(t,a,n,r)}function Gfe(t,e,n,r){if(!e)return t;const i=/\bstyle=(["'])([\s\S]*?)\1/.exec(e);if(i){const s=i[2],a=i[1],o=new Map;for(const u of ije(s)){const f=u.indexOf(":");if(f<0)continue;const h=u.slice(0,f).trim(),p=u.slice(f+1).trim();h&&o.set(h,p)}r===null?o.delete(n):o.set(n,r);const l=Array.from(o.entries()).map(([u,f])=>`${u}: ${QX(f,a)}`).join("; "),c=e.replace(i[0],`style=${a}${l}${a}`);return t.replace(e,c)}else{if(r===null)return t;const s=/\s*\/$/.test(e),o=`${s?e.replace(/\s*\/$/,""):e} style="${n}: ${QX(r,'"')}"${s?" /":""}`;return t.replace(e,o)}}function aje(t,e,n,r){const i=Gf(t,e);if(!i)return t;const s=Gfe(i.tag,i.tag,n,r);return nv(t,i,s)}function nv(t,e,n){return`${t.slice(0,e.start)}${n}${t.slice(e.end)}`}function vM(t,e,n){const i=new RegExp(`(<[^>]*\\b${e}=(["'])${da(n)}\\2[^>]*)>`,"i").exec(t);return(i==null?void 0:i.index)==null?null:{tag:i[1],start:i.index,end:i.index+i[1].length}}function oje(t,e){var l;const n=(l=e.selector)==null?void 0:l.match(/^\.([a-zA-Z0-9_-]+)$/);if(!n)return null;const r=n[1],i=new RegExp(`(<[^>]*\\bclass=(["'])[^"']*\\b${da(r)}\\b[^"']*\\2[^>]*)>`,"gi"),s=e.selectorIndex??0;let a,o=0;for(;(a=i.exec(t))!==null;){if(o===s&&a.index!=null)return{tag:a[1],start:a.index,end:a.index+a[1].length};o+=1}return null}function Gf(t,e){if(e.hfId){const r=vM(t,"data-hf-id",e.hfId);if(r)return r}if(e.id){const r=vM(t,"id",e.id);if(r)return r}if(!e.selector)return null;const n=e.selector.match(/^\[data-composition-id="([^"]+)"\]$/);if(n){const r=vM(t,"data-composition-id",n[1]);if(r)return r}return oje(t,e)}function P_(t,e,n){const r=Gf(t,e);if(!r)return;const i=n.startsWith("data-")?n:`data-${n}`,s=new RegExp(`\\b${i}=(["'])([^"']*)\\1`).exec(r.tag);return(s==null?void 0:s[2])!=null?rje(s[2]):void 0}function SS(t,e){const n=Gf(t,e);return n==null?void 0:n.tag}function lje(t,e,n,r){const i=Gf(t,e);if(!i)return t;const s=n.startsWith("data-")?n:`data-${n}`,a=new RegExp(`\\b${da(s)}=(["'])([^"']*)\\1`),o=i.tag;if(r===null){if(!new RegExp(`\\b${da(s)}(?:=(["'])[^"']*\\1)?`).test(o))return t;const f=new RegExp(`\\s+${da(s)}(?:=(["'])[^"']*\\1)?`),h=o.replace(f,"");return nv(t,i,h)}const l=oF(r);if(a.test(o)){const u=o.replace(a,`${s}="${l}"`);return nv(t,i,u)}const c=o+` ${s}="${l}"`;return nv(t,i,c)}function cje(t,e,n,r){const s=new RegExp(`(<[^>]*\\bid=(["'])${da(e)}\\2[^>]*)>`,"i").exec(t);if(!s)return t;const a=s[1],o=n.startsWith("data-")?n:`data-${n}`,l=new RegExp(`\\b${da(o)}=(["'])([^"']*)\\1`);if(r===null){if(!new RegExp(`\\b${da(o)}(?:=(["'])[^"']*\\1)?`).test(a))return t;const f=new RegExp(`\\s+${da(o)}(?:=(["'])[^"']*\\1)?`),h=a.replace(f,"");return t.replace(a,h)}const c=oF(r);if(l.test(a)){const u=a.replace(l,`${o}="${c}"`);return t.replace(a,u)}else{const u=a+` ${o}="${c}"`;return t.replace(a,u)}}function uje(t,e,n){const i=new RegExp(`(<([a-z0-9-]+)[^>]*\\bid=(["'])${da(e)}\\3[^>]*>)`,"i").exec(t);if(!i||i.index==null)return t;const s=i[1],a=i[2],o=i.index+s.length,l=Ufe(t,a,o);return l<0?t:`${t.slice(0,o)}${n}${t.slice(l)}`}function Ufe(t,e,n){const r=new RegExp(`]*>`,"gi");r.lastIndex=n;let i=1,s;for(;(s=r.exec(t))!==null;){const a=s[0];if(a.startsWith("")||(i+=1)}return-1}const fje=new Set(["loop","muted","autoplay","playsinline","controls","default","defer","disabled","hidden","nomodule","open","readonly","required","reversed","selected"]);function Xfe(t,e,n,r){if(!e)return t;if(fje.has(n)){const l=da(n),c=new RegExp(`(?:^|\\s)${l}(?:\\s|=|$)`).test(e);if(r===null||r===""||r==="false"){if(!c)return t;const f=new RegExp(`\\s+${l}(?:=(["'])[^"']*\\1)?`),h=e.replace(f,"");return t.replace(e,h)}if(c)return t;const u=e+` ${n}`;return t.replace(e,u)}const s=new RegExp(`\\b${da(n)}=(["'])([^"']*)\\1`);if(r===null){if(!s.test(e))return t;const l=new RegExp(`\\s+${da(n)}=(["'])[^"']*\\1`),c=e.replace(l,"");return t.replace(e,c)}const a=oF(r);if(s.test(e)){const l=e.replace(s,`${n}="${a}"`);return t.replace(e,l)}const o=e+` ${n}="${a}"`;return t.replace(e,o)}function hje(t,e,n,r){const s=new RegExp(`(<[^>]*\\bid=(["'])${da(e)}\\2[^>]*)>`,"i").exec(t);return s?Xfe(t,s[1],n,r):t}function dje(t,e,n,r){const i=Gf(t,e);if(!i)return t;const s=Xfe(i.tag,i.tag,n,r);return nv(t,i,s)}function pje(t,e,n){const r=Gf(t,e);if(!r)return t;const i=/^<([a-z0-9-]+)/i.exec(r.tag),s=i==null?void 0:i[1];if(!s)return t;const a=Ufe(t,s,r.end+1);return a<0?t:`${t.slice(0,r.end+1)}${n}${t.slice(a)}`}function mje(t,e,n){switch(n.type){case"inline-style":return sje(t,e,n.property,n.value);case"attribute":return cje(t,e,n.property,n.value);case"html-attribute":return hje(t,e,n.property,n.value);case"text-content":return n.value!==null?uje(t,e,n.value):t;default:return t}}function yd(t,e,n){if(e.id){const r=mje(t,e.id,n);if(r!==t||!e.selector)return r}switch(n.type){case"inline-style":return aje(t,e,n.property,n.value);case"attribute":return lje(t,e,n.property,n.value);case"html-attribute":return dje(t,e,n.property,n.value);case"text-content":return n.value!==null?pje(t,e,n.value):t;default:return t}}const zX=new WeakMap;function wS(t,e,n){let r=zX.get(t);r||(r=new Map,zX.set(t,r));const s=(r.get(e)??Promise.resolve()).then(n,n);return r.set(e,s),s.then(()=>{(r==null?void 0:r.get(e))===s&&r.delete(e)},()=>{(r==null?void 0:r.get(e))===s&&r.delete(e)}),s}function lF(t,e,n){const r=[...new Set(e)].sort(),i=s=>{const a=r[s];return a===void 0?n():wS(t,a,()=>i(s+1))};return i(0)}const Wfe="__studioSaveAttempt";class s0 extends Error{constructor(n,r,i={}){super(n);Et(this,"statusCode");Et(this,"alreadyToasted");this.name="StudioSaveHttpError",this.statusCode=r,this.alreadyToasted=i.alreadyToasted??!1}}class qfe extends Error{constructor(e,n){super(e,n),this.name="StudioSaveNetworkError"}}class O0 extends s0{constructor(n){super(`Save conflict: ${n.filePath} changed outside this Studio session`,409);Et(this,"filePath");Et(this,"currentVersion");Et(this,"currentContent");Et(this,"attemptedContent");this.name="StudioFileConflictError",this.filePath=n.filePath,this.currentVersion=n.currentVersion,this.currentContent=n.currentContent,this.attemptedContent=n.attemptedContent}}function D4(t,e){const r=t[e];return typeof r=="number"&&Number.isFinite(r)?r:void 0}function Yfe(){if(typeof DOMException<"u")return new DOMException("Save aborted","AbortError");const t=new Error("Save aborted");return t.name="AbortError",t}function ZX(t){if(t!=null&&t.aborted)throw Yfe()}function gje(t,e){if(!t||typeof t!="object")return t;try{Object.defineProperty(t,Wfe,{value:e,configurable:!0})}catch{}return t}function Nu(t){return t instanceof Error&&t.message?t.message:typeof t=="string"&&t.trim()?t:"Unknown save failure"}function GX(t){if(!t||typeof t!="object")return t;try{Object.defineProperty(t,"alreadyToasted",{value:!0,configurable:!0})}catch{}return t}function cF(t){if(!t||typeof t!="object")return!1;if(t.alreadyToasted===!0)return!0;const e=t.cause;return e!==t&&cF(e)}function oA(t){if(!t||typeof t!="object")return;const e=D4(t,"statusCode")??D4(t,"status")??D4(t,"status_code");if(e!=null)return e;const n=t.cause;if(n&&n!==t)return oA(n)}function Kfe(t){if(!t||typeof t!="object")return;const e=D4(t,Wfe);if(e!=null)return e;const n=t.cause;if(n&&n!==t)return Kfe(n)}function yje(t){return t instanceof Error&&t.name==="AbortError"}function xje(t){if(yje(t))return!1;if(t instanceof qfe)return!0;const e=oA(t);return e==null?!1:e===408||e===425||e===429||e>=500}function uF(t){const e=t.statusCode??oA(t.error)??null,n=t.attempt??Kfe(t.error)??void 0;return{source:t.source,error_message:Nu(t.error),status_code:e,file_path:t.filePath??t.targetSourceFile??void 0,mutation_type:t.mutationType??void 0,attempt:n,label:t.label??void 0,target_id:t.targetId??void 0,target_selector:t.targetSelector??void 0,target_source_file:t.targetSourceFile??void 0}}function X0(t){Pt("save_failure",uF(t))}function bje(t){Pt("edit_blocked",uF(t))}async function _d(t,e,n={}){let r="";try{r=await t.text()}catch{r=""}const i=r.trim().slice(0,300),s=i?`${e} (${t.status}): ${i}`:`${e} (${t.status})`;return new s0(s,t.status,n)}async function vje(t,e={}){const n=e.retries??3,r=e.baseDelayMs??500,i=e.maxDelayMs??8e3,s=e.jitterRatio??.25,a=e.random??Math.random,o=e.shouldRetry??xje,l=e.sleep??((u,f)=>new Promise((h,p)=>{ZX(f);const y=()=>{globalThis.clearTimeout(m),p(Yfe())},m=globalThis.setTimeout(()=>{f==null||f.removeEventListener("abort",y),h()},u);f==null||f.addEventListener("abort",y,{once:!0})})),c=n+1;for(let u=1;u<=c;u++)try{return ZX(e.signal),await t(u)}catch(f){const h=gje(f,u);if(u>=c||!o(h,u))throw h;const p=u-1,y=Math.min(r*2**p,i),m=y*s,v=Math.round(y+(a()*2-1)*m),b=Math.max(0,Math.min(i,v));await l(b,e.signal)}throw new Error("Save retry loop exited unexpectedly")}async function fF(t,e){const n=await fetch(`/api/projects/${t}/files/${encodeURIComponent(e)}`);if(!n.ok)throw await _d(n,`Failed to read ${e}`);const r=await n.json();if(typeof r.content!="string")throw new Error(`Missing file contents for ${e}`);return r.content}async function il({label:t,kind:e,coalesceKey:n,coalesceMs:r,files:i,readFile:s,writeFile:a,recordEdit:o,diskContent:l}){return lF(a,Object.keys(i),async()=>{const c={};for(const[h,p]of Object.entries(i)){const y=await s(h);y!==p&&(c[h]={before:y,after:p})}const u=Object.keys(c);if(u.length===0)return[];const f=[];try{for(const h of u)await a(h,c[h].after,(l==null?void 0:l[h])??c[h].before),f.push(h);await o({label:t,kind:e,coalesceKey:n,coalesceMs:r,files:c})}catch(h){try{for(const p of f.reverse())await a(p,c[p].before,c[p].after)}catch(p){throw new AggregateError([h,p],"Failed to save project files and rollback did not complete")}throw h}return u})}const Aje=64,Sje=2,wje="rec709",lA=16,Jfe=4,zn={hueDegrees:{min:0,max:360},unit:{min:0,max:1},signedUnit:{min:-1,max:1},secondaryHueRange:{min:0,max:180},secondaryHueSoftness:{min:0,max:180},secondaryHueCombinedMax:180,secondarySoftRangeSoftness:{min:0,max:.5},secondaryHueShift:{min:-180,max:180},effects:{asciiStyle:{min:0,max:7},bloom:{min:0,max:3},bloomRadius:{min:1,max:100},monoScreenShape:{min:0,max:4}}},Oje=["exposure","contrast","highlights","shadows","whites","blacks","temperature","tint","vibrance","saturation"],Cje=["shadows","midtones","highlights"],kje=["master","red","green","blue"],Eje=["hueVsHue","hueVsSaturation","hueVsLuma"],Tje=["vignette","vignetteMidpoint","vignetteRoundness","vignetteFeather","grain","grainSize","grainRoughness"],Pje=["blur","pixelate","chromaBleed","tapeDamage","tapeTracking","tapeNoise","tapeSpeed","filmArtifacts","halftone","halftoneSize","twoInkPrint","twoInkPrintSize","ascii","asciiSize","asciiInvert","asciiStyle","asciiColor","asciiRotation","dither","ditherSize","bloom","bloomRadius","monoScreen","monoScreenSize","monoScreenAngle","monoScreenSpread","monoScreenShape","monoScreenInvert","scanlines","scanlineCount","scanlineSoftness","chromaticAberration","chromaticAngle","crtCurvature","digitalGlitch","digitalGlitchColorSplit","digitalGlitchLineTear","digitalGlitchPixelate","digitalGlitchBlockAmount","digitalGlitchBlockDisplacement","digitalGlitchBlockOpacity","digitalGlitchSpeed","engraving","engravingSpacing","engravingMinThickness","engravingMaxThickness","engravingAngle","engravingContrast","engravingSharpness","engravingWave","engravingWaveFrequency","crosshatch","crosshatchSpacing","crosshatchThickness","crosshatchAngle","crosshatchContrast","crosshatchEdges","crosshatchLineWeight","crosshatchWave","crosshatchWaveFrequency","kuwahara","kuwaharaRadius","kuwaharaSharpness","kuwaharaSaturation"],ehe=1024,cA=lA;function UX(t,e,n,r){const i=((2*t+e)*n-t*r)/(t+e);return Math.sign(i)!==Math.sign(n)?0:Math.sign(n)!==Math.sign(r)&&Math.abs(i)>3*Math.abs(n)?3*n:i}function ks(t,e){const n=t[e];if(n===void 0)throw new RangeError("Color curve points must be contiguous");return n}function Mje(t){const e=[],n=[];let r=ks(t,0);for(const a of t.slice(1)){const o=a[0]-r[0];e.push(o),n.push((a[1]-r[1])/o),r=a}const i=ks(n,0);if(t.length===2)return[i,i];const s=new Array(t.length);s[0]=UX(ks(e,0),ks(e,1),i,ks(n,1)),s[s.length-1]=UX(ks(e,e.length-1),ks(e,e.length-2),ks(n,n.length-1),ks(n,n.length-2));for(let a=1;a=n)throw new RangeError("Curve output bounds must be finite and increasing");if(t.some(([,r])=>rn))throw new RangeError(`Curve outputs must be between ${e} and ${n}`)}function Dje(t,e,n,r,i){const s=n[0]-e[0],a=Math.min(1,Math.max(0,(t-e[0])/s)),o=a*a,l=o*a;return(2*l-3*o+1)*e[1]+(l-2*o+a)*s*r+(-2*l+3*o)*n[1]+(l-o)*s*i}function nhe(t,e,n,r,i){Nje(t,r,i);const s=Mje(t),a=new Float32Array(e);let o=0;for(let l=0;lks(t,o+1)[0];)o+=1;const u=ks(t,o),f=ks(t,o+1),h=Dje(c,u,f,ks(s,o),ks(s,o+1));a[l]=Math.min(i,Math.max(r,h))}return a}function Ije(t,e=ehe){var n,r;if(the(t,e),t.length>cA)throw new RangeError(`A color curve supports at most ${cA} points`);if(t.some(([i])=>i<0||i>1))throw new RangeError("Color curve inputs must be between 0 and 1");if(((n=t[0])==null?void 0:n[0])!==0||((r=t[t.length-1])==null?void 0:r[0])!==1)throw new RangeError("Color curves must include input endpoints 0 and 1");return nhe(t,e,i=>i/(e-1),0,1)}function _je(t,e,n,r=ehe){var l;if(t.length<3)throw new RangeError("A hue curve requires at least three points");if(t.length>cA)throw new RangeError(`A hue curve supports at most ${cA} points`);const i=[...t].sort((c,u)=>c[0]-u[0]);for(let c=0;c=360)throw new RangeError("Hue curve inputs must be from 0 up to 360 degrees");if(c>0&&u[0]===((l=i[c-1])==null?void 0:l[0]))throw new RangeError("Hue curve inputs must be unique")}const s=i.slice(-2).map(([c,u])=>[c-360,u]),a=i.slice(0,2).map(([c,u])=>[c+360,u]),o=[...s,...i,...a];return the(o,r),nhe(o,r,c=>c/r*360,e,n)}const Rje="data-color-grading",JE="data-hf-color-grading-source-hidden",jje="data-hf-authored-opacity",Lje="__hf_color_grading_",rhe=wje,Y6={exposure:0,contrast:0,highlights:0,shadows:0,whites:0,blacks:0,temperature:0,tint:0,vibrance:0,saturation:0},K6={vignette:0,vignetteMidpoint:.5,vignetteRoundness:0,vignetteFeather:.65,grain:0,grainSize:.25,grainRoughness:.5},uA={blur:0,pixelate:0,chromaBleed:0,tapeDamage:0,tapeTracking:0,tapeNoise:1,tapeSpeed:.5,filmArtifacts:0,halftone:0,halftoneSize:0,twoInkPrint:0,twoInkPrintSize:0,ascii:0,asciiSize:5/76,asciiInvert:0,asciiStyle:0,asciiColor:1,asciiRotation:0,dither:0,ditherSize:0,bloom:0,bloomRadius:8,monoScreen:0,monoScreenSize:0,monoScreenAngle:0,monoScreenSpread:0,monoScreenShape:0,monoScreenInvert:0,scanlines:0,scanlineCount:0,scanlineSoftness:0,chromaticAberration:0,chromaticAngle:0,crtCurvature:0,digitalGlitch:0,digitalGlitchColorSplit:0,digitalGlitchLineTear:0,digitalGlitchPixelate:0,digitalGlitchBlockAmount:0,digitalGlitchBlockDisplacement:0,digitalGlitchBlockOpacity:0,digitalGlitchSpeed:0,engraving:0,engravingSpacing:7/17,engravingMinThickness:.2,engravingMaxThickness:3.2/7,engravingAngle:.25,engravingContrast:7/15,engravingSharpness:.59,engravingWave:.2,engravingWaveFrequency:2/9,crosshatch:0,crosshatchSpacing:7/25,crosshatchThickness:.25,crosshatchAngle:.25,crosshatchContrast:1/3,crosshatchEdges:.5,crosshatchLineWeight:0,crosshatchWave:.33,crosshatchWaveFrequency:2/9,kuwahara:0,kuwaharaRadius:1/7,kuwaharaSharpness:5/16,kuwaharaSaturation:.5},ihe=[{id:"noir",label:"Noir",group:"Classic",colors:["#000000","#ffffff"]},{id:"ink-paper",label:"Ink & Paper",group:"Classic",colors:["#1a1a2e","#f5f5dc"]},{id:"terminal",label:"Terminal",group:"Classic",colors:["#001100","#00ff00"]},{id:"amber-glow",label:"Amber Glow",group:"Classic",colors:["#1a0f00","#ffcc00"]},{id:"handheld-green",label:"Handheld Green",group:"Classic",colors:["#0f380f","#306230","#8bac0f","#9bbc0f"]},{id:"golden-hour",label:"Golden Hour",group:"Mood",colors:["#1a1205","#4a3510","#8b6914","#d4a017","#fff8dc"]},{id:"deep-sea",label:"Deep Sea",group:"Mood",colors:["#0a1628","#1a3a5c","#2d6187","#5ba4c9","#a8dce8"]},{id:"arctic-night",label:"Arctic Night",group:"Mood",colors:["#0a0a14","#1a2a4a","#3a5a8a","#6a9aca","#cae8ff"]},{id:"synthwave",label:"Synthwave",group:"Mood",colors:["#120458","#7b2cbf","#e040fb","#ff6ec7","#fff59d"]},{id:"vaporwave",label:"Vaporwave",group:"Mood",colors:["#1a0a2e","#3d1a5c","#ff71ce","#01cdfe","#fffb96"]},{id:"forest",label:"Forest",group:"Mood",colors:["#1a2e1a","#2d4a2d","#4a7c4a","#7ab37a","#c8e6c8"]},{id:"sepia",label:"Sepia",group:"Mono",colors:["#1a1610","#3d3020","#6b5a40","#a89070","#e8dcc8"]},{id:"blueprint",label:"Blueprint",group:"Mono",colors:["#001830","#003060","#0050a0","#0080e0","#e0f0ff"]},{id:"warm-print",label:"Warm Print",group:"HyperFrames",colors:["#17121a","#824c50","#e09873","#f7ddb1"]},{id:"electric-ink",label:"Electric Ink",group:"HyperFrames",colors:["#080717","#3c185f","#7e2278","#d9339f","#ff6b66","#aafae0"]}],hF=Oje,dF=Cje,pF=kje,mF=Eje,she=Tje,ahe=Pje,XX={exposure:.03,contrast:-.12,highlights:-.1,shadows:.16,whites:-.04,blacks:.08,temperature:.13,vibrance:-.08,saturation:-.08},WX={vignette:.18};function ws(t,e,n={},r={},i={},s=1){return{id:t,label:e,intensity:s,adjust:{...Y6,...n},details:{...K6,...r},effects:{...uA,...i}}}const OS=[ws("neutral","Neutral"),ws("warm-daylight","Warm Daylight",{exposure:.06,contrast:.07,highlights:-.06,shadows:.08,temperature:.18,saturation:.08}),ws("clean-studio","Clean Studio",{contrast:.08,highlights:-.08,shadows:.06,temperature:-.08,tint:.03,saturation:.04}),ws("skin-soft","Skin Soft",{exposure:.04,contrast:-.03,highlights:-.12,shadows:.12,temperature:.08,tint:.02,saturation:.04}),ws("food-pop","Food Pop",{exposure:.06,contrast:.1,shadows:.06,temperature:.14,vibrance:.1,saturation:.18}),ws("night-lift","Night Lift",{exposure:.08,contrast:.08,highlights:-.18,shadows:.2,blacks:-.08,saturation:.04},{vignette:.12}),ws("muted-editorial","Muted Editorial",{exposure:-.02,contrast:.08,highlights:-.08,shadows:.06,blacks:-.05,temperature:-.03,saturation:-.12},{vignette:.1}),ws("vintage-wash","Vintage Wash",XX,WX),ws("mono-clean","Mono Clean",{contrast:.12,highlights:-.04,shadows:.04,blacks:-.08,saturation:-1}),ws("mono-fade","Mono Fade",{contrast:-.04,highlights:-.06,shadows:.1,blacks:.12,saturation:-1},{vignette:.08}),ws("soft-boost","Soft Boost",{exposure:.06,contrast:-.04,highlights:-.14,shadows:.16,vibrance:.08,saturation:.1}),ws("bright-pop","Bright Pop",{exposure:.12,contrast:.12,whites:.08,blacks:-.04,vibrance:.08,saturation:.14}),ws("deep-contrast","Deep Contrast",{exposure:-.03,contrast:.2,highlights:-.08,shadows:-.08,blacks:-.12,saturation:.06}),ws("creator-camcorder","Creator Camcorder",{contrast:.08,highlights:-.05,shadows:.02,whites:.03,blacks:-.04,temperature:-.03,tint:-.015,vibrance:-.03,saturation:-.06},{vignette:.06,grain:.08,grainSize:.18,grainRoughness:.58},{chromaBleed:.55},.72),ws("vhs-playback","VHS Playback",{contrast:-.04,saturation:-.08},{grain:.16,grainSize:.12,grainRoughness:.72},{tapeDamage:.82,tapeTracking:.85,tapeNoise:.3,tapeSpeed:.5,chromaBleed:.5,chromaticAberration:.18,scanlines:.35,scanlineCount:.17,scanlineSoftness:1,digitalGlitch:.32,digitalGlitchLineTear:.08,digitalGlitchSpeed:.5}),ws("home-movie-8mm","8mm Home Movie",XX,{...WX,vignette:.28,vignetteMidpoint:.54,vignetteFeather:.72,grain:.34,grainSize:.18,grainRoughness:.72},{filmArtifacts:.62},.72),ws("editorial-halftone","Editorial Halftone",{contrast:.04,saturation:.04},{},{halftone:.94,halftoneSize:.36}),ws("two-ink-print","Two-Ink Print",{contrast:.08,highlights:-.06,shadows:.04},{},{twoInkPrint:1,twoInkPrintSize:.42})],Fje=new Map(OS.map(t=>[t.id,t])),ohe={exposure:{min:-2,max:2},contrast:{min:-1,max:1},highlights:{min:-1,max:1},shadows:{min:-1,max:1},whites:{min:-1,max:1},blacks:{min:-1,max:1},temperature:{min:-1,max:1},tint:{min:-1,max:1},vibrance:{min:-1,max:1},saturation:{min:-1,max:1}},Xm={hue:0,amount:0,level:0},J6={amount:zn.unit,level:zn.signedUnit},sd=[[0,0],[1,1]],eg=[],lhe={hueVsHue:zn.secondaryHueShift,hueVsSaturation:zn.signedUnit,hueVsLuma:zn.signedUnit},AM={center:0,range:180,softness:0},SM={min:0,max:1,softness:.05},che={vignette:zn.unit,vignetteMidpoint:zn.unit,vignetteRoundness:zn.signedUnit,vignetteFeather:zn.unit,grain:zn.unit,grainSize:zn.unit,grainRoughness:zn.unit},df=zn.unit,uhe=zn.effects,e3=["blur","pixelate","chromaBleed","tapeDamage","filmArtifacts","halftone","twoInkPrint","ascii","dither","bloom","monoScreen","scanlines","chromaticAberration","crtCurvature","digitalGlitch","engraving","crosshatch","kuwahara"],$je=[{id:"essentials",label:"Essentials",description:"Common optical, focus, and privacy-oriented primitives."},{id:"retro-glitch",label:"Retro & Glitch",description:"Tape, film, CRT, channel separation, and digital disruption."},{id:"print",label:"Print",description:"Halftone, limited-ink, dither, and screen-print rendering."},{id:"art",label:"Art",description:"ASCII, engraved, crosshatched, and painterly rendering."}],Bje={blur:{family:"essentials",label:"Blur",description:"Defocus or soften a full media layer."},pixelate:{family:"essentials",label:"Pixelate",description:"Turn a media layer into a block mosaic."},bloom:{family:"essentials",label:"Bloom",description:"Add thresholded glow around bright image regions."},chromaBleed:{family:"retro-glitch",label:"Chroma Softening",description:"Smear color like low-bandwidth video."},tapeDamage:{family:"retro-glitch",label:"Tape Damage",description:"Add moving tracking errors and tape noise."},filmArtifacts:{family:"retro-glitch",label:"Film Artifacts",description:"Add deterministic dust and film wear."},scanlines:{family:"retro-glitch",label:"Scanlines",description:"Overlay configurable horizontal display lines."},crtCurvature:{family:"retro-glitch",label:"CRT Curvature",description:"Warp media toward curved CRT geometry."},chromaticAberration:{family:"retro-glitch",label:"Channel Separation",description:"Offset color channels by angle."},digitalGlitch:{family:"retro-glitch",label:"Digital Glitch",description:"Compose tears, blocks, and color splits."},halftone:{family:"print",label:"Halftone",description:"Render source color through a print-dot raster."},twoInkPrint:{family:"print",label:"Two-Ink Print",description:"Reduce media to a two-ink print treatment."},dither:{family:"print",label:"Ordered Dither",description:"Quantize media into an ordered limited palette."},monoScreen:{family:"print",label:"Mono Screen",description:"Build monochrome dot, shape, or line artwork."},ascii:{family:"art",label:"ASCII",description:"Render media as configurable procedural glyph cells."},engraving:{family:"art",label:"Engraving",description:"Translate luminance into directional engraved lines."},crosshatch:{family:"art",label:"Crosshatch",description:"Translate media into layered hand-hatched lines."},kuwahara:{family:"art",label:"Kuwahara Paint",description:"Apply edge-preserving painterly smoothing."}},gF=OS.filter(t=>e3.some(e=>t.effects[e]>1e-4)),fhe=OS.filter(t=>!gF.includes(t)),fA={blur:{blur:.45},pixelate:{pixelate:.55},bloom:{bloom:.55,bloomRadius:8},chromaBleed:{chromaBleed:.55},tapeDamage:{tapeDamage:.65,tapeTracking:.55,tapeNoise:.25,tapeSpeed:.5},filmArtifacts:{filmArtifacts:.55},scanlines:{scanlines:.35,scanlineCount:.17,scanlineSoftness:1},chromaticAberration:{chromaticAberration:.15,chromaticAngle:0},crtCurvature:{crtCurvature:.2},digitalGlitch:{digitalGlitch:.55,digitalGlitchColorSplit:.25,digitalGlitchLineTear:.25,digitalGlitchPixelate:.15,digitalGlitchBlockAmount:.5,digitalGlitchBlockDisplacement:.25,digitalGlitchBlockOpacity:0,digitalGlitchSpeed:.5},halftone:{halftone:.94,halftoneSize:.36},twoInkPrint:{twoInkPrint:1,twoInkPrintSize:.42},ascii:{ascii:1,asciiSize:5/76,asciiInvert:0,asciiStyle:0,asciiColor:1,asciiRotation:0},dither:{dither:1,ditherSize:.5},monoScreen:{monoScreen:1,monoScreenSize:.35,monoScreenAngle:.25,monoScreenSpread:.3,monoScreenShape:0,monoScreenInvert:0},engraving:{engraving:1,engravingSpacing:7/17,engravingMinThickness:.2,engravingMaxThickness:3.2/7,engravingAngle:.25,engravingContrast:7/15,engravingSharpness:.59,engravingWave:.2,engravingWaveFrequency:2/9},crosshatch:{crosshatch:1,crosshatchSpacing:7/25,crosshatchThickness:.25,crosshatchAngle:.25,crosshatchContrast:1/3,crosshatchEdges:.5,crosshatchLineWeight:0,crosshatchWave:.33,crosshatchWaveFrequency:2/9},kuwahara:{kuwahara:1,kuwaharaRadius:1/7,kuwaharaSharpness:5/16,kuwaharaSaturation:.5}},Vje=[{path:"intensity",name:"--hf-color-grading-intensity",min:0,max:1},{path:"lut.intensity",name:"--hf-color-grading-lut-intensity",min:0,max:1},{path:"adjust.exposure",name:"--hf-color-grading-exposure",min:-2,max:2},{path:"effects.blur",name:"--hf-color-grading-blur",min:0,max:1},{path:"effects.bloom",name:"--hf-color-grading-bloom",min:0,max:3},{path:"effects.kuwahara",name:"--hf-color-grading-kuwahara",min:0,max:1},{path:"effects.pixelate",name:"--hf-color-grading-pixelate",min:0,max:1},{path:"effects.ascii",name:"--hf-color-grading-ascii",min:0,max:1},{path:"effects.dither",name:"--hf-color-grading-dither",min:0,max:1}];function Hje(t){return uhe[t]??df}const Qje=new Set(["ascii","dither","monoScreen","engraving","crosshatch"]),zje=new Set(["blur","bloom","kuwahara"]);function yF(){return{version:Sje,targetTags:["img","video"],colorSpace:rhe,intensity:{identity:1,min:0,max:1},palette:{minColors:2,maxColors:6,colorFormat:"#rrggbb"},lut:{format:"3d-cube",maxCubeSize:Aje,intensity:{...df}},presets:[...fhe,...gF].map(t=>({id:t.id,label:t.label,intensity:t.intensity})),adjustments:hF.map(t=>({key:t,identity:Y6[t],...ohe[t]})),wheels:{zones:dF,controls:{hue:{identity:0,unit:"degrees",wrap:!0,min:zn.hueDegrees.min,maxExclusive:zn.hueDegrees.max},amount:{identity:0,...J6.amount},level:{identity:0,...J6.level}}},curves:{channels:pF,input:{min:0,max:1},output:{min:0,max:1},minPoints:2,maxPoints:lA,implicitEndpoints:!0,endpointsCountTowardMax:!0},hueCurves:{channels:mF.map(t=>({key:t,input:{min:0,maxExclusive:360,unit:"degrees",wrap:!0},output:lhe[t]})),minPoints:3,maxPoints:lA},secondaries:{max:Jfe,hue:{center:{min:zn.hueDegrees.min,maxExclusive:zn.hueDegrees.max,unit:"degrees",wrap:!0},range:{...zn.secondaryHueRange,unit:"degrees"},softness:{...zn.secondaryHueSoftness,unit:"degrees"},rangePlusSoftnessMax:zn.secondaryHueCombinedMax},saturation:{min:{...df},max:{...df},relation:"min < max",softness:{...zn.secondarySoftRangeSoftness}},luma:{min:{...df},max:{...df},relation:"min < max",softness:{...zn.secondarySoftRangeSoftness}},correction:{hueShift:{...zn.secondaryHueShift,unit:"degrees"},saturation:{...zn.signedUnit},luma:{...zn.signedUnit},temperature:{...zn.signedUnit},tint:{...zn.signedUnit}}},effectFamilies:$je,finishing:she.map(t=>({key:t,identity:K6[t],...che[t]})),effects:e3.map(t=>{const e=fA[t];return{key:t,...Bje[t],apply:{...e},supportsPalette:Qje.has(t),renderLane:zje.has(t)?"multipass":"single-pass",controls:ahe.filter(n=>Object.hasOwn(e,n)).map(n=>({key:n,identity:uA[n],recommended:e[n]??uA[n],...Hje(n)}))}}),palettes:ihe.map(({id:t,label:e,group:n,colors:r})=>({id:t,label:e,group:n,colors:r})),animatable:Vje}}const Zje=/^#[0-9a-f]{6}$/i;function Gje(t){return!Array.isArray(t)||t.length<2||t.length>6||!t.every(e=>typeof e=="string"&&Zje.test(e))?null:t.map(e=>e.toLowerCase())}function ja(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function hA(t,e,n){return Number.isFinite(t)?Math.min(n,Math.max(e,t)):0}function hhe(t,e){const n=typeof t=="number"?t:Number(t);return Number.isFinite(n)?Math.min(1,Math.max(0,n)):e}function _a(t,e){const n=typeof t=="number"?t:Number(t);return Number.isFinite(n)?hA(n,e.min,e.max):0}function xF(t,e=0){const n=typeof t=="number"?t:Number(t);return Number.isFinite(n)?(n%360+360)%360:e}function M_(t,e,n){const r=hA((n-t)/(e-t),0,1);return r*r*(3-2*r)}function qX(t,e,n,r){return tn?r<=0?0:1-M_(n,n+r,t):1}function Uje(t,e,n,r){const i=Math.abs(((t-r.hue.center+540)%360+360)%360-180);return(r.hue.range<179.999&&e<.001?0:i<=r.hue.range?1:r.hue.softness<=0?0:1-M_(r.hue.range,r.hue.range+r.hue.softness,i))*qX(e,r.saturation.min,r.saturation.max,r.saturation.softness)*qX(n,r.luma.min,r.luma.max,r.luma.softness)}function Xje(t){const e=ja(t)?t:{};return dF.reduce((n,r)=>{const i=ja(e[r])?e[r]:{};return n[r]={hue:xF(i.hue,Xm.hue),amount:_a(i.amount??Xm.amount,J6.amount),level:_a(i.level??Xm.level,J6.level)},n},{shadows:{...Xm},midtones:{...Xm},highlights:{...Xm}})}function Wje(t){if(!Array.isArray(t)||t.length!==2)return null;const e=Number(t[0]),n=Number(t[1]);return Number.isFinite(e)&&Number.isFinite(n)?[hA(e,0,1),hA(n,0,1)]:null}function dhe(t){return t.some((e,n)=>{var r;return n>0&&e[0]===((r=t[n-1])==null?void 0:r[0])})}function qje(t){var e,n;(((e=t[0])==null?void 0:e[0])??0)>0&&t.unshift([0,0]),(((n=t.at(-1))==null?void 0:n[0])??1)<1&&t.push([1,1])}function Yje(t){if(!Array.isArray(t)||t.length<2)return sd;const e=[];for(const n of t){const r=Wje(n);if(!r)return sd;e.push(r)}return e.sort((n,r)=>n[0]-r[0]),dhe(e)||(qje(e),e.length>lA)?sd:e}function Kje(t){const e=ja(t)?t:{};return pF.reduce((n,r)=>(n[r]=Yje(e[r]),n),{master:sd,red:sd,green:sd,blue:sd})}function Jje(t,e){if(!Array.isArray(t)||t.length!==2)return null;const n=Number(t[0]),r=Number(t[1]);return Number.isFinite(n)&&Number.isFinite(r)?[xF(n),hA(r,e.min,e.max)]:null}function eLe(t,e){if(!Array.isArray(t)||t.length<3||t.length>lA)return eg;const n=[];for(const r of t){const i=Jje(r,e);if(!i)return eg;n.push(i)}return n.sort((r,i)=>r[0]-i[0]),dhe(n)?eg:n}function tLe(t){const e=ja(t)?t:{};return mF.reduce((n,r)=>(n[r]=eLe(e[r],lhe[r]),n),{hueVsHue:eg,hueVsSaturation:eg,hueVsLuma:eg})}function YX(t){const e=ja(t)?t:{},n=_a(e.min??SM.min,df),r=_a(e.max??SM.max,df);return{min:Math.min(n,r),max:Math.max(n,r),softness:_a(e.softness??SM.softness,zn.secondarySoftRangeSoftness)}}function nLe(t){const e=ja(t)?t:{},n=_a(e.range??AM.range,zn.secondaryHueRange);return{center:xF(e.center,AM.center),range:n,softness:_a(e.softness??AM.softness,{min:zn.secondaryHueSoftness.min,max:zn.secondaryHueCombinedMax-n})}}function rLe(t){return{hueShift:_a(t.hueShift??0,zn.secondaryHueShift),saturation:_a(t.saturation??0,zn.signedUnit),luma:_a(t.luma??0,zn.signedUnit),temperature:_a(t.temperature??0,zn.signedUnit),tint:_a(t.tint??0,zn.signedUnit)}}function iLe(t){return!ja(t)||!ja(t.key)||!ja(t.correction)?null:{enabled:t.enabled!==!1,key:{hue:nLe(t.key.hue),saturation:YX(t.key.saturation),luma:YX(t.key.luma)},correction:rLe(t.correction)}}function sLe(t){if(!Array.isArray(t))return[];const e=[];for(const n of t.slice(0,Jfe)){const r=iLe(n);r&&e.push(r)}return e}function aLe(t){if(t==null)return null;const e=String(t).trim();return e||null}function oLe(t){if(t==null)return null;if(typeof t=="string"){const n=t.trim();return n?{src:n,intensity:1}:null}if(!ja(t))return null;const e=t.src;return typeof e!="string"||e.trim()===""?null:{src:e.trim(),intensity:hhe(t.intensity,1)}}function lLe(t){if(typeof t=="string"){const e=t.trim();if(!e)return null;if(e.startsWith("{"))try{const n=JSON.parse(e);return ja(n)?n:null}catch{return null}return{preset:e}}return ja(t)?t:null}function cLe(t){return t?Fje.get(t)??null:null}function Tc(t){const e=lLe(t);if(!e||e.enabled===!1)return null;const n=aLe(e.preset),r=cLe(n),i=(r==null?void 0:r.adjust)??Y6,s=(r==null?void 0:r.details)??K6,a=(r==null?void 0:r.effects)??uA,o=ja(e.adjust)?e.adjust:{},l=ja(e.details)?e.details:{},c=ja(e.effects)?e.effects:{},u=hF.reduce((p,y)=>(p[y]=_a(o[y]??i[y],ohe[y]),p),{...Y6}),f=she.reduce((p,y)=>(p[y]=_a(l[y]??s[y],che[y]),p),{...K6}),h=ahe.reduce((p,y)=>(p[y]=_a(c[y]??a[y],uhe[y]??df),p),{...uA});return{enabled:!0,preset:n,intensity:hhe(e.intensity,(r==null?void 0:r.intensity)??1),adjust:u,wheels:Xje(e.wheels),curves:Kje(e.curves),hueCurves:tLe(e.hueCurves),secondaries:sLe(e.secondaries),details:f,effects:h,palette:Gje(e.palette),lut:oLe(e.lut),colorSpace:typeof e.colorSpace=="string"&&e.colorSpace.trim()?e.colorSpace.trim():rhe}}function phe(t){return dF.some(e=>Math.abs(t[e].amount)>1e-4||Math.abs(t[e].level)>1e-4)}function mhe(t){return pF.some(e=>t[e].some(([n,r])=>Math.abs(n-r)>1e-4))}function ghe(t){return mF.some(e=>t[e].some(([,n])=>Math.abs(n)>1e-4))}function uLe(t){return t.some(e=>e.enabled&&Object.values(e.correction).some(n=>Math.abs(n)>1e-4))}function N_(t){const e=Tc(t);if(!e)return"";const{enabled:n,wheels:r,curves:i,hueCurves:s,secondaries:a,palette:o,...l}=e;return JSON.stringify({...l,...phe(r)?{wheels:r}:{},...mhe(i)?{curves:i}:{},...ghe(s)?{hueCurves:s}:{},...a.length>0?{secondaries:a}:{},...o?{palette:o}:{}})}function a0(t){return t!=null&&t.enabled?Math.abs(t.details.vignette)>1e-4||Math.abs(t.details.grain)>1e-4||e3.some(n=>Math.abs(t.effects[n])>1e-4)?!0:t.intensity===0?!1:t.lut&&t.lut.intensity!==0?!0:hF.some(n=>Math.abs(t.adjust[n])>1e-4)||(t.wheels?phe(t.wheels):!1)||(t.curves?mhe(t.curves):!1)||(t.hueCurves?ghe(t.hueCurves):!1)||(t.secondaries?uLe(t.secondaries):!1):!1}function KX(t){var e;return t?(e=t.secondaries)!=null&&e.length?!0:a0(t):!1}function yhe(t){return t.getAttribute(jje)}function xhe(t,e){e===""?t.removeProperty("opacity"):t.setProperty("opacity",e)}const bhe="https://cdn.jsdelivr.net/npm/gsap@3.12.5/dist/MotionPathPlugin.min.js";function fLe(t){var r,i;if(!(t!=null&&t.contentWindow)||!t.contentDocument)return;const e=t.contentWindow,n=t.contentDocument;if(e.MotionPathPlugin){try{(r=e.gsap)!=null&&r.registerPlugin&&e.gsap.registerPlugin(e.MotionPathPlugin)}catch{}return}if((i=e.gsap)!=null&&i.registerPlugin&&!e.__hfMotionPathPluginLoading)try{e.__hfMotionPathPluginLoading=!0;const s=n.createElement("script");s.src=bhe;const a=()=>{var o;e.__hfMotionPathPluginLoading=!1;try{e.MotionPathPlugin&&((o=e.gsap)!=null&&o.registerPlugin)&&e.gsap.registerPlugin(e.MotionPathPlugin)}catch{}};s.onload=a,s.onerror=a,n.head.appendChild(s)}catch{e.__hfMotionPathPluginLoading=!1}}function hLe(t){return t.includes("gsap.timeline")||t.includes("__timelines")||t.includes(".to(")||t.includes(".set(")}function t3(t){const e=[],n=t.querySelectorAll("script:not([src])");for(const r of n)hLe(r.textContent||"")&&e.push(r);return e}function eC(t){const e=new DOMParser().parseFromString(t,"text/html"),n=t3(e);return n.length!==1?null:n[0].textContent||null}function dLe(t,e){const n=t.__timelines;return n?e.length>0?e.every(r=>n[r]!=null):Object.keys(n).filter(r=>r!=="__proxied").length>0:!1}function D_(t,e){var n,r,i,s;(r=(n=t.__player)==null?void 0:n.seek)==null||r.call(n,e),(i=t.__hfForceTimelineRebind)==null||i.call(t),(s=t.__hfStudioManualEditsApply)==null||s.call(t)}function vhe(t,e){const n=t==null?void 0:t.contentWindow;if(!(n!=null&&n.__hfForceTimelineRebind))return!1;try{return n.__hfSuppressSceneMutations?n.__hfSuppressSceneMutations(()=>D_(n,e)):D_(n,e),!0}catch{return!1}}function bF(t,e,n={}){var b,w;const{onAsyncFailure:r,currentTimeOverride:i,authoredHtml:s}=n;if(!t||!e)return"cannot-soft-reload";const a=t.contentWindow,o=t.contentDocument;if(!a||!o||!a.gsap||!a.__hfForceTimelineRebind)return"cannot-soft-reload";const l=[...e.matchAll(/__timelines\s*\[\s*["'`]([^"'`]+)["'`]\s*\]/g)].map(O=>O[1]).filter(O=>O!=="__proxied");if(l.length===0)return"cannot-soft-reload";const c=t3(o);if(c.length===0)return"cannot-soft-reload";const u=c.filter(O=>l.some(k=>{const E=O.textContent||"";return E.includes(`__timelines["${k}"]`)||E.includes(`__timelines['${k}']`)}));if(c.length>1&&u.length===0)return"cannot-soft-reload";const f=i??((w=(b=a.__player)==null?void 0:b.getTime)==null?void 0:w.call(b))??0;let h=!1,p;const y=O=>{if(p===void 0)try{p=s?new DOMParser().parseFromString(s,"text/html"):null}catch{p=null}if(!p)return null;const k=O.getAttribute("data-hf-id");return k?p.querySelector(`[data-hf-id="${k}"]`):O.id?p.getElementById(O.id):null},m=O=>{const k=y(O);return k instanceof HTMLElement?k.style.opacity:yhe(O)},v=()=>{var _,I,j;const O=a.__timelines,k=[];if(O)for(const L of l){const B=O[L];if(B){if(B.getChildren)try{for(const $ of B.getChildren(!0))if(typeof $.targets=="function")for(const z of $.targets())k.push(z)}catch{}try{(_=B.kill)==null||_.call(B)}catch{}delete O[L]}}const E=new Set(k);for(const L of o.querySelectorAll("[style*='transform']"))L.style.transform&&"_gsap"in L&&!E.has(L)&&(E.add(L),k.push(L));if(k.length>0&&((I=a.gsap)!=null&&I.set)){const L=[];for(const B of k){const $=B;((j=$.style)==null?void 0:j.cssText)!=null&&L.push([$,$.style.cssText])}try{a.gsap.set(k,{clearProps:"all"})}catch{}for(const[B,$]of L){const z=B.style;z.cssText=$,z.removeProperty("transform");const Y=m(B);Y!==null?xhe(z,Y):B.hasAttribute(JE)&&z.getPropertyValue("opacity")==="0"&&z.getPropertyPriority("opacity")==="important"&&z.removeProperty("opacity")}}for(const L of u)L.remove();const T=()=>{var B;a.MotionPathPlugin&&((B=a.gsap)!=null&&B.registerPlugin)&&a.gsap.registerPlugin(a.MotionPathPlugin);const L=o.createElement("script");L.textContent=`(function(){${e} -})();`,o.body.appendChild(L),D_(a,f)};if(/motionPath\s*[:{]/.test(e)&&!a.MotionPathPlugin&&a.gsap){if(h=!0,a.__hfMotionPathPluginLoading){const B=Date.now(),$=a.setInterval(()=>{a.MotionPathPlugin?(a.clearInterval($),T()):(!a.__hfMotionPathPluginLoading||Date.now()-B>1e4)&&(a.clearInterval($),r==null||r())},50);return}a.__hfMotionPathPluginLoading=!0;const L=o.createElement("script");L.src=bhe,L.onload=()=>{a.__hfMotionPathPluginLoading=!1,T()},L.onerror=()=>{a.__hfMotionPathPluginLoading=!1,r==null||r()},o.head.appendChild(L);return}T()};try{return a.__hfSuppressSceneMutations?a.__hfSuppressSceneMutations(v):v(),h||dLe(a,l)?"applied":"verify-failed"}catch{return"cannot-soft-reload"}}function pLe(t,e){if(!t||!Number.isFinite(e)||e<=0)return!1;const n=Array.from(t.querySelectorAll("[data-composition-id]")),r=n.find(i=>{var s;return!((s=i.parentElement)!=null&&s.closest("[data-composition-id]"))})??n[0]??null;return r?(r.setAttribute("data-duration",mi(e)),!0):!1}const mLe=5*6e4,dA=new Map;function Ahe(t){for(const[e,n]of dA)t-n>=mLe&&dA.delete(e)}function She(t,e=Date.now()){Ahe(e),dA.set(t,e)}function gLe(t,e=Date.now()){return Ahe(e),!t||!dA.has(t)?!1:(dA.delete(t),!0)}async function yLe(t){const e=new TextEncoder().encode(t),n=await globalThis.crypto.subtle.digest("SHA-256",e);return`"sha256:${Array.from(new Uint8Array(n),i=>i.toString(16).padStart(2,"0")).join("")}"`}async function xLe(t,e,n){return n!==void 0?yLe(n):t.get(e)}function bLe(){const t=globalThis.crypto;if(typeof(t==null?void 0:t.randomUUID)=="function")return t.randomUUID();if(typeof(t==null?void 0:t.getRandomValues)!="function")throw new Error("Web Crypto getRandomValues is required for Studio write identity");const e=t.getRandomValues(new Uint8Array(16));e[6]=e[6]&15|64,e[8]=e[8]&63|128;const n=Array.from(e,r=>r.toString(16).padStart(2,"0")).join("");return`${n.slice(0,8)}-${n.slice(8,12)}-${n.slice(12,16)}-${n.slice(16,20)}-${n.slice(20)}`}function Zl(){const t=bLe();return She(t),{"X-Hyperframes-Write-Token":t}}class pA extends Error{}class tC extends pA{}async function ea(t,e){if(e.includes("\0")||e.includes(".."))throw new Error(`Unsafe path: ${e}`);const n=await fetch(`/api/projects/${encodeURIComponent(t)}/files/${encodeURIComponent(e)}`);if(!n.ok)throw new Error(`Failed to read ${e}`);const r=await n.json();if(typeof r.content!="string")throw new Error(`Missing file contents for ${e}`);return r.content}async function vLe(t){const e=await fetch(`/api/projects/${encodeURIComponent(t)}/gsap-mutation-capabilities`);if(!e.ok)throw new tC("Server does not support owned GSAP mutations");const n=await e.json().catch(()=>null);if(!vF(n)||n.atomicOwnershipPairs!==!0)throw new tC("Invalid GSAP mutation capability response")}async function ALe(t,e,n,r){if(e.includes("\0")||e.includes(".."))throw new Error(`Unsafe path: ${e}`);const i=await fetch(`/api/projects/${encodeURIComponent(t)}/gsap-mutation-rollback/${encodeURIComponent(e)}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({expected:n,restore:r})});if(!i.ok)throw new Error(`Failed to restore ${e}`);const s=await i.json();if(s.restored===!0&&s.conflict===!1)return"restored";if(s.restored===!1&&s.conflict===!0)return"conflict";throw new Error(`Invalid restore response for ${e}`)}function whe(t,e){try{pLe((t==null?void 0:t.contentDocument)??null,e)}catch{}}function nC(t){const e=Tj((t==null?void 0:t.contentDocument)??null);e>0&&(ue.getState().setDuration(e),whe(t,e))}function mA(t){const e=ue.getState().duration;return()=>{ue.getState().duration!==e&&(ue.getState().setDuration(e),whe(t,e))}}function vF(t){return typeof t=="object"&&t!==null}function SLe(t){if(!vF(t)||typeof t.mutated!="boolean"||typeof t.before!="string"||typeof t.after!="string"||t.mutated!==(t.before!==t.after)||"changed"in t&&t.changed!==t.mutated)throw new tC("Invalid owned GSAP mutation response");return{mutated:t.mutated,scriptText:typeof t.scriptText=="string"?t.scriptText:null,before:t.before,after:t.after}}function wLe(t,e){return vF(t)&&typeof t.error=="string"?t.error:e}async function Ohe(t,e,n,r){let i;try{i=await fetch(`/api/projects/${encodeURIComponent(t)}/gsap-mutations/${encodeURIComponent(e)}`,{method:"POST",headers:{"Content-Type":"application/json",...Zl()},body:JSON.stringify(n)})}catch(a){throw new pA(`${r}: mutation outcome unknown`,{cause:a})}const s=await i.json().catch(()=>null);if(!i.ok)throw new pA(wLe(s,r));return SLe(s)}function OLe(t,e){return vhe(t,e)}function CLe(t,e,n,r,i){if(!e.mutated&&i){OLe(t,n)||r();return}if(!t||!e.scriptText){r();return}bF(t,e.scriptText,{onAsyncFailure:r,currentTimeOverride:n})==="cannot-soft-reload"&&r()}async function Che(t){let e={mutated:!1,scriptText:null};if(t.gsapMutation)try{e=await t.gsapMutation()}catch(n){t.onGsapError(n),n instanceof pA&&t.reloadPreview();return}CLe(t.iframe,e,ue.getState().currentTime,t.reloadPreview,t.rebindWhenUnmutated)}const kLe=1e4;async function ELe(t,e,n){let r=!1;for(let i=e.length-1;i>=0;i-=1){const s=e[i];if(!(!s||s.before===s.after))try{await ALe(t,s.path,s.after,s.before)==="conflict"&&(r=!0)}catch(a){r=!0,n(a)}}return r?"convergence-required":"restored"}async function JX(t,e,n,r){throw await ELe(t,e,n)==="convergence-required"?new pA("GSAP rollback could not safely restore every owned write; preview reload required",{cause:r}):r}async function khe(t){const e=[],n=async(i,s)=>{const a=s();if(!a)return{mutated:!1,scriptText:null};const o=await a;if(!o.mutated)return o;if(o.before===void 0||o.after===void 0)throw new tC(`GSAP mutation returned no owned before/after pair for ${i}`);const l=[...e].reverse().find(u=>u.path===i),c={path:i,before:o.before,after:o.after};if(e.push(c),l&&l.after!==c.before)throw new Error(`GSAP mutation ownership chain broke for ${i}`);return o};let r;try{await vLe(t.projectId),r=await t.gsapMutation(n)}catch(i){return JX(t.projectId,e,t.onRollbackError,i)}if(r.mutated)try{const i=new Map;for(const a of e){const o=i.get(a.path);o?o.after=a.after:i.set(a.path,{before:a.before,after:a.after})}const s={};for(const[a,o]of i){if(await ea(t.projectId,a)!==o.after)throw new Error(`GSAP mutation ownership lost for ${a}`);o.before!==o.after&&(s[a]=o)}Object.keys(s).length>0&&await t.recordEdit({label:t.label,kind:"timeline",coalesceKey:t.coalesceKey,coalesceMs:kLe,files:s})}catch(i){return JX(t.projectId,e,t.onRollbackError,i)}return r}async function Ehe(t,e,n,r){return r===0||!n?{mutated:!1,scriptText:null}:Ohe(t,e,{type:"shift-positions",targetSelector:`#${n}`,delta:r},"shift-positions failed")}async function The(t,e,n,r,i,s,a){return!n||i<=0||a<=0?{mutated:!1,scriptText:null}:r===s&&i===a?{mutated:!1,scriptText:null}:Ohe(t,e,{type:"scale-positions",targetSelector:`#${n}`,oldStart:r,oldDuration:i,newStart:s,newDuration:a},"scale-positions failed")}function eW(t){const{projectId:e,targetPath:n,domId:r,edit:i}=t,s=i.kind==="shift"?i.delta!==0:i.from.start!==i.to.start||i.from.duration!==i.to.duration,a=(l,c)=>i.kind==="shift"?Ehe(l,n,c,i.delta):The(l,n,c,i.from.start,i.from.duration,i.to.start,i.to.duration),o=l=>console.error(`[Timeline] Failed to ${i.kind} GSAP positions`,l);return Che({iframe:t.iframe,reloadPreview:t.reloadPreview,gsapMutation:s&&r&&e?()=>khe({projectId:e,label:t.label,coalesceKey:t.coalesceKey,recordEdit:t.recordEdit,gsapMutation:l=>l(n,()=>a(e,r)),onRollbackError:o}):void 0,onGsapError:o,rebindWhenUnmutated:!0})}async function tW(t){const e=t.activeCompPath||"index.html",n=t.changes.some(i=>t.resolveChangePath(i.element)!==e),r=i=>console.error(`[Timeline] ${t.errorLabel}`,i);await Che({iframe:t.iframe,reloadPreview:t.reloadPreview,gsapMutation:()=>khe({projectId:t.projectId,label:t.label,coalesceKey:t.coalesceKey,recordEdit:t.recordEdit,gsapMutation:async i=>{let s=!1,a=null;for(const o of t.changes){const l=t.resolveChangePath(o.element),c=await i(l,()=>t.mutateChange(o,l));s=s||c.mutated,l===e&&(a=c.scriptText)}return{mutated:s,scriptText:n?null:a}},onRollbackError:r}),onGsapError:r,rebindWhenUnmutated:!n})}const Phe=["position","display","top","left","right","bottom","inset","width","height","gap","justify-content","align-items","flex-direction","font-size","font-style","font-weight","font-family","line-height","letter-spacing","text-align","text-transform","color","background-color","background-image","opacity","mix-blend-mode","border-radius","border-width","border-style","border-color","border-top-width","border-top-style","border-top-color","outline-color","overflow","clip-path","box-shadow","filter","backdrop-filter","z-index","transform","object-fit","object-position"];function ru(t){if(!t)return null;const e=t.trim();if(!e.endsWith("px"))return null;const n=parseFloat(e);return Number.isFinite(n)?n:null}function TLe(t){const e=(t??"none").trim();if(!e||e==="none")return!0;const n=e.match(/^matrix\(([^)]+)\)$/i);if(n&&n[1]){const a=n[1].split(",");if(a.length!==6)return!1;const o=a.map(y=>Number.parseFloat(y.trim()));if(o.some(y=>!Number.isFinite(y)))return!1;const[l=0,c=0,u=0,f=0,h=0,p=0]=o;return Math.abs(l-1)<1e-4&&Math.abs(c)<1e-4&&Math.abs(u)<1e-4&&Math.abs(f-1)<1e-4&&Math.abs(h)<1e-4&&Math.abs(p)<1e-4}const r=e.match(/^matrix3d\(([^)]+)\)$/i);if(!r||!r[1])return!1;const i=r[1].split(",").map(a=>Number.parseFloat(a.trim()));if(i.length!==16||i.some(a=>!Number.isFinite(a)))return!1;const s=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1];return i.every((a,o)=>Math.abs(a-(s[o]??0))<1e-4)}function PLe(t){if(!t.hasStableTarget||t.isInsideLockedComposition)return{canSelect:!t.isInsideLockedComposition,canEditStyles:!1,canCrop:!1,canMove:!1,canResize:!1,canApplyManualOffset:!1,canApplyManualSize:!1,canApplyManualRotation:!1,reasonIfDisabled:t.isInsideLockedComposition?"This element belongs to a locked composition.":"Studio could not resolve a stable patch target for this element."};if(!t.existsInSource)return{canSelect:!0,canEditStyles:!1,canCrop:!1,canMove:!1,canResize:!1,canApplyManualOffset:!1,canApplyManualSize:!1,canApplyManualRotation:!1,reasonIfDisabled:"This element is generated by a script and cannot be edited visually."};if(t.isCompositionRoot)return{canSelect:!0,canEditStyles:!0,canCrop:!1,canMove:!1,canResize:!1,canApplyManualOffset:!1,canApplyManualSize:!1,canApplyManualRotation:!1,reasonIfDisabled:"The root composition defines the preview bounds."};const e=t.computedStyles??{},n=e.position,r=ru(t.inlineStyles.left)??ru(e.left),i=ru(t.inlineStyles.top)??ru(e.top),s=ru(t.inlineStyles.width)??ru(e.width),a=ru(t.inlineStyles.height)??ru(e.height),o=!TLe(e.transform),l=(n==="absolute"||n==="fixed")&&r!=null&&i!=null&&!o,c=l&&(s!=null||a!=null),u=!t.isCompositionHost,f=u?void 0:"Select an internal layer to transform it.";return{canSelect:!0,canEditStyles:!(t.isCompositionHost&&t.isMasterView),canCrop:!0,canMove:l,canResize:c,canApplyManualOffset:u,canApplyManualSize:u,canApplyManualRotation:u,reasonIfDisabled:f}}function AF(t){const e=t.tag===ya,n=t.tag!=="audio"&&!e;return{text:t.hasEditableText&&!t.isCompositionHost&&!t.isInsideLockedComposition,media:t.tag==="video"||t.tag==="audio"||t.tag==="img",audioFx:t.tag==="audio"||e,colorGrading:t.tag==="video"||t.tag==="img",timing:!e&&(t.hasTimingStart||t.animationCount>0),animation:t.animationCount>0&&t.tag!=="audio"&&!e,layout:n,style:n}}function MLe(t){return{capabilities:PLe(t),sections:AF(t)}}function Pc(t){return typeof t=="object"&&t!==null&&"nodeType"in t&&typeof t.nodeType=="number"&&t.nodeType===1}function NLe(t){return["div","span","p","strong","h1","h2","h3","h4","h5","h6"].includes(t)}function Mhe(t){const e=t.ownerDocument.defaultView;if(!e)return!0;let n=t;for(;n;){const r=e.getComputedStyle(n);if(r.display==="none"||r.visibility==="hidden")return!1;const i=Number.parseFloat(r.opacity);if(Number.isFinite(i)&&i<=.01&&!n.hasAttribute(JE))return!1;n=n.parentElement}return!0}function Nhe(t){var r;const e={},n=(r=t.ownerDocument.defaultView)==null?void 0:r.getComputedStyle(t);if(!n)return e;for(const i of Phe){const s=n.getPropertyValue(i);s&&(e[i]=s)}return e}function Dhe(t){const e={};for(const n of Phe){const r=t.style.getPropertyValue(n);r&&(e[n]=r)}return e}function DLe(t){const e={};for(const n of t.attributes)n.name.startsWith("data-")&&(e[n.name.slice(5)]=n.value);return e}function I_(t,e){let n=t;for(;n;){const r=n;if(e.some(i=>r.hasAttribute(i)))return r;n=n.parentElement}return null}let I4=new Map;function nW(t){I4=t}function ILe(t){if(!t||I4.size===0)return;const e=t.getAttribute("data-hf-original-composition-id"),n=t.getAttribute("data-composition-id");return(e?I4.get(e):void 0)??(n?I4.get(n):void 0)}function CS(t,e){const n=I_(t,["data-composition-file","data-composition-src"]),r=I_(t,["data-composition-id"]),i=(n==null?void 0:n.getAttribute("data-composition-file"))??(n==null?void 0:n.getAttribute("data-composition-src"))??(r==null?void 0:r.getAttribute("data-composition-file"))??(r==null?void 0:r.getAttribute("data-composition-src"))??ILe(r)??e??"index.html";return{sourceFile:i,compositionPath:i}}function rW(t){const e=t==null?void 0:t.trim();if(!e)return;let n=e;try{n=new URL(e,"http://studio.local").pathname}catch{n=e}for(const r of["/preview/comp/","/preview/"]){const i=n.indexOf(r);if(i<0)continue;return n.slice(i+r.length).replace(/^\/+/,"")||e}return e}function Ihe(t){const e=globalThis.CSS;if(typeof(e==null?void 0:e.escape)=="function")return e.escape(t);if(t==="-")return"\\-";let n="";for(let r=0;r=48&&s<=57,o=s>=65&&s<=90,l=s>=97&&s<=122,c=s>=1&&s<=31||s===127,u=r===0&&a,f=r===1&&t.startsWith("-")&&a;if(c||u||f){n+=`\\${s.toString(16)} `;continue}if(o||l||a||i==="-"||i==="_"||s>=128){n+=i;continue}n+=`\\${i}`}return n}function Tf(t){return t.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\n/g,"\\a ").replace(/\r/g,"\\d ").replace(/\f/g,"\\c ")}function _Le(t,e){try{return Array.from(t.querySelectorAll(e))}catch{return[]}}function e8(t){var e;return((e=t.replace(/\.html$/i,"").replace(/^compositions\//i,"").split("/").at(-1))==null?void 0:e.replace(/[-_]+/g," ").replace(/\b\w/g,n=>n.toUpperCase()))??t}function kS(t){if(t.id)return`#${Ihe(t.id)}`;const e=t.getAttribute("data-composition-id");if(e)return`[data-composition-id="${Tf(e)}"]`;const n=t.getAttribute("data-hf-group");return n?`[data-hf-group="${Tf(n)}"]`:_he(t)}function _he(t){const e=Array.from(t.classList).map(r=>r.trim()).filter(Boolean);if(e.length===0)return;const n=e.find(r=>r!=="clip"&&!r.startsWith("__hf-"))??e[0];return n?`.${Ihe(n)}`:void 0}function Rhe(t){const e=t.getAttribute("data-composition-id");if(e&&e!=="main")return e8(e);const n=t.getAttribute("data-composition-src")??t.getAttribute("data-composition-file");if(n)return e8(n);const r=t.getAttribute("data-hf-group");if(r)return r;if(t.id)return e8(t.id);const i=_he(t);if(i)return e8(i.replace(/^\./,""));const s=(t.textContent??"").trim().replace(/\s+/g," ");return s?s.length>40?`${s.slice(0,39)}…`:s:t.tagName.toLowerCase()}function SF(t,e,n,r,i){if(n!=null&&n.startsWith("."))return Tse(t,e,n,r,s=>Pc(s)?CS(s,i).sourceFile:void 0)}function Sy(t){return Mhe(t)}const iW=new Set(["img","video","canvas","svg","audio"]);function RLe(t){const e=t.ownerDocument.defaultView;if(!e)return!1;const n=e.getComputedStyle(t);return!!(n.backgroundImage!=="none"||n.backgroundColor&&n.backgroundColor!=="transparent"&&n.backgroundColor!=="rgba(0, 0, 0, 0)"||n.borderWidth&&parseFloat(n.borderWidth)>0&&n.borderStyle!=="none"||n.boxShadow&&n.boxShadow!=="none")}function jLe(t){const e=t.tagName.toLowerCase();if(iW.has(e)||RLe(t))return!1;const{children:n}=t;if(n.length===0)return(t.textContent??"").trim().length===0;for(let r=0;rPc(s)&&(!e.sourceFile||CS(s,n).sourceFile===e.sourceFile),i=s=>_Le(t,s).filter(r);if(e.hfId){const s=i(`[data-hf-id="${Tf(e.hfId)}"]`)[0];if(s)return s}if(e.id){const s=i(`[id="${Tf(e.id)}"]`)[0];if(s)return s}return e.selector?i(e.selector)[e.selectorIndex??0]??null:null}function jhe(t,e,n){var f;const r=typeof e.id=="string"?e.id:"",i=rW(e.compositionSrc)??((f=n.compIdToSrc)==null?void 0:f.get(r)),s=i??rW(e.sourceFile)??n.activeCompositionPath??"index.html",a=Tf(r),o=i?Tf(i):null,l=e.selector??(i?`[data-composition-src="${o}"],[data-composition-file="${o}"],[data-composition-id="${a}"]`:a?`[data-composition-id="${a}"]`:void 0);if(l||e.domId){const h=Is(t,{id:e.domId??void 0,selector:l,selectorIndex:e.selectorIndex,sourceFile:s},n.activeCompositionPath);if(h)return h}const c=!!(e.domId||e.selector||i);if(n.isMasterView||c||!n.activeCompositionPath)return null;const u=t.querySelector("[data-composition-id]");return Pc(u)&&CS(u,n.activeCompositionPath).sourceFile===s?u:null}function QLe(t,e){return Array.from(t.children).filter(n=>Pc(n)&&Rg(n,e.activeCompositionPath)!==null)}let zLe=0;function ZLe(t){const{selectedKeyframes:e,selectedElementId:n}=ue.getState();if(!n)return;const r=t.selectedGsapAnimations.filter(c=>c.keyframes),i=r.length===1?r[0]:void 0,s=new Map(r.map(c=>[c.id,c])),a=new Map;for(const c of e){const u=sTe(n,c);if(!u)continue;const f=u.animationId?s.get(u.animationId):i;if(!f)continue;const h=u.tweenPercentage??u.percentage;a.set(`${f.id}\0${h}`,{animationId:f.id,percentage:h})}const o=[...a.values()];if(o.length===0)return;const l={coalesceKey:`delete-keyframes:${++zLe}`,coalesceMs:Number.POSITIVE_INFINITY};for(const[c,u]of o.entries())t.handleGsapRemoveKeyframe(u.animationId,u.percentage,{...l,...c===o.length-1?{softReload:!0}:{skipReload:!0}})}function GLe(t){var n,r;if(!t)return!1;const e=((r=(n=t.ownerDocument)==null?void 0:n.defaultView)==null?void 0:r.HTMLElement)??globalThis.HTMLElement;return t instanceof e}function ULe(t){var s,a;if(t.element.tag==="audio")return Promise.resolve();const e=t.stackingReorder??null;if(e==null||e.zIndexChanges.length===0)return Promise.resolve();const n=new Map(t.timelineElements.map(o=>[Zn(o),o])),r=((s=t.iframe)==null?void 0:s.contentDocument)??null,i=[];for(const o of e.zIndexChanges){const l=n.get(o.key),c=o.domId??(l==null?void 0:l.domId),u=o.selector??(l==null?void 0:l.selector),f=o.selectorIndex??(l==null?void 0:l.selectorIndex),h=o.sourceFile??(l==null?void 0:l.sourceFile)??t.activeCompPath??"index.html",p=r?Is(r,{id:c,selector:u,selectorIndex:f,sourceFile:h},t.activeCompPath):null;if(!GLe(p))return Promise.resolve();r_(p)!==o.zIndex&&i.push({element:p,zIndex:o.zIndex,id:c??(l==null?void 0:l.id)??o.key,selector:u,selectorIndex:f,sourceFile:h,key:o.key})}return i.length===0?Promise.resolve():Promise.resolve((a=t.commit)==null?void 0:a.call(t,i,t.coalesceKey)).then(()=>{})}function rC(t){const e=ue.getState();return t<=e.duration?!1:(e.setDuration(t),!0)}function Xd(t){return t.domId?{id:t.domId,hfId:t.hfId,selector:t.selector,selectorIndex:t.selectorIndex}:t.hfId?{hfId:t.hfId,selector:t.selector,selectorIndex:t.selectorIndex}:t.selector?{selector:t.selector,selectorIndex:t.selectorIndex}:null}function ES(t,e,n=null){try{const r=t==null?void 0:t.contentDocument;return r?e.kind==="composition"&&e.compositionSrc?jhe(r,e,{activeCompositionPath:n,isMasterView:!0}):Is(r,{hfId:e.hfId,id:e.domId,selector:e.selector,selectorIndex:e.selectorIndex,sourceFile:e.sourceFile||n||"index.html"},n):null}catch{return null}}function iC(t,e,n,r=null){try{const i=ES(t,e,r);if(!i)return;for(const[s,a]of n)i.setAttribute(s,a)}catch{}}function sC(t){return t.playbackStartAttr==="playback-start"||t.kind==="composition"?"data-playback-start":"data-media-start"}function XLe(t,e,n,r){if(r.playbackStart!=null)return{attrName:sC(n).slice(5),value:r.playbackStart};const i=r.start-n.start;if(i===0)return null;const s=P_(t,e,"playback-start")??P_(t,e,"media-start"),a=s!=null?parseFloat(s):void 0;return a==null||!Number.isFinite(a)?null:{attrName:sC(n).slice(5),value:Math.max(0,a+i*Math.max(n.playbackRate??1,.1))}}function Lhe(t,e,n,r,i){if(!Number.isFinite(n)||!Number.isFinite(r))return console.warn(`[Timeline] buildTimelineMoveTimingPatch: non-finite timing (start=${n}, duration=${r}) — patch skipped`),t;let s=yd(t,e,{type:"attribute",property:"start",value:mi(n)});return i!=null&&Number.isFinite(i)&&(s=yd(s,e,{type:"attribute",property:"track-index",value:mi(i)})),Gj(s,Pj(s))}function Fhe(t,e,n,r){const i=XLe(t,e,n,r);let s=yd(t,e,{type:"attribute",property:"start",value:mi(r.start)});return s=yd(s,e,{type:"attribute",property:"duration",value:mi(r.duration)}),i&&(s=yd(s,e,{type:"attribute",property:i.attrName,value:mi(i.value)})),Gj(s,Pj(s))}async function WLe(t){const e=t.element.sourceFile||t.activeCompPath||"index.html",n=await ea(t.projectId,e),r=Xd(t.element);if(!r)throw new Error(`Timeline element ${t.element.id} is missing a patchable target`);const i=t.buildPatches(n,r);if(i===n)throw new Error(`Unable to patch timeline element ${t.element.id} in ${e}`);t.pendingTimelineEditPathRef.current.add(e),t.domEditSaveTimestampRef.current=Date.now(),await il({projectId:t.projectId,label:t.label,kind:"timeline",coalesceKey:t.coalesceKey,files:{[e]:i},readFile:async()=>n,writeFile:t.writeProjectFile,recordEdit:t.recordEdit}),t.domEditSaveTimestampRef.current=Date.now()}async function qLe(t){const e=new Map,n=new Map;for(const i of t.changes){const s=i.element.sourceFile||t.activeCompPath||"index.html",a=e.get(s)??await ea(t.projectId,s);e.set(s,a);const o=Xd(i.element);if(!o)throw new Error(`Timeline element ${i.element.id} is missing a patchable target`);const l=n.get(s)??a;if(!Gf(l,o))throw new Error(`Unable to patch timeline element ${i.element.id} in ${s}`);const c=i.buildPatches(l,o);c!==l&&n.set(s,c)}if(n.size===0)return;const r=Object.fromEntries(n);for(const i of Object.keys(r))t.pendingTimelineEditPathRef.current.add(i);t.domEditSaveTimestampRef.current=Date.now(),await il({projectId:t.projectId,label:t.label,kind:"timeline",coalesceKey:t.coalesceKey,coalesceMs:t.coalesceMs,files:r,readFile:async i=>e.get(i)??ea(t.projectId,i),writeFile:t.writeProjectFile,recordEdit:t.recordEdit}),t.domEditSaveTimestampRef.current=Date.now()}async function $he({projectId:t,targetPath:e,patchTarget:n,attr:r,value:i,label:s,writeProjectFile:a,recordEdit:o,domEditSaveTimestampRef:l,pendingTimelineEditPathRef:c,patchLive:u}){const f=await ea(t,e);if(SS(f,n)===void 0)throw new Error(`Unable to patch element in ${e}`);const h=P_(f,n,r)??null;u(i);const y=yd(f,n,{type:"attribute",property:r,value:i});c.current.add(e),l.current=Date.now();try{const m=await il({projectId:t,label:s,kind:"timeline",files:{[e]:y},readFile:async v=>v===e?f:ea(t,v),writeFile:a,recordEdit:o});return l.current=Date.now(),m}catch(m){throw u(h),m}}const aC=.03;function YLe(t,e,n){return t>=e+aC&&t<=e+n-aC}function n3(t){const e=!!(t.hfId||t.domId||t.selector),n=t.playbackRate==null||Number.isFinite(t.playbackRate)&&t.playbackRate>0;return!t.timelineLocked&&t.timingSource!=="implicit"&&e&&n&&!!t.duration&&Number.isFinite(t.duration)}function Bhe(t,e){return n3(t)&&YLe(e,t.start,t.duration)}function KLe(t,e){return t.filter(n=>Bhe(n,e))}function JLe(t,e,n,r){return e.button!==0||e.shiftKey||!r?!1:t==="start"?n.canTrimStart:n.canTrimEnd}function eFe(t,e,n){return t?t==="move"?!!n:!!e:!1}function tFe(t,e,n,r){if(t.button!==0)return{kind:"ignore"};if(ue.getState().activeTool==="razor")return{kind:"ignore"};if(t.shiftKey)return{kind:"arm-shift-click"};const i=t.currentTarget.getBoundingClientRect(),s=t5e({width:i.width,offsetX:t.clientX-i.left,handleWidth:O3e,capabilities:e});return eFe(s,n,r)?{kind:"block",intent:s,rect:i}:!r||!e.canMove?{kind:"ignore"}:{kind:"move",rect:i}}function nFe(t,e,n,r,i){const{pps:s,onResizeElement:a,onMoveElement:o,onRazorSplit:l,onRazorSplitAll:c,blockedClipRef:u,shiftClickClipRef:f,suppressClickRef:h,scrollRef:p,setShowPopover:y,setRangeSelection:m,setResizingClip:v,setDraggedClip:b,setSelectedElementId:w,onSelectElement:O}=i;return{onResizeStart:(N,_)=>{var I;JLe(N,_,r,a)&&(_.stopPropagation(),u.current=null,y(!1),m(null),v({pointerId:_.pointerId,element:t,edge:N,originClientX:_.clientX,originScrollLeft:((I=p.current)==null?void 0:I.scrollLeft)??0,previewStart:t.start,previewDuration:t.duration,previewPlaybackStart:t.playbackStart,started:!1}))},onPointerDown:N=>{var j,L;const _=tFe(N,r,a,o);if(_.kind==="ignore")return;if(_.kind==="arm-shift-click"){f.current={element:t,anchorX:N.clientX,anchorY:N.clientY};return}if(_.kind==="block"){u.current={pointerId:N.pointerId,element:t,intent:_.intent,originClientX:N.clientX,originClientY:N.clientY,started:!1};return}const{rect:I}=_;u.current=null,y(!1),m(null),b({pointerId:N.pointerId,element:t,originClientX:N.clientX,originClientY:N.clientY,originScrollLeft:((j=p.current)==null?void 0:j.scrollLeft)??0,originScrollTop:((L=p.current)==null?void 0:L.scrollTop)??0,pointerClientX:N.clientX,pointerClientY:N.clientY,pointerOffsetX:N.clientX-I.left,pointerOffsetY:N.clientY-I.top,previewStart:t.start,previewTrack:t.track,desiredTrack:t.track,insertRow:null,snapTime:null,snapType:null,started:!1})},onClick:N=>{if(N.stopPropagation(),h.current)return;const{activeTool:_}=ue.getState();if(_==="razor"&&l){const I=N.currentTarget.getBoundingClientRect(),j=N.clientX-I.left,L=n.start+j/s,B=Math.max(n.start+aC,Math.min(n.start+n.duration-aC,L));N.shiftKey&&c?c(B):l(t,B);return}w(e),O==null||O(t)}}}function rFe(t,e,n){return n?{priority:"interaction",rich:!0}:{priority:t.starte.start?"visible":"overscan",rich:!1}}function iFe({element:t}){const e=ue(n=>n.lintFindingsByElement.get(t.key??t.id));return!e||e.count===0?null:d.jsx("span",{className:"absolute w-1.5 h-1.5 rounded-full bg-amber-400",style:{top:7,right:7},title:e.messages.join(` -`)})}function Vhe(t,e,n,r,i={priority:"visible",rich:!1}){return d.jsxs(d.Fragment,{children:[r==null?void 0:r(t),!n&&d.jsx(iFe,{element:t}),n&&d.jsx("div",{className:"absolute inset-0 overflow-hidden",style:{borderRadius:"inherit"},children:n(t,e,i)})]})}function Hhe(t,e){return Number.isFinite(e)&&!t.hidden&&Number.isFinite(t.start)&&Number.isFinite(t.end)&&e>=t.start&&e<=t.end}function Qhe(t,e){return Hhe({start:t.start,end:t.start+Math.max(0,t.duration),hidden:t.hidden===!0},e)}function sW(t){if(t===void 0||t.trim()==="")return null;const e=Number(t);return Number.isFinite(e)?e:null}function sFe(t){if(!(t instanceof HTMLElement))return null;const e=t.dataset.elId,n=sW(t.dataset.clipStart),r=sW(t.dataset.clipEnd);return!e||n===null||r===null?null:{id:e,start:n,end:r,hidden:t.dataset.clipHidden==="true",element:t}}function aFe(t){return[...t.querySelectorAll('[data-clip="true"]')].map(sFe).filter(e=>e!==null)}function oFe(t,e){return new Set(t.filter(n=>Hhe(n,e)).map(n=>n.id))}function aW(t,e,n,r=!1){const i=oFe(t,n);for(const s of t){const a=i.has(s.id);(r||e.has(s.id)!==a)&&s.element.toggleAttribute("data-active",a)}e.clear();for(const s of i)e.add(s)}function lFe({scrollRef:t,currentTime:e,clipStateVersion:n,elementStateVersion:r}){const i=x.useRef([]),s=x.useRef(new Set),a=x.useCallback(o=>{const l=t.current;if(!l){i.current=[],s.current.clear();return}i.current=aFe(l),aW(i.current,s.current,o,!0)},[t]);x.useLayoutEffect(()=>{a(e)},[n,e,r,a]),Or(()=>xa.subscribe(o=>{aW(i.current,s.current,o)}))}const cFe=new Set(["ArrowLeft","ArrowRight","ArrowUp","ArrowDown","Home","End","PageUp","PageDown"]);function uFe(t){return cFe.has(t)}function tg(t){return t.key??t.id}function fFe(t,e){return[...e].sort((n,r)=>n.start-r.start||n.start+n.duration-(r.start+r.duration)||tg(n).localeCompare(tg(r))).map(n=>{const r=tg(n);return{id:hS(r),kind:"clip",rowId:t,elementId:r,time:n.start+n.duration/2}})}function hFe(t,e,n,r,i){const s=sF(t,e,n,r),a=s?tg(s):null,o=s?FL(i.get(tg(s))??[],s.start,s.duration):[];return{activeClip:s,activeId:a,lanes:o}}function dFe(t){return{percentage:t.percentage,tweenPercentage:t.tweenPercentage,propertyGroup:t.propertyGroup,animationId:t.animationId,collidingAnimationTargets:t.collidingAnimationTargets}}function pFe(t,e,n){var o;const r=tg(e),i=new Map;for(const l of n){const c=dFe(l),u=Cf(r,c);i.has(u)||i.set(u,{target:c,time:e.start+l.percentage/100*e.duration})}const s=[...i.entries()].sort(([l,c],[u,f])=>c.time-f.time||l.localeCompare(u)),a=[];for(let l=0;lu.time&&c.target.animationId!==void 0&&a.push({id:loe(r,c.target),kind:"ease",rowId:t,elementId:r,time:u.time+(c.time-u.time)/2,keyframeTarget:c.target}),a.push({id:ooe(r,c.target),kind:"keyframe",rowId:t,elementId:r,time:c.time,keyframeTarget:c.target})}return a}function mFe(t,e,n){return t===null?!1:e.has(t)||n.has(t)}function gFe(t,e,n,r,i,s,a){const o=K2(n,i.group);return{id:o,kind:"row",physicalTrackKey:t,logicalIndex:e,level:s,parentId:a,elementId:n,expandable:!1,expanded:!1,propertyGroup:i.group,items:pFe(o,r,i.keyframes)}}function yFe({tracks:t,displayTrackOrder:e,laneCounts:n,selectedElementId:r,selectedElementIds:i,expandedClipIds:s,collapsedGroupIds:a,expandedLaneOwnerIds:o,groups:l,trackGroupOf:c,gsapAnimations:u}){const f=new Map(t),h=new Map(l.map(v=>[v.anchorKey,v])),p=[];function y(v,b,w){const O=f.get(v)??[],k=aTe(v),{activeClip:E,activeId:T,lanes:N}=hFe(O,n,r,i,u),_=AFe(O,N.length),I=mFe(T,s,o)&&_;if(p.push({id:k,kind:"row",physicalTrackKey:v,logicalIndex:p.length,level:b,parentId:w,elementId:T,expandable:_,expanded:I,items:fFe(k,O)}),!(!I||!E||!T))for(const j of N)p.push(gFe(v,p.length,T,E,j,b===1?2:3,k))}function m(v){const b=oTe(v.id),w=!a.has(v.id);if(p.push({id:b,kind:"row",physicalTrackKey:v.anchorKey,logicalIndex:p.length,level:1,parentId:null,elementId:null,groupId:v.id,expandable:v.memberTracks.length>0,expanded:w,items:[]}),o.has(v.id))for(const O of zf(v.memberElements))p.push({id:`${b}::${O.key}`,kind:"row",physicalTrackKey:v.anchorKey,logicalIndex:p.length,level:2,parentId:b,elementId:null,expandable:!1,expanded:!1,items:[]});if(w)for(const O of v.memberTracks)y(O,2,b)}for(const v of e){const b=h.get(v);if(b){m(b);continue}c.has(v)||y(v,1,null)}return p}function El(t,e){for(let n=0;ns.id===e);if(i>=0)return{row:r,rowIndex:n,itemIndex:i,target:r.items[i]}}return null}function xFe(t,e){return[...t.items].sort((n,r)=>Math.abs(n.time-e)-Math.abs(r.time-e)||n.time-r.time||n.id.localeCompare(r.id))[0]??t}function bFe(t,e,n,r={}){var m;const i=El(t,e);if(!i)return null;const{row:s,rowIndex:a,itemIndex:o,target:l}=i;if(n==="Home"||n==="End"){const v=r.timelineBoundary?n==="Home"?t[0]:t.at(-1):s;return v?r.timelineBoundary||n==="Home"?v:v.items.at(-1)??v:l}if(n==="ArrowLeft")return o<0?s.parentId?((m=El(t,s.parentId))==null?void 0:m.target)??s:s:o===0?s:s.items[o-1];if(n==="ArrowRight")return o<0?s.items[0]??s:s.items[o+1]??l;const c=n==="ArrowUp"||n==="PageUp"?-1:1,u=n==="PageUp"||n==="PageDown",f=r.pageSize;if(u&&(f===void 0||!Number.isFinite(f)||f<1))return l;const h=u?Math.floor(f):1,p=Math.max(0,Math.min(t.length-1,a+c*h)),y=t[p];return!y||p===a?l:l.kind==="row"?y:xFe(y,l.time)}function vFe(t,e,n){const r=El(e,n);if(r)return r.target;const i=El(t,n);if(!i)return null;if(i.itemIndex>=0){for(let a=i.itemIndex-1;a>=0;a-=1){const o=El(e,i.row.items[a].id);if(o)return o.target}for(let a=i.itemIndex+1;a0||zf(t).length>0}function oW(t){if(!(t.target instanceof Element))return null;const e=t.target.closest("button, input, select, textarea, a[href], [contenteditable], [data-timeline-focus-id]");return e!=null&&e.dataset.timelineFocusId&&t.currentTarget.contains(e)?e:null}function SFe(t,e,n,r){if(!r||t.size===0)return 1;const i=n.getRowIndex(e),s=Math.max(0,i>=0?i:Math.floor(n.getRowFromY(r.scrollTop))),a=i>=0?n.getRowTop(i):r.scrollTop,o=Math.min(n.rowKeys.length-1,Math.floor(n.getRowFromY(a+Math.max(0,r.clientHeight-.001))));let l=0;for(let c=s;c<=o;c+=1)l+=t.get(n.rowKeys[c])??0;return Math.max(1,l)}function wFe(t){const e=t.getBoundingClientRect();t.dispatchEvent(new MouseEvent("contextmenu",{bubbles:!0,cancelable:!0,clientX:e.left+e.width/2,clientY:e.top+e.height/2}))}function OFe({logicalRows:t,focusedTargetId:e,rowGeometry:n,scrollRef:r,onToggleRow:i}){var c,u;const s=(e&&((c=El(t,e))==null?void 0:c.target.id))??((u=t[0])==null?void 0:u.id)??null,a=x.useMemo(()=>{const f=new Map;for(const h of t)f.set(h.physicalTrackKey,(f.get(h.physicalTrackKey)??0)+1);return f},[t]),o=x.useCallback(f=>{var p;const h=(p=oW(f))==null?void 0:p.dataset.timelineFocusId;h&&h!==e&&ue.getState().requestTimelineFocus(h)},[e]),l=x.useCallback(f=>{const h=oW(f),p=h==null?void 0:h.dataset.timelineFocusId;if(!h||!p)return;const y=El(t,p);if(y){if(uFe(f.key)){if(y.target.kind==="row"&&(f.key==="ArrowRight"&&y.target.expandable&&!y.target.expanded||f.key==="ArrowLeft"&&y.target.expandable&&y.target.expanded)){f.preventDefault(),i(y.target);return}const m=bFe(t,p,f.key,{pageSize:SFe(a,y.row.physicalTrackKey,n,r.current),timelineBoundary:f.ctrlKey||f.metaKey});f.preventDefault(),m&&m.id!==p&&ue.getState().requestTimelineFocus(m.id);return}if(f.key==="ContextMenu"||f.key==="F10"&&f.shiftKey){f.preventDefault(),wFe(h);return}f.key!=="Enter"&&f.key!==" "||y.target.kind!=="row"||!y.target.expandable||(f.preventDefault(),i(y.target))}},[a,t,i,n,r]);return{rovingTargetId:s,onFocus:o,onKeyDown:l}}function CFe({pps:t,contentOrigin:e,contentGutter:n,trackContentWidth:r,theme:i,displayTrackOrder:s,rowGeometry:a,virtualRows:o,logicalRows:l,focusedTargetId:c,rowsVirtualized:u,clipIndex:f,renderTimeRange:h,visibleTimeRange:p,pinnedClipIdentities:y,trackOrder:m,tracks:v,trackStyles:b,groups:w,laneCounts:O,selectedElementId:k,selectedElementIds:E,hoveredClip:T,draggedClip:N,draggedElement:_,multiDragPreview:I,blockedClipRef:j,suppressClickRef:L,scrollRef:B,renderClipContent:$,renderClipOverlay:z,onDrillDown:Y,onSelectElement:W,setHoveredClip:J,setShowPopover:ne,setRangeSelection:le,setResizingClip:ie,setDraggedClip:q,setSelectedElementId:F,shiftClickClipRef:U,getPreviewElement:Z,getTrackStyle:K,keyframeCache:ee,gsapAnimations:re,selectedKeyframes:Q,currentTime:H,onSeek:se,onSelectSegment:fe,onClickKeyframe:be,onShiftClickKeyframe:me,onContextMenuKeyframe:pe,onMoveKeyframe:ge,onContextMenuClip:Pe,onContextMenuLane:ve,beatAnalysis:xe,onToggleTrackHidden:we,onTogglePropertyGroupKeyframe:Ce,onResizeElement:Me,onMoveElement:Ve,onRazorSplit:tt,onRazorSplitAll:Ze}){const qe=`timeline-lanes${x.useId().replaceAll(":","")}`,pt=ue(Ye=>Ye.expandedClipIds),{collapsedGroupIds:it,expandedLaneOwnerIds:vt,toggleGroupExpanded:Ot,toggleLaneOwnerExpanded:Kt}=_7e(),qt=HIe(),fn=ue(Ye=>Ye.duration);t_e({lanes:qt});const{logicalRowsByTrack:Jt,groupByAnchor:Je}=R7e(l,w),St=x.useMemo(()=>new Set(w.flatMap(Ye=>Ye.memberTracks)),[w]),{toggleRowExpanded:At,toggleClipExpanded:Ke}=j7e(),Be=nje(I,u,h),We=OFe({logicalRows:l,focusedTargetId:c,rowGeometry:a,scrollRef:B,onToggleRow:Ye=>{Ye.elementId&&Ke(Ye.elementId)}});return d.jsx("div",{role:"treegrid","aria-label":"Timeline tracks","aria-rowcount":l.length,"aria-colcount":2,onFocus:We.onFocus,onKeyDown:We.onKeyDown,className:u?"absolute inset-0":void 0,children:o.map(({index:Ye,rowKey:Zt})=>{var nr,gt,rr,Cn,Rn;const Te=s[Ye];if(Te===void 0)return null;const De=Je.get(Te);if(De){const xt=(nr=Jt.get(Te))==null?void 0:nr[0];return xt?d.jsx(I7e,{index:Ye,rowKey:Zt,group:De,logicalRow:xt,top:a.getRowTop(Ye),height:a.getRowHeight(Ye),virtualized:u,contentOrigin:e,theme:i,rovingTargetId:We.rovingTargetId,collapsedGroupIds:it,expandedLaneOwnerIds:vt,toggleGroupExpanded:Ot,toggleLaneOwnerExpanded:Kt,lanes:qt,pps:t,currentTime:H,compositionDuration:fn,beatTimes:xe==null?void 0:xe.beatTimes,contentGutter:n,trackContentWidth:r},Zt):null}const ze=Pfe(s,Te),st=Jt.get(Te)??[],Gt=st[0];if(!Gt)return null;const ln=a.getRowHeight(Ye),Yt=((gt=v.find(([xt])=>xt===Te))==null?void 0:gt[1])??[],Nn=u?Zae(f,Te,h,y,Be):Yt,Mr=b.get(Te)??K(""),mt=(N==null?void 0:N.started)===!0&&!m.includes(Te)&&Yt.length===0,vn=i.rowBackground,mn=Q7e(Yt,xe==null?void 0:xe.beatTimes,{selectedElementId:k,isMusicTrack:my}),Tn=Yt.length>0&&Yt.every(xt=>xt.hidden===!0),Ln=Yt.length>0&&Yt.some(Jo),et=sF(Yt,O,k,E),Yn=(et==null?void 0:et.key)??(et==null?void 0:et.id),Mt=G7e(Yt,pt),hn=Mt?Xi-2*ha:void 0,Ht=Yt.map(Z),dn=`${qe}-track-${Ye}`,tr=`${dn}-automation`,_n=et&&Yn?qt.bind(et,k===Yn||E.has(Yn)):null,xr=_n&&!_n.readOnly?xt=>_n.onCommit({version:1,lanes:_n.lanes.filter(Ut=>Ut.target!==xt)}):void 0;return d.jsxs(Vfe,{index:Ye,rowKey:Zt,logicalRow:Gt,propertyRows:st.slice(1),lanesId:dn,headerLanesId:`${dn} ${tr}`,top:a.getRowTop(Ye),height:ln,virtualized:u,background:vn,borderColor:i.rowBorder,rovingTargetId:We.rovingTargetId,children:[d.jsx(T7e,{trackNumber:Te,trackDisplayNumber:ze,trackLabel:((rr=Yt[0])==null?void 0:rr.label)??((Cn=Yt[0])==null?void 0:Cn.domId)??((Rn=Yt[0])==null?void 0:Rn.id)??`Track${YE(ze)}`,lanesId:`${dn} ${tr}`,contentOrigin:e,keyframeClip:et,trackElements:Yt,clipCount:Yt.length,isExpanded:Mt,animations:Yn?re.get(Yn)??[]:[],currentTime:H,isTrackHidden:Tn,isAudioTrack:Ln,isGroupMember:St.has(Te),theme:i,onToggleClipExpanded:()=>{const xt=Yt.map(Zn);xt.length>0&&At(xt)},onToggleTrackHidden:we,onTogglePropertyGroupKeyframe:Ce,onRemoveAutomationLane:xr,onSeek:se,rovingTargetId:We.rovingTargetId}),d.jsxs("div",{role:"gridcell","aria-colindex":2,style:{width:r,marginLeft:n,opacity:Tn?.35:1,transition:"opacity 120ms ease"},className:"relative",onContextMenu:xt=>{if(xt.defaultPrevented||!ve)return;const Ut=xt.currentTarget.getBoundingClientRect(),Ct=(xt.clientX-Ut.left)/t;Ct<0||(xt.preventDefault(),ve(xt,Te,Ct))},children:[d.jsx(rTe,{beatTimes:xe==null?void 0:xe.beatTimes,beatStrengths:xe==null?void 0:xe.beatStrengths,pps:t,highlightTime:N!=null&&N.started&&N.snapType==="beat"?N.snapTime:null,renderTimeRange:u?h:void 0}),mn&&d.jsx(iTe,{beatTimes:xe==null?void 0:xe.beatTimes,beatStrengths:xe==null?void 0:xe.beatStrengths,pps:t,renderTimeRange:u?h:void 0}),mt&&d.jsx("div",{className:"absolute inset-0 flex items-center",style:{paddingLeft:16,color:Mr.label,fontSize:11,letterSpacing:"0.06em",textTransform:"uppercase",opacity:.5},children:"New track"}),Nn.map(xt=>{const Ut=K(xt.tag),Ct=Zn(xt),fr=Ct===Yn,Dt=fr&&Mt,wt=lS(xt),gn=k===Ct||E.has(Ct),Lt=!!xt.compositionSrc,rn=Ct;if((N==null?void 0:N.started)===!0&&_!=null&&Zn(_)===Ct)return null;const Fn=Z(xt),ri=rFe(Fn,p,gn||T===rn||y.has(rn)),cn=I!=null&&Zfe(rn,I),kn=cn?eje(rn,t,I):0,ir=nFe(xt,Ct,Fn,wt,{pps:t,onResizeElement:Me,onMoveElement:Ve,onRazorSplit:tt,onRazorSplitAll:Ze,blockedClipRef:j,shiftClickClipRef:U,suppressClickRef:L,scrollRef:B,setShowPopover:ne,setRangeSelection:le,setResizingClip:ie,setDraggedClip:q,setSelectedElementId:F,onSelectElement:W}),Pi=d.jsx(coe,{onContextMenu:Nr=>{Nr.preventDefault(),Pe==null||Pe(Nr,xt)},el:Fn,pps:t,clipY:ha,clipHeight:hn,isSelected:gn,isHovered:T===rn,isDragging:!1,isActive:Qhe(Fn,H),hasCustomContent:!!$,capabilities:wt,theme:i,isComposition:Lt,tabIndex:We.rovingTargetId===hS(Ct)?0:-1,onHoverStart:()=>J(rn),onHoverEnd:()=>J(null),onResizeStart:ir.onResizeStart,onPointerDown:ir.onPointerDown,onClick:ir.onClick,onDoubleClick:Nr=>{Nr.stopPropagation(),!L.current&&Lt&&Y&&Y(xt)},children:Vhe(Fn,Ut,$,z,ri)},rn),Jr=ee==null?void 0:ee.get(Ct),Vi=!Dt&&Jr&&d.jsx(hPe,{element:Fn,elementId:Ct,keyframesData:Jr,pixelsPerSecond:t,rowHeight:ln,beatsActive:mn,accentColor:Ut.accent,isSelected:gn,currentTime:H,selectedKeyframes:Q,rovingTargetId:We.rovingTargetId,onClickKeyframe:be,onShiftClickKeyframe:me,onContextMenuKeyframe:pe,onMoveKeyframe:ge,onSelectSegment:fe,suppressClickRef:L},`${rn}-diamonds`),ds=fr&&d.jsx(FDe,{id:dn,animations:Dt?re.get(Ct)??[]:[],clipStart:Ice(Fn),clipDuration:Fn.duration,clipLeftPx:Fn.start*t,clipWidthPx:Math.max(Fn.duration*t,4),accentColor:Ut.accent,isSelected:gn,currentPercentage:Fn.duration>0?(H-Fn.start)/Fn.duration*100:0,elementId:Ct,selectedKeyframes:Q,rovingTargetId:We.rovingTargetId,onSelectSegment:Nr=>fe==null?void 0:fe(Ct,Nr),onClickKeyframe:Nr=>be==null?void 0:be(Fn,Nr),onShiftClickKeyframe:Nr=>me==null?void 0:me(Ct,Nr),onContextMenuKeyframe:(Nr,Qa)=>pe==null?void 0:pe(Nr,Ct,Qa),onMoveKeyframe:(Nr,Qa)=>(ge==null?void 0:ge(Ct,Nr,Qa))??Promise.resolve(!1),suppressClickRef:L},`${rn}-property-lanes`);return cn?d.jsxs("div",{className:"absolute inset-0",style:{transform:`translateX(${kn}px)`,opacity:.85,zIndex:20,pointerEvents:"none"},children:[Pi,Vi,ds]},rn):d.jsxs(x.Fragment,{children:[Pi,Vi,ds]},rn)}),d.jsx("div",{id:tr,children:Mt?d.jsx(Wce,{elements:Ht,isSelected:xt=>{const Ut=Zn(xt);return k===Ut||E.has(Ut)},lanes:qt,pps:t,laneCount:Yn?O.get(Yn)??0:0,accentColor:K((et==null?void 0:et.tag)??"").accent,currentTime:H,beatTimes:xe==null?void 0:xe.beatTimes}):null})]})]},Zt)})})}const zhe=8,oC={playhead:0,"clip-edge":1,beat:2};function kFe(t){const e=new Map,n=(r,i)=>{if(!Number.isFinite(r)||r<0)return;const s=Math.round(r*1e3)/1e3,a=e.get(s);(!a||oC[i]r.time-i.time)}function lC(t,e,n){let r=null,i=n;for(const s of e){const a=Math.abs(s.time-t);(a1e-6&&(f=null),{start:y,snapTime:(f==null?void 0:f.time)??null,snapType:(f==null?void 0:f.type)??null}}function TFe(t,e,n,r){if(n<0)return t;const i=e.indexOf(t);return i<0?t:r?i>=n?t:e[n]??t:i=e:t<=e}function PFe(t,e,n,r){if(e.length===0)return n<0?0:n;const i=t.indexOf(e[0]),s=t.indexOf(e[e.length-1])+1;return rn.has(w));if(s!==null&&lW(s,f,c))return{track:i,insertRow:s};const h=TFe(i,e,f,c),p=e.filter(w=>n.has(w)===c),y=DFe({elements:r,desiredTrack:h,start:a,duration:o,trackOrder:p,excludeKey:l}),m=(b=r.find(w=>(w.key??w.id)===l))==null?void 0:b.track,v=m!=null&&h!==m&&y.track===m;if(y.needsInsert||v){const w=e.indexOf(h);if(w<0)return{track:h,insertRow:PFe(e,p,f,h)};const O=m==null?-1:e.indexOf(m),E=(v?O>w:u&&lW(w,f,c))?w:w+1;return{track:h,insertRow:E}}return{track:y.track,insertRow:null}}function NFe(t,e,n=k3e){if(e===0||t<=0)return 0;if(t>=e)return e;const r=Math.floor(t),i=t-r;return i1-n?r+1:null}function Zhe(t,e,n,r){return t(s.key??s.id)!==i&&s.track===e&&Zhe(n,r,s.start,s.start+s.duration))}function DFe({elements:t,desiredTrack:e,start:n,duration:r,trackOrder:i,excludeKey:s}){const a=n+r,o=i.indexOf(e);if(o===-1)return{track:e,needsInsert:!0};if(_4(t,e,n,a,s))return{track:e,needsInsert:!1};for(let l=o-1;l>=0;l--)if(_4(t,i[l],n,a,s))return{track:i[l],needsInsert:!1};for(let l=o+1;l0?t.scrollWidth/e:n)}function RFe(t,e,n,r,i){if(i.size<=1||!i.has(n))return t;const s=r.filter(o=>i.has(o.key??o.id)).map(o=>o.start),a=tje(t-e.start,s);return e.start+a}function jFe(t,e,n,r,i){const{scroll:s,trackOrder:a,rowHeights:o,elements:l}=i,c=s?M3e(e-s.getBoundingClientRect().top+s.scrollTop,o):{rowFloat:0,fraction:0,rowHeight:jae(0,o)},u=NFe(c.rowFloat,a.length,N3e(c.rowHeight)),f=c.fraction<.5,h=i.audioTracks??new Set(l.filter(Jo).map(p=>p.track));return MFe({order:a,audioTracks:h,elements:l,desiredTrack:r,deliberateInsertRow:u,start:n,duration:t.element.duration,dragKey:t.element.key??t.element.id,isAudio:Jo(t.element),preferInsertAbove:f})}function LFe(t,e,n,r){const{scroll:i,pps:s,duration:a,trackOrder:o,elements:l,selectedKeys:c,buildSnapTargets:u}=r,f=_Fe(i,s,a),h=(i==null?void 0:i.scrollTop)??t.originScrollTop,p=(i==null?void 0:i.getBoundingClientRect().top)??0,y=s_(t.originClientY-p+t.originScrollTop,r.rowHeights),m=s_(n-p+h,r.rowHeights),v=J3e({start:t.element.start,track:t.element.track,duration:t.element.duration,originClientX:t.originClientX,originRow:y,originScrollLeft:t.originScrollLeft,currentScrollLeft:(i==null?void 0:i.scrollLeft)??t.originScrollLeft,pixelsPerSecond:s,maxStart:f,trackOrder:o},e,m),b=u(t.element.key??t.element.id,!my(t.element)),w=EFe(v.start,t.element.duration,b,s,f+t.element.duration),O=t.element.key??t.element.id,k=RFe(w.start,t.element,O,l,c),{track:E,insertRow:T}=jFe(t,n,k,v.track,r);return{...t,started:!0,pointerClientX:e,pointerClientY:n,previewStart:k,previewTrack:E,desiredTrack:v.track,insertRow:T,snapTime:w.snapTime,snapType:w.snapType}}function FFe(t,e,n){const{scroll:r,pps:i,buildSnapTargets:s}=n,a=t.originScrollLeft??(r==null?void 0:r.scrollLeft)??0,o=e+(((r==null?void 0:r.scrollLeft)??a)-a),l=t.element.sourceDuration!=null?Math.max(0,(t.element.sourceDuration-(t.element.playbackStart??0))/Math.max(t.element.playbackRate??1,.1)):Number.POSITIVE_INFINITY,c=t.element.tag.toLowerCase(),u=t.element.kind==="composition"||c==="audio"||c==="video",f=Math.max(t.element.playbackRate??1,.1),h=t.element.start+l;let p=e5e({start:t.element.start,duration:t.element.duration,originClientX:t.originClientX,pixelsPerSecond:i,minStart:0,maxEnd:h,playbackStart:t.edge==="start"&&u?t.element.playbackStart??0:t.element.playbackStart,playbackRate:t.element.playbackRate},t.edge,o);const y=s(t.element.key??t.element.id,!my(t.element));if(y.length>0){const m=zhe/Math.max(i,1);if(t.edge==="end"){const v=p.start+p.duration,b=lC(v,y,m).time,w=Math.round((b-p.start)*1e3)/1e3;b!==v&&b<=h+1e-6&&w>=.05&&(p={...p,duration:w})}else{const v=lC(p.start,y,m).time,b=p.start-v,w=p.playbackStart!=null?p.playbackStart/f:Number.POSITIVE_INFINITY,O=Math.round((p.duration+b)*1e3)/1e3;v!==p.start&&v>=0&&b<=w+1e-6&&O>=.05&&(p={...p,start:v,duration:O,playbackStart:p.playbackStart!=null?Math.round(Math.max(0,p.playbackStart-b*f)*1e3)/1e3:void 0})}}return{originScrollLeft:a,previewStart:p.start,previewDuration:p.duration,previewPlaybackStart:p.playbackStart}}function $Fe(t,e,n){const r=K3e(t,e);n({originScrollLeft:e.originScrollLeft,previewStart:(r==null?void 0:r.start)??e.previewStart,previewDuration:(r==null?void 0:r.duration)??e.previewDuration,previewPlaybackStart:(r==null?void 0:r.playbackStart)??e.previewPlaybackStart,groupPreview:t.changes})}const BFe=x.memo(function({drag:e,scrollRef:n,pixelsPerSecond:r,rowHeight:i,selectedElementId:s,currentTime:a,theme:o,getTrackStyle:l,renderClipContent:c,renderClipOverlay:u}){const f=(e==null?void 0:e.started)===!0?c3e({element:e.element,draggedElementId:e.element.key??e.element.id,previewStart:e.previewStart,previewTrack:e.previewTrack}):null,h=e?IFe(e,n.current):null;return d.jsx("div",{"data-timeline-gesture-overlay":!0,className:"absolute inset-0 pointer-events-none",children:f&&h&&d.jsx("div",{"data-timeline-gesture-actor":f.key??f.id,className:"absolute",style:{top:h.top,left:h.left,width:Math.max(f.duration*r,4),height:i,zIndex:40},children:d.jsx(coe,{el:{...f,start:0},pps:r,clipY:0,isSelected:s===(f.key??f.id),isHovered:!1,isDragging:!0,isGestureActor:!0,isActive:Qhe(f,a),hasCustomContent:!!c,capabilities:lS(f),theme:o,isComposition:!!f.compositionSrc,onHoverStart:()=>{},onHoverEnd:()=>{},onResizeStart:()=>{},onClick:()=>{},onDoubleClick:()=>{},children:Vhe(f,l(f.tag),c,u,{priority:"interaction",rich:!0})})})})}),VFe=x.memo(function(e){const{draggedClip:n,scrollRef:r,selectedElementIds:i,displayTrackOrder:s}=e,a=(n==null?void 0:n.started)===!0?s.indexOf(n.previewTrack):-1,o=jae(a,e.rowHeights),l=Math.min(o,Xi)-ha*2,{onResizeElement:c,onMoveElement:u,onToggleTrackHidden:f,onTogglePropertyGroupKeyframe:h,onRazorSplit:p,onRazorSplitAll:y}=fS(),m=ue(O=>O.beatDragging),v=(n==null?void 0:n.element)??null,b=v?Zn(v):null,w=(n==null?void 0:n.started)===!0&&v&&b?{dragStarted:!0,draggedKey:b,draggedOriginStart:v.start,draggedPreviewStart:n.previewStart,selectedKeys:i}:null;return d.jsxs("div",{className:"relative",style:{height:e.totalH,width:e.contentOrigin+e.trackContentWidth},children:[d.jsx(G5e,{major:e.major,minor:e.minor,pps:e.pps,trackContentWidth:e.trackContentWidth,totalH:e.totalH,effectiveDuration:e.effectiveDuration,majorTickInterval:e.majorTickInterval,theme:e.theme,beatAnalysis:e.beatAnalysis,contentOrigin:e.contentOrigin,renderTimeRange:e.rowsVirtualized?e.renderTimeRange:void 0}),d.jsx("div",{"aria-hidden":"true",style:{height:e.rowsVirtualized?0:r0}}),d.jsx(CFe,{...e,draggedElement:v,multiDragPreview:w,onToggleTrackHidden:f,onTogglePropertyGroupKeyframe:h,onResizeElement:c,onMoveElement:u,onRazorSplit:p,onRazorSplitAll:y}),d.jsx("div",{"aria-hidden":"true",style:{height:e.rowsVirtualized?0:Rae}}),e.laneGapStrips.map(O=>{const k=s.indexOf(O.track);if(k<0)return null;const E=O.kind==="hover";return(e.rowsVirtualized?O.intervals.filter(N=>N.starte.renderTimeRange.start):O.intervals).map(N=>d.jsx("div",{className:"pointer-events-none absolute",style:{top:ZP(k,e.rowHeights)+ha,left:e.contentOrigin+N.start*e.pps,width:Math.max((N.end-N.start)*e.pps,2),height:Xi-ha*2,background:E?"rgba(60,230,172,0.18)":"rgba(60,230,172,0.055)",borderRadius:4,zIndex:25}},`gap-${O.kind}-${O.track}-${N.start}`))}),(n==null?void 0:n.started)&&n.insertRow==null&&a>=0&&d.jsx("div",{className:"absolute pointer-events-none",style:{top:ZP(a,e.rowHeights)+ha,left:e.contentOrigin+n.previewStart*e.pps,width:Math.max(n.element.duration*e.pps,4),height:l,border:"1px solid rgba(60,230,172,0.55)",background:"rgba(60,230,172,0.12)",borderRadius:4,zIndex:30}}),(n==null?void 0:n.started)&&n.insertRow!=null&&d.jsx("div",{className:"absolute pointer-events-none",style:{top:ZP(n.insertRow,e.rowHeights)-.5,left:e.contentOrigin,width:e.trackContentWidth,height:1,background:"#3CE6AC",boxShadow:"0 0 3px rgba(60,230,172,0.5)",zIndex:55}}),(n==null?void 0:n.started)&&n.snapTime!=null&&n.snapType!=="beat"&&d.jsx("div",{className:"absolute pointer-events-none",style:{left:e.contentOrigin+n.snapTime*e.pps,top:Ra,bottom:0,width:1,background:n.snapType==="playhead"?"#3CE6AC":"rgba(255,255,255,0.6)",boxShadow:n.snapType==="playhead"?"0 0 6px rgba(60,230,172,0.5)":"0 0 6px rgba(255,255,255,0.4)",zIndex:60}}),d.jsx(BFe,{drag:n,scrollRef:r,pixelsPerSecond:e.pps,rowHeight:l,selectedElementId:e.selectedElementId,currentTime:e.currentTime,theme:e.theme,getTrackStyle:e.getTrackStyle,renderClipContent:e.renderClipContent,renderClipOverlay:e.renderClipOverlay}),e.marqueeRect&&d.jsx("div",{"aria-hidden":"true",className:"absolute pointer-events-none",style:{left:e.marqueeRect.left,top:e.marqueeRect.top,width:e.marqueeRect.width,height:e.marqueeRect.height,background:"rgba(60,230,172,0.10)",border:"1px dashed rgba(60,230,172,0.7)",borderRadius:2,zIndex:70}}),e.rangeSelection&&d.jsx("div",{className:"absolute pointer-events-none",style:{left:e.contentOrigin+Math.min(e.rangeSelection.start,e.rangeSelection.end)*e.pps,width:Math.abs(e.rangeSelection.end-e.rangeSelection.start)*e.pps,top:Ra,bottom:0,backgroundColor:"rgba(59, 130, 246, 0.12)",borderLeft:"1px solid rgba(59, 130, 246, 0.4)",borderRight:"1px solid rgba(59, 130, 246, 0.4)",zIndex:50}}),d.jsx("div",{ref:e.playheadRef,className:"absolute top-0 bottom-0 pointer-events-none",style:{left:`${a_(0,0,e.contentOrigin)}px`,width:M6,zIndex:100,display:m?"none":void 0},children:d.jsx(U5e,{scrubbing:e.isScrubbing})})]})});function Sc(t){return Jo(t)?"audio":"visual"}const cC=t=>t.key??t.id,cW=1e-6;function HFe(t,e){return t.startr?1:0}function zFe(t,e,n){const r=[...t].sort(QFe),i=[];for(const s of r){let a=i.findIndex(o=>o.every(l=>!HFe(l,s)));a===-1&&(a=i.length,i.push([])),i[a].push(s),n.set(cC(s),e+a)}return Math.max(1,i.length)}function uW(t,e,n){const r=new Map;for(const s of t){const a=r.get(s.track);a?a.push(s):r.set(s.track,[s])}let i=0;for(const s of[...r.keys()].sort((a,o)=>a-o))i+=zFe(r.get(s),e+i,n);return i}function Ghe(t){if(t.length===0)return t;const e=new Map,n=[],r=[];for(const o of t)(Sc(o)==="audio"?r:n).push(o);let i=0;i+=uW(n,i,e),uW(r,i,e);let s=!1;const a=t.map(o=>{const l=e.get(cC(o));return l==null||l===o.track?o:(s=!0,{...o,track:l,authoredTrack:o.authoredTrack??o.track})});return s?a:t}const fW=1e-6,uC=t=>JSON.stringify([t.sourceFile??null,t.stackingContextId??null]);function wF(t,e){return uC(t)===uC(e)}function ZFe(t,e){return t.starte.zIndex:t.domIndex!=null&&e.domIndex!=null?t.domIndex>e.domIndex:!1}function R_(t,e){return t.length>0?e(t.map(n=>n.zIndex)):null}function GFe(t,e,n,r){const i=e.filter(h=>!h.isAudio);if(i.length===0)return!1;const s=i.filter(h=>__(t,h)),a=i.filter(h=>__(h,t));if(s.every(h=>jg(t,h))&&a.every(h=>jg(h,t)))return!1;const l=R_(s,h=>Math.max(...h)),c=WFe(t,s,a);if(c!=null)return c!==t.zIndex&&r(t,c),c!==t.zIndex;const u=l!=null?l+1:0,f=Math.max(0,u);return f!==t.zIndex&&r(t,f),qFe(t,n,r),!0}function UFe(t,e,n){if(e-t>=2){const r=Math.floor((t+e)/2);return r>t&&r=0?n:e(t)?t:null}function WFe(t,e,n){const r=R_(e,a=>Math.max(...a)),i=R_(n,a=>Math.min(...a)),s=a=>{const o={...t,zIndex:a};return e.every(l=>jg(o,l))&&n.every(l=>jg(l,o))};return r!=null&&i!=null?UFe(r,i,s):r!=null?r+1:i!=null?XFe(i,s):null}function qFe(t,e,n){const r=[t],i=(s,a)=>{jg(s,a)||(n(s,a.zIndex+1),r.push(s))};for(;r.length>0;){const s=r.shift();for(const a of e(s))__(a,s)&&!jg(a,s)&&i(a,s)}}function YFe(t,e){const n=new Set(e);if(n.size===0)return[];const r=t.filter(y=>Number.isFinite(y.zIndex)),i=new Set(r.filter(y=>n.has(y.key)).map(uC)),s=r.filter(y=>i.has(uC(y))),a=new Map(s.map(y=>[y.key,{...y}])),o=s.filter(y=>n.has(y.key)&&!y.isAudio).map(y=>a.get(y.key)).sort((y,m)=>m.track-y.track),l=new Map,c=(y,m)=>{y.zIndex=m,l.set(y.key,m)},u=[...a.values()],f=y=>u.filter(m=>m.key!==y.key&&!m.isAudio&&wF(y,m)&&ZFe(y,m));for(const y of o)GFe(y,f(y),f,c);const h=new Set,p=[];for(const y of o)l.has(y.key)&&!h.has(y.key)&&(p.push({key:y.key,zIndex:l.get(y.key)}),h.add(y.key));for(const[y,m]of l)h.has(y)||(p.push({key:y,zIndex:m}),h.add(y));return p}function rv(t){return lS({tag:t.tag,kind:t.kind,duration:t.duration,domId:t.domId,selector:t.selector,compositionSrc:t.compositionSrc,playbackStart:t.playbackStart,playbackStartAttr:t.playbackStartAttr,sourceDuration:t.sourceDuration,timingSource:t.timingSource,timelineLocked:t.timelineLocked}).canMove}function KFe(t,e){const n=e.selectedKeys;if(!n)return null;const r=new Set(n),i=e.elements.includes(t.element)?e.elements:[...e.elements,t.element];for(const u of i){const f=u.expandedHostKey,h=Zn(u);f&&r.has(f)&&r.has(h)&&r.delete(h)}const s=t.element.expandedHostKey,a=Zn(t.element);if(!s||r.has(a))return r.size===n.size?null:{drag:t,selectedKeys:r};const o=e.elements.find(u=>Zn(u)===s);if(!o||!rv(o))return null;const l=t.previewStart-t.element.start,c=u=>u===t.element.track?o.track:u;return{drag:{...t,element:o,previewStart:Math.max(0,Math.round((o.start+l)*1e3)/1e3),previewTrack:c(t.previewTrack)??o.track,desiredTrack:c(t.desiredTrack)},selectedKeys:r}}const j_=new WeakMap;function r3(t,e){let n=j_.get(t);n||(n=new Map,j_.set(t,n));const r=new Map;for(const i of e){const s=(n.get(i)??0)+1;n.set(i,s),r.set(i,s)}return r}function fC(t,e,n){var r;return((r=j_.get(t))==null?void 0:r.get(n))===e.get(n)}function L_(t,e,n){for(const r of n)fC(t,e,r.key)&&t(r.key,r.updates)}let t8=null;function OF(t){const e=t8;let n;if(e)n=e.then(t,t);else try{n=Promise.resolve(t())}catch(i){n=Promise.reject(i)}const r=n.then(()=>{},()=>{});return t8=r,r.then(()=>{t8===r&&(t8=null)}),n}function Uhe(t){return OF(async()=>{const n=await t.commitZ();return n&&!n.durable?!1:t.mirror()})}function Xhe(t){return OF(async()=>await t.commitLane()?(await t.commitZ(),!0):!1)}function Lg(t,e){return t.then(n=>{var r;return n&&((r=e.refreshAfterLaneMove)==null||r.call(e)),n})}const hW=t=>t.key??t.id,CF=(t,e)=>(t.sourceFile??null)===(e.sourceFile??null);function kF(t,e,n){const r=hW(n),i=e.filter(o=>hW(o)!==r&&CF(o,n)),s=i.find(o=>o.track===t);if(s)return s.authoredTrack??s.track;let a=null;for(const o of i)(!a||Math.abs(o.track-t)t.key??t.id,JFe=t=>Math.round(t*1e3)/1e3;let Whe=0;function xd(t,e,n,r="timing",i){if(t.length===0)return Promise.resolve(!0);const{updateElement:s,onMoveElement:a,onMoveElements:o}=e;o||console.warn(a?`[Timeline] persistMoveEdits: only single-clip onMoveElement wired — this ${t.length}-clip move degrades to a per-clip persist race (no atomic single-undo)`:`[Timeline] persistMoveEdits: no move persist handler wired — ${t.length} edit(s) applied to the store only, not saved`);const l=t.map(p=>({key:Gr(p.element),start:p.element.start,track:p.element.track,authoredTrack:p.element.authoredTrack})),c=r3(s,t.map(p=>Gr(p.element))),u=p=>{const y=p.persistTrack??(p.updates.track!==p.element.track?p.updates.track:void 0);s(Gr(p.element),y==null?p.updates:{...p.updates,authoredTrack:y})};for(const p of t)u(p);const f=t.map(p=>p.persistTrack==null||p.persistTrack===p.updates.track?p:{element:p.element,updates:{...p.updates,track:p.persistTrack}}),h=o?o(f,n,r,i):Promise.all(f.map(p=>Promise.resolve(a==null?void 0:a(p.element,p.updates))));return Promise.resolve(h).then(()=>{for(const p of t){const y=Gr(p.element);fC(s,c,y)&&u(p)}return!0},p=>{for(const y of l)fC(s,c,y.key)&&s(y.key,{start:y.start,track:y.track,authoredTrack:y.authoredTrack});return console.error("[Timeline] Failed to persist clip edits",p),!1})}function dW(t,e){return t.length===0?0:e<=0?t[0]-.5:e>=t.length?t[t.length-1]+.5:(t[e-1]+t[e])/2}function e$e(t,e){const{elements:n,selectedKeys:r}=e,i=Gr(t.element);if(!r||r.size<=1||!r.has(i))return null;const s=new Set([...r].filter(l=>{const c=n.find(u=>Gr(u)===l);return c?rv(c):!1})),a=t.previewStart-t.element.start;return{keys:s,movedStart:l=>Gr(l)===i?t.previewStart:Math.max(0,JFe(l.start+a))}}function qhe(t,e){const n=KFe(t,e);if(n){qhe(n.drag,{...e,selectedKeys:n.selectedKeys});return}const{elements:r,updateElement:i,onMoveElement:s}=e,a=Gr(t.element),o=t.insertRow!=null,l=t.previewTrack!==t.element.track,c=t.desiredTrack??t.previewTrack,u=o||c!==t.element.track,f=e$e(t,e);if(!o&&!l){if(t.previewStart-t.element.start===0)return;if(f){const E=r.filter(T=>f.keys.has(Gr(T))).map(T=>({element:T,updates:{start:f.movedStart(T),track:T.track}})).filter(T=>T.updates.start!==T.element.start);xd(E,e);return}const w={start:t.previewStart,track:t.element.track},O={start:t.element.start,track:t.element.track},k=r3(i,[a]);i(a,w),Promise.resolve(s==null?void 0:s(t.element,w)).catch(E=>{fC(i,k,a)&&i(a,O),console.error("[Timeline] Failed to persist clip edit",E)});return}if(o){t$e(t,e,f);return}const h={element:t.element,updates:{start:t.previewStart,track:t.previewTrack},persistTrack:kF(t.previewTrack,r,t.element)},p=u?`clip-lane-move:${Whe++}`:void 0,y=[h];if(f)for(const b of r){if(Gr(b)===a||!f.keys.has(Gr(b)))continue;const w=f.movedStart(b);w!==b.start&&y.push({element:b,updates:{start:w,track:b.track}})}const m=r.map(b=>Gr(b)===a?{...b,start:t.previewStart,track:t.previewTrack}:f!=null&&f.keys.has(Gr(b))?{...b,start:f.movedStart(b)}:b),v=f?f.keys:null;if(!u||!e.readZIndex||!e.onStackingPatches){Lg(xd(y,e,p,"lane-reorder"),e);return}Lg(Xhe({commitLane:()=>xd(y,e,p,"lane-reorder"),commitZ:()=>Khe(m,a,t.element.track,t.previewTrack,v,e,p)}),e).catch(()=>{})}function Yhe(t,e,n,r,i){const{elements:s,trackOrder:a}=i,o=Gr(t);if(t.expandedParentStart!=null)return null;const l=dW(a,n),c=s.map(w=>Gr(w)===o?{...w,start:e,track:l}:r!=null&&r.keys.has(Gr(w))?{...w,start:r.movedStart(w)}:w),u=Sc(t),f=w=>CF(w,t)&&Sc(w)===u&&w.expandedParentStart==null,h=[...new Set(s.filter(f).map(w=>w.track))].sort((w,O)=>w-O),p=h.filter(w=>wGr(w)===o?{...w,start:e,track:y}:r!=null&&r.keys.has(Gr(w))?{...w,start:r.movedStart(w)}:w)),v=new Map(s.map(w=>[Gr(w),w]));for(const w of m){const O=v.get(Gr(w));if(O&&f(O)&&!rv(O)&&w.track!==(O.authoredTrack??O.track))return console.warn(`[Timeline] Track insert refused: locked clip ${Gr(O)} would need renumbering`),null}const b=[];if(r)for(const w of s){const O=Gr(w);O!==o&&r.keys.has(O)&&!f(w)&&rv(w)&&b.push({element:w,updates:{start:r.movedStart(w),track:w.track},persistTrack:w.authoredTrack})}for(const w of m){const O=v.get(Gr(w));if(!O||!rv(O))continue;const k=Gr(w)===o||r!=null&&r.keys.has(Gr(w))?(r==null?void 0:r.movedStart(O))??e:O.start;b.push({element:O,updates:{start:k,track:w.track}})}return{candidate:c,edits:b}}function t$e(t,e,n){const r=Gr(t.element),i=Yhe(t.element,t.previewStart,t.insertRow,n,e);if(!i)return;const{candidate:s,edits:a}=i;if(a.length===0)return;const o=`clip-lane-move:${Whe++}`;if(!e.readZIndex||!e.onStackingPatches){Lg(xd(a,e,o,"track-insert"),e);return}Lg(Xhe({commitLane:()=>xd(a,e,o,"track-insert"),commitZ:()=>Khe(s,r,t.element.track,t.insertRow,n?n.keys:null,e,o)}),e).catch(()=>{})}function n$e(t,e,n,r,i){if(e.kind==="move"){const a={element:t,updates:{start:t.start,track:e.displayTrack},persistTrack:e.persistTrack};return Lg(xd([a],n,r,"lane-reorder",i),n)}const s=Yhe(t,t.start,e.insertRow,null,n);return!s||s.edits.length===0?Promise.resolve(!1):Lg(xd(s.edits,n,r,"track-insert",i),n)}function Khe(t,e,n,r,i,s,a){const{readZIndex:o,onStackingPatches:l}=s;if(!o||!l||r===n)return Promise.resolve();const c=t.map((h,p)=>({key:Gr(h),start:h.start,duration:h.duration,track:h.track,zIndex:o(h),isAudio:Sc(h)==="audio",sourceFile:h.sourceFile,domIndex:p,stackingContextId:h.stackingContextId??null})),u=[e];if(i)for(const h of i)h!==e&&u.push(h);const f=YFe(c,u);return f.length===0?Promise.resolve():Promise.resolve(l(f,a)).then(()=>{})}function r$e(t,e,n){if(!t.hasChanged)return;const r=t.changes,i=r3(e,r.map(a=>a.key));for(const a of r)e(a.key,{start:a.start,duration:a.duration,playbackStart:a.playbackStart});if(!n){L_(e,i,t.members.map(a=>({key:a.key,updates:a})));return}const s=`clip-group-resize:${r.map(a=>a.key).join(":")}`;Promise.resolve(n(r.map(a=>({element:a.element,start:a.start,duration:a.duration,playbackStart:a.playbackStart})),{coalesceKey:s})).catch(a=>{L_(e,i,t.members.map(o=>({key:o.key,updates:o}))),console.error("[Timeline] Failed to persist group clip resize",a)})}function i$e({lifecycleRef:t,sessionEpochRef:e,cancelGestureRef:n,scrollRef:r,draggedClipRef:i,resizingClipRef:s,blockedClipRef:a,groupResizeRef:o,suppressClickRef:l,gestureSelectedKeysRef:c,elementsRef:u,trackOrderRef:f,setDraggedClipState:h,setResizingClipState:p,setShowPopover:y,setRangeSelectionRef:m,applyResizePointerRef:v,syncClipDragAutoScrollRef:b,stopClipDragAutoScrollRef:w,updateDraggedClipPreviewRef:O,publishDraggedClip:k,updateElement:E,onMoveElementRef:T,onMoveElementsRef:N,onResizeElementRef:_,onResizeElementsRef:I,onBlockedEditAttemptRef:j,readZIndexRef:L,onStackingPatchesRef:B,refreshAfterLaneMoveRef:$}){const z=()=>{requestAnimationFrame(()=>{l.current=!1})},Y=pe=>{const ge=t.current.pointerId;return ge===null||pe.pointerId===ge},W=pe=>{if(pe===null)return;const ge=r.current;try{ge!=null&&ge.hasPointerCapture(pe)&&ge.releasePointerCapture(pe)}catch{}},J=pe=>{var ge;if(pe!==null)try{(ge=r.current)==null||ge.setPointerCapture(pe)}catch{}},ne=pe=>{i.current=null,s.current=null,o.current=null,pe&&(h(null),p(null))},le=({updateReact:pe=!0,suppressClick:ge=!1}={})=>{const Pe=t.current;return Pe.phase!=="active"?!1:(Pe.phase="cancelled",w.current(),ne(pe),W(Pe.pointerId),ge&&(l.current=!0),Pe.kind=null,Pe.pointerId=null,Pe.phase="complete",!0)};n.current=le;const ie=(pe,ge)=>{var ve;const Pe=Math.abs(pe.clientX-ge.originClientX);!ge.started&&Pe<2||(ge.started||J(ge.pointerId),y(!1),(ve=m.current)==null||ve.call(m,null),v.current(ge,pe.clientX),b.current(pe.clientX,pe.clientY))},q=(pe,ge)=>{var xe,we;const Pe=Math.hypot(pe.clientX-ge.originClientX,pe.clientY-ge.originClientY),ve=ge.intent==="move"?4:2;!ge.started&&Pe{var ve;const Pe=Math.hypot(pe.clientX-ge.originClientX,pe.clientY-ge.originClientY);!ge.started&&Pe<4||(ge.started||J(ge.pointerId),y(!1),(ve=m.current)==null||ve.call(m,null),k(O.current(ge,pe.clientX,pe.clientY)),b.current(pe.clientX,pe.clientY))},U=pe=>{const ge=s.current;if(ge)return Y(pe)?ie(pe,ge):void 0;const Pe=a.current;if(Pe)return Pe.pointerId!==pe.pointerId?void 0:q(pe,Pe);const ve=i.current;ve&&Y(pe)&&F(pe,ve)},Z=(pe,ge)=>{var we;if(!pe.started)return;if(l.current=!0,z(),ge){r$e(ge,E,I.current);return}if(!(pe.previewStart!==pe.element.start||pe.previewDuration!==pe.element.duration||pe.previewPlaybackStart!==pe.element.playbackStart))return;const ve=pe.element.key??pe.element.id,xe=r3(E,[ve]);E(ve,{start:pe.previewStart,duration:pe.previewDuration,playbackStart:pe.previewPlaybackStart}),Promise.resolve((we=_.current)==null?void 0:we.call(_,pe.element,{start:pe.previewStart,duration:pe.previewDuration,playbackStart:pe.previewPlaybackStart})).catch(Ce=>{L_(E,xe,[{key:ve,updates:{start:pe.element.start,duration:pe.element.duration,playbackStart:pe.element.playbackStart}}]),console.error("[Timeline] Failed to persist clip resize",Ce)})},K=pe=>{a.current=null,pe.started&&z()},ee=pe=>{pe.started&&(l.current=!0,z(),qhe(pe,{elements:u.current,trackOrder:f.current,updateElement:E,onMoveElement:T.current,onMoveElements:N.current,selectedKeys:c.current,readZIndex:L.current,onStackingPatches:B.current,refreshAfterLaneMove:$.current}))},re=()=>{var Pe,ve,xe;const pe=((Pe=o.current)==null?void 0:Pe.members.map(we=>we.element))??[((ve=s.current)==null?void 0:ve.element)??((xe=i.current)==null?void 0:xe.element)],ge=new Set(u.current.map(we=>we.key??we.id));return pe.every(we=>we===void 0||ge.has(we.key??we.id))},Q=pe=>{const ge=t.current;if(ge.phase!=="active")return null;if(!Y(pe))return"ignored";if(ge.sessionEpoch!==e.current||!re())return le(),"ignored";ge.phase="committing";const Pe=ge.kind?{kind:ge.kind,drag:i.current,resize:s.current,groupResize:o.current}:"ignored";return w.current(),ne(!0),W(ge.pointerId),Pe==="ignored"&&(ge.phase="complete"),Pe},H=pe=>{try{pe.kind==="resize"&&pe.resize?Z(pe.resize,pe.groupResize):pe.kind==="drag"&&pe.drag&&ee(pe.drag)}finally{const ge=t.current;ge.kind=null,ge.pointerId=null,ge.phase="complete"}},se=pe=>{const ge=Q(pe);if(ge==="ignored")return;if(ge){H(ge);return}const Pe=a.current;if(Pe)return Pe.pointerId!==pe.pointerId?void 0:K(Pe);l.current&&z()},fe=pe=>{t.current.phase==="active"&&Y(pe)&&le({suppressClick:!0})&&z();const ge=a.current;ge&&ge.pointerId!==pe.pointerId||(a.current=null,l.current&&z())},be=pe=>{t.current.phase==="active"&&Y(pe)&&le({suppressClick:!0})&&z()},me=pe=>{const ge=i5e({key:pe.key,drag:i.current,resize:s.current,blocked:a.current});ge.cancel&&(pe.preventDefault(),a.current=null,le({suppressClick:ge.suppressClick}))};return window.addEventListener("pointermove",U),window.addEventListener("pointerup",se),window.addEventListener("pointercancel",fe),window.addEventListener("lostpointercapture",be),window.addEventListener("keydown",me),()=>{le({updateReact:!1}),n.current=()=>!1,window.removeEventListener("pointermove",U),window.removeEventListener("pointerup",se),window.removeEventListener("pointercancel",fe),window.removeEventListener("lostpointercapture",be),window.removeEventListener("keydown",me)}}const n8=[];function s$e({scrollRef:t,ppsRef:e,durationRef:n,trackOrderRef:r,rowGeometryRef:i,onMoveElement:s,onMoveElements:a,onResizeElement:o,onResizeElements:l,onBlockedEditAttempt:c,setShowPopover:u,setRangeSelectionRef:f,readZIndex:h,onStackingPatches:p,refreshAfterLaneMove:y,sessionEpoch:m=0}){const v=ue(Je=>Je.updateElement),b=ue(Je=>{var St;return((St=Je.beatAnalysis)==null?void 0:St.beatTimes)??n8}),w=ue(Je=>{var St;return((St=Je.beatAnalysis)==null?void 0:St.beatStrengths)??n8}),O=ue(Je=>Je.beatEdits),k=ue(Je=>y0(Je.elements).musicElement),E=(k==null?void 0:k.start)??0,T=(k==null?void 0:k.playbackStart)??0,N=(k==null?void 0:k.duration)??0,_=(k==null?void 0:k.src)??null,I=x.useMemo(()=>{if(b===n8||N===0)return n8;const Je=Dj(b,w,O,_),St=T+N,At=E-T;return Je.times.filter(Ke=>Ke>=T&&Ke<=St).map(Ke=>Math.round((Ke+At)*1e3)/1e3)},[b,w,O,_,E,T,N]),j=ue(Je=>Je.elements),L=ue(Je=>Je.timelineSnapEnabled),B=x.useRef({beatTimes:[],enabled:!0});B.current={beatTimes:I,enabled:L};const $=x.useRef(j);$.current=j;const z=x.useRef(new Map),Y=x.useRef(null),W=x.useCallback((Je,St)=>{if(!B.current.enabled)return[];const At=`${Je??""}|${St?1:0}`,Ke=z.current.get(At);if(Ke)return Ke;const Be=kFe({elements:$.current,playheadTime:ue.getState().currentTime,beatTimes:St?B.current.beatTimes:[],excludeElementKey:Je});return z.current.set(At,Be),Be},[]),[J,ne]=x.useState(null),le=x.useRef(null),ie=x.useCallback(Je=>{le.current=Je,ne(Je)},[]),[q,F]=x.useState(null),U=x.useRef(null),Z=x.useCallback(Je=>{U.current=Je,F(Je)},[]),K=x.useRef({kind:null,phase:"complete",pointerId:null,sessionEpoch:m}),ee=x.useRef(m);ee.current=m;const re=x.useRef(new Set),Q=x.useRef(()=>!1),H=x.useCallback((Je,St)=>{K.current.phase==="active"&&Q.current(),K.current={kind:Je,phase:"active",pointerId:St,sessionEpoch:ee.current},re.current=new Set(ue.getState().selectedElementIds)},[]),se=x.useCallback(Je=>{if(!Je){Q.current();return}H("drag",Je.pointerId),ie(Je)},[H,ie]),fe=x.useCallback(Je=>{if(!Je){Q.current();return}H("resize",Je.pointerId),Z(Je)},[H,Z]),be=x.useRef(null),me=x.useRef(!1),pe=x.useRef(null),ge=x.useRef(s);ge.current=s;const Pe=x.useRef(a);Pe.current=a;const ve=x.useRef(c);ve.current=c;const xe=x.useRef(o);xe.current=o;const we=x.useRef(l);we.current=l;const Ce=x.useRef(h);Ce.current=h;const Me=x.useRef(p);Me.current=p;const Ve=x.useRef(y);Ve.current=y;const tt=x.useRef(0),Ze=x.useRef(null),qe=x.useCallback((Je,St,At)=>(Y.current||(Y.current=y0($.current).audioTracks),LFe(Je,St,At,{scroll:t.current,pps:e.current,duration:n.current,trackOrder:r.current,rowHeights:i==null?void 0:i.current.rowHeights,elements:$.current,selectedKeys:re.current,buildSnapTargets:W,audioTracks:Y.current})),[t,e,n,r,i,W]),pt=x.useCallback((Je,St)=>{const At=FFe(Je,St,{scroll:t.current,pps:e.current,buildSnapTargets:W}),Ke=Ye=>Z(U.current?{...U.current,started:!0,...Ye}:null),Be=Je.element.key??Je.element.id;let We=pe.current;if(!We||We.grabbedKey!==Be||We.edge!==Je.edge){const Ye=q3e($.current,re.current,Be,Je.edge);We=Ye?{grabbedKey:Be,edge:Je.edge,members:Ye,changes:[],hasChanged:!1}:null,pe.current=We}if(!We){Ke(At);return}$Fe(We,At,Ke)},[t,e,W,Z]),it=x.useRef(pt);it.current=pt;const vt=x.useCallback(()=>{Ze.current=null,tt.current&&(cancelAnimationFrame(tt.current),tt.current=0),z.current.clear(),Y.current=null},[]),Ot=x.useCallback(()=>{tt.current=0;const Je=le.current,St=U.current,At=Ze.current,Ke=t.current;!Je&&!St||!At||!Ke||EE(Ke,At.clientX,At.clientY)&&(Je?ie(qe(Je,At.clientX,At.clientY)):St&&it.current(St,At.clientX),tt.current=requestAnimationFrame(Ot))},[ie,t,qe]),Kt=x.useCallback((Je,St)=>{Ze.current={clientX:Je,clientY:St};const At=cS(t.current,Je,St,tt.current!==0);At==="stop"?(cancelAnimationFrame(tt.current),tt.current=0):At==="start"&&(tt.current=requestAnimationFrame(Ot))},[t,Ot]),qt=x.useRef(qe);qt.current=qe;const fn=x.useRef(Kt);fn.current=Kt;const Jt=x.useRef(vt);return Jt.current=vt,Or(()=>i$e({onStackingPatchesRef:Me,refreshAfterLaneMoveRef:Ve,readZIndexRef:Ce,onBlockedEditAttemptRef:ve,onResizeElementsRef:we,onResizeElementRef:xe,onMoveElementsRef:Pe,onMoveElementRef:ge,updateElement:v,publishDraggedClip:ie,updateDraggedClipPreviewRef:qt,stopClipDragAutoScrollRef:Jt,syncClipDragAutoScrollRef:fn,applyResizePointerRef:it,setRangeSelectionRef:f,setShowPopover:u,setResizingClipState:F,setDraggedClipState:ne,trackOrderRef:r,elementsRef:$,gestureSelectedKeysRef:re,suppressClickRef:me,groupResizeRef:pe,blockedClipRef:be,resizingClipRef:U,draggedClipRef:le,scrollRef:t,cancelGestureRef:Q,sessionEpochRef:ee,lifecycleRef:K})),x.useEffect(()=>{Q.current()},[m]),{draggedClip:J,setDraggedClip:se,resizingClip:q,setResizingClip:fe,blockedClipRef:be,suppressClickRef:me,stopClipDragAutoScroll:vt}}function pW(t){if(typeof document>"u"||!document.body||!document.execCommand)return!1;const e=document.createElement("textarea");e.value=t,e.setAttribute("readonly","true"),e.style.position="fixed",e.style.top="0",e.style.left="0",e.style.width="1px",e.style.height="1px",e.style.padding="0",e.style.border="0",e.style.opacity="0",e.style.pointerEvents="none",document.body.appendChild(e),e.focus({preventScroll:!0}),e.select(),e.setSelectionRange(0,t.length);try{return document.execCommand("copy")}catch{return!1}finally{e.remove()}}function a$e(){if(typeof navigator>"u")return!1;const t=navigator.userAgent;return/Safari/i.test(t)&&!/Chrome|Chromium|CriOS|FxiOS|Edg|OPR/i.test(t)}async function Uf(t){const e=a$e();if(e&&pW(t))return!0;const n=typeof navigator<"u"?navigator.clipboard:void 0;if(n!=null&&n.writeText)try{return await n.writeText(t),!0}catch{}return!e&&pW(t)}function o$e(t,e){return`hf-edit-draft:${t.toFixed(2)}:${e.toFixed(2)}`}function l$e(t){try{return sessionStorage.getItem(t)??""}catch{return""}}function mW(t,e){try{e?sessionStorage.setItem(t,e):sessionStorage.removeItem(t)}catch{}}function c$e({rangeStart:t,rangeEnd:e,anchorX:n,anchorY:r,onClose:i}){const s=ue(I=>I.elements),a=Math.min(t,e),o=Math.max(t,e),l=o$e(a,o),[c,u]=x.useState(()=>l$e(l)),f=I=>{u(I),mW(l,I)},[h,p]=x.useState(!1),[y,m]=x.useState(!1),[v,b]=x.useState(!1),w=x.useRef(null),O=x.useRef(null),k=x.useMemo(()=>s.filter(I=>{const j=I.start+I.duration;return I.starta}),[s,a,o]);Or(()=>{setTimeout(()=>{var I;return(I=O.current)==null?void 0:I.focus()},50)}),Or(()=>{const I=j=>{j.key==="Escape"&&i()};return window.addEventListener("keydown",I),()=>window.removeEventListener("keydown",I)}),Or(()=>{const I=j=>{w.current&&!w.current.contains(j.target)&&i()};return setTimeout(()=>window.addEventListener("mousedown",I),100),()=>window.removeEventListener("mousedown",I)});const E=x.useCallback(()=>r5e({rangeStart:a,rangeEnd:o,elements:k,prompt:c}),[a,o,k,c]),T=x.useCallback(async()=>{if(!await Uf(E())){b(!0);return}b(!1),mW(l,""),p(!0),setTimeout(()=>{p(!1),i()},800)},[E,i,l]),N=x.useCallback(async()=>{const I=XG(c);if(!I)return;if(!await Uf(I)){b(!0);return}b(!1),m(!0),setTimeout(()=>{m(!1)},800)},[c]),_={position:"fixed",left:Math.max(8,Math.min(n-160,window.innerWidth-336)),top:Math.max(8,r-280),zIndex:200};return d.jsx("div",{ref:w,style:_,children:d.jsxs("div",{className:"w-80 bg-neutral-900 border border-neutral-700/60 rounded-xl shadow-2xl shadow-black/40 overflow-hidden",children:[d.jsxs("div",{className:"flex items-center justify-between px-4 py-2.5 border-b border-neutral-800/60",children:[d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx("div",{className:"w-1.5 h-1.5 rounded-full bg-studio-accent"}),d.jsxs("span",{className:"text-[11px] font-medium text-neutral-300",children:[os(a)," — ",os(o)]})]}),d.jsxs("span",{className:"text-[10px] text-neutral-600",children:[k.length," element",k.length!==1?"s":""]})]}),k.length>0&&d.jsx("div",{className:"px-4 py-2 border-b border-neutral-800/40 max-h-24 overflow-y-auto",children:k.map(I=>d.jsxs("div",{className:"flex items-center justify-between py-0.5",children:[d.jsxs("span",{className:"text-[10px] font-mono text-studio-accent/80",children:["#",I.id]}),d.jsx("span",{className:"text-[10px] text-neutral-600",children:I.tag})]},I.id))}),d.jsx("div",{className:"p-3",children:d.jsx("textarea",{ref:O,value:c,onChange:I=>f(I.target.value),onKeyDown:I=>{I.key==="Enter"&&(I.metaKey||I.ctrlKey)&&(I.preventDefault(),T())},placeholder:"What should change?",rows:2,className:"w-full px-3 py-2 text-xs bg-neutral-800/60 border border-neutral-700/40 rounded-lg text-neutral-200 placeholder:text-neutral-600 resize-none focus:outline-none focus:border-studio-accent/40 transition-colors"})}),v&&d.jsx("p",{className:"px-3 pb-2 text-[10px] text-red-400",role:"alert",children:"Copy failed — check clipboard permissions and try again."}),d.jsxs("div",{className:"grid grid-cols-2 gap-2 px-3 pb-3",children:[d.jsx("button",{onClick:N,disabled:!XG(c),className:`py-1.5 text-[11px] font-medium rounded-lg transition-all border ${y?"bg-green-500/20 text-green-400 border-green-500/30":"bg-neutral-800/70 text-neutral-200 border-neutral-700/50 hover:bg-neutral-800"} disabled:opacity-50 disabled:cursor-not-allowed`,children:y?"Prompt Copied!":"Copy Prompt"}),d.jsxs("button",{onClick:T,className:`py-1.5 text-[11px] font-medium rounded-lg transition-all ${h?"bg-green-500/20 text-green-400 border border-green-500/30":"bg-studio-accent/15 text-studio-accent border border-studio-accent/25 hover:bg-studio-accent/25"}`,children:[h?"Copied!":"Copy to Agent",!h&&d.jsx("span",{className:"text-[9px] text-studio-accent/50 ml-1.5",children:"Cmd+Enter"})]})]})]})})}function Jhe(t){x.useEffect(()=>{var s;const e=t.current;if(!e)return;const n=document.activeElement,r=()=>Array.from(e.querySelectorAll('[role="menuitem"]')).filter(a=>!a.disabled);(s=r()[0])==null||s.focus();const i=a=>{var u;if(a.key!=="ArrowDown"&&a.key!=="ArrowUp"&&a.key!=="Home"&&a.key!=="End")return;const o=r();if(o.length===0)return;a.preventDefault();const l=o.findIndex(f=>f===document.activeElement);let c;a.key==="ArrowDown"?c=l<0?0:(l+1)%o.length:a.key==="ArrowUp"?c=l<0?o.length-1:(l-1+o.length)%o.length:a.key==="Home"?c=0:c=o.length-1,(u=o[c])==null||u.focus()};return e.addEventListener("keydown",i),()=>{e.removeEventListener("keydown",i),n instanceof HTMLElement&&document.contains(n)&&n.focus()}},[t])}const wM="w-full flex items-center gap-2 px-3 py-1.5 text-xs text-neutral-200 hover:bg-neutral-800 focus-visible:bg-neutral-800 outline-none cursor-pointer text-left",u$e="w-full flex items-center gap-2 px-3 py-1.5 text-xs text-red-400 hover:bg-neutral-800 focus-visible:bg-neutral-800 outline-none cursor-pointer text-left";function ede({state:t,onClose:e,onDelete:n,onDeleteAll:r,onEditEase:i,onCopyProperties:s,onMoveToPlayhead:a}){const o=V0(e),l={percentage:t.percentage,tweenPercentage:t.tweenPercentage,propertyGroup:t.propertyGroup,animationId:t.animationId};Jhe(o);const[c,u]=x.useState("idle"),f=async()=>{if(!s)return;if(await s(t.elementId,l)===!1){u("failed"),setTimeout(()=>u("idle"),1500);return}u("copied"),setTimeout(e,700)},h=200,y=10+(1+(a?1:0)+(i?1:0)+(s?1:0)+(n?1:0))*30+9,m=t.y+y-window.innerHeight,v=t.x+h>window.innerWidth?t.x-h:t.x,b=Math.max(8,m>0?t.y-m-8:t.y);return Bl.createPortal(d.jsxs("div",{ref:o,role:"menu","aria-label":"Keyframe actions",className:"fixed z-[200] bg-neutral-900 border border-neutral-700 rounded-md shadow-lg py-1 min-w-[180px] overflow-y-auto",style:{left:v,top:b,maxHeight:`calc(100vh - ${b+8}px)`},children:[a&&d.jsx("button",{type:"button",role:"menuitem",className:wM,onClick:()=>{a(t.element,l),e()},children:"Move to Playhead"}),i&&d.jsxs("button",{type:"button",role:"menuitem",className:`${wM} justify-between`,onClick:()=>{i(t.elementId,l),e()},children:[d.jsx("span",{children:"Edit Ease…"}),d.jsx("span",{className:"text-[10px] text-neutral-500",children:t.currentEase??"default"})]}),s&&d.jsx("button",{type:"button",role:"menuitem",className:wM,onClick:()=>{f()},children:c==="copied"?"Copied!":c==="failed"?"Copy failed — check permissions":"Copy Properties"}),n&&d.jsx("button",{type:"button",role:"menuitem",className:u$e,onClick:()=>{n(t.elementId,l),e()},children:"Delete Keyframe"}),d.jsx("div",{className:"my-1 border-t border-neutral-700/60",role:"separator"}),d.jsx("div",{className:"my-1 border-t border-neutral-700/60",role:"separator"}),d.jsx("button",{type:"button",role:"menuitem",className:"w-full flex items-center gap-2 px-3 py-1.5 text-xs text-red-400 hover:bg-red-950/40 focus-visible:bg-red-950/40 outline-none cursor-pointer text-left",onClick:()=>{r(t.element,t.animationId),e()},children:"Delete All Keyframes"})]}),document.body)}const f$e=x.memo(function({x:e,y:n,element:r,currentTime:i,onClose:s,onSplit:a,onDelete:o}){const l=V0(s);Jhe(l);const c=200,f=n+80-window.innerHeight,h=e+c>window.innerWidth?e-c:e,p=f>0?n-f-8:n,y=n3(r)&&["video","audio","img"].includes(r.tag),m=y&&i>r.start&&i{m&&(a(r,i),s())},children:[d.jsx("span",{children:v}),d.jsx("span",{className:"text-neutral-500 text-[10px] ml-3",children:"S"})]}),d.jsx("div",{className:"my-1 border-t border-neutral-700/60"})]}),d.jsxs("button",{type:"button",role:"menuitem",className:"w-full flex items-center justify-between px-3 py-1.5 text-xs text-red-400 hover:bg-neutral-800 focus-visible:bg-neutral-800 outline-none cursor-pointer text-left",onClick:()=>{o(r),s()},children:[d.jsx("span",{children:"Delete"}),d.jsx("span",{className:"text-neutral-500 text-[10px] ml-3",children:"⌫"})]})]}),document.body)}),h$e=x.memo(function({x:e,y:n,gapWidth:r,canCloseGap:i,canCloseAllGaps:s,hasAnyGaps:a,onClose:o,onCloseGap:l,onCloseAllGaps:c,onHoverAction:u}){const f=V0(o),h=200,y=n+68-window.innerHeight,m=e+h>window.innerWidth?e-h:e,v=y>0?n-y-8:n,b=k=>`w-full flex items-center justify-between px-3 py-1.5 text-xs text-left ${k?"text-neutral-300 hover:bg-neutral-800 cursor-pointer":"text-neutral-600 cursor-not-allowed"}`,w=i?void 0:r==null?"No gap here":"A clip on this track can't be moved",O=s?void 0:a?"A clip on this track can't be moved":"No gaps on this track";return Bl.createPortal(d.jsxs("div",{ref:f,className:"fixed z-[200] bg-neutral-900 border border-neutral-700 rounded-md shadow-lg py-1 min-w-[180px]",style:{left:m,top:v},onPointerLeave:()=>u(null),children:[d.jsxs("button",{type:"button",className:b(i),disabled:!i,title:w,onPointerEnter:()=>u(i?"close-gap":null),onClick:()=>{i&&(l(),o())},children:[d.jsx("span",{children:"Close gap"}),r!=null&&d.jsxs("span",{className:"text-neutral-500 text-[10px] ml-3",children:[r.toFixed(2),"s"]})]}),d.jsx("button",{type:"button",className:b(s),disabled:!s,title:O,onPointerEnter:()=>u(s?"close-all":null),onClick:()=>{s&&(c(),o())},children:d.jsx("span",{children:"Close all gaps"})})]}),document.body)});function d$e({theme:t}){return d.jsx("div",{className:"absolute bottom-2 right-3 pointer-events-none z-20",children:d.jsxs("div",{className:"flex items-center gap-1.5 px-2 py-1 rounded-md border",style:{background:"rgba(17,23,35,0.84)",borderColor:t.gutterBorder},children:[d.jsx("kbd",{className:"text-[9px] font-mono px-1 py-0.5 rounded",style:{color:t.textSecondary,background:"rgba(255,255,255,0.06)"},children:"Shift"}),d.jsx("span",{className:"text-[9px]",style:{color:t.textSecondary},children:"+ drag/click to edit range"})]})})}function F_({capturedElement:t,targetSessionEpoch:e,sessionEpoch:n,selectedElementId:r,elements:i}){const s=t.key??t.id;return e!==n||r!==s?null:i.find(a=>(a.key??a.id)===s)??null}function p$e(t,e,n){const r=ue.getState();return F_({capturedElement:t,targetSessionEpoch:e,sessionEpoch:r.timelineSessionEpoch,selectedElementId:r.selectedElementId,elements:n})}function m$e({elements:t,elementsRef:e,theme:n,showShortcutHint:r,showPopover:i,rangeSelection:s,setShowPopover:a,setRangeSelection:o,kfContextMenu:l,setKfContextMenu:c,onDeleteKeyframe:u,onDeleteAllKeyframes:f,onMoveKeyframeToPlayhead:h,clipContextMenu:p,setClipContextMenu:y,currentTime:m,onSplitElement:v,pinZoomBeforeEdit:b,onDeleteElement:w,gapContextMenu:O,onDismissGapContextMenu:k,onCloseTrackGap:E,onCloseAllTrackGaps:T,onHoverGapAction:N}){const _=ue(Y=>Y.selectedElementId),I=ue(Y=>Y.timelineSessionEpoch),j=l==null?void 0:l.sessionEpoch,L=p==null?void 0:p.sessionEpoch,B=l?F_({capturedElement:l.element,targetSessionEpoch:j,sessionEpoch:I,selectedElementId:_,elements:t}):null,$=p?F_({capturedElement:p.element,targetSessionEpoch:L,sessionEpoch:I,selectedElementId:_,elements:t}):null,z=(Y,W)=>p$e(Y,W,e.current);return x.useEffect(()=>{l&&!B&&c(null)},[B,l,c]),x.useEffect(()=>{p&&!$&&y(null)},[p,$,y]),d.jsxs(d.Fragment,{children:[r&&!i&&!s&&d.jsx(d$e,{theme:n}),i&&s&&d.jsx(c$e,{rangeStart:s.start,rangeEnd:s.end,anchorX:s.anchorX,anchorY:s.anchorY,onClose:()=>{a(!1),o(null)}}),l&&B&&d.jsx(ede,{state:{...l,element:B},onClose:()=>c(null),onDelete:(...Y)=>{z(B,j)&&(u==null||u(...Y))},onDeleteAll:(Y,W)=>{const J=z(B,j);J&&(f==null||f(J,W))},onMoveToPlayhead:h?(Y,...W)=>{const J=z(B,j);J&&h(J,...W)}:void 0,onEditEase:l.animationId!==void 0&&l.tweenPercentage!==void 0?(Y,W)=>{W.animationId===void 0||W.tweenPercentage===void 0||(ue.getState().setFocusedEaseSegment({animationId:W.animationId,collidingAnimationTargets:W.collidingAnimationTargets,tweenPercentage:W.tweenPercentage,elementId:Y}),tj({action:"open"}))}:void 0,onCopyProperties:(Y,W)=>{const J=ue.getState().keyframeCache.get(Y),ne=J==null?void 0:J.keyframes.find(le=>Math.abs(le.percentage-W.percentage)<.5);return ne?Uf(JSON.stringify(ne.properties,null,2)):!1}}),p&&$&&d.jsx(f$e,{x:p.x,y:p.y,element:$,currentTime:m,onClose:()=>y(null),onSplit:(Y,W)=>{const J=z($,L);J&&(v==null||v(J,W))},onDelete:()=>{const Y=z($,L);Y&&(b(),w==null||w(Y))}}),O&&d.jsx(h$e,{x:O.x,y:O.y,gapWidth:O.gapWidth,canCloseGap:O.canCloseGap,canCloseAllGaps:O.canCloseAllGaps,hasAnyGaps:O.hasAnyGaps,onClose:k,onCloseGap:E,onCloseAllGaps:T,onHoverAction:N})]})}function g$e({ppsRef:t,fitPpsRef:e,onMoveElement:n,onMoveElements:r,onResizeElement:i,onResizeElements:s,onFileDrop:a,onAssetDrop:o,onBlockDrop:l,onCompositionDrop:c}){const u=ue(E=>E.pinTimelineZoom),f=x.useCallback(()=>{u(t.current,e.current)},[u,t,e]),h=x.useRef(null),p=x.useMemo(()=>n&&((...E)=>(f(),n(...E))),[n,f]),y=x.useMemo(()=>r&&((...E)=>(f(),r(...E))),[r,f]),m=x.useMemo(()=>i&&((...E)=>(f(),i(...E))),[i,f]),v=x.useMemo(()=>s&&((...E)=>(f(),s(...E))),[s,f]),b=x.useMemo(()=>a&&((...E)=>(f(),a(...E))),[a,f]),w=x.useMemo(()=>o&&((...E)=>(f(),o(...E))),[o,f]),O=x.useMemo(()=>l&&((...E)=>(f(),l(...E))),[l,f]),k=x.useMemo(()=>c&&((...E)=>(f(),c(...E))),[c,f]);return{pinZoomBeforeEdit:f,setRangeSelectionRef:h,pinnedOnMoveElement:p,pinnedOnMoveElements:y,pinnedOnResizeElement:m,pinnedOnResizeElements:v,pinnedOnFileDrop:b,pinnedOnAssetDrop:w,pinnedOnBlockDrop:O,pinnedOnCompositionDrop:k}}const EF=Rc("StudioShellContext",null),TF=Rc("StudioPlaybackContext",null);function Gl(){const t=x.useContext(EF);if(!t)throw new Error("useStudioShellContext must be used within StudioShellProvider");return t}function PF(){return x.useContext(EF)}function wy(){const t=x.useContext(TF);if(!t)throw new Error("useStudioPlaybackContext must be used within StudioPlaybackProvider");return t}function y$e(){return x.useContext(TF)}function x$e({value:t,children:e}){const{projectId:n,activeCompPath:r,setActiveCompPath:i,showToast:s,previewIframeRef:a,editHistory:o,writeBlockedReason:l,handleUndo:c,handleRedo:u,renderQueue:f,compositionDimensions:h,waitForPendingDomEditSaves:p,handlePreviewIframeRef:y}=t,m=x.useMemo(()=>({projectId:n,activeCompPath:r,setActiveCompPath:i,showToast:s,previewIframeRef:a,editHistory:o,writeBlockedReason:l,handleUndo:c,handleRedo:u,renderQueue:f,compositionDimensions:h,waitForPendingDomEditSaves:p,handlePreviewIframeRef:y}),[n,r,h,o,f,i,s,a,l,c,u,p,y]);return d.jsx(EF,{value:m,children:e})}function b$e({value:t,children:e}){const{captionEditMode:n,compositionLoading:r,refreshKey:i,setRefreshKey:s,timelineElements:a,isPlaying:o,refreshPreviewDocumentVersion:l}=t,c=x.useMemo(()=>({captionEditMode:n,compositionLoading:r,refreshKey:i,setRefreshKey:s,timelineElements:a,isPlaying:o,refreshPreviewDocumentVersion:l}),[n,r,i,a,o,s,l]);return d.jsx(TF,{value:c,children:e})}function v$e(t){var e;try{const n=(e=t.ownerDocument)==null?void 0:e.defaultView;if(!n)return!0;const r=n.getComputedStyle(t);if(r.display==="none"||r.visibility==="hidden"||r.visibility==="collapse")return!1;const i=Number.parseFloat(r.opacity);return!(Number.isFinite(i)&&i<=.01&&!t.hasAttribute(JE))}catch{return!0}}function gW(t){if(!t||t==="auto")return 0;const e=parseInt(t,10);return Number.isFinite(e)?e:0}function i3(t){var r;const e=Ej(t);if(e!=null)return e;const n=t.style.zIndex;if(n&&n!=="auto")return gW(n);try{const i=(r=t.ownerDocument)==null?void 0:r.defaultView;if(i)return gW(i.getComputedStyle(t).zIndex)}catch{}return 0}function tde(t){var n;const e=(n=t.ownerDocument)==null?void 0:n.defaultView;return e&&t instanceof e.HTMLElement?!0:t.nodeType===1}const A$e=new Set(["AUDIO","SCRIPT","STYLE","LINK","META","TEMPLATE","NOSCRIPT"]);function S$e(t){return tde(t)&&!A$e.has(t.tagName)}function nde(t){const e=t.parentElement;if(!e)return{entries:[],targetIndex:-1};const n=[];let r=-1,i=0;for(const s of Array.from(e.children))s!==t&&!S$e(s)||tde(s)&&(s===t&&(r=n.length),n.push({element:s,zIndex:i3(s),domIndex:i}),i+=1);return{entries:n,targetIndex:r}}function w$e(t,e){return t.lefte.left&&t.tope.top}function O$e(t,e,n){const r=e.filter(a=>a.element===t||n(a.element));let i;try{i=t.getBoundingClientRect()}catch{return r}if(i.width===0&&i.height===0)return r;const s={left:i.left,top:i.top,right:i.right,bottom:i.bottom};return r.filter(a=>{if(a.element===t)return!0;try{const o=a.element.getBoundingClientRect();return w$e(s,{left:o.left,top:o.top,right:o.right,bottom:o.bottom})}catch{return!1}})}function MF(t){return[...t].sort((e,n)=>e.zIndex-n.zIndex||e.domIndex-n.domIndex)}function C$e(t,e){if(t&&e)return e.zIndex-t.zIndex>=2?t.zIndex+1:null;if(t)return t.zIndex+1;if(e){const n=Math.max(0,e.zIndex-1);return n>=e.zIndex?null:n}return null}function rde(t,e,n,r){const i=e.findIndex(l=>l.element===n);if(i===-1)return null;const s=i3(n),a=t.map(l=>l.zIndex);if(!a.some((l,c)=>a.indexOf(l)!==c)){const l=C$e(e[i-1],e[i+1]);if(l!==null)return l===s?null:[{element:n,zIndex:l}]}return k$e(t,e,n,r)}function k$e(t,e,n,r){const i=new Set(e.map(p=>p.element)),s=r.filter(p=>!i.has(p.element)),a=e.length,o=t.map(p=>p.zIndex),l=Math.min(...o),c=Math.max(...o);if(!s.some(p=>p.zIndex>=l&&p.zIndex<=c)){const p=s.filter(w=>w.zIndexw.zIndex),y=s.filter(w=>w.zIndex>c).map(w=>w.zIndex),m=p.length>0?Math.max(...p)+1:0,v=y.length>0,b=v?Math.min(...y)-a:Number.POSITIVE_INFINITY;if(m<=b){let w=Math.max(l,m);v&&(w=Math.min(w,b));const O=[];return e.forEach((k,E)=>{k.zIndex!==w+E&&O.push({element:k.element,zIndex:w+E})}),O.length===0?null:O}}const f=E$e(r,e,n),h=[];return f.forEach((p,y)=>{p.zIndex!==y&&h.push({element:p.element,zIndex:y})}),h.length===0?null:h}function E$e(t,e,n){const r=MF(t),i=r.find(f=>f.element===n),s=r.filter(f=>f.element!==n);if(!i)return s;const a=e.findIndex(f=>f.element===n),o=e[a-1],l=e[a+1],c=o?s.findIndex(f=>f.element===o.element):-1,u=l?s.findIndex(f=>f.element===l.element):-1;return c>=0?s.splice(c+1,0,i):u>=0?s.splice(u,0,i):s.unshift(i),s}function ide(t,e,n){const{entries:r}=nde(t);if(r.length<2)return null;const s=e==="bring-to-front"||e==="send-to-back"?r:O$e(t,r,v$e);if(s.length<2)return null;const a=MF(s),o=a.findIndex(l=>l.element===t);return o===-1?null:{entries:r,order:a,pos:o}}function sde(t,e,n){const r=ide(t,e);if(!r)return null;const{entries:i,order:s,pos:a}=r,o=[...s],[l]=o.splice(a,1);switch(e){case"bring-forward":if(a>=s.length-1)return null;o.splice(a+1,0,l);break;case"send-backward":if(a<=0)return null;o.splice(a-1,0,l);break;case"bring-to-front":if(a>=s.length-1)return null;o.push(l);break;case"send-to-back":if(a<=0)return null;o.unshift(l);break}return rde(s,o,t,i)}function T$e(t,e){const{entries:n}=nde(t);if(n.length<2)return null;const r=new Map(n.map(a=>[a.element,a])),i=[];for(const a of e){const o=r.get(a);if(!o)return null;i.push(o)}if(i.length<2||!i.some(a=>a.element===t))return null;const s=MF(i);return s.every((a,o)=>a.element===i[o].element)?null:rde(s,i,t,n)}function P$e(t,e,n){if(e!=="bring-forward"&&e!=="send-backward")return null;const r=ide(t,e);if(!r)return null;const{order:i,pos:s}=r,a=e==="bring-forward"?i[s+1]:i[s-1];return(a==null?void 0:a.element)??null}function M$e(t,e,n){return sde(t,e)!==null}function N$e({expandedElementsRef:t}){const e=AS(),n=PF(),r=(e==null?void 0:e.previewIframeRef)??null,i=e==null?void 0:e.handleDomZIndexReorderCommit,s=(n==null?void 0:n.activeCompPath)??null,a=x.useCallback(u=>{var h;const f=((h=r==null?void 0:r.current)==null?void 0:h.contentDocument)??null;return f?Is(f,{hfId:u.hfId,id:u.domId??u.id,selector:u.selector,selectorIndex:u.selectorIndex,sourceFile:u.sourceFile??s??"index.html"},s):null},[r,s]),o=x.useCallback(u=>{const f=a(u);return f?i3(f):Number.NaN},[a]),l=x.useCallback((u,f)=>{if(!i)return Promise.resolve();const h=u.flatMap(p=>{const y=t.current.find(v=>(v.key??v.id)===p.key),m=y&&a(y);return!y||!m?[]:[{element:m,zIndex:p.zIndex,id:y.domId??y.id,selector:y.selector,selectorIndex:y.selectorIndex,sourceFile:y.sourceFile??s??"index.html",key:p.key}]});return h.length?i(h,f).then(()=>{}):Promise.resolve()},[i,a,s,t]);return{readClipZIndex:o,applyStackingPatches:l,zSyncEnabled:!!(i&&r)}}function D$e({viewportWidth:t,effectiveDuration:e,zoomMode:n,manualZoomPercent:r,ppsRef:i,fitPpsRef:s,draggedClip:a,resizingClip:o,expandedElements:l,isDragging:c,scrollRef:u,lastScrollLeftRef:f,contentOrigin:h}){const p=I3e(t,e,h),y=BCe(p,n,r);i.current=y;const m=Math.max(0,e*y),v=a!=null&&a.started?(a.previewStart+a.element.duration)*y+HG:0,b=o!=null&&o.started?(o.previewStart+o.previewDuration)*y+HG:0,w=_3e({trackContentWidth:m,viewportWidth:t,contentOrigin:h,pps:y,dragGhostEndPx:v,resizeGhostEndPx:b}),O=y>0?w/y:e,k=x.useRef(n);k.current=n;const E=x.useRef(r);return E.current=r,s.current=p,x.useEffect(()=>{if(n!=="manual"||c.current)return;const T=u.current,N=f.current;if(!T||N<=0)return;const _=requestAnimationFrame(()=>{const I=Math.max(0,T.scrollWidth-T.clientWidth),j=Math.min(N,I);Math.abs(T.scrollLeft-j)>.5&&(T.scrollLeft=j)});return()=>cancelAnimationFrame(_)},[l,n]),x.useEffect(()=>{ue.getState().setTimelineScale(y,p)},[y,p]),{pps:y,fitPps:p,displayContentWidth:w,displayDuration:O,clipStateVersion:l,zoomModeRef:k,manualZoomPercentRef:E}}function I$e(t,e){for(const r of e)t.has(r)||e.delete(r);const n=[];for(const[r,i]of t)e.has(r)||i.some(Fce)&&n.push(r);return n}function _$e(t){var i;const e=ue(s=>s.expandClips),n=((i=PF())==null?void 0:i.projectId)??null,r=x.useRef({projectId:n,source:t,clips:new Set});x.useEffect(()=>{if(r.current.projectId!==n){const a=r.current.source!==t;if(r.current={projectId:n,source:t,clips:new Set},!a)return}else r.current.source=t;const s=I$e(t,r.current.clips);if(s.length!==0){for(const a of s)r.current.clips.add(a);e(s)}},[t,e,n])}const R$e=!0,j$e=Object.freeze({scrollLeft:0,scrollTop:0,clientWidth:0,clientHeight:0,scrollWidth:0,scrollHeight:0,isScrolling:!1});function L$e(t,e){return{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop,clientWidth:t.clientWidth,clientHeight:t.clientHeight,scrollWidth:t.scrollWidth,scrollHeight:t.scrollHeight,isScrolling:e}}function F$e(t,e){const[n,r]=x.useState(j$e),[i,s]=x.useState(!0),a=x.useRef(null),o=x.useRef(0),l=x.useRef(0),c=x.useRef(null),u=x.useRef(!1),f=x.useCallback((m,v=!1)=>{u.current=v;const b=()=>{l.current=0,r(L$e(m,u.current))};if(v)l.current||(l.current=requestAnimationFrame(b));else{l.current&&cancelAnimationFrame(l.current),b();return}c.current&&clearTimeout(c.current),c.current=setTimeout(()=>{c.current=null,u.current=!1,l.current&&cancelAnimationFrame(l.current),b()},100)},[]),h=x.useCallback(()=>{const m=t.current;s(m?F3e(m.scrollHeight,m.clientHeight):!0)},[t]),p=x.useCallback(()=>{o.current&&cancelAnimationFrame(o.current),o.current=requestAnimationFrame(()=>{o.current=0,h()})},[h]),y=x.useCallback(m=>{if(a.current&&(a.current.disconnect(),a.current=null),t.current=m,!m){c.current&&clearTimeout(c.current),c.current=null,u.current=!1;return}const v=()=>{f(m,u.current),p()};v(),a.current=new ResizeObserver(v),a.current.observe(m)},[t,p,f]);return Or(()=>()=>{var m;(m=a.current)==null||m.disconnect(),o.current&&cancelAnimationFrame(o.current),l.current&&cancelAnimationFrame(l.current),c.current&&clearTimeout(c.current)}),x.useEffect(()=>{h()},[h,...e]),{viewport:n,showShortcutHint:i,setScrollRef:y,syncScrollViewport:f}}function $$e(t){const e=fS(),{onMoveElement:n,onMoveElements:r,onResizeElement:i,onResizeElements:s,onBlockedEditAttempt:a,onSplitElement:o}=t;return x.useMemo(()=>({...e,onMoveElement:n??e.onMoveElement,onMoveElements:r??e.onMoveElements,onResizeElement:i??e.onResizeElement,onResizeElements:s??e.onResizeElements,onBlockedEditAttempt:a??e.onBlockedEditAttempt,onSplitElement:o??e.onSplitElement}),[e,n,r,i,s,a,o])}const s3=.001,Fg=t=>t.key??t.id;function gA(t){return Math.max(0,...t.map(e=>e.expandedParentStart??0))}const ade=t=>Math.round(t*1e3)/1e3,hC=t=>t.start+t.duration;function a3(t){return[...t].sort((e,n)=>e.start-n.start||Fg(e).localeCompare(Fg(n)))}function $_(t,e,n=s3,r=0){const i=a3(t);if(i.some(c=>e>=c.start-n&&ec.start>e-n);if(a.length===0)return null;const o=a[0].start,l=Math.max(r,...i.filter(c=>c.start<=e-n).map(c=>hC(c)));return o-l<=n?null:{gapStart:l,gapEnd:o,followingKeys:a.map(Fg)}}function ode(t,e=s3,n=0){const r=[];let i=n;for(const s of a3(t))s.start-i>e&&r.push({start:i,end:s.start}),i=Math.max(i,hC(s));return r}function lde(t,e=s3,n=0){const r=[];let i=n;for(const s of a3(t)){const a=ade(i);Math.abs(a-s.start)>e&&r.push({key:Fg(s),newStart:a}),i+=s.duration}return r}function B$e(t,e,n=s3,r=0){const i=ode(t,n,r),s=Math.max(r,...t.map(hC));return e-s>n&&i.push({start:s,end:e}),i}function cde(t,e){const n=e.gapEnd-e.gapStart,r=new Set(e.followingKeys);return a3(t).filter(i=>r.has(Fg(i))).map(i=>({key:Fg(i),newStart:Math.max(e.gapStart,ade(i.start-n))}))}const ude=t=>t.key??t.id;let V$e=0;function B_(t,e){const n=new Map(t.map(r=>[ude(r),r]));return e.every(r=>{const i=n.get(r.key);return i!=null&&lS(i).canMove})}function H$e(t,e){if(e.length===0||!B_(t,e))return null;const n=new Map(t.map(r=>[ude(r),r]));return e.map(r=>{const i=n.get(r.key);return{element:i,updates:{start:r.newStart,track:i.track}}})}function fde(t,e,n){const r=H$e(t,e);return r?(xd(r,n,`track-gap-close:${V$e++}`),!0):!1}function Q$e(t,e,n){const r=$_(t,e,void 0,gA(t));return r?fde(t,cde(t,r),n):!1}function z$e(t,e){return fde(t,lde(t,void 0,gA(t)),e)}function Z$e({tracks:t,expandedElementsRef:e,trackOrderRef:n,onMoveElement:r,onMoveElements:i}){const s=ue(w=>w.updateElement),a=ue(w=>w.timelineSessionEpoch),[o,l]=x.useState(null),[c,u]=x.useState(null),f=x.useMemo(()=>{var w;return(o==null?void 0:o.sessionEpoch)===a?((w=t.find(([O])=>O===o.track))==null?void 0:w[1])??[]:null},[o,a,t]),h=x.useMemo(()=>{if(!o||!f)return null;const w=gA(f),O=$_(f,o.time,void 0,w),k=lde(f,void 0,w);return{x:o.x,y:o.y,gapWidth:O?O.gapEnd-O.gapStart:null,canCloseGap:O!=null&&B_(f,cde(f,O)),hasAnyGaps:k.length>0,canCloseAllGaps:k.length>0&&B_(f,k)}},[o,f]),p=x.useMemo(()=>{if(!o||!f||!c)return null;const w=gA(f);if(c==="close-gap"){const k=$_(f,o.time,void 0,w);return k?{track:o.track,intervals:[{start:k.gapStart,end:k.gapEnd}]}:null}const O=ode(f,void 0,w);return O.length>0?{track:o.track,intervals:O}:null},[o,f,c]),y=x.useCallback(()=>{!o||!f||o.sessionEpoch!==ue.getState().timelineSessionEpoch||Q$e(f,o.time,{elements:e.current,trackOrder:n.current,updateElement:s,onMoveElement:r,onMoveElements:i})},[o,f,e,n,s,r,i]),m=x.useCallback(()=>{!o||!f||o.sessionEpoch!==ue.getState().timelineSessionEpoch||z$e(f,{elements:e.current,trackOrder:n.current,updateElement:s,onMoveElement:r,onMoveElements:i})},[o,f,e,n,s,r,i]),v=x.useCallback(w=>{u(null),l({...w,sessionEpoch:ue.getState().timelineSessionEpoch})},[]),b=x.useCallback(()=>{u(null),l(null)},[]);return x.useEffect(()=>{o&&o.sessionEpoch!==a&&b()},[b,o,a]),{gapMenuModel:h,gapHighlight:p,setHoveredGapAction:u,openGapMenu:v,dismissGapMenu:b,closeTrackGap:y,closeAllTrackGaps:m}}function G$e(t,e){return e.size===0||e.size===1&&e.has(t)}function U$e(t){var c;const{selectedElementId:e,selectedElementIds:n,expandedElements:r,tracks:i,gapHighlight:s}=t;if(!e||!G$e(e,n))return null;const a=r.find(u=>(u.key??u.id)===e);if(!a||a.track===(s==null?void 0:s.track))return null;const o=((c=i.find(([u])=>u===a.track))==null?void 0:c[1])??[],l=B$e(o,t.displayDuration,void 0,gA(o));return l.length>0?{track:a.track,intervals:l,kind:"selected"}:null}function X$e(t){if(t.dragActive)return[];const e=[];t.gapHighlight&&t.gapHighlight.intervals.length>0&&e.push({...t.gapHighlight,kind:"hover"});const n=U$e(t);return n&&e.push(n),e}function W$e(t){const{gapHighlight:e,tracks:n,selectedElementId:r,selectedElementIds:i,expandedElements:s,dragActive:a,displayDuration:o}=t;return x.useMemo(()=>X$e({gapHighlight:e,tracks:n,selectedElementId:r,selectedElementIds:i,expandedElements:s,dragActive:a,displayDuration:o}),[e,n,r,i,s,a,o])}function q$e({active:t,scrollRef:e,contentOrigin:n,pixelsPerSecond:r,onSplitAll:i}){const[s,a]=x.useState(null),o=x.useCallback(u=>{const f=e.current;if(!t||!f)return;const h=f.getBoundingClientRect();a(u.clientX-h.left+f.scrollLeft)},[t,e]),l=x.useCallback(()=>a(null),[]),c=x.useCallback(u=>{const f=e.current;if(!t||!u.shiftKey||u.button!==0||!f)return!1;const h=f.getBoundingClientRect(),p=CE({clientX:u.clientX,rectLeft:h.left,scrollLeft:f.scrollLeft,contentOrigin:n});return i==null||i(Math.max(0,p/r)),!0},[t,n,i,r,e]);return{razorGuideX:s,updateRazorGuide:o,clearRazorGuide:l,splitAllAtPointer:c}}function Y$e({x:t}){return d.jsx("div",{className:"absolute top-0 bottom-0 pointer-events-none z-10",style:{left:t,width:1,background:"rgba(239,68,68,0.7)"}})}const K$e=400,J$e=6e4;function yW(t,e){if(t.length===0)return;const n=[...t].sort((i,s)=>i-s),r=Math.min(n.length-1,Math.ceil(n.length*e)-1);return Number(n[Math.max(0,r)].toFixed(2))}function eBe(t,e,n,r){const i=yW(n,.95);if(i===void 0)return null;const s=yW(r,.95);return{total_clip_count:e.totalClipCount,mounted_clip_count:t.querySelectorAll('[data-clip="true"]').length,total_row_count:e.totalRowCount,timeline_dom_node_count:t.querySelectorAll("*").length,viewport_width:t.clientWidth,viewport_height:t.clientHeight,zoom_mode:e.zoomMode,scroll_sample_count:n.length,scroll_frame_latency_p95_ms:i,scroll_frame_latency_max_ms:Number(Math.max(...n).toFixed(2)),...s===void 0?{}:{frame_interval_p95_ms:s}}}function xW(t){t.previousFrameAt=null,t.frameLatencies=[],t.frameIntervals=[]}function tBe(t){const e=x.useRef({frameRequest:0,idleTimer:null,pendingScrollStartedAt:0,previousFrameAt:null,frameLatencies:[],frameIntervals:[],lastEmittedAt:Number.NEGATIVE_INFINITY}),n=r=>{const i=e.current,s=performance.now();i.frameRequest===0&&(i.pendingScrollStartedAt=s,i.frameRequest=requestAnimationFrame(a=>{i.frameRequest=0,i.frameLatencies.push(performance.now()-i.pendingScrollStartedAt),i.previousFrameAt!==null&&i.frameIntervals.push(a-i.previousFrameAt),i.previousFrameAt=a})),i.idleTimer!==null&&clearTimeout(i.idleTimer),i.idleTimer=setTimeout(()=>{if(i.idleTimer=null,i.frameRequest!==0){cancelAnimationFrame(i.frameRequest),i.frameRequest=0,xW(i);return}const a=performance.now();if(a-i.lastEmittedAt>=J$e){const o=eBe(r,t,i.frameLatencies,i.frameIntervals);o&&(x8e(o),i.lastEmittedAt=a)}xW(i)},K$e)};return Or(()=>()=>{const r=e.current;r.frameRequest!==0&&cancelAnimationFrame(r.frameRequest),r.idleTimer!==null&&clearTimeout(r.idleTimer)}),{recordTimelineScroll:n}}function nBe(t){return Array.from(t.values()).some(e=>e.some(Fce))}function rBe(t,e){return nBe(t)||e.some(n=>!!n.audioGroup)}function hde(t,e){const n=Number.isFinite(t)?t:0;if(e.length===0)return n;const r=Math.max(n,...e.map(i=>i.start+i.duration));return Number.isFinite(r)?r:n}function iBe(t,e){var i;const n=Zn(t),r=(i=e==null?void 0:e.groupPreview)==null?void 0:i.find(s=>s.key===n);return r?{...t,...r}:e&&Zn(e.element)===n?{...t,start:e.previewStart,duration:e.previewDuration,playbackStart:e.previewPlaybackStart}:t}function sBe(t,e,n,r){const i=x.useMemo(()=>t.find(o=>Zn(o)===e)??null,[t,e]),s=x.useRef(i);s.current=i;const a=x.useRef(s.current);x.useEffect(()=>{const o=a.current,l=s.current;a.current=l,o&&!l&&(n(!1),r())})}function aBe(){const[t,e]=x.useState(!1);return Or(()=>{const n=i=>i.key==="Shift"&&e(i.type==="keydown"),r=()=>e(!1);return window.addEventListener("keydown",n),window.addEventListener("keyup",n),window.addEventListener("blur",r),()=>{window.removeEventListener("keydown",n),window.removeEventListener("keyup",n),window.removeEventListener("blur",r)}}),t}function oBe(t,e,n,r){const i=n==="frame"?Qd:void 0;return{...x.useMemo(()=>z5e(t,e,i,r),[t,i,e,r]),majorTickInterval:Jae(t,e,i)}}const OM=1024*1024,lBe=1440*60*1e3,tl=Object.freeze({directScrollSafetyPx:8e6,rowOverscanPerSide:2,timeOverscanViewportRatio:.25,maxMountedRows:64,maxMountedClipRoots:512,maxMountedClipRootsPerRow:128,maxMountedTimelineDescendants:5e3,posterMaxPhysicalWidth:240,posterMaxPhysicalHeight:135,posterDprCap:1.5,richPreviewFrameCount:6,concurrentVideoDecodes:2,concurrentMetadataJobs:4,concurrentCompositionFetches:2,concurrentServerPages:1,thumbnailLoadTimeoutMs:3e4,thumbnailCacheBytes:64*OM,thumbnailCacheEntries:256,thumbnailCacheEntriesPerProject:96,metadataRegistryEntries:512,metadataFailureTtlMs:3e4,waveformCacheBytes:16*OM,waveformCacheEntries:256,compositionDiskCacheBytes:512*OM,compositionDiskCacheMaxAgeMs:14*lBe,interactionP95Ms:50,frameIntervalP95Ms:33.3,constrainedInteractionP95Ms:75,constrainedFrameIntervalP95Ms:75,longTaskLimitMs:50,constrainedLongTaskLimitMs:300,memoryReturnToleranceRatio:.15,posterColdP95Ms:750,posterCachedP95Ms:250,constrainedPosterColdP95Ms:1200,constrainedPosterCachedP95Ms:400,posterCoverageRatio:.9,posterCoverageSettleMs:1500,constrainedPosterCoverageSettleMs:2500,richPreviewP95Ms:750,constrainedRichPreviewP95Ms:1200,supportedFixtureFallbackRatio:.02,scrollSamplesPerRun:21,warmupRuns:3,measuredRuns:5,requiredPassingRuns:4});function cBe(t,e,n,r){if(!(e>0)||!(r>0)||!(t.clientWidth>0))return{start:0,end:0};const i=t.clientWidth*tl.timeOverscanViewportRatio,s=t.scrollLeft-n-i,a=t.scrollLeft+t.clientWidth-n+i;return{start:Math.min(r,Math.max(0,s/e)),end:Math.min(r,Math.max(0,a/e))}}function uBe(t,e,n,r){if(!(e>0)||!(r>0))return{start:0,end:0};const i=Math.max(0,(t.scrollLeft-n)/e),s=Math.min(r,Math.max(i,(t.scrollLeft+t.clientWidth-n)/e));return{start:Math.min(i,r),end:s}}function fBe(t,e,n){const r=t.getRowPositionFromY(n+Ra);if(r.row<0||r.row>=t.rowKeys.length)return n;const i=t.rowKeys[r.row];if(i===void 0)return n;const s=e.getRowIndex(i);return s<0?n:Math.max(0,n+e.getRowTop(s)-t.getRowTop(r.row))}function hBe({tracks:t,viewport:e,pixelsPerSecond:n,contentOrigin:r,duration:i,selectedElementId:s,draggedElementId:a,resizingElementIds:o,focusedElementId:l,focusedEaseElementId:c,clipContextMenuElementId:u,keyframeContextMenuElementId:f}){const h=x.useMemo(()=>l5e(t),[t]),p=x.useMemo(()=>cBe(e,n,r,i),[r,i,n,e]),y=x.useMemo(()=>uBe(e,n,r,i),[r,i,n,e]),m=x.useMemo(()=>new Set([s,a,...o??[],l,c,u,f].filter(v=>v!==void 0)),[u,a,c,l,f,o,s]);return{clipIndex:h,renderTimeRange:p,visibleTimeRange:y,pinnedClipIdentities:m}}function dBe(){var e;const t=(e=y$e())==null?void 0:e.setRefreshKey;return x.useCallback(()=>t==null?void 0:t(n=>n+1),[t])}const r8=12;function bW(t,e,n,r,i){const s=t+n+r8,a=t+e-r8,o=a-s;return o<=0||r>=s&&i<=a?null:i-r>o||rn.removeAttribute("data-reveal-highlight"),{once:!0}),!0)):!1}function gBe(t,e,n,r,i,s,a){const o=r.getRowIndex(e.row.physicalTrackKey);if(o<0)return!1;const l=e.target.kind==="row"?e.row.elementId:e.target.elementId,c=l?n.find(m=>(m.key??m.id)===l):void 0,u=e.target.kind==="row"?null:e.target.time,f=c&&e.target.kind==="clip"?c.start:u,h=c&&e.target.kind==="clip"?c.start+c.duration:u,p=r.getRowTop(o),y=pBe({scrollLeft:t.scrollLeft,scrollTop:t.scrollTop,viewportWidth:t.clientWidth,viewportHeight:t.clientHeight,clipLeft:s+(f??0)*i,clipRight:s+(h??0)*i,clipTop:p+ha,clipBottom:p+r.getRowHeight(o)-ha,stickyLeft:s,stickyTop:Ra,allowHorizontal:a&&f!==null});return y.left!==null&&(t.scrollLeft=y.left),y.top!==null&&(t.scrollTop=y.top),y.left!==null||y.top!==null}function yBe({scrollRef:t,logicalRows:e,elements:n,rowGeometry:r,pixelsPerSecond:i,contentOrigin:s,allowHorizontal:a,viewportVersion:o,projectId:l,sessionEpoch:c,syncScrollViewport:u}){const f=ue(b=>b.timelineFocus),h=x.useRef(e),p=x.useRef(null),y=x.useRef(null),m=x.useMemo(()=>{var b;if(vW(f,l,c)){((b=p.current)==null?void 0:b.nonce)!==f.nonce&&(p.current={nonce:f.nonce,id:f.id});const w=p.current.id;let O=El(e,w);if(!O){const k=vFe(h.current,e,w);k&&(p.current={nonce:f.nonce,id:k.id},O=El(e,k.id))}return O?{target:O.target,row:O.row}:null}return p.current=null,null},[e,l,f,c]);x.useLayoutEffect(()=>{h.current=e},[e]),x.useEffect(()=>{var w;if(!vW(f,l,c))return;if(!m){ue.getState().clearTimelineFocus(f.nonce);return}if(m.target.id!==f.id){ue.getState().requestTimelineFocus(m.target.id);return}if(((w=y.current)==null?void 0:w.nonce)===f.nonce&&y.current.id===m.target.id)return;const b=t.current;b&&(gBe(b,m,n,r,i,s,a)&&u(b),mBe(b,m.target.id)&&(y.current={nonce:f.nonce,id:m.target.id}))},[a,s,n,i,l,f,m,r,t,c,u,o]);const v=m?m.target.kind==="row"?m.row.elementId??void 0:m.target.elementId:void 0;return{focusedTargetId:(m==null?void 0:m.target.id)??null,focusedRowKey:m==null?void 0:m.row.physicalTrackKey,pinnedElementId:v}}function xBe({tracks:t,displayTrackOrder:e,laneCounts:n,selectedElementId:r,selectedElementIds:i,expandedClipIds:s,collapsedGroupIds:a,expandedLaneOwnerIds:o,groups:l,trackGroupOf:c,gsapAnimations:u}){return x.useMemo(()=>yFe({tracks:t,displayTrackOrder:e,laneCounts:n,selectedElementId:r,selectedElementIds:i,expandedClipIds:s,collapsedGroupIds:a,expandedLaneOwnerIds:o,groups:l,trackGroupOf:c,gsapAnimations:u}),[e,s,a,o,l,c,u,n,r,i,t])}function AW(t,e){if(!e)return null;const n=y0(t).byKey.get(e);return n?{elementId:e,rowKey:n.track}:null}function bBe(t,e,n){const r=new Array(t);return new Proxy(r,{get(i,s,a){if(typeof s=="string"){const o=s.charCodeAt(0);if(o>=48&&o<=57){const l=+s;if(Number.isInteger(l)&&l>=0&&lr[u]!==c))&&(r=o,i=e(...o),n!=null&&n.onChange&&!(s&&n.skipInitialOnChange)&&n.onChange(i),s=!1),i}return a.updateDeps=o=>{r=o},a}function SW(t,e){if(t===void 0)throw new Error("Unexpected undefined");return t}const vBe=(t,e)=>Math.abs(t-e)<1.01,ABe=(t,e,n)=>{let r;return function(...i){t.clearTimeout(r),r=t.setTimeout(()=>e.apply(this,i),n)}};let tb;const CM=()=>{if(tb!==void 0)return tb;if(typeof navigator>"u")return tb=!1;if(/iP(hone|od|ad)/.test(navigator.userAgent))return tb=!0;const t=navigator.maxTouchPoints;return tb=navigator.platform==="MacIntel"&&t!==void 0&&t>0},wW=t=>{const{offsetWidth:e,offsetHeight:n}=t;return{width:e,height:n}},SBe=t=>t,dde=t=>{const e=Math.max(t.startIndex-t.overscan,0),r=Math.min(t.endIndex+t.overscan,t.count-1)-e+1,i=new Array(r);for(let s=0;s{const n=t.scrollElement;if(!n)return;const r=t.targetWindow;if(!r)return;const i=a=>{const{width:o,height:l}=a;e({width:Math.round(o),height:Math.round(l)})};if(i(wW(n)),!r.ResizeObserver)return()=>{};const s=new r.ResizeObserver(a=>{const o=()=>{const l=a[0];if(l!=null&&l.borderBoxSize){const c=l.borderBoxSize[0];if(c){i({width:c.inlineSize,height:c.blockSize});return}}i(wW(n))};t.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(o):o()});return s.observe(n,{box:"border-box"}),()=>{s.unobserve(n)}},dC={passive:!0},OBe=typeof window>"u"?!0:"onscrollend"in window,CBe=(t,e,n)=>{const r=t.scrollElement;if(!r)return;const i=t.targetWindow;if(!i)return;const s=t.options.useScrollendEvent&&OBe;let a=0;const o=s?null:ABe(i,()=>e(a,!1),t.options.isScrollingResetDelay),l=f=>()=>{a=n(r),o==null||o(),e(a,f)},c=l(!0),u=l(!1);return r.addEventListener("scroll",c,dC),s&&r.addEventListener("scrollend",u,dC),()=>{r.removeEventListener("scroll",c),s&&r.removeEventListener("scrollend",u)}},kBe=(t,e)=>CBe(t,e,n=>{const{horizontal:r,isRtl:i}=t.options;return r?n.scrollLeft*(i&&-1||1):n.scrollTop}),EBe=(t,e,n)=>{if(n.options.useCachedMeasurements){const r=n.indexFromElement(t),i=n.options.getItemKey(r);return n.itemSizeCache.get(i)??n.options.estimateSize(r)}if(e!=null&&e.borderBoxSize){const r=e.borderBoxSize[0];if(r)return Math.round(r[n.options.horizontal?"inlineSize":"blockSize"])}if(!e){const r=n.indexFromElement(t),i=n.options.getItemKey(r),s=n.itemSizeCache.get(i);if(s!==void 0)return s}return t[n.options.horizontal?"offsetWidth":"offsetHeight"]},TBe=(t,{adjustments:e=0,behavior:n},r)=>{var i,s;(s=(i=r.scrollElement)==null?void 0:i.scrollTo)==null||s.call(i,{[r.options.horizontal?"left":"top"]:t+e,behavior:n})},PBe=TBe;class MBe{constructor(e){this.unsubs=[],this.scrollElement=null,this.targetWindow=null,this.isScrolling=!1,this.scrollState=null,this.measurementsCache=[],this._flatMeasurements=null,this.itemSizeCache=new Map,this.itemSizeCacheVersion=0,this.laneAssignments=new Map,this.pendingMin=null,this.prevLanes=void 0,this.lanesChangedFlag=!1,this.lanesSettling=!1,this.pendingScrollAnchor=null,this.scrollRect=null,this.scrollOffset=null,this.scrollDirection=null,this.scrollAdjustments=0,this._iosDeferredAdjustment=0,this._iosTouching=!1,this._iosJustTouchEnded=!1,this._iosTouchEndTimerId=null,this._intendedScrollOffset=null,this.elementsCache=new Map,this.now=()=>{var n,r,i;return((i=(r=(n=this.targetWindow)==null?void 0:n.performance)==null?void 0:r.now)==null?void 0:i.call(r))??Date.now()},this.observer=(()=>{let n=null;const r=()=>n||(!this.targetWindow||!this.targetWindow.ResizeObserver?null:n=new this.targetWindow.ResizeObserver(i=>{i.forEach(s=>{const a=()=>{const o=s.target,l=this.indexFromElement(o);if(!o.isConnected){this.observer.unobserve(o);for(const[c,u]of this.elementsCache)if(u===o){this.elementsCache.delete(c);break}return}this.shouldMeasureDuringScroll(l)&&this.resizeItem(l,this.options.measureElement(o,s,this))};this.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(a):a()})}));return{disconnect:()=>{var i;(i=r())==null||i.disconnect(),n=null},observe:i=>{var s;return(s=r())==null?void 0:s.observe(i,{box:"border-box"})},unobserve:i=>{var s;return(s=r())==null?void 0:s.unobserve(i)}}})(),this.range=null,this.setOptions=n=>{var r,i;const s={debug:!1,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:!1,getItemKey:SBe,rangeExtractor:dde,onChange:()=>{},measureElement:EBe,initialRect:{width:0,height:0},scrollMargin:0,gap:0,indexAttribute:"data-index",initialMeasurementsCache:[],lanes:1,anchorTo:"start",followOnAppend:!1,scrollEndThreshold:1,isScrollingResetDelay:150,enabled:!0,isRtl:!1,useScrollendEvent:!1,useAnimationFrameWithResizeObserver:!1,laneAssignmentMode:"estimate",useCachedMeasurements:!1};for(const h in n){const p=n[h];p!==void 0&&(s[h]=p)}const a=this.options;let o=null,l=null,c=!1;if(a!==void 0&&a.enabled&&s.enabled&&s.anchorTo==="end"&&this.scrollElement!==null){const h=a.count,p=s.count,y=this.getMeasurements(),m=h>0?((r=y[0])==null?void 0:r.key)??a.getItemKey(0):null,v=h>0?((i=y[h-1])==null?void 0:i.key)??a.getItemKey(h-1):null;if(p!==h||h>0&&p>0&&(s.getItemKey(0)!==m||s.getItemKey(p-1)!==v)){c=!0;const O=h>0?this.getVirtualItemForOffset(this.getScrollOffset())??y[0]:null;O&&(o=[O.key,this.getScrollOffset()-O.start]);const k=s.followOnAppend===!0?"auto":s.followOnAppend||null;k&&p>h&&this.isAtEnd(a.scrollEndThreshold)&&(h===0||s.getItemKey(p-1)!==v)&&(l=k)}}this.options=s,c&&(this.pendingMin=0,this.itemSizeCacheVersion++);let u=!1,f=0;if(o&&this.scrollOffset!==null){const[h,p]=o,y=this.getMeasurements(),{count:m,getItemKey:v}=this.options;let b=0;for(;b{var r,i;(i=(r=this.options).onChange)==null||i.call(r,this,n)},this.maybeNotify=Wm(()=>(this.calculateRange(),[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]),n=>{this.notify(n)},{key:!1,debug:()=>this.options.debug,initialDeps:[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]}),this.cleanup=()=>{this.unsubs.filter(Boolean).forEach(n=>n()),this.unsubs=[],this.observer.disconnect(),this.rafId!=null&&this.targetWindow&&(this.targetWindow.cancelAnimationFrame(this.rafId),this.rafId=null),this.scrollState=null,this._iosDeferredAdjustment=0,this._iosTouching=!1,this._iosJustTouchEnded=!1,this.scrollElement=null,this.targetWindow=null},this._didMount=()=>()=>{this.cleanup()},this._willUpdate=()=>{var n;const r=this.options.enabled?this.options.getScrollElement():null;if(this.scrollElement!==r){if(this.cleanup(),!r){this.maybeNotify();return}if(this.scrollElement=r,this.scrollElement&&"ownerDocument"in this.scrollElement?this.targetWindow=this.scrollElement.ownerDocument.defaultView:this.targetWindow=((n=this.scrollElement)==null?void 0:n.window)??null,this.elementsCache.forEach(s=>{this.observer.observe(s)}),this.unsubs.push(this.options.observeElementRect(this,s=>{this.scrollRect=s,this.maybeNotify()})),this.unsubs.push(this.options.observeElementOffset(this,(s,a)=>{if(a&&this._intendedScrollOffset===null&&s===this.scrollOffset)return;this._intendedScrollOffset!==null&&Math.abs(s-this._intendedScrollOffset)<1.5&&(s=this._intendedScrollOffset),this._intendedScrollOffset=null,this.scrollAdjustments=0;const o=this.getScrollOffset();this.scrollDirection=a?o===s?this.scrollDirection:o{this._iosTouching=!0,this._iosJustTouchEnded=!1,this._iosTouchEndTimerId!==null&&this.targetWindow!=null&&(this.targetWindow.clearTimeout(this._iosTouchEndTimerId),this._iosTouchEndTimerId=null)},o=()=>{this._iosTouching=!1,!(!CM()||this.targetWindow==null)&&(this._iosJustTouchEnded=!0,this._iosTouchEndTimerId=this.targetWindow.setTimeout(()=>{this._iosJustTouchEnded=!1,this._iosTouchEndTimerId=null,this._flushIosDeferredIfReady()},150))};s.addEventListener("touchstart",a,dC),s.addEventListener("touchend",o,dC),this.unsubs.push(()=>{s.removeEventListener("touchstart",a),s.removeEventListener("touchend",o),this._iosTouchEndTimerId!==null&&this.targetWindow!=null&&(this.targetWindow.clearTimeout(this._iosTouchEndTimerId),this._iosTouchEndTimerId=null)})}this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0})}const i=this.pendingScrollAnchor;if(this.pendingScrollAnchor=null,i&&this.scrollElement&&this.options.enabled){const[s,a,o,l]=i;s!==null&&!o&&(CM()&&(this.isScrolling||this._iosTouching||this._iosJustTouchEnded)?l!==0&&(this._iosDeferredAdjustment+=l):this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0})),o&&this.scrollToEnd({behavior:o})}},this._flushIosDeferredIfReady=()=>{if(this._iosDeferredAdjustment===0||this.isScrolling||this._iosTouching||this._iosJustTouchEnded)return;const n=this.getScrollOffset(),r=this.getMaxScrollOffset();if(n<0||n>r)return;const i=this._iosDeferredAdjustment;this._iosDeferredAdjustment=0,this._scrollToOffset(n,{adjustments:this.scrollAdjustments+=i,behavior:void 0})},this.rafId=null,this.getSize=()=>this.options.enabled?(this.scrollRect=this.scrollRect??this.options.initialRect,this.scrollRect[this.options.horizontal?"width":"height"]):(this.scrollRect=null,0),this.getScrollOffset=()=>this.options.enabled?(this.scrollOffset=this.scrollOffset??(typeof this.options.initialOffset=="function"?this.options.initialOffset():this.options.initialOffset),this.scrollOffset):(this.scrollOffset=null,0),this.getMeasurementOptions=Wm(()=>[this.options.count,this.options.paddingStart,this.options.scrollMargin,this.options.getItemKey,this.options.enabled,this.options.lanes,this.options.laneAssignmentMode,this.options.gap],(n,r,i,s,a,o,l,c)=>(this.prevLanes!==void 0&&this.prevLanes!==o&&(this.lanesChangedFlag=!0),this.prevLanes=o,this.pendingMin=null,{count:n,paddingStart:r,scrollMargin:i,getItemKey:s,enabled:a,lanes:o,laneAssignmentMode:l,gap:c}),{key:!1}),this.getMeasurements=Wm(()=>[this.getMeasurementOptions(),this.itemSizeCacheVersion],({count:n,paddingStart:r,scrollMargin:i,getItemKey:s,enabled:a,lanes:o,laneAssignmentMode:l,gap:c},u)=>{const f=this.itemSizeCache;if(!a)return this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),[];if(this.laneAssignments.size>n)for(const b of this.laneAssignments.keys())b>=n&&this.laneAssignments.delete(b);this.lanesChangedFlag&&(this.lanesChangedFlag=!1,this.lanesSettling=!0,this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),this.pendingMin=null),this.measurementsCache.length===0&&!this.lanesSettling&&(this.measurementsCache=this.options.initialMeasurementsCache,this.measurementsCache.forEach(b=>{this.itemSizeCache.set(b.key,b.size)}));const h=this.lanesSettling?0:this.pendingMin??0;if(this.pendingMin=null,this.lanesSettling&&this.measurementsCache.length===n&&(this.lanesSettling=!1),o===1){const b=n*2;let w=this._flatMeasurements;if(!w||w.length0&&E.set(w.subarray(0,h*2)),w=E,this._flatMeasurements=w}let O;if(h===0)O=r+i;else{const E=h-1;O=w[E*2]+w[E*2+1]+c}for(let E=h;E1){k=O;const j=y[k],L=j!==void 0?p[j]:void 0;E=L?L.end+c:r+i}else if(v===o){let j=0,L=m[0],B=y[0];for(let $=1;$this.options.debug}),this.calculateRange=Wm(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset(),this.options.lanes],(n,r,i,s)=>n.length===0||r===0?(this.range=null,null):(this.range=DBe(n,r,i,s,s===1&&this._flatMeasurements!=null?this._flatMeasurements:null),this.range),{key:!1,debug:()=>this.options.debug}),this.getVirtualIndexes=Wm(()=>{let n=null,r=null;const i=this.calculateRange();return i&&(n=i.startIndex,r=i.endIndex),this.maybeNotify.updateDeps([this.isScrolling,n,r]),[this.options.rangeExtractor,this.options.overscan,this.options.count,n,r]},(n,r,i,s,a)=>s===null||a===null?[]:n({startIndex:s,endIndex:a,overscan:r,count:i}),{key:!1,debug:()=>this.options.debug}),this.indexFromElement=n=>{const r=this.options.indexAttribute,i=n.getAttribute(r);return i?parseInt(i,10):(console.warn(`Missing attribute name '${r}={index}' on measured element.`),-1)},this.shouldMeasureDuringScroll=n=>{var r;if(!this.scrollState||this.scrollState.behavior!=="smooth")return!0;const i=this.scrollState.index??((r=this.getVirtualItemForOffset(this.scrollState.lastTargetOffset))==null?void 0:r.index);if(i!==void 0&&this.range){const s=Math.max(this.options.overscan,Math.ceil((this.range.endIndex-this.range.startIndex)/2)),a=Math.max(0,i-s),o=Math.min(this.options.count-1,i+s);return n>=a&&n<=o}return!0},this.measureElement=n=>{if(!n){this.elementsCache.forEach((a,o)=>{a.isConnected||(this.observer.unobserve(a),this.elementsCache.delete(o))});return}const r=this.indexFromElement(n),i=this.options.getItemKey(r),s=this.elementsCache.get(i);s!==n&&(s&&this.observer.unobserve(s),this.observer.observe(n),this.elementsCache.set(i,n)),(!this.isScrolling||this.scrollState)&&this.shouldMeasureDuringScroll(r)&&this.resizeItem(r,this.options.measureElement(n,void 0,this))},this.resizeItem=(n,r)=>{var i,s;if(n<0||n>=this.options.count)return;let a,o,l;const c=this._flatMeasurements;if(this.options.lanes===1&&c!==null)l=this.options.getItemKey(n),o=c[n*2],a=c[n*2+1];else{const h=this.measurementsCache[n];if(!h)return;l=h.key,o=h.start,a=h.size}const u=this.itemSizeCache.get(l)??a,f=r-u;if(f!==0){const h=this.options.anchorTo==="end"&&((i=this.scrollState)==null?void 0:i.behavior)!=="smooth"&&this.getVirtualDistanceFromEnd()<=this.options.scrollEndThreshold,p=h?this.getTotalSize():0,y=((s=this.scrollState)==null?void 0:s.behavior)!=="smooth"&&(this.shouldAdjustScrollPositionOnItemSizeChange!==void 0?this.shouldAdjustScrollPositionOnItemSizeChange(this.measurementsCache[n]??{index:n,key:l,start:o,size:a,end:o+a,lane:0},f,this):o[this.getVirtualIndexes(),this.getMeasurements()],(n,r)=>{const i=[];for(let s=0,a=n.length;sthis.options.debug}),this.getVirtualItemForOffset=n=>{const r=this.getMeasurements();if(r.length===0)return;const i=this._flatMeasurements,s=this.options.lanes===1&&i!=null,a=pde(0,r.length-1,s?o=>i[o*2]:o=>SW(r[o]).start,n);return SW(r[a])},this.getMaxScrollOffset=()=>{if(!this.scrollElement)return 0;if("scrollHeight"in this.scrollElement)return this.options.horizontal?this.scrollElement.scrollWidth-this.scrollElement.clientWidth:this.scrollElement.scrollHeight-this.scrollElement.clientHeight;{const n=this.scrollElement.document.documentElement;return this.options.horizontal?n.scrollWidth-this.scrollElement.innerWidth:n.scrollHeight-this.scrollElement.innerHeight}},this.getVirtualDistanceFromEnd=()=>Math.max(this.getTotalSize()-this.getSize()-this.getScrollOffset(),0),this.getDistanceFromEnd=()=>Math.max(this.getMaxScrollOffset()-this.getScrollOffset(),0),this.isAtEnd=(n=this.options.scrollEndThreshold)=>this.getDistanceFromEnd()<=n,this.getOffsetForAlignment=(n,r,i=0)=>{if(!this.scrollElement)return 0;const s=this.getSize(),a=this.getScrollOffset();r==="auto"&&(r=n>=a+s?"end":"start"),r==="center"?n+=(i-s)/2:r==="end"&&(n-=s);const o=this.getMaxScrollOffset();return Math.max(Math.min(o,n),0)},this.getOffsetForIndex=(n,r="auto")=>{n=Math.max(0,Math.min(n,this.options.count-1));const i=this.getSize(),s=this.getScrollOffset(),a=this.measurementsCache[n];if(!a)return;if(r==="auto")if(a.end>=s+i-this.options.scrollPaddingEnd)r="end";else if(a.start<=s+this.options.scrollPaddingStart)r="start";else return[s,r];if(r==="end"&&n===this.options.count-1)return[this.getMaxScrollOffset(),r];const o=r==="end"?a.end+this.options.scrollPaddingEnd:a.start-this.options.scrollPaddingStart;return[this.getOffsetForAlignment(o,r,a.size),r]},this.scrollToOffset=(n,{align:r="start",behavior:i="auto"}={})=>{const s=this.getOffsetForAlignment(n,r),a=this.now();this.scrollState={index:null,align:r,behavior:i,startedAt:a,lastTargetOffset:s,stableFrames:0},this._scrollToOffset(s,{adjustments:void 0,behavior:i}),this.scheduleScrollReconcile()},this.scrollToIndex=(n,{align:r="auto",behavior:i="auto"}={})=>{n=Math.max(0,Math.min(n,this.options.count-1));const s=this.getOffsetForIndex(n,r);if(!s)return;const[a,o]=s,l=this.now();this.scrollState={index:n,align:o,behavior:i,startedAt:l,lastTargetOffset:a,stableFrames:0},this._scrollToOffset(a,{adjustments:void 0,behavior:i}),this.scheduleScrollReconcile()},this.scrollBy=(n,{behavior:r="auto"}={})=>{const i=this.getScrollOffset()+n,s=this.now();this.scrollState={index:null,align:"start",behavior:r,startedAt:s,lastTargetOffset:i,stableFrames:0},this._scrollToOffset(i,{adjustments:void 0,behavior:r}),this.scheduleScrollReconcile()},this.scrollToEnd=({behavior:n="auto"}={})=>{if(this.options.count>0){this.scrollToIndex(this.options.count-1,{align:"end",behavior:n});return}this.scrollToOffset(Math.max(this.getTotalSize()-this.getSize(),0),{behavior:n})},this.getTotalSize=()=>{var n;const r=this.getMeasurements();let i;if(r.length===0)i=this.options.paddingStart;else if(this.options.lanes===1){const s=r.length-1,a=this._flatMeasurements;a!=null?i=a[s*2]+a[s*2+1]:i=((n=r[s])==null?void 0:n.end)??0}else{const s=Array(this.options.lanes).fill(null);let a=r.length-1;for(;a>=0&&s.some(o=>o===null);){const o=r[a];s[o.lane]===null&&(s[o.lane]=o.end),a--}i=Math.max(...s.filter(o=>o!==null))}return Math.max(i-this.options.scrollMargin+this.options.paddingEnd,0)},this.takeSnapshot=()=>{const n=[];if(this.itemSizeCache.size===0)return n;const r=this.getMeasurements();for(const i of r)i&&this.itemSizeCache.has(i.key)&&n.push({index:i.index,key:i.key,start:i.start,size:i.size,end:i.end,lane:i.lane});return n},this._scrollToOffset=(n,{adjustments:r,behavior:i})=>{this._intendedScrollOffset=n+(r??0),this.options.scrollToFn(n,{behavior:i,adjustments:r},this)},this.measure=()=>{this.pendingMin=null,this.itemSizeCache.clear(),this.laneAssignments.clear(),this.itemSizeCacheVersion++,this.notify(!1)},this.setOptions(e)}applyScrollAdjustment(e,n){e!==0&&(CM()&&(this.isScrolling||this._iosTouching||this._iosJustTouchEnded)?this._iosDeferredAdjustment+=e:(this._scrollToOffset(this.getScrollOffset(),{adjustments:this.scrollAdjustments+=e,behavior:n}),this.scrollOffset!==null&&(this.scrollOffset+=this.scrollAdjustments,this.scrollAdjustments=0)))}scheduleScrollReconcile(){if(!this.targetWindow){this.scrollState=null;return}this.rafId==null&&(this.rafId=this.targetWindow.requestAnimationFrame(()=>{this.rafId=null,this.reconcileScroll()}))}reconcileScroll(){if(!this.scrollState||!this.scrollElement)return;if(this.now()-this.scrollState.startedAt>5e3){this.scrollState=null;return}const r=this.scrollState.index!=null?this.getOffsetForIndex(this.scrollState.index,this.scrollState.align):void 0,i=r?r[0]:this.scrollState.lastTargetOffset,s=1,a=i!==this.scrollState.lastTargetOffset;if(!a&&vBe(i,this.getScrollOffset())){if(this.scrollState.stableFrames++,this.scrollState.stableFrames>=s){this.getScrollOffset()!==i&&this._scrollToOffset(i,{adjustments:void 0,behavior:"auto"}),this.scrollState=null;return}}else if(this.scrollState.stableFrames=0,a){const o=this.getSize()||600,l=Math.abs(i-this.getScrollOffset()),c=this.scrollState.behavior==="smooth"&&l>o;this.scrollState.lastTargetOffset=i,c||(this.scrollState.behavior="auto"),this._scrollToOffset(i,{adjustments:void 0,behavior:c?"smooth":"auto"})}this.scheduleScrollReconcile()}}const pde=(t,e,n,r)=>{for(;t<=e;){const i=(t+e)/2|0,s=n(i);if(sr)e=i-1;else return i}return t>0?t-1:0};function NBe(t,e,n){let r=0;for(;r<=e;){const i=(r+e)/2|0,s=t[i*2];if(sn)e=i-1;else return i}return r>0?r-1:0}function DBe(t,e,n,r,i){const s=t.length-1;if(t.length<=r)return{startIndex:0,endIndex:s};if(r===1&&i!==null){const c=NBe(i,s,n);let u=c;const f=n+e;for(;ut[c].start,n),l=o;if(r===1)for(;l1){const c=Array(r).fill(0);for(;lf=0&&u.some(f=>f>=n);){const f=t[o];u[f.lane]=f.start,o--}o=Math.max(0,o-o%r),l=Math.min(s,l+(r-1-l%r))}return{startIndex:o,endIndex:l}}const kM=typeof document<"u"?x.useLayoutEffect:x.useEffect;function IBe({useFlushSync:t=!0,directDomUpdates:e=!1,directDomUpdatesMode:n="transform",...r}){const i=x.useReducer(c=>c+1,0)[1],s=x.useRef({enabled:e,mode:n,container:null,lastSize:null,lastPositions:new WeakMap,prevRange:null});s.current.enabled=e,s.current.mode=n;const a=c=>{const u=s.current;if(!u.enabled||!u.container)return;const f=c.getTotalSize();if(f!==u.lastSize){u.lastSize=f;const b=c.options.horizontal?"width":"height";u.container.style[b]=`${f}px`}const h=!!c.options.horizontal,p=u.mode==="transform",y=h?"left":"top",m=c.options.scrollMargin,v=c.getVirtualItems();for(const b of v){const w=b.start-m,O=c.elementsCache.get(b.key);O&&u.lastPositions.get(O)!==w&&(u.lastPositions.set(O,w),p?O.style.transform=h?`translate3d(${w}px, 0, 0)`:`translate3d(0, ${w}px, 0)`:O.style[y]=`${w}px`)}},o={...r,onChange:(c,u)=>{var f;const h=s.current;let p=!0;if(h.enabled){a(c);const y=c.range,m=h.prevRange;p=!m||m.isScrolling!==c.isScrolling||m.startIndex!==(y==null?void 0:y.startIndex)||m.endIndex!==(y==null?void 0:y.endIndex),p&&(h.prevRange=y?{startIndex:y.startIndex,endIndex:y.endIndex,isScrolling:c.isScrolling}:null)}p&&(t&&u?Bl.flushSync(i):i()),(f=r.onChange)==null||f.call(r,c,u)}},[l]=x.useState(()=>{const c=new MBe(o);return Object.assign(c,{containerRef:u=>{const f=s.current;if(f.container=u,f.lastSize=null,u&&f.enabled){const h=c.getTotalSize();f.lastSize=h;const p=c.options.horizontal?"width":"height";u.style[p]=`${h}px`}}})});return l.setOptions(o),kM(()=>l._didMount(),[]),kM(()=>l._willUpdate()),kM(()=>{a(l)}),l}function _Be(t){return IBe({observeElementRect:wBe,observeElementOffset:kBe,scrollToFn:PBe,...t})}function RBe(t,e){const n=new Set(dde(t));for(const r of e)r>=0&&rr-i)}function jBe(t,e){const n=Math.min(t,tl.rowOverscanPerSide*2+1),r=new Set(Array.from({length:n},(i,s)=>s));for(const i of e)i>=0&&ii-s)}function LBe({enabled:t,scrollRef:e,viewport:n,rowGeometry:r,sessionEpoch:i,pinnedRowKeys:s,focusedRowKey:a}){const o=n.clientWidth>0&&n.clientHeight>0,l=x.useMemo(()=>[...new Set([...s,...a===void 0?[]:[a]].map(b=>r.getRowIndex(b)))],[a,s,r]),c=x.useCallback(b=>r.getRowHeight(b),[r]),u=x.useCallback(b=>r.rowKeys[b]??b,[r]),f=x.useCallback(b=>RBe(b,l),[l]),h=x.useCallback(()=>n.scrollTop,[n.scrollTop]),p=_Be({enabled:o,useFlushSync:!1,count:r.rowKeys.length,getScrollElement:()=>e.current,estimateSize:c,getItemKey:u,overscan:tl.rowOverscanPerSide,rangeExtractor:f,scrollMargin:Ra+r0,initialRect:{width:n.clientWidth,height:n.clientHeight},initialOffset:h});x.useEffect(()=>{var b;o&&(p.measure(),(b=e.current)==null||b.dispatchEvent(new Event("scroll")))},[t,e,i,o,p]);const y=a===void 0?-1:r.getRowIndex(a),m=y<0?0:r.getRowHeight(y);x.useEffect(()=>{o&&y>=0&&p.resizeItem(y,m)},[t,m,y,i,o,p]);const v=x.useMemo(()=>null,[t,r]);return v||(o?p.getVirtualItems().map(({index:b})=>({index:b,rowKey:r.rowKeys[b]??b})):jBe(r.rowKeys.length,l).map(b=>({index:b,rowKey:r.rowKeys[b]??b})))}function OW(t){var r;if(!(t instanceof Element))return;const e=(r=t.closest("[data-timeline-row-key]"))==null?void 0:r.dataset.timelineRowKey;if(e===void 0)return;const n=Number(e);return Number.isFinite(n)?n:void 0}function FBe({scrollRef:t,viewport:e,rowGeometry:n,sessionEpoch:r,elements:i,selectedElementId:s,focusedRowKey:a,draggedRowKey:o,resizingElementIds:l,clipContextMenuRowKey:c,keyframeContextMenuRowKey:u,lastScrollLeftRef:f,syncScrollViewport:h}){const p=R$e,[y,m]=x.useState(),v=x.useCallback(_=>{m(OW(_.target))},[]),b=x.useCallback(_=>{m(OW(_.relatedTarget))},[]),w=x.useMemo(()=>AW(i,s),[i,s]),O=x.useMemo(()=>(l==null?void 0:l.map(_=>{var I;return(I=AW(i,_))==null?void 0:I.rowKey}).filter(_=>_!==void 0))??[],[i,l]),k=x.useMemo(()=>[o,...O,w==null?void 0:w.rowKey,a,c,u].filter(_=>_!==void 0),[c,o,a,u,O,w]),E=LBe({enabled:p,scrollRef:t,viewport:e,rowGeometry:n,sessionEpoch:r,pinnedRowKeys:k,focusedRowKey:y??a}),T=x.useRef(n),N=x.useRef(r);return x.useLayoutEffect(()=>{const _=t.current,I=T.current;if(N.current!==r)N.current=r,f.current=0,_&&(_.scrollLeft=0,_.scrollTop=0,h(_));else if(_&&I!==n){const j=fBe(I,n,_.scrollTop);j!==_.scrollTop&&(_.scrollTop=j,h(_))}T.current=n},[f,n,t,r,h]),{enabled:p,virtualRows:E,timelineFocusProps:{onFocus:v,onBlur:b}}}function $Be(t){const e=ue(l=>l.expandedClipIds),n=ue(l=>l.collapsedGroupIds),r=ue(l=>l.expandedLaneOwnerIds),i=ue(l=>l.timelineProjectId),s=xBe({tracks:t.tracks,displayTrackOrder:t.layout.displayTrackOrder,laneCounts:t.laneCounts,selectedElementId:t.selectedElementId,selectedElementIds:t.selectedElementIds,expandedClipIds:e,collapsedGroupIds:n,expandedLaneOwnerIds:r,groups:t.groups,trackGroupOf:t.trackGroupOf,gsapAnimations:t.gsapAnimations}),a=yBe({scrollRef:t.scrollRef,logicalRows:s,elements:t.elements,rowGeometry:t.layout.rowGeometry,pixelsPerSecond:t.pixelsPerSecond,contentOrigin:t.contentOrigin,allowHorizontal:t.allowHorizontal,viewportVersion:t.viewport,projectId:i,sessionEpoch:t.sessionEpoch,syncScrollViewport:t.syncScrollViewport}),o=FBe({scrollRef:t.scrollRef,viewport:t.viewport,rowGeometry:t.layout.rowGeometry,sessionEpoch:t.sessionEpoch,elements:t.elements,selectedElementId:t.selectedElementId,focusedRowKey:a.focusedRowKey,draggedRowKey:t.draggedRowKey,resizingElementIds:t.resizingElementIds,clipContextMenuRowKey:t.clipContextMenuRowKey,keyframeContextMenuRowKey:t.keyframeContextMenuRowKey,lastScrollLeftRef:t.lastScrollLeftRef,syncScrollViewport:t.syncScrollViewport});return{logicalRows:s,...a,rowVirtualizationActive:o.enabled,virtualRows:o.virtualRows,timelineFocusProps:o.timelineFocusProps}}const BBe=x.memo(function({onSeek:e,onDrillDown:n,renderClipContent:r,renderClipOverlay:i,onFileDrop:s,onAssetDrop:a,onBlockDrop:o,onCompositionDrop:l,onDeleteElement:c,onMoveElement:u,onMoveElements:f,onResizeElement:h,onResizeElements:p,onBlockedEditAttempt:y,onSplitElement:m,onSelectElement:v,theme:b,sessionEpoch:w=0}={}){var lt;const{onMoveElement:O,onMoveElements:k,onResizeElement:E,onResizeElements:T,onBlockedEditAttempt:N,onSplitElement:_,onRazorSplitAll:I,onDeleteKeyframe:j,onDeleteAllKeyframes:L,onMoveKeyframeToPlayhead:B,onMoveKeyframe:$}=$$e({onMoveElement:u,onMoveElements:f,onResizeElement:h,onResizeElements:p,onBlockedEditAttempt:y,onSplitElement:m}),z=x.useMemo(()=>({...Fj,...b}),[b]),Y=dBe();Hke();const W=ue(kt=>kt.elements),J=aS(),ne=Vke(),le=ue(kt=>kt.duration),ie=ue(kt=>kt.timeDisplayMode),q=ue(kt=>kt.timelineReady),F=ue(kt=>kt.selectedElementId),U=ue(kt=>kt.selectedElementIds),Z=ue(kt=>kt.focusedEaseSegment),K=ue(kt=>kt.gsapAnimations),ee=x.useMemo(()=>rBe(K,J),[K,J]),re=ee?Fo+W2:W2+E3e,Q=ee?W2:0,H=ue(kt=>kt.setSelectedElementId),se=ue(kt=>kt.currentTime),{zoomMode:fe,manualZoomPercent:be,setZoomMode:me,setManualZoomPercent:pe}=Uae(),ge=x.useRef(null),Pe=x.useRef(null),ve=x.useRef(null),xe=ue(kt=>kt.activeTool),[we,Ce]=x.useState(null),Me=x.useRef(!1),Ve=aBe(),[tt,Ze]=x.useState(!1),[qe,pt]=x.useState(null),[it,vt]=x.useState(null),Ot=x.useCallback(kt=>{Pe.current=kt},[]),Kt=x.useRef(0),qt=x.useMemo(()=>hde(le,W),[le,W]),fn=ue(kt=>kt.keyframeCache);_$e(K);const{tracks:Jt,trackStyles:Je,trackOrder:St,trackOrderRef:At,laneCounts:Ke,rowGeometry:Be,rowGeometryRef:We,groups:Ye,trackGroupOf:Zt}=q7e(J,K,F,U),Te=x.useRef(J);Te.current=J;const De=x.useRef(100),ze=x.useRef(qt);ze.current=qt;const st=x.useRef(100),{pinZoomBeforeEdit:Gt,setRangeSelectionRef:ln,pinnedOnMoveElement:Yt,pinnedOnMoveElements:Nn,pinnedOnResizeElement:Mr,pinnedOnResizeElements:mt,pinnedOnFileDrop:vn,pinnedOnAssetDrop:mn,pinnedOnBlockDrop:Tn,pinnedOnCompositionDrop:Ln}=g$e({ppsRef:De,fitPpsRef:st,onMoveElement:O,onMoveElements:k,onResizeElement:E,onResizeElements:T,onFileDrop:s,onAssetDrop:a,onBlockDrop:o,onCompositionDrop:l}),{readClipZIndex:et,applyStackingPatches:Yn,zSyncEnabled:Mt}=N$e({expandedElementsRef:Te}),{gapMenuModel:hn,gapHighlight:Ht,setHoveredGapAction:dn,openGapMenu:tr,dismissGapMenu:_n,closeTrackGap:xr,closeAllTrackGaps:nr}=Z$e({tracks:Jt,expandedElementsRef:Te,trackOrderRef:At,onMoveElement:Yt,onMoveElements:Nn}),{draggedClip:gt,setDraggedClip:rr,resizingClip:Cn,setResizingClip:Rn,blockedClipRef:xt,suppressClickRef:Ut}=s$e({scrollRef:ve,ppsRef:De,durationRef:ze,trackOrderRef:At,rowGeometryRef:We,onMoveElement:Yt,onMoveElements:Nn,onResizeElement:Mr,onResizeElements:mt,onBlockedEditAttempt:N,setShowPopover:Ze,setRangeSelectionRef:ln,readZIndex:Mt?et:void 0,onStackingPatches:Mt?Yn:void 0,refreshAfterLaneMove:Y,sessionEpoch:w}),Ct=F5e({scrollRef:ve,ppsRef:De,durationRef:ze,trackOrderRef:At,rowGeometryRef:We,contentOrigin:re,onFileDrop:vn,onAssetDrop:mn,onBlockDrop:Tn,onCompositionDrop:Ln,sessionEpoch:w}),fr=J7e(gt,St,Be),Dt=((lt=Cn==null?void 0:Cn.groupPreview)==null?void 0:lt.map(kt=>kt.key))??(Cn?[Zn(Cn.element)]:void 0),{recordTimelineScroll:wt}=tBe({totalClipCount:J.length,totalRowCount:fr.displayTrackOrder.length,zoomMode:fe}),{viewport:gn,showShortcutHint:Lt,setScrollRef:rn,syncScrollViewport:hs}=F$e(ve,[q,J.length,fr.totalH]),{pps:Fn,fitPps:ri,displayContentWidth:cn,displayDuration:kn,zoomModeRef:ir,manualZoomPercentRef:Pi}=D$e({viewportWidth:gn.clientWidth,effectiveDuration:qt,zoomMode:fe,manualZoomPercent:be,ppsRef:De,fitPpsRef:st,draggedClip:gt,resizingClip:Cn,expandedElements:J,isDragging:Me,scrollRef:ve,lastScrollLeftRef:Kt,contentOrigin:re}),Jr=$Be({scrollRef:ve,tracks:Jt,layout:fr,laneCounts:Ke,selectedElementId:F,selectedElementIds:U,groups:Ye,trackGroupOf:Zt,gsapAnimations:K,elements:J,pixelsPerSecond:Fn,contentOrigin:re,allowHorizontal:fe==="manual",viewport:gn,sessionEpoch:w,draggedRowKey:gt!=null&>.started?gt.previewTrack:void 0,resizingElementIds:Dt,clipContextMenuRowKey:it==null?void 0:it.element.track,keyframeContextMenuRowKey:qe==null?void 0:qe.element.track,lastScrollLeftRef:Kt,syncScrollViewport:hs}),Vi=ue(kt=>kt.selectedKeyframes),ds=ue(kt=>kt.toggleSelectedKeyframe),{onClickKeyframe:Nr,onSelectSegment:Qa,onShiftClickKeyframe:bi,onContextMenuKeyframe:wa}=oPe({expandedElements:J,keyframeCache:fn,onSelectElement:v,onSeek:e,setSelectedElementId:H,setKfContextMenu:pt,toggleSelectedKeyframe:ds}),{clipIndex:ft,renderTimeRange:Ae,visibleTimeRange:_e,pinnedClipIdentities:ot}=hBe({tracks:Jt,viewport:gn,pixelsPerSecond:Fn,contentOrigin:re,duration:kn,selectedElementId:F??void 0,draggedElementId:gt?Zn(gt.element):void 0,resizingElementIds:Dt,focusedElementId:Jr.pinnedElementId,focusedEaseElementId:Z==null?void 0:Z.elementId,clipContextMenuElementId:it?Zn(it.element):void 0,keyframeContextMenuElementId:qe?Zn(qe.element):void 0});lFe({scrollRef:ve,currentTime:se,clipStateVersion:Ae,elementStateVersion:J});const bt=W$e({gapHighlight:Ht,tracks:Jt,selectedElementId:F,selectedElementIds:U,expandedElements:J,dragActive:(gt==null?void 0:gt.started)===!0||Cn!=null,displayDuration:kn}),{seekFromX:en,autoScrollDuringDrag:Pn,dragScrollRaf:Br}=O5e({playheadRef:ge,scrollRef:ve,ppsRef:De,durationRef:ze,isDragging:Me,currentTime:se,zoomMode:fe,zoomModeRef:ir,manualZoomPercentRef:Pi,fitPps:ri,fitPpsRef:st,effectiveDuration:qt,pps:Fn,timelineReady:q,elementsLength:J.length,setZoomMode:me,setManualZoomPercent:pe,onSeek:e,contentOrigin:re}),{razorGuideX:lr,updateRazorGuide:vi,clearRazorGuide:ps,splitAllAtPointer:ql}=q$e({active:xe==="razor",scrollRef:ve,contentOrigin:re,pixelsPerSecond:Fn,onSplitAll:I}),{rangeSelection:Vr,setRangeSelection:As,shiftClickClipRef:Bc,marqueeRect:ju,isScrubbing:Oa,handlePointerDown:Ca,handlePointerMove:Vc,handlePointerUp:Lu,handlePointerCancel:Yl}=w5e({scrollRef:ve,ppsRef:De,effectiveDuration:qt,pps:Fn,onSeek:e,seekFromX:en,autoScrollDuringDrag:Pn,dragScrollRaf:Br,isDragging:Me,setShowPopover:Ze,elementsRef:Te,clipIndex:ft,rowGeometryRef:We,onSelectElement:v,contentOrigin:re,sessionEpoch:w});ln.current=As,sBe(J,F,Ze,()=>As(null));const{major:Kl,minor:Rs,majorTickInterval:Fu}=oBe(kn,Fn,ie,Jr.rowVirtualizationActive?Ae:void 0),Hr=x.useCallback(kt=>iBe(kt,Cn),[Cn]);return!q||J.length===0?d.jsx($5e,{isDragOver:Ct.isDragOver,onFileDrop:!!s,onDragOver:Ct.handleAssetDragOver,onDragLeave:Ct.handleAssetDragLeave,onDrop:Ct.handleAssetDrop}):d.jsxs("div",{ref:Ot,"aria-label":"Timeline","data-timeline-element-count":J.length,className:`relative border-t select-none h-full overflow-hidden ${Ct.isDragOver?"ring-1 ring-inset ring-studio-accent/60":""} ${xe==="razor"||Ve?"cursor-crosshair":"cursor-default"}`,onMouseMove:vi,onMouseLeave:ps,style:{touchAction:"pan-x pan-y",background:z.shellBackground,borderColor:z.shellBorder},children:[d.jsxs("div",{ref:rn,"data-timeline-scroll-viewport":!0,"data-timeline-auto-scroll-left-inset":ee?Fo:0,tabIndex:-1,className:`${fe==="fit"?"overflow-x-hidden":"overflow-x-auto"} overflow-y-auto h-full outline-none`,onScroll:kt=>{Kt.current=kt.currentTarget.scrollLeft,wt(kt.currentTarget),hs(kt.currentTarget,!0)},...Jr.timelineFocusProps,onDragOver:Ct.handleAssetDragOver,onDragLeave:Ct.handleAssetDragLeave,onDrop:Ct.handleAssetDrop,onPointerDown:kt=>{kt.target instanceof Element&&kt.target.closest("button, input, select, a")||ql(kt)||Ca(kt)},onPointerMove:Vc,onPointerUp:Lu,onPointerCancel:Yl,onLostPointerCapture:Yl,children:[d.jsx(VFe,{major:Kl,minor:Rs,pps:Fn,contentOrigin:re,contentGutter:Q,trackContentWidth:cn,totalH:fr.totalH,effectiveDuration:qt,majorTickInterval:Fu,rangeSelection:Vr,marqueeRect:ju,laneGapStrips:bt,theme:z,displayTrackOrder:fr.displayTrackOrder,rowHeights:fr.displayRowHeights,rowGeometry:fr.rowGeometry,virtualRows:Jr.virtualRows,logicalRows:Jr.logicalRows,focusedTargetId:Jr.focusedTargetId,rowsVirtualized:Jr.rowVirtualizationActive,clipIndex:ft,renderTimeRange:Ae,visibleTimeRange:_e,pinnedClipIdentities:ot,trackOrder:St,tracks:Jt,trackStyles:Je,groups:Ye,laneCounts:Ke,selectedElementId:F,selectedElementIds:U,hoveredClip:we,draggedClip:gt,resizingClip:Cn,isScrubbing:Oa,blockedClipRef:xt,suppressClickRef:Ut,scrollRef:ve,renderClipContent:Jr.rowVirtualizationActive&&gn.isScrolling?void 0:r,renderClipOverlay:i,playheadRef:ge,onDrillDown:n,onSelectElement:v,setHoveredClip:Ce,setShowPopover:Ze,setRangeSelection:As,setResizingClip:Rn,setDraggedClip:rr,setSelectedElementId:H,shiftClickClipRef:Bc,getPreviewElement:Hr,getTrackStyle:Qfe,keyframeCache:fn,gsapAnimations:K,selectedKeyframes:Vi,currentTime:se,onSeek:e,beatAnalysis:ne,onSelectSegment:Qa,onClickKeyframe:Nr,onShiftClickKeyframe:bi,onMoveKeyframe:$,onContextMenuKeyframe:wa,onContextMenuClip:(kt,Ai)=>{kt.preventDefault(),H(Ai.key??Ai.id),v==null||v(Ai),_n(),vt({x:kt.clientX,y:kt.clientY,element:Ai,sessionEpoch:ue.getState().timelineSessionEpoch})},onContextMenuLane:(kt,Ai,ph)=>{gt!=null&>.started||Cn||(vt(null),tr({x:kt.clientX,y:kt.clientY,track:Ai,time:ph}))}}),xe==="razor"&&lr!==null&&d.jsx(Y$e,{x:lr})]}),d.jsx(m$e,{elements:J,elementsRef:Te,theme:z,showShortcutHint:Lt,showPopover:tt,rangeSelection:Vr,setShowPopover:Ze,setRangeSelection:As,kfContextMenu:qe,setKfContextMenu:pt,onDeleteKeyframe:j,onDeleteAllKeyframes:L,onMoveKeyframeToPlayhead:B,clipContextMenu:it,setClipContextMenu:vt,currentTime:se,onSplitElement:_,pinZoomBeforeEdit:Gt,onDeleteElement:c,gapContextMenu:hn,onDismissGapContextMenu:_n,onCloseTrackGap:xr,onCloseAllTrackGaps:nr,onHoverGapAction:dn})]})}),VBe={overscan:0,visible:1,interaction:2},CW=Object.freeze({status:"idle"});function HBe(t){return t==="video"?"video":t==="composition"?"composition":"general"}function QBe(t){return t instanceof Error?t:new Error(String(t))}function TS(t){return Object.entries(t).filter(e=>e[1]!==void 0).sort(([e],[n])=>e.localeCompare(n)).map(([e,n])=>`${encodeURIComponent(e)}=${encodeURIComponent(String(n))}`).join("&")}function V_(t){return TS({project:t.projectId,session:t.sessionEpoch,request:t.key,kind:t.kind,rich:t.rich?1:0})}class zBe{constructor(e=tl,n=Date.now){Et(this,"entries",new Map);Et(this,"budgets");Et(this,"nextLeaseId",1);Et(this,"nextSequence",1);Et(this,"scrolling",!1);Et(this,"cacheBytes",0);Et(this,"waveformCacheBytes",0);Et(this,"activeByBucket",{video:0,composition:0,general:0});Et(this,"activeByKind",{video:0,image:0,composition:0,waveform:0});Et(this,"now");this.budgets=e,this.now=n}acquire(e,n){const r=V_(e);let i=this.entries.get(r);(i==null?void 0:i.state)==="error"&&i.failedAt!==void 0&&this.now()-i.failedAt>=this.budgets.metadataFailureTtlMs&&(this.deleteEntry(r,i),i=this.entries.get(r)),i||(i={request:e,scopedKey:r,state:"queued",leases:new Map,listeners:new Map,controller:null,weight:0,disposed:!1,cached:!1,lastAccess:this.nextSequence++,snapshot:Object.freeze({status:"queued"})},this.entries.set(r,i));const s=this.nextLeaseId++;i.leases.set(s,e.priority),i.listeners.set(s,n),i.lastAccess=this.nextSequence++,this.pump();let a=!1;return{updatePriority:o=>{const l=this.entries.get(r);!l||!l.leases.has(s)||(l.leases.set(s,o),l.lastAccess=this.nextSequence++,this.pump())},release:()=>{var l;if(a)return;a=!0;const o=this.entries.get(r);o&&(o.leases.delete(s),o.listeners.delete(s),o.leases.size===0&&(o.state==="queued"?this.deleteEntry(r,o):o.state==="loading"?((l=o.controller)==null||l.abort(),this.deleteEntry(r,o)):o.state==="ready"&&!o.cached&&this.deleteEntry(r,o)),this.evict())}}}getSnapshot(e){const n=this.entries.get(V_(e));return n?n.snapshot:CW}setScrolling(e){this.scrolling!==e&&(this.scrolling=e,e||this.pump())}invalidateProject(e){var n;for(const[r,i]of this.entries)i.request.projectId===e&&(i.leases.size>0||((n=i.controller)==null||n.abort(),this.deleteEntry(r,i)))}getDiagnostics(){let e=0,n=0,r=0,i=0,s=0;for(const a of this.entries.values())a.state==="queued"&&e++,a.state==="loading"&&n++,a.cached&&(a.request.kind==="waveform"?s++:i++),r+=a.leases.size;return{queued:e,active:n,leases:r,cacheEntries:i,cacheBytes:this.cacheBytes,waveformCacheEntries:s,waveformCacheBytes:this.waveformCacheBytes,activeByKind:{...this.activeByKind}}}pump(){const e=Array.from(this.entries.values()).filter(n=>n.state==="queued"&&n.leases.size>0).sort((n,r)=>this.entryPriority(r)-this.entryPriority(n)||n.lastAccess-r.lastAccess);for(const n of e){if(this.scrolling&&n.request.rich)continue;const r=HBe(n.request.kind);this.activeByBucket[r]>=this.bucketLimit(r)||this.start(n,r)}}start(e,n){e.state="loading",e.snapshot=Object.freeze({status:"loading"});const r=new AbortController;e.controller=r,this.activeByBucket[n]++,this.activeByKind[e.request.kind]++,this.notify(e),this.loadWithTimeout(e,r).then(s=>this.acceptResult(e,r,s)).catch(s=>{if(this.entries.get(e.scopedKey)===e){if(r.signal.aborted&&e.leases.size===0){this.deleteEntry(e.scopedKey,e);return}e.state="error",e.error=QBe(s),e.failedAt=this.now(),e.snapshot=Object.freeze({status:"error",error:e.error}),this.notify(e),this.evictFailures()}}).finally(()=>{e.controller===r&&(e.controller=null),this.activeByBucket[n]--,this.activeByKind[e.request.kind]--,this.pump()})}acceptResult(e,n,r){if(n.signal.aborted||this.entries.get(e.scopedKey)!==e){this.safeDispose(r.dispose);return}this.validateResult(r),e.state="ready",e.value=r.value,e.weight=r.weight,e.dispose=r.dispose,this.cacheResult(e),e.snapshot=Object.freeze({status:"ready",value:r.value}),this.notify(e),this.evict(),!e.cached&&e.leases.size===0&&this.deleteEntry(e.scopedKey,e)}validateResult(e){if(!(Number.isFinite(e.weight)&&e.weight>=0))throw this.safeDispose(e.dispose),new RangeError("Thumbnail result weight must be finite and non-negative")}cacheResult(e){const n=e.request.kind==="waveform",r=n?this.budgets.waveformCacheBytes:this.budgets.thumbnailCacheBytes;e.cached=e.weight<=r,e.cached&&(n?this.waveformCacheBytes+=e.weight:this.cacheBytes+=e.weight)}entryPriority(e){let n=-1;for(const r of e.leases.values())n=Math.max(n,VBe[r]);return n}bucketLimit(e){return e==="video"?this.budgets.concurrentVideoDecodes:e==="composition"?this.budgets.concurrentCompositionFetches:this.budgets.concurrentMetadataJobs}evict(){this.evictPartition(!1),this.evictPartition(!0)}evictPartition(e){const n=Array.from(this.entries.values()).filter(s=>s.cached&&s.request.kind==="waveform"===e),r=new Map;for(const s of n)r.set(s.request.projectId,(r.get(s.request.projectId)??0)+1);n.sort((s,a)=>s.lastAccess-a.lastAccess);let i=n.length;for(const s of n){const a=r.get(s.request.projectId)??0;this.isCacheOverBudget(e,i,a)&&(this.uncache(s),i--,r.set(s.request.projectId,a-1),s.leases.size===0&&this.deleteEntry(s.scopedKey,s))}}isCacheOverBudget(e,n,r){const i=e?this.budgets.waveformCacheEntries:this.budgets.thumbnailCacheEntries,s=e?this.budgets.waveformCacheBytes:this.budgets.thumbnailCacheBytes,a=e?this.waveformCacheBytes:this.cacheBytes,o=!e&&r>this.budgets.thumbnailCacheEntriesPerProject;return n>i||a>s||o}uncache(e){e.cached=!1,e.request.kind==="waveform"?this.waveformCacheBytes-=e.weight:this.cacheBytes-=e.weight}notify(e){for(const n of new Set(e.listeners.values()))n()}loadWithTimeout(e,n){let r;try{r=e.request.load(n.signal)}catch(i){r=Promise.reject(i)}return new Promise((i,s)=>{let a=!1;const o=setTimeout(()=>{a||(a=!0,n.abort(),s(new Error(`Thumbnail load timed out after ${this.budgets.thumbnailLoadTimeoutMs}ms`)))},this.budgets.thumbnailLoadTimeoutMs);r.then(l=>{if(a){this.safeDispose(l.dispose);return}a=!0,clearTimeout(o),i(l)},l=>{a||(a=!0,clearTimeout(o),s(l))})})}deleteEntry(e,n){this.entries.get(e)===n&&(this.entries.delete(e),n.snapshot=CW,this.notify(n),n.cached&&(n.cached=!1,n.request.kind==="waveform"?this.waveformCacheBytes-=n.weight:this.cacheBytes-=n.weight),n.disposed||(n.disposed=!0,this.safeDispose(n.dispose)),n.listeners.clear(),n.leases.clear())}evictFailures(){const e=Array.from(this.entries.values()).filter(r=>r.state==="error"&&r.leases.size===0).sort((r,i)=>r.lastAccess-i.lastAccess),n=e.length-this.budgets.thumbnailCacheEntries;for(const r of e.slice(0,Math.max(0,n)))this.deleteEntry(r.scopedKey,r)}safeDispose(e){try{e==null||e()}catch{}}}const ZBe=new zBe,kW=Object.freeze({status:"idle"});function o3(t,e=ZBe){const n=x.useRef(t);n.current=t;const r=x.useRef(null),i=t?V_(t):null,s=t==null?void 0:t.priority,a=x.useCallback(l=>{const c=n.current;if(!c||i===null)return()=>{};const u=e.acquire(c,l);return r.current=u,()=>{r.current===u&&(r.current=null),u.release()}},[i,e]),o=x.useCallback(()=>{const l=n.current;return l&&i!==null?e.getSnapshot(l):kW},[i,e]);return x.useLayoutEffect(()=>{var l;s&&((l=r.current)==null||l.updatePriority(s))},[s]),x.useSyncExternalStore(a,o,()=>kW)}function GBe(t,e,n){const r=Math.max(0,Number.isFinite(t)?t:0),i=Math.max(0,Number.isFinite(e)?e:0),s=Math.max(1,Number.isFinite(n)?Math.floor(n):1);return s===1?[r+i/2]:Array.from({length:s},(a,o)=>r+i*o/(s-1))}async function UBe(t){return t instanceof HTMLCanvasElement?new Promise((e,n)=>{t.toBlob(r=>r?e(r):n(new Error("Video thumbnail encode failed")),"image/jpeg",.72)}):t.convertToBlob({type:"image/jpeg",quality:.72})}function D1(t){if(t.aborted)throw new DOMException("Aborted","AbortError")}function mde(t){for(const e of t.urls.splice(0))URL.revokeObjectURL(e);for(const e of t.canvases)e.width=0,e.height=0;t.canvases.clear()}function XBe(t,e){const n=Math.max(1,Math.min(e.posterMaxPhysicalWidth,Math.round(e.posterMaxPhysicalHeight*t)));return{width:n,height:Math.max(1,Math.min(e.posterMaxPhysicalHeight,Math.round(n/t)))}}async function WBe(t,e,n,r){for await(const i of t.canvasesAtTimestamps(e)){if(D1(n),!i)continue;r.canvases.add(i.canvas);const s=await UBe(i.canvas);D1(n),r.urls.push(URL.createObjectURL(s))}}function qBe(t,e,n,r){const i=t.urls[0];if(!i)throw new Error("Video source returned no thumbnail frames");return{value:t.urls.length===1?{kind:"image",url:i,aspect:e}:{kind:"filmstrip",urls:[...t.urls],aspect:e},weight:n*r*4*t.urls.length,dispose:()=>mde(t)}}async function YBe(t,e,n=tl){const r=await hy(()=>import("./index-DivnGS5G.js"),[]);D1(e);const i=new r.Input({source:new r.UrlSource(t.source),formats:r.ALL_FORMATS}),s={urls:[],canvases:new Set};try{const a=await i.getPrimaryVideoTrack();if(D1(e),!a)throw new Error("Video source has no decodable video track");const[o,l]=await Promise.all([a.getDisplayWidth(),a.getDisplayHeight()]);if(D1(e),!(o>0&&l>0))throw new Error("Video source has invalid dimensions");const c=await a.getDurationFromMetadata({skipLiveWait:!0});D1(e);const u=Math.max(0,c??t.sourceRangeDuration??0),f=Math.min(Math.max(0,t.sourceStart??0),u),h=t.sourceRangeDuration??Math.max(0,u-f),p=Math.min(Math.max(0,h),Math.max(0,u-f)),y=GBe(f,p,Math.min(t.frameCount,n.richPreviewFrameCount)),m=o/l,v=XBe(m,n),b=new r.CanvasSink(a,{width:v.width,height:v.height,fit:t.fit??"cover",poolSize:1});return await WBe(b,y,e,s),qBe(s,m,v.width,v.height)}catch(a){throw mde(s),a}finally{i.dispose()}}const gde=66;function yde(t,e,n=!1){return new Promise((r,i)=>{const s=new Image,a=()=>{s.onload=null,s.onerror=null,e.removeEventListener("abort",o)},o=()=>{a(),s.src="",i(new DOMException("Aborted","AbortError"))};if(e.aborted){o();return}s.onload=()=>{a(),r(s.naturalWidth>0&&s.naturalHeight>0?s.naturalWidth/s.naturalHeight:16/9)},s.onerror=()=>{a(),n&&/\.svg($|\?)/i.test(t)?r(16/9):i(new Error("Image thumbnail failed to load"))},e.addEventListener("abort",o,{once:!0}),s.src=t})}function NF(t,e,n=gde,r=1){const i=Number.isFinite(e)&&e>0?e:1.7777777777777777,s=Math.max(r,Math.round(n*i)),a=t>0?Math.max(1,Math.ceil(t/s)):1;return{frameW:s,frameCount:a}}function yA(t){return t.split("/").map(encodeURIComponent).join("/")}function Oy(t,e,n){if(!t||/^(?:data:|blob:)/i.test(t))return t;let r=t,i="";if(/^https?:/i.test(t)){let s;try{s=new URL(t)}catch{return t}if(!n||s.origin!==n)return t;const a=new URL(`/api/projects/${e}/preview/`,n).pathname;if(s.pathname.startsWith(a)||s.pathname.startsWith("/api/"))return t;try{r=s.pathname.replace(/^\/+/,"").split("/").map(decodeURIComponent).join("/")}catch{return t}i=`${s.search}${s.hash}`}return`/api/projects/${e}/preview/${yA(r.replace(/^\/+/,""))}${i}`}const KBe=x.memo(function({videoSrc:e,label:n,labelColor:r,duration:i=5,sourceStart:s,sourceRangeDuration:a,projectId:o=e,sessionEpoch:l=0,priority:c="visible",rich:u=!1}){const[f,h]=x.useState(0),p=x.useRef(null),y=x.useMemo(()=>({key:TS({kind:"video",source:e,start:s,duration:a??i,frames:u?6:1}),projectId:o,sessionEpoch:l,kind:"video",priority:c,rich:u,load:T=>YBe({source:e,sourceStart:s,sourceRangeDuration:a??i,frameCount:u?6:1,fit:"cover"},T)}),[i,c,o,u,l,a,s,e]),m=o3(y),v=m.status==="ready"?m.value:null,b=(v==null?void 0:v.kind)==="filmstrip"?v.urls:(v==null?void 0:v.kind)==="image"?[v.url]:[],w=(v==null?void 0:v.kind)==="image"||(v==null?void 0:v.kind)==="filmstrip"?v.aspect:16/9,{frameW:O,frameCount:k}=NF(f,w,gde),E=x.useCallback(T=>{var _;if((_=p.current)==null||_.disconnect(),!T)return;const N=T.parentElement??T;h(N.clientWidth),p.current=new ResizeObserver(([I])=>h(I.contentRect.width)),p.current.observe(N)},[]);return Or(()=>()=>{var T;return(T=p.current)==null?void 0:T.disconnect()}),d.jsxs("div",{ref:E,className:"absolute inset-0 overflow-hidden",children:[b.length>0&&d.jsx("div",{className:"absolute inset-0 flex",children:Array.from({length:k},(T,N)=>{const _=b[N%b.length];return d.jsx("div",{className:"relative h-full flex-shrink-0 overflow-hidden bg-neutral-900",style:{width:O},children:d.jsx("img",{src:_,alt:"",draggable:!1,className:"absolute inset-0 h-full w-full object-cover"})},N)})}),m.status==="loading"&&b.length===0&&d.jsx("div",{className:"absolute inset-0 animate-pulse motion-reduce:animate-none",style:{background:"linear-gradient(90deg, rgba(255,255,255,0.02) 0%, rgba(255,255,255,0.05) 50%, rgba(255,255,255,0.02) 100%)"}}),m.status==="error"&&d.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-neutral-900/60",children:d.jsx("span",{className:"rounded bg-black/50 px-1 text-[8px] text-neutral-500",children:"no preview"})}),n&&d.jsx("div",{className:"absolute inset-x-0 bottom-0 z-10 px-1.5 pb-0.5 pt-3",style:{background:"linear-gradient(to top, rgba(0,0,0,0.85) 0%, rgba(0,0,0,0.4) 60%, transparent 100%)"},children:d.jsx("span",{className:"block truncate text-[9px] font-semibold leading-tight",style:{color:r,textShadow:"0 1px 2px rgba(0,0,0,0.9)"},children:n})})]})}),JBe=66,eVe="v3";function DF({previewUrl:t,seekTime:e=2,duration:n=5,selector:r,selectorIndex:i,origin:s,output:a}){const o=t.replace("/preview/comp/","/thumbnail/").replace(/\/preview$/,"/thumbnail/index.html"),l=new URL(o,s);return l.searchParams.set("t",(e+n/2).toFixed(2)),l.searchParams.set("v",eVe),a&&l.searchParams.set("output",a),r&&(l.searchParams.set("selector",r),i!=null&&i>0&&l.searchParams.set("selectorIndex",String(i))),l.toString()}async function tVe(t,e){const n=await fetch(t,{signal:e});if(!n.ok)throw new Error(`Composition thumbnail failed (${n.status})`);const r=await n.blob();if(e.aborted)throw new DOMException("Aborted","AbortError");const i=URL.createObjectURL(r);try{const s=await yde(i,e);return{value:{kind:"image",url:i,aspect:s},weight:tl.posterMaxPhysicalWidth*tl.posterMaxPhysicalHeight*4,dispose:()=>URL.revokeObjectURL(i)}}catch(s){throw URL.revokeObjectURL(i),s}}const EM=x.memo(function({previewUrl:e,label:n,labelColor:r,selector:i,selectorIndex:s,seekTime:a=2,duration:o=5,projectId:l=e,sessionEpoch:c=0,priority:u="visible"}){const[f,h]=x.useState(0),p=x.useRef(null),y=DF({previewUrl:e,seekTime:a,duration:o,selector:i,selectorIndex:s,origin:window.location.origin}),m=x.useMemo(()=>({key:TS({kind:"composition",url:y}),projectId:l,sessionEpoch:c,kind:"composition",priority:u,rich:!0,load:E=>tVe(y,E)}),[u,l,c,y]),v=o3(m),b=v.status==="ready"&&v.value.kind==="image"?v.value:null,{frameW:w,frameCount:O}=NF(f,(b==null?void 0:b.aspect)??16/9,JBe,48),k=x.useCallback(E=>{var N;if((N=p.current)==null||N.disconnect(),!E)return;const T=E.parentElement??E;h(T.clientWidth),p.current=new ResizeObserver(([_])=>h(_.contentRect.width)),p.current.observe(T)},[]);return Or(()=>()=>{var E;return(E=p.current)==null?void 0:E.disconnect()}),d.jsxs("div",{ref:k,className:"absolute inset-0 overflow-hidden",children:[b&&d.jsx("div",{className:"absolute inset-0 flex",style:{animation:"hf-thumb-fade 200ms ease-out",mixBlendMode:"lighten"},children:Array.from({length:O},(E,T)=>d.jsx("div",{className:"relative h-full flex-shrink-0 overflow-hidden",style:{width:w},children:d.jsx("img",{src:b.url,alt:"",draggable:!1,className:"absolute inset-0 h-full w-full object-cover",style:{opacity:.7}})},T))}),v.status==="loading"&&d.jsx("div",{className:"absolute inset-0 animate-pulse bg-white/[0.035]"}),n&&d.jsx("div",{className:"absolute inset-y-0 left-3 z-10 flex items-center",children:d.jsx("span",{className:"block max-w-full truncate text-[10px] font-semibold leading-none",style:{color:r,textShadow:b?"0 1px 4px rgba(0,0,0,0.9), 0 0 8px rgba(0,0,0,0.6)":"none"},children:n})})]})});let EW=0;const nVe=800,TW={isEditMode:!1,dismissed:!1,model:null,selectedSegmentIds:new Set,selectedGroupId:null,sourceFilePath:null,syncError:null,retrySave:null,past:[],future:[]};let iv=null,TM=0;function Xc(t,e){if(!t.model)return{};const n=Date.now();return iv===e&&n-TM({...TW,setEditMode:n=>t({isEditMode:n}),setDismissed:n=>t({dismissed:n}),setModel:n=>t({model:n}),setSourceFilePath:n=>t({sourceFilePath:n}),setSyncError:n=>t({syncError:n}),setRetrySave:n=>t({retrySave:n}),undo:()=>{const{model:n,past:r,future:i}=e(),s=r[r.length-1];return!s||!n?null:(iv=null,t({model:s,past:r.slice(0,-1),future:[...i,n]}),s)},redo:()=>{const{model:n,past:r,future:i}=e(),s=i[i.length-1];return!s||!n?null:(iv=null,t({model:s,past:[...r,n].slice(-50),future:i.slice(0,-1)}),s)},selectSegment:(n,r=!1)=>t(i=>{if(r){const s=new Set(i.selectedSegmentIds);return s.has(n)?s.delete(n):s.add(n),{selectedSegmentIds:s,selectedGroupId:null}}return{selectedSegmentIds:new Set([n]),selectedGroupId:null}}),selectGroup:n=>{var i;const r=(i=e().model)==null?void 0:i.groups.get(n);r&&t({selectedSegmentIds:new Set(r.segmentIds),selectedGroupId:n})},selectAll:()=>t(n=>n.model?{selectedSegmentIds:new Set(n.model.segments.keys()),selectedGroupId:null}:{}),clearSelection:()=>{const{selectedSegmentIds:n,selectedGroupId:r}=e();n.size===0&&r===null||t({selectedSegmentIds:new Set,selectedGroupId:null})},updateSegmentStyle:(n,r)=>t(i=>{if(!i.model)return{};const s=i.model.segments.get(n);if(!s)return{};const a=new Map(i.model.segments);return a.set(n,{...s,style:{...s.style,...r}}),{...Xc(i,`seg-style:${n}`),model:{...i.model,segments:a}}}),updateSegmentText:(n,r)=>t(i=>{if(!i.model)return{};const s=i.model.segments.get(n);if(!s)return{};const a=new Map(i.model.segments);return a.set(n,{...s,text:r}),{...Xc(i,`seg-text:${n}`),model:{...i.model,segments:a}}}),updateSegmentTiming:(n,r,i)=>t(s=>{if(!s.model)return{};const a=s.model.segments.get(n);if(!a)return{};const o=new Map(s.model.segments);return o.set(n,{...a,start:r,end:i}),{...Xc(s,`seg-timing:${n}`),model:{...s.model,segments:o}}}),updateGroupStyle:(n,r)=>t(i=>{if(!i.model)return{};const s=i.model.groups.get(n);if(!s)return{};const a=new Map(i.model.groups);return a.set(n,{...s,style:{...s.style,...r}}),{...Xc(i,`group-style:${n}`),model:{...i.model,groups:a}}}),updateGroupContainer:(n,r)=>t(i=>{if(!i.model)return{};const s=i.model.groups.get(n);if(!s)return{};const a=new Map(i.model.groups);return a.set(n,{...s,containerStyle:{...s.containerStyle,...r}}),{...Xc(i,`group-container:${n}`),model:{...i.model,groups:a}}}),updateGroupAnimation:(n,r,i)=>t(s=>{if(!s.model)return{};const a=s.model.groups.get(n);if(!a)return{};const o=new Map(s.model.groups),l=a.animation[r],c=l!==null?{...l,...i}:i;return o.set(n,{...a,animation:{...a.animation,[r]:c}}),{...Xc(s,`group-anim:${n}:${r}`),model:{...s.model,groups:o}}}),splitGroup:(n,r)=>t(i=>{if(!i.model)return{};const s=i.model.groups.get(n);if(!s)return{};const a=s.segmentIds.indexOf(r);if(a<=0)return{};const o=s.segmentIds.slice(0,a),l=s.segmentIds.slice(a),c=`group-split-${EW++}`,u=new Map(i.model.groups);u.set(n,{...s,segmentIds:o}),u.set(c,{...s,id:c,segmentIds:l});const f=i.model.groupOrder.indexOf(n),h=[...i.model.groupOrder];h.splice(f+1,0,c);const p=new Map(i.model.segments);return l.forEach((y,m)=>{const v=p.get(y);v&&p.set(y,{...v,groupIndex:m})}),{...Xc(i,`split:${n}:${r}:${EW}`),model:{...i.model,groups:u,segments:p,groupOrder:h}}}),mergeGroups:(n,r)=>t(i=>{if(!i.model)return{};const s=i.model.groups.get(n),a=i.model.groups.get(r);if(!s||!a)return{};const o=[...s.segmentIds,...a.segmentIds],l=new Map(i.model.groups);l.set(n,{...s,segmentIds:o}),l.delete(r);const c=i.model.groupOrder.filter(h=>h!==r),u=new Map(i.model.segments);a.segmentIds.forEach((h,p)=>{const y=u.get(h);y&&u.set(h,{...y,groupIndex:s.segmentIds.length+p})});const f=i.selectedGroupId===r?null:i.selectedGroupId;return{...Xc(i,`merge:${n}:${r}`),model:{...i.model,groups:l,segments:u,groupOrder:c},selectedGroupId:f}}),updateSelectedStyle:n=>t(r=>{if(!r.model||r.selectedSegmentIds.size===0)return{};const i=new Map(r.model.segments);for(const s of r.selectedSegmentIds){const a=i.get(s);a&&i.set(s,{...a,style:{...a.style,...n}})}return{...Xc(r,`sel-style:${[...r.selectedSegmentIds].join(",")}`),model:{...r.model,segments:i}}}),applyAnimationToAll:n=>t(r=>{if(!r.model)return{};const i=new Map(r.model.groups);for(const[s,a]of i)i.set(s,{...a,animation:n});return{...Xc(r,"apply-anim-all"),model:{...r.model,groups:i}}}),reset:()=>{iv=null,t(n=>({...TW,retrySave:n.retrySave,selectedSegmentIds:new Set,past:[],future:[]}))}})),rVe=new Set(["ArrowLeft","ArrowRight"]),iVe=["button","a[href]","[role='button']","[role='checkbox']","[role='combobox']","[role='menuitem']","[role='radio']","[role='slider']","[role='spinbutton']","[role='switch']","[role='textbox']"].join(",");function sVe(t){if(Zf(t))return!0;if(!t||typeof t!="object")return!1;const e=t;return typeof e.closest!="function"?!1:e.closest.call(t,iVe)!==null}function aVe(t,e={isCaptionEditMode:!1,selectedCaptionSegmentCount:0}){return t.metaKey||t.ctrlKey||t.altKey||sVe(t.target)?!0:rVe.has(t.code)&&e.isCaptionEditMode&&e.selectedCaptionSegmentCount>0}const PW=[1,2,4];let H_=0;function oVe(){H_+=1;let t=!1;return()=>{t||(t=!0,H_-=1)}}function lVe(){return H_>0}function cVe({iframeRef:t,shuttleDirectionRef:e,shuttleSpeedIndexRef:n,iframeShortcutCleanupRef:r,getAdapter:i,play:s,playBackward:a,pause:o,seek:l}){const c=x.useRef(new Set),u=x.useRef(()=>{}),f=x.useRef(()=>{}),h=x.useCallback(w=>{const O=i(),k=(O==null?void 0:O.getTime())??ue.getState().currentTime;l(K6e(k,w,Qd))},[i,l]),p=x.useCallback(w=>{e.current===w?n.current=Math.min(n.current+1,PW.length-1):n.current=0;const O=PW[n.current];ue.getState().setPlaybackRate(O),w==="forward"?s():a(O)},[s,a,e,n]),y=x.useCallback(()=>{ue.getState().isPlaying?o():s()},[s,o]),m=x.useCallback(w=>{var T,N,_;if(w.defaultPrevented)return;const O=An.getState();if(aVe(w,{isCaptionEditMode:O.isEditMode,selectedCaptionSegmentCount:O.selectedSegmentIds.size}))return;const k=w.key.toLowerCase();if(c.current.add(k),w.code==="Space"){w.preventDefault(),y();return}if(!((w.code==="ArrowLeft"||w.code==="ArrowRight")&&lVe())){if(w.code==="ArrowLeft"){w.preventDefault(),h(w.shiftKey?-10:-1);return}if(w.code==="ArrowRight"){w.preventDefault(),h(w.shiftKey?10:1);return}if(!w.repeat){if(k==="m"){w.preventDefault();const I=ue.getState();I.setAudioMuted(!I.audioMuted);return}if(k==="l"&&w.shiftKey){w.preventDefault();const I=ue.getState();I.setLoopEnabled(!I.loopEnabled);return}if(k==="k"){w.preventDefault(),o();return}if(k==="j"){if(w.preventDefault(),c.current.has("k")){h(-1);return}p("backward");return}if(k==="l"){if(w.preventDefault(),c.current.has("k")){h(1);return}p("forward");return}if(k==="i"){w.preventDefault();const I=((T=i())==null?void 0:T.getTime())??ue.getState().currentTime;ue.getState().setInPoint(w.shiftKey?null:I);return}if(k==="o"){w.preventDefault();const I=((N=i())==null?void 0:N.getTime())??ue.getState().currentTime;ue.getState().setOutPoint(w.shiftKey?null:I);return}if(k==="a"){w.preventDefault(),l(ue.getState().inPoint??0,{keepPlaying:!0});return}if(k==="e"){w.preventDefault();const{outPoint:I}=ue.getState();l(I??((_=i())==null?void 0:_.getDuration())??ue.getState().duration,{keepPlaying:!0});return}}}},[o,p,h,y,i,l]),v=x.useCallback(w=>{c.current.delete(w.key.toLowerCase())},[]);u.current=m,f.current=v;const b=x.useCallback(()=>{var T,N,_;(T=r.current)==null||T.call(r),r.current=null;let w=null,O=null;try{w=((N=t.current)==null?void 0:N.contentWindow)??null,O=((_=t.current)==null?void 0:_.contentDocument)??null}catch{return}if(!w&&!O)return;const k=I=>u.current(I),E=I=>f.current(I);try{w==null||w.addEventListener("keydown",k,!0),w==null||w.addEventListener("keyup",E,!0)}catch{}O==null||O.addEventListener("keydown",k,!0),O==null||O.addEventListener("keyup",E,!0),r.current=()=>{try{w==null||w.removeEventListener("keydown",k,!0),w==null||w.removeEventListener("keyup",E,!0)}catch{}O==null||O.removeEventListener("keydown",k,!0),O==null||O.removeEventListener("keyup",E,!0)}},[t,r]);return{playbackKeyDownRef:u,playbackKeyUpRef:f,attachIframeShortcutListeners:b,togglePlay:y}}function Q_(t){return Number.isFinite(t)&&t>0&&t<7200?t:0}function uVe(t){const e=t.getAttribute(Go);if(!e)return{};const n=SE(t.ownerDocument,e);return{audioGroup:e,audioGroupLabel:n.label,audioGroupVolume:n.volume,audioGroupHidden:n.hidden,...n.fxChain?{audioGroupFxChain:n.fxChain}:{},...n.automation?{audioGroupAutomation:n.automation}:{}}}function fVe(t){const e=new Map,n=t==null?void 0:t.__clipTree;if(!n)return e;const r=i=>{for(const s of i)s.id&&s.parentId&&e.set(s.id,s.parentId),s.children.length>0&&r(s.children)};return r(n.roots),e}function z_(t,e,n,r,i){for(const s of Array.from(e.children)){if(!s.id){z_(t,s,n,r,i);continue}const a=s.hasAttribute("data-hf-group");i.push({id:s.id,parentId:n,hostId:t,label:a&&s.getAttribute("data-hf-group")||s.id,stackingContextId:_j(s),...uVe(s)}),r.set(s.id,n),a&&z_(t,s,s.id,r,i)}}function hVe(t,e,n){const r=[];if(!t)return r;for(const i of e){if(i.kind!=="composition"||!i.id)continue;const s=t.getElementById(i.id);if(!s)continue;const a=s.querySelector("[data-hf-inner-root]")??s;z_(i.id,a,i.id,n,r)}return r}function dVe(t){const e={};t.hasAttribute("data-hidden")&&(e.hidden=!0),t.hasAttribute("data-timeline-locked")&&(e.timelineLocked=!0);const n=t.getAttribute("data-timeline-role");n&&(e.timelineRole=n);const r=t.getAttribute("data-fx-chain");r&&(e.fxChain=r);const i=t.getAttribute("data-automation");return i&&(e.automation=i),Object.keys(e).length>0?e:null}function pVe(t,e){const n=new Map;if(!t)return n;for(const r of e){if(r.kind!=="composition"||!r.id)continue;const i=t.getElementById(r.id);if(i)for(const s of Array.from(i.querySelectorAll("[id]"))){const a=dVe(s);a&&n.set(s.id,a)}}return n}function xde(t){try{return(t==null?void 0:t.contentDocument)??null}catch{return null}}function mVe(t,e){const n=new Set;return t.map((r,i)=>{const s=e?NCe(e,r,i,n):null;return s&&n.add(s),Cae({clip:r,fallbackIndex:i,doc:e,hostEl:s})})}function gVe(t,e,n){const r=yVe(t,n);return!e||n<=0?r:[...r,...kae(e,n,r)]}function yVe(t,e){return e<=0?[...t]:t.filter(n=>n.start({...n,duration:Math.min(n.duration,e-n.start)})).filter(n=>n.duration>0)}function xVe(t){const e=t.pendingSeek??t.requestedSeek??t.storeCurrentTime;return!Number.isFinite(e)||e<=0?0:!Number.isFinite(t.duration)||t.duration<=0?e:Math.min(e,t.duration)}function bVe(t,e){const n=ue.getState().requestedSeekTime,r=xVe({pendingSeek:e.current,requestedSeek:n,storeCurrentTime:ue.getState().currentTime,duration:t.getDuration()});return e.current=null,n!=null&&ue.getState().clearSeekRequest(),t.seek(r>.001?Math.max(0,r-.001):.001),t.seek(r),r}function vVe(t,e){const n=Q_(t.getDuration());n>0&&n!==ue.getState().duration&&e(n)}function AVe(t,e,n,r){const i=Eae(t,n);if(i.length>0){r(i);return}const s=t.querySelector("[data-composition-id]");if(!s||n<=0)return;const a=UEe({compositionId:s.getAttribute("data-composition-id")||"composition",tagName:s.tagName||"div",rootDuration:n,iframeSrc:(e==null?void 0:e.src)||"",selector:m0(s)});a&&r([a])}function SVe(t,e){return!t.source||!e?!0:t.source===e.contentWindow}function wVe(t,e){if(!SVe(t,e))return!1;const n=t.data;return(n==null?void 0:n.source)!=="hf-preview"||(n==null?void 0:n.type)!=="state"&&(n==null?void 0:n.type)!=="timeline"?!1:Rj(n).status!=="unsupported"}function OVe(t,e,n){!t||!e||(TEe(t,e),PEe(t),n())}function CVe(t,e){const n=t==null?void 0:t.__clipManifest;n&&n.clips.length>0&&e(n)}function kVe(t){const{iframe:e,adapter:n,syncTimelineElements:r}=t;try{const i=xde(e),s=(e==null?void 0:e.contentWindow)??null;OVe(i,s,t.attachIframeShortcutListeners),CVe(s,t.processTimelineMessage),t.enrichMissingCompositions(),t.applyPreviewAudioState(),i&&ue.getState().elements.length===0&&AVe(i,e,n.getDuration(),r)}catch{}}function MW(t){t&&t.style.visibility==="hidden"&&(t.style.visibility="")}function EVe(t){return Math.max(Q_(t.manifestDurationSeconds),Q_(t.authoredRootDurationSeconds))}function TVe({iframeRef:t,probeIntervalRef:e,pendingSeekRef:n,isRefreshingRef:r,getAdapter:i,syncTimelineElements:s,setDuration:a,setCurrentTime:o,setTimelineReady:l,setIsPlaying:c,attachIframeShortcutListeners:u,applyPreviewAudioState:f}){const h=x.useCallback(w=>{var I;if(!w.clips||w.clips.length===0)return;ue.getState().setClipManifest(w.clips);const O=new Set(w.clips.map(j=>j.compositionId).filter(Boolean)),k=w.clips.filter(j=>!j.parentCompositionId||!O.has(j.parentCompositionId)),E=xde(t.current);try{const j=fVe(((I=t.current)==null?void 0:I.contentWindow)??null),L=hVe(E,w.clips,j);ue.getState().setClipParentMap(j),ue.getState().setDomClipChildren(L),ue.getState().setSubCompositionHostState(pVe(E,w.clips))}catch{}const T=mVe(k,E),N=EVe({manifestDurationSeconds:w.durationInFrames/EEe(w),authoredRootDurationSeconds:Use(E)}),_=gVe(T,E,N>0?N:ue.getState().duration);_.length>0&&s(_,N>0?N:void 0)},[t,s]),p=x.useCallback(()=>{try{const w=t.current,O=w==null?void 0:w.contentDocument,k=w==null?void 0:w.contentWindow;if(!O||!k)return;const E=ue.getState().elements,T=ue.getState().duration,{missing:N,updatedEls:_,patched:I}=zEe(O,k,E,T);if(N.length>0||I){const j=new Set(_.map(B=>B.id)),L=N.filter(B=>!j.has(B.id));s([..._,...L])}}catch{}},[t,s]),y=x.useCallback(()=>{const w=i();if(!w||w.getDuration()<=0)return!1;w.pause();const O=bVe(w,n);return MW(t.current),xa.notify(O),vVe(w,a),o(O),r.current||l(!0),r.current=!1,c(!1),kVe({iframe:t.current,adapter:w,processTimelineMessage:h,enrichMissingCompositions:p,applyPreviewAudioState:f,attachIframeShortcutListeners:u,syncTimelineElements:s}),!0},[i,a,o,l,c,h,p,s,u,f,t,r,n]),m=x.useCallback(()=>{if(f(),e.current&&clearInterval(e.current),y())return;const w=t.current;let O=!1;const k=()=>{O||y()&&(O=!0,window.removeEventListener("message",E),e.current&&clearInterval(e.current))},E=T=>{wVe(T,w)&&k()};window.addEventListener("message",E),e.current=setTimeout(()=>{O||k(),window.removeEventListener("message",E),MW(t.current)},5e3)},[y,t,e,f]);return{processTimelineMessage:h,processTimelineMessageRef:{current:h},enrichMissingCompositions:p,enrichMissingCompositionsRef:{current:p},initializeAdapter:y,onIframeLoad:m}}function PVe({rafRef:t,reverseRafRef:e,getAdapter:n,setCurrentTime:r,setIsPlaying:i}){const s=x.useCallback(()=>{cancelAnimationFrame(e.current)},[e]),a=x.useCallback(()=>{const l=()=>{const c=n();if(c){const u=c.getTime(),f=c.getDuration(),h=f>0?Math.min(u,f):u;xa.notify(h);const{inPoint:p,outPoint:y}=ue.getState(),m=y!==null?Math.min(y,f):f,v=p!==null?p:0,b=v=b){if(ue.getState().loopEnabled&&f>0){c.seek(w,{keepPlaying:!0}),xa.notify(w),c.play(),i(!0),t.current=requestAnimationFrame(l);return}c.isPlaying()&&c.pause(),r(h),i(!1),cancelAnimationFrame(t.current);return}}t.current=requestAnimationFrame(l)};t.current=requestAnimationFrame(l)},[t,n,r,i]),o=x.useCallback(()=>{cancelAnimationFrame(t.current)},[t]);return{startRAFLoop:a,stopRAFLoop:o,stopReverseLoop:s}}function W0(t){let e=null;return(n,r={})=>{if(e===null)try{e=localStorage.getItem(`hf-${t}-debug`)==="1"}catch{e=!1}if(!e)return;const i=typeof r=="function"?r():r;i&&console.log(`[hf-${t}] ${JSON.stringify({stage:n,t:Math.round(performance.now()),...i})}`)}}const f1=W0("reload");function MVe(t,e){const n=ue.getState(),r=y0(n.elements).musicElement;if(!r||n.audioMuted)return;const i=e-r.start,s=i>=0&&i<=r.duration?(r.playbackStart??0)+i:null;LEe(t,s,r.domId??r.id,n.audioVolume)}const v2=1e3;let bde=!1;const NW=Object.freeze({"dense-short":{duration:120,clipDuration:1.5},"long-overlap":{duration:7200,clipDuration:120},"keyframe-heavy-expanded":{duration:600,clipDuration:8},"composition-heavy":{duration:900,clipDuration:12},"remote-unsupported":{duration:900,clipDuration:12}});function NVe(t){bde=t}function vde(){return bde}function DVe(t){if(t.elementCount!==1e3&&t.elementCount!==5e4)throw new RangeError("Timeline performance fixture elementCount must be 1000 or 50000");if(!Object.hasOwn(NW,t.profile))throw new RangeError(`Unknown timeline performance fixture profile: ${t.profile}`);return NW[t.profile]}function IVe(t,e){if(t({percentage:t,propertyGroup:"position",properties:{x:t},ease:"power2.inOut"}))}}function jVe(t,e,n){return{id:`animation-${t}`,targetSelector:`#${t}`,method:"to",position:e,resolvedStart:e,duration:n,propertyGroup:"position",fromProperties:{x:0},properties:{x:100},ease:"power2.inOut"}}function LVe(t){const e=DVe(t),n=[],r=new Map,i=new Map,s=new Set;for(let a=0;aimport("./index-DivnGS5G.js"),[]),qm}catch{return qm=!1,null}}function IF(t){try{return new URL(t,window.location.href).href}catch{return t}}async function $Ve(t){const e=await FVe();if(!e)return null;const n=new e.Input({source:new e.UrlSource(t),formats:e.ALL_FORMATS});try{const r=await n.getDurationFromMetadata();if(r==null||!Number.isFinite(r)||r<=0)return null;const i=await n.getPrimaryVideoTrack(),s=await n.getAudioTracks();return{duration:r,width:i==null?void 0:i.displayWidth,height:i==null?void 0:i.displayHeight,hasVideo:i!=null,hasAudio:s.length>0}}catch{return null}finally{n.dispose()}}function _F(t){const e=sv.get(IF(t));return e&&(e.lastAccess=++pC),e==null?void 0:e.result}function Sde(t,e){return e?Oy(t,e,window.location.origin):t}function BVe(){const t=sv.size+ng.size-tl.metadataRegistryEntries;if(t<=0)return;const e=[...Array.from(sv,([n,r])=>({key:n,at:r.lastAccess,failed:!1})),...Array.from(ng,([n,r])=>({key:n,at:r.lastAccess,failed:!0}))].sort((n,r)=>n.at-r.at);for(const n of e.slice(0,t))n.failed?ng.delete(n.key):sv.delete(n.key)}function VVe(t,e){return t.map(n=>{const r=n.tag.toLowerCase();if(!n.src||n.sourceDuration!=null||r!=="audio"&&r!=="video")return n;const i=_F(Sde(n.src,e));return i!=null&&i.duration&&i.duration>0?{...n,sourceDuration:i.duration}:n})}async function HVe(t,e,n){const r=t.flatMap(i=>{if(!i.src||i.sourceDuration!=null||!["video","audio"].includes(i.tag.toLowerCase()))return[];const s=Sde(i.src,e);return!_F(s)&&!wde(IF(s))?[{el:i,source:s}]:[]});r.length!==0&&await Promise.allSettled(r.map(async({el:i,source:s})=>{const a=await QVe(s);a&&n(i.key??i.id,a.duration)}))}function wde(t){const e=ng.get(t);return e===void 0?!1:Date.now()-e.failedAt{Ade.push({key:e,epoch:G_,resolve:i}),Ode()}),Z_.set(e,r),r)}function Ode(){for(;PMt.epoch!==G_?null:(Z_.delete(t.key),e?sv.set(t.key,{result:e,lastAccess:++pC}):ng.set(t.key,{failedAt:Date.now(),lastAccess:++pC}),BVe(),e)).then(t.resolve).finally(()=>{PM--,Ode()})}}function zVe(t){return t.keepPlaying&&!t.wasReverseShuttle&&t.storeWasPlaying&&(t.duration<=0||t.nextTime0&&t.processTimelineMessageRef.current(r)}Date.now()-t.lastTimelineMessageRef.current>500&&t.enrichMissingCompositionsRef.current()}catch{}}function WVe(t,e,n){if(t.lastTimelineMessageRef.current=Date.now(),t.processTimelineMessageRef.current(n),t.enrichMissingCompositionsRef.current(),!(ue.getState().elements.length>0))try{const r=e==null?void 0:e.contentDocument,i=t.getAdapter();if(!r||!i)return;const s=Eae(r,i.getDuration());s.length>0&&t.syncTimelineElements(s)}catch{}}function qVe(t){return e=>{const n=t.iframeRef.current,r=UVe(e,n);if(r){if(r.type==="state")return XVe(t,n);r.type==="timeline"&&Array.isArray(r.clips)&&WVe(t,n,r)}}}function YVe(t,e){return e.length!==t.length?!0:e.some((n,r)=>{const i=t[r];return!i||n.id!==i.id||n.start!==i.start||n.duration!==i.duration||n.track!==i.track||n.sourceDuration!==i.sourceDuration})}function KVe(){const t=x.useRef(null),e=x.useRef(0),n=x.useRef(void 0),r=x.useRef(null),i=x.useRef(!1),s=x.useRef(0),a=x.useRef(null),o=x.useRef(0),l=x.useRef(null),c=x.useRef(0),u=x.useRef(null),f=x.useRef(!1),{setIsPlaying:h,setCurrentTime:p,setDuration:y,setTimelineReady:m,setElements:v}=ue.getState(),b=x.useCallback((U,Z)=>{if(vde())return;const K=ue.getState(),ee=Z??K.duration,re=Ghe(VVe(ZEe(K.elements,U,K.duration,ee),K.timelineProjectId));YVe(K.elements,re)&&v(re),Number.isFinite(Z)&&(Z??0)>0&&Z!==K.duration&&y(Z??0),K.timelineReady||m(!0),HVe(re,K.timelineProjectId,(Q,H)=>{ue.setState(se=>{const fe=se.elements.findIndex(me=>(me.key??me.id)===Q);if(fe===-1||se.elements[fe].sourceDuration!=null)return{};const be=se.elements.slice();return be[fe]={...se.elements[fe],sourceDuration:H},{elements:be}})})},[v,m,y]),w=x.useCallback(()=>{var U,Z;try{const K=t.current,ee=K==null?void 0:K.contentWindow;if(!K||!ee)return null;const re=ee.__player&&typeof ee.__player.play=="function"?ee.__player:null,Q=Use(K.contentDocument),H=O4(re);if(H>0&&Q<=H)return jO(u,f),re;let se=null;if(ee.__timeline){const me=OG(ee.__timeline),pe=O4(me);if(pe>0&&Q<=pe)return jO(u,f),me;pe>0&&(se??(se=me))}if(ee.__timelines){const me=Object.keys(ee.__timelines);if(me.length>0){const pe=(Z=(U=K==null?void 0:K.contentDocument)==null?void 0:U.querySelector("[data-composition-id]"))==null?void 0:Z.getAttribute("data-composition-id"),ge=pe&&pe in ee.__timelines?pe:me[me.length-1],Pe=OG(ee.__timelines[ge]),ve=O4(Pe);if(ve>0&&Q<=ve)return jO(u,f),Pe;ve>0&&(se??(se=Pe))}}const fe=re??se,be=Math.max(ue.getState().duration,Q,H);return fe&&be>0&&("renderSeek"in fe||typeof fe.seek=="function")?rCe({cache:u,warned:f,bestAdapter:fe,effectiveDuration:be,docDuration:Q,clock:tCe(ee),getPlaybackRate:()=>ue.getState().playbackRate}):fe}catch{return null}},[]),{startRAFLoop:O,stopRAFLoop:k,stopReverseLoop:E}=PVe({rafRef:e,reverseRafRef:s,getAdapter:w,setCurrentTime:p,setIsPlaying:h}),T=x.useCallback(U=>{const Z=t.current;if(Z){IEe(Z,U);try{const K=Z.contentWindow;if(K!=null&&K.__timelines)for(const ee of Object.values(K.__timelines))ee&&typeof ee.timeScale=="function"&&ee.timeScale(U)}catch{}}},[]),N=x.useCallback(()=>{const{audioMuted:U,audioVolume:Z}=ue.getState();DEe(t.current,U,Z)},[]),_=x.useCallback(()=>{k(),E(),Kv();const U=w();U&&(U.getTime()>=U.getDuration()&&U.seek(ue.getState().inPoint??0),T(ue.getState().playbackRate),N(),U.play(),a.current="forward",h(!0),O())},[w,h,O,T,N,k,E]),I=x.useCallback(U=>{k(),E();const Z=w();if(!Z)return;const K=Math.max(0,Z.getDuration()),ee=Z.getTime()<=0&&K>0?K:Z.getTime();Z.pause(),ee!==Z.getTime()&&Z.seek(ee);const re=Math.max(.1,Math.min(4,U));T(re),N();let Q=ee,H=performance.now();const se=fe=>{const be=(fe-H)/1e3*re;let me=Q-be;const{inPoint:pe,outPoint:ge}=ue.getState(),Pe=ge!==null?Math.min(ge,K):K,ve=pe!==null?pe:0,xe=ve0)Q=xe,H=fe,me=xe;else{Z.seek(we),xa.notify(we),p(we),h(!1),a.current=null,s.current=0;return}Z.seek(Math.max(0,me)),xa.notify(Math.max(0,me)),h(!0),s.current=requestAnimationFrame(se)};h(!0),a.current="backward",s.current=requestAnimationFrame(se)},[w,p,h,T,N,k,E]),j=x.useCallback(()=>{E();const U=w();U&&(U.pause(),p(U.getTime()),h(!1),a.current=null,o.current=0,k())},[w,p,h,k,E]),L=x.useCallback((U,Z)=>{const K=a.current==="backward";E();const ee=w();if(!ee)return r.current=Math.max(0,U),!1;const re=Math.max(0,ee.getDuration()),Q=Math.max(0,re>0?Math.min(re,U):U),H=(Z==null?void 0:Z.keepPlaying)===!0,se=zVe({keepPlaying:H,wasReverseShuttle:K,storeWasPlaying:ue.getState().isPlaying,duration:re,nextTime:Q});return ee.seek(Q,Z),xa.notify(Q),p(Q),!se&&!H&&MVe(t.current,Q),se?(k(),T(ue.getState().playbackRate),N(),ee.play(),h(!0),a.current="forward",o.current=0,O()):ZVe({keepPlaying:H,wasReverseShuttle:K})&&(k(),ue.getState().isPlaying&&h(!1),a.current=null,o.current=0),!0},[w,r,p,h,O,k,E,T,N,a,o]);x.useEffect(()=>ue.subscribe((U,Z)=>{var ee;U.requestedSeekTime!==null&&U.requestedSeekTime!==Z.requestedSeekTime&&(L(U.requestedSeekTime),ue.getState().clearSeekRequest());const K=U.playbackRequest;K&&K.nonce!==((ee=Z.playbackRequest)==null?void 0:ee.nonce)&&(K.playing?_():(j(),K.returnTo!==null&&L(K.returnTo)),ue.getState().clearPlaybackRequest())}),[L,_,j]);const{playbackKeyDownRef:B,playbackKeyUpRef:$,attachIframeShortcutListeners:z,togglePlay:Y}=cVe({iframeRef:t,shuttleDirectionRef:a,shuttleSpeedIndexRef:o,iframeShortcutCleanupRef:l,getAdapter:w,play:_,playBackward:I,pause:j,seek:L}),{processTimelineMessageRef:W,enrichMissingCompositionsRef:J,onIframeLoad:ne}=TVe({iframeRef:t,probeIntervalRef:n,pendingSeekRef:r,isRefreshingRef:i,getAdapter:w,syncTimelineElements:b,setDuration:y,setCurrentTime:p,setTimelineReady:m,setIsPlaying:h,attachIframeShortcutListeners:z,applyPreviewAudioState:N}),le=x.useCallback(()=>{if(!(i.current&&r.current!=null)){const Z=w();Z?r.current=Z.getTime():r.current==null&&(r.current=ue.getState().currentTime??0)}i.current=!0,k(),E(),h(!1)},[w,k,h,E]),ie=x.useCallback(()=>{const U=t.current;if(!U)return;f1("refreshPlayer",()=>({stack:new Error("refreshPlayer").stack})),le(),U.style.visibility="hidden";const Z=U.src,K=new URL(Z,window.location.origin);K.searchParams.set("_t",String(Date.now())),bie(K),U.src=K.toString()},[le]),q=x.useRef(w);q.current=w,Or(()=>{const U=re=>B.current(re),Z=re=>$.current(re),K=qVe({iframeRef:t,processTimelineMessageRef:W,enrichMissingCompositionsRef:J,lastTimelineMessageRef:c,getAdapter:w,syncTimelineElements:b}),ee=()=>{var re;if(document.hidden&&ue.getState().isPlaying){const Q=(re=q.current)==null?void 0:re.call(q);Q&&(Q.pause(),h(!1),k())}};return window.addEventListener("keydown",U,!0),window.addEventListener("keyup",Z,!0),window.addEventListener("message",K),document.addEventListener("visibilitychange",ee),()=>{var re;window.removeEventListener("keydown",U,!0),window.removeEventListener("keyup",Z,!0),(re=l.current)==null||re.call(l),l.current=null,window.removeEventListener("message",K),document.removeEventListener("visibilitychange",ee),k(),E(),Kv(),jO(u,f),n.current&&clearInterval(n.current)}});const F=x.useCallback(()=>{k(),E(),n.current&&clearInterval(n.current),ue.getState().reset()},[k,E]);return x.useEffect(()=>ue.subscribe((U,Z)=>{const K=U.playbackRate!==Z.playbackRate,ee=U.audioMuted!==Z.audioMuted,re=U.audioVolume!==Z.audioVolume;!K&&!ee&&!re||(K&&T(U.playbackRate),N())}),[T,N]),{iframeRef:t,play:_,pause:j,togglePlay:Y,seek:L,onIframeLoad:ne,refreshPlayer:ie,saveSeekPosition:le,resetPlayer:F}}const DW='button:not([disabled]), [href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), summary, [contenteditable="true"], [tabindex]:not([tabindex="-1"])';function PS({open:t,onClose:e,containerRef:n,canClose:r}){const i=x.useRef(null),s=x.useRef(r);s.current=r;const a=x.useRef(e);a.current=e;const o=x.useCallback(()=>{const l=s.current;l&&!l()||a.current()},[]);return x.useEffect(()=>{var h;const l=document.activeElement;i.current=l instanceof HTMLElement?l:null;const c=n.current;(h=(c==null?void 0:c.querySelector(DW))??c)==null||h.focus();const f=p=>{if(p.key==="Escape"){p.stopPropagation(),o();return}if(p.key!=="Tab")return;const y=n.current;if(!y)return;const m=Array.from(y.querySelectorAll(DW));if(m.length===0)return;const v=m[0],b=m[m.length-1],w=document.activeElement;p.shiftKey&&(w===v||!y.contains(w))?(p.preventDefault(),b.focus()):!p.shiftKey&&(w===b||!y.contains(w))&&(p.preventDefault(),v.focus())};return document.addEventListener("keydown",f,!0),()=>{var p;document.removeEventListener("keydown",f,!0),(p=i.current)==null||p.focus(),i.current=null}},[t,n,o]),{requestClose:o}}function IW({findings:t,projectId:e,projectDir:n,title:r="HyperFrame Lint Results",promptIntro:i="Fix these HyperFrames lint issues",onClose:s}){const a=t.filter(v=>v.severity==="error"),o=t.filter(v=>v.severity==="warning"),l=t.length>0,[c,u]=x.useState(!1),[f,h]=x.useState(!1),p=x.useRef(null),{requestClose:y}=PS({open:!0,onClose:s,containerRef:p}),m=async()=>{const v=t.map(k=>{let E=`[${k.severity}] ${k.message}`;return k.file&&(E+=` +})();`,o.body.appendChild(L),D_(a,f)};if(/motionPath\s*[:{]/.test(e)&&!a.MotionPathPlugin&&a.gsap){if(h=!0,a.__hfMotionPathPluginLoading){const B=Date.now(),$=a.setInterval(()=>{a.MotionPathPlugin?(a.clearInterval($),T()):(!a.__hfMotionPathPluginLoading||Date.now()-B>1e4)&&(a.clearInterval($),r==null||r())},50);return}a.__hfMotionPathPluginLoading=!0;const L=o.createElement("script");L.src=bhe,L.onload=()=>{a.__hfMotionPathPluginLoading=!1,T()},L.onerror=()=>{a.__hfMotionPathPluginLoading=!1,r==null||r()},o.head.appendChild(L);return}T()};try{return a.__hfSuppressSceneMutations?a.__hfSuppressSceneMutations(v):v(),h||dLe(a,l)?"applied":"verify-failed"}catch{return"cannot-soft-reload"}}function pLe(t,e){if(!t||!Number.isFinite(e)||e<=0)return!1;const n=Array.from(t.querySelectorAll("[data-composition-id]")),r=n.find(i=>{var s;return!((s=i.parentElement)!=null&&s.closest("[data-composition-id]"))})??n[0]??null;return r?(r.setAttribute("data-duration",mi(e)),!0):!1}const mLe=5*6e4,dA=new Map;function Ahe(t){for(const[e,n]of dA)t-n>=mLe&&dA.delete(e)}function She(t,e=Date.now()){Ahe(e),dA.set(t,e)}function gLe(t,e=Date.now()){return Ahe(e),!t||!dA.has(t)?!1:(dA.delete(t),!0)}async function yLe(t){const e=new TextEncoder().encode(t),n=await globalThis.crypto.subtle.digest("SHA-256",e);return`"sha256:${Array.from(new Uint8Array(n),i=>i.toString(16).padStart(2,"0")).join("")}"`}async function xLe(t,e,n){return n!==void 0?yLe(n):t.get(e)}function bLe(){const t=globalThis.crypto;if(typeof(t==null?void 0:t.randomUUID)=="function")return t.randomUUID();if(typeof(t==null?void 0:t.getRandomValues)!="function")throw new Error("Web Crypto getRandomValues is required for Studio write identity");const e=t.getRandomValues(new Uint8Array(16));e[6]=e[6]&15|64,e[8]=e[8]&63|128;const n=Array.from(e,r=>r.toString(16).padStart(2,"0")).join("");return`${n.slice(0,8)}-${n.slice(8,12)}-${n.slice(12,16)}-${n.slice(16,20)}-${n.slice(20)}`}function Zl(){const t=bLe();return She(t),{"X-Hyperframes-Write-Token":t}}class pA extends Error{}class tC extends pA{}async function ea(t,e){if(e.includes("\0")||e.includes(".."))throw new Error(`Unsafe path: ${e}`);const n=await fetch(`/api/projects/${encodeURIComponent(t)}/files/${encodeURIComponent(e)}`);if(!n.ok)throw new Error(`Failed to read ${e}`);const r=await n.json();if(typeof r.content!="string")throw new Error(`Missing file contents for ${e}`);return r.content}async function vLe(t){const e=await fetch(`/api/projects/${encodeURIComponent(t)}/gsap-mutation-capabilities`);if(!e.ok)throw new tC("Server does not support owned GSAP mutations");const n=await e.json().catch(()=>null);if(!vF(n)||n.atomicOwnershipPairs!==!0)throw new tC("Invalid GSAP mutation capability response")}async function ALe(t,e,n,r){if(e.includes("\0")||e.includes(".."))throw new Error(`Unsafe path: ${e}`);const i=await fetch(`/api/projects/${encodeURIComponent(t)}/gsap-mutation-rollback/${encodeURIComponent(e)}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({expected:n,restore:r})});if(!i.ok)throw new Error(`Failed to restore ${e}`);const s=await i.json();if(s.restored===!0&&s.conflict===!1)return"restored";if(s.restored===!1&&s.conflict===!0)return"conflict";throw new Error(`Invalid restore response for ${e}`)}function whe(t,e){try{pLe((t==null?void 0:t.contentDocument)??null,e)}catch{}}function nC(t){const e=Tj((t==null?void 0:t.contentDocument)??null);e>0&&(ue.getState().setDuration(Math.max(e,window.__crocoPlannedPreviewDuration?.()||0)),whe(t,e))}function mA(t){const e=ue.getState().duration;return()=>{ue.getState().duration!==e&&(ue.getState().setDuration(e),whe(t,e))}}function vF(t){return typeof t=="object"&&t!==null}function SLe(t){if(!vF(t)||typeof t.mutated!="boolean"||typeof t.before!="string"||typeof t.after!="string"||t.mutated!==(t.before!==t.after)||"changed"in t&&t.changed!==t.mutated)throw new tC("Invalid owned GSAP mutation response");return{mutated:t.mutated,scriptText:typeof t.scriptText=="string"?t.scriptText:null,before:t.before,after:t.after}}function wLe(t,e){return vF(t)&&typeof t.error=="string"?t.error:e}async function Ohe(t,e,n,r){let i;try{i=await fetch(`/api/projects/${encodeURIComponent(t)}/gsap-mutations/${encodeURIComponent(e)}`,{method:"POST",headers:{"Content-Type":"application/json",...Zl()},body:JSON.stringify(n)})}catch(a){throw new pA(`${r}: mutation outcome unknown`,{cause:a})}const s=await i.json().catch(()=>null);if(!i.ok)throw new pA(wLe(s,r));return SLe(s)}function OLe(t,e){return vhe(t,e)}function CLe(t,e,n,r,i){if(!e.mutated&&i){OLe(t,n)||r();return}if(!t||!e.scriptText){r();return}bF(t,e.scriptText,{onAsyncFailure:r,currentTimeOverride:n})==="cannot-soft-reload"&&r()}async function Che(t){let e={mutated:!1,scriptText:null};if(t.gsapMutation)try{e=await t.gsapMutation()}catch(n){t.onGsapError(n),n instanceof pA&&t.reloadPreview();return}CLe(t.iframe,e,ue.getState().currentTime,t.reloadPreview,t.rebindWhenUnmutated)}const kLe=1e4;async function ELe(t,e,n){let r=!1;for(let i=e.length-1;i>=0;i-=1){const s=e[i];if(!(!s||s.before===s.after))try{await ALe(t,s.path,s.after,s.before)==="conflict"&&(r=!0)}catch(a){r=!0,n(a)}}return r?"convergence-required":"restored"}async function JX(t,e,n,r){throw await ELe(t,e,n)==="convergence-required"?new pA("GSAP rollback could not safely restore every owned write; preview reload required",{cause:r}):r}async function khe(t){const e=[],n=async(i,s)=>{const a=s();if(!a)return{mutated:!1,scriptText:null};const o=await a;if(!o.mutated)return o;if(o.before===void 0||o.after===void 0)throw new tC(`GSAP mutation returned no owned before/after pair for ${i}`);const l=[...e].reverse().find(u=>u.path===i),c={path:i,before:o.before,after:o.after};if(e.push(c),l&&l.after!==c.before)throw new Error(`GSAP mutation ownership chain broke for ${i}`);return o};let r;try{await vLe(t.projectId),r=await t.gsapMutation(n)}catch(i){return JX(t.projectId,e,t.onRollbackError,i)}if(r.mutated)try{const i=new Map;for(const a of e){const o=i.get(a.path);o?o.after=a.after:i.set(a.path,{before:a.before,after:a.after})}const s={};for(const[a,o]of i){if(await ea(t.projectId,a)!==o.after)throw new Error(`GSAP mutation ownership lost for ${a}`);o.before!==o.after&&(s[a]=o)}Object.keys(s).length>0&&await t.recordEdit({label:t.label,kind:"timeline",coalesceKey:t.coalesceKey,coalesceMs:kLe,files:s})}catch(i){return JX(t.projectId,e,t.onRollbackError,i)}return r}async function Ehe(t,e,n,r){return r===0||!n?{mutated:!1,scriptText:null}:Ohe(t,e,{type:"shift-positions",targetSelector:`#${n}`,delta:r},"shift-positions failed")}async function The(t,e,n,r,i,s,a){return!n||i<=0||a<=0?{mutated:!1,scriptText:null}:r===s&&i===a?{mutated:!1,scriptText:null}:Ohe(t,e,{type:"scale-positions",targetSelector:`#${n}`,oldStart:r,oldDuration:i,newStart:s,newDuration:a},"scale-positions failed")}function eW(t){const{projectId:e,targetPath:n,domId:r,edit:i}=t,s=i.kind==="shift"?i.delta!==0:i.from.start!==i.to.start||i.from.duration!==i.to.duration,a=(l,c)=>i.kind==="shift"?Ehe(l,n,c,i.delta):The(l,n,c,i.from.start,i.from.duration,i.to.start,i.to.duration),o=l=>console.error(`[Timeline] Failed to ${i.kind} GSAP positions`,l);return Che({iframe:t.iframe,reloadPreview:t.reloadPreview,gsapMutation:s&&r&&e?()=>khe({projectId:e,label:t.label,coalesceKey:t.coalesceKey,recordEdit:t.recordEdit,gsapMutation:l=>l(n,()=>a(e,r)),onRollbackError:o}):void 0,onGsapError:o,rebindWhenUnmutated:!0})}async function tW(t){const e=t.activeCompPath||"index.html",n=t.changes.some(i=>t.resolveChangePath(i.element)!==e),r=i=>console.error(`[Timeline] ${t.errorLabel}`,i);await Che({iframe:t.iframe,reloadPreview:t.reloadPreview,gsapMutation:()=>khe({projectId:t.projectId,label:t.label,coalesceKey:t.coalesceKey,recordEdit:t.recordEdit,gsapMutation:async i=>{let s=!1,a=null;for(const o of t.changes){const l=t.resolveChangePath(o.element),c=await i(l,()=>t.mutateChange(o,l));s=s||c.mutated,l===e&&(a=c.scriptText)}return{mutated:s,scriptText:n?null:a}},onRollbackError:r}),onGsapError:r,rebindWhenUnmutated:!n})}const Phe=["position","display","top","left","right","bottom","inset","width","height","gap","justify-content","align-items","flex-direction","font-size","font-style","font-weight","font-family","line-height","letter-spacing","text-align","text-transform","color","background-color","background-image","opacity","mix-blend-mode","border-radius","border-width","border-style","border-color","border-top-width","border-top-style","border-top-color","outline-color","overflow","clip-path","box-shadow","filter","backdrop-filter","z-index","transform","object-fit","object-position"];function ru(t){if(!t)return null;const e=t.trim();if(!e.endsWith("px"))return null;const n=parseFloat(e);return Number.isFinite(n)?n:null}function TLe(t){const e=(t??"none").trim();if(!e||e==="none")return!0;const n=e.match(/^matrix\(([^)]+)\)$/i);if(n&&n[1]){const a=n[1].split(",");if(a.length!==6)return!1;const o=a.map(y=>Number.parseFloat(y.trim()));if(o.some(y=>!Number.isFinite(y)))return!1;const[l=0,c=0,u=0,f=0,h=0,p=0]=o;return Math.abs(l-1)<1e-4&&Math.abs(c)<1e-4&&Math.abs(u)<1e-4&&Math.abs(f-1)<1e-4&&Math.abs(h)<1e-4&&Math.abs(p)<1e-4}const r=e.match(/^matrix3d\(([^)]+)\)$/i);if(!r||!r[1])return!1;const i=r[1].split(",").map(a=>Number.parseFloat(a.trim()));if(i.length!==16||i.some(a=>!Number.isFinite(a)))return!1;const s=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1];return i.every((a,o)=>Math.abs(a-(s[o]??0))<1e-4)}function PLe(t){if(!t.hasStableTarget||t.isInsideLockedComposition)return{canSelect:!t.isInsideLockedComposition,canEditStyles:!1,canCrop:!1,canMove:!1,canResize:!1,canApplyManualOffset:!1,canApplyManualSize:!1,canApplyManualRotation:!1,reasonIfDisabled:t.isInsideLockedComposition?"This element belongs to a locked composition.":"Studio could not resolve a stable patch target for this element."};if(!t.existsInSource)return{canSelect:!0,canEditStyles:!1,canCrop:!1,canMove:!1,canResize:!1,canApplyManualOffset:!1,canApplyManualSize:!1,canApplyManualRotation:!1,reasonIfDisabled:"This element is generated by a script and cannot be edited visually."};if(t.isCompositionRoot)return{canSelect:!0,canEditStyles:!0,canCrop:!1,canMove:!1,canResize:!1,canApplyManualOffset:!1,canApplyManualSize:!1,canApplyManualRotation:!1,reasonIfDisabled:"The root composition defines the preview bounds."};const e=t.computedStyles??{},n=e.position,r=ru(t.inlineStyles.left)??ru(e.left),i=ru(t.inlineStyles.top)??ru(e.top),s=ru(t.inlineStyles.width)??ru(e.width),a=ru(t.inlineStyles.height)??ru(e.height),o=!TLe(e.transform),l=(n==="absolute"||n==="fixed")&&r!=null&&i!=null&&!o,c=l&&(s!=null||a!=null),u=!t.isCompositionHost,f=u?void 0:"Select an internal layer to transform it.";return{canSelect:!0,canEditStyles:!(t.isCompositionHost&&t.isMasterView),canCrop:!0,canMove:l,canResize:c,canApplyManualOffset:u,canApplyManualSize:u,canApplyManualRotation:u,reasonIfDisabled:f}}function AF(t){const e=t.tag===ya,n=t.tag!=="audio"&&!e;return{text:t.hasEditableText&&!t.isCompositionHost&&!t.isInsideLockedComposition,media:t.tag==="video"||t.tag==="audio"||t.tag==="img",audioFx:t.tag==="audio"||e,colorGrading:t.tag==="video"||t.tag==="img",timing:!e&&(t.hasTimingStart||t.animationCount>0),animation:t.animationCount>0&&t.tag!=="audio"&&!e,layout:n,style:n}}function MLe(t){return{capabilities:PLe(t),sections:AF(t)}}function Pc(t){return typeof t=="object"&&t!==null&&"nodeType"in t&&typeof t.nodeType=="number"&&t.nodeType===1}function NLe(t){return["div","span","p","strong","h1","h2","h3","h4","h5","h6"].includes(t)}function Mhe(t){const e=t.ownerDocument.defaultView;if(!e)return!0;let n=t;for(;n;){const r=e.getComputedStyle(n);if(r.display==="none"||r.visibility==="hidden")return!1;const i=Number.parseFloat(r.opacity);if(Number.isFinite(i)&&i<=.01&&!n.hasAttribute(JE))return!1;n=n.parentElement}return!0}function Nhe(t){var r;const e={},n=(r=t.ownerDocument.defaultView)==null?void 0:r.getComputedStyle(t);if(!n)return e;for(const i of Phe){const s=n.getPropertyValue(i);s&&(e[i]=s)}return e}function Dhe(t){const e={};for(const n of Phe){const r=t.style.getPropertyValue(n);r&&(e[n]=r)}return e}function DLe(t){const e={};for(const n of t.attributes)n.name.startsWith("data-")&&(e[n.name.slice(5)]=n.value);return e}function I_(t,e){let n=t;for(;n;){const r=n;if(e.some(i=>r.hasAttribute(i)))return r;n=n.parentElement}return null}let I4=new Map;function nW(t){I4=t}function ILe(t){if(!t||I4.size===0)return;const e=t.getAttribute("data-hf-original-composition-id"),n=t.getAttribute("data-composition-id");return(e?I4.get(e):void 0)??(n?I4.get(n):void 0)}function CS(t,e){const n=I_(t,["data-composition-file","data-composition-src"]),r=I_(t,["data-composition-id"]),i=(n==null?void 0:n.getAttribute("data-composition-file"))??(n==null?void 0:n.getAttribute("data-composition-src"))??(r==null?void 0:r.getAttribute("data-composition-file"))??(r==null?void 0:r.getAttribute("data-composition-src"))??ILe(r)??e??"index.html";return{sourceFile:i,compositionPath:i}}function rW(t){const e=t==null?void 0:t.trim();if(!e)return;let n=e;try{n=new URL(e,"http://studio.local").pathname}catch{n=e}for(const r of["/preview/comp/","/preview/"]){const i=n.indexOf(r);if(i<0)continue;return n.slice(i+r.length).replace(/^\/+/,"")||e}return e}function Ihe(t){const e=globalThis.CSS;if(typeof(e==null?void 0:e.escape)=="function")return e.escape(t);if(t==="-")return"\\-";let n="";for(let r=0;r=48&&s<=57,o=s>=65&&s<=90,l=s>=97&&s<=122,c=s>=1&&s<=31||s===127,u=r===0&&a,f=r===1&&t.startsWith("-")&&a;if(c||u||f){n+=`\\${s.toString(16)} `;continue}if(o||l||a||i==="-"||i==="_"||s>=128){n+=i;continue}n+=`\\${i}`}return n}function Tf(t){return t.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\n/g,"\\a ").replace(/\r/g,"\\d ").replace(/\f/g,"\\c ")}function _Le(t,e){try{return Array.from(t.querySelectorAll(e))}catch{return[]}}function e8(t){var e;return((e=t.replace(/\.html$/i,"").replace(/^compositions\//i,"").split("/").at(-1))==null?void 0:e.replace(/[-_]+/g," ").replace(/\b\w/g,n=>n.toUpperCase()))??t}function kS(t){if(t.id)return`#${Ihe(t.id)}`;const e=t.getAttribute("data-composition-id");if(e)return`[data-composition-id="${Tf(e)}"]`;const n=t.getAttribute("data-hf-group");return n?`[data-hf-group="${Tf(n)}"]`:_he(t)}function _he(t){const e=Array.from(t.classList).map(r=>r.trim()).filter(Boolean);if(e.length===0)return;const n=e.find(r=>r!=="clip"&&!r.startsWith("__hf-"))??e[0];return n?`.${Ihe(n)}`:void 0}function Rhe(t){const e=t.getAttribute("data-composition-id");if(e&&e!=="main")return e8(e);const n=t.getAttribute("data-composition-src")??t.getAttribute("data-composition-file");if(n)return e8(n);const r=t.getAttribute("data-hf-group");if(r)return r;if(t.id)return e8(t.id);const i=_he(t);if(i)return e8(i.replace(/^\./,""));const s=(t.textContent??"").trim().replace(/\s+/g," ");return s?s.length>40?`${s.slice(0,39)}…`:s:t.tagName.toLowerCase()}function SF(t,e,n,r,i){if(n!=null&&n.startsWith("."))return Tse(t,e,n,r,s=>Pc(s)?CS(s,i).sourceFile:void 0)}function Sy(t){return Mhe(t)}const iW=new Set(["img","video","canvas","svg","audio"]);function RLe(t){const e=t.ownerDocument.defaultView;if(!e)return!1;const n=e.getComputedStyle(t);return!!(n.backgroundImage!=="none"||n.backgroundColor&&n.backgroundColor!=="transparent"&&n.backgroundColor!=="rgba(0, 0, 0, 0)"||n.borderWidth&&parseFloat(n.borderWidth)>0&&n.borderStyle!=="none"||n.boxShadow&&n.boxShadow!=="none")}function jLe(t){const e=t.tagName.toLowerCase();if(iW.has(e)||RLe(t))return!1;const{children:n}=t;if(n.length===0)return(t.textContent??"").trim().length===0;for(let r=0;rPc(s)&&(!e.sourceFile||CS(s,n).sourceFile===e.sourceFile),i=s=>_Le(t,s).filter(r);if(e.hfId){const s=i(`[data-hf-id="${Tf(e.hfId)}"]`)[0];if(s)return s}if(e.id){const s=i(`[id="${Tf(e.id)}"]`)[0];if(s)return s}return e.selector?i(e.selector)[e.selectorIndex??0]??null:null}function jhe(t,e,n){var f;const r=typeof e.id=="string"?e.id:"",i=rW(e.compositionSrc)??((f=n.compIdToSrc)==null?void 0:f.get(r)),s=i??rW(e.sourceFile)??n.activeCompositionPath??"index.html",a=Tf(r),o=i?Tf(i):null,l=e.selector??(i?`[data-composition-src="${o}"],[data-composition-file="${o}"],[data-composition-id="${a}"]`:a?`[data-composition-id="${a}"]`:void 0);if(l||e.domId){const h=Is(t,{id:e.domId??void 0,selector:l,selectorIndex:e.selectorIndex,sourceFile:s},n.activeCompositionPath);if(h)return h}const c=!!(e.domId||e.selector||i);if(n.isMasterView||c||!n.activeCompositionPath)return null;const u=t.querySelector("[data-composition-id]");return Pc(u)&&CS(u,n.activeCompositionPath).sourceFile===s?u:null}function QLe(t,e){return Array.from(t.children).filter(n=>Pc(n)&&Rg(n,e.activeCompositionPath)!==null)}let zLe=0;function ZLe(t){const{selectedKeyframes:e,selectedElementId:n}=ue.getState();if(!n)return;const r=t.selectedGsapAnimations.filter(c=>c.keyframes),i=r.length===1?r[0]:void 0,s=new Map(r.map(c=>[c.id,c])),a=new Map;for(const c of e){const u=sTe(n,c);if(!u)continue;const f=u.animationId?s.get(u.animationId):i;if(!f)continue;const h=u.tweenPercentage??u.percentage;a.set(`${f.id}\0${h}`,{animationId:f.id,percentage:h})}const o=[...a.values()];if(o.length===0)return;const l={coalesceKey:`delete-keyframes:${++zLe}`,coalesceMs:Number.POSITIVE_INFINITY};for(const[c,u]of o.entries())t.handleGsapRemoveKeyframe(u.animationId,u.percentage,{...l,...c===o.length-1?{softReload:!0}:{skipReload:!0}})}function GLe(t){var n,r;if(!t)return!1;const e=((r=(n=t.ownerDocument)==null?void 0:n.defaultView)==null?void 0:r.HTMLElement)??globalThis.HTMLElement;return t instanceof e}function ULe(t){var s,a;if(t.element.tag==="audio")return Promise.resolve();const e=t.stackingReorder??null;if(e==null||e.zIndexChanges.length===0)return Promise.resolve();const n=new Map(t.timelineElements.map(o=>[Zn(o),o])),r=((s=t.iframe)==null?void 0:s.contentDocument)??null,i=[];for(const o of e.zIndexChanges){const l=n.get(o.key),c=o.domId??(l==null?void 0:l.domId),u=o.selector??(l==null?void 0:l.selector),f=o.selectorIndex??(l==null?void 0:l.selectorIndex),h=o.sourceFile??(l==null?void 0:l.sourceFile)??t.activeCompPath??"index.html",p=r?Is(r,{id:c,selector:u,selectorIndex:f,sourceFile:h},t.activeCompPath):null;if(!GLe(p))return Promise.resolve();r_(p)!==o.zIndex&&i.push({element:p,zIndex:o.zIndex,id:c??(l==null?void 0:l.id)??o.key,selector:u,selectorIndex:f,sourceFile:h,key:o.key})}return i.length===0?Promise.resolve():Promise.resolve((a=t.commit)==null?void 0:a.call(t,i,t.coalesceKey)).then(()=>{})}function rC(t){const e=ue.getState();return t<=e.duration?!1:(e.setDuration(t),!0)}function Xd(t){if(!t.domId&&/^#[A-Za-z_][\w-]*$/.test(t.selector||""))return{id:t.selector.slice(1),hfId:t.hfId};return t.domId?{id:t.domId,hfId:t.hfId,selector:t.selector,selectorIndex:t.selectorIndex}:t.hfId?{hfId:t.hfId,selector:t.selector,selectorIndex:t.selectorIndex}:t.selector?{selector:t.selector,selectorIndex:t.selectorIndex}:null}function ES(t,e,n=null){try{const r=t==null?void 0:t.contentDocument;return r?e.kind==="composition"&&e.compositionSrc?jhe(r,e,{activeCompositionPath:n,isMasterView:!0}):Is(r,{hfId:e.hfId,id:e.domId,selector:e.selector,selectorIndex:e.selectorIndex,sourceFile:e.sourceFile||n||"index.html"},n):null}catch{return null}}function iC(t,e,n,r=null){try{const i=ES(t,e,r);if(!i)return;for(const[s,a]of n)i.setAttribute(s,a)}catch{}}function sC(t){return t.playbackStartAttr==="playback-start"||t.kind==="composition"?"data-playback-start":"data-media-start"}function XLe(t,e,n,r){if(r.playbackStart!=null)return{attrName:sC(n).slice(5),value:r.playbackStart};const i=r.start-n.start;if(i===0)return null;const s=P_(t,e,"playback-start")??P_(t,e,"media-start"),a=s!=null?parseFloat(s):void 0;return a==null||!Number.isFinite(a)?null:{attrName:sC(n).slice(5),value:Math.max(0,a+i*Math.max(n.playbackRate??1,.1))}}function Lhe(t,e,n,r,i){if(!Number.isFinite(n)||!Number.isFinite(r))return console.warn(`[Timeline] buildTimelineMoveTimingPatch: non-finite timing (start=${n}, duration=${r}) — patch skipped`),t;let s=yd(t,e,{type:"attribute",property:"start",value:mi(n)});return i!=null&&Number.isFinite(i)&&(s=yd(s,e,{type:"attribute",property:"track-index",value:mi(i)})),Gj(s,Pj(s))}function Fhe(t,e,n,r){const i=XLe(t,e,n,r);let s=yd(t,e,{type:"attribute",property:"start",value:mi(r.start)});return s=yd(s,e,{type:"attribute",property:"duration",value:mi(r.duration)}),i&&(s=yd(s,e,{type:"attribute",property:i.attrName,value:mi(i.value)})),Gj(s,Pj(s))}async function WLe(t){const e=t.element.sourceFile||t.activeCompPath||"index.html",n=await ea(t.projectId,e),r=Xd(t.element);if(!r)throw new Error(`Timeline element ${t.element.id} is missing a patchable target`);const i=t.buildPatches(n,r);if(i===n)throw new Error(`Unable to patch timeline element ${t.element.id} in ${e}`);t.pendingTimelineEditPathRef.current.add(e),t.domEditSaveTimestampRef.current=Date.now(),await il({projectId:t.projectId,label:t.label,kind:"timeline",coalesceKey:t.coalesceKey,files:{[e]:i},readFile:async()=>n,writeFile:t.writeProjectFile,recordEdit:t.recordEdit}),t.domEditSaveTimestampRef.current=Date.now()}async function qLe(t){const e=new Map,n=new Map;for(const i of t.changes){const s=i.element.sourceFile||t.activeCompPath||"index.html",a=e.get(s)??await ea(t.projectId,s);e.set(s,a);const o=Xd(i.element);if(!o)throw new Error(`Timeline element ${i.element.id} is missing a patchable target`);const l=n.get(s)??a;if(!Gf(l,o))throw new Error(`Unable to patch timeline element ${i.element.id} in ${s}`);const c=i.buildPatches(l,o);c!==l&&n.set(s,c)}if(n.size===0)return;const r=Object.fromEntries(n);for(const i of Object.keys(r))t.pendingTimelineEditPathRef.current.add(i);t.domEditSaveTimestampRef.current=Date.now(),await il({projectId:t.projectId,label:t.label,kind:"timeline",coalesceKey:t.coalesceKey,coalesceMs:t.coalesceMs,files:r,readFile:async i=>e.get(i)??ea(t.projectId,i),writeFile:t.writeProjectFile,recordEdit:t.recordEdit}),t.domEditSaveTimestampRef.current=Date.now()}async function $he({projectId:t,targetPath:e,patchTarget:n,attr:r,value:i,label:s,writeProjectFile:a,recordEdit:o,domEditSaveTimestampRef:l,pendingTimelineEditPathRef:c,patchLive:u}){const f=await ea(t,e);if(SS(f,n)===void 0)throw new Error(`Unable to patch element in ${e}`);const h=P_(f,n,r)??null;u(i);const y=yd(f,n,{type:"attribute",property:r,value:i});c.current.add(e),l.current=Date.now();try{const m=await il({projectId:t,label:s,kind:"timeline",files:{[e]:y},readFile:async v=>v===e?f:ea(t,v),writeFile:a,recordEdit:o});return l.current=Date.now(),m}catch(m){throw u(h),m}}const aC=.03;function YLe(t,e,n){return t>=e+aC&&t<=e+n-aC}function n3(t){const e=!!(t.hfId||t.domId||t.selector),n=t.playbackRate==null||Number.isFinite(t.playbackRate)&&t.playbackRate>0;return!t.timelineLocked&&t.timingSource!=="implicit"&&e&&n&&!!t.duration&&Number.isFinite(t.duration)}function Bhe(t,e){return n3(t)&&YLe(e,t.start,t.duration)}function KLe(t,e){return t.filter(n=>Bhe(n,e))}function JLe(t,e,n,r){return e.button!==0||e.shiftKey||!r?!1:t==="start"?n.canTrimStart:n.canTrimEnd}function eFe(t,e,n){return t?t==="move"?!!n:!!e:!1}function tFe(t,e,n,r){if(t.button!==0)return{kind:"ignore"};if(ue.getState().activeTool==="razor")return{kind:"ignore"};if(t.shiftKey)return{kind:"arm-shift-click"};const i=t.currentTarget.getBoundingClientRect(),s=t5e({width:i.width,offsetX:t.clientX-i.left,handleWidth:O3e,capabilities:e});return eFe(s,n,r)?{kind:"block",intent:s,rect:i}:!r||!e.canMove?{kind:"ignore"}:{kind:"move",rect:i}}function nFe(t,e,n,r,i){const{pps:s,onResizeElement:a,onMoveElement:o,onRazorSplit:l,onRazorSplitAll:c,blockedClipRef:u,shiftClickClipRef:f,suppressClickRef:h,scrollRef:p,setShowPopover:y,setRangeSelection:m,setResizingClip:v,setDraggedClip:b,setSelectedElementId:w,onSelectElement:O}=i;return{onResizeStart:(N,_)=>{var I;JLe(N,_,r,a)&&(_.stopPropagation(),u.current=null,y(!1),m(null),v({pointerId:_.pointerId,element:t,edge:N,originClientX:_.clientX,originScrollLeft:((I=p.current)==null?void 0:I.scrollLeft)??0,previewStart:t.start,previewDuration:t.duration,previewPlaybackStart:t.playbackStart,started:!1}))},onPointerDown:N=>{var j,L;const _=tFe(N,r,a,o);if(_.kind==="ignore")return;if(_.kind==="arm-shift-click"){f.current={element:t,anchorX:N.clientX,anchorY:N.clientY};return}if(_.kind==="block"){u.current={pointerId:N.pointerId,element:t,intent:_.intent,originClientX:N.clientX,originClientY:N.clientY,started:!1};return}const{rect:I}=_;u.current=null,y(!1),m(null),b({pointerId:N.pointerId,element:t,originClientX:N.clientX,originClientY:N.clientY,originScrollLeft:((j=p.current)==null?void 0:j.scrollLeft)??0,originScrollTop:((L=p.current)==null?void 0:L.scrollTop)??0,pointerClientX:N.clientX,pointerClientY:N.clientY,pointerOffsetX:N.clientX-I.left,pointerOffsetY:N.clientY-I.top,previewStart:t.start,previewTrack:t.track,desiredTrack:t.track,insertRow:null,snapTime:null,snapType:null,started:!1})},onClick:N=>{if(N.stopPropagation(),h.current)return;const{activeTool:_}=ue.getState();if(_==="razor"&&l){const I=N.currentTarget.getBoundingClientRect(),j=N.clientX-I.left,L=n.start+j/s,B=Math.max(n.start+aC,Math.min(n.start+n.duration-aC,L));N.shiftKey&&c?c(B):l(t,B);return}w(e),O==null||O(t)}}}function rFe(t,e,n){return n?{priority:"interaction",rich:!0}:{priority:t.starte.start?"visible":"overscan",rich:!1}}function iFe({element:t}){const e=ue(n=>n.lintFindingsByElement.get(t.key??t.id));return!e||e.count===0?null:d.jsx("span",{className:"absolute w-1.5 h-1.5 rounded-full bg-amber-400",style:{top:7,right:7},title:e.messages.join(` +`)})}function Vhe(t,e,n,r,i={priority:"visible",rich:!1}){return d.jsxs(d.Fragment,{children:[r==null?void 0:r(t),!n&&d.jsx(iFe,{element:t}),n&&d.jsx("div",{className:"absolute inset-0 overflow-hidden",style:{borderRadius:"inherit"},children:n(t,e,i)})]})}function Hhe(t,e){return Number.isFinite(e)&&!t.hidden&&Number.isFinite(t.start)&&Number.isFinite(t.end)&&e>=t.start&&e<=t.end}function Qhe(t,e){return Hhe({start:t.start,end:t.start+Math.max(0,t.duration),hidden:t.hidden===!0},e)}function sW(t){if(t===void 0||t.trim()==="")return null;const e=Number(t);return Number.isFinite(e)?e:null}function sFe(t){if(!(t instanceof HTMLElement))return null;const e=t.dataset.elId,n=sW(t.dataset.clipStart),r=sW(t.dataset.clipEnd);return!e||n===null||r===null?null:{id:e,start:n,end:r,hidden:t.dataset.clipHidden==="true",element:t}}function aFe(t){return[...t.querySelectorAll('[data-clip="true"]')].map(sFe).filter(e=>e!==null)}function oFe(t,e){return new Set(t.filter(n=>Hhe(n,e)).map(n=>n.id))}function aW(t,e,n,r=!1){const i=oFe(t,n);for(const s of t){const a=i.has(s.id);(r||e.has(s.id)!==a)&&s.element.toggleAttribute("data-active",a)}e.clear();for(const s of i)e.add(s)}function lFe({scrollRef:t,currentTime:e,clipStateVersion:n,elementStateVersion:r}){const i=x.useRef([]),s=x.useRef(new Set),a=x.useCallback(o=>{const l=t.current;if(!l){i.current=[],s.current.clear();return}i.current=aFe(l),aW(i.current,s.current,o,!0)},[t]);x.useLayoutEffect(()=>{a(e)},[n,e,r,a]),Or(()=>xa.subscribe(o=>{aW(i.current,s.current,o)}))}const cFe=new Set(["ArrowLeft","ArrowRight","ArrowUp","ArrowDown","Home","End","PageUp","PageDown"]);function uFe(t){return cFe.has(t)}function tg(t){return t.key??t.id}function fFe(t,e){return[...e].sort((n,r)=>n.start-r.start||n.start+n.duration-(r.start+r.duration)||tg(n).localeCompare(tg(r))).map(n=>{const r=tg(n);return{id:hS(r),kind:"clip",rowId:t,elementId:r,time:n.start+n.duration/2}})}function hFe(t,e,n,r,i){const s=sF(t,e,n,r),a=s?tg(s):null,o=s?FL(i.get(tg(s))??[],s.start,s.duration):[];return{activeClip:s,activeId:a,lanes:o}}function dFe(t){return{percentage:t.percentage,tweenPercentage:t.tweenPercentage,propertyGroup:t.propertyGroup,animationId:t.animationId,collidingAnimationTargets:t.collidingAnimationTargets}}function pFe(t,e,n){var o;const r=tg(e),i=new Map;for(const l of n){const c=dFe(l),u=Cf(r,c);i.has(u)||i.set(u,{target:c,time:e.start+l.percentage/100*e.duration})}const s=[...i.entries()].sort(([l,c],[u,f])=>c.time-f.time||l.localeCompare(u)),a=[];for(let l=0;lu.time&&c.target.animationId!==void 0&&a.push({id:loe(r,c.target),kind:"ease",rowId:t,elementId:r,time:u.time+(c.time-u.time)/2,keyframeTarget:c.target}),a.push({id:ooe(r,c.target),kind:"keyframe",rowId:t,elementId:r,time:c.time,keyframeTarget:c.target})}return a}function mFe(t,e,n){return t===null?!1:e.has(t)||n.has(t)}function gFe(t,e,n,r,i,s,a){const o=K2(n,i.group);return{id:o,kind:"row",physicalTrackKey:t,logicalIndex:e,level:s,parentId:a,elementId:n,expandable:!1,expanded:!1,propertyGroup:i.group,items:pFe(o,r,i.keyframes)}}function yFe({tracks:t,displayTrackOrder:e,laneCounts:n,selectedElementId:r,selectedElementIds:i,expandedClipIds:s,collapsedGroupIds:a,expandedLaneOwnerIds:o,groups:l,trackGroupOf:c,gsapAnimations:u}){const f=new Map(t),h=new Map(l.map(v=>[v.anchorKey,v])),p=[];function y(v,b,w){const O=f.get(v)??[],k=aTe(v),{activeClip:E,activeId:T,lanes:N}=hFe(O,n,r,i,u),_=AFe(O,N.length),I=mFe(T,s,o)&&_;if(p.push({id:k,kind:"row",physicalTrackKey:v,logicalIndex:p.length,level:b,parentId:w,elementId:T,expandable:_,expanded:I,items:fFe(k,O)}),!(!I||!E||!T))for(const j of N)p.push(gFe(v,p.length,T,E,j,b===1?2:3,k))}function m(v){const b=oTe(v.id),w=!a.has(v.id);if(p.push({id:b,kind:"row",physicalTrackKey:v.anchorKey,logicalIndex:p.length,level:1,parentId:null,elementId:null,groupId:v.id,expandable:v.memberTracks.length>0,expanded:w,items:[]}),o.has(v.id))for(const O of zf(v.memberElements))p.push({id:`${b}::${O.key}`,kind:"row",physicalTrackKey:v.anchorKey,logicalIndex:p.length,level:2,parentId:b,elementId:null,expandable:!1,expanded:!1,items:[]});if(w)for(const O of v.memberTracks)y(O,2,b)}for(const v of e){const b=h.get(v);if(b){m(b);continue}c.has(v)||y(v,1,null)}return p}function El(t,e){for(let n=0;ns.id===e);if(i>=0)return{row:r,rowIndex:n,itemIndex:i,target:r.items[i]}}return null}function xFe(t,e){return[...t.items].sort((n,r)=>Math.abs(n.time-e)-Math.abs(r.time-e)||n.time-r.time||n.id.localeCompare(r.id))[0]??t}function bFe(t,e,n,r={}){var m;const i=El(t,e);if(!i)return null;const{row:s,rowIndex:a,itemIndex:o,target:l}=i;if(n==="Home"||n==="End"){const v=r.timelineBoundary?n==="Home"?t[0]:t.at(-1):s;return v?r.timelineBoundary||n==="Home"?v:v.items.at(-1)??v:l}if(n==="ArrowLeft")return o<0?s.parentId?((m=El(t,s.parentId))==null?void 0:m.target)??s:s:o===0?s:s.items[o-1];if(n==="ArrowRight")return o<0?s.items[0]??s:s.items[o+1]??l;const c=n==="ArrowUp"||n==="PageUp"?-1:1,u=n==="PageUp"||n==="PageDown",f=r.pageSize;if(u&&(f===void 0||!Number.isFinite(f)||f<1))return l;const h=u?Math.floor(f):1,p=Math.max(0,Math.min(t.length-1,a+c*h)),y=t[p];return!y||p===a?l:l.kind==="row"?y:xFe(y,l.time)}function vFe(t,e,n){const r=El(e,n);if(r)return r.target;const i=El(t,n);if(!i)return null;if(i.itemIndex>=0){for(let a=i.itemIndex-1;a>=0;a-=1){const o=El(e,i.row.items[a].id);if(o)return o.target}for(let a=i.itemIndex+1;a0||zf(t).length>0}function oW(t){if(!(t.target instanceof Element))return null;const e=t.target.closest("button, input, select, textarea, a[href], [contenteditable], [data-timeline-focus-id]");return e!=null&&e.dataset.timelineFocusId&&t.currentTarget.contains(e)?e:null}function SFe(t,e,n,r){if(!r||t.size===0)return 1;const i=n.getRowIndex(e),s=Math.max(0,i>=0?i:Math.floor(n.getRowFromY(r.scrollTop))),a=i>=0?n.getRowTop(i):r.scrollTop,o=Math.min(n.rowKeys.length-1,Math.floor(n.getRowFromY(a+Math.max(0,r.clientHeight-.001))));let l=0;for(let c=s;c<=o;c+=1)l+=t.get(n.rowKeys[c])??0;return Math.max(1,l)}function wFe(t){const e=t.getBoundingClientRect();t.dispatchEvent(new MouseEvent("contextmenu",{bubbles:!0,cancelable:!0,clientX:e.left+e.width/2,clientY:e.top+e.height/2}))}function OFe({logicalRows:t,focusedTargetId:e,rowGeometry:n,scrollRef:r,onToggleRow:i}){var c,u;const s=(e&&((c=El(t,e))==null?void 0:c.target.id))??((u=t[0])==null?void 0:u.id)??null,a=x.useMemo(()=>{const f=new Map;for(const h of t)f.set(h.physicalTrackKey,(f.get(h.physicalTrackKey)??0)+1);return f},[t]),o=x.useCallback(f=>{var p;const h=(p=oW(f))==null?void 0:p.dataset.timelineFocusId;h&&h!==e&&ue.getState().requestTimelineFocus(h)},[e]),l=x.useCallback(f=>{const h=oW(f),p=h==null?void 0:h.dataset.timelineFocusId;if(!h||!p)return;const y=El(t,p);if(y){if(uFe(f.key)){if(y.target.kind==="row"&&(f.key==="ArrowRight"&&y.target.expandable&&!y.target.expanded||f.key==="ArrowLeft"&&y.target.expandable&&y.target.expanded)){f.preventDefault(),i(y.target);return}const m=bFe(t,p,f.key,{pageSize:SFe(a,y.row.physicalTrackKey,n,r.current),timelineBoundary:f.ctrlKey||f.metaKey});f.preventDefault(),m&&m.id!==p&&ue.getState().requestTimelineFocus(m.id);return}if(f.key==="ContextMenu"||f.key==="F10"&&f.shiftKey){f.preventDefault(),wFe(h);return}f.key!=="Enter"&&f.key!==" "||y.target.kind!=="row"||!y.target.expandable||(f.preventDefault(),i(y.target))}},[a,t,i,n,r]);return{rovingTargetId:s,onFocus:o,onKeyDown:l}}function CFe({pps:t,contentOrigin:e,contentGutter:n,trackContentWidth:r,theme:i,displayTrackOrder:s,rowGeometry:a,virtualRows:o,logicalRows:l,focusedTargetId:c,rowsVirtualized:u,clipIndex:f,renderTimeRange:h,visibleTimeRange:p,pinnedClipIdentities:y,trackOrder:m,tracks:v,trackStyles:b,groups:w,laneCounts:O,selectedElementId:k,selectedElementIds:E,hoveredClip:T,draggedClip:N,draggedElement:_,multiDragPreview:I,blockedClipRef:j,suppressClickRef:L,scrollRef:B,renderClipContent:$,renderClipOverlay:z,onDrillDown:Y,onSelectElement:W,setHoveredClip:J,setShowPopover:ne,setRangeSelection:le,setResizingClip:ie,setDraggedClip:q,setSelectedElementId:F,shiftClickClipRef:U,getPreviewElement:Z,getTrackStyle:K,keyframeCache:ee,gsapAnimations:re,selectedKeyframes:Q,currentTime:H,onSeek:se,onSelectSegment:fe,onClickKeyframe:be,onShiftClickKeyframe:me,onContextMenuKeyframe:pe,onMoveKeyframe:ge,onContextMenuClip:Pe,onContextMenuLane:ve,beatAnalysis:xe,onToggleTrackHidden:we,onTogglePropertyGroupKeyframe:Ce,onResizeElement:Me,onMoveElement:Ve,onRazorSplit:tt,onRazorSplitAll:Ze}){const qe=`timeline-lanes${x.useId().replaceAll(":","")}`,pt=ue(Ye=>Ye.expandedClipIds),{collapsedGroupIds:it,expandedLaneOwnerIds:vt,toggleGroupExpanded:Ot,toggleLaneOwnerExpanded:Kt}=_7e(),qt=HIe(),fn=ue(Ye=>Ye.duration);t_e({lanes:qt});const{logicalRowsByTrack:Jt,groupByAnchor:Je}=R7e(l,w),St=x.useMemo(()=>new Set(w.flatMap(Ye=>Ye.memberTracks)),[w]),{toggleRowExpanded:At,toggleClipExpanded:Ke}=j7e(),Be=nje(I,u,h),We=OFe({logicalRows:l,focusedTargetId:c,rowGeometry:a,scrollRef:B,onToggleRow:Ye=>{Ye.elementId&&Ke(Ye.elementId)}});return d.jsx("div",{role:"treegrid","aria-label":"Timeline tracks","aria-rowcount":l.length,"aria-colcount":2,onFocus:We.onFocus,onKeyDown:We.onKeyDown,className:u?"absolute inset-0":void 0,children:o.map(({index:Ye,rowKey:Zt})=>{var nr,gt,rr,Cn,Rn;const Te=s[Ye];if(Te===void 0)return null;const De=Je.get(Te);if(De){const xt=(nr=Jt.get(Te))==null?void 0:nr[0];return xt?d.jsx(I7e,{index:Ye,rowKey:Zt,group:De,logicalRow:xt,top:a.getRowTop(Ye),height:a.getRowHeight(Ye),virtualized:u,contentOrigin:e,theme:i,rovingTargetId:We.rovingTargetId,collapsedGroupIds:it,expandedLaneOwnerIds:vt,toggleGroupExpanded:Ot,toggleLaneOwnerExpanded:Kt,lanes:qt,pps:t,currentTime:H,compositionDuration:fn,beatTimes:xe==null?void 0:xe.beatTimes,contentGutter:n,trackContentWidth:r},Zt):null}const ze=Pfe(s,Te),st=Jt.get(Te)??[],Gt=st[0];if(!Gt)return null;const ln=a.getRowHeight(Ye),Yt=((gt=v.find(([xt])=>xt===Te))==null?void 0:gt[1])??[],Nn=u?Zae(f,Te,h,y,Be):Yt,Mr=b.get(Te)??K(""),mt=(N==null?void 0:N.started)===!0&&!m.includes(Te)&&Yt.length===0,vn=i.rowBackground,mn=Q7e(Yt,xe==null?void 0:xe.beatTimes,{selectedElementId:k,isMusicTrack:my}),Tn=Yt.length>0&&Yt.every(xt=>xt.hidden===!0),Ln=Yt.length>0&&Yt.some(Jo),et=sF(Yt,O,k,E),Yn=(et==null?void 0:et.key)??(et==null?void 0:et.id),Mt=G7e(Yt,pt),hn=Mt?Xi-2*ha:void 0,Ht=Yt.map(Z),dn=`${qe}-track-${Ye}`,tr=`${dn}-automation`,_n=et&&Yn?qt.bind(et,k===Yn||E.has(Yn)):null,xr=_n&&!_n.readOnly?xt=>_n.onCommit({version:1,lanes:_n.lanes.filter(Ut=>Ut.target!==xt)}):void 0;return d.jsxs(Vfe,{index:Ye,rowKey:Zt,logicalRow:Gt,propertyRows:st.slice(1),lanesId:dn,headerLanesId:`${dn} ${tr}`,top:a.getRowTop(Ye),height:ln,virtualized:u,background:vn,borderColor:i.rowBorder,rovingTargetId:We.rovingTargetId,children:[d.jsx(T7e,{trackNumber:Te,trackDisplayNumber:ze,trackLabel:((rr=Yt[0])==null?void 0:rr.label)??((Cn=Yt[0])==null?void 0:Cn.domId)??((Rn=Yt[0])==null?void 0:Rn.id)??`Track${YE(ze)}`,lanesId:`${dn} ${tr}`,contentOrigin:e,keyframeClip:et,trackElements:Yt,clipCount:Yt.length,isExpanded:Mt,animations:Yn?re.get(Yn)??[]:[],currentTime:H,isTrackHidden:Tn,isAudioTrack:Ln,isGroupMember:St.has(Te),theme:i,onToggleClipExpanded:()=>{const xt=Yt.map(Zn);xt.length>0&&At(xt)},onToggleTrackHidden:we,onTogglePropertyGroupKeyframe:Ce,onRemoveAutomationLane:xr,onSeek:se,rovingTargetId:We.rovingTargetId}),d.jsxs("div",{role:"gridcell","aria-colindex":2,style:{width:r,marginLeft:n,opacity:Tn?.35:1,transition:"opacity 120ms ease"},className:"relative",onContextMenu:xt=>{if(xt.defaultPrevented||!ve)return;const Ut=xt.currentTarget.getBoundingClientRect(),Ct=(xt.clientX-Ut.left)/t;Ct<0||(xt.preventDefault(),ve(xt,Te,Ct))},children:[d.jsx(rTe,{beatTimes:xe==null?void 0:xe.beatTimes,beatStrengths:xe==null?void 0:xe.beatStrengths,pps:t,highlightTime:N!=null&&N.started&&N.snapType==="beat"?N.snapTime:null,renderTimeRange:u?h:void 0}),mn&&d.jsx(iTe,{beatTimes:xe==null?void 0:xe.beatTimes,beatStrengths:xe==null?void 0:xe.beatStrengths,pps:t,renderTimeRange:u?h:void 0}),mt&&d.jsx("div",{className:"absolute inset-0 flex items-center",style:{paddingLeft:16,color:Mr.label,fontSize:11,letterSpacing:"0.06em",textTransform:"uppercase",opacity:.5},children:"New track"}),Nn.map(xt=>{const Ut=K(xt.tag),Ct=Zn(xt),fr=Ct===Yn,Dt=fr&&Mt,wt=lS(xt),gn=k===Ct||E.has(Ct),Lt=!!xt.compositionSrc,rn=Ct;if((N==null?void 0:N.started)===!0&&_!=null&&Zn(_)===Ct)return null;const Fn=Z(xt),ri=rFe(Fn,p,gn||T===rn||y.has(rn)),cn=I!=null&&Zfe(rn,I),kn=cn?eje(rn,t,I):0,ir=nFe(xt,Ct,Fn,wt,{pps:t,onResizeElement:Me,onMoveElement:Ve,onRazorSplit:tt,onRazorSplitAll:Ze,blockedClipRef:j,shiftClickClipRef:U,suppressClickRef:L,scrollRef:B,setShowPopover:ne,setRangeSelection:le,setResizingClip:ie,setDraggedClip:q,setSelectedElementId:F,onSelectElement:W}),Pi=d.jsx(coe,{onContextMenu:Nr=>{Nr.preventDefault(),Pe==null||Pe(Nr,xt)},el:Fn,pps:t,clipY:ha,clipHeight:hn,isSelected:gn,isHovered:T===rn,isDragging:!1,isActive:Qhe(Fn,H),hasCustomContent:!!$,capabilities:wt,theme:i,isComposition:Lt,tabIndex:We.rovingTargetId===hS(Ct)?0:-1,onHoverStart:()=>J(rn),onHoverEnd:()=>J(null),onResizeStart:ir.onResizeStart,onPointerDown:ir.onPointerDown,onClick:ir.onClick,onDoubleClick:Nr=>{Nr.stopPropagation(),!L.current&&Lt&&Y&&Y(xt)},children:Vhe(Fn,Ut,$,z,ri)},rn),Jr=ee==null?void 0:ee.get(Ct),Vi=!Dt&&Jr&&d.jsx(hPe,{element:Fn,elementId:Ct,keyframesData:Jr,pixelsPerSecond:t,rowHeight:ln,beatsActive:mn,accentColor:Ut.accent,isSelected:gn,currentTime:H,selectedKeyframes:Q,rovingTargetId:We.rovingTargetId,onClickKeyframe:be,onShiftClickKeyframe:me,onContextMenuKeyframe:pe,onMoveKeyframe:ge,onSelectSegment:fe,suppressClickRef:L},`${rn}-diamonds`),ds=fr&&d.jsx(FDe,{id:dn,animations:Dt?re.get(Ct)??[]:[],clipStart:Ice(Fn),clipDuration:Fn.duration,clipLeftPx:Fn.start*t,clipWidthPx:Math.max(Fn.duration*t,4),accentColor:Ut.accent,isSelected:gn,currentPercentage:Fn.duration>0?(H-Fn.start)/Fn.duration*100:0,elementId:Ct,selectedKeyframes:Q,rovingTargetId:We.rovingTargetId,onSelectSegment:Nr=>fe==null?void 0:fe(Ct,Nr),onClickKeyframe:Nr=>be==null?void 0:be(Fn,Nr),onShiftClickKeyframe:Nr=>me==null?void 0:me(Ct,Nr),onContextMenuKeyframe:(Nr,Qa)=>pe==null?void 0:pe(Nr,Ct,Qa),onMoveKeyframe:(Nr,Qa)=>(ge==null?void 0:ge(Ct,Nr,Qa))??Promise.resolve(!1),suppressClickRef:L},`${rn}-property-lanes`);return cn?d.jsxs("div",{className:"absolute inset-0",style:{transform:`translateX(${kn}px)`,opacity:.85,zIndex:20,pointerEvents:"none"},children:[Pi,Vi,ds]},rn):d.jsxs(x.Fragment,{children:[Pi,Vi,ds]},rn)}),d.jsx("div",{id:tr,children:Mt?d.jsx(Wce,{elements:Ht,isSelected:xt=>{const Ut=Zn(xt);return k===Ut||E.has(Ut)},lanes:qt,pps:t,laneCount:Yn?O.get(Yn)??0:0,accentColor:K((et==null?void 0:et.tag)??"").accent,currentTime:H,beatTimes:xe==null?void 0:xe.beatTimes}):null})]})]},Zt)})})}const zhe=8,oC={playhead:0,"clip-edge":1,beat:2};function kFe(t){const e=new Map,n=(r,i)=>{if(!Number.isFinite(r)||r<0)return;const s=Math.round(r*1e3)/1e3,a=e.get(s);(!a||oC[i]r.time-i.time)}function lC(t,e,n){let r=null,i=n;for(const s of e){const a=Math.abs(s.time-t);(a1e-6&&(f=null),{start:y,snapTime:(f==null?void 0:f.time)??null,snapType:(f==null?void 0:f.type)??null}}function TFe(t,e,n,r){if(n<0)return t;const i=e.indexOf(t);return i<0?t:r?i>=n?t:e[n]??t:i=e:t<=e}function PFe(t,e,n,r){if(e.length===0)return n<0?0:n;const i=t.indexOf(e[0]),s=t.indexOf(e[e.length-1])+1;return rn.has(w));if(s!==null&&lW(s,f,c))return{track:i,insertRow:s};const h=TFe(i,e,f,c),p=e.filter(w=>n.has(w)===c),y=DFe({elements:r,desiredTrack:h,start:a,duration:o,trackOrder:p,excludeKey:l}),m=(b=r.find(w=>(w.key??w.id)===l))==null?void 0:b.track,v=m!=null&&h!==m&&y.track===m;if(y.needsInsert||v){const w=e.indexOf(h);if(w<0)return{track:h,insertRow:PFe(e,p,f,h)};const O=m==null?-1:e.indexOf(m),E=(v?O>w:u&&lW(w,f,c))?w:w+1;return{track:h,insertRow:E}}return{track:y.track,insertRow:null}}function NFe(t,e,n=k3e){if(e===0||t<=0)return 0;if(t>=e)return e;const r=Math.floor(t),i=t-r;return i1-n?r+1:null}function Zhe(t,e,n,r){return t(s.key??s.id)!==i&&s.track===e&&Zhe(n,r,s.start,s.start+s.duration))}function DFe({elements:t,desiredTrack:e,start:n,duration:r,trackOrder:i,excludeKey:s}){const a=n+r,o=i.indexOf(e);if(o===-1)return{track:e,needsInsert:!0};if(_4(t,e,n,a,s))return{track:e,needsInsert:!1};for(let l=o-1;l>=0;l--)if(_4(t,i[l],n,a,s))return{track:i[l],needsInsert:!1};for(let l=o+1;l0?t.scrollWidth/e:n)}function RFe(t,e,n,r,i){if(i.size<=1||!i.has(n))return t;const s=r.filter(o=>i.has(o.key??o.id)).map(o=>o.start),a=tje(t-e.start,s);return e.start+a}function jFe(t,e,n,r,i){const{scroll:s,trackOrder:a,rowHeights:o,elements:l}=i,c=s?M3e(e-s.getBoundingClientRect().top+s.scrollTop,o):{rowFloat:0,fraction:0,rowHeight:jae(0,o)},u=NFe(c.rowFloat,a.length,N3e(c.rowHeight)),f=c.fraction<.5,h=i.audioTracks??new Set(l.filter(Jo).map(p=>p.track));return MFe({order:a,audioTracks:h,elements:l,desiredTrack:r,deliberateInsertRow:u,start:n,duration:t.element.duration,dragKey:t.element.key??t.element.id,isAudio:Jo(t.element),preferInsertAbove:f})}function LFe(t,e,n,r){const{scroll:i,pps:s,duration:a,trackOrder:o,elements:l,selectedKeys:c,buildSnapTargets:u}=r,f=_Fe(i,s,a),h=(i==null?void 0:i.scrollTop)??t.originScrollTop,p=(i==null?void 0:i.getBoundingClientRect().top)??0,y=s_(t.originClientY-p+t.originScrollTop,r.rowHeights),m=s_(n-p+h,r.rowHeights),v=J3e({start:t.element.start,track:t.element.track,duration:t.element.duration,originClientX:t.originClientX,originRow:y,originScrollLeft:t.originScrollLeft,currentScrollLeft:(i==null?void 0:i.scrollLeft)??t.originScrollLeft,pixelsPerSecond:s,maxStart:f,trackOrder:o},e,m),b=u(t.element.key??t.element.id,!my(t.element)),w=EFe(v.start,t.element.duration,b,s,f+t.element.duration),O=t.element.key??t.element.id,k=RFe(w.start,t.element,O,l,c),{track:E,insertRow:T}=jFe(t,n,k,v.track,r);return{...t,started:!0,pointerClientX:e,pointerClientY:n,previewStart:k,previewTrack:E,desiredTrack:v.track,insertRow:T,snapTime:w.snapTime,snapType:w.snapType}}function FFe(t,e,n){const{scroll:r,pps:i,buildSnapTargets:s}=n,a=t.originScrollLeft??(r==null?void 0:r.scrollLeft)??0,o=e+(((r==null?void 0:r.scrollLeft)??a)-a),l=t.element.sourceDuration!=null?Math.max(0,(t.element.sourceDuration-(t.element.playbackStart??0))/Math.max(t.element.playbackRate??1,.1)):Number.POSITIVE_INFINITY,c=t.element.tag.toLowerCase(),u=t.element.kind==="composition"||c==="audio"||c==="video",f=Math.max(t.element.playbackRate??1,.1),h=t.element.start+l;let p=e5e({start:t.element.start,duration:t.element.duration,originClientX:t.originClientX,pixelsPerSecond:i,minStart:0,maxEnd:h,playbackStart:t.edge==="start"&&u?t.element.playbackStart??0:t.element.playbackStart,playbackRate:t.element.playbackRate},t.edge,o);const y=s(t.element.key??t.element.id,!my(t.element));if(y.length>0){const m=zhe/Math.max(i,1);if(t.edge==="end"){const v=p.start+p.duration,b=lC(v,y,m).time,w=Math.round((b-p.start)*1e3)/1e3;b!==v&&b<=h+1e-6&&w>=.05&&(p={...p,duration:w})}else{const v=lC(p.start,y,m).time,b=p.start-v,w=p.playbackStart!=null?p.playbackStart/f:Number.POSITIVE_INFINITY,O=Math.round((p.duration+b)*1e3)/1e3;v!==p.start&&v>=0&&b<=w+1e-6&&O>=.05&&(p={...p,start:v,duration:O,playbackStart:p.playbackStart!=null?Math.round(Math.max(0,p.playbackStart-b*f)*1e3)/1e3:void 0})}}return{originScrollLeft:a,previewStart:p.start,previewDuration:p.duration,previewPlaybackStart:p.playbackStart}}function $Fe(t,e,n){const r=K3e(t,e);n({originScrollLeft:e.originScrollLeft,previewStart:(r==null?void 0:r.start)??e.previewStart,previewDuration:(r==null?void 0:r.duration)??e.previewDuration,previewPlaybackStart:(r==null?void 0:r.playbackStart)??e.previewPlaybackStart,groupPreview:t.changes})}const BFe=x.memo(function({drag:e,scrollRef:n,pixelsPerSecond:r,rowHeight:i,selectedElementId:s,currentTime:a,theme:o,getTrackStyle:l,renderClipContent:c,renderClipOverlay:u}){const f=(e==null?void 0:e.started)===!0?c3e({element:e.element,draggedElementId:e.element.key??e.element.id,previewStart:e.previewStart,previewTrack:e.previewTrack}):null,h=e?IFe(e,n.current):null;return d.jsx("div",{"data-timeline-gesture-overlay":!0,className:"absolute inset-0 pointer-events-none",children:f&&h&&d.jsx("div",{"data-timeline-gesture-actor":f.key??f.id,className:"absolute",style:{top:h.top,left:h.left,width:Math.max(f.duration*r,4),height:i,zIndex:40},children:d.jsx(coe,{el:{...f,start:0},pps:r,clipY:0,isSelected:s===(f.key??f.id),isHovered:!1,isDragging:!0,isGestureActor:!0,isActive:Qhe(f,a),hasCustomContent:!!c,capabilities:lS(f),theme:o,isComposition:!!f.compositionSrc,onHoverStart:()=>{},onHoverEnd:()=>{},onResizeStart:()=>{},onClick:()=>{},onDoubleClick:()=>{},children:Vhe(f,l(f.tag),c,u,{priority:"interaction",rich:!0})})})})}),VFe=x.memo(function(e){const{draggedClip:n,scrollRef:r,selectedElementIds:i,displayTrackOrder:s}=e,a=(n==null?void 0:n.started)===!0?s.indexOf(n.previewTrack):-1,o=jae(a,e.rowHeights),l=Math.min(o,Xi)-ha*2,{onResizeElement:c,onMoveElement:u,onToggleTrackHidden:f,onTogglePropertyGroupKeyframe:h,onRazorSplit:p,onRazorSplitAll:y}=fS(),m=ue(O=>O.beatDragging),v=(n==null?void 0:n.element)??null,b=v?Zn(v):null,w=(n==null?void 0:n.started)===!0&&v&&b?{dragStarted:!0,draggedKey:b,draggedOriginStart:v.start,draggedPreviewStart:n.previewStart,selectedKeys:i}:null;return d.jsxs("div",{className:"relative",style:{height:e.totalH,width:e.contentOrigin+e.trackContentWidth},children:[d.jsx(G5e,{major:e.major,minor:e.minor,pps:e.pps,trackContentWidth:e.trackContentWidth,totalH:e.totalH,effectiveDuration:e.effectiveDuration,majorTickInterval:e.majorTickInterval,theme:e.theme,beatAnalysis:e.beatAnalysis,contentOrigin:e.contentOrigin,renderTimeRange:e.rowsVirtualized?e.renderTimeRange:void 0}),d.jsx("div",{"aria-hidden":"true",style:{height:e.rowsVirtualized?0:r0}}),d.jsx(CFe,{...e,draggedElement:v,multiDragPreview:w,onToggleTrackHidden:f,onTogglePropertyGroupKeyframe:h,onResizeElement:c,onMoveElement:u,onRazorSplit:p,onRazorSplitAll:y}),d.jsx("div",{"aria-hidden":"true",style:{height:e.rowsVirtualized?0:Rae}}),e.laneGapStrips.map(O=>{const k=s.indexOf(O.track);if(k<0)return null;const E=O.kind==="hover";return(e.rowsVirtualized?O.intervals.filter(N=>N.starte.renderTimeRange.start):O.intervals).map(N=>d.jsx("div",{className:"pointer-events-none absolute",style:{top:ZP(k,e.rowHeights)+ha,left:e.contentOrigin+N.start*e.pps,width:Math.max((N.end-N.start)*e.pps,2),height:Xi-ha*2,background:E?"rgba(60,230,172,0.18)":"rgba(60,230,172,0.055)",borderRadius:4,zIndex:25}},`gap-${O.kind}-${O.track}-${N.start}`))}),(n==null?void 0:n.started)&&n.insertRow==null&&a>=0&&d.jsx("div",{className:"absolute pointer-events-none",style:{top:ZP(a,e.rowHeights)+ha,left:e.contentOrigin+n.previewStart*e.pps,width:Math.max(n.element.duration*e.pps,4),height:l,border:"1px solid rgba(60,230,172,0.55)",background:"rgba(60,230,172,0.12)",borderRadius:4,zIndex:30}}),(n==null?void 0:n.started)&&n.insertRow!=null&&d.jsx("div",{className:"absolute pointer-events-none",style:{top:ZP(n.insertRow,e.rowHeights)-.5,left:e.contentOrigin,width:e.trackContentWidth,height:1,background:"#3CE6AC",boxShadow:"0 0 3px rgba(60,230,172,0.5)",zIndex:55}}),(n==null?void 0:n.started)&&n.snapTime!=null&&n.snapType!=="beat"&&d.jsx("div",{className:"absolute pointer-events-none",style:{left:e.contentOrigin+n.snapTime*e.pps,top:Ra,bottom:0,width:1,background:n.snapType==="playhead"?"#3CE6AC":"rgba(255,255,255,0.6)",boxShadow:n.snapType==="playhead"?"0 0 6px rgba(60,230,172,0.5)":"0 0 6px rgba(255,255,255,0.4)",zIndex:60}}),d.jsx(BFe,{drag:n,scrollRef:r,pixelsPerSecond:e.pps,rowHeight:l,selectedElementId:e.selectedElementId,currentTime:e.currentTime,theme:e.theme,getTrackStyle:e.getTrackStyle,renderClipContent:e.renderClipContent,renderClipOverlay:e.renderClipOverlay}),e.marqueeRect&&d.jsx("div",{"aria-hidden":"true",className:"absolute pointer-events-none",style:{left:e.marqueeRect.left,top:e.marqueeRect.top,width:e.marqueeRect.width,height:e.marqueeRect.height,background:"rgba(60,230,172,0.10)",border:"1px dashed rgba(60,230,172,0.7)",borderRadius:2,zIndex:70}}),e.rangeSelection&&d.jsx("div",{className:"absolute pointer-events-none",style:{left:e.contentOrigin+Math.min(e.rangeSelection.start,e.rangeSelection.end)*e.pps,width:Math.abs(e.rangeSelection.end-e.rangeSelection.start)*e.pps,top:Ra,bottom:0,backgroundColor:"rgba(59, 130, 246, 0.12)",borderLeft:"1px solid rgba(59, 130, 246, 0.4)",borderRight:"1px solid rgba(59, 130, 246, 0.4)",zIndex:50}}),d.jsx("div",{ref:e.playheadRef,"data-croco-timeline-playhead":"true",className:"absolute top-0 bottom-0 pointer-events-none",style:{left:`${a_(0,0,e.contentOrigin)}px`,width:M6,zIndex:100,display:m?"none":void 0},children:d.jsx(U5e,{scrubbing:e.isScrubbing})})]})});function Sc(t){return Jo(t)?"audio":"visual"}const cC=t=>t.key??t.id,cW=1e-6;function HFe(t,e){return t.startr?1:0}function zFe(t,e,n){const r=[...t].sort(QFe),i=[];for(const s of r){let a=i.findIndex(o=>o.every(l=>!HFe(l,s)));a===-1&&(a=i.length,i.push([])),i[a].push(s),n.set(cC(s),e+a)}return Math.max(1,i.length)}function uW(t,e,n){const r=new Map;for(const s of t){const a=r.get(s.track);a?a.push(s):r.set(s.track,[s])}let i=0;for(const s of[...r.keys()].sort((a,o)=>a-o))i+=zFe(r.get(s),e+i,n);return i}function Ghe(t){if(t.length===0)return t;const e=new Map,n=[],r=[];for(const o of t)(Sc(o)==="audio"?r:n).push(o);let i=0;i+=uW(n,i,e),uW(r,i,e);let s=!1;const a=t.map(o=>{const l=e.get(cC(o));return l==null||l===o.track?o:(s=!0,{...o,track:l,authoredTrack:o.authoredTrack??o.track})});return s?a:t}const fW=1e-6,uC=t=>JSON.stringify([t.sourceFile??null,t.stackingContextId??null]);function wF(t,e){return uC(t)===uC(e)}function ZFe(t,e){return t.starte.zIndex:t.domIndex!=null&&e.domIndex!=null?t.domIndex>e.domIndex:!1}function R_(t,e){return t.length>0?e(t.map(n=>n.zIndex)):null}function GFe(t,e,n,r){const i=e.filter(h=>!h.isAudio);if(i.length===0)return!1;const s=i.filter(h=>__(t,h)),a=i.filter(h=>__(h,t));if(s.every(h=>jg(t,h))&&a.every(h=>jg(h,t)))return!1;const l=R_(s,h=>Math.max(...h)),c=WFe(t,s,a);if(c!=null)return c!==t.zIndex&&r(t,c),c!==t.zIndex;const u=l!=null?l+1:0,f=Math.max(0,u);return f!==t.zIndex&&r(t,f),qFe(t,n,r),!0}function UFe(t,e,n){if(e-t>=2){const r=Math.floor((t+e)/2);return r>t&&r=0?n:e(t)?t:null}function WFe(t,e,n){const r=R_(e,a=>Math.max(...a)),i=R_(n,a=>Math.min(...a)),s=a=>{const o={...t,zIndex:a};return e.every(l=>jg(o,l))&&n.every(l=>jg(l,o))};return r!=null&&i!=null?UFe(r,i,s):r!=null?r+1:i!=null?XFe(i,s):null}function qFe(t,e,n){const r=[t],i=(s,a)=>{jg(s,a)||(n(s,a.zIndex+1),r.push(s))};for(;r.length>0;){const s=r.shift();for(const a of e(s))__(a,s)&&!jg(a,s)&&i(a,s)}}function YFe(t,e){const n=new Set(e);if(n.size===0)return[];const r=t.filter(y=>Number.isFinite(y.zIndex)),i=new Set(r.filter(y=>n.has(y.key)).map(uC)),s=r.filter(y=>i.has(uC(y))),a=new Map(s.map(y=>[y.key,{...y}])),o=s.filter(y=>n.has(y.key)&&!y.isAudio).map(y=>a.get(y.key)).sort((y,m)=>m.track-y.track),l=new Map,c=(y,m)=>{y.zIndex=m,l.set(y.key,m)},u=[...a.values()],f=y=>u.filter(m=>m.key!==y.key&&!m.isAudio&&wF(y,m)&&ZFe(y,m));for(const y of o)GFe(y,f(y),f,c);const h=new Set,p=[];for(const y of o)l.has(y.key)&&!h.has(y.key)&&(p.push({key:y.key,zIndex:l.get(y.key)}),h.add(y.key));for(const[y,m]of l)h.has(y)||(p.push({key:y,zIndex:m}),h.add(y));return p}function rv(t){return lS({tag:t.tag,kind:t.kind,duration:t.duration,domId:t.domId,selector:t.selector,compositionSrc:t.compositionSrc,playbackStart:t.playbackStart,playbackStartAttr:t.playbackStartAttr,sourceDuration:t.sourceDuration,timingSource:t.timingSource,timelineLocked:t.timelineLocked}).canMove}function KFe(t,e){const n=e.selectedKeys;if(!n)return null;const r=new Set(n),i=e.elements.includes(t.element)?e.elements:[...e.elements,t.element];for(const u of i){const f=u.expandedHostKey,h=Zn(u);f&&r.has(f)&&r.has(h)&&r.delete(h)}const s=t.element.expandedHostKey,a=Zn(t.element);if(!s||r.has(a))return r.size===n.size?null:{drag:t,selectedKeys:r};const o=e.elements.find(u=>Zn(u)===s);if(!o||!rv(o))return null;const l=t.previewStart-t.element.start,c=u=>u===t.element.track?o.track:u;return{drag:{...t,element:o,previewStart:Math.max(0,Math.round((o.start+l)*1e3)/1e3),previewTrack:c(t.previewTrack)??o.track,desiredTrack:c(t.desiredTrack)},selectedKeys:r}}const j_=new WeakMap;function r3(t,e){let n=j_.get(t);n||(n=new Map,j_.set(t,n));const r=new Map;for(const i of e){const s=(n.get(i)??0)+1;n.set(i,s),r.set(i,s)}return r}function fC(t,e,n){var r;return((r=j_.get(t))==null?void 0:r.get(n))===e.get(n)}function L_(t,e,n){for(const r of n)fC(t,e,r.key)&&t(r.key,r.updates)}let t8=null;function OF(t){const e=t8;let n;if(e)n=e.then(t,t);else try{n=Promise.resolve(t())}catch(i){n=Promise.reject(i)}const r=n.then(()=>{},()=>{});return t8=r,r.then(()=>{t8===r&&(t8=null)}),n}function Uhe(t){return OF(async()=>{const n=await t.commitZ();return n&&!n.durable?!1:t.mirror()})}function Xhe(t){return OF(async()=>await t.commitLane()?(await t.commitZ(),!0):!1)}function Lg(t,e){return t.then(n=>{var r;return n&&((r=e.refreshAfterLaneMove)==null||r.call(e)),n})}const hW=t=>t.key??t.id,CF=(t,e)=>(t.sourceFile??null)===(e.sourceFile??null);function kF(t,e,n){const r=hW(n),i=e.filter(o=>hW(o)!==r&&CF(o,n)),s=i.find(o=>o.track===t);if(s)return s.authoredTrack??s.track;let a=null;for(const o of i)(!a||Math.abs(o.track-t)t.key??t.id,JFe=t=>Math.round(t*1e3)/1e3;let Whe=0;function xd(t,e,n,r="timing",i){if(t.length===0)return Promise.resolve(!0);const{updateElement:s,onMoveElement:a,onMoveElements:o}=e;o||console.warn(a?`[Timeline] persistMoveEdits: only single-clip onMoveElement wired — this ${t.length}-clip move degrades to a per-clip persist race (no atomic single-undo)`:`[Timeline] persistMoveEdits: no move persist handler wired — ${t.length} edit(s) applied to the store only, not saved`);const l=t.map(p=>({key:Gr(p.element),start:p.element.start,track:p.element.track,authoredTrack:p.element.authoredTrack})),c=r3(s,t.map(p=>Gr(p.element))),u=p=>{const y=p.persistTrack??(p.updates.track!==p.element.track?p.updates.track:void 0);s(Gr(p.element),y==null?p.updates:{...p.updates,authoredTrack:y})};for(const p of t)u(p);const f=t.map(p=>p.persistTrack==null||p.persistTrack===p.updates.track?p:{element:p.element,updates:{...p.updates,track:p.persistTrack}}),h=o?o(f,n,r,i):Promise.all(f.map(p=>Promise.resolve(a==null?void 0:a(p.element,p.updates))));return Promise.resolve(h).then(()=>{for(const p of t){const y=Gr(p.element);fC(s,c,y)&&u(p)}return!0},p=>{for(const y of l)fC(s,c,y.key)&&s(y.key,{start:y.start,track:y.track,authoredTrack:y.authoredTrack});return console.error("[Timeline] Failed to persist clip edits",p),!1})}function dW(t,e){return t.length===0?0:e<=0?t[0]-.5:e>=t.length?t[t.length-1]+.5:(t[e-1]+t[e])/2}function e$e(t,e){const{elements:n,selectedKeys:r}=e,i=Gr(t.element);if(!r||r.size<=1||!r.has(i))return null;const s=new Set([...r].filter(l=>{const c=n.find(u=>Gr(u)===l);return c?rv(c):!1})),a=t.previewStart-t.element.start;return{keys:s,movedStart:l=>Gr(l)===i?t.previewStart:Math.max(0,JFe(l.start+a))}}function qhe(t,e){const n=KFe(t,e);if(n){qhe(n.drag,{...e,selectedKeys:n.selectedKeys});return}const{elements:r,updateElement:i,onMoveElement:s}=e,a=Gr(t.element),o=t.insertRow!=null,l=t.previewTrack!==t.element.track,c=t.desiredTrack??t.previewTrack,u=o||c!==t.element.track,f=e$e(t,e);if(!o&&!l){if(t.previewStart-t.element.start===0)return;if(f){const E=r.filter(T=>f.keys.has(Gr(T))).map(T=>({element:T,updates:{start:f.movedStart(T),track:T.track}})).filter(T=>T.updates.start!==T.element.start);xd(E,e);return}const w={start:t.previewStart,track:t.element.track},O={start:t.element.start,track:t.element.track},k=r3(i,[a]);i(a,w),Promise.resolve(s==null?void 0:s(t.element,w)).catch(E=>{fC(i,k,a)&&i(a,O),console.error("[Timeline] Failed to persist clip edit",E)});return}if(o){t$e(t,e,f);return}const h={element:t.element,updates:{start:t.previewStart,track:t.previewTrack},persistTrack:kF(t.previewTrack,r,t.element)},p=u?`clip-lane-move:${Whe++}`:void 0,y=[h];if(f)for(const b of r){if(Gr(b)===a||!f.keys.has(Gr(b)))continue;const w=f.movedStart(b);w!==b.start&&y.push({element:b,updates:{start:w,track:b.track}})}const m=r.map(b=>Gr(b)===a?{...b,start:t.previewStart,track:t.previewTrack}:f!=null&&f.keys.has(Gr(b))?{...b,start:f.movedStart(b)}:b),v=f?f.keys:null;if(!u||!e.readZIndex||!e.onStackingPatches){Lg(xd(y,e,p,"lane-reorder"),e);return}Lg(Xhe({commitLane:()=>xd(y,e,p,"lane-reorder"),commitZ:()=>Khe(m,a,t.element.track,t.previewTrack,v,e,p)}),e).catch(()=>{})}function Yhe(t,e,n,r,i){const{elements:s,trackOrder:a}=i,o=Gr(t);if(t.expandedParentStart!=null)return null;const l=dW(a,n),c=s.map(w=>Gr(w)===o?{...w,start:e,track:l}:r!=null&&r.keys.has(Gr(w))?{...w,start:r.movedStart(w)}:w),u=Sc(t),f=w=>CF(w,t)&&Sc(w)===u&&w.expandedParentStart==null,h=[...new Set(s.filter(f).map(w=>w.track))].sort((w,O)=>w-O),p=h.filter(w=>wGr(w)===o?{...w,start:e,track:y}:r!=null&&r.keys.has(Gr(w))?{...w,start:r.movedStart(w)}:w)),v=new Map(s.map(w=>[Gr(w),w]));for(const w of m){const O=v.get(Gr(w));if(O&&f(O)&&!rv(O)&&w.track!==(O.authoredTrack??O.track))return console.warn(`[Timeline] Track insert refused: locked clip ${Gr(O)} would need renumbering`),null}const b=[];if(r)for(const w of s){const O=Gr(w);O!==o&&r.keys.has(O)&&!f(w)&&rv(w)&&b.push({element:w,updates:{start:r.movedStart(w),track:w.track},persistTrack:w.authoredTrack})}for(const w of m){const O=v.get(Gr(w));if(!O||!rv(O))continue;const k=Gr(w)===o||r!=null&&r.keys.has(Gr(w))?(r==null?void 0:r.movedStart(O))??e:O.start;b.push({element:O,updates:{start:k,track:w.track}})}return{candidate:c,edits:b}}function t$e(t,e,n){const r=Gr(t.element),i=Yhe(t.element,t.previewStart,t.insertRow,n,e);if(!i)return;const{candidate:s,edits:a}=i;if(a.length===0)return;const o=`clip-lane-move:${Whe++}`;if(!e.readZIndex||!e.onStackingPatches){Lg(xd(a,e,o,"track-insert"),e);return}Lg(Xhe({commitLane:()=>xd(a,e,o,"track-insert"),commitZ:()=>Khe(s,r,t.element.track,t.insertRow,n?n.keys:null,e,o)}),e).catch(()=>{})}function n$e(t,e,n,r,i){if(e.kind==="move"){const a={element:t,updates:{start:t.start,track:e.displayTrack},persistTrack:e.persistTrack};return Lg(xd([a],n,r,"lane-reorder",i),n)}const s=Yhe(t,t.start,e.insertRow,null,n);return!s||s.edits.length===0?Promise.resolve(!1):Lg(xd(s.edits,n,r,"track-insert",i),n)}function Khe(t,e,n,r,i,s,a){const{readZIndex:o,onStackingPatches:l}=s;if(!o||!l||r===n)return Promise.resolve();const c=t.map((h,p)=>({key:Gr(h),start:h.start,duration:h.duration,track:h.track,zIndex:o(h),isAudio:Sc(h)==="audio",sourceFile:h.sourceFile,domIndex:p,stackingContextId:h.stackingContextId??null})),u=[e];if(i)for(const h of i)h!==e&&u.push(h);const f=YFe(c,u);return f.length===0?Promise.resolve():Promise.resolve(l(f,a)).then(()=>{})}function r$e(t,e,n){if(!t.hasChanged)return;const r=t.changes,i=r3(e,r.map(a=>a.key));for(const a of r)e(a.key,{start:a.start,duration:a.duration,playbackStart:a.playbackStart});if(!n){L_(e,i,t.members.map(a=>({key:a.key,updates:a})));return}const s=`clip-group-resize:${r.map(a=>a.key).join(":")}`;Promise.resolve(n(r.map(a=>({element:a.element,start:a.start,duration:a.duration,playbackStart:a.playbackStart})),{coalesceKey:s})).catch(a=>{L_(e,i,t.members.map(o=>({key:o.key,updates:o}))),console.error("[Timeline] Failed to persist group clip resize",a)})}function i$e({lifecycleRef:t,sessionEpochRef:e,cancelGestureRef:n,scrollRef:r,draggedClipRef:i,resizingClipRef:s,blockedClipRef:a,groupResizeRef:o,suppressClickRef:l,gestureSelectedKeysRef:c,elementsRef:u,trackOrderRef:f,setDraggedClipState:h,setResizingClipState:p,setShowPopover:y,setRangeSelectionRef:m,applyResizePointerRef:v,syncClipDragAutoScrollRef:b,stopClipDragAutoScrollRef:w,updateDraggedClipPreviewRef:O,publishDraggedClip:k,updateElement:E,onMoveElementRef:T,onMoveElementsRef:N,onResizeElementRef:_,onResizeElementsRef:I,onBlockedEditAttemptRef:j,readZIndexRef:L,onStackingPatchesRef:B,refreshAfterLaneMoveRef:$}){const z=()=>{requestAnimationFrame(()=>{l.current=!1})},Y=pe=>{const ge=t.current.pointerId;return ge===null||pe.pointerId===ge},W=pe=>{if(pe===null)return;const ge=r.current;try{ge!=null&&ge.hasPointerCapture(pe)&&ge.releasePointerCapture(pe)}catch{}},J=pe=>{var ge;if(pe!==null)try{(ge=r.current)==null||ge.setPointerCapture(pe)}catch{}},ne=pe=>{i.current=null,s.current=null,o.current=null,pe&&(h(null),p(null))},le=({updateReact:pe=!0,suppressClick:ge=!1}={})=>{const Pe=t.current;return Pe.phase!=="active"?!1:(Pe.phase="cancelled",w.current(),ne(pe),W(Pe.pointerId),ge&&(l.current=!0),Pe.kind=null,Pe.pointerId=null,Pe.phase="complete",!0)};n.current=le;const ie=(pe,ge)=>{var ve;const Pe=Math.abs(pe.clientX-ge.originClientX);!ge.started&&Pe<2||(ge.started||J(ge.pointerId),y(!1),(ve=m.current)==null||ve.call(m,null),v.current(ge,pe.clientX),b.current(pe.clientX,pe.clientY))},q=(pe,ge)=>{var xe,we;const Pe=Math.hypot(pe.clientX-ge.originClientX,pe.clientY-ge.originClientY),ve=ge.intent==="move"?4:2;!ge.started&&Pe{var ve;const Pe=Math.hypot(pe.clientX-ge.originClientX,pe.clientY-ge.originClientY);!ge.started&&Pe<4||(ge.started||J(ge.pointerId),y(!1),(ve=m.current)==null||ve.call(m,null),k(O.current(ge,pe.clientX,pe.clientY)),b.current(pe.clientX,pe.clientY))},U=pe=>{const ge=s.current;if(ge)return Y(pe)?ie(pe,ge):void 0;const Pe=a.current;if(Pe)return Pe.pointerId!==pe.pointerId?void 0:q(pe,Pe);const ve=i.current;ve&&Y(pe)&&F(pe,ve)},Z=(pe,ge)=>{var we;if(!pe.started)return;if(l.current=!0,z(),ge){r$e(ge,E,I.current);return}if(!(pe.previewStart!==pe.element.start||pe.previewDuration!==pe.element.duration||pe.previewPlaybackStart!==pe.element.playbackStart))return;const ve=pe.element.key??pe.element.id,xe=r3(E,[ve]);E(ve,{start:pe.previewStart,duration:pe.previewDuration,playbackStart:pe.previewPlaybackStart}),Promise.resolve((we=_.current)==null?void 0:we.call(_,pe.element,{start:pe.previewStart,duration:pe.previewDuration,playbackStart:pe.previewPlaybackStart})).catch(Ce=>{L_(E,xe,[{key:ve,updates:{start:pe.element.start,duration:pe.element.duration,playbackStart:pe.element.playbackStart}}]),console.error("[Timeline] Failed to persist clip resize",Ce)})},K=pe=>{a.current=null,pe.started&&z()},ee=pe=>{pe.started&&(l.current=!0,z(),qhe(pe,{elements:u.current,trackOrder:f.current,updateElement:E,onMoveElement:T.current,onMoveElements:N.current,selectedKeys:c.current,readZIndex:L.current,onStackingPatches:B.current,refreshAfterLaneMove:$.current}))},re=()=>{var Pe,ve,xe;const pe=((Pe=o.current)==null?void 0:Pe.members.map(we=>we.element))??[((ve=s.current)==null?void 0:ve.element)??((xe=i.current)==null?void 0:xe.element)],ge=new Set(u.current.map(we=>we.key??we.id));return pe.every(we=>we===void 0||ge.has(we.key??we.id))},Q=pe=>{const ge=t.current;if(ge.phase!=="active")return null;if(!Y(pe))return"ignored";if(ge.sessionEpoch!==e.current||!re())return le(),"ignored";ge.phase="committing";const Pe=ge.kind?{kind:ge.kind,drag:i.current,resize:s.current,groupResize:o.current}:"ignored";return w.current(),ne(!0),W(ge.pointerId),Pe==="ignored"&&(ge.phase="complete"),Pe},H=pe=>{try{pe.kind==="resize"&&pe.resize?Z(pe.resize,pe.groupResize):pe.kind==="drag"&&pe.drag&&ee(pe.drag)}finally{const ge=t.current;ge.kind=null,ge.pointerId=null,ge.phase="complete"}},se=pe=>{const ge=Q(pe);if(ge==="ignored")return;if(ge){H(ge);return}const Pe=a.current;if(Pe)return Pe.pointerId!==pe.pointerId?void 0:K(Pe);l.current&&z()},fe=pe=>{t.current.phase==="active"&&Y(pe)&&le({suppressClick:!0})&&z();const ge=a.current;ge&&ge.pointerId!==pe.pointerId||(a.current=null,l.current&&z())},be=pe=>{t.current.phase==="active"&&Y(pe)&&le({suppressClick:!0})&&z()},me=pe=>{const ge=i5e({key:pe.key,drag:i.current,resize:s.current,blocked:a.current});ge.cancel&&(pe.preventDefault(),a.current=null,le({suppressClick:ge.suppressClick}))};return window.addEventListener("pointermove",U),window.addEventListener("pointerup",se),window.addEventListener("pointercancel",fe),window.addEventListener("lostpointercapture",be),window.addEventListener("keydown",me),()=>{le({updateReact:!1}),n.current=()=>!1,window.removeEventListener("pointermove",U),window.removeEventListener("pointerup",se),window.removeEventListener("pointercancel",fe),window.removeEventListener("lostpointercapture",be),window.removeEventListener("keydown",me)}}const n8=[];function s$e({scrollRef:t,ppsRef:e,durationRef:n,trackOrderRef:r,rowGeometryRef:i,onMoveElement:s,onMoveElements:a,onResizeElement:o,onResizeElements:l,onBlockedEditAttempt:c,setShowPopover:u,setRangeSelectionRef:f,readZIndex:h,onStackingPatches:p,refreshAfterLaneMove:y,sessionEpoch:m=0}){const v=ue(Je=>Je.updateElement),b=ue(Je=>{var St;return((St=Je.beatAnalysis)==null?void 0:St.beatTimes)??n8}),w=ue(Je=>{var St;return((St=Je.beatAnalysis)==null?void 0:St.beatStrengths)??n8}),O=ue(Je=>Je.beatEdits),k=ue(Je=>y0(Je.elements).musicElement),E=(k==null?void 0:k.start)??0,T=(k==null?void 0:k.playbackStart)??0,N=(k==null?void 0:k.duration)??0,_=(k==null?void 0:k.src)??null,I=x.useMemo(()=>{if(b===n8||N===0)return n8;const Je=Dj(b,w,O,_),St=T+N,At=E-T;return Je.times.filter(Ke=>Ke>=T&&Ke<=St).map(Ke=>Math.round((Ke+At)*1e3)/1e3)},[b,w,O,_,E,T,N]),j=ue(Je=>Je.elements),L=ue(Je=>Je.timelineSnapEnabled),B=x.useRef({beatTimes:[],enabled:!0});B.current={beatTimes:I,enabled:L};const $=x.useRef(j);$.current=j;const z=x.useRef(new Map),Y=x.useRef(null),W=x.useCallback((Je,St)=>{if(!B.current.enabled)return[];const At=`${Je??""}|${St?1:0}`,Ke=z.current.get(At);if(Ke)return Ke;const Be=kFe({elements:$.current,playheadTime:ue.getState().currentTime,beatTimes:St?B.current.beatTimes:[],excludeElementKey:Je});return z.current.set(At,Be),Be},[]),[J,ne]=x.useState(null),le=x.useRef(null),ie=x.useCallback(Je=>{le.current=Je,ne(Je)},[]),[q,F]=x.useState(null),U=x.useRef(null),Z=x.useCallback(Je=>{U.current=Je,F(Je)},[]),K=x.useRef({kind:null,phase:"complete",pointerId:null,sessionEpoch:m}),ee=x.useRef(m);ee.current=m;const re=x.useRef(new Set),Q=x.useRef(()=>!1),H=x.useCallback((Je,St)=>{K.current.phase==="active"&&Q.current(),K.current={kind:Je,phase:"active",pointerId:St,sessionEpoch:ee.current},re.current=new Set(ue.getState().selectedElementIds)},[]),se=x.useCallback(Je=>{if(!Je){Q.current();return}H("drag",Je.pointerId),ie(Je)},[H,ie]),fe=x.useCallback(Je=>{if(!Je){Q.current();return}H("resize",Je.pointerId),Z(Je)},[H,Z]),be=x.useRef(null),me=x.useRef(!1),pe=x.useRef(null),ge=x.useRef(s);ge.current=s;const Pe=x.useRef(a);Pe.current=a;const ve=x.useRef(c);ve.current=c;const xe=x.useRef(o);xe.current=o;const we=x.useRef(l);we.current=l;const Ce=x.useRef(h);Ce.current=h;const Me=x.useRef(p);Me.current=p;const Ve=x.useRef(y);Ve.current=y;const tt=x.useRef(0),Ze=x.useRef(null),qe=x.useCallback((Je,St,At)=>(Y.current||(Y.current=y0($.current).audioTracks),LFe(Je,St,At,{scroll:t.current,pps:e.current,duration:n.current,trackOrder:r.current,rowHeights:i==null?void 0:i.current.rowHeights,elements:$.current,selectedKeys:re.current,buildSnapTargets:W,audioTracks:Y.current})),[t,e,n,r,i,W]),pt=x.useCallback((Je,St)=>{const At=FFe(Je,St,{scroll:t.current,pps:e.current,buildSnapTargets:W}),Ke=Ye=>Z(U.current?{...U.current,started:!0,...Ye}:null),Be=Je.element.key??Je.element.id;let We=pe.current;if(!We||We.grabbedKey!==Be||We.edge!==Je.edge){const Ye=q3e($.current,re.current,Be,Je.edge);We=Ye?{grabbedKey:Be,edge:Je.edge,members:Ye,changes:[],hasChanged:!1}:null,pe.current=We}if(!We){Ke(At);return}$Fe(We,At,Ke)},[t,e,W,Z]),it=x.useRef(pt);it.current=pt;const vt=x.useCallback(()=>{Ze.current=null,tt.current&&(cancelAnimationFrame(tt.current),tt.current=0),z.current.clear(),Y.current=null},[]),Ot=x.useCallback(()=>{tt.current=0;const Je=le.current,St=U.current,At=Ze.current,Ke=t.current;!Je&&!St||!At||!Ke||EE(Ke,At.clientX,At.clientY)&&(Je?ie(qe(Je,At.clientX,At.clientY)):St&&it.current(St,At.clientX),tt.current=requestAnimationFrame(Ot))},[ie,t,qe]),Kt=x.useCallback((Je,St)=>{Ze.current={clientX:Je,clientY:St};const At=cS(t.current,Je,St,tt.current!==0);At==="stop"?(cancelAnimationFrame(tt.current),tt.current=0):At==="start"&&(tt.current=requestAnimationFrame(Ot))},[t,Ot]),qt=x.useRef(qe);qt.current=qe;const fn=x.useRef(Kt);fn.current=Kt;const Jt=x.useRef(vt);return Jt.current=vt,Or(()=>i$e({onStackingPatchesRef:Me,refreshAfterLaneMoveRef:Ve,readZIndexRef:Ce,onBlockedEditAttemptRef:ve,onResizeElementsRef:we,onResizeElementRef:xe,onMoveElementsRef:Pe,onMoveElementRef:ge,updateElement:v,publishDraggedClip:ie,updateDraggedClipPreviewRef:qt,stopClipDragAutoScrollRef:Jt,syncClipDragAutoScrollRef:fn,applyResizePointerRef:it,setRangeSelectionRef:f,setShowPopover:u,setResizingClipState:F,setDraggedClipState:ne,trackOrderRef:r,elementsRef:$,gestureSelectedKeysRef:re,suppressClickRef:me,groupResizeRef:pe,blockedClipRef:be,resizingClipRef:U,draggedClipRef:le,scrollRef:t,cancelGestureRef:Q,sessionEpochRef:ee,lifecycleRef:K})),x.useEffect(()=>{Q.current()},[m]),{draggedClip:J,setDraggedClip:se,resizingClip:q,setResizingClip:fe,blockedClipRef:be,suppressClickRef:me,stopClipDragAutoScroll:vt}}function pW(t){if(typeof document>"u"||!document.body||!document.execCommand)return!1;const e=document.createElement("textarea");e.value=t,e.setAttribute("readonly","true"),e.style.position="fixed",e.style.top="0",e.style.left="0",e.style.width="1px",e.style.height="1px",e.style.padding="0",e.style.border="0",e.style.opacity="0",e.style.pointerEvents="none",document.body.appendChild(e),e.focus({preventScroll:!0}),e.select(),e.setSelectionRange(0,t.length);try{return document.execCommand("copy")}catch{return!1}finally{e.remove()}}function a$e(){if(typeof navigator>"u")return!1;const t=navigator.userAgent;return/Safari/i.test(t)&&!/Chrome|Chromium|CriOS|FxiOS|Edg|OPR/i.test(t)}async function Uf(t){const e=a$e();if(e&&pW(t))return!0;const n=typeof navigator<"u"?navigator.clipboard:void 0;if(n!=null&&n.writeText)try{return await n.writeText(t),!0}catch{}return!e&&pW(t)}function o$e(t,e){return`hf-edit-draft:${t.toFixed(2)}:${e.toFixed(2)}`}function l$e(t){try{return sessionStorage.getItem(t)??""}catch{return""}}function mW(t,e){try{e?sessionStorage.setItem(t,e):sessionStorage.removeItem(t)}catch{}}function c$e({rangeStart:t,rangeEnd:e,anchorX:n,anchorY:r,onClose:i}){const s=ue(I=>I.elements),a=Math.min(t,e),o=Math.max(t,e),l=o$e(a,o),[c,u]=x.useState(()=>l$e(l)),f=I=>{u(I),mW(l,I)},[h,p]=x.useState(!1),[y,m]=x.useState(!1),[v,b]=x.useState(!1),w=x.useRef(null),O=x.useRef(null),k=x.useMemo(()=>s.filter(I=>{const j=I.start+I.duration;return I.starta}),[s,a,o]);Or(()=>{setTimeout(()=>{var I;return(I=O.current)==null?void 0:I.focus()},50)}),Or(()=>{const I=j=>{j.key==="Escape"&&i()};return window.addEventListener("keydown",I),()=>window.removeEventListener("keydown",I)}),Or(()=>{const I=j=>{w.current&&!w.current.contains(j.target)&&i()};return setTimeout(()=>window.addEventListener("mousedown",I),100),()=>window.removeEventListener("mousedown",I)});const E=x.useCallback(()=>r5e({rangeStart:a,rangeEnd:o,elements:k,prompt:c}),[a,o,k,c]),T=x.useCallback(async()=>{if(!await Uf(E())){b(!0);return}b(!1),mW(l,""),p(!0),setTimeout(()=>{p(!1),i()},800)},[E,i,l]),N=x.useCallback(async()=>{const I=XG(c);if(!I)return;if(!await Uf(I)){b(!0);return}b(!1),m(!0),setTimeout(()=>{m(!1)},800)},[c]),_={position:"fixed",left:Math.max(8,Math.min(n-160,window.innerWidth-336)),top:Math.max(8,r-280),zIndex:200};return d.jsx("div",{ref:w,style:_,children:d.jsxs("div",{className:"w-80 bg-neutral-900 border border-neutral-700/60 rounded-xl shadow-2xl shadow-black/40 overflow-hidden",children:[d.jsxs("div",{className:"flex items-center justify-between px-4 py-2.5 border-b border-neutral-800/60",children:[d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx("div",{className:"w-1.5 h-1.5 rounded-full bg-studio-accent"}),d.jsxs("span",{className:"text-[11px] font-medium text-neutral-300",children:[os(a)," — ",os(o)]})]}),d.jsxs("span",{className:"text-[10px] text-neutral-600",children:[k.length," element",k.length!==1?"s":""]})]}),k.length>0&&d.jsx("div",{className:"px-4 py-2 border-b border-neutral-800/40 max-h-24 overflow-y-auto",children:k.map(I=>d.jsxs("div",{className:"flex items-center justify-between py-0.5",children:[d.jsxs("span",{className:"text-[10px] font-mono text-studio-accent/80",children:["#",I.id]}),d.jsx("span",{className:"text-[10px] text-neutral-600",children:I.tag})]},I.id))}),d.jsx("div",{className:"p-3",children:d.jsx("textarea",{ref:O,value:c,onChange:I=>f(I.target.value),onKeyDown:I=>{I.key==="Enter"&&(I.metaKey||I.ctrlKey)&&(I.preventDefault(),T())},placeholder:"What should change?",rows:2,className:"w-full px-3 py-2 text-xs bg-neutral-800/60 border border-neutral-700/40 rounded-lg text-neutral-200 placeholder:text-neutral-600 resize-none focus:outline-none focus:border-studio-accent/40 transition-colors"})}),v&&d.jsx("p",{className:"px-3 pb-2 text-[10px] text-red-400",role:"alert",children:"Copy failed — check clipboard permissions and try again."}),d.jsxs("div",{className:"grid grid-cols-2 gap-2 px-3 pb-3",children:[d.jsx("button",{onClick:N,disabled:!XG(c),className:`py-1.5 text-[11px] font-medium rounded-lg transition-all border ${y?"bg-green-500/20 text-green-400 border-green-500/30":"bg-neutral-800/70 text-neutral-200 border-neutral-700/50 hover:bg-neutral-800"} disabled:opacity-50 disabled:cursor-not-allowed`,children:y?"Prompt Copied!":"Copy Prompt"}),d.jsxs("button",{onClick:T,className:`py-1.5 text-[11px] font-medium rounded-lg transition-all ${h?"bg-green-500/20 text-green-400 border border-green-500/30":"bg-studio-accent/15 text-studio-accent border border-studio-accent/25 hover:bg-studio-accent/25"}`,children:[h?"Copied!":"Copy to Agent",!h&&d.jsx("span",{className:"text-[9px] text-studio-accent/50 ml-1.5",children:"Cmd+Enter"})]})]})]})})}function Jhe(t){x.useEffect(()=>{var s;const e=t.current;if(!e)return;const n=document.activeElement,r=()=>Array.from(e.querySelectorAll('[role="menuitem"]')).filter(a=>!a.disabled);(s=r()[0])==null||s.focus();const i=a=>{var u;if(a.key!=="ArrowDown"&&a.key!=="ArrowUp"&&a.key!=="Home"&&a.key!=="End")return;const o=r();if(o.length===0)return;a.preventDefault();const l=o.findIndex(f=>f===document.activeElement);let c;a.key==="ArrowDown"?c=l<0?0:(l+1)%o.length:a.key==="ArrowUp"?c=l<0?o.length-1:(l-1+o.length)%o.length:a.key==="Home"?c=0:c=o.length-1,(u=o[c])==null||u.focus()};return e.addEventListener("keydown",i),()=>{e.removeEventListener("keydown",i),n instanceof HTMLElement&&document.contains(n)&&n.focus()}},[t])}const wM="w-full flex items-center gap-2 px-3 py-1.5 text-xs text-neutral-200 hover:bg-neutral-800 focus-visible:bg-neutral-800 outline-none cursor-pointer text-left",u$e="w-full flex items-center gap-2 px-3 py-1.5 text-xs text-red-400 hover:bg-neutral-800 focus-visible:bg-neutral-800 outline-none cursor-pointer text-left";function ede({state:t,onClose:e,onDelete:n,onDeleteAll:r,onEditEase:i,onCopyProperties:s,onMoveToPlayhead:a}){const o=V0(e),l={percentage:t.percentage,tweenPercentage:t.tweenPercentage,propertyGroup:t.propertyGroup,animationId:t.animationId};Jhe(o);const[c,u]=x.useState("idle"),f=async()=>{if(!s)return;if(await s(t.elementId,l)===!1){u("failed"),setTimeout(()=>u("idle"),1500);return}u("copied"),setTimeout(e,700)},h=200,y=10+(1+(a?1:0)+(i?1:0)+(s?1:0)+(n?1:0))*30+9,m=t.y+y-window.innerHeight,v=t.x+h>window.innerWidth?t.x-h:t.x,b=Math.max(8,m>0?t.y-m-8:t.y);return Bl.createPortal(d.jsxs("div",{ref:o,role:"menu","aria-label":"Keyframe actions",className:"fixed z-[200] bg-neutral-900 border border-neutral-700 rounded-md shadow-lg py-1 min-w-[180px] overflow-y-auto",style:{left:v,top:b,maxHeight:`calc(100vh - ${b+8}px)`},children:[a&&d.jsx("button",{type:"button",role:"menuitem",className:wM,onClick:()=>{a(t.element,l),e()},children:"Move to Playhead"}),i&&d.jsxs("button",{type:"button",role:"menuitem",className:`${wM} justify-between`,onClick:()=>{i(t.elementId,l),e()},children:[d.jsx("span",{children:"Edit Ease…"}),d.jsx("span",{className:"text-[10px] text-neutral-500",children:t.currentEase??"default"})]}),s&&d.jsx("button",{type:"button",role:"menuitem",className:wM,onClick:()=>{f()},children:c==="copied"?"Copied!":c==="failed"?"Copy failed — check permissions":"Copy Properties"}),n&&d.jsx("button",{type:"button",role:"menuitem",className:u$e,onClick:()=>{n(t.elementId,l),e()},children:"Delete Keyframe"}),d.jsx("div",{className:"my-1 border-t border-neutral-700/60",role:"separator"}),d.jsx("div",{className:"my-1 border-t border-neutral-700/60",role:"separator"}),d.jsx("button",{type:"button",role:"menuitem",className:"w-full flex items-center gap-2 px-3 py-1.5 text-xs text-red-400 hover:bg-red-950/40 focus-visible:bg-red-950/40 outline-none cursor-pointer text-left",onClick:()=>{r(t.element,t.animationId),e()},children:"Delete All Keyframes"})]}),document.body)}const f$e=x.memo(function({x:e,y:n,element:r,currentTime:i,onClose:s,onSplit:a,onDelete:o}){const l=V0(s);Jhe(l);const c=200,f=n+80-window.innerHeight,h=e+c>window.innerWidth?e-c:e,p=f>0?n-f-8:n,y=n3(r)&&["video","audio","img"].includes(r.tag),m=y&&i>r.start&&i{m&&(a(r,i),s())},children:[d.jsx("span",{children:v}),d.jsx("span",{className:"text-neutral-500 text-[10px] ml-3",children:"S"})]}),d.jsx("div",{className:"my-1 border-t border-neutral-700/60"})]}),d.jsxs("button",{type:"button",role:"menuitem",className:"w-full flex items-center justify-between px-3 py-1.5 text-xs text-red-400 hover:bg-neutral-800 focus-visible:bg-neutral-800 outline-none cursor-pointer text-left",onClick:()=>{o(r),s()},children:[d.jsx("span",{children:"Delete"}),d.jsx("span",{className:"text-neutral-500 text-[10px] ml-3",children:"⌫"})]})]}),document.body)}),h$e=x.memo(function({x:e,y:n,gapWidth:r,canCloseGap:i,canCloseAllGaps:s,hasAnyGaps:a,onClose:o,onCloseGap:l,onCloseAllGaps:c,onHoverAction:u}){const f=V0(o),h=200,y=n+68-window.innerHeight,m=e+h>window.innerWidth?e-h:e,v=y>0?n-y-8:n,b=k=>`w-full flex items-center justify-between px-3 py-1.5 text-xs text-left ${k?"text-neutral-300 hover:bg-neutral-800 cursor-pointer":"text-neutral-600 cursor-not-allowed"}`,w=i?void 0:r==null?"No gap here":"A clip on this track can't be moved",O=s?void 0:a?"A clip on this track can't be moved":"No gaps on this track";return Bl.createPortal(d.jsxs("div",{ref:f,className:"fixed z-[200] bg-neutral-900 border border-neutral-700 rounded-md shadow-lg py-1 min-w-[180px]",style:{left:m,top:v},onPointerLeave:()=>u(null),children:[d.jsxs("button",{type:"button",className:b(i),disabled:!i,title:w,onPointerEnter:()=>u(i?"close-gap":null),onClick:()=>{i&&(l(),o())},children:[d.jsx("span",{children:"Close gap"}),r!=null&&d.jsxs("span",{className:"text-neutral-500 text-[10px] ml-3",children:[r.toFixed(2),"s"]})]}),d.jsx("button",{type:"button",className:b(s),disabled:!s,title:O,onPointerEnter:()=>u(s?"close-all":null),onClick:()=>{s&&(c(),o())},children:d.jsx("span",{children:"Close all gaps"})})]}),document.body)});function d$e({theme:t}){return d.jsx("div",{className:"absolute bottom-2 right-3 pointer-events-none z-20",children:d.jsxs("div",{className:"flex items-center gap-1.5 px-2 py-1 rounded-md border",style:{background:"rgba(17,23,35,0.84)",borderColor:t.gutterBorder},children:[d.jsx("kbd",{className:"text-[9px] font-mono px-1 py-0.5 rounded",style:{color:t.textSecondary,background:"rgba(255,255,255,0.06)"},children:"Shift"}),d.jsx("span",{className:"text-[9px]",style:{color:t.textSecondary},children:"+ drag/click to edit range"})]})})}function F_({capturedElement:t,targetSessionEpoch:e,sessionEpoch:n,selectedElementId:r,elements:i}){const s=t.key??t.id;return e!==n||r!==s?null:i.find(a=>(a.key??a.id)===s)??null}function p$e(t,e,n){const r=ue.getState();return F_({capturedElement:t,targetSessionEpoch:e,sessionEpoch:r.timelineSessionEpoch,selectedElementId:r.selectedElementId,elements:n})}function m$e({elements:t,elementsRef:e,theme:n,showShortcutHint:r,showPopover:i,rangeSelection:s,setShowPopover:a,setRangeSelection:o,kfContextMenu:l,setKfContextMenu:c,onDeleteKeyframe:u,onDeleteAllKeyframes:f,onMoveKeyframeToPlayhead:h,clipContextMenu:p,setClipContextMenu:y,currentTime:m,onSplitElement:v,pinZoomBeforeEdit:b,onDeleteElement:w,gapContextMenu:O,onDismissGapContextMenu:k,onCloseTrackGap:E,onCloseAllTrackGaps:T,onHoverGapAction:N}){const _=ue(Y=>Y.selectedElementId),I=ue(Y=>Y.timelineSessionEpoch),j=l==null?void 0:l.sessionEpoch,L=p==null?void 0:p.sessionEpoch,B=l?F_({capturedElement:l.element,targetSessionEpoch:j,sessionEpoch:I,selectedElementId:_,elements:t}):null,$=p?F_({capturedElement:p.element,targetSessionEpoch:L,sessionEpoch:I,selectedElementId:_,elements:t}):null,z=(Y,W)=>p$e(Y,W,e.current);return x.useEffect(()=>{l&&!B&&c(null)},[B,l,c]),x.useEffect(()=>{p&&!$&&y(null)},[p,$,y]),d.jsxs(d.Fragment,{children:[r&&!i&&!s&&d.jsx(d$e,{theme:n}),i&&s&&d.jsx(c$e,{rangeStart:s.start,rangeEnd:s.end,anchorX:s.anchorX,anchorY:s.anchorY,onClose:()=>{a(!1),o(null)}}),l&&B&&d.jsx(ede,{state:{...l,element:B},onClose:()=>c(null),onDelete:(...Y)=>{z(B,j)&&(u==null||u(...Y))},onDeleteAll:(Y,W)=>{const J=z(B,j);J&&(f==null||f(J,W))},onMoveToPlayhead:h?(Y,...W)=>{const J=z(B,j);J&&h(J,...W)}:void 0,onEditEase:l.animationId!==void 0&&l.tweenPercentage!==void 0?(Y,W)=>{W.animationId===void 0||W.tweenPercentage===void 0||(ue.getState().setFocusedEaseSegment({animationId:W.animationId,collidingAnimationTargets:W.collidingAnimationTargets,tweenPercentage:W.tweenPercentage,elementId:Y}),tj({action:"open"}))}:void 0,onCopyProperties:(Y,W)=>{const J=ue.getState().keyframeCache.get(Y),ne=J==null?void 0:J.keyframes.find(le=>Math.abs(le.percentage-W.percentage)<.5);return ne?Uf(JSON.stringify(ne.properties,null,2)):!1}}),p&&$&&d.jsx(f$e,{x:p.x,y:p.y,element:$,currentTime:m,onClose:()=>y(null),onSplit:(Y,W)=>{const J=z($,L);J&&(v==null||v(J,W))},onDelete:()=>{const Y=z($,L);Y&&(b(),w==null||w(Y))}}),O&&d.jsx(h$e,{x:O.x,y:O.y,gapWidth:O.gapWidth,canCloseGap:O.canCloseGap,canCloseAllGaps:O.canCloseAllGaps,hasAnyGaps:O.hasAnyGaps,onClose:k,onCloseGap:E,onCloseAllGaps:T,onHoverAction:N})]})}function g$e({ppsRef:t,fitPpsRef:e,onMoveElement:n,onMoveElements:r,onResizeElement:i,onResizeElements:s,onFileDrop:a,onAssetDrop:o,onBlockDrop:l,onCompositionDrop:c}){const u=ue(E=>E.pinTimelineZoom),f=x.useCallback(()=>{u(t.current,e.current)},[u,t,e]),h=x.useRef(null),p=x.useMemo(()=>n&&((...E)=>(f(),n(...E))),[n,f]),y=x.useMemo(()=>r&&((...E)=>(f(),r(...E))),[r,f]),m=x.useMemo(()=>i&&((...E)=>(f(),i(...E))),[i,f]),v=x.useMemo(()=>s&&((...E)=>(f(),s(...E))),[s,f]),b=x.useMemo(()=>a&&((...E)=>(f(),a(...E))),[a,f]),w=x.useMemo(()=>o&&((...E)=>(f(),o(...E))),[o,f]),O=x.useMemo(()=>l&&((...E)=>(f(),l(...E))),[l,f]),k=x.useMemo(()=>c&&((...E)=>(f(),c(...E))),[c,f]);return{pinZoomBeforeEdit:f,setRangeSelectionRef:h,pinnedOnMoveElement:p,pinnedOnMoveElements:y,pinnedOnResizeElement:m,pinnedOnResizeElements:v,pinnedOnFileDrop:b,pinnedOnAssetDrop:w,pinnedOnBlockDrop:O,pinnedOnCompositionDrop:k}}const EF=Rc("StudioShellContext",null),TF=Rc("StudioPlaybackContext",null);function Gl(){const t=x.useContext(EF);if(!t)throw new Error("useStudioShellContext must be used within StudioShellProvider");return t}function PF(){return x.useContext(EF)}function wy(){const t=x.useContext(TF);if(!t)throw new Error("useStudioPlaybackContext must be used within StudioPlaybackProvider");return t}function y$e(){return x.useContext(TF)}function x$e({value:t,children:e}){const{projectId:n,activeCompPath:r,setActiveCompPath:i,showToast:s,previewIframeRef:a,editHistory:o,writeBlockedReason:l,handleUndo:c,handleRedo:u,renderQueue:f,compositionDimensions:h,waitForPendingDomEditSaves:p,handlePreviewIframeRef:y}=t,m=x.useMemo(()=>({projectId:n,activeCompPath:r,setActiveCompPath:i,showToast:s,previewIframeRef:a,editHistory:o,writeBlockedReason:l,handleUndo:c,handleRedo:u,renderQueue:f,compositionDimensions:h,waitForPendingDomEditSaves:p,handlePreviewIframeRef:y}),[n,r,h,o,f,i,s,a,l,c,u,p,y]);return d.jsx(EF,{value:m,children:e})}function b$e({value:t,children:e}){const{captionEditMode:n,compositionLoading:r,refreshKey:i,setRefreshKey:s,timelineElements:a,isPlaying:o,refreshPreviewDocumentVersion:l}=t,c=x.useMemo(()=>({captionEditMode:n,compositionLoading:r,refreshKey:i,setRefreshKey:s,timelineElements:a,isPlaying:o,refreshPreviewDocumentVersion:l}),[n,r,i,a,o,s,l]);return d.jsx(TF,{value:c,children:e})}function v$e(t){var e;try{const n=(e=t.ownerDocument)==null?void 0:e.defaultView;if(!n)return!0;const r=n.getComputedStyle(t);if(r.display==="none"||r.visibility==="hidden"||r.visibility==="collapse")return!1;const i=Number.parseFloat(r.opacity);return!(Number.isFinite(i)&&i<=.01&&!t.hasAttribute(JE))}catch{return!0}}function gW(t){if(!t||t==="auto")return 0;const e=parseInt(t,10);return Number.isFinite(e)?e:0}function i3(t){var r;const e=Ej(t);if(e!=null)return e;const n=t.style.zIndex;if(n&&n!=="auto")return gW(n);try{const i=(r=t.ownerDocument)==null?void 0:r.defaultView;if(i)return gW(i.getComputedStyle(t).zIndex)}catch{}return 0}function tde(t){var n;const e=(n=t.ownerDocument)==null?void 0:n.defaultView;return e&&t instanceof e.HTMLElement?!0:t.nodeType===1}const A$e=new Set(["AUDIO","SCRIPT","STYLE","LINK","META","TEMPLATE","NOSCRIPT"]);function S$e(t){return tde(t)&&!A$e.has(t.tagName)}function nde(t){const e=t.parentElement;if(!e)return{entries:[],targetIndex:-1};const n=[];let r=-1,i=0;for(const s of Array.from(e.children))s!==t&&!S$e(s)||tde(s)&&(s===t&&(r=n.length),n.push({element:s,zIndex:i3(s),domIndex:i}),i+=1);return{entries:n,targetIndex:r}}function w$e(t,e){return t.lefte.left&&t.tope.top}function O$e(t,e,n){const r=e.filter(a=>a.element===t||n(a.element));let i;try{i=t.getBoundingClientRect()}catch{return r}if(i.width===0&&i.height===0)return r;const s={left:i.left,top:i.top,right:i.right,bottom:i.bottom};return r.filter(a=>{if(a.element===t)return!0;try{const o=a.element.getBoundingClientRect();return w$e(s,{left:o.left,top:o.top,right:o.right,bottom:o.bottom})}catch{return!1}})}function MF(t){return[...t].sort((e,n)=>e.zIndex-n.zIndex||e.domIndex-n.domIndex)}function C$e(t,e){if(t&&e)return e.zIndex-t.zIndex>=2?t.zIndex+1:null;if(t)return t.zIndex+1;if(e){const n=Math.max(0,e.zIndex-1);return n>=e.zIndex?null:n}return null}function rde(t,e,n,r){const i=e.findIndex(l=>l.element===n);if(i===-1)return null;const s=i3(n),a=t.map(l=>l.zIndex);if(!a.some((l,c)=>a.indexOf(l)!==c)){const l=C$e(e[i-1],e[i+1]);if(l!==null)return l===s?null:[{element:n,zIndex:l}]}return k$e(t,e,n,r)}function k$e(t,e,n,r){const i=new Set(e.map(p=>p.element)),s=r.filter(p=>!i.has(p.element)),a=e.length,o=t.map(p=>p.zIndex),l=Math.min(...o),c=Math.max(...o);if(!s.some(p=>p.zIndex>=l&&p.zIndex<=c)){const p=s.filter(w=>w.zIndexw.zIndex),y=s.filter(w=>w.zIndex>c).map(w=>w.zIndex),m=p.length>0?Math.max(...p)+1:0,v=y.length>0,b=v?Math.min(...y)-a:Number.POSITIVE_INFINITY;if(m<=b){let w=Math.max(l,m);v&&(w=Math.min(w,b));const O=[];return e.forEach((k,E)=>{k.zIndex!==w+E&&O.push({element:k.element,zIndex:w+E})}),O.length===0?null:O}}const f=E$e(r,e,n),h=[];return f.forEach((p,y)=>{p.zIndex!==y&&h.push({element:p.element,zIndex:y})}),h.length===0?null:h}function E$e(t,e,n){const r=MF(t),i=r.find(f=>f.element===n),s=r.filter(f=>f.element!==n);if(!i)return s;const a=e.findIndex(f=>f.element===n),o=e[a-1],l=e[a+1],c=o?s.findIndex(f=>f.element===o.element):-1,u=l?s.findIndex(f=>f.element===l.element):-1;return c>=0?s.splice(c+1,0,i):u>=0?s.splice(u,0,i):s.unshift(i),s}function ide(t,e,n){const{entries:r}=nde(t);if(r.length<2)return null;const s=e==="bring-to-front"||e==="send-to-back"?r:O$e(t,r,v$e);if(s.length<2)return null;const a=MF(s),o=a.findIndex(l=>l.element===t);return o===-1?null:{entries:r,order:a,pos:o}}function sde(t,e,n){const r=ide(t,e);if(!r)return null;const{entries:i,order:s,pos:a}=r,o=[...s],[l]=o.splice(a,1);switch(e){case"bring-forward":if(a>=s.length-1)return null;o.splice(a+1,0,l);break;case"send-backward":if(a<=0)return null;o.splice(a-1,0,l);break;case"bring-to-front":if(a>=s.length-1)return null;o.push(l);break;case"send-to-back":if(a<=0)return null;o.unshift(l);break}return rde(s,o,t,i)}function T$e(t,e){const{entries:n}=nde(t);if(n.length<2)return null;const r=new Map(n.map(a=>[a.element,a])),i=[];for(const a of e){const o=r.get(a);if(!o)return null;i.push(o)}if(i.length<2||!i.some(a=>a.element===t))return null;const s=MF(i);return s.every((a,o)=>a.element===i[o].element)?null:rde(s,i,t,n)}function P$e(t,e,n){if(e!=="bring-forward"&&e!=="send-backward")return null;const r=ide(t,e);if(!r)return null;const{order:i,pos:s}=r,a=e==="bring-forward"?i[s+1]:i[s-1];return(a==null?void 0:a.element)??null}function M$e(t,e,n){return sde(t,e)!==null}function N$e({expandedElementsRef:t}){const e=AS(),n=PF(),r=(e==null?void 0:e.previewIframeRef)??null,i=e==null?void 0:e.handleDomZIndexReorderCommit,s=(n==null?void 0:n.activeCompPath)??null,a=x.useCallback(u=>{var h;const f=((h=r==null?void 0:r.current)==null?void 0:h.contentDocument)??null;return f?Is(f,{hfId:u.hfId,id:u.domId??u.id,selector:u.selector,selectorIndex:u.selectorIndex,sourceFile:u.sourceFile??s??"index.html"},s):null},[r,s]),o=x.useCallback(u=>{const f=a(u);return f?i3(f):Number.NaN},[a]),l=x.useCallback((u,f)=>{if(!i)return Promise.resolve();const h=u.flatMap(p=>{const y=t.current.find(v=>(v.key??v.id)===p.key),m=y&&a(y);return!y||!m?[]:[{element:m,zIndex:p.zIndex,id:y.domId??y.id,selector:y.selector,selectorIndex:y.selectorIndex,sourceFile:y.sourceFile??s??"index.html",key:p.key}]});return h.length?i(h,f).then(()=>{}):Promise.resolve()},[i,a,s,t]);return{readClipZIndex:o,applyStackingPatches:l,zSyncEnabled:!!(i&&r)}}function D$e({viewportWidth:t,effectiveDuration:e,zoomMode:n,manualZoomPercent:r,ppsRef:i,fitPpsRef:s,draggedClip:a,resizingClip:o,expandedElements:l,isDragging:c,scrollRef:u,lastScrollLeftRef:f,contentOrigin:h}){const p=I3e(t,e,h),y=BCe(p,n,r);i.current=y;const m=Math.max(0,e*y),v=a!=null&&a.started?(a.previewStart+a.element.duration)*y+HG:0,b=o!=null&&o.started?(o.previewStart+o.previewDuration)*y+HG:0,w=_3e({trackContentWidth:m,viewportWidth:t,contentOrigin:h,pps:y,dragGhostEndPx:v,resizeGhostEndPx:b}),O=y>0?w/y:e,k=x.useRef(n);k.current=n;const E=x.useRef(r);return E.current=r,s.current=p,x.useEffect(()=>{if(n!=="manual"||c.current)return;const T=u.current,N=f.current;if(!T||N<=0)return;const _=requestAnimationFrame(()=>{const I=Math.max(0,T.scrollWidth-T.clientWidth),j=Math.min(N,I);Math.abs(T.scrollLeft-j)>.5&&(T.scrollLeft=j)});return()=>cancelAnimationFrame(_)},[l,n]),x.useEffect(()=>{ue.getState().setTimelineScale(y,p)},[y,p]),{pps:y,fitPps:p,displayContentWidth:w,displayDuration:O,clipStateVersion:l,zoomModeRef:k,manualZoomPercentRef:E}}function I$e(t,e){for(const r of e)t.has(r)||e.delete(r);const n=[];for(const[r,i]of t)e.has(r)||i.some(Fce)&&n.push(r);return n}function _$e(t){var i;const e=ue(s=>s.expandClips),n=((i=PF())==null?void 0:i.projectId)??null,r=x.useRef({projectId:n,source:t,clips:new Set});x.useEffect(()=>{if(r.current.projectId!==n){const a=r.current.source!==t;if(r.current={projectId:n,source:t,clips:new Set},!a)return}else r.current.source=t;const s=I$e(t,r.current.clips);if(s.length!==0){for(const a of s)r.current.clips.add(a);e(s)}},[t,e,n])}const R$e=!0,j$e=Object.freeze({scrollLeft:0,scrollTop:0,clientWidth:0,clientHeight:0,scrollWidth:0,scrollHeight:0,isScrolling:!1});function L$e(t,e){return{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop,clientWidth:t.clientWidth,clientHeight:t.clientHeight,scrollWidth:t.scrollWidth,scrollHeight:t.scrollHeight,isScrolling:e}}function F$e(t,e){const[n,r]=x.useState(j$e),[i,s]=x.useState(!0),a=x.useRef(null),o=x.useRef(0),l=x.useRef(0),c=x.useRef(null),u=x.useRef(!1),f=x.useCallback((m,v=!1)=>{u.current=v;const b=()=>{l.current=0,r(L$e(m,u.current))};if(v)l.current||(l.current=requestAnimationFrame(b));else{l.current&&cancelAnimationFrame(l.current),b();return}c.current&&clearTimeout(c.current),c.current=setTimeout(()=>{c.current=null,u.current=!1,l.current&&cancelAnimationFrame(l.current),b()},100)},[]),h=x.useCallback(()=>{const m=t.current;s(m?F3e(m.scrollHeight,m.clientHeight):!0)},[t]),p=x.useCallback(()=>{o.current&&cancelAnimationFrame(o.current),o.current=requestAnimationFrame(()=>{o.current=0,h()})},[h]),y=x.useCallback(m=>{if(a.current&&(a.current.disconnect(),a.current=null),t.current=m,!m){c.current&&clearTimeout(c.current),c.current=null,u.current=!1;return}const v=()=>{f(m,u.current),p()};v(),a.current=new ResizeObserver(v),a.current.observe(m)},[t,p,f]);return Or(()=>()=>{var m;(m=a.current)==null||m.disconnect(),o.current&&cancelAnimationFrame(o.current),l.current&&cancelAnimationFrame(l.current),c.current&&clearTimeout(c.current)}),x.useEffect(()=>{h()},[h,...e]),{viewport:n,showShortcutHint:i,setScrollRef:y,syncScrollViewport:f}}function $$e(t){const e=fS(),{onMoveElement:n,onMoveElements:r,onResizeElement:i,onResizeElements:s,onBlockedEditAttempt:a,onSplitElement:o}=t;return x.useMemo(()=>({...e,onMoveElement:n??e.onMoveElement,onMoveElements:r??e.onMoveElements,onResizeElement:i??e.onResizeElement,onResizeElements:s??e.onResizeElements,onBlockedEditAttempt:a??e.onBlockedEditAttempt,onSplitElement:o??e.onSplitElement}),[e,n,r,i,s,a,o])}const s3=.001,Fg=t=>t.key??t.id;function gA(t){return Math.max(0,...t.map(e=>e.expandedParentStart??0))}const ade=t=>Math.round(t*1e3)/1e3,hC=t=>t.start+t.duration;function a3(t){return[...t].sort((e,n)=>e.start-n.start||Fg(e).localeCompare(Fg(n)))}function $_(t,e,n=s3,r=0){const i=a3(t);if(i.some(c=>e>=c.start-n&&ec.start>e-n);if(a.length===0)return null;const o=a[0].start,l=Math.max(r,...i.filter(c=>c.start<=e-n).map(c=>hC(c)));return o-l<=n?null:{gapStart:l,gapEnd:o,followingKeys:a.map(Fg)}}function ode(t,e=s3,n=0){const r=[];let i=n;for(const s of a3(t))s.start-i>e&&r.push({start:i,end:s.start}),i=Math.max(i,hC(s));return r}function lde(t,e=s3,n=0){const r=[];let i=n;for(const s of a3(t)){const a=ade(i);Math.abs(a-s.start)>e&&r.push({key:Fg(s),newStart:a}),i+=s.duration}return r}function B$e(t,e,n=s3,r=0){const i=ode(t,n,r),s=Math.max(r,...t.map(hC));return e-s>n&&i.push({start:s,end:e}),i}function cde(t,e){const n=e.gapEnd-e.gapStart,r=new Set(e.followingKeys);return a3(t).filter(i=>r.has(Fg(i))).map(i=>({key:Fg(i),newStart:Math.max(e.gapStart,ade(i.start-n))}))}const ude=t=>t.key??t.id;let V$e=0;function B_(t,e){const n=new Map(t.map(r=>[ude(r),r]));return e.every(r=>{const i=n.get(r.key);return i!=null&&lS(i).canMove})}function H$e(t,e){if(e.length===0||!B_(t,e))return null;const n=new Map(t.map(r=>[ude(r),r]));return e.map(r=>{const i=n.get(r.key);return{element:i,updates:{start:r.newStart,track:i.track}}})}function fde(t,e,n){const r=H$e(t,e);return r?(xd(r,n,`track-gap-close:${V$e++}`),!0):!1}function Q$e(t,e,n){const r=$_(t,e,void 0,gA(t));return r?fde(t,cde(t,r),n):!1}function z$e(t,e){return fde(t,lde(t,void 0,gA(t)),e)}function Z$e({tracks:t,expandedElementsRef:e,trackOrderRef:n,onMoveElement:r,onMoveElements:i}){const s=ue(w=>w.updateElement),a=ue(w=>w.timelineSessionEpoch),[o,l]=x.useState(null),[c,u]=x.useState(null),f=x.useMemo(()=>{var w;return(o==null?void 0:o.sessionEpoch)===a?((w=t.find(([O])=>O===o.track))==null?void 0:w[1])??[]:null},[o,a,t]),h=x.useMemo(()=>{if(!o||!f)return null;const w=gA(f),O=$_(f,o.time,void 0,w),k=lde(f,void 0,w);return{x:o.x,y:o.y,gapWidth:O?O.gapEnd-O.gapStart:null,canCloseGap:O!=null&&B_(f,cde(f,O)),hasAnyGaps:k.length>0,canCloseAllGaps:k.length>0&&B_(f,k)}},[o,f]),p=x.useMemo(()=>{if(!o||!f||!c)return null;const w=gA(f);if(c==="close-gap"){const k=$_(f,o.time,void 0,w);return k?{track:o.track,intervals:[{start:k.gapStart,end:k.gapEnd}]}:null}const O=ode(f,void 0,w);return O.length>0?{track:o.track,intervals:O}:null},[o,f,c]),y=x.useCallback(()=>{!o||!f||o.sessionEpoch!==ue.getState().timelineSessionEpoch||Q$e(f,o.time,{elements:e.current,trackOrder:n.current,updateElement:s,onMoveElement:r,onMoveElements:i})},[o,f,e,n,s,r,i]),m=x.useCallback(()=>{!o||!f||o.sessionEpoch!==ue.getState().timelineSessionEpoch||z$e(f,{elements:e.current,trackOrder:n.current,updateElement:s,onMoveElement:r,onMoveElements:i})},[o,f,e,n,s,r,i]),v=x.useCallback(w=>{u(null),l({...w,sessionEpoch:ue.getState().timelineSessionEpoch})},[]),b=x.useCallback(()=>{u(null),l(null)},[]);return x.useEffect(()=>{o&&o.sessionEpoch!==a&&b()},[b,o,a]),{gapMenuModel:h,gapHighlight:p,setHoveredGapAction:u,openGapMenu:v,dismissGapMenu:b,closeTrackGap:y,closeAllTrackGaps:m}}function G$e(t,e){return e.size===0||e.size===1&&e.has(t)}function U$e(t){var c;const{selectedElementId:e,selectedElementIds:n,expandedElements:r,tracks:i,gapHighlight:s}=t;if(!e||!G$e(e,n))return null;const a=r.find(u=>(u.key??u.id)===e);if(!a||a.track===(s==null?void 0:s.track))return null;const o=((c=i.find(([u])=>u===a.track))==null?void 0:c[1])??[],l=B$e(o,t.displayDuration,void 0,gA(o));return l.length>0?{track:a.track,intervals:l,kind:"selected"}:null}function X$e(t){if(t.dragActive)return[];const e=[];t.gapHighlight&&t.gapHighlight.intervals.length>0&&e.push({...t.gapHighlight,kind:"hover"});const n=U$e(t);return n&&e.push(n),e}function W$e(t){const{gapHighlight:e,tracks:n,selectedElementId:r,selectedElementIds:i,expandedElements:s,dragActive:a,displayDuration:o}=t;return x.useMemo(()=>X$e({gapHighlight:e,tracks:n,selectedElementId:r,selectedElementIds:i,expandedElements:s,dragActive:a,displayDuration:o}),[e,n,r,i,s,a,o])}function q$e({active:t,scrollRef:e,contentOrigin:n,pixelsPerSecond:r,onSplitAll:i}){const[s,a]=x.useState(null),o=x.useCallback(u=>{const f=e.current;if(!t||!f)return;const h=f.getBoundingClientRect();a(u.clientX-h.left+f.scrollLeft)},[t,e]),l=x.useCallback(()=>a(null),[]),c=x.useCallback(u=>{const f=e.current;if(!t||!u.shiftKey||u.button!==0||!f)return!1;const h=f.getBoundingClientRect(),p=CE({clientX:u.clientX,rectLeft:h.left,scrollLeft:f.scrollLeft,contentOrigin:n});return i==null||i(Math.max(0,p/r)),!0},[t,n,i,r,e]);return{razorGuideX:s,updateRazorGuide:o,clearRazorGuide:l,splitAllAtPointer:c}}function Y$e({x:t}){return d.jsx("div",{className:"absolute top-0 bottom-0 pointer-events-none z-10",style:{left:t,width:1,background:"rgba(239,68,68,0.7)"}})}const K$e=400,J$e=6e4;function yW(t,e){if(t.length===0)return;const n=[...t].sort((i,s)=>i-s),r=Math.min(n.length-1,Math.ceil(n.length*e)-1);return Number(n[Math.max(0,r)].toFixed(2))}function eBe(t,e,n,r){const i=yW(n,.95);if(i===void 0)return null;const s=yW(r,.95);return{total_clip_count:e.totalClipCount,mounted_clip_count:t.querySelectorAll('[data-clip="true"]').length,total_row_count:e.totalRowCount,timeline_dom_node_count:t.querySelectorAll("*").length,viewport_width:t.clientWidth,viewport_height:t.clientHeight,zoom_mode:e.zoomMode,scroll_sample_count:n.length,scroll_frame_latency_p95_ms:i,scroll_frame_latency_max_ms:Number(Math.max(...n).toFixed(2)),...s===void 0?{}:{frame_interval_p95_ms:s}}}function xW(t){t.previousFrameAt=null,t.frameLatencies=[],t.frameIntervals=[]}function tBe(t){const e=x.useRef({frameRequest:0,idleTimer:null,pendingScrollStartedAt:0,previousFrameAt:null,frameLatencies:[],frameIntervals:[],lastEmittedAt:Number.NEGATIVE_INFINITY}),n=r=>{const i=e.current,s=performance.now();i.frameRequest===0&&(i.pendingScrollStartedAt=s,i.frameRequest=requestAnimationFrame(a=>{i.frameRequest=0,i.frameLatencies.push(performance.now()-i.pendingScrollStartedAt),i.previousFrameAt!==null&&i.frameIntervals.push(a-i.previousFrameAt),i.previousFrameAt=a})),i.idleTimer!==null&&clearTimeout(i.idleTimer),i.idleTimer=setTimeout(()=>{if(i.idleTimer=null,i.frameRequest!==0){cancelAnimationFrame(i.frameRequest),i.frameRequest=0,xW(i);return}const a=performance.now();if(a-i.lastEmittedAt>=J$e){const o=eBe(r,t,i.frameLatencies,i.frameIntervals);o&&(x8e(o),i.lastEmittedAt=a)}xW(i)},K$e)};return Or(()=>()=>{const r=e.current;r.frameRequest!==0&&cancelAnimationFrame(r.frameRequest),r.idleTimer!==null&&clearTimeout(r.idleTimer)}),{recordTimelineScroll:n}}function nBe(t){return Array.from(t.values()).some(e=>e.some(Fce))}function rBe(t,e){return nBe(t)||e.some(n=>!!n.audioGroup)}function hde(t,e){const n=Number.isFinite(t)?t:0;if(e.length===0)return n;const r=Math.max(n,...e.map(i=>i.start+i.duration));return Number.isFinite(r)?r:n}function iBe(t,e){var i;const n=Zn(t),r=(i=e==null?void 0:e.groupPreview)==null?void 0:i.find(s=>s.key===n);return r?{...t,...r}:e&&Zn(e.element)===n?{...t,start:e.previewStart,duration:e.previewDuration,playbackStart:e.previewPlaybackStart}:t}function sBe(t,e,n,r){const i=x.useMemo(()=>t.find(o=>Zn(o)===e)??null,[t,e]),s=x.useRef(i);s.current=i;const a=x.useRef(s.current);x.useEffect(()=>{const o=a.current,l=s.current;a.current=l,o&&!l&&(n(!1),r())})}function aBe(){const[t,e]=x.useState(!1);return Or(()=>{const n=i=>i.key==="Shift"&&e(i.type==="keydown"),r=()=>e(!1);return window.addEventListener("keydown",n),window.addEventListener("keyup",n),window.addEventListener("blur",r),()=>{window.removeEventListener("keydown",n),window.removeEventListener("keyup",n),window.removeEventListener("blur",r)}}),t}function oBe(t,e,n,r){const i=n==="frame"?Qd:void 0;return{...x.useMemo(()=>z5e(t,e,i,r),[t,i,e,r]),majorTickInterval:Jae(t,e,i)}}const OM=1024*1024,lBe=1440*60*1e3,tl=Object.freeze({directScrollSafetyPx:8e6,rowOverscanPerSide:2,timeOverscanViewportRatio:.25,maxMountedRows:64,maxMountedClipRoots:512,maxMountedClipRootsPerRow:128,maxMountedTimelineDescendants:5e3,posterMaxPhysicalWidth:240,posterMaxPhysicalHeight:135,posterDprCap:1.5,richPreviewFrameCount:6,concurrentVideoDecodes:2,concurrentMetadataJobs:4,concurrentCompositionFetches:2,concurrentServerPages:1,thumbnailLoadTimeoutMs:3e4,thumbnailCacheBytes:64*OM,thumbnailCacheEntries:256,thumbnailCacheEntriesPerProject:96,metadataRegistryEntries:512,metadataFailureTtlMs:3e4,waveformCacheBytes:16*OM,waveformCacheEntries:256,compositionDiskCacheBytes:512*OM,compositionDiskCacheMaxAgeMs:14*lBe,interactionP95Ms:50,frameIntervalP95Ms:33.3,constrainedInteractionP95Ms:75,constrainedFrameIntervalP95Ms:75,longTaskLimitMs:50,constrainedLongTaskLimitMs:300,memoryReturnToleranceRatio:.15,posterColdP95Ms:750,posterCachedP95Ms:250,constrainedPosterColdP95Ms:1200,constrainedPosterCachedP95Ms:400,posterCoverageRatio:.9,posterCoverageSettleMs:1500,constrainedPosterCoverageSettleMs:2500,richPreviewP95Ms:750,constrainedRichPreviewP95Ms:1200,supportedFixtureFallbackRatio:.02,scrollSamplesPerRun:21,warmupRuns:3,measuredRuns:5,requiredPassingRuns:4});function cBe(t,e,n,r){if(!(e>0)||!(r>0)||!(t.clientWidth>0))return{start:0,end:0};const i=t.clientWidth*tl.timeOverscanViewportRatio,s=t.scrollLeft-n-i,a=t.scrollLeft+t.clientWidth-n+i;return{start:Math.min(r,Math.max(0,s/e)),end:Math.min(r,Math.max(0,a/e))}}function uBe(t,e,n,r){if(!(e>0)||!(r>0))return{start:0,end:0};const i=Math.max(0,(t.scrollLeft-n)/e),s=Math.min(r,Math.max(i,(t.scrollLeft+t.clientWidth-n)/e));return{start:Math.min(i,r),end:s}}function fBe(t,e,n){const r=t.getRowPositionFromY(n+Ra);if(r.row<0||r.row>=t.rowKeys.length)return n;const i=t.rowKeys[r.row];if(i===void 0)return n;const s=e.getRowIndex(i);return s<0?n:Math.max(0,n+e.getRowTop(s)-t.getRowTop(r.row))}function hBe({tracks:t,viewport:e,pixelsPerSecond:n,contentOrigin:r,duration:i,selectedElementId:s,draggedElementId:a,resizingElementIds:o,focusedElementId:l,focusedEaseElementId:c,clipContextMenuElementId:u,keyframeContextMenuElementId:f}){const h=x.useMemo(()=>l5e(t),[t]),p=x.useMemo(()=>cBe(e,n,r,i),[r,i,n,e]),y=x.useMemo(()=>uBe(e,n,r,i),[r,i,n,e]),m=x.useMemo(()=>new Set([s,a,...o??[],l,c,u,f].filter(v=>v!==void 0)),[u,a,c,l,f,o,s]);return{clipIndex:h,renderTimeRange:p,visibleTimeRange:y,pinnedClipIdentities:m}}function dBe(){var e;const t=(e=y$e())==null?void 0:e.setRefreshKey;return x.useCallback(()=>t==null?void 0:t(n=>n+1),[t])}const r8=12;function bW(t,e,n,r,i){const s=t+n+r8,a=t+e-r8,o=a-s;return o<=0||r>=s&&i<=a?null:i-r>o||rn.removeAttribute("data-reveal-highlight"),{once:!0}),!0)):!1}function gBe(t,e,n,r,i,s,a){const o=r.getRowIndex(e.row.physicalTrackKey);if(o<0)return!1;const l=e.target.kind==="row"?e.row.elementId:e.target.elementId,c=l?n.find(m=>(m.key??m.id)===l):void 0,u=e.target.kind==="row"?null:e.target.time,f=c&&e.target.kind==="clip"?c.start:u,h=c&&e.target.kind==="clip"?c.start+c.duration:u,p=r.getRowTop(o),y=pBe({scrollLeft:t.scrollLeft,scrollTop:t.scrollTop,viewportWidth:t.clientWidth,viewportHeight:t.clientHeight,clipLeft:s+(f??0)*i,clipRight:s+(h??0)*i,clipTop:p+ha,clipBottom:p+r.getRowHeight(o)-ha,stickyLeft:s,stickyTop:Ra,allowHorizontal:a&&f!==null});return y.left!==null&&(t.scrollLeft=y.left),y.top!==null&&(t.scrollTop=y.top),y.left!==null||y.top!==null}function yBe({scrollRef:t,logicalRows:e,elements:n,rowGeometry:r,pixelsPerSecond:i,contentOrigin:s,allowHorizontal:a,viewportVersion:o,projectId:l,sessionEpoch:c,syncScrollViewport:u}){const f=ue(b=>b.timelineFocus),h=x.useRef(e),p=x.useRef(null),y=x.useRef(null),m=x.useMemo(()=>{var b;if(vW(f,l,c)){((b=p.current)==null?void 0:b.nonce)!==f.nonce&&(p.current={nonce:f.nonce,id:f.id});const w=p.current.id;let O=El(e,w);if(!O){const k=vFe(h.current,e,w);k&&(p.current={nonce:f.nonce,id:k.id},O=El(e,k.id))}return O?{target:O.target,row:O.row}:null}return p.current=null,null},[e,l,f,c]);x.useLayoutEffect(()=>{h.current=e},[e]),x.useEffect(()=>{var w;if(!vW(f,l,c))return;if(!m){ue.getState().clearTimelineFocus(f.nonce);return}if(m.target.id!==f.id){ue.getState().requestTimelineFocus(m.target.id);return}if(((w=y.current)==null?void 0:w.nonce)===f.nonce&&y.current.id===m.target.id)return;const b=t.current;b&&(gBe(b,m,n,r,i,s,a)&&u(b),mBe(b,m.target.id)&&(y.current={nonce:f.nonce,id:m.target.id}))},[a,s,n,i,l,f,m,r,t,c,u,o]);const v=m?m.target.kind==="row"?m.row.elementId??void 0:m.target.elementId:void 0;return{focusedTargetId:(m==null?void 0:m.target.id)??null,focusedRowKey:m==null?void 0:m.row.physicalTrackKey,pinnedElementId:v}}function xBe({tracks:t,displayTrackOrder:e,laneCounts:n,selectedElementId:r,selectedElementIds:i,expandedClipIds:s,collapsedGroupIds:a,expandedLaneOwnerIds:o,groups:l,trackGroupOf:c,gsapAnimations:u}){return x.useMemo(()=>yFe({tracks:t,displayTrackOrder:e,laneCounts:n,selectedElementId:r,selectedElementIds:i,expandedClipIds:s,collapsedGroupIds:a,expandedLaneOwnerIds:o,groups:l,trackGroupOf:c,gsapAnimations:u}),[e,s,a,o,l,c,u,n,r,i,t])}function AW(t,e){if(!e)return null;const n=y0(t).byKey.get(e);return n?{elementId:e,rowKey:n.track}:null}function bBe(t,e,n){const r=new Array(t);return new Proxy(r,{get(i,s,a){if(typeof s=="string"){const o=s.charCodeAt(0);if(o>=48&&o<=57){const l=+s;if(Number.isInteger(l)&&l>=0&&lr[u]!==c))&&(r=o,i=e(...o),n!=null&&n.onChange&&!(s&&n.skipInitialOnChange)&&n.onChange(i),s=!1),i}return a.updateDeps=o=>{r=o},a}function SW(t,e){if(t===void 0)throw new Error("Unexpected undefined");return t}const vBe=(t,e)=>Math.abs(t-e)<1.01,ABe=(t,e,n)=>{let r;return function(...i){t.clearTimeout(r),r=t.setTimeout(()=>e.apply(this,i),n)}};let tb;const CM=()=>{if(tb!==void 0)return tb;if(typeof navigator>"u")return tb=!1;if(/iP(hone|od|ad)/.test(navigator.userAgent))return tb=!0;const t=navigator.maxTouchPoints;return tb=navigator.platform==="MacIntel"&&t!==void 0&&t>0},wW=t=>{const{offsetWidth:e,offsetHeight:n}=t;return{width:e,height:n}},SBe=t=>t,dde=t=>{const e=Math.max(t.startIndex-t.overscan,0),r=Math.min(t.endIndex+t.overscan,t.count-1)-e+1,i=new Array(r);for(let s=0;s{const n=t.scrollElement;if(!n)return;const r=t.targetWindow;if(!r)return;const i=a=>{const{width:o,height:l}=a;e({width:Math.round(o),height:Math.round(l)})};if(i(wW(n)),!r.ResizeObserver)return()=>{};const s=new r.ResizeObserver(a=>{const o=()=>{const l=a[0];if(l!=null&&l.borderBoxSize){const c=l.borderBoxSize[0];if(c){i({width:c.inlineSize,height:c.blockSize});return}}i(wW(n))};t.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(o):o()});return s.observe(n,{box:"border-box"}),()=>{s.unobserve(n)}},dC={passive:!0},OBe=typeof window>"u"?!0:"onscrollend"in window,CBe=(t,e,n)=>{const r=t.scrollElement;if(!r)return;const i=t.targetWindow;if(!i)return;const s=t.options.useScrollendEvent&&OBe;let a=0;const o=s?null:ABe(i,()=>e(a,!1),t.options.isScrollingResetDelay),l=f=>()=>{a=n(r),o==null||o(),e(a,f)},c=l(!0),u=l(!1);return r.addEventListener("scroll",c,dC),s&&r.addEventListener("scrollend",u,dC),()=>{r.removeEventListener("scroll",c),s&&r.removeEventListener("scrollend",u)}},kBe=(t,e)=>CBe(t,e,n=>{const{horizontal:r,isRtl:i}=t.options;return r?n.scrollLeft*(i&&-1||1):n.scrollTop}),EBe=(t,e,n)=>{if(n.options.useCachedMeasurements){const r=n.indexFromElement(t),i=n.options.getItemKey(r);return n.itemSizeCache.get(i)??n.options.estimateSize(r)}if(e!=null&&e.borderBoxSize){const r=e.borderBoxSize[0];if(r)return Math.round(r[n.options.horizontal?"inlineSize":"blockSize"])}if(!e){const r=n.indexFromElement(t),i=n.options.getItemKey(r),s=n.itemSizeCache.get(i);if(s!==void 0)return s}return t[n.options.horizontal?"offsetWidth":"offsetHeight"]},TBe=(t,{adjustments:e=0,behavior:n},r)=>{var i,s;(s=(i=r.scrollElement)==null?void 0:i.scrollTo)==null||s.call(i,{[r.options.horizontal?"left":"top"]:t+e,behavior:n})},PBe=TBe;class MBe{constructor(e){this.unsubs=[],this.scrollElement=null,this.targetWindow=null,this.isScrolling=!1,this.scrollState=null,this.measurementsCache=[],this._flatMeasurements=null,this.itemSizeCache=new Map,this.itemSizeCacheVersion=0,this.laneAssignments=new Map,this.pendingMin=null,this.prevLanes=void 0,this.lanesChangedFlag=!1,this.lanesSettling=!1,this.pendingScrollAnchor=null,this.scrollRect=null,this.scrollOffset=null,this.scrollDirection=null,this.scrollAdjustments=0,this._iosDeferredAdjustment=0,this._iosTouching=!1,this._iosJustTouchEnded=!1,this._iosTouchEndTimerId=null,this._intendedScrollOffset=null,this.elementsCache=new Map,this.now=()=>{var n,r,i;return((i=(r=(n=this.targetWindow)==null?void 0:n.performance)==null?void 0:r.now)==null?void 0:i.call(r))??Date.now()},this.observer=(()=>{let n=null;const r=()=>n||(!this.targetWindow||!this.targetWindow.ResizeObserver?null:n=new this.targetWindow.ResizeObserver(i=>{i.forEach(s=>{const a=()=>{const o=s.target,l=this.indexFromElement(o);if(!o.isConnected){this.observer.unobserve(o);for(const[c,u]of this.elementsCache)if(u===o){this.elementsCache.delete(c);break}return}this.shouldMeasureDuringScroll(l)&&this.resizeItem(l,this.options.measureElement(o,s,this))};this.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(a):a()})}));return{disconnect:()=>{var i;(i=r())==null||i.disconnect(),n=null},observe:i=>{var s;return(s=r())==null?void 0:s.observe(i,{box:"border-box"})},unobserve:i=>{var s;return(s=r())==null?void 0:s.unobserve(i)}}})(),this.range=null,this.setOptions=n=>{var r,i;const s={debug:!1,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:!1,getItemKey:SBe,rangeExtractor:dde,onChange:()=>{},measureElement:EBe,initialRect:{width:0,height:0},scrollMargin:0,gap:0,indexAttribute:"data-index",initialMeasurementsCache:[],lanes:1,anchorTo:"start",followOnAppend:!1,scrollEndThreshold:1,isScrollingResetDelay:150,enabled:!0,isRtl:!1,useScrollendEvent:!1,useAnimationFrameWithResizeObserver:!1,laneAssignmentMode:"estimate",useCachedMeasurements:!1};for(const h in n){const p=n[h];p!==void 0&&(s[h]=p)}const a=this.options;let o=null,l=null,c=!1;if(a!==void 0&&a.enabled&&s.enabled&&s.anchorTo==="end"&&this.scrollElement!==null){const h=a.count,p=s.count,y=this.getMeasurements(),m=h>0?((r=y[0])==null?void 0:r.key)??a.getItemKey(0):null,v=h>0?((i=y[h-1])==null?void 0:i.key)??a.getItemKey(h-1):null;if(p!==h||h>0&&p>0&&(s.getItemKey(0)!==m||s.getItemKey(p-1)!==v)){c=!0;const O=h>0?this.getVirtualItemForOffset(this.getScrollOffset())??y[0]:null;O&&(o=[O.key,this.getScrollOffset()-O.start]);const k=s.followOnAppend===!0?"auto":s.followOnAppend||null;k&&p>h&&this.isAtEnd(a.scrollEndThreshold)&&(h===0||s.getItemKey(p-1)!==v)&&(l=k)}}this.options=s,c&&(this.pendingMin=0,this.itemSizeCacheVersion++);let u=!1,f=0;if(o&&this.scrollOffset!==null){const[h,p]=o,y=this.getMeasurements(),{count:m,getItemKey:v}=this.options;let b=0;for(;b{var r,i;(i=(r=this.options).onChange)==null||i.call(r,this,n)},this.maybeNotify=Wm(()=>(this.calculateRange(),[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]),n=>{this.notify(n)},{key:!1,debug:()=>this.options.debug,initialDeps:[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]}),this.cleanup=()=>{this.unsubs.filter(Boolean).forEach(n=>n()),this.unsubs=[],this.observer.disconnect(),this.rafId!=null&&this.targetWindow&&(this.targetWindow.cancelAnimationFrame(this.rafId),this.rafId=null),this.scrollState=null,this._iosDeferredAdjustment=0,this._iosTouching=!1,this._iosJustTouchEnded=!1,this.scrollElement=null,this.targetWindow=null},this._didMount=()=>()=>{this.cleanup()},this._willUpdate=()=>{var n;const r=this.options.enabled?this.options.getScrollElement():null;if(this.scrollElement!==r){if(this.cleanup(),!r){this.maybeNotify();return}if(this.scrollElement=r,this.scrollElement&&"ownerDocument"in this.scrollElement?this.targetWindow=this.scrollElement.ownerDocument.defaultView:this.targetWindow=((n=this.scrollElement)==null?void 0:n.window)??null,this.elementsCache.forEach(s=>{this.observer.observe(s)}),this.unsubs.push(this.options.observeElementRect(this,s=>{this.scrollRect=s,this.maybeNotify()})),this.unsubs.push(this.options.observeElementOffset(this,(s,a)=>{if(a&&this._intendedScrollOffset===null&&s===this.scrollOffset)return;this._intendedScrollOffset!==null&&Math.abs(s-this._intendedScrollOffset)<1.5&&(s=this._intendedScrollOffset),this._intendedScrollOffset=null,this.scrollAdjustments=0;const o=this.getScrollOffset();this.scrollDirection=a?o===s?this.scrollDirection:o{this._iosTouching=!0,this._iosJustTouchEnded=!1,this._iosTouchEndTimerId!==null&&this.targetWindow!=null&&(this.targetWindow.clearTimeout(this._iosTouchEndTimerId),this._iosTouchEndTimerId=null)},o=()=>{this._iosTouching=!1,!(!CM()||this.targetWindow==null)&&(this._iosJustTouchEnded=!0,this._iosTouchEndTimerId=this.targetWindow.setTimeout(()=>{this._iosJustTouchEnded=!1,this._iosTouchEndTimerId=null,this._flushIosDeferredIfReady()},150))};s.addEventListener("touchstart",a,dC),s.addEventListener("touchend",o,dC),this.unsubs.push(()=>{s.removeEventListener("touchstart",a),s.removeEventListener("touchend",o),this._iosTouchEndTimerId!==null&&this.targetWindow!=null&&(this.targetWindow.clearTimeout(this._iosTouchEndTimerId),this._iosTouchEndTimerId=null)})}this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0})}const i=this.pendingScrollAnchor;if(this.pendingScrollAnchor=null,i&&this.scrollElement&&this.options.enabled){const[s,a,o,l]=i;s!==null&&!o&&(CM()&&(this.isScrolling||this._iosTouching||this._iosJustTouchEnded)?l!==0&&(this._iosDeferredAdjustment+=l):this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0})),o&&this.scrollToEnd({behavior:o})}},this._flushIosDeferredIfReady=()=>{if(this._iosDeferredAdjustment===0||this.isScrolling||this._iosTouching||this._iosJustTouchEnded)return;const n=this.getScrollOffset(),r=this.getMaxScrollOffset();if(n<0||n>r)return;const i=this._iosDeferredAdjustment;this._iosDeferredAdjustment=0,this._scrollToOffset(n,{adjustments:this.scrollAdjustments+=i,behavior:void 0})},this.rafId=null,this.getSize=()=>this.options.enabled?(this.scrollRect=this.scrollRect??this.options.initialRect,this.scrollRect[this.options.horizontal?"width":"height"]):(this.scrollRect=null,0),this.getScrollOffset=()=>this.options.enabled?(this.scrollOffset=this.scrollOffset??(typeof this.options.initialOffset=="function"?this.options.initialOffset():this.options.initialOffset),this.scrollOffset):(this.scrollOffset=null,0),this.getMeasurementOptions=Wm(()=>[this.options.count,this.options.paddingStart,this.options.scrollMargin,this.options.getItemKey,this.options.enabled,this.options.lanes,this.options.laneAssignmentMode,this.options.gap],(n,r,i,s,a,o,l,c)=>(this.prevLanes!==void 0&&this.prevLanes!==o&&(this.lanesChangedFlag=!0),this.prevLanes=o,this.pendingMin=null,{count:n,paddingStart:r,scrollMargin:i,getItemKey:s,enabled:a,lanes:o,laneAssignmentMode:l,gap:c}),{key:!1}),this.getMeasurements=Wm(()=>[this.getMeasurementOptions(),this.itemSizeCacheVersion],({count:n,paddingStart:r,scrollMargin:i,getItemKey:s,enabled:a,lanes:o,laneAssignmentMode:l,gap:c},u)=>{const f=this.itemSizeCache;if(!a)return this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),[];if(this.laneAssignments.size>n)for(const b of this.laneAssignments.keys())b>=n&&this.laneAssignments.delete(b);this.lanesChangedFlag&&(this.lanesChangedFlag=!1,this.lanesSettling=!0,this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),this.pendingMin=null),this.measurementsCache.length===0&&!this.lanesSettling&&(this.measurementsCache=this.options.initialMeasurementsCache,this.measurementsCache.forEach(b=>{this.itemSizeCache.set(b.key,b.size)}));const h=this.lanesSettling?0:this.pendingMin??0;if(this.pendingMin=null,this.lanesSettling&&this.measurementsCache.length===n&&(this.lanesSettling=!1),o===1){const b=n*2;let w=this._flatMeasurements;if(!w||w.length0&&E.set(w.subarray(0,h*2)),w=E,this._flatMeasurements=w}let O;if(h===0)O=r+i;else{const E=h-1;O=w[E*2]+w[E*2+1]+c}for(let E=h;E1){k=O;const j=y[k],L=j!==void 0?p[j]:void 0;E=L?L.end+c:r+i}else if(v===o){let j=0,L=m[0],B=y[0];for(let $=1;$this.options.debug}),this.calculateRange=Wm(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset(),this.options.lanes],(n,r,i,s)=>n.length===0||r===0?(this.range=null,null):(this.range=DBe(n,r,i,s,s===1&&this._flatMeasurements!=null?this._flatMeasurements:null),this.range),{key:!1,debug:()=>this.options.debug}),this.getVirtualIndexes=Wm(()=>{let n=null,r=null;const i=this.calculateRange();return i&&(n=i.startIndex,r=i.endIndex),this.maybeNotify.updateDeps([this.isScrolling,n,r]),[this.options.rangeExtractor,this.options.overscan,this.options.count,n,r]},(n,r,i,s,a)=>s===null||a===null?[]:n({startIndex:s,endIndex:a,overscan:r,count:i}),{key:!1,debug:()=>this.options.debug}),this.indexFromElement=n=>{const r=this.options.indexAttribute,i=n.getAttribute(r);return i?parseInt(i,10):(console.warn(`Missing attribute name '${r}={index}' on measured element.`),-1)},this.shouldMeasureDuringScroll=n=>{var r;if(!this.scrollState||this.scrollState.behavior!=="smooth")return!0;const i=this.scrollState.index??((r=this.getVirtualItemForOffset(this.scrollState.lastTargetOffset))==null?void 0:r.index);if(i!==void 0&&this.range){const s=Math.max(this.options.overscan,Math.ceil((this.range.endIndex-this.range.startIndex)/2)),a=Math.max(0,i-s),o=Math.min(this.options.count-1,i+s);return n>=a&&n<=o}return!0},this.measureElement=n=>{if(!n){this.elementsCache.forEach((a,o)=>{a.isConnected||(this.observer.unobserve(a),this.elementsCache.delete(o))});return}const r=this.indexFromElement(n),i=this.options.getItemKey(r),s=this.elementsCache.get(i);s!==n&&(s&&this.observer.unobserve(s),this.observer.observe(n),this.elementsCache.set(i,n)),(!this.isScrolling||this.scrollState)&&this.shouldMeasureDuringScroll(r)&&this.resizeItem(r,this.options.measureElement(n,void 0,this))},this.resizeItem=(n,r)=>{var i,s;if(n<0||n>=this.options.count)return;let a,o,l;const c=this._flatMeasurements;if(this.options.lanes===1&&c!==null)l=this.options.getItemKey(n),o=c[n*2],a=c[n*2+1];else{const h=this.measurementsCache[n];if(!h)return;l=h.key,o=h.start,a=h.size}const u=this.itemSizeCache.get(l)??a,f=r-u;if(f!==0){const h=this.options.anchorTo==="end"&&((i=this.scrollState)==null?void 0:i.behavior)!=="smooth"&&this.getVirtualDistanceFromEnd()<=this.options.scrollEndThreshold,p=h?this.getTotalSize():0,y=((s=this.scrollState)==null?void 0:s.behavior)!=="smooth"&&(this.shouldAdjustScrollPositionOnItemSizeChange!==void 0?this.shouldAdjustScrollPositionOnItemSizeChange(this.measurementsCache[n]??{index:n,key:l,start:o,size:a,end:o+a,lane:0},f,this):o[this.getVirtualIndexes(),this.getMeasurements()],(n,r)=>{const i=[];for(let s=0,a=n.length;sthis.options.debug}),this.getVirtualItemForOffset=n=>{const r=this.getMeasurements();if(r.length===0)return;const i=this._flatMeasurements,s=this.options.lanes===1&&i!=null,a=pde(0,r.length-1,s?o=>i[o*2]:o=>SW(r[o]).start,n);return SW(r[a])},this.getMaxScrollOffset=()=>{if(!this.scrollElement)return 0;if("scrollHeight"in this.scrollElement)return this.options.horizontal?this.scrollElement.scrollWidth-this.scrollElement.clientWidth:this.scrollElement.scrollHeight-this.scrollElement.clientHeight;{const n=this.scrollElement.document.documentElement;return this.options.horizontal?n.scrollWidth-this.scrollElement.innerWidth:n.scrollHeight-this.scrollElement.innerHeight}},this.getVirtualDistanceFromEnd=()=>Math.max(this.getTotalSize()-this.getSize()-this.getScrollOffset(),0),this.getDistanceFromEnd=()=>Math.max(this.getMaxScrollOffset()-this.getScrollOffset(),0),this.isAtEnd=(n=this.options.scrollEndThreshold)=>this.getDistanceFromEnd()<=n,this.getOffsetForAlignment=(n,r,i=0)=>{if(!this.scrollElement)return 0;const s=this.getSize(),a=this.getScrollOffset();r==="auto"&&(r=n>=a+s?"end":"start"),r==="center"?n+=(i-s)/2:r==="end"&&(n-=s);const o=this.getMaxScrollOffset();return Math.max(Math.min(o,n),0)},this.getOffsetForIndex=(n,r="auto")=>{n=Math.max(0,Math.min(n,this.options.count-1));const i=this.getSize(),s=this.getScrollOffset(),a=this.measurementsCache[n];if(!a)return;if(r==="auto")if(a.end>=s+i-this.options.scrollPaddingEnd)r="end";else if(a.start<=s+this.options.scrollPaddingStart)r="start";else return[s,r];if(r==="end"&&n===this.options.count-1)return[this.getMaxScrollOffset(),r];const o=r==="end"?a.end+this.options.scrollPaddingEnd:a.start-this.options.scrollPaddingStart;return[this.getOffsetForAlignment(o,r,a.size),r]},this.scrollToOffset=(n,{align:r="start",behavior:i="auto"}={})=>{const s=this.getOffsetForAlignment(n,r),a=this.now();this.scrollState={index:null,align:r,behavior:i,startedAt:a,lastTargetOffset:s,stableFrames:0},this._scrollToOffset(s,{adjustments:void 0,behavior:i}),this.scheduleScrollReconcile()},this.scrollToIndex=(n,{align:r="auto",behavior:i="auto"}={})=>{n=Math.max(0,Math.min(n,this.options.count-1));const s=this.getOffsetForIndex(n,r);if(!s)return;const[a,o]=s,l=this.now();this.scrollState={index:n,align:o,behavior:i,startedAt:l,lastTargetOffset:a,stableFrames:0},this._scrollToOffset(a,{adjustments:void 0,behavior:i}),this.scheduleScrollReconcile()},this.scrollBy=(n,{behavior:r="auto"}={})=>{const i=this.getScrollOffset()+n,s=this.now();this.scrollState={index:null,align:"start",behavior:r,startedAt:s,lastTargetOffset:i,stableFrames:0},this._scrollToOffset(i,{adjustments:void 0,behavior:r}),this.scheduleScrollReconcile()},this.scrollToEnd=({behavior:n="auto"}={})=>{if(this.options.count>0){this.scrollToIndex(this.options.count-1,{align:"end",behavior:n});return}this.scrollToOffset(Math.max(this.getTotalSize()-this.getSize(),0),{behavior:n})},this.getTotalSize=()=>{var n;const r=this.getMeasurements();let i;if(r.length===0)i=this.options.paddingStart;else if(this.options.lanes===1){const s=r.length-1,a=this._flatMeasurements;a!=null?i=a[s*2]+a[s*2+1]:i=((n=r[s])==null?void 0:n.end)??0}else{const s=Array(this.options.lanes).fill(null);let a=r.length-1;for(;a>=0&&s.some(o=>o===null);){const o=r[a];s[o.lane]===null&&(s[o.lane]=o.end),a--}i=Math.max(...s.filter(o=>o!==null))}return Math.max(i-this.options.scrollMargin+this.options.paddingEnd,0)},this.takeSnapshot=()=>{const n=[];if(this.itemSizeCache.size===0)return n;const r=this.getMeasurements();for(const i of r)i&&this.itemSizeCache.has(i.key)&&n.push({index:i.index,key:i.key,start:i.start,size:i.size,end:i.end,lane:i.lane});return n},this._scrollToOffset=(n,{adjustments:r,behavior:i})=>{this._intendedScrollOffset=n+(r??0),this.options.scrollToFn(n,{behavior:i,adjustments:r},this)},this.measure=()=>{this.pendingMin=null,this.itemSizeCache.clear(),this.laneAssignments.clear(),this.itemSizeCacheVersion++,this.notify(!1)},this.setOptions(e)}applyScrollAdjustment(e,n){e!==0&&(CM()&&(this.isScrolling||this._iosTouching||this._iosJustTouchEnded)?this._iosDeferredAdjustment+=e:(this._scrollToOffset(this.getScrollOffset(),{adjustments:this.scrollAdjustments+=e,behavior:n}),this.scrollOffset!==null&&(this.scrollOffset+=this.scrollAdjustments,this.scrollAdjustments=0)))}scheduleScrollReconcile(){if(!this.targetWindow){this.scrollState=null;return}this.rafId==null&&(this.rafId=this.targetWindow.requestAnimationFrame(()=>{this.rafId=null,this.reconcileScroll()}))}reconcileScroll(){if(!this.scrollState||!this.scrollElement)return;if(this.now()-this.scrollState.startedAt>5e3){this.scrollState=null;return}const r=this.scrollState.index!=null?this.getOffsetForIndex(this.scrollState.index,this.scrollState.align):void 0,i=r?r[0]:this.scrollState.lastTargetOffset,s=1,a=i!==this.scrollState.lastTargetOffset;if(!a&&vBe(i,this.getScrollOffset())){if(this.scrollState.stableFrames++,this.scrollState.stableFrames>=s){this.getScrollOffset()!==i&&this._scrollToOffset(i,{adjustments:void 0,behavior:"auto"}),this.scrollState=null;return}}else if(this.scrollState.stableFrames=0,a){const o=this.getSize()||600,l=Math.abs(i-this.getScrollOffset()),c=this.scrollState.behavior==="smooth"&&l>o;this.scrollState.lastTargetOffset=i,c||(this.scrollState.behavior="auto"),this._scrollToOffset(i,{adjustments:void 0,behavior:c?"smooth":"auto"})}this.scheduleScrollReconcile()}}const pde=(t,e,n,r)=>{for(;t<=e;){const i=(t+e)/2|0,s=n(i);if(sr)e=i-1;else return i}return t>0?t-1:0};function NBe(t,e,n){let r=0;for(;r<=e;){const i=(r+e)/2|0,s=t[i*2];if(sn)e=i-1;else return i}return r>0?r-1:0}function DBe(t,e,n,r,i){const s=t.length-1;if(t.length<=r)return{startIndex:0,endIndex:s};if(r===1&&i!==null){const c=NBe(i,s,n);let u=c;const f=n+e;for(;ut[c].start,n),l=o;if(r===1)for(;l1){const c=Array(r).fill(0);for(;lf=0&&u.some(f=>f>=n);){const f=t[o];u[f.lane]=f.start,o--}o=Math.max(0,o-o%r),l=Math.min(s,l+(r-1-l%r))}return{startIndex:o,endIndex:l}}const kM=typeof document<"u"?x.useLayoutEffect:x.useEffect;function IBe({useFlushSync:t=!0,directDomUpdates:e=!1,directDomUpdatesMode:n="transform",...r}){const i=x.useReducer(c=>c+1,0)[1],s=x.useRef({enabled:e,mode:n,container:null,lastSize:null,lastPositions:new WeakMap,prevRange:null});s.current.enabled=e,s.current.mode=n;const a=c=>{const u=s.current;if(!u.enabled||!u.container)return;const f=c.getTotalSize();if(f!==u.lastSize){u.lastSize=f;const b=c.options.horizontal?"width":"height";u.container.style[b]=`${f}px`}const h=!!c.options.horizontal,p=u.mode==="transform",y=h?"left":"top",m=c.options.scrollMargin,v=c.getVirtualItems();for(const b of v){const w=b.start-m,O=c.elementsCache.get(b.key);O&&u.lastPositions.get(O)!==w&&(u.lastPositions.set(O,w),p?O.style.transform=h?`translate3d(${w}px, 0, 0)`:`translate3d(0, ${w}px, 0)`:O.style[y]=`${w}px`)}},o={...r,onChange:(c,u)=>{var f;const h=s.current;let p=!0;if(h.enabled){a(c);const y=c.range,m=h.prevRange;p=!m||m.isScrolling!==c.isScrolling||m.startIndex!==(y==null?void 0:y.startIndex)||m.endIndex!==(y==null?void 0:y.endIndex),p&&(h.prevRange=y?{startIndex:y.startIndex,endIndex:y.endIndex,isScrolling:c.isScrolling}:null)}p&&(t&&u?Bl.flushSync(i):i()),(f=r.onChange)==null||f.call(r,c,u)}},[l]=x.useState(()=>{const c=new MBe(o);return Object.assign(c,{containerRef:u=>{const f=s.current;if(f.container=u,f.lastSize=null,u&&f.enabled){const h=c.getTotalSize();f.lastSize=h;const p=c.options.horizontal?"width":"height";u.style[p]=`${h}px`}}})});return l.setOptions(o),kM(()=>l._didMount(),[]),kM(()=>l._willUpdate()),kM(()=>{a(l)}),l}function _Be(t){return IBe({observeElementRect:wBe,observeElementOffset:kBe,scrollToFn:PBe,...t})}function RBe(t,e){const n=new Set(dde(t));for(const r of e)r>=0&&rr-i)}function jBe(t,e){const n=Math.min(t,tl.rowOverscanPerSide*2+1),r=new Set(Array.from({length:n},(i,s)=>s));for(const i of e)i>=0&&ii-s)}function LBe({enabled:t,scrollRef:e,viewport:n,rowGeometry:r,sessionEpoch:i,pinnedRowKeys:s,focusedRowKey:a}){const o=n.clientWidth>0&&n.clientHeight>0,l=x.useMemo(()=>[...new Set([...s,...a===void 0?[]:[a]].map(b=>r.getRowIndex(b)))],[a,s,r]),c=x.useCallback(b=>r.getRowHeight(b),[r]),u=x.useCallback(b=>r.rowKeys[b]??b,[r]),f=x.useCallback(b=>RBe(b,l),[l]),h=x.useCallback(()=>n.scrollTop,[n.scrollTop]),p=_Be({enabled:o,useFlushSync:!1,count:r.rowKeys.length,getScrollElement:()=>e.current,estimateSize:c,getItemKey:u,overscan:tl.rowOverscanPerSide,rangeExtractor:f,scrollMargin:Ra+r0,initialRect:{width:n.clientWidth,height:n.clientHeight},initialOffset:h});x.useEffect(()=>{var b;o&&(p.measure(),(b=e.current)==null||b.dispatchEvent(new Event("scroll")))},[t,e,i,o,p]);const y=a===void 0?-1:r.getRowIndex(a),m=y<0?0:r.getRowHeight(y);x.useEffect(()=>{o&&y>=0&&p.resizeItem(y,m)},[t,m,y,i,o,p]);const v=x.useMemo(()=>null,[t,r]);return v||(o?p.getVirtualItems().map(({index:b})=>({index:b,rowKey:r.rowKeys[b]??b})):jBe(r.rowKeys.length,l).map(b=>({index:b,rowKey:r.rowKeys[b]??b})))}function OW(t){var r;if(!(t instanceof Element))return;const e=(r=t.closest("[data-timeline-row-key]"))==null?void 0:r.dataset.timelineRowKey;if(e===void 0)return;const n=Number(e);return Number.isFinite(n)?n:void 0}function FBe({scrollRef:t,viewport:e,rowGeometry:n,sessionEpoch:r,elements:i,selectedElementId:s,focusedRowKey:a,draggedRowKey:o,resizingElementIds:l,clipContextMenuRowKey:c,keyframeContextMenuRowKey:u,lastScrollLeftRef:f,syncScrollViewport:h}){const p=R$e,[y,m]=x.useState(),v=x.useCallback(_=>{m(OW(_.target))},[]),b=x.useCallback(_=>{m(OW(_.relatedTarget))},[]),w=x.useMemo(()=>AW(i,s),[i,s]),O=x.useMemo(()=>(l==null?void 0:l.map(_=>{var I;return(I=AW(i,_))==null?void 0:I.rowKey}).filter(_=>_!==void 0))??[],[i,l]),k=x.useMemo(()=>[o,...O,w==null?void 0:w.rowKey,a,c,u].filter(_=>_!==void 0),[c,o,a,u,O,w]),E=LBe({enabled:p,scrollRef:t,viewport:e,rowGeometry:n,sessionEpoch:r,pinnedRowKeys:k,focusedRowKey:y??a}),T=x.useRef(n),N=x.useRef(r);return x.useLayoutEffect(()=>{const _=t.current,I=T.current;if(N.current!==r)N.current=r,f.current=0,_&&(_.scrollLeft=0,_.scrollTop=0,h(_));else if(_&&I!==n){const j=fBe(I,n,_.scrollTop);j!==_.scrollTop&&(_.scrollTop=j,h(_))}T.current=n},[f,n,t,r,h]),{enabled:p,virtualRows:E,timelineFocusProps:{onFocus:v,onBlur:b}}}function $Be(t){const e=ue(l=>l.expandedClipIds),n=ue(l=>l.collapsedGroupIds),r=ue(l=>l.expandedLaneOwnerIds),i=ue(l=>l.timelineProjectId),s=xBe({tracks:t.tracks,displayTrackOrder:t.layout.displayTrackOrder,laneCounts:t.laneCounts,selectedElementId:t.selectedElementId,selectedElementIds:t.selectedElementIds,expandedClipIds:e,collapsedGroupIds:n,expandedLaneOwnerIds:r,groups:t.groups,trackGroupOf:t.trackGroupOf,gsapAnimations:t.gsapAnimations}),a=yBe({scrollRef:t.scrollRef,logicalRows:s,elements:t.elements,rowGeometry:t.layout.rowGeometry,pixelsPerSecond:t.pixelsPerSecond,contentOrigin:t.contentOrigin,allowHorizontal:t.allowHorizontal,viewportVersion:t.viewport,projectId:i,sessionEpoch:t.sessionEpoch,syncScrollViewport:t.syncScrollViewport}),o=FBe({scrollRef:t.scrollRef,viewport:t.viewport,rowGeometry:t.layout.rowGeometry,sessionEpoch:t.sessionEpoch,elements:t.elements,selectedElementId:t.selectedElementId,focusedRowKey:a.focusedRowKey,draggedRowKey:t.draggedRowKey,resizingElementIds:t.resizingElementIds,clipContextMenuRowKey:t.clipContextMenuRowKey,keyframeContextMenuRowKey:t.keyframeContextMenuRowKey,lastScrollLeftRef:t.lastScrollLeftRef,syncScrollViewport:t.syncScrollViewport});return{logicalRows:s,...a,rowVirtualizationActive:o.enabled,virtualRows:o.virtualRows,timelineFocusProps:o.timelineFocusProps}}const BBe=x.memo(function({onSeek:e,onDrillDown:n,renderClipContent:r,renderClipOverlay:i,onFileDrop:s,onAssetDrop:a,onBlockDrop:o,onCompositionDrop:l,onDeleteElement:c,onMoveElement:u,onMoveElements:f,onResizeElement:h,onResizeElements:p,onBlockedEditAttempt:y,onSplitElement:m,onSelectElement:v,theme:b,sessionEpoch:w=0}={}){var lt;const{onMoveElement:O,onMoveElements:k,onResizeElement:E,onResizeElements:T,onBlockedEditAttempt:N,onSplitElement:_,onRazorSplitAll:I,onDeleteKeyframe:j,onDeleteAllKeyframes:L,onMoveKeyframeToPlayhead:B,onMoveKeyframe:$}=$$e({onMoveElement:u,onMoveElements:f,onResizeElement:h,onResizeElements:p,onBlockedEditAttempt:y,onSplitElement:m}),z=x.useMemo(()=>({...Fj,...b}),[b]),Y=dBe();Hke();const W=ue(kt=>kt.elements),J=aS(),ne=Vke(),le=ue(kt=>kt.duration),ie=ue(kt=>kt.timeDisplayMode),q=ue(kt=>kt.timelineReady),F=ue(kt=>kt.selectedElementId),U=ue(kt=>kt.selectedElementIds),Z=ue(kt=>kt.focusedEaseSegment),K=ue(kt=>kt.gsapAnimations),ee=x.useMemo(()=>rBe(K,J),[K,J]),re=ee?Fo+W2:W2+E3e,Q=ee?W2:0,H=ue(kt=>kt.setSelectedElementId),se=ue(kt=>kt.currentTime),{zoomMode:fe,manualZoomPercent:be,setZoomMode:me,setManualZoomPercent:pe}=Uae(),ge=x.useRef(null),Pe=x.useRef(null),ve=x.useRef(null),xe=ue(kt=>kt.activeTool),[we,Ce]=x.useState(null),Me=x.useRef(!1),Ve=aBe(),[tt,Ze]=x.useState(!1),[qe,pt]=x.useState(null),[it,vt]=x.useState(null),Ot=x.useCallback(kt=>{Pe.current=kt},[]),Kt=x.useRef(0),qt=x.useMemo(()=>hde(le,W),[le,W]),fn=ue(kt=>kt.keyframeCache);_$e(K);const{tracks:Jt,trackStyles:Je,trackOrder:St,trackOrderRef:At,laneCounts:Ke,rowGeometry:Be,rowGeometryRef:We,groups:Ye,trackGroupOf:Zt}=q7e(J,K,F,U),Te=x.useRef(J);Te.current=J;const De=x.useRef(100),ze=x.useRef(qt);ze.current=qt;const st=x.useRef(100),{pinZoomBeforeEdit:Gt,setRangeSelectionRef:ln,pinnedOnMoveElement:Yt,pinnedOnMoveElements:Nn,pinnedOnResizeElement:Mr,pinnedOnResizeElements:mt,pinnedOnFileDrop:vn,pinnedOnAssetDrop:mn,pinnedOnBlockDrop:Tn,pinnedOnCompositionDrop:Ln}=g$e({ppsRef:De,fitPpsRef:st,onMoveElement:O,onMoveElements:k,onResizeElement:E,onResizeElements:T,onFileDrop:s,onAssetDrop:a,onBlockDrop:o,onCompositionDrop:l}),{readClipZIndex:et,applyStackingPatches:Yn,zSyncEnabled:Mt}=N$e({expandedElementsRef:Te}),{gapMenuModel:hn,gapHighlight:Ht,setHoveredGapAction:dn,openGapMenu:tr,dismissGapMenu:_n,closeTrackGap:xr,closeAllTrackGaps:nr}=Z$e({tracks:Jt,expandedElementsRef:Te,trackOrderRef:At,onMoveElement:Yt,onMoveElements:Nn}),{draggedClip:gt,setDraggedClip:rr,resizingClip:Cn,setResizingClip:Rn,blockedClipRef:xt,suppressClickRef:Ut}=s$e({scrollRef:ve,ppsRef:De,durationRef:ze,trackOrderRef:At,rowGeometryRef:We,onMoveElement:Yt,onMoveElements:Nn,onResizeElement:Mr,onResizeElements:mt,onBlockedEditAttempt:N,setShowPopover:Ze,setRangeSelectionRef:ln,readZIndex:Mt?et:void 0,onStackingPatches:Mt?Yn:void 0,refreshAfterLaneMove:Y,sessionEpoch:w}),Ct=F5e({scrollRef:ve,ppsRef:De,durationRef:ze,trackOrderRef:At,rowGeometryRef:We,contentOrigin:re,onFileDrop:vn,onAssetDrop:mn,onBlockDrop:Tn,onCompositionDrop:Ln,sessionEpoch:w}),fr=J7e(gt,St,Be),Dt=((lt=Cn==null?void 0:Cn.groupPreview)==null?void 0:lt.map(kt=>kt.key))??(Cn?[Zn(Cn.element)]:void 0),{recordTimelineScroll:wt}=tBe({totalClipCount:J.length,totalRowCount:fr.displayTrackOrder.length,zoomMode:fe}),{viewport:gn,showShortcutHint:Lt,setScrollRef:rn,syncScrollViewport:hs}=F$e(ve,[q,J.length,fr.totalH]),{pps:Fn,fitPps:ri,displayContentWidth:cn,displayDuration:kn,zoomModeRef:ir,manualZoomPercentRef:Pi}=D$e({viewportWidth:gn.clientWidth,effectiveDuration:qt,zoomMode:fe,manualZoomPercent:be,ppsRef:De,fitPpsRef:st,draggedClip:gt,resizingClip:Cn,expandedElements:J,isDragging:Me,scrollRef:ve,lastScrollLeftRef:Kt,contentOrigin:re}),Jr=$Be({scrollRef:ve,tracks:Jt,layout:fr,laneCounts:Ke,selectedElementId:F,selectedElementIds:U,groups:Ye,trackGroupOf:Zt,gsapAnimations:K,elements:J,pixelsPerSecond:Fn,contentOrigin:re,allowHorizontal:fe==="manual",viewport:gn,sessionEpoch:w,draggedRowKey:gt!=null&>.started?gt.previewTrack:void 0,resizingElementIds:Dt,clipContextMenuRowKey:it==null?void 0:it.element.track,keyframeContextMenuRowKey:qe==null?void 0:qe.element.track,lastScrollLeftRef:Kt,syncScrollViewport:hs}),Vi=ue(kt=>kt.selectedKeyframes),ds=ue(kt=>kt.toggleSelectedKeyframe),{onClickKeyframe:Nr,onSelectSegment:Qa,onShiftClickKeyframe:bi,onContextMenuKeyframe:wa}=oPe({expandedElements:J,keyframeCache:fn,onSelectElement:v,onSeek:e,setSelectedElementId:H,setKfContextMenu:pt,toggleSelectedKeyframe:ds}),{clipIndex:ft,renderTimeRange:Ae,visibleTimeRange:_e,pinnedClipIdentities:ot}=hBe({tracks:Jt,viewport:gn,pixelsPerSecond:Fn,contentOrigin:re,duration:kn,selectedElementId:F??void 0,draggedElementId:gt?Zn(gt.element):void 0,resizingElementIds:Dt,focusedElementId:Jr.pinnedElementId,focusedEaseElementId:Z==null?void 0:Z.elementId,clipContextMenuElementId:it?Zn(it.element):void 0,keyframeContextMenuElementId:qe?Zn(qe.element):void 0});lFe({scrollRef:ve,currentTime:se,clipStateVersion:Ae,elementStateVersion:J});const bt=W$e({gapHighlight:Ht,tracks:Jt,selectedElementId:F,selectedElementIds:U,expandedElements:J,dragActive:(gt==null?void 0:gt.started)===!0||Cn!=null,displayDuration:kn}),{seekFromX:en,autoScrollDuringDrag:Pn,dragScrollRaf:Br}=O5e({playheadRef:ge,scrollRef:ve,ppsRef:De,durationRef:ze,isDragging:Me,currentTime:se,zoomMode:fe,zoomModeRef:ir,manualZoomPercentRef:Pi,fitPps:ri,fitPpsRef:st,effectiveDuration:qt,pps:Fn,timelineReady:q,elementsLength:J.length,setZoomMode:me,setManualZoomPercent:pe,onSeek:e,contentOrigin:re}),{razorGuideX:lr,updateRazorGuide:vi,clearRazorGuide:ps,splitAllAtPointer:ql}=q$e({active:xe==="razor",scrollRef:ve,contentOrigin:re,pixelsPerSecond:Fn,onSplitAll:I}),{rangeSelection:Vr,setRangeSelection:As,shiftClickClipRef:Bc,marqueeRect:ju,isScrubbing:Oa,handlePointerDown:Ca,handlePointerMove:Vc,handlePointerUp:Lu,handlePointerCancel:Yl}=w5e({scrollRef:ve,ppsRef:De,effectiveDuration:qt,pps:Fn,onSeek:e,seekFromX:en,autoScrollDuringDrag:Pn,dragScrollRaf:Br,isDragging:Me,setShowPopover:Ze,elementsRef:Te,clipIndex:ft,rowGeometryRef:We,onSelectElement:v,contentOrigin:re,sessionEpoch:w});ln.current=As,sBe(J,F,Ze,()=>As(null));const{major:Kl,minor:Rs,majorTickInterval:Fu}=oBe(kn,Fn,ie,Jr.rowVirtualizationActive?Ae:void 0),Hr=x.useCallback(kt=>iBe(kt,Cn),[Cn]);return!q||J.length===0?d.jsx($5e,{isDragOver:Ct.isDragOver,onFileDrop:!!s,onDragOver:Ct.handleAssetDragOver,onDragLeave:Ct.handleAssetDragLeave,onDrop:Ct.handleAssetDrop}):d.jsxs("div",{ref:Ot,"aria-label":"Timeline","data-timeline-element-count":J.length,className:`relative border-t select-none h-full overflow-hidden ${Ct.isDragOver?"ring-1 ring-inset ring-studio-accent/60":""} ${xe==="razor"||Ve?"cursor-crosshair":"cursor-default"}`,onMouseMove:vi,onMouseLeave:ps,style:{touchAction:"pan-x pan-y",background:z.shellBackground,borderColor:z.shellBorder},children:[d.jsxs("div",{ref:rn,"data-timeline-scroll-viewport":!0,"data-timeline-auto-scroll-left-inset":ee?Fo:0,tabIndex:-1,className:`${fe==="fit"?"overflow-x-hidden":"overflow-x-auto"} overflow-y-auto h-full outline-none`,onScroll:kt=>{Kt.current=kt.currentTarget.scrollLeft,wt(kt.currentTarget),hs(kt.currentTarget,!0)},...Jr.timelineFocusProps,onDragOver:Ct.handleAssetDragOver,onDragLeave:Ct.handleAssetDragLeave,onDrop:Ct.handleAssetDrop,onPointerDown:kt=>{kt.target instanceof Element&&kt.target.closest("button, input, select, a")||ql(kt)||Ca(kt)},onPointerMove:Vc,onPointerUp:Lu,onPointerCancel:Yl,onLostPointerCapture:Yl,children:[d.jsx(VFe,{major:Kl,minor:Rs,pps:Fn,contentOrigin:re,contentGutter:Q,trackContentWidth:cn,totalH:fr.totalH,effectiveDuration:qt,majorTickInterval:Fu,rangeSelection:Vr,marqueeRect:ju,laneGapStrips:bt,theme:z,displayTrackOrder:fr.displayTrackOrder,rowHeights:fr.displayRowHeights,rowGeometry:fr.rowGeometry,virtualRows:Jr.virtualRows,logicalRows:Jr.logicalRows,focusedTargetId:Jr.focusedTargetId,rowsVirtualized:Jr.rowVirtualizationActive,clipIndex:ft,renderTimeRange:Ae,visibleTimeRange:_e,pinnedClipIdentities:ot,trackOrder:St,tracks:Jt,trackStyles:Je,groups:Ye,laneCounts:Ke,selectedElementId:F,selectedElementIds:U,hoveredClip:we,draggedClip:gt,resizingClip:Cn,isScrubbing:Oa,blockedClipRef:xt,suppressClickRef:Ut,scrollRef:ve,renderClipContent:Jr.rowVirtualizationActive&&gn.isScrolling?void 0:r,renderClipOverlay:i,playheadRef:ge,onDrillDown:n,onSelectElement:v,setHoveredClip:Ce,setShowPopover:Ze,setRangeSelection:As,setResizingClip:Rn,setDraggedClip:rr,setSelectedElementId:H,shiftClickClipRef:Bc,getPreviewElement:Hr,getTrackStyle:Qfe,keyframeCache:fn,gsapAnimations:K,selectedKeyframes:Vi,currentTime:se,onSeek:e,beatAnalysis:ne,onSelectSegment:Qa,onClickKeyframe:Nr,onShiftClickKeyframe:bi,onMoveKeyframe:$,onContextMenuKeyframe:wa,onContextMenuClip:(kt,Ai)=>{kt.preventDefault(),H(Ai.key??Ai.id),v==null||v(Ai),_n(),vt({x:kt.clientX,y:kt.clientY,element:Ai,sessionEpoch:ue.getState().timelineSessionEpoch})},onContextMenuLane:(kt,Ai,ph)=>{gt!=null&>.started||Cn||(vt(null),tr({x:kt.clientX,y:kt.clientY,track:Ai,time:ph}))}}),xe==="razor"&&lr!==null&&d.jsx(Y$e,{x:lr})]}),d.jsx(m$e,{elements:J,elementsRef:Te,theme:z,showShortcutHint:Lt,showPopover:tt,rangeSelection:Vr,setShowPopover:Ze,setRangeSelection:As,kfContextMenu:qe,setKfContextMenu:pt,onDeleteKeyframe:j,onDeleteAllKeyframes:L,onMoveKeyframeToPlayhead:B,clipContextMenu:it,setClipContextMenu:vt,currentTime:se,onSplitElement:_,pinZoomBeforeEdit:Gt,onDeleteElement:c,gapContextMenu:hn,onDismissGapContextMenu:_n,onCloseTrackGap:xr,onCloseAllTrackGaps:nr,onHoverGapAction:dn})]})}),VBe={overscan:0,visible:1,interaction:2},CW=Object.freeze({status:"idle"});function HBe(t){return t==="video"?"video":t==="composition"?"composition":"general"}function QBe(t){return t instanceof Error?t:new Error(String(t))}function TS(t){return Object.entries(t).filter(e=>e[1]!==void 0).sort(([e],[n])=>e.localeCompare(n)).map(([e,n])=>`${encodeURIComponent(e)}=${encodeURIComponent(String(n))}`).join("&")}function V_(t){return TS({project:t.projectId,session:t.sessionEpoch,request:t.key,kind:t.kind,rich:t.rich?1:0})}class zBe{constructor(e=tl,n=Date.now){Et(this,"entries",new Map);Et(this,"budgets");Et(this,"nextLeaseId",1);Et(this,"nextSequence",1);Et(this,"scrolling",!1);Et(this,"cacheBytes",0);Et(this,"waveformCacheBytes",0);Et(this,"activeByBucket",{video:0,composition:0,general:0});Et(this,"activeByKind",{video:0,image:0,composition:0,waveform:0});Et(this,"now");this.budgets=e,this.now=n}acquire(e,n){const r=V_(e);let i=this.entries.get(r);(i==null?void 0:i.state)==="error"&&i.failedAt!==void 0&&this.now()-i.failedAt>=this.budgets.metadataFailureTtlMs&&(this.deleteEntry(r,i),i=this.entries.get(r)),i||(i={request:e,scopedKey:r,state:"queued",leases:new Map,listeners:new Map,controller:null,weight:0,disposed:!1,cached:!1,lastAccess:this.nextSequence++,snapshot:Object.freeze({status:"queued"})},this.entries.set(r,i));const s=this.nextLeaseId++;i.leases.set(s,e.priority),i.listeners.set(s,n),i.lastAccess=this.nextSequence++,this.pump();let a=!1;return{updatePriority:o=>{const l=this.entries.get(r);!l||!l.leases.has(s)||(l.leases.set(s,o),l.lastAccess=this.nextSequence++,this.pump())},release:()=>{var l;if(a)return;a=!0;const o=this.entries.get(r);o&&(o.leases.delete(s),o.listeners.delete(s),o.leases.size===0&&(o.state==="queued"?this.deleteEntry(r,o):o.state==="loading"?((l=o.controller)==null||l.abort(),this.deleteEntry(r,o)):o.state==="ready"&&!o.cached&&this.deleteEntry(r,o)),this.evict())}}}getSnapshot(e){const n=this.entries.get(V_(e));return n?n.snapshot:CW}setScrolling(e){this.scrolling!==e&&(this.scrolling=e,e||this.pump())}invalidateProject(e){var n;for(const[r,i]of this.entries)i.request.projectId===e&&(i.leases.size>0||((n=i.controller)==null||n.abort(),this.deleteEntry(r,i)))}getDiagnostics(){let e=0,n=0,r=0,i=0,s=0;for(const a of this.entries.values())a.state==="queued"&&e++,a.state==="loading"&&n++,a.cached&&(a.request.kind==="waveform"?s++:i++),r+=a.leases.size;return{queued:e,active:n,leases:r,cacheEntries:i,cacheBytes:this.cacheBytes,waveformCacheEntries:s,waveformCacheBytes:this.waveformCacheBytes,activeByKind:{...this.activeByKind}}}pump(){const e=Array.from(this.entries.values()).filter(n=>n.state==="queued"&&n.leases.size>0).sort((n,r)=>this.entryPriority(r)-this.entryPriority(n)||n.lastAccess-r.lastAccess);for(const n of e){if(this.scrolling&&n.request.rich)continue;const r=HBe(n.request.kind);this.activeByBucket[r]>=this.bucketLimit(r)||this.start(n,r)}}start(e,n){e.state="loading",e.snapshot=Object.freeze({status:"loading"});const r=new AbortController;e.controller=r,this.activeByBucket[n]++,this.activeByKind[e.request.kind]++,this.notify(e),this.loadWithTimeout(e,r).then(s=>this.acceptResult(e,r,s)).catch(s=>{if(this.entries.get(e.scopedKey)===e){if(r.signal.aborted&&e.leases.size===0){this.deleteEntry(e.scopedKey,e);return}e.state="error",e.error=QBe(s),e.failedAt=this.now(),e.snapshot=Object.freeze({status:"error",error:e.error}),this.notify(e),this.evictFailures()}}).finally(()=>{e.controller===r&&(e.controller=null),this.activeByBucket[n]--,this.activeByKind[e.request.kind]--,this.pump()})}acceptResult(e,n,r){if(n.signal.aborted||this.entries.get(e.scopedKey)!==e){this.safeDispose(r.dispose);return}this.validateResult(r),e.state="ready",e.value=r.value,e.weight=r.weight,e.dispose=r.dispose,this.cacheResult(e),e.snapshot=Object.freeze({status:"ready",value:r.value}),this.notify(e),this.evict(),!e.cached&&e.leases.size===0&&this.deleteEntry(e.scopedKey,e)}validateResult(e){if(!(Number.isFinite(e.weight)&&e.weight>=0))throw this.safeDispose(e.dispose),new RangeError("Thumbnail result weight must be finite and non-negative")}cacheResult(e){const n=e.request.kind==="waveform",r=n?this.budgets.waveformCacheBytes:this.budgets.thumbnailCacheBytes;e.cached=e.weight<=r,e.cached&&(n?this.waveformCacheBytes+=e.weight:this.cacheBytes+=e.weight)}entryPriority(e){let n=-1;for(const r of e.leases.values())n=Math.max(n,VBe[r]);return n}bucketLimit(e){return e==="video"?this.budgets.concurrentVideoDecodes:e==="composition"?this.budgets.concurrentCompositionFetches:this.budgets.concurrentMetadataJobs}evict(){this.evictPartition(!1),this.evictPartition(!0)}evictPartition(e){const n=Array.from(this.entries.values()).filter(s=>s.cached&&s.request.kind==="waveform"===e),r=new Map;for(const s of n)r.set(s.request.projectId,(r.get(s.request.projectId)??0)+1);n.sort((s,a)=>s.lastAccess-a.lastAccess);let i=n.length;for(const s of n){const a=r.get(s.request.projectId)??0;this.isCacheOverBudget(e,i,a)&&(this.uncache(s),i--,r.set(s.request.projectId,a-1),s.leases.size===0&&this.deleteEntry(s.scopedKey,s))}}isCacheOverBudget(e,n,r){const i=e?this.budgets.waveformCacheEntries:this.budgets.thumbnailCacheEntries,s=e?this.budgets.waveformCacheBytes:this.budgets.thumbnailCacheBytes,a=e?this.waveformCacheBytes:this.cacheBytes,o=!e&&r>this.budgets.thumbnailCacheEntriesPerProject;return n>i||a>s||o}uncache(e){e.cached=!1,e.request.kind==="waveform"?this.waveformCacheBytes-=e.weight:this.cacheBytes-=e.weight}notify(e){for(const n of new Set(e.listeners.values()))n()}loadWithTimeout(e,n){let r;try{r=e.request.load(n.signal)}catch(i){r=Promise.reject(i)}return new Promise((i,s)=>{let a=!1;const o=setTimeout(()=>{a||(a=!0,n.abort(),s(new Error(`Thumbnail load timed out after ${this.budgets.thumbnailLoadTimeoutMs}ms`)))},this.budgets.thumbnailLoadTimeoutMs);r.then(l=>{if(a){this.safeDispose(l.dispose);return}a=!0,clearTimeout(o),i(l)},l=>{a||(a=!0,clearTimeout(o),s(l))})})}deleteEntry(e,n){this.entries.get(e)===n&&(this.entries.delete(e),n.snapshot=CW,this.notify(n),n.cached&&(n.cached=!1,n.request.kind==="waveform"?this.waveformCacheBytes-=n.weight:this.cacheBytes-=n.weight),n.disposed||(n.disposed=!0,this.safeDispose(n.dispose)),n.listeners.clear(),n.leases.clear())}evictFailures(){const e=Array.from(this.entries.values()).filter(r=>r.state==="error"&&r.leases.size===0).sort((r,i)=>r.lastAccess-i.lastAccess),n=e.length-this.budgets.thumbnailCacheEntries;for(const r of e.slice(0,Math.max(0,n)))this.deleteEntry(r.scopedKey,r)}safeDispose(e){try{e==null||e()}catch{}}}const ZBe=new zBe,kW=Object.freeze({status:"idle"});function o3(t,e=ZBe){const n=x.useRef(t);n.current=t;const r=x.useRef(null),i=t?V_(t):null,s=t==null?void 0:t.priority,a=x.useCallback(l=>{const c=n.current;if(!c||i===null)return()=>{};const u=e.acquire(c,l);return r.current=u,()=>{r.current===u&&(r.current=null),u.release()}},[i,e]),o=x.useCallback(()=>{const l=n.current;return l&&i!==null?e.getSnapshot(l):kW},[i,e]);return x.useLayoutEffect(()=>{var l;s&&((l=r.current)==null||l.updatePriority(s))},[s]),x.useSyncExternalStore(a,o,()=>kW)}function GBe(t,e,n){const r=Math.max(0,Number.isFinite(t)?t:0),i=Math.max(0,Number.isFinite(e)?e:0),s=Math.max(1,Number.isFinite(n)?Math.floor(n):1);return s===1?[r+i/2]:Array.from({length:s},(a,o)=>r+i*o/(s-1))}async function UBe(t){return t instanceof HTMLCanvasElement?new Promise((e,n)=>{t.toBlob(r=>r?e(r):n(new Error("Video thumbnail encode failed")),"image/jpeg",.72)}):t.convertToBlob({type:"image/jpeg",quality:.72})}function D1(t){if(t.aborted)throw new DOMException("Aborted","AbortError")}function mde(t){for(const e of t.urls.splice(0))URL.revokeObjectURL(e);for(const e of t.canvases)e.width=0,e.height=0;t.canvases.clear()}function XBe(t,e){const n=Math.max(1,Math.min(e.posterMaxPhysicalWidth,Math.round(e.posterMaxPhysicalHeight*t)));return{width:n,height:Math.max(1,Math.min(e.posterMaxPhysicalHeight,Math.round(n/t)))}}async function WBe(t,e,n,r){for await(const i of t.canvasesAtTimestamps(e)){if(D1(n),!i)continue;r.canvases.add(i.canvas);const s=await UBe(i.canvas);D1(n),r.urls.push(URL.createObjectURL(s))}}function qBe(t,e,n,r){const i=t.urls[0];if(!i)throw new Error("Video source returned no thumbnail frames");return{value:t.urls.length===1?{kind:"image",url:i,aspect:e}:{kind:"filmstrip",urls:[...t.urls],aspect:e},weight:n*r*4*t.urls.length,dispose:()=>mde(t)}}async function YBe(t,e,n=tl){const r=await hy(()=>import("./index-DivnGS5G.js"),[]);D1(e);const i=new r.Input({source:new r.UrlSource(t.source),formats:r.ALL_FORMATS}),s={urls:[],canvases:new Set};try{const a=await i.getPrimaryVideoTrack();if(D1(e),!a)throw new Error("Video source has no decodable video track");const[o,l]=await Promise.all([a.getDisplayWidth(),a.getDisplayHeight()]);if(D1(e),!(o>0&&l>0))throw new Error("Video source has invalid dimensions");const c=await a.getDurationFromMetadata({skipLiveWait:!0});D1(e);const u=Math.max(0,c??t.sourceRangeDuration??0),f=Math.min(Math.max(0,t.sourceStart??0),u),h=t.sourceRangeDuration??Math.max(0,u-f),p=Math.min(Math.max(0,h),Math.max(0,u-f)),y=GBe(f,p,Math.min(t.frameCount,n.richPreviewFrameCount)),m=o/l,v=XBe(m,n),b=new r.CanvasSink(a,{width:v.width,height:v.height,fit:t.fit??"cover",poolSize:1});return await WBe(b,y,e,s),qBe(s,m,v.width,v.height)}catch(a){throw mde(s),a}finally{i.dispose()}}const gde=66;function yde(t,e,n=!1){return new Promise((r,i)=>{const s=new Image,a=()=>{s.onload=null,s.onerror=null,e.removeEventListener("abort",o)},o=()=>{a(),s.src="",i(new DOMException("Aborted","AbortError"))};if(e.aborted){o();return}s.onload=()=>{a(),r(s.naturalWidth>0&&s.naturalHeight>0?s.naturalWidth/s.naturalHeight:16/9)},s.onerror=()=>{a(),n&&/\.svg($|\?)/i.test(t)?r(16/9):i(new Error("Image thumbnail failed to load"))},e.addEventListener("abort",o,{once:!0}),s.src=t})}function NF(t,e,n=gde,r=1){const i=Number.isFinite(e)&&e>0?e:1.7777777777777777,s=Math.max(r,Math.round(n*i)),a=t>0?Math.max(1,Math.ceil(t/s)):1;return{frameW:s,frameCount:a}}function yA(t){return t.split("/").map(encodeURIComponent).join("/")}function Oy(t,e,n){if(!t||/^(?:data:|blob:)/i.test(t))return t;let r=t,i="";if(/^https?:/i.test(t)){let s;try{s=new URL(t)}catch{return t}if(!n||s.origin!==n)return t;const a=new URL(`/api/projects/${e}/preview/`,n).pathname;if(s.pathname.startsWith(a)||s.pathname.startsWith("/api/"))return t;try{r=s.pathname.replace(/^\/+/,"").split("/").map(decodeURIComponent).join("/")}catch{return t}i=`${s.search}${s.hash}`}return`/api/projects/${e}/preview/${yA(r.replace(/^\/+/,""))}${i}`}const KBe=x.memo(function({videoSrc:e,label:n,labelColor:r,duration:i=5,sourceStart:s,sourceRangeDuration:a,projectId:o=e,sessionEpoch:l=0,priority:c="visible",rich:u=!1}){const[f,h]=x.useState(0),p=x.useRef(null),y=x.useMemo(()=>({key:TS({kind:"video",source:e,start:s,duration:a??i,frames:u?6:1}),projectId:o,sessionEpoch:l,kind:"video",priority:c,rich:u,load:T=>YBe({source:e,sourceStart:s,sourceRangeDuration:a??i,frameCount:u?6:1,fit:"cover"},T)}),[i,c,o,u,l,a,s,e]),m=o3(y),v=m.status==="ready"?m.value:null,b=(v==null?void 0:v.kind)==="filmstrip"?v.urls:(v==null?void 0:v.kind)==="image"?[v.url]:[],w=(v==null?void 0:v.kind)==="image"||(v==null?void 0:v.kind)==="filmstrip"?v.aspect:16/9,{frameW:O,frameCount:k}=NF(f,w,gde),E=x.useCallback(T=>{var _;if((_=p.current)==null||_.disconnect(),!T)return;const N=T.parentElement??T;h(N.clientWidth),p.current=new ResizeObserver(([I])=>h(I.contentRect.width)),p.current.observe(N)},[]);return Or(()=>()=>{var T;return(T=p.current)==null?void 0:T.disconnect()}),d.jsxs("div",{ref:E,className:"absolute inset-0 overflow-hidden",children:[b.length>0&&d.jsx("div",{className:"absolute inset-0 flex",children:Array.from({length:k},(T,N)=>{const _=b[N%b.length];return d.jsx("div",{className:"relative h-full flex-shrink-0 overflow-hidden bg-neutral-900",style:{width:O},children:d.jsx("img",{src:_,alt:"",draggable:!1,className:"absolute inset-0 h-full w-full object-cover"})},N)})}),m.status==="loading"&&b.length===0&&d.jsx("div",{className:"absolute inset-0 animate-pulse motion-reduce:animate-none",style:{background:"linear-gradient(90deg, rgba(255,255,255,0.02) 0%, rgba(255,255,255,0.05) 50%, rgba(255,255,255,0.02) 100%)"}}),m.status==="error"&&d.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-neutral-900/60",children:d.jsx("span",{className:"rounded bg-black/50 px-1 text-[8px] text-neutral-500",children:"no preview"})}),n&&d.jsx("div",{className:"absolute inset-x-0 bottom-0 z-10 px-1.5 pb-0.5 pt-3",style:{background:"linear-gradient(to top, rgba(0,0,0,0.85) 0%, rgba(0,0,0,0.4) 60%, transparent 100%)"},children:d.jsx("span",{className:"block truncate text-[9px] font-semibold leading-tight",style:{color:r,textShadow:"0 1px 2px rgba(0,0,0,0.9)"},children:n})})]})}),JBe=66,eVe="v3";function DF({previewUrl:t,seekTime:e=2,duration:n=5,selector:r,selectorIndex:i,origin:s,output:a}){const o=t.replace("/preview/comp/","/thumbnail/").replace(/\/preview$/,"/thumbnail/index.html"),l=new URL(o,s);return l.searchParams.set("t",(e+n/2).toFixed(2)),l.searchParams.set("v",eVe),a&&l.searchParams.set("output",a),r&&(l.searchParams.set("selector",r),i!=null&&i>0&&l.searchParams.set("selectorIndex",String(i))),l.toString()}async function tVe(t,e){const n=await fetch(t,{signal:e});if(!n.ok)throw new Error(`Composition thumbnail failed (${n.status})`);const r=await n.blob();if(e.aborted)throw new DOMException("Aborted","AbortError");const i=URL.createObjectURL(r);try{const s=await yde(i,e);return{value:{kind:"image",url:i,aspect:s},weight:tl.posterMaxPhysicalWidth*tl.posterMaxPhysicalHeight*4,dispose:()=>URL.revokeObjectURL(i)}}catch(s){throw URL.revokeObjectURL(i),s}}const EM=x.memo(function({previewUrl:e,label:n,labelColor:r,selector:i,selectorIndex:s,seekTime:a=2,duration:o=5,projectId:l=e,sessionEpoch:c=0,priority:u="visible"}){const[f,h]=x.useState(0),p=x.useRef(null),y=DF({previewUrl:e,seekTime:a,duration:o,selector:i,selectorIndex:s,origin:window.location.origin}),m=x.useMemo(()=>({key:TS({kind:"composition",url:y}),projectId:l,sessionEpoch:c,kind:"composition",priority:u,rich:!0,load:E=>tVe(y,E)}),[u,l,c,y]),v=o3(m),b=v.status==="ready"&&v.value.kind==="image"?v.value:null,{frameW:w,frameCount:O}=NF(f,(b==null?void 0:b.aspect)??16/9,JBe,48),k=x.useCallback(E=>{var N;if((N=p.current)==null||N.disconnect(),!E)return;const T=E.parentElement??E;h(T.clientWidth),p.current=new ResizeObserver(([_])=>h(_.contentRect.width)),p.current.observe(T)},[]);return Or(()=>()=>{var E;return(E=p.current)==null?void 0:E.disconnect()}),d.jsxs("div",{ref:k,className:"absolute inset-0 overflow-hidden",children:[b&&d.jsx("div",{className:"absolute inset-0 flex",style:{animation:"hf-thumb-fade 200ms ease-out",mixBlendMode:"lighten"},children:Array.from({length:O},(E,T)=>d.jsx("div",{className:"relative h-full flex-shrink-0 overflow-hidden",style:{width:w},children:d.jsx("img",{src:b.url,alt:"",draggable:!1,className:"absolute inset-0 h-full w-full object-cover",style:{opacity:.7}})},T))}),v.status==="loading"&&d.jsx("div",{className:"absolute inset-0 animate-pulse bg-white/[0.035]"}),n&&d.jsx("div",{className:"absolute inset-y-0 left-3 z-10 flex items-center",children:d.jsx("span",{className:"block max-w-full truncate text-[10px] font-semibold leading-none",style:{color:r,textShadow:b?"0 1px 4px rgba(0,0,0,0.9), 0 0 8px rgba(0,0,0,0.6)":"none"},children:n})})]})});let EW=0;const nVe=800,TW={isEditMode:!1,dismissed:!1,model:null,selectedSegmentIds:new Set,selectedGroupId:null,sourceFilePath:null,syncError:null,retrySave:null,past:[],future:[]};let iv=null,TM=0;function Xc(t,e){if(!t.model)return{};const n=Date.now();return iv===e&&n-TM({...TW,setEditMode:n=>t({isEditMode:n}),setDismissed:n=>t({dismissed:n}),setModel:n=>t({model:n}),setSourceFilePath:n=>t({sourceFilePath:n}),setSyncError:n=>t({syncError:n}),setRetrySave:n=>t({retrySave:n}),undo:()=>{const{model:n,past:r,future:i}=e(),s=r[r.length-1];return!s||!n?null:(iv=null,t({model:s,past:r.slice(0,-1),future:[...i,n]}),s)},redo:()=>{const{model:n,past:r,future:i}=e(),s=i[i.length-1];return!s||!n?null:(iv=null,t({model:s,past:[...r,n].slice(-50),future:i.slice(0,-1)}),s)},selectSegment:(n,r=!1)=>t(i=>{if(r){const s=new Set(i.selectedSegmentIds);return s.has(n)?s.delete(n):s.add(n),{selectedSegmentIds:s,selectedGroupId:null}}return{selectedSegmentIds:new Set([n]),selectedGroupId:null}}),selectGroup:n=>{var i;const r=(i=e().model)==null?void 0:i.groups.get(n);r&&t({selectedSegmentIds:new Set(r.segmentIds),selectedGroupId:n})},selectAll:()=>t(n=>n.model?{selectedSegmentIds:new Set(n.model.segments.keys()),selectedGroupId:null}:{}),clearSelection:()=>{const{selectedSegmentIds:n,selectedGroupId:r}=e();n.size===0&&r===null||t({selectedSegmentIds:new Set,selectedGroupId:null})},updateSegmentStyle:(n,r)=>t(i=>{if(!i.model)return{};const s=i.model.segments.get(n);if(!s)return{};const a=new Map(i.model.segments);return a.set(n,{...s,style:{...s.style,...r}}),{...Xc(i,`seg-style:${n}`),model:{...i.model,segments:a}}}),updateSegmentText:(n,r)=>t(i=>{if(!i.model)return{};const s=i.model.segments.get(n);if(!s)return{};const a=new Map(i.model.segments);return a.set(n,{...s,text:r}),{...Xc(i,`seg-text:${n}`),model:{...i.model,segments:a}}}),updateSegmentTiming:(n,r,i)=>t(s=>{if(!s.model)return{};const a=s.model.segments.get(n);if(!a)return{};const o=new Map(s.model.segments);return o.set(n,{...a,start:r,end:i}),{...Xc(s,`seg-timing:${n}`),model:{...s.model,segments:o}}}),updateGroupStyle:(n,r)=>t(i=>{if(!i.model)return{};const s=i.model.groups.get(n);if(!s)return{};const a=new Map(i.model.groups);return a.set(n,{...s,style:{...s.style,...r}}),{...Xc(i,`group-style:${n}`),model:{...i.model,groups:a}}}),updateGroupContainer:(n,r)=>t(i=>{if(!i.model)return{};const s=i.model.groups.get(n);if(!s)return{};const a=new Map(i.model.groups);return a.set(n,{...s,containerStyle:{...s.containerStyle,...r}}),{...Xc(i,`group-container:${n}`),model:{...i.model,groups:a}}}),updateGroupAnimation:(n,r,i)=>t(s=>{if(!s.model)return{};const a=s.model.groups.get(n);if(!a)return{};const o=new Map(s.model.groups),l=a.animation[r],c=l!==null?{...l,...i}:i;return o.set(n,{...a,animation:{...a.animation,[r]:c}}),{...Xc(s,`group-anim:${n}:${r}`),model:{...s.model,groups:o}}}),splitGroup:(n,r)=>t(i=>{if(!i.model)return{};const s=i.model.groups.get(n);if(!s)return{};const a=s.segmentIds.indexOf(r);if(a<=0)return{};const o=s.segmentIds.slice(0,a),l=s.segmentIds.slice(a),c=`group-split-${EW++}`,u=new Map(i.model.groups);u.set(n,{...s,segmentIds:o}),u.set(c,{...s,id:c,segmentIds:l});const f=i.model.groupOrder.indexOf(n),h=[...i.model.groupOrder];h.splice(f+1,0,c);const p=new Map(i.model.segments);return l.forEach((y,m)=>{const v=p.get(y);v&&p.set(y,{...v,groupIndex:m})}),{...Xc(i,`split:${n}:${r}:${EW}`),model:{...i.model,groups:u,segments:p,groupOrder:h}}}),mergeGroups:(n,r)=>t(i=>{if(!i.model)return{};const s=i.model.groups.get(n),a=i.model.groups.get(r);if(!s||!a)return{};const o=[...s.segmentIds,...a.segmentIds],l=new Map(i.model.groups);l.set(n,{...s,segmentIds:o}),l.delete(r);const c=i.model.groupOrder.filter(h=>h!==r),u=new Map(i.model.segments);a.segmentIds.forEach((h,p)=>{const y=u.get(h);y&&u.set(h,{...y,groupIndex:s.segmentIds.length+p})});const f=i.selectedGroupId===r?null:i.selectedGroupId;return{...Xc(i,`merge:${n}:${r}`),model:{...i.model,groups:l,segments:u,groupOrder:c},selectedGroupId:f}}),updateSelectedStyle:n=>t(r=>{if(!r.model||r.selectedSegmentIds.size===0)return{};const i=new Map(r.model.segments);for(const s of r.selectedSegmentIds){const a=i.get(s);a&&i.set(s,{...a,style:{...a.style,...n}})}return{...Xc(r,`sel-style:${[...r.selectedSegmentIds].join(",")}`),model:{...r.model,segments:i}}}),applyAnimationToAll:n=>t(r=>{if(!r.model)return{};const i=new Map(r.model.groups);for(const[s,a]of i)i.set(s,{...a,animation:n});return{...Xc(r,"apply-anim-all"),model:{...r.model,groups:i}}}),reset:()=>{iv=null,t(n=>({...TW,retrySave:n.retrySave,selectedSegmentIds:new Set,past:[],future:[]}))}})),rVe=new Set(["ArrowLeft","ArrowRight"]),iVe=["button","a[href]","[role='button']","[role='checkbox']","[role='combobox']","[role='menuitem']","[role='radio']","[role='slider']","[role='spinbutton']","[role='switch']","[role='textbox']"].join(",");function sVe(t){if(Zf(t))return!0;if(!t||typeof t!="object")return!1;const e=t;return typeof e.closest!="function"?!1:e.closest.call(t,iVe)!==null}function aVe(t,e={isCaptionEditMode:!1,selectedCaptionSegmentCount:0}){return t.metaKey||t.ctrlKey||t.altKey||sVe(t.target)?!0:rVe.has(t.code)&&e.isCaptionEditMode&&e.selectedCaptionSegmentCount>0}const PW=[1,2,4];let H_=0;function oVe(){H_+=1;let t=!1;return()=>{t||(t=!0,H_-=1)}}function lVe(){return H_>0}function cVe({iframeRef:t,shuttleDirectionRef:e,shuttleSpeedIndexRef:n,iframeShortcutCleanupRef:r,getAdapter:i,play:s,playBackward:a,pause:o,seek:l}){const c=x.useRef(new Set),u=x.useRef(()=>{}),f=x.useRef(()=>{}),h=x.useCallback(w=>{const O=i(),k=(O==null?void 0:O.getTime())??ue.getState().currentTime;l(K6e(k,w,Qd))},[i,l]),p=x.useCallback(w=>{e.current===w?n.current=Math.min(n.current+1,PW.length-1):n.current=0;const O=PW[n.current];ue.getState().setPlaybackRate(O),w==="forward"?s():a(O)},[s,a,e,n]),y=x.useCallback(()=>{ue.getState().isPlaying?o():s()},[s,o]),m=x.useCallback(w=>{var T,N,_;if(w.defaultPrevented)return;const O=An.getState();if(aVe(w,{isCaptionEditMode:O.isEditMode,selectedCaptionSegmentCount:O.selectedSegmentIds.size}))return;const k=w.key.toLowerCase();if(c.current.add(k),w.code==="Space"){w.preventDefault(),y();return}if(!((w.code==="ArrowLeft"||w.code==="ArrowRight")&&lVe())){if(w.code==="ArrowLeft"){w.preventDefault(),h(w.shiftKey?-10:-1);return}if(w.code==="ArrowRight"){w.preventDefault(),h(w.shiftKey?10:1);return}if(!w.repeat){if(k==="m"){w.preventDefault();const I=ue.getState();I.setAudioMuted(!I.audioMuted);return}if(k==="l"&&w.shiftKey){w.preventDefault();const I=ue.getState();I.setLoopEnabled(!I.loopEnabled);return}if(k==="k"){w.preventDefault(),o();return}if(k==="j"){if(w.preventDefault(),c.current.has("k")){h(-1);return}p("backward");return}if(k==="l"){if(w.preventDefault(),c.current.has("k")){h(1);return}p("forward");return}if(k==="i"){w.preventDefault();const I=((T=i())==null?void 0:T.getTime())??ue.getState().currentTime;ue.getState().setInPoint(w.shiftKey?null:I);return}if(k==="o"){w.preventDefault();const I=((N=i())==null?void 0:N.getTime())??ue.getState().currentTime;ue.getState().setOutPoint(w.shiftKey?null:I);return}if(k==="a"){w.preventDefault(),l(ue.getState().inPoint??0,{keepPlaying:!0});return}if(k==="e"){w.preventDefault();const{outPoint:I}=ue.getState();l(I??((_=i())==null?void 0:_.getDuration())??ue.getState().duration,{keepPlaying:!0});return}}}},[o,p,h,y,i,l]),v=x.useCallback(w=>{c.current.delete(w.key.toLowerCase())},[]);u.current=m,f.current=v;const b=x.useCallback(()=>{var T,N,_;(T=r.current)==null||T.call(r),r.current=null;let w=null,O=null;try{w=((N=t.current)==null?void 0:N.contentWindow)??null,O=((_=t.current)==null?void 0:_.contentDocument)??null}catch{return}if(!w&&!O)return;const k=I=>u.current(I),E=I=>f.current(I);try{w==null||w.addEventListener("keydown",k,!0),w==null||w.addEventListener("keyup",E,!0)}catch{}O==null||O.addEventListener("keydown",k,!0),O==null||O.addEventListener("keyup",E,!0),r.current=()=>{try{w==null||w.removeEventListener("keydown",k,!0),w==null||w.removeEventListener("keyup",E,!0)}catch{}O==null||O.removeEventListener("keydown",k,!0),O==null||O.removeEventListener("keyup",E,!0)}},[t,r]);return{playbackKeyDownRef:u,playbackKeyUpRef:f,attachIframeShortcutListeners:b,togglePlay:y}}function Q_(t){return Number.isFinite(t)&&t>0&&t<7200?t:0}function uVe(t){const e=t.getAttribute(Go);if(!e)return{};const n=SE(t.ownerDocument,e);return{audioGroup:e,audioGroupLabel:n.label,audioGroupVolume:n.volume,audioGroupHidden:n.hidden,...n.fxChain?{audioGroupFxChain:n.fxChain}:{},...n.automation?{audioGroupAutomation:n.automation}:{}}}function fVe(t){const e=new Map,n=t==null?void 0:t.__clipTree;if(!n)return e;const r=i=>{for(const s of i)s.id&&s.parentId&&e.set(s.id,s.parentId),s.children.length>0&&r(s.children)};return r(n.roots),e}function z_(t,e,n,r,i){for(const s of Array.from(e.children)){if(!s.id){z_(t,s,n,r,i);continue}const a=s.hasAttribute("data-hf-group");i.push({id:s.id,parentId:n,hostId:t,label:a&&s.getAttribute("data-hf-group")||s.id,stackingContextId:_j(s),...uVe(s)}),r.set(s.id,n),a&&z_(t,s,s.id,r,i)}}function hVe(t,e,n){const r=[];if(!t)return r;for(const i of e){if(i.kind!=="composition"||!i.id)continue;const s=t.getElementById(i.id);if(!s)continue;const a=s.querySelector("[data-hf-inner-root]")??s;z_(i.id,a,i.id,n,r)}return r}function dVe(t){const e={};t.hasAttribute("data-hidden")&&(e.hidden=!0),t.hasAttribute("data-timeline-locked")&&(e.timelineLocked=!0);const n=t.getAttribute("data-timeline-role");n&&(e.timelineRole=n);const r=t.getAttribute("data-fx-chain");r&&(e.fxChain=r);const i=t.getAttribute("data-automation");return i&&(e.automation=i),Object.keys(e).length>0?e:null}function pVe(t,e){const n=new Map;if(!t)return n;for(const r of e){if(r.kind!=="composition"||!r.id)continue;const i=t.getElementById(r.id);if(i)for(const s of Array.from(i.querySelectorAll("[id]"))){const a=dVe(s);a&&n.set(s.id,a)}}return n}function xde(t){try{return(t==null?void 0:t.contentDocument)??null}catch{return null}}function mVe(t,e){const n=new Set;return t.map((r,i)=>{const s=e?NCe(e,r,i,n):null;return s&&n.add(s),Cae({clip:r,fallbackIndex:i,doc:e,hostEl:s})})}function gVe(t,e,n){const r=yVe(t,n);return!e||n<=0?r:[...r,...kae(e,n,r)]}function yVe(t,e){return e<=0?[...t]:t.filter(n=>n.start({...n,duration:Math.min(n.duration,e-n.start)})).filter(n=>n.duration>0)}function xVe(t){const e=t.pendingSeek??t.requestedSeek??t.storeCurrentTime;return!Number.isFinite(e)||e<=0?0:!Number.isFinite(t.duration)||t.duration<=0?e:Math.min(e,t.duration)}function bVe(t,e){const n=ue.getState().requestedSeekTime,r=xVe({pendingSeek:e.current,requestedSeek:n,storeCurrentTime:ue.getState().currentTime,duration:t.getDuration()});return e.current=null,n!=null&&ue.getState().clearSeekRequest(),t.seek(r>.001?Math.max(0,r-.001):.001),t.seek(r),r}function vVe(t,e){const n=Q_(t.getDuration());n>0&&n!==ue.getState().duration&&e(n)}function AVe(t,e,n,r){window.__crocoPlannedPreviewDuration?.()>0&&(n=Use(t)||n);const i=Eae(t,n);if(i.length>0){r(i);return}const s=t.querySelector("[data-composition-id]");if(!s||n<=0)return;const a=UEe({compositionId:s.getAttribute("data-composition-id")||"composition",tagName:s.tagName||"div",rootDuration:n,iframeSrc:(e==null?void 0:e.src)||"",selector:m0(s)});a&&r([a])}function SVe(t,e){return!t.source||!e?!0:t.source===e.contentWindow}function wVe(t,e){if(!SVe(t,e))return!1;const n=t.data;return(n==null?void 0:n.source)!=="hf-preview"||(n==null?void 0:n.type)!=="state"&&(n==null?void 0:n.type)!=="timeline"?!1:Rj(n).status!=="unsupported"}function OVe(t,e,n){!t||!e||(TEe(t,e),PEe(t),n())}function CVe(t,e){const n=t==null?void 0:t.__clipManifest;n&&n.clips.length>0&&e(n)}function kVe(t){const{iframe:e,adapter:n,syncTimelineElements:r}=t;try{const i=xde(e),s=(e==null?void 0:e.contentWindow)??null;OVe(i,s,t.attachIframeShortcutListeners),CVe(s,t.processTimelineMessage),t.enrichMissingCompositions(),t.applyPreviewAudioState(),i&&ue.getState().elements.length===0&&AVe(i,e,n.getDuration(),r)}catch{}}function MW(t){t&&t.style.visibility==="hidden"&&(t.style.visibility="")}function EVe(t){return Math.max(Q_(t.manifestDurationSeconds),Q_(t.authoredRootDurationSeconds))}function TVe({iframeRef:t,probeIntervalRef:e,pendingSeekRef:n,isRefreshingRef:r,getAdapter:i,syncTimelineElements:s,setDuration:a,setCurrentTime:o,setTimelineReady:l,setIsPlaying:c,attachIframeShortcutListeners:u,applyPreviewAudioState:f}){const h=x.useCallback(w=>{var I;if(!w.clips||w.clips.length===0)return;ue.getState().setClipManifest(w.clips);const O=new Set(w.clips.map(j=>j.compositionId).filter(Boolean)),k=w.clips.filter(j=>!j.parentCompositionId||!O.has(j.parentCompositionId)),E=xde(t.current);try{const j=fVe(((I=t.current)==null?void 0:I.contentWindow)??null),L=hVe(E,w.clips,j);ue.getState().setClipParentMap(j),ue.getState().setDomClipChildren(L),ue.getState().setSubCompositionHostState(pVe(E,w.clips))}catch{}const T=mVe(k,E),N=EVe({manifestDurationSeconds:w.durationInFrames/EEe(w),authoredRootDurationSeconds:Use(E)}),_=gVe(T,E,N>0?N:ue.getState().duration);_.length>0&&s(_,N>0?N:void 0)},[t,s]),p=x.useCallback(()=>{try{const w=t.current,O=w==null?void 0:w.contentDocument,k=w==null?void 0:w.contentWindow;if(!O||!k)return;const E=ue.getState().elements,T=ue.getState().duration,{missing:N,updatedEls:_,patched:I}=zEe(O,k,E,T);if(N.length>0||I){const j=new Set(_.map(B=>B.id)),L=N.filter(B=>!j.has(B.id));s([..._,...L])}}catch{}},[t,s]),y=x.useCallback(()=>{const w=i();if(!w||w.getDuration()<=0)return!1;w.pause();const O=bVe(w,n);return MW(t.current),xa.notify(O),vVe(w,a),o(O),r.current||l(!0),r.current=!1,c(!1),kVe({iframe:t.current,adapter:w,processTimelineMessage:h,enrichMissingCompositions:p,applyPreviewAudioState:f,attachIframeShortcutListeners:u,syncTimelineElements:s}),!0},[i,a,o,l,c,h,p,s,u,f,t,r,n]),m=x.useCallback(()=>{if(f(),e.current&&clearInterval(e.current),y())return;const w=t.current;let O=!1;const k=()=>{O||y()&&(O=!0,window.removeEventListener("message",E),e.current&&clearInterval(e.current))},E=T=>{wVe(T,w)&&k()};window.addEventListener("message",E),e.current=setTimeout(()=>{O||k(),window.removeEventListener("message",E),MW(t.current)},5e3)},[y,t,e,f]);return{processTimelineMessage:h,processTimelineMessageRef:{current:h},enrichMissingCompositions:p,enrichMissingCompositionsRef:{current:p},initializeAdapter:y,onIframeLoad:m}}function PVe({rafRef:t,reverseRafRef:e,getAdapter:n,setCurrentTime:r,setIsPlaying:i}){const s=x.useCallback(()=>{cancelAnimationFrame(e.current)},[e]),a=x.useCallback(()=>{const l=()=>{const c=n();if(c){const u=c.getTime(),f=c.getDuration(),h=f>0?Math.min(u,f):u;xa.notify(h);const{inPoint:p,outPoint:y}=ue.getState(),m=y!==null?Math.min(y,f):f,v=p!==null?p:0,b=v=b){if(ue.getState().loopEnabled&&f>0){c.seek(w,{keepPlaying:!0}),xa.notify(w),c.play(),i(!0),t.current=requestAnimationFrame(l);return}c.isPlaying()&&c.pause(),r(h),i(!1),cancelAnimationFrame(t.current);return}}t.current=requestAnimationFrame(l)};t.current=requestAnimationFrame(l)},[t,n,r,i]),o=x.useCallback(()=>{cancelAnimationFrame(t.current)},[t]);return{startRAFLoop:a,stopRAFLoop:o,stopReverseLoop:s}}function W0(t){let e=null;return(n,r={})=>{if(e===null)try{e=localStorage.getItem(`hf-${t}-debug`)==="1"}catch{e=!1}if(!e)return;const i=typeof r=="function"?r():r;i&&console.log(`[hf-${t}] ${JSON.stringify({stage:n,t:Math.round(performance.now()),...i})}`)}}const f1=W0("reload");function MVe(t,e){const n=ue.getState(),r=y0(n.elements).musicElement;if(!r||n.audioMuted)return;const i=e-r.start,s=i>=0&&i<=r.duration?(r.playbackStart??0)+i:null;LEe(t,s,r.domId??r.id,n.audioVolume)}const v2=1e3;let bde=!1;const NW=Object.freeze({"dense-short":{duration:120,clipDuration:1.5},"long-overlap":{duration:7200,clipDuration:120},"keyframe-heavy-expanded":{duration:600,clipDuration:8},"composition-heavy":{duration:900,clipDuration:12},"remote-unsupported":{duration:900,clipDuration:12}});function NVe(t){bde=t}function vde(){return bde}function DVe(t){if(t.elementCount!==1e3&&t.elementCount!==5e4)throw new RangeError("Timeline performance fixture elementCount must be 1000 or 50000");if(!Object.hasOwn(NW,t.profile))throw new RangeError(`Unknown timeline performance fixture profile: ${t.profile}`);return NW[t.profile]}function IVe(t,e){if(t({percentage:t,propertyGroup:"position",properties:{x:t},ease:"power2.inOut"}))}}function jVe(t,e,n){return{id:`animation-${t}`,targetSelector:`#${t}`,method:"to",position:e,resolvedStart:e,duration:n,propertyGroup:"position",fromProperties:{x:0},properties:{x:100},ease:"power2.inOut"}}function LVe(t){const e=DVe(t),n=[],r=new Map,i=new Map,s=new Set;for(let a=0;aimport("./index-DivnGS5G.js"),[]),qm}catch{return qm=!1,null}}function IF(t){try{return new URL(t,window.location.href).href}catch{return t}}async function $Ve(t){const e=await FVe();if(!e)return null;const n=new e.Input({source:new e.UrlSource(t),formats:e.ALL_FORMATS});try{const r=await n.getDurationFromMetadata();if(r==null||!Number.isFinite(r)||r<=0)return null;const i=await n.getPrimaryVideoTrack(),s=await n.getAudioTracks();return{duration:r,width:i==null?void 0:i.displayWidth,height:i==null?void 0:i.displayHeight,hasVideo:i!=null,hasAudio:s.length>0}}catch{return null}finally{n.dispose()}}function _F(t){const e=sv.get(IF(t));return e&&(e.lastAccess=++pC),e==null?void 0:e.result}function Sde(t,e){return e?Oy(t,e,window.location.origin):t}function BVe(){const t=sv.size+ng.size-tl.metadataRegistryEntries;if(t<=0)return;const e=[...Array.from(sv,([n,r])=>({key:n,at:r.lastAccess,failed:!1})),...Array.from(ng,([n,r])=>({key:n,at:r.lastAccess,failed:!0}))].sort((n,r)=>n.at-r.at);for(const n of e.slice(0,t))n.failed?ng.delete(n.key):sv.delete(n.key)}function VVe(t,e){return t.map(n=>{const r=n.tag.toLowerCase();if(!n.src||n.sourceDuration!=null||r!=="audio"&&r!=="video")return n;const i=_F(Sde(n.src,e));return i!=null&&i.duration&&i.duration>0?{...n,sourceDuration:i.duration}:n})}async function HVe(t,e,n){const r=t.flatMap(i=>{if(!i.src||i.sourceDuration!=null||!["video","audio"].includes(i.tag.toLowerCase()))return[];const s=Sde(i.src,e);return!_F(s)&&!wde(IF(s))?[{el:i,source:s}]:[]});r.length!==0&&await Promise.allSettled(r.map(async({el:i,source:s})=>{const a=await QVe(s);a&&n(i.key??i.id,a.duration)}))}function wde(t){const e=ng.get(t);return e===void 0?!1:Date.now()-e.failedAt{Ade.push({key:e,epoch:G_,resolve:i}),Ode()}),Z_.set(e,r),r)}function Ode(){for(;PMt.epoch!==G_?null:(Z_.delete(t.key),e?sv.set(t.key,{result:e,lastAccess:++pC}):ng.set(t.key,{failedAt:Date.now(),lastAccess:++pC}),BVe(),e)).then(t.resolve).finally(()=>{PM--,Ode()})}}function zVe(t){return t.keepPlaying&&!t.wasReverseShuttle&&t.storeWasPlaying&&(t.duration<=0||t.nextTime0&&t.processTimelineMessageRef.current(r)}Date.now()-t.lastTimelineMessageRef.current>500&&t.enrichMissingCompositionsRef.current()}catch{}}function WVe(t,e,n){if(t.lastTimelineMessageRef.current=Date.now(),t.processTimelineMessageRef.current(n),t.enrichMissingCompositionsRef.current(),!(ue.getState().elements.length>0))try{const r=e==null?void 0:e.contentDocument,i=t.getAdapter();if(!r||!i)return;const s=Eae(r,i.getDuration());s.length>0&&t.syncTimelineElements(s)}catch{}}function qVe(t){return e=>{const n=t.iframeRef.current,r=UVe(e,n);if(r){if(r.type==="state")return XVe(t,n);r.type==="timeline"&&Array.isArray(r.clips)&&WVe(t,n,r)}}}function YVe(t,e){return e.length!==t.length?!0:e.some((n,r)=>{const i=t[r];return!i||n.id!==i.id||n.start!==i.start||n.duration!==i.duration||n.track!==i.track||n.sourceDuration!==i.sourceDuration})}function KVe(){const t=x.useRef(null),e=x.useRef(0),n=x.useRef(void 0),r=x.useRef(null),i=x.useRef(!1),s=x.useRef(0),a=x.useRef(null),o=x.useRef(0),l=x.useRef(null),c=x.useRef(0),u=x.useRef(null),f=x.useRef(!1),{setIsPlaying:h,setCurrentTime:p,setDuration:y,setTimelineReady:m,setElements:v}=ue.getState(),b=x.useCallback((U,Z)=>{if(vde())return;Z!=null&&(Z=Math.max(Z,window.__crocoPlannedPreviewDuration?.()||0));const K=ue.getState(),ee=Z??K.duration,re=Ghe(VVe(ZEe(K.elements,U,K.duration,ee),K.timelineProjectId));YVe(K.elements,re)&&v(re),Number.isFinite(Z)&&(Z??0)>0&&Z!==K.duration&&y(Z??0),K.timelineReady||m(!0),HVe(re,K.timelineProjectId,(Q,H)=>{ue.setState(se=>{const fe=se.elements.findIndex(me=>(me.key??me.id)===Q);if(fe===-1||se.elements[fe].sourceDuration!=null)return{};const be=se.elements.slice();return be[fe]={...se.elements[fe],sourceDuration:H},{elements:be}})})},[v,m,y]),w=x.useCallback(()=>{var U,Z;try{const K=t.current,ee=K==null?void 0:K.contentWindow;if(!K||!ee)return null;ee.__crocoPlannedPreviewDuration=window.__crocoPlannedPreviewDuration;const re=ee.__player&&typeof ee.__player.play=="function"?ee.__player:null,Q=Math.max(Use(K.contentDocument),window.__crocoPlannedPreviewDuration?.()||0),H=O4(re);if(H>0&&Q<=H)return jO(u,f),re;let se=null;if(ee.__timeline){const me=OG(ee.__timeline),pe=O4(me);if(pe>0&&Q<=pe)return jO(u,f),me;pe>0&&(se??(se=me))}if(ee.__timelines){const me=Object.keys(ee.__timelines);if(me.length>0){const pe=(Z=(U=K==null?void 0:K.contentDocument)==null?void 0:U.querySelector("[data-composition-id]"))==null?void 0:Z.getAttribute("data-composition-id"),ge=pe&&pe in ee.__timelines?pe:me[me.length-1],Pe=OG(ee.__timelines[ge]),ve=O4(Pe);if(ve>0&&Q<=ve)return jO(u,f),Pe;ve>0&&(se??(se=Pe))}}const fe=re??se,be=Math.max(window.__crocoPlannedPreviewDuration?.()||ue.getState().duration,Q,H);return fe&&be>0&&("renderSeek"in fe||typeof fe.seek=="function")?rCe({cache:u,warned:f,bestAdapter:fe,effectiveDuration:be,docDuration:Q,clock:tCe(ee),getPlaybackRate:()=>ue.getState().playbackRate}):fe}catch{return null}},[]),{startRAFLoop:O,stopRAFLoop:k,stopReverseLoop:E}=PVe({rafRef:e,reverseRafRef:s,getAdapter:w,setCurrentTime:p,setIsPlaying:h}),T=x.useCallback(U=>{const Z=t.current;if(Z){IEe(Z,U);try{const K=Z.contentWindow;if(K!=null&&K.__timelines)for(const ee of Object.values(K.__timelines))ee&&typeof ee.timeScale=="function"&&ee.timeScale(U)}catch{}}},[]),N=x.useCallback(()=>{const{audioMuted:U,audioVolume:Z}=ue.getState();DEe(t.current,U,Z)},[]),_=x.useCallback(()=>{k(),E(),Kv();const U=w();U&&(U.getTime()>=U.getDuration()&&U.seek(ue.getState().inPoint??0),T(ue.getState().playbackRate),N(),U.play(),a.current="forward",h(!0),O())},[w,h,O,T,N,k,E]),I=x.useCallback(U=>{k(),E();const Z=w();if(!Z)return;const K=Math.max(0,Z.getDuration()),ee=Z.getTime()<=0&&K>0?K:Z.getTime();Z.pause(),ee!==Z.getTime()&&Z.seek(ee);const re=Math.max(.1,Math.min(4,U));T(re),N();let Q=ee,H=performance.now();const se=fe=>{const be=(fe-H)/1e3*re;let me=Q-be;const{inPoint:pe,outPoint:ge}=ue.getState(),Pe=ge!==null?Math.min(ge,K):K,ve=pe!==null?pe:0,xe=ve0)Q=xe,H=fe,me=xe;else{Z.seek(we),xa.notify(we),p(we),h(!1),a.current=null,s.current=0;return}Z.seek(Math.max(0,me)),xa.notify(Math.max(0,me)),h(!0),s.current=requestAnimationFrame(se)};h(!0),a.current="backward",s.current=requestAnimationFrame(se)},[w,p,h,T,N,k,E]),j=x.useCallback(()=>{E();const U=w();U&&(U.pause(),p(U.getTime()),h(!1),a.current=null,o.current=0,k())},[w,p,h,k,E]),L=x.useCallback((U,Z)=>{const K=a.current==="backward";E();const ee=w();if(!ee)return r.current=Math.max(0,U),!1;const re=Math.max(0,ee.getDuration()),Q=Math.max(0,re>0?Math.min(re,U):U),H=(Z==null?void 0:Z.keepPlaying)===!0,se=zVe({keepPlaying:H,wasReverseShuttle:K,storeWasPlaying:ue.getState().isPlaying,duration:re,nextTime:Q});return ee.seek(Q,Z),xa.notify(Q),p(Q),!se&&!H&&MVe(t.current,Q),se?(k(),T(ue.getState().playbackRate),N(),ee.play(),h(!0),a.current="forward",o.current=0,O()):ZVe({keepPlaying:H,wasReverseShuttle:K})&&(k(),ue.getState().isPlaying&&h(!1),a.current=null,o.current=0),!0},[w,r,p,h,O,k,E,T,N,a,o]);x.useEffect(()=>ue.subscribe((U,Z)=>{var ee;U.requestedSeekTime!==null&&U.requestedSeekTime!==Z.requestedSeekTime&&(L(U.requestedSeekTime),ue.getState().clearSeekRequest());const K=U.playbackRequest;K&&K.nonce!==((ee=Z.playbackRequest)==null?void 0:ee.nonce)&&(K.playing?_():(j(),K.returnTo!==null&&L(K.returnTo)),ue.getState().clearPlaybackRequest())}),[L,_,j]);const{playbackKeyDownRef:B,playbackKeyUpRef:$,attachIframeShortcutListeners:z,togglePlay:Y}=cVe({iframeRef:t,shuttleDirectionRef:a,shuttleSpeedIndexRef:o,iframeShortcutCleanupRef:l,getAdapter:w,play:_,playBackward:I,pause:j,seek:L}),{processTimelineMessageRef:W,enrichMissingCompositionsRef:J,onIframeLoad:ne}=TVe({iframeRef:t,probeIntervalRef:n,pendingSeekRef:r,isRefreshingRef:i,getAdapter:w,syncTimelineElements:b,setDuration:y,setCurrentTime:p,setTimelineReady:m,setIsPlaying:h,attachIframeShortcutListeners:z,applyPreviewAudioState:N}),le=x.useCallback(()=>{if(!(i.current&&r.current!=null)){const Z=w();Z?r.current=Z.getTime():r.current==null&&(r.current=ue.getState().currentTime??0)}i.current=!0,k(),E(),h(!1)},[w,k,h,E]),ie=x.useCallback(()=>{const U=t.current;if(!U)return;f1("refreshPlayer",()=>({stack:new Error("refreshPlayer").stack})),le(),U.style.visibility="hidden";const Z=U.src,K=new URL(Z,window.location.origin);K.searchParams.set("_t",String(Date.now())),bie(K),U.src=K.toString()},[le]),q=x.useRef(w);q.current=w,Or(()=>{const U=re=>B.current(re),Z=re=>$.current(re),K=qVe({iframeRef:t,processTimelineMessageRef:W,enrichMissingCompositionsRef:J,lastTimelineMessageRef:c,getAdapter:w,syncTimelineElements:b}),ee=()=>{var re;if(document.hidden&&ue.getState().isPlaying){const Q=(re=q.current)==null?void 0:re.call(q);Q&&(Q.pause(),h(!1),k())}};return window.addEventListener("keydown",U,!0),window.addEventListener("keyup",Z,!0),window.addEventListener("message",K),document.addEventListener("visibilitychange",ee),()=>{var re;window.removeEventListener("keydown",U,!0),window.removeEventListener("keyup",Z,!0),(re=l.current)==null||re.call(l),l.current=null,window.removeEventListener("message",K),document.removeEventListener("visibilitychange",ee),k(),E(),Kv(),jO(u,f),n.current&&clearInterval(n.current)}});const F=x.useCallback(()=>{k(),E(),n.current&&clearInterval(n.current),ue.getState().reset()},[k,E]);return x.useEffect(()=>ue.subscribe((U,Z)=>{const K=U.playbackRate!==Z.playbackRate,ee=U.audioMuted!==Z.audioMuted,re=U.audioVolume!==Z.audioVolume;!K&&!ee&&!re||(K&&T(U.playbackRate),N())}),[T,N]),{iframeRef:t,play:_,pause:j,togglePlay:Y,seek:L,onIframeLoad:ne,refreshPlayer:ie,saveSeekPosition:le,resetPlayer:F}}const DW='button:not([disabled]), [href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), summary, [contenteditable="true"], [tabindex]:not([tabindex="-1"])';function PS({open:t,onClose:e,containerRef:n,canClose:r}){const i=x.useRef(null),s=x.useRef(r);s.current=r;const a=x.useRef(e);a.current=e;const o=x.useCallback(()=>{const l=s.current;l&&!l()||a.current()},[]);return x.useEffect(()=>{var h;const l=document.activeElement;i.current=l instanceof HTMLElement?l:null;const c=n.current;(h=(c==null?void 0:c.querySelector(DW))??c)==null||h.focus();const f=p=>{if(p.key==="Escape"){p.stopPropagation(),o();return}if(p.key!=="Tab")return;const y=n.current;if(!y)return;const m=Array.from(y.querySelectorAll(DW));if(m.length===0)return;const v=m[0],b=m[m.length-1],w=document.activeElement;p.shiftKey&&(w===v||!y.contains(w))?(p.preventDefault(),b.focus()):!p.shiftKey&&(w===b||!y.contains(w))&&(p.preventDefault(),v.focus())};return document.addEventListener("keydown",f,!0),()=>{var p;document.removeEventListener("keydown",f,!0),(p=i.current)==null||p.focus(),i.current=null}},[t,n,o]),{requestClose:o}}function IW({findings:t,projectId:e,projectDir:n,title:r="HyperFrame Lint Results",promptIntro:i="Fix these HyperFrames lint issues",onClose:s}){const a=t.filter(v=>v.severity==="error"),o=t.filter(v=>v.severity==="warning"),l=t.length>0,[c,u]=x.useState(!1),[f,h]=x.useState(!1),p=x.useRef(null),{requestClose:y}=PS({open:!0,onClose:s,containerRef:p}),m=async()=>{const v=t.map(k=>{let E=`[${k.severity}] ${k.message}`;return k.file&&(E+=` File: ${k.file}`),k.fixHint&&(E+=` Fix: ${k.fixHint}`),E}),b=n?`Project path: ${n} @@ -275,14 +275,14 @@ ${s} `||t===" "||t==="\r"||t==="\f"}function AKe(t){const e=t.document;return t.wrapped?e.body.innerHTML??"":` ${e.documentElement.outerHTML}`}function SKe(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)&&typeof t.id=="string"}function wKe(t){var u;const e=/^\/elements\/([^/]+)\/inlineStyles\/(.+)$/.exec(t);if(e)return{type:"style",id:e[1],prop:e[2]};const n=/^\/elements\/([^/]+)\/text$/.exec(t);if(n)return{type:"text",id:n[1]};const r=/^\/elements\/([^/]+)\/attributes\/(.+)$/.exec(t);if(r)return{type:"attribute",id:r[1],prop:(u=r[2])==null?void 0:u.replace(/~1/g,"/").replace(/~0/g,"~")};const i=/^\/elements\/([^/]+)\/timing\/(.+)$/.exec(t);if(i)return{type:"timing",id:i[1],field:i[2]};const s=/^\/elements\/([^/]+)\/hold\/(.+)$/.exec(t);if(s)return{type:"hold",id:s[1],field:s[2]};const a=/^\/elements\/([^/]+)$/.exec(t);if(a)return{type:"element",id:a[1]};const o=/^\/variableDeclarations\/(.+)$/.exec(t);if(o)return{type:"variableDeclaration",id:o[1]};const l=/^\/variables\/(.+)$/.exec(t);if(l)return{type:"variable",id:l[1]};const c=/^\/metadata\/(.+)$/.exec(t);return c?{type:"metadata",field:c[1]}:t==="/script/gsap"?{type:"script"}:t==="/style/css"?{type:"stylesheet"}:null}function OKe(t,e,n){n===null?nYe(t,e):$me(t,e,n)}function CKe(t,e){var s;const n=[],r=((s=K0(t.document))==null?void 0:s.getAttribute("data-hf-id"))??null,i=Object.entries(e).sort(([a],[o])=>{const l=a.startsWith("var."),c=o.startsWith("var."),u=a.startsWith("varDecl."),f=o.startsWith("varDecl.");return l&&f?1:u&&c?-1:0});for(const[a,o]of i){const l=tWe(a);if(l)if(o===null?n.push({op:"remove",path:l}):n.push({op:"replace",path:l,value:o}),r&&a.startsWith("var.")&&o!==null&&typeof o!="object"){const c=Ug(r,`--${a.slice(4)}`);n.push({op:"replace",path:c,value:String(o)})}else r&&a.startsWith("var.")&&o===null&&n.push({op:"remove",path:Ug(r,`--${a.slice(4)}`)})}NR(t,n)}function NR(t,e){for(const n of e){const r=wKe(n.path);r&&kKe(t,n,r)}}function kKe(t,e,n){switch(n.type){case"style":{const r=n.id?kp(t.document,n.id):null;if(!r||!n.prop)return;e.op==="remove"?lc(r,{[n.prop]:null}):lc(r,{[n.prop]:String(e.value)});break}case"text":{const r=n.id?kp(t.document,n.id):null;if(!r)return;e.op==="remove"?CR(r,""):CR(r,String(e.value??""));break}case"attribute":{const r=n.id?kp(t.document,n.id):null;if(!r||!n.prop)return;e.op==="remove"?r.removeAttribute(n.prop):r.setAttribute(n.prop,String(e.value??""));break}case"timing":{const r=n.id?kp(t.document,n.id):null;if(!r||!n.field)return;n.field==="start"?e.op==="remove"?r.removeAttribute("data-start"):r.setAttribute("data-start",String(e.value)):n.field==="duration"?e.op==="remove"?r.removeAttribute("data-duration"):r.setAttribute("data-duration",String(e.value)):n.field==="end"?e.op==="remove"?r.removeAttribute("data-end"):r.setAttribute("data-end",String(e.value)):n.field==="trackIndex"&&(e.op==="remove"?r.removeAttribute("data-track-index"):r.setAttribute("data-track-index",String(e.value)));break}case"hold":{const r=n.id?kp(t.document,n.id):null;if(!r||!n.field)return;const i=`data-hold-${n.field}`;e.op==="remove"?r.removeAttribute(i):r.setAttribute(i,String(e.value));break}case"element":{if(!n.id)return;if(e.op==="remove"){const r=kp(t.document,n.id);r==null||r.remove()}else if(e.op==="add"&&e.value){const r=e.value,i=r.parentId?kp(t.document,r.parentId):t.document.body;if(!i)return;const s=t.document.createElement("div");s.innerHTML=r.html;const a=s.firstElementChild;if(!a)return;const l=Array.from(i.children)[r.siblingIndex]??null;i.insertBefore(a,l)}break}case"variableDeclaration":{if(!n.id)return;e.op==="remove"?Fme(mo(t.document,t.wrapped),n.id):SKe(e.value)&&B$(mo(t.document,t.wrapped),e.value);break}case"variable":{if(!n.id)return;OKe(mo(t.document,t.wrapped),n.id,e.op==="remove"?null:e.value);break}case"script":{e.op==="remove"?$i(t.document,""):$i(t.document,String(e.value??""));break}case"stylesheet":{e.op==="remove"?kR(t.document,""):kR(t.document,String(e.value??""));break}case"metadata":{const r=K0(t.document);if(!r||!n.field)return;n.field==="width"?e.op==="remove"?(lc(r,{width:null}),r.removeAttribute("data-width")):(lc(r,{width:`${e.value}px`}),r.hasAttribute("data-width")&&r.setAttribute("data-width",String(e.value))):n.field==="height"?e.op==="remove"?(lc(r,{height:null}),r.removeAttribute("data-height")):(lc(r,{height:`${e.value}px`}),r.hasAttribute("data-height")&&r.setAttribute("data-height",String(e.value))):n.field==="duration"&&(e.op==="remove"?r.removeAttribute("data-duration"):r.setAttribute("data-duration",String(e.value)));break}}}function EKe(t,e={}){const n=e.coalesceMs??300,r=e.maxEntries??100,{trackedOrigins:i}=e,s=[];let a=[];function o(h){return h===L4?!1:i?i.includes(h):!0}function l(h){return h.map(p=>p.path).sort().join(` `)}function c(h){return[...h].sort().join(",")}function u(h,p){return n<=0||c(h.opTypes)!==c(p.opTypes)||h.origin!==p.origin||l(h.patches)!==l(p.patches)?!1:Date.now()-h.timestamp<=n}const f=t.on("patch",h=>{if(!o(h.origin))return;const p=s[s.length-1];if(p&&u(p,h)){const y={patches:h.patches,inversePatches:p.inversePatches,opTypes:p.opTypes,origin:p.origin,timestamp:Date.now()};s[s.length-1]=y}else s.push({patches:h.patches,inversePatches:h.inversePatches,opTypes:h.opTypes,origin:h.origin,timestamp:Date.now()}),s.length>r&&s.shift();a=[]});return{undo(){const h=s.pop();return h?(t.applyPatches(h.inversePatches,{origin:L4}),a.push(h),!0):!1},redo(){const h=a.pop();return h?(t.applyPatches(h.patches,{origin:L4}),s.push(h),!0):!1},canUndo(){return s.length>0},canRedo(){return a.length>0},dispose(){f(),s.length=0,a.length=0}}}function TKe(t,e,n={}){const r=n.path??"composition.html";let i=null,s=Promise.resolve(),a=!1;function o(){i!==null&&clearTimeout(i),i=setTimeout(()=>{i=null,l()},0)}function l(){if(a)return Promise.resolve();const u=t.serialize();return s=s.then(async()=>{var f;if(!a)try{await e.write(r,u)}catch(h){const p=h instanceof Error?h.message:String(h);(f=n.onError)==null||f.call(n,{error:{message:p,cause:h}})}}),s}const c=t.on("change",()=>{o()});return{async flush(){i!==null&&(clearTimeout(i),i=null),await l()},dispose(){a=!0,i!==null&&(clearTimeout(i),i=null),c()}}}function PKe(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}class MKe{constructor(e,n,r={}){Et(this,"parsed");Et(this,"persist");Et(this,"preview");Et(this,"overrides");Et(this,"baseVariableDefaults");Et(this,"elementsCache",null);Et(this,"rootsCache",null);Et(this,"currentSelection",[]);Et(this,"changeHandlers",[]);Et(this,"selectionHandlers",[]);Et(this,"patchHandlers",[]);Et(this,"errorHandlers",[]);Et(this,"previewSelectionUnsubscribe",null);Et(this,"historyModule",null);Et(this,"persistQueueModule",null);Et(this,"batchDepth",0);Et(this,"batchForward",[]);Et(this,"batchInverse",[]);Et(this,"batchOpTypes",[]);Et(this,"batchOrigin",Qh);Et(this,"batchOverridesSnapshot",{});Et(this,"_variableUsageScanCache",new Map);Et(this,"_gsapLabelCache",null);var i;this.parsed=e,this.persist=n.persist,this.preview=n.preview,this.overrides={...n.overrides??{}},this.baseVariableDefaults=r,this.previewSelectionUnsubscribe=((i=this.preview)==null?void 0:i.on("selection",s=>this.updateSelection(s)))??null}attachHistory(e){this.historyModule=e}attachPersistQueue(e){this.persistQueueModule=e}_fireError(e){this.errorHandlers.forEach(n=>n(e))}setStyle(e,n){this.dispatch({type:"setStyle",target:e,styles:n})}setText(e,n){this.dispatch({type:"setText",target:e,value:n})}setAttribute(e,n,r){this.dispatch({type:"setAttribute",target:e,name:n,value:r})}setTiming(e,n){this.dispatch({type:"setTiming",target:e,...n})}removeElement(e){this.dispatch({type:"removeElement",target:e})}addElement(e,n,r){var s;return((s=this._dispatch({type:"addElement",parent:e,index:n,html:r},Qh).meta)==null?void 0:s.newId)??""}setVariableValue(e,n){this.dispatch({type:"setVariableValue",id:e,value:n})}getVariableValue(e,n){return(n!=null&&n.base&&e in this.baseVariableDefaults?this.baseVariableDefaults:this.getVariableValues())[e]}listVariables(){return this.getVariableDeclarations()}removeVariable(e){this.dispatch({type:"removeVariable",id:e})}declareVariable(e){this.dispatch({type:"declareVariable",declaration:e})}updateVariableDeclaration(e,n){this.dispatch({type:"updateVariableDeclaration",id:e,declaration:n})}removeVariableDeclaration(e){this.dispatch({type:"removeVariableDeclaration",id:e})}getVariableDeclarations(){return eYe(mo(this.parsed.document,this.parsed.wrapped))}getVariableValues(e){return{...Lme(mo(this.parsed.document,this.parsed.wrapped)),...e??{}}}validateVariableValues(e){return Kqe(e,this.getVariableDeclarations())}getVariableUsage(){var c;const e=[],n=new Set;let r=!1;const i=new Map;for(const u of Array.from(this.parsed.document.querySelectorAll("script"))){if(u.getAttribute("src"))continue;const f=u.textContent??"";if(f.includes("__hfVariables")&&(r=!0),!f.includes("getVariables"))continue;const h=this._variableUsageScanCache.get(f)??qqe(f);i.set(f,h),r=r||h.scanIncomplete;for(const p of h.usedIds)n.has(p)||(n.add(p),e.push(p))}for(const u of Array.from(this.parsed.document.querySelectorAll("[data-var-src], [data-var-text]")))for(const f of["data-var-src","data-var-text"]){const h=(c=u.getAttribute(f))==null?void 0:c.trim();h&&!n.has(h)&&(n.add(h),e.push(h))}this._variableUsageScanCache=i;const s=this.getVariableDeclarations().map(u=>u.id),a=this._collectCssText(),o=u=>new RegExp(`var\\(\\s*--${PKe(u)}[\\s,)]`).test(a),l=new Set(s);return{usedIds:e,unusedDeclarations:s.filter(u=>!n.has(u)&&!o(u)),undeclaredReads:e.filter(u=>!l.has(u)),scanIncomplete:r}}_collectCssText(){const e=[];for(const n of Array.from(this.parsed.document.querySelectorAll("style")))e.push(n.textContent??"");for(const n of Array.from(this.parsed.document.querySelectorAll("[style]")))e.push(n.getAttribute("style")??"");return e.join(` -`)}setPreviewVariables(e){var n;return(n=this.preview)!=null&&n.setPreviewVariables?(this.preview.setPreviewVariables(e),!0):!1}getElementTimings(){var u,f;const e=ER(this.parsed.document);let n;const r=(u=this._gsapLabelCache)==null?void 0:u.scripts;(r==null?void 0:r.length)===e.length&&r.every((h,p)=>h===e[p])?n=((f=this._gsapLabelCache)==null?void 0:f.labels)??[]:(n=e.flatMap(h=>ODe(h)),this._gsapLabelCache=e.length?{scripts:[...e],labels:n}:null);const s=new Map,a=new Set,o=h=>{const p=s.get(h);if(p)return p;if(a.has(h))return Td(h);a.add(h);try{const y=Td(h,{resolveReferenceEnd:m=>{const v=ma(this.parsed.document,m);if(!v)return null;const b=o(v);return b.end??b.start}});return s.set(h,y),y}finally{a.delete(h)}},l={},c=this.getElements();for(const h of c){const p=ma(this.parsed.document,h.scopedId);if(!p)continue;const y=o(p),m=y.start??0,v=y.duration;if(v===null)continue;const b=m+v,w=n.filter(({position:O})=>O>=m&&O<=b).map(({name:O})=>O);l[h.scopedId]={enterAt:m,exitAt:b,labels:w}}return l}setElementTiming(e){const n=Object.entries(e);n.length!==0&&this.batch(()=>{for(const[r,i]of n)this.dispatch({type:"setTiming",target:r,...i})})}setHold(e,n){this.dispatch({type:"setHold",target:e,hold:n})}addGsapTween(e,n){var i;return((i=this._dispatch({type:"addGsapTween",target:e,tween:n},Qh).meta)==null?void 0:i.animationId)??""}setGsapTween(e,n){this.dispatch({type:"setGsapTween",animationId:e,properties:n})}removeGsapTween(e){this.dispatch({type:"removeGsapTween",animationId:e})}addWithKeyframes(e,n,r,i,s){var o;return((o=this._dispatch({type:"addWithKeyframes",targetSelector:e,position:n,duration:r,keyframes:i,ease:s},Qh).meta)==null?void 0:o.animationId)??""}replaceWithKeyframes(e,n,r,i,s,a){var l;return((l=this._dispatch({type:"replaceWithKeyframes",animationId:e,targetSelector:n,position:r,duration:i,keyframes:s,ease:a},Qh).meta)==null?void 0:l.animationId)??""}undo(){var e;(e=this.historyModule)==null||e.undo()}redo(){var e;(e=this.historyModule)==null||e.redo()}canUndo(){var e;return((e=this.historyModule)==null?void 0:e.canUndo())??!1}canRedo(){var e;return((e=this.historyModule)==null?void 0:e.canRedo())??!1}getElements(){return this.elementsCache??(this.elementsCache=cKe(wY(this.parsed.document))),[...this.elementsCache]}getRootElements(){return this.rootsCache??(this.rootsCache=wY(this.parsed.document)),[...this.rootsCache]}getElement(e){return this.getElements().find(n=>n.scopedId===e)??this.getElements().find(n=>n.id===e&&n.scopedId===n.id)??null}find(e){return this.getElements().filter(n=>{var r;return!(e.tag&&n.tag!==e.tag||e.text&&!((r=n.text)!=null&&r.includes(e.text))||e.name&&n.attributes["data-name"]!==e.name||e.track!==void 0&&n.trackIndex!==e.track||e.composition&&!n.scopedId.startsWith(`${e.composition}/`))}).map(n=>n.scopedId)}getAllAnimationIds(){const e=new Set;for(const n of ER(this.parsed.document))for(const r of oKe(n))e.add(r);return e}selection(){const e=[...this.currentSelection];return{ids:e,setStyle:n=>this.dispatch({type:"setStyle",target:e,styles:n}),setText:n=>this.dispatch({type:"setText",target:e,value:n}),setAttribute:(n,r)=>this.dispatch({type:"setAttribute",target:e,name:n,value:r}),setTiming:n=>this.dispatch({type:"setTiming",target:e,...n}),removeElement:()=>this.dispatch({type:"removeElement",target:e})}}element(e){return{id:e,setStyle:n=>this.dispatch({type:"setStyle",target:e,styles:n}),setText:n=>this.dispatch({type:"setText",target:e,value:n}),setAttribute:(n,r)=>this.dispatch({type:"setAttribute",target:e,name:n,value:r}),setTiming:n=>this.dispatch({type:"setTiming",target:e,...n}),removeElement:()=>this.dispatch({type:"removeElement",target:e})}}getSelection(){return[...this.currentSelection]}setSelection(e){const n=Array.from(new Set(e));n.length===this.currentSelection.length&&n.every((r,i)=>r===this.currentSelection[i])||this.updateSelection(n)}updateSelection(e){this.currentSelection=[...e];for(const n of this.selectionHandlers)n([...this.currentSelection])}_dispatch(e,n){const r=pYe(this.parsed,e),{forward:i,inverse:s}=r;if(i.length===0&&s.length===0)return this.batchDepth===0&&this.changeHandlers.forEach(a=>a()),r;this.elementsCache=null,this.rootsCache=null;for(const a of i){const o=nY(a.path);o!==null&&(this.overrides[o]=a.op==="remove"?null:a.value)}for(const a of i){const o=/^\/elements\/([^/]+)$/.exec(a.path);if(a.op==="remove"&&o){const l=o[1].replace(/~1/g,"/").replace(/~0/g,"~");for(const c of Object.keys(this.overrides))(c.startsWith(`${l}.`)||c.startsWith(`${l}/`))&&delete this.overrides[c]}}if(this.batchDepth>0)this.batchForward.push(...i),this.batchInverse.push(...s),this.batchOpTypes.includes(e.type)||this.batchOpTypes.push(e.type);else{const a=pN(i,[...s].reverse(),n,[e.type]);this.patchHandlers.forEach(o=>o(a)),this.changeHandlers.forEach(o=>o())}return r}dispatch(e,n){this._dispatch(e,(n==null?void 0:n.origin)??Qh)}batch(e,n){const r=(n==null?void 0:n.origin)??Qh;this.batchDepth++,this.batchDepth===1&&(this.batchOrigin=r,this.batchOverridesSnapshot={...this.overrides});let i=!1;try{e()}catch(s){throw i=!0,s}finally{if(this.batchDepth--,this.batchDepth===0)if(!i&&this.batchForward.length>0){const s=pN(this.batchForward,[...this.batchInverse].reverse(),this.batchOrigin,this.batchOpTypes);this.patchHandlers.forEach(a=>a(s)),this.changeHandlers.forEach(a=>a()),this.resetBatchState()}else i&&this.batchInverse.length>0&&(NR(this.parsed,[...this.batchInverse].reverse()),this.overrides={...this.batchOverridesSnapshot},this.elementsCache=null,this.rootsCache=null),this.resetBatchState(),i||this.changeHandlers.forEach(s=>s())}}resetBatchState(){this.batchForward=[],this.batchInverse=[],this.batchOpTypes=[],this.batchOrigin=Qh,this.batchOverridesSnapshot={}}can(e){return nKe(this.parsed,e)}on(e,n){var i;const r=n;if(e==="change")return this.changeHandlers.push(r),()=>{this.changeHandlers=this.changeHandlers.filter(s=>s!==r)};if(e==="selectionchange")return this.selectionHandlers.push(r),()=>{this.selectionHandlers=this.selectionHandlers.filter(s=>s!==r)};if(e==="patch")return this.patchHandlers.push(r),()=>{this.patchHandlers=this.patchHandlers.filter(s=>s!==r)};if(e==="persist:error"){const s=r;this.errorHandlers.push(s);const a=(i=this.persist)==null?void 0:i.on("persist:error",s);return()=>{this.errorHandlers=this.errorHandlers.filter(o=>o!==s),a==null||a()}}return()=>{}}serialize(e){const n=AKe(this.parsed);return e!=null&&e.stripRuntime?pKe(n):n}getOverrides(){return{...this.overrides}}applyPatches(e,n){const r=(n==null?void 0:n.origin)??L4;NR(this.parsed,e),this.elementsCache=null,this.rootsCache=null;for(const a of e){const o=nY(a.path);o!==null&&(this.overrides[o]=a.op==="remove"?null:a.value)}const s=pN(e,[],r,["applyPatches"]);this.patchHandlers.forEach(a=>a(s)),this.changeHandlers.forEach(a=>a())}async flush(){var e;await((e=this.persistQueueModule)==null?void 0:e.flush())}dispose(){var e,n,r;(e=this.previewSelectionUnsubscribe)==null||e.call(this),this.previewSelectionUnsubscribe=null,(n=this.persistQueueModule)==null||n.dispose(),(r=this.historyModule)==null||r.dispose(),this.changeHandlers=[],this.selectionHandlers=[],this.patchHandlers=[],this.errorHandlers=[]}}async function US(t,e){const n=HXe(t),r=Lme(mo(n.document,n.wrapped));e!=null&&e.overrides&&CKe(n,e.overrides);const i=new MKe(n,e??{},r);if(!((e==null?void 0:e.overrides)!==void 0)){if((e==null?void 0:e.history)!==!1){const a=EKe(i,{coalesceMs:(e==null?void 0:e.coalesceMs)??300,trackedOrigins:e==null?void 0:e.trackedOrigins});i.attachHistory(a)}if(e!=null&&e.persist){const a=TKe(i,e.persist,{path:e.persistPath,onError:o=>i._fireError(o)});i.attachPersistQueue(a)}}return i}const dv={};function Q$(t){dv[t]=(dv[t]??0)+1,IKe()}function NKe(){const t=Object.keys(dv);if(t.length===0)return null;const e={};for(const n of t)e[n]=dv[n],delete dv[n];return e}const DKe=5*6e4;let OY=null,yN=null;function CY(){const t=NKe();t!==null&&Pt("sdk_resolver_shadow_attempt",{counts:JSON.stringify(t)})}function IKe(){OY||(OY=setInterval(CY,DKe)),!yN&&typeof document<"u"&&(yN=()=>{document.visibilityState==="hidden"&&(CY(),sae())},document.addEventListener("visibilitychange",yN))}function _Ke(t){const e=t.type==="attribute"?t.property.startsWith("data-")?t.property:`data-${t.property}`:t.type==="html-attribute"?t.property:null;return e===null||!e.startsWith("data-hf-")}const RKe=new Set(["inline-style","text-content","attribute","html-attribute"]);function jKe(t){return t.replace(/-([a-z])/g,(e,n)=>n.toUpperCase())}function kY(t){if(t==null)return null;const e=t.trim();return e===""?null:e}function Gme(t,e){return t.split(`data-hf-id="${e}"`).length-1+(t.split(`data-hf-id='${e}'`).length-1)}function DR(t,e){const n=t.getElements(),r=n.find(s=>s.scopedId===e);if(r)return r;const i=n.filter(s=>s.id===e);return i.find(s=>s.scopedId===s.id)??i[0]??null}function LKe(t,e){return{expected:t.value??null,actual:e.inlineStyles[jKe(t.property)]??e.inlineStyles[t.property]??null}}function FKe(t,e){return{expected:kY(t.value),actual:kY(e.text)}}function $Ke(t,e){const n=t.type==="attribute"?t.property.startsWith("data-")?t.property:`data-${t.property}`:t.property;return{property:n,expected:t.value??null,actual:e.attributes[n]??null}}function BKe(t,e,n){let r,i,s;if(t.type==="inline-style")r=t.property,{expected:i,actual:s}=LKe(t,e);else if(t.type==="text-content")r="text",{expected:i,actual:s}=FKe(t,e);else if(t.type==="attribute"||t.type==="html-attribute")({property:r,expected:i,actual:s}=$Ke(t,e));else return null;return s===i?null:{kind:"value_mismatch",hfId:n,property:r,expected:i,actual:s}}function VKe(t,e,n,r){if(!DR(t,e))return r!==void 0&&!r.includes(e)?[]:[{kind:"element_not_found",hfId:e}];const i=n.filter(_Ke);if(i.length===0)return[];if(i.some(o=>!RKe.has(o.type)))return[];const s=[],a=t.on("patch",o=>s.push(...o.inversePatches));try{try{const l=npe(e,i);t.batch(()=>{for(const c of l)t.dispatch(c)})}catch(l){return[{kind:"dispatch_error",hfId:e,error:String(l)}]}const o=DR(t,e);return o?i.map(l=>BKe(l,o,e)).filter(l=>l!==null):[{kind:"element_not_found",hfId:e}]}finally{a(),s.length>0&&t.applyPatches(s)}}function EY(t){return t==null?t:`[redacted len=${t.length}]`}function HKe(t){return t.map(e=>({...e,expected:EY(e.expected),actual:EY(e.actual)}))}const TY=new WeakSet;function Ume(t,e){return t.getElements().length!==0?!1:(TY.has(t)||(TY.add(t),Pt("sdk_resolver_shadow",{opLabel:e,sessionEmpty:!0,sessionElementCount:0,mismatchCount:1,mismatches:JSON.stringify([{kind:"session_empty"}])})),!0)}function z$(t){return(t==null?void 0:t.targetPath)!==void 0&&t.compositionPath!=null&&t.targetPath!==t.compositionPath}function QKe(t,e,n,r,i){if(u3&&e)try{if(z$(i)||Ume(t,"dom-edit"))return;Q$("dom-edit");const s=VKe(t,e,n,r);if(s.length===0)return;const o=s.some(l=>l.kind==="element_not_found")&&r!==void 0?Gme(r,e):void 0;Pt("sdk_resolver_shadow",{hfId:e,sessionElementCount:t.getElements().length,...o!==void 0?{sourceHfIdCount:o}:{},...o===0?{sourceLooseMatchOnly:!0}:{},mismatchCount:s.length,mismatches:JSON.stringify(HKe(s))})}catch{}}async function zKe(t,e){if(!e)return{suppress:!1,sourceReadFailed:!1};let n;try{n=await e()}catch{return{suppress:!1,sourceReadFailed:!0}}return n===void 0?{suppress:!1,sourceReadFailed:!1}:n.includes(t)?{suppress:!1,strictCount:Gme(n,t),sourceReadFailed:!1}:{suppress:!0,sourceReadFailed:!1}}async function XS(t,e,n,r,i){if(u3&&!(!t||!e))try{if(z$(i)||Ume(t,n)||(Q$(n),DR(t,e)))return;const s=t.getElements().length,a=await zKe(e,r);if(a.suppress)return;const{strictCount:o,sourceReadFailed:l}=a;Pt("sdk_resolver_shadow",{hfId:e,opLabel:n,sessionElementCount:s,...o!==void 0?{sourceHfIdCount:o}:{},...o===0?{sourceLooseMatchOnly:!0}:{},...l?{sourceReadFailed:!0}:{},mismatchCount:1,mismatches:JSON.stringify([{kind:"element_not_found",hfId:e}])})}catch{}}async function ZKe(t,e){let n;try{n=await e}catch{return{staleSession:!1,diskChecked:!1,sourceReadFailed:!0}}if(n===void 0)return{staleSession:!1,diskChecked:!1,sourceReadFailed:!1};let r;try{r=await US(n,{history:!1})}catch{return{staleSession:!1,diskChecked:!1,sourceReadFailed:!0}}try{return{staleSession:r.getAllAnimationIds().has(t),diskChecked:!0,sourceReadFailed:!1}}finally{r.dispose()}}async function Xme(t,e,n,r,i){if(u3&&!(!t||!e))try{if(z$(i))return;Q$(n);const s=t.getElements();if(s.some(u=>u.animationIds.includes(e))||t.getAllAnimationIds().has(e))return;const o=s.length;let l=!1,c=!1;if(r){const u=(async()=>r())(),f=await ZKe(e,u);if(f.staleSession)return;l=f.diskChecked,c=f.sourceReadFailed}Pt("sdk_resolver_shadow",{animationId:e,opLabel:n,sessionElementCount:o,...l?{diskChecked:!0}:{},...c?{sourceReadFailed:!0}:{},mismatchCount:1,mismatches:JSON.stringify([{kind:"animation_not_found",animationId:e}])})}catch{}}const GKe=new Set(["id","class","style","title","name","for","type","lang","dir","translate","hidden","tabindex","draggable","contenteditable","role","slot","href","target","rel","src","srcset","sizes","alt","poster","loading","decoding","crossorigin","preload","autoplay","loop","muted","controls","playsinline","width","height","colspan","rowspan","scope","placeholder","value","min","max","step","pattern","required","disabled","readonly","checked","selected","multiple","accept","maxlength","minlength","rows","cols","wrap"]),UKe=new Set(["src","href","action","formaction","poster","srcset","xlink:href"]),XKe=/^(?:javascript|vbscript):/i,WKe=/^data\s*:\s*text\/html/i;function qKe(t){const e=t.toLowerCase();return e.startsWith("on")?!1:!!(GKe.has(e)||e.startsWith("data-")||e.startsWith("aria-"))}function YKe(t,e){if(UKe.has(t.toLowerCase())){const n=e.trim();if(XKe.test(n)||WKe.test(n))return!1}return!0}const KKe=new Set(["inline-style","text-content","attribute","html-attribute"]),JKe=new Set(["data-hf-id","data-composition-id","data-width","data-height","data-start","data-end","data-track-index","data-hold-start","data-hold-end","data-hold-fill"]);function eJe(t){return t.type==="attribute"?t.property.startsWith("data-")?t.property:`data-${t.property}`:t.type==="html-attribute"?t.property:null}function tJe(t){const e=eJe(t);return e!==null&&JKe.has(e.toLowerCase())}function nJe(t){return t.some(e=>e.type==="html-attribute"&&(!qKe(e.property)||e.value!==null&&!YKe(e.property,e.value)))}function rJe(t){return t.some(e=>e.childSelector!==void 0)}function iJe(t){return t.some(e=>e.type==="text-content")}function sJe(t){if(!t||typeof t!="object"||!("children"in t))return null;const e=t.children;return Array.isArray(e)?e:null}function aJe(t){if(!t||typeof t!="object"||!("tag"in t))return null;const e=t.tag;return typeof e=="string"?e.toLowerCase():null}const oJe=new Set(["svg","math"]);function lJe(t,e){if(!iJe(e))return!1;const n=sJe(t);if(!n)return!1;if(n.length>1)return!0;const r=aJe(n[0]);return r!==null&&oJe.has(r)}function cJe(t,e,n,r){return t&&e&&!!n&&r.length>0&&r.every(i=>KKe.has(i.type))&&!rJe(r)&&!r.some(tJe)&&!nJe(r)}const uJe=2e3,pv=new Map;function Z$(t){let e=2166136261;for(let n=0;n>>0).toString(16)}function Wme(t,e){return t.filter(n=>e-n.ata.hash===i);return s===-1?(pv.set(t,r),!1):(r.splice(s,1),pv.set(t,r),!0)}function di(t){return{status:"declined",reason:t}}function Iu(t){return t instanceof Error?t:new Error(String(t))}function Ri(t){if(t.status==="failed")throw t.error;return t.status==="committed"}async function Yme(t,e,n){return t.readProjectFile?t.readProjectFile(e):n}function xN(t,e){t&&t!==e&&t.dispose()}function hJe(t,e,n){return n.createCandidateSession?n.createCandidateSession(t,e):US(t,{history:!1})}function dJe(t,e,n){return t===e||n.publishSession!==void 0}async function pJe(t,e,n,r){let i;try{const s=r??t.serialize();i=await hJe(s,t,e),i.batch(()=>n(i));const a=i.serialize();return a===s?(xN(i,t),di("no_change")):dJe(i,t,e)?{live:t,candidate:i,serializedBefore:s,after:a}:(xN(i,t),{status:"failed",error:new Error("SDK candidate publisher is unavailable")})}catch(s){return xN(i,t),{status:"failed",error:Iu(s)}}}function mJe(t){return"status"in t}async function gJe(t,e,n,r,i){try{return r.domEditSaveTimestampRef.current=Date.now(),qme(t,e),await r.writeProjectFile(t,e,n),i}catch(s){return new AggregateError([i,Iu(s)],`SDK edit failed and rollback could not restore ${t}`)}}async function Kme(t,e,n,r,i){r.domEditSaveTimestampRef.current=Date.now(),qme(e,t);try{await r.writeProjectFile(e,t,n)}catch(s){return Iu(s)}try{return await r.editHistory.recordEdit({label:(i==null?void 0:i.label)??"Edit layer",kind:"manual",...i!=null&&i.coalesceKey?{coalesceKey:i.coalesceKey}:{},...(i==null?void 0:i.coalesceMs)!=null?{coalesceMs:i.coalesceMs}:{},files:{[e]:{before:n,after:t}}}),null}catch(s){return gJe(e,n,t,r,Iu(s))}}function Jme(t,e,n){try{e.refresh?e.refresh(t):n!=null&&n.skipRefresh||e.reloadPreview()}catch(r){Pt("sdk_cutover_refresh_failed",{error:Iu(r).message})}}async function yJe(t,e,n,r,i){const s=await Kme(t.after,e,n,r,i);if(s)return t.candidate!==t.live&&t.candidate.dispose(),{status:"failed",error:s};let a=!0;try{if(t.candidate!==t.live){const o=r.publishSession({candidate:t.candidate,expectedSession:t.live,targetPath:e});o!=="published"&&t.candidate.dispose(),o==="rejected-inactive-target"&&(a=!1)}}catch(o){Pt("sdk_cutover_publish_failed",{path:e,error:Iu(o).message})}return a&&Jme(t.after,r,i),{status:"committed",version:Z$(t.after)}}async function jy(t,e,n,r,i,s,a){return wS(r.writeProjectFile,e,async()=>{const o=a??n;let l;try{l=await Yme(r,e,o)}catch(f){return{status:"failed",error:Iu(f)}}const c=r.readProjectFile?l:a,u=await pJe(t,r,i,c);return mJe(u)?u:yJe(u,e,l,r,s)})}async function e1e(t,e,n,r,i){await wS(r.writeProjectFile,e,async()=>{const s=await Yme(r,e,n),a=await t(s);if(a===s)return;const o=await Kme(a,e,s,r,i);if(o)throw o;Jme(a,r,i)})}function Ly(t){const e=Object.prototype.hasOwnProperty.call(qHe,"STUDIO_SDK_CUTOVER_FAMILIES")?Pde:void 0;return ZHe(RF,e,t)}function G$(t,e){t.status==="committed"?Pt("sdk_cutover_success",e):t.status==="failed"&&Pt("sdk_cutover_failed",{...e,error:t.error.message})}function WS(t,e){return t.compositionPath!=null&&e!==t.compositionPath}function t1e(t,e){const n=t.readProjectFile;return n?()=>n(e):void 0}async function xJe(t,e,n,r,i,s,a){if(!cJe(Ly("dom"),!!i,t.hfId,e))return di("ineligible_operation");if(!i)return di("session_unavailable");const o=t.hfId;if(!o)return di("target_unaddressable");const l=i.getElement(o);if(!l)return di("target_not_found");if(lJe(l,e))return di("unsupported_text_target");if(WS(s,r))return di("wrong_composition_file");const c=await jy(i,r,n,s,u=>{for(const f of npe(o,e))u.dispatch(f)},a);return G$(c,{hfId:o,opCount:e.length}),c}async function PY(t,e,n,r,i,s){const a=i.readProjectFile;if(XS(r,t,"setTiming",a?()=>a(e):void 0,{targetPath:e,compositionPath:i.compositionPath}),!Ly("timing"))return di("feature_disabled");if(!r)return di("session_unavailable");if(!r.getElement(t))return di("target_not_found");if(WS(i,e))return di("wrong_composition_file");try{const o=r.serialize(),l=await jy(r,e,o,i,c=>c.setTiming(t,n),s,o);return G$(l,{hfId:t,opCount:1}),l}catch(o){const l={status:"failed",error:Iu(o)};return Pt("sdk_cutover_failed",{hfId:t,error:l.error.message}),l}}async function bJe(t,e,n,r,i){var a,o,l;const s=r.readProjectFile;for(const c of t)XS(n,c.hfId,"setTiming",s?()=>s(e):void 0,{targetPath:e,compositionPath:r.compositionPath});if(!Ly("timing"))return di("feature_disabled");if(!n)return di("session_unavailable");if(WS(r,e))return di("wrong_composition_file");if(t.some(c=>!n.getElement(c.hfId)))return di("target_not_found");try{const c=n.serialize(),u=await jy(n,e,c,r,f=>{for(const h of t)f.setTiming(h.hfId,h.timingUpdate)},i,c);return u.status==="failed"?(Pt("sdk_cutover_failed",{hfId:((a=t[0])==null?void 0:a.hfId)??null,error:u.error.message}),u):(Pt("sdk_cutover_success",{hfId:((o=t[0])==null?void 0:o.hfId)??null,opCount:t.length}),u)}catch(c){const u={status:"failed",error:Iu(c)};return Pt("sdk_cutover_failed",{hfId:((l=t[0])==null?void 0:l.hfId)??null,error:u.error.message}),u}}function zp(t,e,n,r,i){if(e.kind==="add"){const s=r.readProjectFile;XS(n,e.target,"addGsapTween",s?()=>s(t):void 0,{targetPath:t,compositionPath:r.compositionPath})}else Xme(n,e.animationId,e.kind==="set"?"setGsapTween":"removeGsapTween",t1e(r,t),{targetPath:t,compositionPath:r.compositionPath});return Ly("gsap-animation")?e.kind==="add"&&n&&!n.getElement(e.target)?Promise.resolve(di("target_not_found")):Wd("gsap-animation",t,n,r,i,s=>{s.batch(()=>{e.kind==="add"?s.addGsapTween(e.target,e.spec):e.kind==="set"?s.setGsapTween(e.animationId,e.properties):s.removeGsapTween(e.animationId)})}):Promise.resolve(di("feature_disabled"))}async function Wd(t,e,n,r,i,s,a){if(a&&Xme(n,a.animationId,a.opLabel,t1e(r,e),{targetPath:e,compositionPath:r.compositionPath}),!Ly(t))return di("feature_disabled");if(!n)return di("session_unavailable");if(WS(r,e))return di("wrong_composition_file");const o=n;try{const l=o.serialize(),c=await jy(o,e,l,r,s,i,l);return c.status==="committed"?Pt("sdk_cutover_success",{opCount:1}):c.status==="failed"&&Pt("sdk_cutover_failed",{error:c.error.message}),c}catch(l){const c={status:"failed",error:Iu(l)};return Pt("sdk_cutover_failed",{error:c.error.message}),c}}function MY(t,e,n,r,i,s,a){return Wd("gsap-keyframe",t,i,s,a,o=>o.batch(()=>o.dispatch({type:"addGsapKeyframe",animationId:e,position:n,value:r})),{animationId:e,opLabel:"addGsapKeyframe"})}function vJe(t,e,n,r,i,s){return Wd("gsap-keyframe",t,r,i,s,a=>a.dispatch({type:"removeGsapKeyframe",animationId:e,percentage:n}),{animationId:e,opLabel:"removeGsapKeyframe"})}function AJe(t,e,n,r,i,s,a){return Wd("gsap-animation",t,i,s,a,o=>o.dispatch({type:"removeGsapProperty",animationId:e,property:n,from:r}),{animationId:e,opLabel:"removeGsapProperty"})}function SJe(t,e,n,r,i){return Wd("gsap-animation",t,n,r,i,s=>s.dispatch({type:"deleteAllForSelector",selector:e}))}function wJe(t,e,n,r,i){return Wd("gsap-keyframe",t,n,r,i,s=>s.dispatch({type:"removeAllKeyframes",animationId:e}),{animationId:e,opLabel:"removeAllKeyframes"})}function OJe(t,e,n,r,i,s){return Wd("gsap-keyframe",t,r,i,s,a=>a.dispatch({type:"convertToKeyframes",animationId:e,resolvedFromValues:n}),{animationId:e,opLabel:"convertToKeyframes"})}function CJe(t,e,n,r,i){return{targetSelector:t,position:e,duration:n,keyframes:r,...i?{ease:i}:{}}}function kJe(t,e,n){n!==void 0?t.dispatch({type:"replaceWithKeyframes",animationId:n,...e}):t.dispatch({type:"addWithKeyframes",...e})}function n1e(t){const e=CJe(t.targetSelector,t.position,t.duration,t.keyframes,t.ease);return Wd("gsap-keyframe",t.targetPath,t.sdkSession,t.deps,t.options,n=>kJe(n,e,t.animationId),t.animationId?{animationId:t.animationId,opLabel:"replaceWithKeyframes"}:void 0)}function EJe(t,e,n,r,i,s,a,o,l){return n1e({targetPath:t,targetSelector:e,position:n,duration:r,keyframes:i,ease:s,sdkSession:a,deps:o,options:l})}function TJe(t,e,n,r,i,s,a,o,l,c){return n1e({targetPath:t,animationId:e,targetSelector:n,position:r,duration:i,keyframes:s,ease:a,sdkSession:o,deps:l,options:c})}async function PJe(t,e,n,r,i){if(XS(r,t,"removeElement",()=>Promise.resolve(e),{targetPath:n,compositionPath:i.compositionPath}),!Ly("lifecycle"))return di("feature_disabled");if(!r)return di("session_unavailable");if(!r.getElement(t))return di("target_not_found");if(WS(i,n))return di("wrong_composition_file");const s=await jy(r,n,e,i,a=>a.removeElement(t),{label:"Delete element"});return G$(s,{hfId:t,opCount:1}),s}function IC(t,e){return t.sourceFile||e||"index.html"}function MJe(t,e){const n=t[0]?IC(t[0].element,e):null;return n&&t.every(r=>IC(r.element,e)===n)?n:null}function NJe(t){return`timeline-group-move:${t.map(e=>e.element.hfId??e.element.id).join(",")}`}function DJe(t){return`timeline-group-resize:${t.map(e=>e.element.hfId??e.element.id).join(",")}`}function NY(t,e){return t.map(n=>n.element.hfId?{hfId:n.element.hfId,timingUpdate:e(n)}:null)}function IJe(t){return t.playbackStart!=null||t.start!==t.element.start&&t.element.playbackStart!=null}function _Je({activeCompPath:t,domEditSaveTimestampRef:e,editQueueRef:n,forceReloadSdkSession:r,invalidateGsapCache:i,isRecordingRef:s,pendingTimelineEditPathRef:a,previewIframeRef:o,projectIdRef:l,recordEdit:c,reloadPreview:u,sdkSession:f,publishSdkSession:h,showToast:p,writeProjectFile:y}){const m=x.useCallback((k,E)=>{if(s!=null&&s.current)return p("Cannot edit timeline while recording","error"),Promise.reject(new Error(`${k}: blocked while recording`));const T=l.current;if(!T)return Promise.reject(new Error(`${k}: no active project`));const N=n.current.then(()=>E(T));return n.current=N.then(()=>{},_=>{console.error(`[Timeline] Failed to persist: ${k}`,_)}),N},[n,s,l,p]),v=x.useCallback(async(k,E,T,N,_)=>{await qLe({projectId:k,activeCompPath:t,label:E,changes:T,writeProjectFile:y,recordEdit:c,domEditSaveTimestampRef:e,pendingTimelineEditPathRef:a,coalesceKey:N,coalesceMs:_}),r==null||r()},[t,e,r,a,c,y]),b=x.useCallback(async k=>{const E=MJe(k.changes,t);if(!(!k.needsExtension&&E!==null&&k.eligible&&k.sdkChanges.every(_=>_!==null)))return!1;const N=await bJe(k.sdkChanges.filter(_=>_!==null),E,f,{editHistory:{recordEdit:c},writeProjectFile:y,reloadPreview:u,domEditSaveTimestampRef:e,compositionPath:t,readProjectFile:_=>ea(l.current??"",_),publishSession:h},{label:k.label,coalesceKey:k.coalesceKey,coalesceMs:k.coalesceMs,skipRefresh:!0});return Ri(N)},[t,e,l,h,c,u,f,y]),w=x.useCallback((k,E)=>{if(k.length===0)return Promise.resolve();for(const B of k){const $=[["data-start",mi(B.start)]];B.track!=null&&$.push(["data-track-index",mi(B.track)]),iC(o.current,B.element,$,t)}const T=k.every(B=>B.start===B.element.start),N=Math.max(...k.map(B=>B.start+B.element.duration)),_=mA(o.current),I=rC(N);nC(o.current);const j=(E==null?void 0:E.coalesceKey)??NJe(k),L=E==null?void 0:E.coalesceMs;return m("Move timeline clips",async B=>{if(await(E==null?void 0:E.beforeTiming),await b({changes:k,sdkChanges:NY(k,z=>({start:z.start})),eligible:k.every(z=>z.track==null),needsExtension:I,label:"Move timeline clips",coalesceKey:j,coalesceMs:L})||await v(B,"Move timeline clips",k.map(z=>({element:z.element,buildPatches:(Y,W)=>Lhe(Y,W,z.start,z.element.duration,z.track)})),j,L),!T)try{await tW({projectId:B,iframe:o.current,reloadPreview:u,label:"Move timeline clips",errorLabel:"Failed to shift GSAP positions",coalesceKey:j,recordEdit:c,activeCompPath:t,changes:k,resolveChangePath:z=>IC(z,t),mutateChange:(z,Y)=>{const W=z.start-z.element.start,J=z.element.domId;return W===0||!J?null:Ehe(B,Y,J,W)}})}finally{i==null||i()}}).catch(B=>{throw _(),p(Nu(B),"error"),B})},[t,m,v,o,c,u,b,p,i]),O=x.useCallback((k,E)=>{if(k.length===0)return Promise.resolve();for(const L of k){const B=[["data-start",mi(L.start)],["data-duration",mi(L.duration)]];if(L.playbackStart!=null){const $=sC(L.element);B.push([$,mi(L.playbackStart)])}iC(o.current,L.element,B,t)}const T=Math.max(...k.map(L=>L.start+L.duration)),N=mA(o.current),_=rC(T);nC(o.current);const I=(E==null?void 0:E.coalesceKey)??DJe(k),j=E==null?void 0:E.coalesceMs;return m("Resize timeline clips",async L=>{await(E==null?void 0:E.beforeTiming),await b({changes:k,sdkChanges:NY(k,$=>({start:$.start,duration:$.duration})),eligible:k.every($=>!IJe($)),needsExtension:_,label:"Resize timeline clips",coalesceKey:I,coalesceMs:j})||await v(L,"Resize timeline clips",k.map($=>({element:$.element,buildPatches:(z,Y)=>Fhe(z,Y,$.element,{start:$.start,duration:$.duration,playbackStart:$.playbackStart})})),I,j);try{await tW({projectId:L,iframe:o.current,reloadPreview:u,label:"Resize timeline clips",errorLabel:"Failed to scale GSAP positions",coalesceKey:I,recordEdit:c,activeCompPath:t,changes:k,resolveChangePath:$=>IC($,t),mutateChange:($,z)=>{const Y=$.element.domId;return!($.start!==$.element.start||$.duration!==$.element.duration)||!Y?null:The(L,z,Y,$.element.start,$.element.duration,$.start,$.duration)}})}finally{i==null||i()}}).catch(L=>{throw N(),p(Nu(L),"error"),L})},[t,m,v,o,c,u,b,p,i]);return{handleTimelineGroupMove:w,handleTimelineGroupResize:O}}const RJe=1500;function jJe(t){const e=x.useRef(0);return x.useCallback(n=>{const r=Date.now();r-e.current{if(h!=null&&h.current)return r("Cannot edit timeline while recording","error"),Promise.resolve();const K=w.current;if(!K)return Promise.resolve();const ee=O.current.then(()=>WLe({projectId:K,element:q,activeCompPath:e,label:F,buildPatches:U,writeProjectFile:i,recordEdit:a,domEditSaveTimestampRef:o,pendingTimelineEditPathRef:u,coalesceKey:Z})).then(()=>{m==null||m()});return O.current=ee.catch(re=>{console.error(`[Timeline] Failed to persist: ${F}`,re)}),ee},[e,a,i,o,u,r,h,m]),E=_Je({activeCompPath:e,domEditSaveTimestampRef:o,editQueueRef:O,forceReloadSdkSession:m,invalidateGsapCache:v,isRecordingRef:h,pendingTimelineEditPathRef:u,previewIframeRef:c,projectIdRef:w,recordEdit:a,reloadPreview:l,sdkSession:p,publishSdkSession:y,showToast:r,writeProjectFile:i}),T=x.useCallback((q,F)=>{const U=()=>{const Z=q.sourceFile||e||"index.html",K=F.start!==q.start,ee=F.track!==q.track;if(K||ee){const pe=[];K&&pe.push(["data-start",mi(F.start)]),ee&&pe.push(["data-track-index",mi(F.track)]),iC(c.current,q,pe,e)}const re=ULe({element:q,stackingReorder:F.stackingReorder,timelineElements:n,iframe:c.current,activeCompPath:e,commit:b==null?void 0:b.current});if(!K&&!ee)return re;const Q=mA(c.current),H=rC(F.start+q.duration);nC(c.current);const se=(pe,ge)=>{const Pe=ee?F.track:void 0;return Lhe(pe,ge,F.start,q.duration,Pe)},fe=`timeline-move:${q.hfId??q.id}`,be=()=>eW({iframe:c.current,reloadPreview:l,projectId:w.current,targetPath:Z,domId:q.domId,label:"Move timeline clip",coalesceKey:fe,recordEdit:a,edit:{kind:"shift",delta:F.start-q.start}}).finally(()=>v==null?void 0:v()),me=()=>k(q,"Move timeline clip",se,fe).then(be);return re.then(()=>p&&q.hfId&&!H&&!ee?PY(q.hfId,Z,{start:F.start},p,{editHistory:{recordEdit:a},writeProjectFile:i,reloadPreview:l,domEditSaveTimestampRef:o,compositionPath:e,readProjectFile:pe=>ea(w.current??"",pe),publishSession:y},{label:"Move timeline clip",coalesceKey:fe,skipRefresh:!0}).then(pe=>Ri(pe)?be():me()):me()).catch(pe=>{throw Q(),r(Nu(pe),"error"),pe})};return F.stackingReorder?OF(U):U()},[c,k,e,p,y,a,i,l,o,n,b,r,v]),N=x.useCallback((q,F)=>{const U=[["data-start",mi(F.start)],["data-duration",mi(F.duration)]];if(F.playbackStart!=null){const me=sC(q);U.push([me,mi(F.playbackStart)])}iC(c.current,q,U,e);const Z=mA(c.current),K=rC(F.start+F.duration);nC(c.current);const ee=q.sourceFile||e||"index.html",re=(me,pe)=>Fhe(me,pe,q,F),Q=F.playbackStart!=null||F.start!==q.start&&q.playbackStart!=null,H=`timeline-resize:${q.hfId??q.id}`,se=()=>eW({iframe:c.current,reloadPreview:l,projectId:w.current,targetPath:ee,domId:q.domId,label:"Resize timeline clip",coalesceKey:H,recordEdit:a,edit:{kind:"scale",from:{start:q.start,duration:q.duration},to:{start:F.start,duration:F.duration}}}).finally(()=>v==null?void 0:v()),fe=()=>k(q,"Resize timeline clip",re,H).then(se);return(p&&q.hfId&&!Q&&!K?PY(q.hfId,ee,{start:F.start,duration:F.duration},p,{editHistory:{recordEdit:a},writeProjectFile:i,reloadPreview:l,domEditSaveTimestampRef:o,compositionPath:e,readProjectFile:me=>ea(w.current??"",me),publishSession:y},{label:"Resize timeline clip",coalesceKey:H,skipRefresh:!0}).then(me=>Ri(me)?se():fe()):fe()).catch(me=>{throw Z(),r(Nu(me),"error"),me})},[c,k,e,p,y,a,i,l,o,r,v]),_=Sze({projectIdRef:w,activeCompPath:e,timelineElements:n,showToast:r,writeProjectFile:i,recordEdit:a,domEditSaveTimestampRef:o,previewIframeRef:c,pendingTimelineEditPathRef:u,isRecordingRef:h,forceReloadSdkSession:m}),I=wze({projectIdRef:w,activeCompPath:e,showToast:r,writeProjectFile:i,recordEdit:a,domEditSaveTimestampRef:o,previewIframeRef:c,pendingTimelineEditPathRef:u,isRecordingRef:h,forceReloadSdkSession:m}),j=Mze({projectIdRef:w,activeCompPath:e,showToast:r,writeProjectFile:i,recordEdit:a,domEditSaveTimestampRef:o,previewIframeRef:c,pendingTimelineEditPathRef:u,isRecordingRef:h}),L=yze({projectIdRef:w,activeCompPath:e,showToast:r,writeProjectFile:i,recordEdit:a,domEditSaveTimestampRef:o,previewIframeRef:c,pendingTimelineEditPathRef:u,isRecordingRef:h}),B=mze({projectIdRef:w,activeCompPath:e,showToast:r,writeProjectFile:i,recordEdit:a,domEditSaveTimestampRef:o,previewIframeRef:c,pendingTimelineEditPathRef:u,isRecordingRef:h}),{handleTimelineElementsDelete:$,handleTimelineElementDelete:z}=xze({projectIdRef:w,activeCompPath:e,timelineElements:n,showToast:r,writeProjectFile:i,recordEdit:a,domEditSaveTimestampRef:o,reloadPreview:l,isRecordingRef:h,forceReloadSdkSession:m,previewIframeRef:c}),{handleTimelineAssetDrop:Y,handleTimelineFileDrop:W,handleTimelineCompositionDrop:J}=uze({projectIdRef:w,activeCompPath:e,timelineElements:n,showToast:r,writeProjectFile:i,recordEdit:a,domEditSaveTimestampRef:o,reloadPreview:l,uploadProjectFiles:f,isRecordingRef:h,forceReloadSdkSession:m,observeProjectFileVersion:s}),ne=jJe(r),{handleRazorSplit:le,handleRazorSplitAll:ie}=oze({projectId:t,activeCompPath:e,showToast:r,writeProjectFile:i,observeProjectFileVersion:s,recordEdit:a,domEditSaveTimestampRef:o,reloadPreview:l,isRecordingRef:h,forceReloadSdkSession:m});return{handleTimelineElementMove:T,handleTimelineElementResize:N,handleToggleTrackHidden:_,handleToggleElementHidden:I,handleAutoGroupCarveSources:j,setAudioGroupAttribute:B,setElementFxAttribute:L,handleTimelineElementDelete:z,handleTimelineElementsDelete:$,handleTimelineElementSplit:le,handleRazorSplit:le,handleRazorSplitAll:ie,handleTimelineAssetDrop:Y,handleTimelineFileDrop:W,handleTimelineCompositionDrop:J,handleBlockedTimelineEdit:ne,...E}}function FJe(t,e,n,r,i){return r.handleTimelineGroupMove(t.map(({element:s,updates:a})=>({element:s,start:a.start,track:n==="timing"?void 0:a.track})),{coalesceKey:e,coalesceMs:i})}function $Je(t,e){return(e!=null&&e.isConnected?Array.from(e.children):[t]).filter(Pc)}function DY(t,e){const n=[];for(let i=t;i;i=i.parentElement)i.hasAttribute("data-hf-group")&&n.push(i);return(()=>{if(!e){const a=n[n.length-1];return a?{kind:"unit",element:a}:{kind:"child"}}const i=n.indexOf(e);if(i===-1)return{kind:"out-of-scope"};const s=n[i-1];return s?{kind:"unit",element:s}:{kind:"child"}})()}const BJe=1;function IY(t){if(!t)return null;const e=Number.parseFloat(t);return Number.isFinite(e)&&e>0?e:null}function y8(t,e){return Math.abs(t-e)<=BJe}function VJe(t){const e=t.querySelector("[data-composition-id]")??t.documentElement??null,n=IY((e==null?void 0:e.getAttribute("data-width"))??null),r=IY((e==null?void 0:e.getAttribute("data-height"))??null);return!e||!n||!r?null:{rect:e.getBoundingClientRect(),width:n,height:r}}function HJe(t,e){const n=t.getBoundingClientRect(),r=n.width||ru(e.width),i=n.height||ru(e.height);return r&&i?{width:r,height:i}:null}function QJe(t,e,n){return y8(t.left,n.rect.left)&&y8(t.top,n.rect.top)&&y8(e.width,n.width)&&y8(e.height,n.height)}function zJe(t){return t.position==="absolute"||t.position==="fixed"}function ZJe(t,e,n){if(t.parentElement!==e.body||t.hasAttribute("data-hf-allow-root-edit")||zJe(n))return!1;const r=VJe(e),i=HJe(t,n);return!!(r&&i&&QJe(t.getBoundingClientRect(),i,r))}function z4(t){return NLe(t.tagName.toLowerCase())&&t.children.length===0}function _Y(t){let e=0,n=t.previousElementSibling;for(;n;)n.tagName===t.tagName&&(e+=1),n=n.previousElementSibling;return e}function GJe(t,e,n,r){return r==="self"||n===1?"Content":`Text ${e+1}`}function bN(t,e,n,r,i){const s=t.tagName.toLowerCase();return{key:t.getAttribute("data-hf-text-key")??`${r}:${e}:${s}`,label:GJe(s,e,n,r),value:t.textContent??"",tagName:s,attributes:Array.from(t.attributes).filter(o=>o.name!=="style").map(o=>({name:o.name,value:o.value})),inlineStyles:Dhe(t),computedStyles:Nhe(t),source:r,...i==null?{}:{sourceChildIndex:i}}}function r1e(t){const e=Array.from(t.children).filter(Pc).filter(z4);if(e.length>0){if(Array.from(t.childNodes).some(r=>{var i;return r.nodeType===3&&((i=r.textContent)==null?void 0:i.trim())})){const r=[];let i=0;for(const s of t.childNodes)if(s.nodeType===3){const a=s.textContent??"";if(!a.trim())continue;r.push({key:`text-node:${i}`,label:`Text ${i+1}`,value:a,tagName:"#text",attributes:[],inlineStyles:{},computedStyles:{},source:"text-node"}),i++}else Pc(s)&&z4(s)&&(r.push(bN(s,i,e.length,"child",_Y(s))),i++);return r}return e.map((r,i)=>bN(r,i,e.length,"child",_Y(r)))}return z4(t)?[bN(t,0,1,"self")]:[]}function RY(t){return t.replace(/&/g,"&").replace(//g,">")}function UJe(t){const e=Object.entries(t.inlineStyles).filter(([,n])=>!!n);return e.length===0?"":e.map(([n,r])=>`${n}: ${r}`).join("; ")}function i1e(t){return t.filter(e=>e.source==="child"||e.source==="text-node").map(e=>{if(e.source==="text-node")return RY(e.value);const n=[...e.attributes.filter(s=>s.name!=="data-hf-text-key"),{name:"data-hf-text-key",value:e.key}].map(s=>` ${s.name}="${s.value.replace(/"/g,""")}"`).join(""),r=UJe(e),i=r?` style="${r.replace(/"/g,""")}"`:"";return`<${e.tagName}${n}${i}>${RY(e.value)}`}).join("")}function s1e(t){var e,n,r,i;return{key:`child:new:${Date.now()}`,label:"Text",value:"New text",tagName:"span",attributes:[],inlineStyles:{"font-family":((e=t==null?void 0:t.computedStyles)==null?void 0:e["font-family"])??"inherit","font-size":((n=t==null?void 0:t.computedStyles)==null?void 0:n["font-size"])??"16px","font-weight":((r=t==null?void 0:t.computedStyles)==null?void 0:r["font-weight"])??"400",color:((i=t==null?void 0:t.computedStyles)==null?void 0:i.color)??"inherit"},computedStyles:{},source:"child"}}function a1e(t,e){const n=t.find(r=>r.key===e);return!n||n.source!=="child"||n.sourceChildIndex==null?null:{childSelector:`:scope > ${n.tagName}`,childIndex:n.sourceChildIndex}}function XJe(t){return{...t,hasEditableText:!1,hasTimingStart:!1,animationCount:0}}function U$(t,e=(n=>(n=t.gsapAnimations)==null?void 0:n.length)()??0){return{hasStableTarget:!!(t.selector||t.hfId),tag:t.tagName,inlineStyles:t.inlineStyles,computedStyles:t.computedStyles,isCompositionHost:t.isCompositionHost,isCompositionRoot:!1,isInsideLockedComposition:t.isInsideLockedComposition,isMasterView:!1,existsInSource:!0,hasEditableText:t.textFields.length>0,hasTimingStart:t.dataAttributes.start!=null,animationCount:e}}async function WJe(t,e,n){try{const r=await fetch(`/api/projects/${t}/file-mutations/probe-element/${encodeURIComponent(e)}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({target:n})});if(!r.ok)return!0;const i=await r.json();return!(i&&typeof i=="object"&&"exists"in i&&i.exists===!1)}catch{return!0}}async function O3(t,e){var s;if(!t)return null;const n=t.ownerDocument;let r=DY(t,e.activeGroupElement??null);r.kind==="out-of-scope"&&(r=DY(t,null));let i=r.kind==="unit"?r.element:VLe(t,e);for(;i&&i!==n.body&&i!==n.documentElement;){const a=kS(i),o=vA(i);if(!a&&!o){i=i.parentElement;continue}const{sourceFile:l,compositionPath:c}=CS(i,e.activeCompositionPath),u=a?SF(n,i,a,l,e.activeCompositionPath):void 0,f=i.getAttribute("data-composition-src")??i.getAttribute("data-composition-file")??void 0,h=Dhe(i),p=Nhe(i),y=i.hasAttribute("data-composition-id")&&!f||ZJe(i,n,p),m=r1e(i),v=!!I_(i,["data-timeline-locked"]);let b;if(!e.skipSourceProbe&&e.projectId&&(i.id||a||o)){const k={};i.id&&(k.id=i.id),o&&(k.hfId=o),a&&(k.selector=a),u!=null&&(k.selectorIndex=u),b=await WJe(e.projectId,l,k)}const w=MLe(XJe({hasStableTarget:!!(a||o),tag:i.tagName.toLowerCase(),inlineStyles:h,computedStyles:p,isCompositionHost:!!f,isCompositionRoot:y,isInsideLockedComposition:v,isMasterView:e.isMasterView,existsInSource:b??!0})).capabilities,O=i.getBoundingClientRect();return{element:i,id:i.id||void 0,hfId:o,selector:a,selectorIndex:u,sourceFile:l,compositionPath:c,compositionSrc:f,isCompositionHost:!!f,isInsideLockedComposition:v,label:Rhe(i),tagName:i.tagName.toLowerCase(),boundingBox:{x:O.left,y:O.top,width:O.width,height:O.height},textContent:((s=i.textContent)==null?void 0:s.trim())||null,dataAttributes:DLe(i),inlineStyles:h,computedStyles:p,textFields:m,capabilities:w}}return null}function X$(t){const e=t.selectorIndex??0;return`${t.sourceFile}:${t.id??t.selector??"layer"}:${e}`}function C3(t,e,n=Number.POSITIVE_INFINITY){if(!t)return[];const r=[],i=(s,a)=>{if(r.length>=n)return;const o=Rg(s,e.activeCompositionPath);o&&r.push({key:X$(o),element:s,label:Rhe(s),tagName:s.tagName.toLowerCase(),depth:a,childCount:QLe(s,e).length,id:o.id??void 0,hfId:o.hfId??void 0,selector:o.selector??void 0,selectorIndex:o.selectorIndex,sourceFile:o.sourceFile});const l=o?a+1:a;for(const c of Array.from(s.children))if(Pc(c)&&(i(c,l),r.length>=n))return};for(const s of $Je(t,e.activeGroupElement??null))i(s,0);return r}function j1(t,e,n){return{type:"inline-style",property:t,value:e,...n}}function W$(t,e){return{type:"text-content",property:"text",value:t,...e}}function q$(t){return{type:"rich-text",property:"",value:t}}function gc(t){return[t.sourceFile||"index.html",t.hfId??"",t.id??"",t.selector??"",t.selectorIndex??""].join("|")}function ih(t){return AF(U$(t)).text}function vA(t){var e;return((e=t.getAttribute("data-hf-id"))==null?void 0:e.trim())||void 0}function Wg(t){return{id:t.id,hfId:t.hfId,selector:t.selector,selectorIndex:t.selectorIndex}}const qJe=Object.freeze(Object.defineProperty({__proto__:null,buildDefaultDomEditTextField:s1e,buildDomEditPatchTarget:Wg,buildDomEditRichTextPatchOperation:q$,buildDomEditStylePatchOperation:j1,buildDomEditTextPatchOperation:W$,buildTextFieldChildLocator:a1e,collectDomEditLayerItems:C3,collectDomEditTextFields:r1e,domEditSelectionToFacts:U$,getDomEditLayerKey:X$,getDomEditTargetKey:gc,isEditableTextLeaf:z4,isTextEditableSelection:ih,readHfId:vA,resolveDomEditSelection:O3,serializeDomEditTextFields:i1e},Symbol.toStringTag,{value:"Module"}));function YJe({activeCompPath:t,projectDir:e,projectIdRef:n,showToast:r,domEditSelectionRef:i,domEditSelection:s}){const[a,o]=x.useState(),[l,c]=x.useState(),[u,f]=x.useState(null),[h,p]=x.useState(!1),[y,m]=x.useState(!1),v=x.useRef(null),b=x.useCallback(async k=>{const E=n.current;if(!E)return;const T=k.sourceFile||t||"index.html";try{const N=await fetch(`/api/projects/${E}/files/${encodeURIComponent(T)}`);if(!N.ok)return;const I=(await N.json()).content,j=typeof I=="string"?SS(I,k):void 0;o(L=>i.current!==k?L:j)}catch{}},[t,i,n]),w=x.useCallback(()=>{s&&(o(void 0),c(void 0),f(null),b(s),m(!0))},[s,b]),O=x.useCallback(async k=>{if(!s)return;const E=s.sourceFile||t||"index.html",T=a??s.element.outerHTML,N=gHe({selection:s,currentTime:ue.getState().currentTime,tagSnippet:T,selectionContext:l,userInstruction:k,sourceFilePath:DIe(e,E)});if(!await Uf(N)){r("Could not copy prompt to clipboard.","error");return}m(!1),c(void 0),f(null),v.current&&clearTimeout(v.current),p(!0),v.current=setTimeout(()=>p(!1),1600)},[t,l,a,s,e,r]);return x.useEffect(()=>{o(void 0),c(void 0),f(null),p(!1)},[s]),x.useEffect(()=>()=>{v.current&&clearTimeout(v.current)},[]),{agentModalOpen:y,agentModalAnchorPoint:u,copiedAgentPrompt:h,agentPromptSelectionContext:l,setAgentModalOpen:m,setAgentPromptSelectionContext:c,setAgentModalAnchorPoint:f,preloadAgentPromptSnippet:b,handleAskAgent:w,handleAgentModalSubmit:O}}const jY=.95,KJe=new Set(["video","img","canvas","svg"]);function o1e(t,e){return e.width<=1||e.height<=1?!1:t.width/e.width>=jY&&t.height/e.height>=jY}function _C(t,e){return KJe.has(t.tagName.toLowerCase())?!1:o1e(t.getBoundingClientRect(),e)}function l1e(t,e,n,r,i){const s=t.getBoundingClientRect(),a=e.querySelector("[data-composition-id]")??e.documentElement??null,o=a==null?void 0:a.getBoundingClientRect(),l=(o==null?void 0:o.width)||n.innerWidth,c=(o==null?void 0:o.height)||n.innerHeight;if(!l||!c)return null;const u=s.width/l,f=s.height/c;return{x:(r-s.left)/u,y:(i-s.top)/f,viewport:{width:l,height:c}}}const JJe="__hf_studio_pointer_events_override__";function c1e(t){try{const e=t.createElement("style");return e.id=JJe,e.textContent="* { pointer-events: auto !important; }",t.head.appendChild(e),e}catch{return null}}function sg(t){try{t==null||t.remove()}catch{}}const LY=new WeakMap;function eet(t,e){const n=LY.get(t);if(n!==void 0)return n;const r=t.createElement("div"),i=t.createElement("div");r.style.pointerEvents="none",r.appendChild(i);const s=t.body??t.documentElement;if(!s)return!1;s.appendChild(r);const a=e.getComputedStyle(i).pointerEvents!=="none";return r.remove(),LY.set(t,a),a}function tet(t,e){const n=e.getComputedStyle(t).pointerEvents;return n!==""&&n!=="inherit"&&n!=="unset"}function net(t,e){let n=t.parentElement;for(;n;){if(e.getComputedStyle(n).pointerEvents==="none"){let r=t;for(;r&&r!==n;){if(tet(r,e))return e.getComputedStyle(r).pointerEvents==="none";r=r.parentElement}return!0}n=n.parentElement}return!1}function RC(t){const e=t.ownerDocument.defaultView;return e?e.getComputedStyle(t).pointerEvents==="none"?!0:eet(t.ownerDocument,e)?net(t,e):!1:!1}function ret(t){const e=new WeakSet;for(const n of t)Pc(n)&&RC(n)&&e.add(n);return e}function u1e(t,e){const n=ret(t);return HLe(t,{activeCompositionPath:e}).filter(r=>!n.has(r))}function iet(t,e,n){let r=null,i=1/0;for(const s of Array.from(t.querySelectorAll("[data-hf-group]"))){let a=1/0,o=1/0,l=-1/0,c=-1/0;for(const f of Array.from(s.children)){const h=f.getBoundingClientRect();h.width===0&&h.height===0||(a=Math.min(a,h.left),o=Math.min(o,h.top),l=Math.max(l,h.right),c=Math.max(c,h.bottom))}if(ll||nc)continue;const u=(l-a)*(c-o);u!_C(p,a.viewport))??null;if(h)return h}sg(o),o=null;const l=iet(i,a.x,a.y);if(l&&!RC(l)&&Rg(l,r))return l;const c=Kce(i.elementFromPoint(a.x,a.y));return!c||!Rg(c,r)||RC(c)||!Sy(c)||_C(c,a.viewport)?null:c}finally{sg(o)}}function set(t,e,n,r){let i=null,s=null;try{i=t.contentDocument,s=t.contentWindow}catch{return[]}if(!i||!s)return[];const a=l1e(t,i,s,e,n);if(!a)return[];let o=c1e(i);try{if(typeof i.elementsFromPoint=="function"){const c=i.elementsFromPoint(a.x,a.y);return sg(o),o=null,u1e(c,r).filter(u=>!_C(u,a.viewport))}const l=Kce(i.elementFromPoint(a.x,a.y));return!l||!Rg(l,r)?[]:(sg(o),o=null,RC(l)?[]:Sy(l)?_C(l,a.viewport)?[]:[l]:[])}finally{sg(o)}}function x8(t){return t&&(typeof t=="object"||typeof t=="function")?t:null}function vN(t,e){const n=t?Reflect.get(t,e):null;if(typeof n=="function")try{n.call(t)}catch{}}function AN(t,e){const n=t?Reflect.get(t,e):null;if(typeof n!="function")return null;try{const r=n.call(t);return typeof r=="number"&&Number.isFinite(r)?r:null}catch{return null}}function aet(t){const e=t==null?void 0:t.contentWindow;if(!e)return null;try{const n=x8(Reflect.get(e,"__player")),r=AN(n,"getTime");if(typeof(n?Reflect.get(n,"pause"):null)=="function")return vN(n,"pause"),r;let s=null;const a=x8(Reflect.get(e,"__timeline"));s=s??AN(a,"time"),vN(a,"pause");const o=x8(Reflect.get(e,"__timelines"));if(o)for(const l of Object.values(o)){const c=x8(l);s=s??AN(c,"time"),vN(c,"pause")}return s}catch{return null}}function lf(t,e){return t===e?!0:!t||!e?!1:gc(t)===gc(e)}function Fp(t,e){return e?t.some(n=>lf(n,e)):!1}function oet(t,e){return Fp(t,e)?t.filter(n=>!lf(n,e)):[...t,e]}function cet(t,e){let n=!1;const r=t.map(i=>lf(i,e)?(n=!0,e):i);return n?r:[...t,e]}function FY(t,e){return!e||Fp(t,e)?t:[e,...t]}function uet(t){const e=Number(t);return Number.isFinite(e)&&e>=0?e:0}function fet(t){const e={idle:0,loading:0,ready:0,fallback:0,error:0};for(const n of t.querySelectorAll("[data-timeline-poster-state]")){const r=n.dataset.timelinePosterState;r&&Object.hasOwn(e,r)&&(e[r]+=1)}return Object.freeze(e)}function het(t){const e=new Map;for(const n of t.querySelectorAll('[data-clip="true"]')){const r=n.closest("[data-timeline-row]");r&&e.set(r,(e.get(r)??0)+1)}return Math.max(0,...e.values())}function SN(t,e,n){let r=0;for(const i of t.querySelectorAll(e))r+=uet(i.dataset[n]);return r}function det(t=document){const e=t.querySelectorAll('[aria-label="Timeline"]');let n=0;for(const r of e)n+=r.querySelectorAll("*").length;return Object.freeze({timelineRoots:e.length,mountedRows:t.querySelectorAll("[data-timeline-row]").length,mountedClipRoots:t.querySelectorAll('[data-clip="true"]').length,maxMountedClipRootsInOneRow:het(t),mountedTimeGridCells:t.querySelectorAll("[data-timeline-grid-cell]").length,mountedTimelineDescendants:n,schedulerQueued:SN(t,"[data-timeline-scheduler-queued]","timelineSchedulerQueued"),schedulerActive:SN(t,"[data-timeline-scheduler-active]","timelineSchedulerActive"),cacheBytes:SN(t,"[data-timeline-cache-bytes]","timelineCacheBytes"),posterStates:fet(t)})}const pet={BASE_URL:"/",DEV:!1,MODE:"production",PROD:!0,SSR:!1};function met(){try{return pet}catch{return}}const cf=met(),get=cf!=null&&cf.DEV?"development":"production",yet=(cf==null?void 0:cf.DEV)===!0||(cf==null?void 0:cf.MODE)==="development";function xet({previewIframeRef:t,buildDomSelectionFromTarget:e,applyDomSelection:n}){x.useEffect(()=>{if(!yet||typeof window>"u")return;const r={runtimeMode:get,selectByDomId:async i=>{var o,l;const s=((l=(o=t.current)==null?void 0:o.contentDocument)==null?void 0:l.getElementById(i))??null;if(!s)return!1;const a=await e(s);return a?(n(a,{revealPanel:!0}),!0):!1},loadTimelinePerformanceFixture:i=>{const s=LVe(i);return NVe(!0),ue.setState({...JI(),currentTime:0,duration:s.summary.duration,timelineReady:!0,loopEnabled:!1,zoomMode:"manual",manualZoomPercent:2e3,elements:s.elements,selectedElementId:null,selectedElementIds:new Set,selectedKeyframes:new Set,keyframeCache:s.keyframeCache,gsapAnimations:s.gsapAnimations,expandedClipIds:s.expandedClipIds}),s.summary},resetTimelinePerformanceFixture:()=>{ue.getState().reset()},readTimelinePerformanceDiagnostics:()=>det(),timelineViewportBudgets:tl};return window.__studioTest=r,()=>{delete window.__studioTest}},[n,e,t])}const yc=W0("select");function bet(t,e,n){const{timelineElements:r,getTimelineSelectionSet:i,setSelectedTimelineElementId:s,setTimelineSelectionSet:a}=t;if(!n){a(new Set),s(null);return}const o=h=>GL(h,r)??eue(h.element,r,h.sourceFile||"index.html"),l=e.map(o).filter(h=>!!h),c=o(n),u=new Set(l);c&&u.add(c);const f=c??l[0]??null;if(yc("announce",{group:e.length,published:u.size,anchor:c,anchorPublished:c!=null&&u.has(c)}),!f){n.tagName.toLowerCase()===ya&&(a(new Set),s(null));return}(e.length>1||!i().has(f))&&a(u),s(f,{preserveSet:!0})}function vet({projectId:t,activeCompPath:e,isMasterView:n,compIdToSrc:r,captionEditMode:i,previewIframeRef:s,timelineElements:a,getTimelineSelectionSet:o,setSelectedTimelineElementId:l,setTimelineSelectionSet:c,setRightCollapsed:u,setRightPanelTab:f,previewIframe:h,refreshKey:p,rightPanelTab:y}){const[m,v]=x.useState(null),[b,w]=x.useState([]),[O,k]=x.useState(null),[E,T]=x.useState(null),N=x.useRef(y);N.current=y;const _=x.useRef(m),I=x.useRef(b),j=x.useRef(O),L=x.useRef(E),B=x.useRef({activeCompPath:e,projectId:t}),$=x.useRef(0);_.current=m,I.current=b,j.current=O,L.current=E;const z=x.useCallback((Q,H)=>bet({timelineElements:a,getTimelineSelectionSet:o,setSelectedTimelineElementId:l,setTimelineSelectionSet:c},Q,H),[o,l,c,a]),Y=x.useCallback((Q,H)=>{if(!Q){yc("clear",{hadGroup:I.current.length}),_.current=null,I.current=[],v(null),w([]),(H==null?void 0:H.announce)!==!1&&z([],null);return}const se=!!(H!=null&&H.additive),fe=_.current,be=I.current;if(!se&&!(H!=null&&H.preserveGroup)&&be.length===1&&lf(fe,Q)&&lf(be[0],Q)){(H==null?void 0:H.revealPanel)!==!1&&(u(!1),N.current!=="variables"&&f("design"));return}const pe=se?FY(be,fe):be,ge=Fp(pe,Q),Pe=H!=null&&H.preserveGroup?cet(pe,Q):se?oet(pe,Q):[Q],ve=H!=null&&H.preserveGroup?Q:se&&ge?lf(fe,Q)?Pe[0]??null:Fp(Pe,fe)?fe:Pe[0]??null:Q;yc("apply",{additive:se,target:Q.selector??Q.id??null,wasInGroup:ge,prevGroup:be.length,nextGroup:Pe.length}),_.current=ve,I.current=Pe,v(ve),w(Pe);const xe=L.current;if(xe&&ve&&!xe.contains(ve.element)&&(L.current=null,T(null)),ve){(H==null?void 0:H.revealPanel)!==!1&&(u(!1),N.current!=="variables"&&f("design")),z(Pe,ve);return}z([],null)},[z,u,f]),W=x.useCallback(()=>{Y(null,{revealPanel:!1})},[Y]),J=x.useCallback(Q=>{L.current!==Q&&(L.current=Q,T(Q),Y(null,{revealPanel:!1}))},[Y]),ne=x.useCallback((Q,H)=>O3(Q,{activeCompositionPath:e,isMasterView:n,preferClipAncestor:H==null?void 0:H.preferClipAncestor,skipSourceProbe:H==null?void 0:H.skipSourceProbe,activeGroupElement:H&&"activeGroupElement"in H?H.activeGroupElement:L.current,projectId:t}),[e,n,t]),le=x.useCallback(async(Q,H,se)=>{const fe=s.current;if(!fe||i)return null;try{fe.contentDocument&&ov(fe.contentDocument)}catch{}const be=jC(fe,Q,H,e);return be?ne(be,se&&"activeGroupElement"in se?{preferClipAncestor:se.preferClipAncestor,skipSourceProbe:se.skipSourceProbe,activeGroupElement:se.activeGroupElement}:{preferClipAncestor:se==null?void 0:se.preferClipAncestor,skipSourceProbe:se==null?void 0:se.skipSourceProbe}):null},[e,ne,i,s]),ie=x.useCallback(async(Q,H)=>{const se=s.current;if(!se||i)return[];try{se.contentDocument&&ov(se.contentDocument)}catch{}const fe=set(se,Q,H,e),be=[];for(const me of fe){const pe=await ne(me,{skipSourceProbe:!0});pe&&be.push(pe)}return be},[e,ne,i,s]),q=x.useCallback(Q=>{lf(j.current,Q)||(j.current=Q,k(Q))},[]),F=x.useCallback(async Q=>{const H=s.current;let se=null;try{se=(H==null?void 0:H.contentDocument)??null}catch{return null}if(!se)return null;ov(se);const fe=jhe(se,Q,{activeCompositionPath:e,compIdToSrc:r,isMasterView:n});return fe?ne(fe,{preferClipAncestor:!1}):null},[e,ne,r,n,s]),U=x.useCallback(async Q=>{const H=++$.current;if(!Q){Y(null,{revealPanel:!1});return}const se=await F(Q);if(H===$.current){if(se){Y(se);return}Y(null,{revealPanel:!1,announce:!1})}},[Y,F]),Z=x.useRef(async()=>{}),K=x.useCallback(async Q=>{const H=s.current;let se=null;try{se=(H==null?void 0:H.contentDocument)??null}catch{return}if(!se)return;const fe=Is(se,Q,e);if(!fe){const me=I.current;if(yc("refresh-lost",{target:Q.selector??Q.id??null,group:me.length}),me.length>1){await Z.current(me);return}Y(null,{revealPanel:!1});return}const be=await ne(fe);be&&Y(be,{revealPanel:!1,preserveGroup:!0})},[e,Y,ne,s]),ee=x.useCallback(async Q=>{const H=s.current;let se=null;try{se=(H==null?void 0:H.contentDocument)??null}catch{return}if(!se)return;const fe=[];for(const pe of Q){const ge=Is(se,pe,e);if(!ge)continue;const Pe=await ne(ge);Pe&&fe.push(Pe)}if(fe.length===0)return;const be=_.current,me=fe.find(pe=>lf(pe,be))??fe[0]??null;_.current=me,I.current=fe,v(me),w(fe),z(fe,me)},[e,z,ne,s]);x.useEffect(()=>{Z.current=ee},[ee]),x.useEffect(()=>{q(null)},[e,t,h,p,q]),x.useEffect(()=>{const Q=B.current;Q.activeCompPath===e&&Q.projectId===t||(B.current={activeCompPath:e,projectId:t},L.current=null,T(null),Y(null,{revealPanel:!1}))},[e,t,Y]),x.useEffect(()=>{if(!O)return;(i||lf(O,m)||Fp(b,O)||!O.element.isConnected)&&q(null)},[i,O,m,b,q]),x.useEffect(()=>{i&&Y(null,{revealPanel:!1})},[Y,i]),xet({previewIframeRef:s,buildDomSelectionFromTarget:ne,applyDomSelection:Y});const re=x.useCallback((Q,H)=>{if(yc("marquee",{hits:Q.length,additive:H}),Q.length===0){H||Y(null,{revealPanel:!1});return}const se=_.current,fe=I.current;let be;if(H){be=FY(fe,se);for(const pe of Q)Fp(be,pe)||(be=[...be,pe])}else{be=[];for(const pe of Q)Fp(be,pe)||be.push(pe)}const me=H&&se?se:Q[0];_.current=me,I.current=be,v(me),w(be),z(be,me)},[Y,z]);return{domEditSelection:m,domEditGroupSelections:b,domEditHoverSelection:O,activeGroupElement:E,domEditSelectionRef:_,domEditGroupSelectionsRef:I,domEditHoverSelectionRef:j,activeGroupElementRef:L,setDomEditSelection:v,setDomEditGroupSelections:w,setActiveGroupElement:J,applyDomSelection:Y,clearDomSelection:W,buildDomSelectionFromTarget:ne,resolveDomSelectionFromPreviewPoint:le,resolveAllDomSelectionsFromPreviewPoint:ie,updateDomEditHoverSelection:q,buildDomSelectionForTimelineElement:F,handleTimelineElementSelect:U,refreshDomEditSelectionFromPreview:K,refreshDomEditGroupSelectionsFromPreview:ee,applyMarqueeSelection:re}}const $Y=6,BY=600,Aet=400,wet=6;function Oet({captionEditMode:t,compositionLoading:e,previewIframeRef:n,showToast:r,applyDomSelection:i,resolveDomSelectionFromPreviewPoint:s,resolveAllDomSelectionsFromPreviewPoint:a,updateDomEditHoverSelection:o,setActiveGroupElement:l,onClickToSource:c}){const u=x.useRef(null),f=x.useRef(null),h=x.useCallback(()=>{const w=aet(n.current),O=ue.getState();O.setIsPlaying(!1),w!=null&&(O.setCurrentTime(w),xa.notify(w))},[n]),p=x.useCallback(async(w,O)=>{if(t||e)return;const k=Date.now(),E=f.current,T=w.detail>=2||E!=null&&k-E.t{N&&ue.getState().setIsPlaying(!0)};if(T&&!w.shiftKey){const W=await s(w.clientX,w.clientY),J=u.current,ne=J!==null&&J.candidates.length>1&&Math.hypot(w.clientX-J.x,w.clientY-J.y)<$Y&&k-J.at1?{x:w.clientX,y:w.clientY,candidates:Y,index:0,at:I}:null},[i,t,e,c,h,a,s,l]),y=x.useCallback(async(w,O)=>{if(t||e)return o(null),null;const k=await s(w.clientX,w.clientY,{preferClipAncestor:(O==null?void 0:O.preferClipAncestor)??!1,skipSourceProbe:!0});return o(k),k},[t,e,s,o]),m=x.useCallback(()=>{o(null)},[o]),v=x.useCallback(w=>{r(w.capabilities.reasonIfDisabled??"This element can't be adjusted directly from the preview.","info")},[r]),b=x.useCallback(()=>{h()},[h]);return{handlePreviewCanvasMouseDown:p,handlePreviewCanvasPointerMove:y,handlePreviewCanvasPointerLeave:m,handleBlockedDomMove:v,handleDomManualDragStart:b}}function LC(t,e="body",n={}){var r;return t===null?(r=n.allowNullPath)!=null&&r.call(n,e)?[]:[{path:e,reason:"null"}]:typeof t=="number"?Number.isFinite(t)?[]:[{path:e,reason:"non-finite-number"}]:!t||typeof t!="object"?[]:Array.isArray(t)?t.flatMap((i,s)=>LC(i,`${e}[${s}]`,n)):Object.entries(t).flatMap(([i,s])=>LC(s,`${e}.${i}`,n))}const Cet=/^body\.operations\[\d+\]\.value$/;function IR(t){return LC(t,"body",{allowNullPath:e=>Cet.test(e)})}const VY=["ABeeZee","Abel","Abril Fatface","Alegreya","Alegreya Sans","Anton","Archivo","Archivo Black","Arimo","Assistant","Barlow","Barlow Condensed","Bebas Neue","Bitter","Bricolage Grotesque","Cabin","Cardo","Catamaran","Caveat","Chivo","Cormorant Garamond","Crimson Text","Dancing Script","DM Sans","DM Serif Display","Domine","EB Garamond","Exo 2","Figtree","Fira Code","Fira Sans","Fraunces","Fredoka","IBM Plex Mono","IBM Plex Sans","IBM Plex Serif","Inconsolata","Instrument Sans","Instrument Serif","Inter","JetBrains Mono","Josefin Sans","Jost","Kanit","Karla","Lato","League Gothic","Lexend","Libre Baskerville","Libre Franklin","Lora","Manrope","Merriweather","Montserrat","Mukta","Mulish","Newsreader","Noto Sans","Noto Sans JP","Noto Serif","Nunito","Nunito Sans","Open Sans","Oswald","Outfit","Overpass","Pacifico","Pathway Extreme","Permanent Marker","Playfair Display","Plus Jakarta Sans","Poppins","Prata","PT Sans","PT Serif","Public Sans","Quicksand","Raleway","Red Hat Display","Roboto","Roboto Condensed","Roboto Mono","Roboto Serif","Rubik","Schibsted Grotesk","Signika","Source Code Pro","Source Sans 3","Source Serif 4","Space Grotesk","Space Mono","Spectral","Sora","Syne","Teko","Titillium Web","Ubuntu","Ubuntu Mono","Unbounded","Urbanist","Varela Round","Work Sans","Young Serif","Zilla Slab"],_R=["TT Norms Pro","SF Pro Display","SF Pro Text","Avenir","Avenir Next","Menlo","Monaco"];function HY(t){const e=Qqe(t);if(!(!e||e.toLowerCase()===t.toLowerCase()))return e}function f1e(t){return`https://fonts.googleapis.com/css2?family=${encodeURIComponent(t.trim()).replace(/%20/g,"+")}:wght@300;400;500;600;700;800;900&display=swap`}const ket=new Set(["inherit","initial","revert","revert-layer","serif","sans-serif","monospace","cursive","fantasy","system-ui","ui-sans-serif","ui-serif","ui-monospace","ui-rounded","emoji","math","fangsong"]);function Eet(t){return(t.split(",")[0]??"").trim().replace(/^["']|["']$/g,"")}function Tet(t){var e;return((e=t.split(",")[0])==null?void 0:e.trim().replace(/^["']|["']$/g,"").trim())??""}function QY(t,e){const n=Eet(e);if(!n||ket.has(n.toLowerCase()))return;const r=`studio-preview-google-font-${n.toLowerCase().replace(/[^a-z0-9]+/g,"-")}`;if(t.getElementById(r))return;const i=t.createElement("link");i.id=r,i.rel="stylesheet",i.href=f1e(n),t.head.appendChild(i)}function zY(t,e){const n=`studio-imported-font-${e.family.toLowerCase().replace(/[^a-z0-9]+/g,"-")}`;if(t.getElementById(n))return;const r=t.createElement("style");r.id=n,r.textContent=jF(e),t.head.appendChild(r)}function ZY(t,e,n){const r=jF(e,MIe(n,e.path));if(t.includes(r))return t;const s=/]*data-hf-studio-fonts=(["'])true\1[^>]*>([\s\S]*?)<\/style>/i.exec(t);if(s){const o=`${s[2].trim()} +`)}setPreviewVariables(e){var n;return(n=this.preview)!=null&&n.setPreviewVariables?(this.preview.setPreviewVariables(e),!0):!1}getElementTimings(){var u,f;const e=ER(this.parsed.document);let n;const r=(u=this._gsapLabelCache)==null?void 0:u.scripts;(r==null?void 0:r.length)===e.length&&r.every((h,p)=>h===e[p])?n=((f=this._gsapLabelCache)==null?void 0:f.labels)??[]:(n=e.flatMap(h=>ODe(h)),this._gsapLabelCache=e.length?{scripts:[...e],labels:n}:null);const s=new Map,a=new Set,o=h=>{const p=s.get(h);if(p)return p;if(a.has(h))return Td(h);a.add(h);try{const y=Td(h,{resolveReferenceEnd:m=>{const v=ma(this.parsed.document,m);if(!v)return null;const b=o(v);return b.end??b.start}});return s.set(h,y),y}finally{a.delete(h)}},l={},c=this.getElements();for(const h of c){const p=ma(this.parsed.document,h.scopedId);if(!p)continue;const y=o(p),m=y.start??0,v=y.duration;if(v===null)continue;const b=m+v,w=n.filter(({position:O})=>O>=m&&O<=b).map(({name:O})=>O);l[h.scopedId]={enterAt:m,exitAt:b,labels:w}}return l}setElementTiming(e){const n=Object.entries(e);n.length!==0&&this.batch(()=>{for(const[r,i]of n)this.dispatch({type:"setTiming",target:r,...i})})}setHold(e,n){this.dispatch({type:"setHold",target:e,hold:n})}addGsapTween(e,n){var i;return((i=this._dispatch({type:"addGsapTween",target:e,tween:n},Qh).meta)==null?void 0:i.animationId)??""}setGsapTween(e,n){this.dispatch({type:"setGsapTween",animationId:e,properties:n})}removeGsapTween(e){this.dispatch({type:"removeGsapTween",animationId:e})}addWithKeyframes(e,n,r,i,s){var o;return((o=this._dispatch({type:"addWithKeyframes",targetSelector:e,position:n,duration:r,keyframes:i,ease:s},Qh).meta)==null?void 0:o.animationId)??""}replaceWithKeyframes(e,n,r,i,s,a){var l;return((l=this._dispatch({type:"replaceWithKeyframes",animationId:e,targetSelector:n,position:r,duration:i,keyframes:s,ease:a},Qh).meta)==null?void 0:l.animationId)??""}undo(){var e;(e=this.historyModule)==null||e.undo()}redo(){var e;(e=this.historyModule)==null||e.redo()}canUndo(){var e;return((e=this.historyModule)==null?void 0:e.canUndo())??!1}canRedo(){var e;return((e=this.historyModule)==null?void 0:e.canRedo())??!1}getElements(){return this.elementsCache??(this.elementsCache=cKe(wY(this.parsed.document))),[...this.elementsCache]}getRootElements(){return this.rootsCache??(this.rootsCache=wY(this.parsed.document)),[...this.rootsCache]}getElement(e){return this.getElements().find(n=>n.scopedId===e)??this.getElements().find(n=>n.id===e&&n.scopedId===n.id)??null}find(e){return this.getElements().filter(n=>{var r;return!(e.tag&&n.tag!==e.tag||e.text&&!((r=n.text)!=null&&r.includes(e.text))||e.name&&n.attributes["data-name"]!==e.name||e.track!==void 0&&n.trackIndex!==e.track||e.composition&&!n.scopedId.startsWith(`${e.composition}/`))}).map(n=>n.scopedId)}getAllAnimationIds(){const e=new Set;for(const n of ER(this.parsed.document))for(const r of oKe(n))e.add(r);return e}selection(){const e=[...this.currentSelection];return{ids:e,setStyle:n=>this.dispatch({type:"setStyle",target:e,styles:n}),setText:n=>this.dispatch({type:"setText",target:e,value:n}),setAttribute:(n,r)=>this.dispatch({type:"setAttribute",target:e,name:n,value:r}),setTiming:n=>this.dispatch({type:"setTiming",target:e,...n}),removeElement:()=>this.dispatch({type:"removeElement",target:e})}}element(e){return{id:e,setStyle:n=>this.dispatch({type:"setStyle",target:e,styles:n}),setText:n=>this.dispatch({type:"setText",target:e,value:n}),setAttribute:(n,r)=>this.dispatch({type:"setAttribute",target:e,name:n,value:r}),setTiming:n=>this.dispatch({type:"setTiming",target:e,...n}),removeElement:()=>this.dispatch({type:"removeElement",target:e})}}getSelection(){return[...this.currentSelection]}setSelection(e){const n=Array.from(new Set(e));n.length===this.currentSelection.length&&n.every((r,i)=>r===this.currentSelection[i])||this.updateSelection(n)}updateSelection(e){this.currentSelection=[...e];for(const n of this.selectionHandlers)n([...this.currentSelection])}_dispatch(e,n){const r=pYe(this.parsed,e),{forward:i,inverse:s}=r;if(i.length===0&&s.length===0)return this.batchDepth===0&&this.changeHandlers.forEach(a=>a()),r;this.elementsCache=null,this.rootsCache=null;for(const a of i){const o=nY(a.path);o!==null&&(this.overrides[o]=a.op==="remove"?null:a.value)}for(const a of i){const o=/^\/elements\/([^/]+)$/.exec(a.path);if(a.op==="remove"&&o){const l=o[1].replace(/~1/g,"/").replace(/~0/g,"~");for(const c of Object.keys(this.overrides))(c.startsWith(`${l}.`)||c.startsWith(`${l}/`))&&delete this.overrides[c]}}if(this.batchDepth>0)this.batchForward.push(...i),this.batchInverse.push(...s),this.batchOpTypes.includes(e.type)||this.batchOpTypes.push(e.type);else{const a=pN(i,[...s].reverse(),n,[e.type]);this.patchHandlers.forEach(o=>o(a)),this.changeHandlers.forEach(o=>o())}return r}dispatch(e,n){this._dispatch(e,(n==null?void 0:n.origin)??Qh)}batch(e,n){const r=(n==null?void 0:n.origin)??Qh;this.batchDepth++,this.batchDepth===1&&(this.batchOrigin=r,this.batchOverridesSnapshot={...this.overrides});let i=!1;try{e()}catch(s){throw i=!0,s}finally{if(this.batchDepth--,this.batchDepth===0)if(!i&&this.batchForward.length>0){const s=pN(this.batchForward,[...this.batchInverse].reverse(),this.batchOrigin,this.batchOpTypes);this.patchHandlers.forEach(a=>a(s)),this.changeHandlers.forEach(a=>a()),this.resetBatchState()}else i&&this.batchInverse.length>0&&(NR(this.parsed,[...this.batchInverse].reverse()),this.overrides={...this.batchOverridesSnapshot},this.elementsCache=null,this.rootsCache=null),this.resetBatchState(),i||this.changeHandlers.forEach(s=>s())}}resetBatchState(){this.batchForward=[],this.batchInverse=[],this.batchOpTypes=[],this.batchOrigin=Qh,this.batchOverridesSnapshot={}}can(e){return nKe(this.parsed,e)}on(e,n){var i;const r=n;if(e==="change")return this.changeHandlers.push(r),()=>{this.changeHandlers=this.changeHandlers.filter(s=>s!==r)};if(e==="selectionchange")return this.selectionHandlers.push(r),()=>{this.selectionHandlers=this.selectionHandlers.filter(s=>s!==r)};if(e==="patch")return this.patchHandlers.push(r),()=>{this.patchHandlers=this.patchHandlers.filter(s=>s!==r)};if(e==="persist:error"){const s=r;this.errorHandlers.push(s);const a=(i=this.persist)==null?void 0:i.on("persist:error",s);return()=>{this.errorHandlers=this.errorHandlers.filter(o=>o!==s),a==null||a()}}return()=>{}}serialize(e){const n=AKe(this.parsed);return e!=null&&e.stripRuntime?pKe(n):n}getOverrides(){return{...this.overrides}}applyPatches(e,n){const r=(n==null?void 0:n.origin)??L4;NR(this.parsed,e),this.elementsCache=null,this.rootsCache=null;for(const a of e){const o=nY(a.path);o!==null&&(this.overrides[o]=a.op==="remove"?null:a.value)}const s=pN(e,[],r,["applyPatches"]);this.patchHandlers.forEach(a=>a(s)),this.changeHandlers.forEach(a=>a())}async flush(){var e;await((e=this.persistQueueModule)==null?void 0:e.flush())}dispose(){var e,n,r;(e=this.previewSelectionUnsubscribe)==null||e.call(this),this.previewSelectionUnsubscribe=null,(n=this.persistQueueModule)==null||n.dispose(),(r=this.historyModule)==null||r.dispose(),this.changeHandlers=[],this.selectionHandlers=[],this.patchHandlers=[],this.errorHandlers=[]}}async function US(t,e){const n=HXe(t),r=Lme(mo(n.document,n.wrapped));e!=null&&e.overrides&&CKe(n,e.overrides);const i=new MKe(n,e??{},r);if(!((e==null?void 0:e.overrides)!==void 0)){if((e==null?void 0:e.history)!==!1){const a=EKe(i,{coalesceMs:(e==null?void 0:e.coalesceMs)??300,trackedOrigins:e==null?void 0:e.trackedOrigins});i.attachHistory(a)}if(e!=null&&e.persist){const a=TKe(i,e.persist,{path:e.persistPath,onError:o=>i._fireError(o)});i.attachPersistQueue(a)}}return i}const dv={};function Q$(t){dv[t]=(dv[t]??0)+1,IKe()}function NKe(){const t=Object.keys(dv);if(t.length===0)return null;const e={};for(const n of t)e[n]=dv[n],delete dv[n];return e}const DKe=5*6e4;let OY=null,yN=null;function CY(){const t=NKe();t!==null&&Pt("sdk_resolver_shadow_attempt",{counts:JSON.stringify(t)})}function IKe(){OY||(OY=setInterval(CY,DKe)),!yN&&typeof document<"u"&&(yN=()=>{document.visibilityState==="hidden"&&(CY(),sae())},document.addEventListener("visibilitychange",yN))}function _Ke(t){const e=t.type==="attribute"?t.property.startsWith("data-")?t.property:`data-${t.property}`:t.type==="html-attribute"?t.property:null;return e===null||!e.startsWith("data-hf-")}const RKe=new Set(["inline-style","text-content","attribute","html-attribute"]);function jKe(t){return t.replace(/-([a-z])/g,(e,n)=>n.toUpperCase())}function kY(t){if(t==null)return null;const e=t.trim();return e===""?null:e}function Gme(t,e){return t.split(`data-hf-id="${e}"`).length-1+(t.split(`data-hf-id='${e}'`).length-1)}function DR(t,e){const n=t.getElements(),r=n.find(s=>s.scopedId===e);if(r)return r;const i=n.filter(s=>s.id===e);return i.find(s=>s.scopedId===s.id)??i[0]??null}function LKe(t,e){return{expected:t.value??null,actual:e.inlineStyles[jKe(t.property)]??e.inlineStyles[t.property]??null}}function FKe(t,e){return{expected:kY(t.value),actual:kY(e.text)}}function $Ke(t,e){const n=t.type==="attribute"?t.property.startsWith("data-")?t.property:`data-${t.property}`:t.property;return{property:n,expected:t.value??null,actual:e.attributes[n]??null}}function BKe(t,e,n){let r,i,s;if(t.type==="inline-style")r=t.property,{expected:i,actual:s}=LKe(t,e);else if(t.type==="text-content")r="text",{expected:i,actual:s}=FKe(t,e);else if(t.type==="attribute"||t.type==="html-attribute")({property:r,expected:i,actual:s}=$Ke(t,e));else return null;return s===i?null:{kind:"value_mismatch",hfId:n,property:r,expected:i,actual:s}}function VKe(t,e,n,r){if(!DR(t,e))return r!==void 0&&!r.includes(e)?[]:[{kind:"element_not_found",hfId:e}];const i=n.filter(_Ke);if(i.length===0)return[];if(i.some(o=>!RKe.has(o.type)))return[];const s=[],a=t.on("patch",o=>s.push(...o.inversePatches));try{try{const l=npe(e,i);t.batch(()=>{for(const c of l)t.dispatch(c)})}catch(l){return[{kind:"dispatch_error",hfId:e,error:String(l)}]}const o=DR(t,e);return o?i.map(l=>BKe(l,o,e)).filter(l=>l!==null):[{kind:"element_not_found",hfId:e}]}finally{a(),s.length>0&&t.applyPatches(s)}}function EY(t){return t==null?t:`[redacted len=${t.length}]`}function HKe(t){return t.map(e=>({...e,expected:EY(e.expected),actual:EY(e.actual)}))}const TY=new WeakSet;function Ume(t,e){return t.getElements().length!==0?!1:(TY.has(t)||(TY.add(t),Pt("sdk_resolver_shadow",{opLabel:e,sessionEmpty:!0,sessionElementCount:0,mismatchCount:1,mismatches:JSON.stringify([{kind:"session_empty"}])})),!0)}function z$(t){return(t==null?void 0:t.targetPath)!==void 0&&t.compositionPath!=null&&t.targetPath!==t.compositionPath}function QKe(t,e,n,r,i){if(u3&&e)try{if(z$(i)||Ume(t,"dom-edit"))return;Q$("dom-edit");const s=VKe(t,e,n,r);if(s.length===0)return;const o=s.some(l=>l.kind==="element_not_found")&&r!==void 0?Gme(r,e):void 0;Pt("sdk_resolver_shadow",{hfId:e,sessionElementCount:t.getElements().length,...o!==void 0?{sourceHfIdCount:o}:{},...o===0?{sourceLooseMatchOnly:!0}:{},mismatchCount:s.length,mismatches:JSON.stringify(HKe(s))})}catch{}}async function zKe(t,e){if(!e)return{suppress:!1,sourceReadFailed:!1};let n;try{n=await e()}catch{return{suppress:!1,sourceReadFailed:!0}}return n===void 0?{suppress:!1,sourceReadFailed:!1}:n.includes(t)?{suppress:!1,strictCount:Gme(n,t),sourceReadFailed:!1}:{suppress:!0,sourceReadFailed:!1}}async function XS(t,e,n,r,i){if(u3&&!(!t||!e))try{if(z$(i)||Ume(t,n)||(Q$(n),DR(t,e)))return;const s=t.getElements().length,a=await zKe(e,r);if(a.suppress)return;const{strictCount:o,sourceReadFailed:l}=a;Pt("sdk_resolver_shadow",{hfId:e,opLabel:n,sessionElementCount:s,...o!==void 0?{sourceHfIdCount:o}:{},...o===0?{sourceLooseMatchOnly:!0}:{},...l?{sourceReadFailed:!0}:{},mismatchCount:1,mismatches:JSON.stringify([{kind:"element_not_found",hfId:e}])})}catch{}}async function ZKe(t,e){let n;try{n=await e}catch{return{staleSession:!1,diskChecked:!1,sourceReadFailed:!0}}if(n===void 0)return{staleSession:!1,diskChecked:!1,sourceReadFailed:!1};let r;try{r=await US(n,{history:!1})}catch{return{staleSession:!1,diskChecked:!1,sourceReadFailed:!0}}try{return{staleSession:r.getAllAnimationIds().has(t),diskChecked:!0,sourceReadFailed:!1}}finally{r.dispose()}}async function Xme(t,e,n,r,i){if(u3&&!(!t||!e))try{if(z$(i))return;Q$(n);const s=t.getElements();if(s.some(u=>u.animationIds.includes(e))||t.getAllAnimationIds().has(e))return;const o=s.length;let l=!1,c=!1;if(r){const u=(async()=>r())(),f=await ZKe(e,u);if(f.staleSession)return;l=f.diskChecked,c=f.sourceReadFailed}Pt("sdk_resolver_shadow",{animationId:e,opLabel:n,sessionElementCount:o,...l?{diskChecked:!0}:{},...c?{sourceReadFailed:!0}:{},mismatchCount:1,mismatches:JSON.stringify([{kind:"animation_not_found",animationId:e}])})}catch{}}const GKe=new Set(["id","class","style","title","name","for","type","lang","dir","translate","hidden","tabindex","draggable","contenteditable","role","slot","href","target","rel","src","srcset","sizes","alt","poster","loading","decoding","crossorigin","preload","autoplay","loop","muted","controls","playsinline","width","height","colspan","rowspan","scope","placeholder","value","min","max","step","pattern","required","disabled","readonly","checked","selected","multiple","accept","maxlength","minlength","rows","cols","wrap"]),UKe=new Set(["src","href","action","formaction","poster","srcset","xlink:href"]),XKe=/^(?:javascript|vbscript):/i,WKe=/^data\s*:\s*text\/html/i;function qKe(t){const e=t.toLowerCase();return e.startsWith("on")?!1:!!(GKe.has(e)||e.startsWith("data-")||e.startsWith("aria-"))}function YKe(t,e){if(UKe.has(t.toLowerCase())){const n=e.trim();if(XKe.test(n)||WKe.test(n))return!1}return!0}const KKe=new Set(["inline-style","text-content","attribute","html-attribute"]),JKe=new Set(["data-hf-id","data-composition-id","data-width","data-height","data-start","data-end","data-track-index","data-hold-start","data-hold-end","data-hold-fill"]);function eJe(t){return t.type==="attribute"?t.property.startsWith("data-")?t.property:`data-${t.property}`:t.type==="html-attribute"?t.property:null}function tJe(t){const e=eJe(t);return e!==null&&JKe.has(e.toLowerCase())}function nJe(t){return t.some(e=>e.type==="html-attribute"&&(!qKe(e.property)||e.value!==null&&!YKe(e.property,e.value)))}function rJe(t){return t.some(e=>e.childSelector!==void 0)}function iJe(t){return t.some(e=>e.type==="text-content")}function sJe(t){if(!t||typeof t!="object"||!("children"in t))return null;const e=t.children;return Array.isArray(e)?e:null}function aJe(t){if(!t||typeof t!="object"||!("tag"in t))return null;const e=t.tag;return typeof e=="string"?e.toLowerCase():null}const oJe=new Set(["svg","math"]);function lJe(t,e){if(!iJe(e))return!1;const n=sJe(t);if(!n)return!1;if(n.length>1)return!0;const r=aJe(n[0]);return r!==null&&oJe.has(r)}function cJe(t,e,n,r){return t&&e&&!!n&&r.length>0&&r.every(i=>KKe.has(i.type))&&!rJe(r)&&!r.some(tJe)&&!nJe(r)}const uJe=2e3,pv=new Map;function Z$(t){let e=2166136261;for(let n=0;n>>0).toString(16)}function Wme(t,e){return t.filter(n=>e-n.ata.hash===i);return s===-1?(pv.set(t,r),!1):(r.splice(s,1),pv.set(t,r),!0)}function di(t){return{status:"declined",reason:t}}function Iu(t){return t instanceof Error?t:new Error(String(t))}function Ri(t){if(t.status==="failed")throw t.error;return t.status==="committed"}async function Yme(t,e,n){return t.readProjectFile?t.readProjectFile(e):n}function xN(t,e){t&&t!==e&&t.dispose()}function hJe(t,e,n){return n.createCandidateSession?n.createCandidateSession(t,e):US(t,{history:!1})}function dJe(t,e,n){return t===e||n.publishSession!==void 0}async function pJe(t,e,n,r){let i;try{const s=r??t.serialize();i=await hJe(s,t,e),i.batch(()=>n(i));const a=i.serialize();return a===s?(xN(i,t),di("no_change")):dJe(i,t,e)?{live:t,candidate:i,serializedBefore:s,after:a}:(xN(i,t),{status:"failed",error:new Error("SDK candidate publisher is unavailable")})}catch(s){return xN(i,t),{status:"failed",error:Iu(s)}}}function mJe(t){return"status"in t}async function gJe(t,e,n,r,i){try{return r.domEditSaveTimestampRef.current=Date.now(),qme(t,e),await r.writeProjectFile(t,e,n),i}catch(s){return new AggregateError([i,Iu(s)],`SDK edit failed and rollback could not restore ${t}`)}}async function Kme(t,e,n,r,i){r.domEditSaveTimestampRef.current=Date.now(),qme(e,t);try{await r.writeProjectFile(e,t,n)}catch(s){return Iu(s)}try{return await r.editHistory.recordEdit({label:(i==null?void 0:i.label)??"Edit layer",kind:"manual",...i!=null&&i.coalesceKey?{coalesceKey:i.coalesceKey}:{},...(i==null?void 0:i.coalesceMs)!=null?{coalesceMs:i.coalesceMs}:{},files:{[e]:{before:n,after:t}}}),null}catch(s){return gJe(e,n,t,r,Iu(s))}}function Jme(t,e,n){try{e.refresh?e.refresh(t):n!=null&&n.skipRefresh||e.reloadPreview()}catch(r){Pt("sdk_cutover_refresh_failed",{error:Iu(r).message})}}async function yJe(t,e,n,r,i){const s=await Kme(t.after,e,n,r,i);if(s)return t.candidate!==t.live&&t.candidate.dispose(),{status:"failed",error:s};let a=!0;try{if(t.candidate!==t.live){const o=r.publishSession({candidate:t.candidate,expectedSession:t.live,targetPath:e});o!=="published"&&t.candidate.dispose(),o==="rejected-inactive-target"&&(a=!1)}}catch(o){Pt("sdk_cutover_publish_failed",{path:e,error:Iu(o).message})}return a&&Jme(t.after,r,i),{status:"committed",version:Z$(t.after)}}async function jy(t,e,n,r,i,s,a){return wS(r.writeProjectFile,e,async()=>{const o=a??n;let l;try{l=await Yme(r,e,o)}catch(f){return{status:"failed",error:Iu(f)}}const c=r.readProjectFile?l:a,u=await pJe(t,r,i,c);return mJe(u)?u:yJe(u,e,l,r,s)})}async function e1e(t,e,n,r,i){await wS(r.writeProjectFile,e,async()=>{const s=await Yme(r,e,n),a=await t(s);if(a===s)return;const o=await Kme(a,e,s,r,i);if(o)throw o;Jme(a,r,i)})}function Ly(t){const e=Object.prototype.hasOwnProperty.call(qHe,"STUDIO_SDK_CUTOVER_FAMILIES")?Pde:void 0;return ZHe(RF,e,t)}function G$(t,e){t.status==="committed"?Pt("sdk_cutover_success",e):t.status==="failed"&&Pt("sdk_cutover_failed",{...e,error:t.error.message})}function WS(t,e){return t.compositionPath!=null&&e!==t.compositionPath}function t1e(t,e){const n=t.readProjectFile;return n?()=>n(e):void 0}async function xJe(t,e,n,r,i,s,a){if(!cJe(Ly("dom"),!!i,t.hfId,e))return di("ineligible_operation");if(!i)return di("session_unavailable");const o=t.hfId;if(!o)return di("target_unaddressable");const l=i.getElement(o);if(!l)return di("target_not_found");if(lJe(l,e))return di("unsupported_text_target");if(WS(s,r))return di("wrong_composition_file");const c=await jy(i,r,n,s,u=>{for(const f of npe(o,e))u.dispatch(f)},a);return G$(c,{hfId:o,opCount:e.length}),c}async function PY(t,e,n,r,i,s){const a=i.readProjectFile;if(XS(r,t,"setTiming",a?()=>a(e):void 0,{targetPath:e,compositionPath:i.compositionPath}),!Ly("timing"))return di("feature_disabled");if(!r)return di("session_unavailable");if(!r.getElement(t))return di("target_not_found");if(WS(i,e))return di("wrong_composition_file");try{const o=r.serialize(),l=await jy(r,e,o,i,c=>c.setTiming(t,n),s,o);return G$(l,{hfId:t,opCount:1}),l}catch(o){const l={status:"failed",error:Iu(o)};return Pt("sdk_cutover_failed",{hfId:t,error:l.error.message}),l}}async function bJe(t,e,n,r,i){var a,o,l;const s=r.readProjectFile;for(const c of t)XS(n,c.hfId,"setTiming",s?()=>s(e):void 0,{targetPath:e,compositionPath:r.compositionPath});if(!Ly("timing"))return di("feature_disabled");if(!n)return di("session_unavailable");if(WS(r,e))return di("wrong_composition_file");if(t.some(c=>!n.getElement(c.hfId)))return di("target_not_found");try{const c=n.serialize(),u=await jy(n,e,c,r,f=>{for(const h of t)f.setTiming(h.hfId,h.timingUpdate)},i,c);return u.status==="failed"?(Pt("sdk_cutover_failed",{hfId:((a=t[0])==null?void 0:a.hfId)??null,error:u.error.message}),u):(Pt("sdk_cutover_success",{hfId:((o=t[0])==null?void 0:o.hfId)??null,opCount:t.length}),u)}catch(c){const u={status:"failed",error:Iu(c)};return Pt("sdk_cutover_failed",{hfId:((l=t[0])==null?void 0:l.hfId)??null,error:u.error.message}),u}}function zp(t,e,n,r,i){if(e.kind==="add"){const s=r.readProjectFile;XS(n,e.target,"addGsapTween",s?()=>s(t):void 0,{targetPath:t,compositionPath:r.compositionPath})}else Xme(n,e.animationId,e.kind==="set"?"setGsapTween":"removeGsapTween",t1e(r,t),{targetPath:t,compositionPath:r.compositionPath});return Ly("gsap-animation")?e.kind==="add"&&n&&!n.getElement(e.target)?Promise.resolve(di("target_not_found")):Wd("gsap-animation",t,n,r,i,s=>{s.batch(()=>{e.kind==="add"?s.addGsapTween(e.target,e.spec):e.kind==="set"?s.setGsapTween(e.animationId,e.properties):s.removeGsapTween(e.animationId)})}):Promise.resolve(di("feature_disabled"))}async function Wd(t,e,n,r,i,s,a){if(a&&Xme(n,a.animationId,a.opLabel,t1e(r,e),{targetPath:e,compositionPath:r.compositionPath}),!Ly(t))return di("feature_disabled");if(!n)return di("session_unavailable");if(WS(r,e))return di("wrong_composition_file");const o=n;try{const l=o.serialize(),c=await jy(o,e,l,r,s,i,l);return c.status==="committed"?Pt("sdk_cutover_success",{opCount:1}):c.status==="failed"&&Pt("sdk_cutover_failed",{error:c.error.message}),c}catch(l){const c={status:"failed",error:Iu(l)};return Pt("sdk_cutover_failed",{error:c.error.message}),c}}function MY(t,e,n,r,i,s,a){return Wd("gsap-keyframe",t,i,s,a,o=>o.batch(()=>o.dispatch({type:"addGsapKeyframe",animationId:e,position:n,value:r})),{animationId:e,opLabel:"addGsapKeyframe"})}function vJe(t,e,n,r,i,s){return Wd("gsap-keyframe",t,r,i,s,a=>a.dispatch({type:"removeGsapKeyframe",animationId:e,percentage:n}),{animationId:e,opLabel:"removeGsapKeyframe"})}function AJe(t,e,n,r,i,s,a){return Wd("gsap-animation",t,i,s,a,o=>o.dispatch({type:"removeGsapProperty",animationId:e,property:n,from:r}),{animationId:e,opLabel:"removeGsapProperty"})}function SJe(t,e,n,r,i){return Wd("gsap-animation",t,n,r,i,s=>s.dispatch({type:"deleteAllForSelector",selector:e}))}function wJe(t,e,n,r,i){return Wd("gsap-keyframe",t,n,r,i,s=>s.dispatch({type:"removeAllKeyframes",animationId:e}),{animationId:e,opLabel:"removeAllKeyframes"})}function OJe(t,e,n,r,i,s){return Wd("gsap-keyframe",t,r,i,s,a=>a.dispatch({type:"convertToKeyframes",animationId:e,resolvedFromValues:n}),{animationId:e,opLabel:"convertToKeyframes"})}function CJe(t,e,n,r,i){return{targetSelector:t,position:e,duration:n,keyframes:r,...i?{ease:i}:{}}}function kJe(t,e,n){n!==void 0?t.dispatch({type:"replaceWithKeyframes",animationId:n,...e}):t.dispatch({type:"addWithKeyframes",...e})}function n1e(t){const e=CJe(t.targetSelector,t.position,t.duration,t.keyframes,t.ease);return Wd("gsap-keyframe",t.targetPath,t.sdkSession,t.deps,t.options,n=>kJe(n,e,t.animationId),t.animationId?{animationId:t.animationId,opLabel:"replaceWithKeyframes"}:void 0)}function EJe(t,e,n,r,i,s,a,o,l){return n1e({targetPath:t,targetSelector:e,position:n,duration:r,keyframes:i,ease:s,sdkSession:a,deps:o,options:l})}function TJe(t,e,n,r,i,s,a,o,l,c){return n1e({targetPath:t,animationId:e,targetSelector:n,position:r,duration:i,keyframes:s,ease:a,sdkSession:o,deps:l,options:c})}async function PJe(t,e,n,r,i){if(XS(r,t,"removeElement",()=>Promise.resolve(e),{targetPath:n,compositionPath:i.compositionPath}),!Ly("lifecycle"))return di("feature_disabled");if(!r)return di("session_unavailable");if(!r.getElement(t))return di("target_not_found");if(WS(i,n))return di("wrong_composition_file");const s=await jy(r,n,e,i,a=>a.removeElement(t),{label:"Delete element"});return G$(s,{hfId:t,opCount:1}),s}function IC(t,e){return t.sourceFile||e||"index.html"}function MJe(t,e){const n=t[0]?IC(t[0].element,e):null;return n&&t.every(r=>IC(r.element,e)===n)?n:null}function NJe(t){return`timeline-group-move:${t.map(e=>e.element.hfId??e.element.id).join(",")}`}function DJe(t){return`timeline-group-resize:${t.map(e=>e.element.hfId??e.element.id).join(",")}`}function NY(t,e){return t.map(n=>n.element.hfId?{hfId:n.element.hfId,timingUpdate:e(n)}:null)}function IJe(t){return t.playbackStart!=null||t.start!==t.element.start&&t.element.playbackStart!=null}function _Je({activeCompPath:t,domEditSaveTimestampRef:e,editQueueRef:n,forceReloadSdkSession:r,invalidateGsapCache:i,isRecordingRef:s,pendingTimelineEditPathRef:a,previewIframeRef:o,projectIdRef:l,recordEdit:c,reloadPreview:u,sdkSession:f,publishSdkSession:h,showToast:p,writeProjectFile:y}){const m=x.useCallback((k,E)=>{if(s!=null&&s.current)return p("Cannot edit timeline while recording","error"),Promise.reject(new Error(`${k}: blocked while recording`));const T=l.current;if(!T)return Promise.reject(new Error(`${k}: no active project`));const N=n.current.then(()=>E(T));return n.current=N.then(()=>{},_=>{console.error(`[Timeline] Failed to persist: ${k}`,_)}),N},[n,s,l,p]),v=x.useCallback(async(k,E,T,N,_)=>{await qLe({projectId:k,activeCompPath:t,label:E,changes:T,writeProjectFile:y,recordEdit:c,domEditSaveTimestampRef:e,pendingTimelineEditPathRef:a,coalesceKey:N,coalesceMs:_}),r==null||r()},[t,e,r,a,c,y]),b=x.useCallback(async k=>{const E=MJe(k.changes,t);if(!(!k.needsExtension&&E!==null&&k.eligible&&k.sdkChanges.every(_=>_!==null)))return!1;const N=await bJe(k.sdkChanges.filter(_=>_!==null),E,f,{editHistory:{recordEdit:c},writeProjectFile:y,reloadPreview:u,domEditSaveTimestampRef:e,compositionPath:t,readProjectFile:_=>ea(l.current??"",_),publishSession:h},{label:k.label,coalesceKey:k.coalesceKey,coalesceMs:k.coalesceMs,skipRefresh:!0});return Ri(N)},[t,e,l,h,c,u,f,y]),w=x.useCallback((k,E)=>{if(k.length===0)return Promise.resolve();for(const B of k){const $=[["data-start",mi(B.start)]];B.track!=null&&$.push(["data-track-index",mi(B.track)]),iC(o.current,B.element,$,t)}const T=k.every(B=>B.start===B.element.start),N=Math.max(...k.map(B=>B.start+B.element.duration)),_=mA(o.current),I=rC(N);nC(o.current);const j=(E==null?void 0:E.coalesceKey)??NJe(k),L=E==null?void 0:E.coalesceMs;return m("Move timeline clips",async B=>{if(await(E==null?void 0:E.beforeTiming),await b({changes:k,sdkChanges:NY(k,z=>({start:z.start})),eligible:k.every(z=>z.track==null),needsExtension:I,label:"Move timeline clips",coalesceKey:j,coalesceMs:L})||await v(B,"Move timeline clips",k.map(z=>({element:z.element,buildPatches:(Y,W)=>Lhe(Y,W,z.start,z.element.duration,z.track)})),j,L),!T)try{await tW({projectId:B,iframe:o.current,reloadPreview:u,label:"Move timeline clips",errorLabel:"Failed to shift GSAP positions",coalesceKey:j,recordEdit:c,activeCompPath:t,changes:k,resolveChangePath:z=>IC(z,t),mutateChange:(z,Y)=>{const W=z.start-z.element.start,J=z.element.domId;return W===0||!J?null:Ehe(B,Y,J,W)}})}finally{i==null||i()}}).catch(B=>{throw _(),p(Nu(B),"error"),B})},[t,m,v,o,c,u,b,p,i]),O=x.useCallback((k,E)=>{if(k.length===0)return Promise.resolve();for(const L of k){const B=[["data-start",mi(L.start)],["data-duration",mi(L.duration)]];if(L.playbackStart!=null){const $=sC(L.element);B.push([$,mi(L.playbackStart)])}iC(o.current,L.element,B,t)}const T=Math.max(...k.map(L=>L.start+L.duration)),N=mA(o.current),_=rC(T);nC(o.current);const I=(E==null?void 0:E.coalesceKey)??DJe(k),j=E==null?void 0:E.coalesceMs;return m("Resize timeline clips",async L=>{await(E==null?void 0:E.beforeTiming),await b({changes:k,sdkChanges:NY(k,$=>({start:$.start,duration:$.duration})),eligible:k.every($=>!IJe($)),needsExtension:_,label:"Resize timeline clips",coalesceKey:I,coalesceMs:j})||await v(L,"Resize timeline clips",k.map($=>({element:$.element,buildPatches:(z,Y)=>Fhe(z,Y,$.element,{start:$.start,duration:$.duration,playbackStart:$.playbackStart})})),I,j);try{await tW({projectId:L,iframe:o.current,reloadPreview:u,label:"Resize timeline clips",errorLabel:"Failed to scale GSAP positions",coalesceKey:I,recordEdit:c,activeCompPath:t,changes:k,resolveChangePath:$=>IC($,t),mutateChange:($,z)=>{const Y=$.element.domId;return!($.start!==$.element.start||$.duration!==$.element.duration)||!Y?null:The(L,z,Y,$.element.start,$.element.duration,$.start,$.duration)}})}finally{i==null||i()}}).catch(L=>{throw N(),p(Nu(L),"error"),L})},[t,m,v,o,c,u,b,p,i]);return{handleTimelineGroupMove:w,handleTimelineGroupResize:O}}const RJe=1500;function jJe(t){const e=x.useRef(0);return x.useCallback(n=>{const r=Date.now();r-e.current{if(h!=null&&h.current)return r("Cannot edit timeline while recording","error"),Promise.resolve();const K=w.current;if(!K)return Promise.resolve();const ee=O.current.then(()=>WLe({projectId:K,element:q,activeCompPath:e,label:F,buildPatches:U,writeProjectFile:i,recordEdit:a,domEditSaveTimestampRef:o,pendingTimelineEditPathRef:u,coalesceKey:Z})).then(()=>{m==null||m()});return O.current=ee.catch(re=>{console.error(`[Timeline] Failed to persist: ${F}`,re)}),ee},[e,a,i,o,u,r,h,m]),E=_Je({activeCompPath:e,domEditSaveTimestampRef:o,editQueueRef:O,forceReloadSdkSession:m,invalidateGsapCache:v,isRecordingRef:h,pendingTimelineEditPathRef:u,previewIframeRef:c,projectIdRef:w,recordEdit:a,reloadPreview:l,sdkSession:p,publishSdkSession:y,showToast:r,writeProjectFile:i}),T=x.useCallback((q,F)=>{const U=()=>{const Z=q.sourceFile||e||"index.html",K=F.start!==q.start,ee=F.track!==q.track;if(K||ee){const pe=[];K&&pe.push(["data-start",mi(F.start)]),ee&&pe.push(["data-track-index",mi(F.track)]),iC(c.current,q,pe,e)}const re=ULe({element:q,stackingReorder:F.stackingReorder,timelineElements:n,iframe:c.current,activeCompPath:e,commit:b==null?void 0:b.current});if(!K&&!ee)return re;const Q=mA(c.current),H=rC(F.start+q.duration);nC(c.current);const se=(pe,ge)=>{const Pe=ee?F.track:void 0;return Lhe(pe,ge,F.start,q.duration,Pe)},fe=`timeline-move:${q.hfId??q.id}`,be=()=>eW({iframe:c.current,reloadPreview:l,projectId:w.current,targetPath:Z,domId:q.domId,label:"Move timeline clip",coalesceKey:fe,recordEdit:a,edit:{kind:"shift",delta:F.start-q.start}}).finally(()=>v==null?void 0:v()),me=()=>k(q,"Move timeline clip",se,fe).then(be);return re.then(()=>p&&q.hfId&&!H&&!ee?PY(q.hfId,Z,{start:F.start},p,{editHistory:{recordEdit:a},writeProjectFile:i,reloadPreview:l,domEditSaveTimestampRef:o,compositionPath:e,readProjectFile:pe=>ea(w.current??"",pe),publishSession:y},{label:"Move timeline clip",coalesceKey:fe,skipRefresh:!0}).then(pe=>Ri(pe)?be():me()):me()).catch(pe=>{throw Q(),r(Nu(pe),"error"),pe})};return F.stackingReorder?OF(U):U()},[c,k,e,p,y,a,i,l,o,n,b,r,v]),N=x.useCallback((q,F)=>{const U=[["data-start",mi(F.start)],["data-duration",mi(F.duration)]];if(F.playbackStart!=null){const me=sC(q);U.push([me,mi(F.playbackStart)])}iC(c.current,q,U,e);const Z=mA(c.current),K=rC(F.start+F.duration);nC(c.current);const ee=q.sourceFile||e||"index.html",re=(me,pe)=>Fhe(me,pe,q,F),Q=F.playbackStart!=null||F.start!==q.start&&q.playbackStart!=null,H=`timeline-resize:${q.hfId??q.id}`,se=()=>eW({iframe:c.current,reloadPreview:l,projectId:w.current,targetPath:ee,domId:q.domId,label:"Resize timeline clip",coalesceKey:H,recordEdit:a,edit:{kind:"scale",from:{start:q.start,duration:q.duration},to:{start:F.start,duration:F.duration}}}).finally(()=>v==null?void 0:v()),fe=()=>k(q,"Resize timeline clip",re,H).then(se);return(p&&q.hfId&&!Q&&!K?PY(q.hfId,ee,{start:F.start,duration:F.duration},p,{editHistory:{recordEdit:a},writeProjectFile:i,reloadPreview:l,domEditSaveTimestampRef:o,compositionPath:e,readProjectFile:me=>ea(w.current??"",me),publishSession:y},{label:"Resize timeline clip",coalesceKey:H,skipRefresh:!0}).then(me=>Ri(me)?se():fe()):fe()).catch(me=>{throw Z(),r(Nu(me),"error"),me})},[c,k,e,p,y,a,i,l,o,r,v]),_=Sze({projectIdRef:w,activeCompPath:e,timelineElements:n,showToast:r,writeProjectFile:i,recordEdit:a,domEditSaveTimestampRef:o,previewIframeRef:c,pendingTimelineEditPathRef:u,isRecordingRef:h,forceReloadSdkSession:m}),I=wze({projectIdRef:w,activeCompPath:e,showToast:r,writeProjectFile:i,recordEdit:a,domEditSaveTimestampRef:o,previewIframeRef:c,pendingTimelineEditPathRef:u,isRecordingRef:h,forceReloadSdkSession:m}),j=Mze({projectIdRef:w,activeCompPath:e,showToast:r,writeProjectFile:i,recordEdit:a,domEditSaveTimestampRef:o,previewIframeRef:c,pendingTimelineEditPathRef:u,isRecordingRef:h}),L=yze({projectIdRef:w,activeCompPath:e,showToast:r,writeProjectFile:i,recordEdit:a,domEditSaveTimestampRef:o,previewIframeRef:c,pendingTimelineEditPathRef:u,isRecordingRef:h}),B=mze({projectIdRef:w,activeCompPath:e,showToast:r,writeProjectFile:i,recordEdit:a,domEditSaveTimestampRef:o,previewIframeRef:c,pendingTimelineEditPathRef:u,isRecordingRef:h}),{handleTimelineElementsDelete:$,handleTimelineElementDelete:z}=xze({projectIdRef:w,activeCompPath:e,timelineElements:n,showToast:r,writeProjectFile:i,recordEdit:a,domEditSaveTimestampRef:o,reloadPreview:l,isRecordingRef:h,forceReloadSdkSession:m,previewIframeRef:c}),{handleTimelineAssetDrop:Y,handleTimelineFileDrop:W,handleTimelineCompositionDrop:J}=uze({projectIdRef:w,activeCompPath:e,timelineElements:n,showToast:r,writeProjectFile:i,recordEdit:a,domEditSaveTimestampRef:o,reloadPreview:l,uploadProjectFiles:f,isRecordingRef:h,forceReloadSdkSession:m,observeProjectFileVersion:s}),ne=jJe(r),{handleRazorSplit:le,handleRazorSplitAll:ie}=oze({projectId:t,activeCompPath:e,showToast:r,writeProjectFile:i,observeProjectFileVersion:s,recordEdit:a,domEditSaveTimestampRef:o,reloadPreview:l,isRecordingRef:h,forceReloadSdkSession:m});if(new URLSearchParams(window.location.search).get("crocoView")==="script")window.__crocoTimelineAdapter={store:ue,resize:E.handleTimelineGroupResize,isAudio:Jo,projectId:t,compositionPath:e};return{handleTimelineElementMove:T,handleTimelineElementResize:N,handleToggleTrackHidden:_,handleToggleElementHidden:I,handleAutoGroupCarveSources:j,setAudioGroupAttribute:B,setElementFxAttribute:L,handleTimelineElementDelete:z,handleTimelineElementsDelete:$,handleTimelineElementSplit:le,handleRazorSplit:le,handleRazorSplitAll:ie,handleTimelineAssetDrop:Y,handleTimelineFileDrop:W,handleTimelineCompositionDrop:J,handleBlockedTimelineEdit:ne,...E}}function FJe(t,e,n,r,i){return r.handleTimelineGroupMove(t.map(({element:s,updates:a})=>({element:s,start:a.start,track:n==="timing"?void 0:a.track})),{coalesceKey:e,coalesceMs:i})}function $Je(t,e){return(e!=null&&e.isConnected?Array.from(e.children):[t]).filter(Pc)}function DY(t,e){const n=[];for(let i=t;i;i=i.parentElement)i.hasAttribute("data-hf-group")&&n.push(i);return(()=>{if(!e){const a=n[n.length-1];return a?{kind:"unit",element:a}:{kind:"child"}}const i=n.indexOf(e);if(i===-1)return{kind:"out-of-scope"};const s=n[i-1];return s?{kind:"unit",element:s}:{kind:"child"}})()}const BJe=1;function IY(t){if(!t)return null;const e=Number.parseFloat(t);return Number.isFinite(e)&&e>0?e:null}function y8(t,e){return Math.abs(t-e)<=BJe}function VJe(t){const e=t.querySelector("[data-composition-id]")??t.documentElement??null,n=IY((e==null?void 0:e.getAttribute("data-width"))??null),r=IY((e==null?void 0:e.getAttribute("data-height"))??null);return!e||!n||!r?null:{rect:e.getBoundingClientRect(),width:n,height:r}}function HJe(t,e){const n=t.getBoundingClientRect(),r=n.width||ru(e.width),i=n.height||ru(e.height);return r&&i?{width:r,height:i}:null}function QJe(t,e,n){return y8(t.left,n.rect.left)&&y8(t.top,n.rect.top)&&y8(e.width,n.width)&&y8(e.height,n.height)}function zJe(t){return t.position==="absolute"||t.position==="fixed"}function ZJe(t,e,n){if(t.parentElement!==e.body||t.hasAttribute("data-hf-allow-root-edit")||zJe(n))return!1;const r=VJe(e),i=HJe(t,n);return!!(r&&i&&QJe(t.getBoundingClientRect(),i,r))}function z4(t){return NLe(t.tagName.toLowerCase())&&t.children.length===0}function _Y(t){let e=0,n=t.previousElementSibling;for(;n;)n.tagName===t.tagName&&(e+=1),n=n.previousElementSibling;return e}function GJe(t,e,n,r){return r==="self"||n===1?"Content":`Text ${e+1}`}function bN(t,e,n,r,i){const s=t.tagName.toLowerCase();return{key:t.getAttribute("data-hf-text-key")??`${r}:${e}:${s}`,label:GJe(s,e,n,r),value:t.textContent??"",tagName:s,attributes:Array.from(t.attributes).filter(o=>o.name!=="style").map(o=>({name:o.name,value:o.value})),inlineStyles:Dhe(t),computedStyles:Nhe(t),source:r,...i==null?{}:{sourceChildIndex:i}}}function r1e(t){const e=Array.from(t.children).filter(Pc).filter(z4);if(e.length>0){if(Array.from(t.childNodes).some(r=>{var i;return r.nodeType===3&&((i=r.textContent)==null?void 0:i.trim())})){const r=[];let i=0;for(const s of t.childNodes)if(s.nodeType===3){const a=s.textContent??"";if(!a.trim())continue;r.push({key:`text-node:${i}`,label:`Text ${i+1}`,value:a,tagName:"#text",attributes:[],inlineStyles:{},computedStyles:{},source:"text-node"}),i++}else Pc(s)&&z4(s)&&(r.push(bN(s,i,e.length,"child",_Y(s))),i++);return r}return e.map((r,i)=>bN(r,i,e.length,"child",_Y(r)))}return z4(t)?[bN(t,0,1,"self")]:[]}function RY(t){return t.replace(/&/g,"&").replace(//g,">")}function UJe(t){const e=Object.entries(t.inlineStyles).filter(([,n])=>!!n);return e.length===0?"":e.map(([n,r])=>`${n}: ${r}`).join("; ")}function i1e(t){return t.filter(e=>e.source==="child"||e.source==="text-node").map(e=>{if(e.source==="text-node")return RY(e.value);const n=[...e.attributes.filter(s=>s.name!=="data-hf-text-key"),{name:"data-hf-text-key",value:e.key}].map(s=>` ${s.name}="${s.value.replace(/"/g,""")}"`).join(""),r=UJe(e),i=r?` style="${r.replace(/"/g,""")}"`:"";return`<${e.tagName}${n}${i}>${RY(e.value)}`}).join("")}function s1e(t){var e,n,r,i;return{key:`child:new:${Date.now()}`,label:"Text",value:"New text",tagName:"span",attributes:[],inlineStyles:{"font-family":((e=t==null?void 0:t.computedStyles)==null?void 0:e["font-family"])??"inherit","font-size":((n=t==null?void 0:t.computedStyles)==null?void 0:n["font-size"])??"16px","font-weight":((r=t==null?void 0:t.computedStyles)==null?void 0:r["font-weight"])??"400",color:((i=t==null?void 0:t.computedStyles)==null?void 0:i.color)??"inherit"},computedStyles:{},source:"child"}}function a1e(t,e){const n=t.find(r=>r.key===e);return!n||n.source!=="child"||n.sourceChildIndex==null?null:{childSelector:`:scope > ${n.tagName}`,childIndex:n.sourceChildIndex}}function XJe(t){return{...t,hasEditableText:!1,hasTimingStart:!1,animationCount:0}}function U$(t,e=(n=>(n=t.gsapAnimations)==null?void 0:n.length)()??0){return{hasStableTarget:!!(t.selector||t.hfId),tag:t.tagName,inlineStyles:t.inlineStyles,computedStyles:t.computedStyles,isCompositionHost:t.isCompositionHost,isCompositionRoot:!1,isInsideLockedComposition:t.isInsideLockedComposition,isMasterView:!1,existsInSource:!0,hasEditableText:t.textFields.length>0,hasTimingStart:t.dataAttributes.start!=null,animationCount:e}}async function WJe(t,e,n){try{const r=await fetch(`/api/projects/${t}/file-mutations/probe-element/${encodeURIComponent(e)}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({target:n})});if(!r.ok)return!0;const i=await r.json();return!(i&&typeof i=="object"&&"exists"in i&&i.exists===!1)}catch{return!0}}async function O3(t,e){var s;if(!t)return null;const n=t.ownerDocument;let r=DY(t,e.activeGroupElement??null);r.kind==="out-of-scope"&&(r=DY(t,null));let i=r.kind==="unit"?r.element:VLe(t,e);for(;i&&i!==n.body&&i!==n.documentElement;){const a=kS(i),o=vA(i);if(!a&&!o){i=i.parentElement;continue}const{sourceFile:l,compositionPath:c}=CS(i,e.activeCompositionPath),u=a?SF(n,i,a,l,e.activeCompositionPath):void 0,f=i.getAttribute("data-composition-src")??i.getAttribute("data-composition-file")??void 0,h=Dhe(i),p=Nhe(i),y=i.hasAttribute("data-composition-id")&&!f||ZJe(i,n,p),m=r1e(i),v=!!I_(i,["data-timeline-locked"]);let b;if(!e.skipSourceProbe&&e.projectId&&(i.id||a||o)){const k={};i.id&&(k.id=i.id),o&&(k.hfId=o),a&&(k.selector=a),u!=null&&(k.selectorIndex=u),b=await WJe(e.projectId,l,k)}const w=MLe(XJe({hasStableTarget:!!(a||o),tag:i.tagName.toLowerCase(),inlineStyles:h,computedStyles:p,isCompositionHost:!!f,isCompositionRoot:y,isInsideLockedComposition:v,isMasterView:e.isMasterView,existsInSource:b??!0})).capabilities,O=i.getBoundingClientRect();return{element:i,id:i.id||void 0,hfId:o,selector:a,selectorIndex:u,sourceFile:l,compositionPath:c,compositionSrc:f,isCompositionHost:!!f,isInsideLockedComposition:v,label:Rhe(i),tagName:i.tagName.toLowerCase(),boundingBox:{x:O.left,y:O.top,width:O.width,height:O.height},textContent:((s=i.textContent)==null?void 0:s.trim())||null,dataAttributes:DLe(i),inlineStyles:h,computedStyles:p,textFields:m,capabilities:w}}return null}function X$(t){const e=t.selectorIndex??0;return`${t.sourceFile}:${t.id??t.selector??"layer"}:${e}`}function C3(t,e,n=Number.POSITIVE_INFINITY){if(!t)return[];const r=[],i=(s,a)=>{if(r.length>=n)return;const o=Rg(s,e.activeCompositionPath);o&&r.push({key:X$(o),element:s,label:Rhe(s),tagName:s.tagName.toLowerCase(),depth:a,childCount:QLe(s,e).length,id:o.id??void 0,hfId:o.hfId??void 0,selector:o.selector??void 0,selectorIndex:o.selectorIndex,sourceFile:o.sourceFile});const l=o?a+1:a;for(const c of Array.from(s.children))if(Pc(c)&&(i(c,l),r.length>=n))return};for(const s of $Je(t,e.activeGroupElement??null))i(s,0);return r}function j1(t,e,n){return{type:"inline-style",property:t,value:e,...n}}function W$(t,e){return{type:"text-content",property:"text",value:t,...e}}function q$(t){return{type:"rich-text",property:"",value:t}}function gc(t){return[t.sourceFile||"index.html",t.hfId??"",t.id??"",t.selector??"",t.selectorIndex??""].join("|")}function ih(t){return AF(U$(t)).text}function vA(t){var e;return((e=t.getAttribute("data-hf-id"))==null?void 0:e.trim())||void 0}function Wg(t){return{id:t.id,hfId:t.hfId,selector:t.selector,selectorIndex:t.selectorIndex}}const qJe=Object.freeze(Object.defineProperty({__proto__:null,buildDefaultDomEditTextField:s1e,buildDomEditPatchTarget:Wg,buildDomEditRichTextPatchOperation:q$,buildDomEditStylePatchOperation:j1,buildDomEditTextPatchOperation:W$,buildTextFieldChildLocator:a1e,collectDomEditLayerItems:C3,collectDomEditTextFields:r1e,domEditSelectionToFacts:U$,getDomEditLayerKey:X$,getDomEditTargetKey:gc,isEditableTextLeaf:z4,isTextEditableSelection:ih,readHfId:vA,resolveDomEditSelection:O3,serializeDomEditTextFields:i1e},Symbol.toStringTag,{value:"Module"}));function YJe({activeCompPath:t,projectDir:e,projectIdRef:n,showToast:r,domEditSelectionRef:i,domEditSelection:s}){const[a,o]=x.useState(),[l,c]=x.useState(),[u,f]=x.useState(null),[h,p]=x.useState(!1),[y,m]=x.useState(!1),v=x.useRef(null),b=x.useCallback(async k=>{const E=n.current;if(!E)return;const T=k.sourceFile||t||"index.html";try{const N=await fetch(`/api/projects/${E}/files/${encodeURIComponent(T)}`);if(!N.ok)return;const I=(await N.json()).content,j=typeof I=="string"?SS(I,k):void 0;o(L=>i.current!==k?L:j)}catch{}},[t,i,n]),w=x.useCallback(()=>{s&&(o(void 0),c(void 0),f(null),b(s),m(!0))},[s,b]),O=x.useCallback(async k=>{if(!s)return;const E=s.sourceFile||t||"index.html",T=a??s.element.outerHTML,N=gHe({selection:s,currentTime:ue.getState().currentTime,tagSnippet:T,selectionContext:l,userInstruction:k,sourceFilePath:DIe(e,E)});if(!await Uf(N)){r("Could not copy prompt to clipboard.","error");return}m(!1),c(void 0),f(null),v.current&&clearTimeout(v.current),p(!0),v.current=setTimeout(()=>p(!1),1600)},[t,l,a,s,e,r]);return x.useEffect(()=>{o(void 0),c(void 0),f(null),p(!1)},[s]),x.useEffect(()=>()=>{v.current&&clearTimeout(v.current)},[]),{agentModalOpen:y,agentModalAnchorPoint:u,copiedAgentPrompt:h,agentPromptSelectionContext:l,setAgentModalOpen:m,setAgentPromptSelectionContext:c,setAgentModalAnchorPoint:f,preloadAgentPromptSnippet:b,handleAskAgent:w,handleAgentModalSubmit:O}}const jY=.95,KJe=new Set(["video","img","canvas","svg"]);function o1e(t,e){return e.width<=1||e.height<=1?!1:t.width/e.width>=jY&&t.height/e.height>=jY}function _C(t,e){return KJe.has(t.tagName.toLowerCase())?!1:o1e(t.getBoundingClientRect(),e)}function l1e(t,e,n,r,i){const s=t.getBoundingClientRect(),a=e.querySelector("[data-composition-id]")??e.documentElement??null,o=a==null?void 0:a.getBoundingClientRect(),l=(o==null?void 0:o.width)||n.innerWidth,c=(o==null?void 0:o.height)||n.innerHeight;if(!l||!c)return null;const u=s.width/l,f=s.height/c;return{x:(r-s.left)/u,y:(i-s.top)/f,viewport:{width:l,height:c}}}const JJe="__hf_studio_pointer_events_override__";function c1e(t){try{const e=t.createElement("style");return e.id=JJe,e.textContent="* { pointer-events: auto !important; }",t.head.appendChild(e),e}catch{return null}}function sg(t){try{t==null||t.remove()}catch{}}const LY=new WeakMap;function eet(t,e){const n=LY.get(t);if(n!==void 0)return n;const r=t.createElement("div"),i=t.createElement("div");r.style.pointerEvents="none",r.appendChild(i);const s=t.body??t.documentElement;if(!s)return!1;s.appendChild(r);const a=e.getComputedStyle(i).pointerEvents!=="none";return r.remove(),LY.set(t,a),a}function tet(t,e){const n=e.getComputedStyle(t).pointerEvents;return n!==""&&n!=="inherit"&&n!=="unset"}function net(t,e){let n=t.parentElement;for(;n;){if(e.getComputedStyle(n).pointerEvents==="none"){let r=t;for(;r&&r!==n;){if(tet(r,e))return e.getComputedStyle(r).pointerEvents==="none";r=r.parentElement}return!0}n=n.parentElement}return!1}function RC(t){const e=t.ownerDocument.defaultView;return e?e.getComputedStyle(t).pointerEvents==="none"?!0:eet(t.ownerDocument,e)?net(t,e):!1:!1}function ret(t){const e=new WeakSet;for(const n of t)Pc(n)&&RC(n)&&e.add(n);return e}function u1e(t,e){const n=ret(t);return HLe(t,{activeCompositionPath:e}).filter(r=>!n.has(r))}function iet(t,e,n){let r=null,i=1/0;for(const s of Array.from(t.querySelectorAll("[data-hf-group]"))){let a=1/0,o=1/0,l=-1/0,c=-1/0;for(const f of Array.from(s.children)){const h=f.getBoundingClientRect();h.width===0&&h.height===0||(a=Math.min(a,h.left),o=Math.min(o,h.top),l=Math.max(l,h.right),c=Math.max(c,h.bottom))}if(ll||nc)continue;const u=(l-a)*(c-o);u!_C(p,a.viewport))??null;if(h)return h}sg(o),o=null;const l=iet(i,a.x,a.y);if(l&&!RC(l)&&Rg(l,r))return l;const c=Kce(i.elementFromPoint(a.x,a.y));return!c||!Rg(c,r)||RC(c)||!Sy(c)||_C(c,a.viewport)?null:c}finally{sg(o)}}function set(t,e,n,r){let i=null,s=null;try{i=t.contentDocument,s=t.contentWindow}catch{return[]}if(!i||!s)return[];const a=l1e(t,i,s,e,n);if(!a)return[];let o=c1e(i);try{if(typeof i.elementsFromPoint=="function"){const c=i.elementsFromPoint(a.x,a.y);return sg(o),o=null,u1e(c,r).filter(u=>!_C(u,a.viewport))}const l=Kce(i.elementFromPoint(a.x,a.y));return!l||!Rg(l,r)?[]:(sg(o),o=null,RC(l)?[]:Sy(l)?_C(l,a.viewport)?[]:[l]:[])}finally{sg(o)}}function x8(t){return t&&(typeof t=="object"||typeof t=="function")?t:null}function vN(t,e){const n=t?Reflect.get(t,e):null;if(typeof n=="function")try{n.call(t)}catch{}}function AN(t,e){const n=t?Reflect.get(t,e):null;if(typeof n!="function")return null;try{const r=n.call(t);return typeof r=="number"&&Number.isFinite(r)?r:null}catch{return null}}function aet(t){const e=t==null?void 0:t.contentWindow;if(!e)return null;try{const n=x8(Reflect.get(e,"__player")),r=AN(n,"getTime");if(typeof(n?Reflect.get(n,"pause"):null)=="function")return vN(n,"pause"),r;let s=null;const a=x8(Reflect.get(e,"__timeline"));s=s??AN(a,"time"),vN(a,"pause");const o=x8(Reflect.get(e,"__timelines"));if(o)for(const l of Object.values(o)){const c=x8(l);s=s??AN(c,"time"),vN(c,"pause")}return s}catch{return null}}function lf(t,e){return t===e?!0:!t||!e?!1:gc(t)===gc(e)}function Fp(t,e){return e?t.some(n=>lf(n,e)):!1}function oet(t,e){return Fp(t,e)?t.filter(n=>!lf(n,e)):[...t,e]}function cet(t,e){let n=!1;const r=t.map(i=>lf(i,e)?(n=!0,e):i);return n?r:[...t,e]}function FY(t,e){return!e||Fp(t,e)?t:[e,...t]}function uet(t){const e=Number(t);return Number.isFinite(e)&&e>=0?e:0}function fet(t){const e={idle:0,loading:0,ready:0,fallback:0,error:0};for(const n of t.querySelectorAll("[data-timeline-poster-state]")){const r=n.dataset.timelinePosterState;r&&Object.hasOwn(e,r)&&(e[r]+=1)}return Object.freeze(e)}function het(t){const e=new Map;for(const n of t.querySelectorAll('[data-clip="true"]')){const r=n.closest("[data-timeline-row]");r&&e.set(r,(e.get(r)??0)+1)}return Math.max(0,...e.values())}function SN(t,e,n){let r=0;for(const i of t.querySelectorAll(e))r+=uet(i.dataset[n]);return r}function det(t=document){const e=t.querySelectorAll('[aria-label="Timeline"]');let n=0;for(const r of e)n+=r.querySelectorAll("*").length;return Object.freeze({timelineRoots:e.length,mountedRows:t.querySelectorAll("[data-timeline-row]").length,mountedClipRoots:t.querySelectorAll('[data-clip="true"]').length,maxMountedClipRootsInOneRow:het(t),mountedTimeGridCells:t.querySelectorAll("[data-timeline-grid-cell]").length,mountedTimelineDescendants:n,schedulerQueued:SN(t,"[data-timeline-scheduler-queued]","timelineSchedulerQueued"),schedulerActive:SN(t,"[data-timeline-scheduler-active]","timelineSchedulerActive"),cacheBytes:SN(t,"[data-timeline-cache-bytes]","timelineCacheBytes"),posterStates:fet(t)})}const pet={BASE_URL:"/",DEV:!1,MODE:"production",PROD:!0,SSR:!1};function met(){try{return pet}catch{return}}const cf=met(),get=cf!=null&&cf.DEV?"development":"production",yet=(cf==null?void 0:cf.DEV)===!0||(cf==null?void 0:cf.MODE)==="development";function xet({previewIframeRef:t,buildDomSelectionFromTarget:e,applyDomSelection:n}){x.useEffect(()=>{if(!yet||typeof window>"u")return;const r={runtimeMode:get,selectByDomId:async i=>{var o,l;const s=((l=(o=t.current)==null?void 0:o.contentDocument)==null?void 0:l.getElementById(i))??null;if(!s)return!1;const a=await e(s);return a?(n(a,{revealPanel:!0}),!0):!1},loadTimelinePerformanceFixture:i=>{const s=LVe(i);return NVe(!0),ue.setState({...JI(),currentTime:0,duration:s.summary.duration,timelineReady:!0,loopEnabled:!1,zoomMode:"manual",manualZoomPercent:2e3,elements:s.elements,selectedElementId:null,selectedElementIds:new Set,selectedKeyframes:new Set,keyframeCache:s.keyframeCache,gsapAnimations:s.gsapAnimations,expandedClipIds:s.expandedClipIds}),s.summary},resetTimelinePerformanceFixture:()=>{ue.getState().reset()},readTimelinePerformanceDiagnostics:()=>det(),timelineViewportBudgets:tl};return window.__studioTest=r,()=>{delete window.__studioTest}},[n,e,t])}const yc=W0("select");function bet(t,e,n){const{timelineElements:r,getTimelineSelectionSet:i,setSelectedTimelineElementId:s,setTimelineSelectionSet:a}=t;if(!n){a(new Set),s(null);return}const o=h=>GL(h,r)??eue(h.element,r,h.sourceFile||"index.html"),l=e.map(o).filter(h=>!!h),c=o(n),u=new Set(l);c&&u.add(c);const f=c??l[0]??null;if(yc("announce",{group:e.length,published:u.size,anchor:c,anchorPublished:c!=null&&u.has(c)}),!f){n.tagName.toLowerCase()===ya&&(a(new Set),s(null));return}(e.length>1||!i().has(f))&&a(u),s(f,{preserveSet:!0})}function vet({projectId:t,activeCompPath:e,isMasterView:n,compIdToSrc:r,captionEditMode:i,previewIframeRef:s,timelineElements:a,getTimelineSelectionSet:o,setSelectedTimelineElementId:l,setTimelineSelectionSet:c,setRightCollapsed:u,setRightPanelTab:f,previewIframe:h,refreshKey:p,rightPanelTab:y}){const[m,v]=x.useState(null),[b,w]=x.useState([]),[O,k]=x.useState(null),[E,T]=x.useState(null),N=x.useRef(y);N.current=y;const _=x.useRef(m),I=x.useRef(b),j=x.useRef(O),L=x.useRef(E),B=x.useRef({activeCompPath:e,projectId:t}),$=x.useRef(0);_.current=m,I.current=b,j.current=O,L.current=E;const z=x.useCallback((Q,H)=>bet({timelineElements:a,getTimelineSelectionSet:o,setSelectedTimelineElementId:l,setTimelineSelectionSet:c},Q,H),[o,l,c,a]),Y=x.useCallback((Q,H)=>{if(!Q){yc("clear",{hadGroup:I.current.length}),_.current=null,I.current=[],v(null),w([]),(H==null?void 0:H.announce)!==!1&&z([],null);return}const se=!!(H!=null&&H.additive),fe=_.current,be=I.current;if(!se&&!(H!=null&&H.preserveGroup)&&be.length===1&&lf(fe,Q)&&lf(be[0],Q)){(H==null?void 0:H.revealPanel)!==!1&&(u(!1),N.current!=="variables"&&f("design"));return}const pe=se?FY(be,fe):be,ge=Fp(pe,Q),Pe=H!=null&&H.preserveGroup?cet(pe,Q):se?oet(pe,Q):[Q],ve=H!=null&&H.preserveGroup?Q:se&&ge?lf(fe,Q)?Pe[0]??null:Fp(Pe,fe)?fe:Pe[0]??null:Q;yc("apply",{additive:se,target:Q.selector??Q.id??null,wasInGroup:ge,prevGroup:be.length,nextGroup:Pe.length}),_.current=ve,I.current=Pe,v(ve),w(Pe);const xe=L.current;if(xe&&ve&&!xe.contains(ve.element)&&(L.current=null,T(null)),ve){(H==null?void 0:H.revealPanel)!==!1&&(u(!1),N.current!=="variables"&&f("design")),z(Pe,ve);return}z([],null)},[z,u,f]),W=x.useCallback(()=>{Y(null,{revealPanel:!1})},[Y]),J=x.useCallback(Q=>{L.current!==Q&&(L.current=Q,T(Q),Y(null,{revealPanel:!1}))},[Y]),ne=x.useCallback((Q,H)=>O3(Q,{activeCompositionPath:e,isMasterView:n,preferClipAncestor:H==null?void 0:H.preferClipAncestor,skipSourceProbe:H==null?void 0:H.skipSourceProbe,activeGroupElement:H&&"activeGroupElement"in H?H.activeGroupElement:L.current,projectId:t}),[e,n,t]),le=x.useCallback(async(Q,H,se)=>{const fe=s.current;if(!fe||i)return null;try{fe.contentDocument&&ov(fe.contentDocument)}catch{}const be=jC(fe,Q,H,e);return be?ne(be,se&&"activeGroupElement"in se?{preferClipAncestor:se.preferClipAncestor,skipSourceProbe:se.skipSourceProbe,activeGroupElement:se.activeGroupElement}:{preferClipAncestor:se==null?void 0:se.preferClipAncestor,skipSourceProbe:se==null?void 0:se.skipSourceProbe}):null},[e,ne,i,s]),ie=x.useCallback(async(Q,H)=>{const se=s.current;if(!se||i)return[];try{se.contentDocument&&ov(se.contentDocument)}catch{}const fe=set(se,Q,H,e),be=[];for(const me of fe){const pe=await ne(me,{skipSourceProbe:!0});pe&&be.push(pe)}return be},[e,ne,i,s]),q=x.useCallback(Q=>{lf(j.current,Q)||(j.current=Q,k(Q))},[]),F=x.useCallback(async Q=>{const H=s.current;let se=null;try{se=(H==null?void 0:H.contentDocument)??null}catch{return null}if(!se)return null;ov(se);const fe=jhe(se,Q,{activeCompositionPath:e,compIdToSrc:r,isMasterView:n});return fe?ne(fe,{preferClipAncestor:!1}):null},[e,ne,r,n,s]),U=x.useCallback(async Q=>{const H=++$.current;if(!Q){Y(null,{revealPanel:!1});return}const se=await F(Q);if(H===$.current){if(se){Y(se);return}Y(null,{revealPanel:!1,announce:!1})}},[Y,F]),Z=x.useRef(async()=>{}),K=x.useCallback(async Q=>{const H=s.current;let se=null;try{se=(H==null?void 0:H.contentDocument)??null}catch{return}if(!se)return;const fe=Is(se,Q,e);if(!fe){const me=I.current;if(yc("refresh-lost",{target:Q.selector??Q.id??null,group:me.length}),me.length>1){await Z.current(me);return}Y(null,{revealPanel:!1});return}const be=await ne(fe);be&&Y(be,{revealPanel:!1,preserveGroup:!0})},[e,Y,ne,s]),ee=x.useCallback(async Q=>{const H=s.current;let se=null;try{se=(H==null?void 0:H.contentDocument)??null}catch{return}if(!se)return;const fe=[];for(const pe of Q){const ge=Is(se,pe,e);if(!ge)continue;const Pe=await ne(ge);Pe&&fe.push(Pe)}if(fe.length===0)return;const be=_.current,me=fe.find(pe=>lf(pe,be))??fe[0]??null;_.current=me,I.current=fe,v(me),w(fe),z(fe,me)},[e,z,ne,s]);x.useEffect(()=>{Z.current=ee},[ee]),x.useEffect(()=>{q(null)},[e,t,h,p,q]),x.useEffect(()=>{const Q=B.current;Q.activeCompPath===e&&Q.projectId===t||(B.current={activeCompPath:e,projectId:t},L.current=null,T(null),Y(null,{revealPanel:!1}))},[e,t,Y]),x.useEffect(()=>{if(!O)return;(i||lf(O,m)||Fp(b,O)||!O.element.isConnected)&&q(null)},[i,O,m,b,q]),x.useEffect(()=>{i&&Y(null,{revealPanel:!1})},[Y,i]),xet({previewIframeRef:s,buildDomSelectionFromTarget:ne,applyDomSelection:Y});const re=x.useCallback((Q,H)=>{if(yc("marquee",{hits:Q.length,additive:H}),Q.length===0){H||Y(null,{revealPanel:!1});return}const se=_.current,fe=I.current;let be;if(H){be=FY(fe,se);for(const pe of Q)Fp(be,pe)||(be=[...be,pe])}else{be=[];for(const pe of Q)Fp(be,pe)||be.push(pe)}const me=H&&se?se:Q[0];_.current=me,I.current=be,v(me),w(be),z(be,me)},[Y,z]);return{domEditSelection:m,domEditGroupSelections:b,domEditHoverSelection:O,activeGroupElement:E,domEditSelectionRef:_,domEditGroupSelectionsRef:I,domEditHoverSelectionRef:j,activeGroupElementRef:L,setDomEditSelection:v,setDomEditGroupSelections:w,setActiveGroupElement:J,applyDomSelection:Y,clearDomSelection:W,buildDomSelectionFromTarget:ne,resolveDomSelectionFromPreviewPoint:le,resolveAllDomSelectionsFromPreviewPoint:ie,updateDomEditHoverSelection:q,buildDomSelectionForTimelineElement:F,handleTimelineElementSelect:U,refreshDomEditSelectionFromPreview:K,refreshDomEditGroupSelectionsFromPreview:ee,applyMarqueeSelection:re}}const $Y=6,BY=600,Aet=400,wet=6;function Oet({captionEditMode:t,compositionLoading:e,previewIframeRef:n,showToast:r,applyDomSelection:i,resolveDomSelectionFromPreviewPoint:s,resolveAllDomSelectionsFromPreviewPoint:a,updateDomEditHoverSelection:o,setActiveGroupElement:l,onClickToSource:c}){const u=x.useRef(null),f=x.useRef(null),h=x.useCallback(()=>{const w=aet(n.current),O=ue.getState();O.setIsPlaying(!1),w!=null&&(O.setCurrentTime(w),xa.notify(w))},[n]),p=x.useCallback(async(w,O)=>{if(t||e)return;const k=Date.now(),E=f.current,T=w.detail>=2||E!=null&&k-E.t{N&&ue.getState().setIsPlaying(!0)};if(T&&!w.shiftKey){const W=await s(w.clientX,w.clientY),J=u.current,ne=J!==null&&J.candidates.length>1&&Math.hypot(w.clientX-J.x,w.clientY-J.y)<$Y&&k-J.at1?{x:w.clientX,y:w.clientY,candidates:Y,index:0,at:I}:null},[i,t,e,c,h,a,s,l]),y=x.useCallback(async(w,O)=>{if(t||e)return o(null),null;const k=await s(w.clientX,w.clientY,{preferClipAncestor:(O==null?void 0:O.preferClipAncestor)??!1,skipSourceProbe:!0});return o(k),k},[t,e,s,o]),m=x.useCallback(()=>{o(null)},[o]),v=x.useCallback(w=>{r(w.capabilities.reasonIfDisabled??"This element can't be adjusted directly from the preview.","info")},[r]),b=x.useCallback(()=>{h()},[h]);return{handlePreviewCanvasMouseDown:p,handlePreviewCanvasPointerMove:y,handlePreviewCanvasPointerLeave:m,handleBlockedDomMove:v,handleDomManualDragStart:b}}function LC(t,e="body",n={}){var r;return t===null?(r=n.allowNullPath)!=null&&r.call(n,e)?[]:[{path:e,reason:"null"}]:typeof t=="number"?Number.isFinite(t)?[]:[{path:e,reason:"non-finite-number"}]:!t||typeof t!="object"?[]:Array.isArray(t)?t.flatMap((i,s)=>LC(i,`${e}[${s}]`,n)):Object.entries(t).flatMap(([i,s])=>LC(s,`${e}.${i}`,n))}const Cet=/^body\.operations\[\d+\]\.value$/;function IR(t){return LC(t,"body",{allowNullPath:e=>Cet.test(e)})}const VY=["ABeeZee","Abel","Abril Fatface","Alegreya","Alegreya Sans","Anton","Archivo","Archivo Black","Arimo","Assistant","Barlow","Barlow Condensed","Bebas Neue","Bitter","Bricolage Grotesque","Cabin","Cardo","Catamaran","Caveat","Chivo","Cormorant Garamond","Crimson Text","Dancing Script","DM Sans","DM Serif Display","Domine","EB Garamond","Exo 2","Figtree","Fira Code","Fira Sans","Fraunces","Fredoka","IBM Plex Mono","IBM Plex Sans","IBM Plex Serif","Inconsolata","Instrument Sans","Instrument Serif","Inter","JetBrains Mono","Josefin Sans","Jost","Kanit","Karla","Lato","League Gothic","Lexend","Libre Baskerville","Libre Franklin","Lora","Manrope","Merriweather","Montserrat","Mukta","Mulish","Newsreader","Noto Sans","Noto Sans JP","Noto Serif","Nunito","Nunito Sans","Open Sans","Oswald","Outfit","Overpass","Pacifico","Pathway Extreme","Permanent Marker","Playfair Display","Plus Jakarta Sans","Poppins","Prata","PT Sans","PT Serif","Public Sans","Quicksand","Raleway","Red Hat Display","Roboto","Roboto Condensed","Roboto Mono","Roboto Serif","Rubik","Schibsted Grotesk","Signika","Source Code Pro","Source Sans 3","Source Serif 4","Space Grotesk","Space Mono","Spectral","Sora","Syne","Teko","Titillium Web","Ubuntu","Ubuntu Mono","Unbounded","Urbanist","Varela Round","Work Sans","Young Serif","Zilla Slab"],_R=["TT Norms Pro","SF Pro Display","SF Pro Text","Avenir","Avenir Next","Menlo","Monaco"];function HY(t){const e=Qqe(t);if(!(!e||e.toLowerCase()===t.toLowerCase()))return e}function f1e(t){return`https://fonts.googleapis.com/css2?family=${encodeURIComponent(t.trim()).replace(/%20/g,"+")}:wght@300;400;500;600;700;800;900&display=swap`}const ket=new Set(["inherit","initial","revert","revert-layer","serif","sans-serif","monospace","cursive","fantasy","system-ui","ui-sans-serif","ui-serif","ui-monospace","ui-rounded","emoji","math","fangsong"]);function Eet(t){return(t.split(",")[0]??"").trim().replace(/^["']|["']$/g,"")}function Tet(t){var e;return((e=t.split(",")[0])==null?void 0:e.trim().replace(/^["']|["']$/g,"").trim())??""}function QY(t,e){const n=Eet(e);if(!n||ket.has(n.toLowerCase()))return;const r=`studio-preview-google-font-${n.toLowerCase().replace(/[^a-z0-9]+/g,"-")}`;if(t.getElementById(r))return;const i=t.createElement("link");i.id=r,i.rel="stylesheet",i.href=f1e(n),t.head.appendChild(i)}function zY(t,e){const n=`studio-imported-font-${e.family.toLowerCase().replace(/[^a-z0-9]+/g,"-")}`;if(t.getElementById(n))return;const r=t.createElement("style");r.id=n,r.textContent=jF(e),t.head.appendChild(r)}function ZY(t,e,n){const r=jF(e,MIe(n,e.path));if(t.includes(r))return t;const s=/]*data-hf-studio-fonts=(["'])true\1[^>]*>([\s\S]*?)<\/style>/i.exec(t);if(s){const o=`${s[2].trim()} ${r}`.trim();return t.replace(s[0],``)}const a=``;return/<\/head>/i.test(t)?t.replace(/<\/head>/i,` ${a} `):`${a} -${t}`}class Pet extends Error{constructor(e){super(`Couldn't find this element in the source file (${e})`),this.name="DomEditPersistUnresolvableError"}}class Z4 extends Error{constructor(n,r={}){super(n);Et(this,"alreadyToasted");this.name="DomEditPersistUnsafeValueError",this.alreadyToasted=r.alreadyToasted??!1}}function h1e(t){return t.map(e=>`${e.type}:${e.property}`).join(", ")}function d1e(t){return{hfId:t.hfId,id:t.id,selector:t.selector,selectorIndex:t.selectorIndex,sourceFile:t.sourceFile}}function Met(t){return t instanceof Error?t.message:String(t)}function Net(t){return t.label||t.selector||t.id||"this element"}function Zp(t,e,n,r){const i=Met(n);console.warn("[Studio] DOM edit persist failed",{target:d1e(t),operations:h1e(e),error:i}),!((n instanceof Z4||n instanceof s0)&&n.alreadyToasted)&&r(`Couldn't save "${Net(t)}": ${i}`,"error")}function Det(t,e){console.warn("[Studio] DOM edit persist no-op",{target:d1e(t),operations:h1e(e),detail:"Server matched the target but reported no change even though the client believed the value changed."})}function Iet({activeCompPath:t,persistDomEditOperations:e,queueDomEditSave:n,showToast:r}){return x.useCallback((i,s,a)=>n(async()=>{await e(i,s,{label:a.label,coalesceKey:a.coalesceKey,coalesceMs:a.coalesceMs,skipRefresh:a.skipRefresh??!0})}).catch(o=>{throw o instanceof GF||(r(o instanceof Error?o.message:"Failed to save position"),X0({source:"dom_edit",error:o,filePath:i.sourceFile??t??"index.html",mutationType:"position",label:a.label,targetId:i.id,targetSelector:i.selector,targetSourceFile:i.sourceFile})),o}),[t,e,n,r])}const p1e=new Set(["SPAN","B","STRONG","I","EM","U","BR"]),_et=new Set(["color","background-color","font-weight","font-style","text-decoration-line","font-family","font-size","letter-spacing","line-height","-webkit-text-fill-color"]),Ret=new Set(["data-hf-text-key","data-hf-id"]),jet=/^[A-Za-z0-9_:-]+$/,Let=new Set(["SCRIPT","STYLE","TEMPLATE","NOSCRIPT","IFRAME","OBJECT","EMBED","SVG","MATH"]),Fet=/url\(|expression\(|javascript:|vbscript:|@import|<\//i,$et=1,Bet=3;function Y$(t){return p1e.has(t.toUpperCase())}function m1e(t,e){return Ret.has(t.toLowerCase())&&jet.test(e)}function g1e(t,e){return _et.has(t.toLowerCase())&&e.length>0&&!Fet.test(e)}function Vet(t){return t.nodeType===$et}function Het(t){var n,r;const e=Array.from(t.childNodes,i=>({phase:"visit",node:i})).reverse();for(let i=e.pop();i;i=e.pop()){if(i.phase==="sanitize"){p1e.has(i.tag)?zet(i.element):Qet(i.element);continue}const s=i.node;if(s.nodeType===Bet)continue;if(!Vet(s)){(n=s.parentNode)==null||n.removeChild(s);continue}const a=s,o=a.tagName.toUpperCase();if(Let.has(o)){(r=a.parentNode)==null||r.removeChild(a);continue}e.push({phase:"sanitize",element:a,tag:o});for(const l of Array.from(a.childNodes).reverse())e.push({phase:"visit",node:l})}}function Qet(t){const e=t.parentNode;if(e){for(;t.firstChild;)e.insertBefore(t.firstChild,t);e.removeChild(t)}}function zet(t){const e=t.getAttribute("style");for(const r of Array.from(t.getAttributeNames())){const i=t.getAttribute(r)??"";m1e(r,i)||t.removeAttribute(r)}if(e===null)return;const n=Zet(e);n?t.setAttribute("style",n):t.removeAttribute("style")}function Zet(t){return Wet(t).map(e=>{const n=e.indexOf(":");if(n===-1)return null;const r=e.slice(0,n).trim().toLowerCase(),i=e.slice(n+1).trim();return g1e(r,i)?`${r}: ${i}`:null}).filter(e=>e!==null).join("; ")}function Get(t){return t==="'"||t==='"'}function Uet(t,e){return e==="("?t+1:e===")"?Math.max(0,t-1):t}function Xet(t,e,n){return t===";"&&e===0&&n===null}function Wet(t){const e=[];let n="",r=0,i=null;for(const s of t){if(s===i)i=null;else if(i===null&&Get(s))i=s;else if(Xet(s,r,i)){e.push(n),n="";continue}else i===null&&(r=Uet(r,s));n+=s}return n.trim()&&e.push(n),e}function qet(t){return!t||!ih(t)||t.isCompositionHost||t.isInsideLockedComposition?!1:t.textFields.length<=1?!0:K$(t.element)}function K$(t){if(!t)return!1;const e=t.tagName;return e==="BODY"||e==="HTML"||!y1e(t)||t.isContentEditable?!1:(t.textContent??"").trim().length>0}function y1e(t){var n;const e=(n=t.ownerDocument.defaultView)==null?void 0:n.HTMLElement;if(!e)return!1;for(const r of Array.from(t.children))if(!Y$(r.tagName)||!(r instanceof e)||!y1e(r))return!1;return!0}const Yet=450,GY=6;function Ket(t,e){return t?e.element!==null&&t.element===e.element&&e.at-t.at<=Yet&&Math.abs(e.x-t.x)<=GY&&Math.abs(e.y-t.y)<=GY:!1}function Jet(t,e){return t.every((n,r)=>{var i;return((i=e[r])==null?void 0:i.key)===n.key})}function UY(t,e){return Object.prototype.hasOwnProperty.call(t,e)?t[e]:null}function ett(t,e){return Array.from(new Set([...Object.keys(t),...Object.keys(e)]))}function ttt(t,e){if(t.length!==e.length||!Jet(t,e)||e.some(i=>i.source==="text-node")||e.some(i=>i.source!=="child")||t.some(i=>i.source!=="child"))return null;const n=new Map(t.map(i=>[i.key,i])),r=[];for(const i of e){const s=n.get(i.key),a=a1e(t,i.key);if(!s||!a)return null;i.value!==s.value&&r.push(W$(i.value,a));for(const o of ett(s.inlineStyles,i.inlineStyles)){const l=UY(s.inlineStyles,o),c=UY(i.inlineStyles,o);c!==l&&r.push(j1(o,c,a))}}return r}function mv(t){const e=t.current+1;return t.current=e,()=>t.current===e}function G4(t,e){const n=(t.get(e)??0)+1;return t.set(e,n),()=>t.get(e)===n}async function ag(t){var e,n;t.capture(),t.apply();try{await t.persist(),(e=t.onSettled)==null||e.call(t,!0)}catch(r){t.shouldRevert(r)&&t.revert(),t.onError(r),(n=t.onSettled)==null||n.call(t,!1)}t.shouldResync()&&await t.resync()}function hu(t){return{ok:!1,reason:t}}async function XY(t){let e=!1;return await ag({...t,onSettled:n=>{var r;e=n,(r=t.onSettled)==null||r.call(t,n)}}),e?{ok:!0}:hu("persist-failed")}function WY(t,e){return t.startsWith("data-")?t:`data-${t}`}function n1(t,e,n){n===null?t.removeAttribute(e):t.setAttribute(e,n),(t.tagName.toLowerCase()===ya||e===Go)&&AE(t.ownerDocument)}function x1e(t,e,n){return t?Is(t,e,n):null}function ntt(t,e,n,r){const i=x1e(t,e,n);if(!i)return null;const s=new Map(r.map(a=>[a,i.getAttribute(a)]));return{element:i,previousValues:s}}function qY(t,e,n,r){const i=x1e(t,e,n);return i?{element:i,previousValue:i.getAttribute(r)}:null}function rtt({activeCompPath:t,previewIframeRef:e,showToast:n,domEditSelection:r,refreshDomEditSelectionFromPreview:i,persistDomEditOperations:s}){const a=x.useRef(new Map),o=x.useCallback(async(y,m,v)=>{var _;if(!r)return;const b=e.current,w=WY(y),O=((_=v.coalesce)==null?void 0:_.key)??`${v.coalescePrefix}:${y}:${gc(r)}`,k=G4(a.current,O),E={type:"attribute",property:y,value:m};let T=null,N=null;await ag({capture:()=>{const I=qY(b==null?void 0:b.contentDocument,r,t,w);I&&(T=I.element,N=I.previousValue)},apply:()=>{if(!T)return;n1(T,w,m===null||m===""?null:m)},persist:v.previewOnly?async()=>{}:()=>s(r,[E],{label:v.label,coalesceKey:O,...v.coalesce?{coalesceMs:v.coalesce.ms}:{},skipRefresh:v.skipRefresh}),shouldRevert:()=>k(),revert:()=>{T&&n1(T,w,N)},onError:I=>Zp(r,[E],I,n),shouldResync:()=>k()&&!!v.refreshAfter,resync:()=>{var I;i(r),cR(((I=e.current)==null?void 0:I.contentDocument)??null)},onSettled:v.onSettled})},[t,r,s,i,n,e]),l=x.useCallback(async(y,m,v)=>{const b=e.current,w=Object.entries(m).map(([N,_])=>({attr:N,fullAttr:WY(N),value:_})),O=`${v.coalescePrefix}:${w.map(N=>N.attr).sort().join(",")}:${gc(y)}`,k=G4(a.current,O),E=w.map(N=>({type:"attribute",property:N.attr,value:N.value}));let T=null;await ag({capture:()=>{T=ntt(b==null?void 0:b.contentDocument,y,t,w.map(N=>N.fullAttr))},apply:()=>{if(T)for(const N of w){const _=N.value===null||N.value===""?null:N.value;n1(T.element,N.fullAttr,_)}},persist:()=>s(y,E,{label:v.label,coalesceKey:O,skipRefresh:v.skipRefresh}),shouldRevert:()=>k(),revert:()=>{if(T)for(const N of w)n1(T.element,N.fullAttr,T.previousValues.get(N.fullAttr)??null)},onError:N=>Zp(y,E,N,n),shouldResync:()=>k()&&!!v.refreshAfter,resync:()=>i(y),onSettled:v.onSettled})},[t,s,i,n,e]),c=x.useCallback(async(y,m)=>{await l(y,m,{label:"Edit timing",coalescePrefix:"attrs",skipRefresh:!1,refreshAfter:!0})},[l]),u=x.useCallback(async(y,m)=>{await o(y,m,{label:`Edit ${y.replace(/-/g," ")}`,coalescePrefix:"attr",skipRefresh:!1,refreshAfter:!0})},[o]),f=x.useCallback(async(y,m,v,b)=>{await o(y,m,{label:`Edit ${y.replace(/^(data-)?/,"").replace(/-/g," ")}`,coalescePrefix:"attr-live",skipRefresh:!0,onSettled:v,...b!=null&&b.coalesce?{coalesce:b.coalesce}:{},...b!=null&&b.previewOnly?{previewOnly:!0}:{}})},[o]),h=x.useCallback(async(y,m,v)=>{await o(y,m,{label:`Edit ${y.replace(/^(data-)?/,"").replace(/-/g," ")}`,coalescePrefix:"attr-quiet",skipRefresh:!0,refreshAfter:!0,...v?{coalesce:v}:{}})},[o]),p=x.useCallback(async(y,m)=>{if(!r)return;const v=e.current,b=`html-attr:${y}:${gc(r)}`,w=G4(a.current,b),O={type:"html-attribute",property:y,value:m};let k=null,E=null;await ag({capture:()=>{const T=qY(v==null?void 0:v.contentDocument,r,t,y);T&&(k=T.element,E=T.previousValue)},apply:()=>{if(!k)return;n1(k,y,m===null||m==="false"?null:m)},persist:()=>s(r,[O],{label:`Edit ${y}`,coalesceKey:b,skipRefresh:!1}),shouldRevert:()=>w(),revert:()=>{k&&n1(k,y,E)},onError:T=>Zp(r,[O],T,n),shouldResync:()=>w(),resync:()=>{var T;i(r),cR(((T=e.current)==null?void 0:T.contentDocument)??null)}})},[t,r,s,i,n,e]);return{handleDomAttributeCommit:u,handleDomAttributeLiveCommit:f,handleDomAttributeQuietCommit:h,handleDomHtmlAttributeCommit:p,handleDomAttributesCommit:c}}function itt(t,e){return t.isCompositionHost||t.isInsideLockedComposition?!1:K$(e)}function stt(t,e,n){return!n||!e.isConnected?!1:e===t.element&&e.ownerDocument===n}function att(t,e,n){const r=[j1(t,k_(t,e))];return n&&r.push(j1("background-position","center"),j1("background-repeat","no-repeat"),j1("background-size","contain")),r}function ott(t,e,n){return t.length===0?[]:t.map(r=>r.key===n?{...r,value:e}:r)}function YY(t,e,n){const r=e.length>1||e.some(o=>o.source==="child"),i=r?i1e(e):n,s=r?ttt(t,e):null,a=s??(r?[q$(i)]:[W$(i)]);return{usesSerializedTextFields:r,nextContent:i,childOperations:s,operations:a}}async function wN(t,e,n,r,i){if(!t)return;const s=Is(t,e,n);if(!s)return;const a=await r(s);a&&i(a,{revealPanel:!1,preserveGroup:!0})}function ltt({activeCompPath:t,previewIframeRef:e,showToast:n,domEditSelection:r,applyDomSelection:i,refreshDomEditSelectionFromPreview:s,buildDomSelectionFromTarget:a,persistDomEditOperations:o,resolveImportedFontAsset:l}){const c=x.useRef(0),u=x.useRef(new Map),{handleDomAttributeCommit:f,handleDomAttributeLiveCommit:h,handleDomAttributeQuietCommit:p,handleDomHtmlAttributeCommit:y,handleDomAttributesCommit:m}=rtt({activeCompPath:t,previewIframeRef:e,showToast:n,domEditSelection:r,refreshDomEditSelectionFromPreview:s,persistDomEditOperations:o}),v=x.useCallback(async(N,_)=>{if(!r)return hu("no-selection");if(_Ie(N))return hu("geometry-property");if(!r.capabilities.canEditStyles)return hu("styles-not-editable");const I=`${gc(r)}:${N}`,j=G4(u.current,I),L=N==="font-family"?l(_):null,B=e.current,$=B==null?void 0:B.contentDocument,z=k_(N,_),Y=N==="background-image"&&IIe(_);let W=null,J=null;const ne=att(N,_,Y),le=!0;return XY({capture:()=>{if(!$)return;const ie=Is($,r,t);ie&&(W=ie,J=ie.style.getPropertyValue(N))},apply:()=>{W&&(W.style.setProperty(N,z),N==="font-family"&&$&&(QY($,_),L&&zY($,L)),Y&&(W.style.setProperty("background-position","center"),W.style.setProperty("background-repeat","no-repeat"),W.style.setProperty("background-size","contain")))},persist:()=>o(r,ne,{label:"Edit layer style",skipRefresh:le,prepareContent:L?(ie,q)=>ZY(ie,L,q):void 0}),shouldRevert:()=>j(),revert:()=>{!W||J===null||(J===""?W.style.removeProperty(N):W.style.setProperty(N,J))},onError:ie=>Zp(r,ne,ie,n),shouldResync:j,resync:()=>s(r)})},[t,r,o,s,l,n,e]),b=x.useCallback(async(N,_)=>{if(!r)return hu("no-selection");if(!ih(r))return hu("not-text-editable");const I=mv(c),j=ott(r.textFields,N,_),L=YY(r.textFields,j,N),B=e.current,$=B==null?void 0:B.contentDocument;let z=null,Y=null;return XY({capture:()=>{if(!$)return;const W=Is($,r,t);W&&(z=W,Y=W.innerHTML)},apply:()=>{z&&(L.usesSerializedTextFields?z.innerHTML=L.nextContent:z.textContent=N)},persist:async()=>{await o(r,L.operations,{label:"Edit text",skipRefresh:!0,shouldSave:I})},shouldRevert:()=>I(),revert:()=>{!z||Y===null||(z.innerHTML=Y)},onError:W=>Zp(r,L.operations,W,n),shouldResync:I,resync:()=>wN($,r,t,a,i)})},[t,i,a,r,o,e,n]),w=x.useCallback(async({element:N,html:_,previousHtml:I})=>{if(!r||!itt(r,N))return;const j=e.current,L=j==null?void 0:j.contentDocument;if(!stt(r,N,L))return;const B=mv(c),$=[q$(_)];let z="";await ag({capture:()=>{},apply:()=>{N.innerHTML=_,z=N.innerHTML},persist:async()=>{await o(r,$,{label:"Edit text",skipRefresh:!0,shouldSave:B})},shouldRevert:()=>B(),revert:()=>{N.isConnected&&N.innerHTML===z&&(N.innerHTML=I)},onError:Y=>Zp(r,$,Y,n),shouldResync:B,resync:()=>wN(L,r,t,a,i)})},[t,i,a,r,o,e,n]),O=x.useCallback(async(N,_,I)=>{var J;const j=mv(c),L=YY(N.textFields,_,((J=_[0])==null?void 0:J.value)??""),B=e.current,$=B==null?void 0:B.contentDocument;let z=null,Y=null;const W=(I==null?void 0:I.importedFont)??null;await ag({capture:()=>{if(!$)return;const ne=Is($,N,t);ne&&(z=ne,Y=ne.innerHTML)},apply:()=>{z&&(L.usesSerializedTextFields?z.innerHTML=L.nextContent:z.textContent=L.nextContent)},persist:async()=>{await o(N,L.operations,{label:"Edit text",skipRefresh:!0,prepareContent:W?(ne,le)=>ZY(ne,W,le):void 0})},shouldRevert:()=>j(),revert:()=>{!z||Y===null||(z.innerHTML=Y)},onError:ne=>Zp(N,L.operations,ne,n),shouldResync:j,resync:()=>wN($,N,t,a,i)})},[t,i,a,o,e,n]),k=x.useCallback(async(N,_,I)=>{var z;if(!r)return;const j=r.textFields.find(Y=>Y.key===N);if(!j)return;if(j.source==="self"){await v(_,I);return}const L=k_(_,I),B=_==="font-family"?l(I):null;if(_==="font-family"){const Y=(z=e.current)==null?void 0:z.contentDocument;Y&&(QY(Y,L),B&&zY(Y,B))}const $=r.textFields.map(Y=>Y.key===N?{...Y,inlineStyles:{...Y.inlineStyles,[_]:L},computedStyles:{...Y.computedStyles,[_]:L}}:Y);await O(r,$,{importedFont:B})},[O,r,v,l,e]),E=x.useCallback(async N=>{if(!r||!r.textFields.some(B=>B.source==="child"))return null;const _=r.textFields.findIndex(B=>B.key===N),I=r.textFields[_>=0?_:0]??r.textFields[0],j=s1e(I),L=[...r.textFields];return L.splice(_>=0?_+1:L.length,0,j),await O(r,L),j.key},[O,r]),T=x.useCallback(async N=>{if(!r)return;const _=r.textFields.find(j=>j.key===N);if(!_)return;if(_.source==="self"){await b("",N);return}const I=r.textFields.filter(j=>j.key!==N);await O(r,I)},[O,r,b]);return{handleDomStyleCommit:v,handleDomAttributeCommit:f,handleDomAttributeLiveCommit:h,handleDomAttributeQuietCommit:p,handleDomHtmlAttributeCommit:y,handleDomAttributesCommit:m,handleDomTextCommit:b,handleDomRichTextCommit:w,commitDomTextFields:O,handleDomTextFieldStyleCommit:k,handleDomAddTextField:E,handleDomRemoveTextField:T}}function AA(t,e,n){for(const r of e){const i=t.style.getPropertyValue(r);i&&n.push({type:"inline-style",property:r,value:i})}}function FC(t,e,n){for(const r of e){const i=t.getAttribute(r);i!==null&&n.push({type:"attribute",property:r,value:i})}}function b1e(t,e){const n=t.getAttribute(th);n!==null&&(e.push({type:"inline-style",property:"display",value:n||null}),e.push({type:"attribute",property:th,value:null}))}function KY(t){const e=[];AA(t,[La,po],e);const n=t.style.getPropertyValue("translate"),r=t.style.getPropertyValue(La)||t.style.getPropertyValue(po),i=n&&n!=="none"?n:r?`var(${La}, 0px) var(${po}, 0px)`:null;return i&&e.push({type:"inline-style",property:"translate",value:i}),e.push({type:"attribute",property:Xf,value:"true"}),FC(t,[Yf,Kf],e),AA(t,["display"],e),FC(t,[th],e),e}function ctt(t){const e=t.getAttribute(Kf),n=[{type:"inline-style",property:La,value:null},{type:"inline-style",property:po,value:null},{type:"inline-style",property:"translate",value:e||null},{type:"attribute",property:Xf,value:null},{type:"attribute",property:Yf,value:null},{type:"attribute",property:Kf,value:null}];return b1e(t,n),n}const utt=["width","height","min-width","min-height","max-width","max-height","flex-basis","flex-grow","flex-shrink","box-sizing","scale","transform-origin","display"],v1e=[[Cy,"width"],[ky,"height"],[Vg,""],[Hg,""],[MS,"min-width"],[NS,"min-height"],[DS,"max-width"],[IS,"max-height"],[_S,"flex-basis"],[RS,"flex-grow"],[jS,"flex-shrink"],[LS,"box-sizing"],[Pf,"scale"],[k0,"transform-origin"],[FS,"display"],[th,""]];function ftt(t){const e=[];return AA(t,[hh,dh],e),AA(t,utt,e),e.push({type:"attribute",property:Wf,value:"true"}),FC(t,v1e.map(([n])=>n),e),e}function htt(t){const e=[{type:"inline-style",property:hh,value:null},{type:"inline-style",property:dh,value:null},{type:"attribute",property:Wf,value:null}];for(const[n,r]of v1e){const i=t.getAttribute(n);i!==null&&r&&e.push({type:"inline-style",property:r,value:i||null}),e.push({type:"attribute",property:n,value:null})}return e}const dtt=[jc,"rotate","transform-origin","display"],ptt=[Jf,eh,Du,th];function mtt(t){const e=[];return AA(t,dtt,e),e.push({type:"attribute",property:qf,value:"true"}),FC(t,ptt,e),e}function gtt(t){const e=t.getAttribute(eh),n=t.getAttribute(Du),r=[{type:"inline-style",property:jc,value:null},{type:"inline-style",property:"rotate",value:e||null},{type:"inline-style",property:"transform-origin",value:n!==null&&n||null},{type:"attribute",property:qf,value:null},{type:"attribute",property:q0,value:null},{type:"attribute",property:Jf,value:null},{type:"attribute",property:eh,value:null},{type:"attribute",property:Du,value:null}];return b1e(t,r),r}let JY,eK,tK;function ytt(t,e,n){var i,s;const r=(i=t.getChildren)==null?void 0:i.call(t,!0);if(r)for(const a of r){const o=(s=a.targets)==null?void 0:s.call(a);if(o)for(const l of o)n.add(l),l.id&&e.add(l.id)}}function xtt(t){const e=new Set,n=new WeakSet;for(const r of Object.values(t))if(r)try{ytt(r,e,n)}catch{}return{ids:e,nodes:n}}function btt(t){if(t!=null&&t.contentWindow)try{return t.contentWindow.__timelines}catch{return}}function ON(t,e){const n=btt(t);if(!n)return!1;if(n!==JY){const r=xtt(n);eK=r.ids,tK=r.nodes,JY=n}return tK.has(e)||!!(e.id&&eK.has(e.id))}const CN="This element is GSAP-animated — dragging via CSS would corrupt keyframes";function vtt({previewIframeRef:t,showToast:e,commitPositionPatchToHtml:n}){const r=x.useCallback((o,l)=>{if(ON(t.current,o.element)){const f=new Error(CN);return e(f.message,"error"),Promise.reject(f)}const u=rg(o.element);return gC(o.element,l),n(o,KY(o.element),{label:"Move layer",coalesceKey:`path-offset:${gc(o)}`}).catch(f=>{throw fc(o.element,u),f})},[n,t,e]),i=x.useCallback((o,l,c)=>{if(ON(t.current,o.element)){const p=new Error(CN);return e(p.message,"error"),Promise.reject(p)}const u=sR(o.element),f=c?rg(o.element):null;BF(o.element,l);const h=ftt(o.element);return c&&(gC(o.element,c),h.push(...KY(o.element))),n(o,h,{label:"Resize layer box",coalesceKey:`box-size:${gc(o)}`}).catch(p=>{throw lv(o.element,u),f&&fc(o.element,f),p})},[n,t,e]),s=x.useCallback((o,l)=>{if(ON(t.current,o.element)){const u=new Error(CN);return e(u.message,"error"),Promise.reject(u)}const c=aR(o.element);return HF(o.element,l),n(o,mtt(o.element),{label:"Rotate layer",coalesceKey:`rotation:${gc(o)}`}).catch(u=>{throw yC(o.element,c),u})},[n,t,e]),a=x.useCallback(o=>{const l=o.element,c=rg(l),u=sR(l),f=aR(l),h=[...ctt(l),...htt(l),...gtt(l)];return Qde(l),zde(l),MQe(l),n(o,h,{label:"Reset layer edits",coalesceKey:`manual-reset:${gc(o)}`,skipRefresh:!1}).catch(p=>{throw fc(l,c),lv(l,u),yC(l,f),p})},[n]);return{handleDomPathOffsetCommit:r,handleDomBoxSizeCommit:i,handleDomRotationCommit:s,handleDomManualEditsReset:a}}const A1e="2147483000",k3="data-hf-studio-reveal-pending-commit";let Att=0;const d1=new WeakMap,Stt=16;function wtt(t){d1.set(t,(d1.get(t)??0)+1);let e=!1;return()=>{if(e)return;e=!0;const n=(d1.get(t)??1)-1;n>0?d1.set(t,n):d1.delete(t)}}function Gp(t,e,n){n?t.style.setProperty(e,n):t.style.removeProperty(e)}function J$(t){const e=t.getAttribute(k3);if(!e)return null;try{const n=JSON.parse(e);if(typeof n!="object"||n===null||!("token"in n))return null;const r=n.token;if(typeof r!="string")return null;if(!("releasedPriors"in n)||n.releasedPriors===void 0)return{token:r};const i=n.releasedPriors;if(typeof i!="object"||i===null||!("zIndex"in i)||!("position"in i))return null;const{zIndex:s,position:a}=i;return typeof s=="string"&&typeof a=="string"?{token:r,releasedPriors:{zIndex:s,position:a}}:null}catch{return null}}function S1e(t,e){t.setAttribute(k3,JSON.stringify(e))}function Ott(t){const e=t.getAttribute(Vf);if(e==null)return null;const n={token:`reveal-z-${Att++}`,priorZ:e,priorPosition:t.getAttribute(p0),activeLiftStyles:{zIndex:t.style.zIndex,position:t.style.position}};return S1e(t,{token:n.token}),t.removeAttribute(Vf),t.removeAttribute(p0),n}function Ctt(t,e){var n;((n=J$(t))==null?void 0:n.token)===e.token&&t.removeAttribute(k3)}function ktt(t,e){const n=J$(t);if((n==null?void 0:n.token)===e.token){if(t.removeAttribute(k3),t.removeAttribute(Vf),t.removeAttribute(p0),n.releasedPriors){Gp(t,"z-index",n.releasedPriors.zIndex),Gp(t,"position",n.releasedPriors.position);return}Gp(t,"z-index",e.activeLiftStyles.zIndex),Gp(t,"position",e.activeLiftStyles.position),t.setAttribute(Vf,e.priorZ),e.priorPosition!=null&&t.setAttribute(p0,e.priorPosition)}}function kN(t,e,n,r){n!=null&&t.style.getPropertyValue(e)===n&&Gp(t,e,r)}function Ett(t,e){const n=e.getComputedStyle(t),r=Number.parseFloat(n.opacity);return{display:n.display==="none",visibility:n.visibility==="hidden"||n.visibility==="collapse",opacity:Number.isFinite(r)&&r<=.01}}function Ttt(t,e,n){const r={display:t.style.display,visibility:t.style.visibility,opacity:t.style.opacity},i={};return n.display&&(t.style.removeProperty("display"),e.getComputedStyle(t).display==="none"&&(t.style.display="block"),i.display=t.style.display),n.visibility&&(t.style.visibility="visible",i.visibility="visible"),n.opacity&&(t.style.opacity="1",i.opacity="1"),{element:t,priors:r,applied:i}}function Ptt(t){const e=t.ownerDocument,n=e.defaultView;if(!n)return[];const r=[];let i=t;for(;i&&i!==e.body&&i!==e.documentElement;){let s;try{s=Ett(i,n)}catch{break}(s.display||s.visibility||s.opacity)&&r.push(Ttt(i,n,s)),i=i.parentElement}return r}function Mtt(t){const e=t.ownerDocument.defaultView;if(!e)return null;const n={zIndex:t.style.zIndex,position:t.style.position};let r=!1;try{t.setAttribute(Vf,String(i3(t))),e.getComputedStyle(t).position==="static"&&(t.setAttribute(p0,"static"),t.style.position="relative",r=!0)}catch{return t.removeAttribute(Vf),null}return t.style.zIndex=A1e,{priors:n,positionLifted:r}}function Ntt(t,e){if(!t.hasAttribute(Vf)){const n=J$(t);n&&!n.releasedPriors&&S1e(t,{...n,releasedPriors:e.priors});return}t.removeAttribute(Vf),t.removeAttribute(p0),t.style.zIndex===A1e&&Gp(t,"z-index",e.priors.zIndex),e.positionLifted&&t.style.position==="relative"&&Gp(t,"position",e.priors.position)}function Dtt({isPlaying:t,selectedElement:e}){const n=x.useRef(null),r=x.useRef(null),i=x.useRef({isPlaying:t,selectedElement:e});i.current={isPlaying:t,selectedElement:e};const s=x.useCallback(()=>{const c=n.current;if(n.current=null,!!c){for(const{element:u,priors:f,applied:h}of c.nodes)u.isConnected&&(kN(u,"display",h.display,f.display),kN(u,"visibility",h.visibility,f.visibility),kN(u,"opacity",h.opacity,f.opacity));c.lift&&c.base.isConnected&&Ntt(c.base,c.lift)}},[]),a=x.useCallback(c=>{s();const u=Ptt(c),f=Mtt(c);(u.length>0||f)&&(n.current={base:c,nodes:u,lift:f})},[s]),o=x.useCallback(()=>{const c=r.current;r.current=null,c&&window.clearTimeout(c.timer)},[]),l=x.useCallback((c,u)=>{if(o(),i.current.isPlaying)return;const h=()=>{const y=i.current;if(y.isPlaying||y.selectedElement!==c||!c.isConnected){r.current=null;return}if(d1.has(c)){const m=window.setTimeout(h,Stt);r.current={timer:m,element:c};return}r.current=null,a(c)},p=window.setTimeout(h,u);r.current={timer:p,element:c}},[o,a]);return x.useEffect(()=>{var f;const c=r.current;(t||c&&c.element!==e)&&o();const u=(f=n.current)==null?void 0:f.base;(t||u&&e!==u)&&s()},[o,t,s,e]),x.useEffect(()=>()=>{o(),s()},[o,s]),{scheduleReveal:l}}let Itt=0;function eB(t,e){const n=t.map(r=>r.id??r.selector??r.element.getAttribute("data-hf-id")??"el").join(":");return`z-reorder:${e??"reorder"}:${n}:g${Itt++}`}function _tt({activeCompPath:t,showToast:e,writeProjectFile:n,domEditSaveTimestampRef:r,editHistory:i,projectIdRef:s,reloadPreview:a,clearDomSelection:o,onTrySdkDelete:l,onReorderShadow:c,forceReloadSdkSession:u,commitDomEditPatchBatches:f,onElementDeleted:h}){const p=x.useCallback(async v=>{const b=s.current;if(!b)return hu("no-project");const[w]=v;if(!w)return hu("no-selection");const O=v.length===1?w.label||w.id||w.selector||w.tagName:`${v.length} elements`;v.length>1&&e(`Deleting ${O}...`,"info");const k=w.sourceFile||t||"index.html",E=v.filter(T=>(T.sourceFile||t||"index.html")===k);try{const T=await fF(b,k),N=E.map(B=>Wg(B));if(N.some(B=>!B.id&&!B.selector&&!B.hfId))throw new Error("Selected element has no patchable target");const _=E.map(B=>B.hfId).filter(B=>!!B);if(l&&_.length===E.length){let B=!0;for(const $ of _){const z=await l($,T,k);if(!Ri(z)){B=!1;break}}if(B)return o(),ue.getState().setSelectedElementId(null),e(`Deleted ${O}. Use Undo to restore ${E.length===1?"it":"them"}.`,"info"),{ok:!0}}r.current=Date.now();const I=await fetch(`/api/projects/${b}/file-mutations/remove-elements/${encodeURIComponent(k)}`,{method:"POST",headers:{"Content-Type":"application/json",...Zl()},body:JSON.stringify({targets:N})});if(!I.ok)throw await _d(I,`Failed to delete element from ${k}`);const j=await I.json();if(!j.changed)return a(),e("Nothing to delete, the preview was out of date. Try again."),hu("preview-stale");const L=typeof j.content=="string"?j.content:T;await il({projectId:b,label:"Delete element",kind:"timeline",files:{[k]:L},readFile:async()=>T,diskContent:{[k]:L},writeFile:n,recordEdit:i.recordEdit}),o(),ue.getState().setSelectedElementId(null),u==null||u(),a();for(const B of E)h==null||h(B);return e(`Deleted ${O}. Use Undo to restore ${E.length===1?"it":"them"}.`,"info"),{ok:!0}}catch(T){const N=T instanceof Error?T.message:"Failed to delete element";return e(N),hu("persist-failed")}},[t,o,r,i.recordEdit,l,h,u,s,a,e,n]),y=x.useCallback((v,b,w)=>v.length===0?Promise.resolve():(async()=>{var k;const O=v.map(E=>wtt(E.element));try{c==null||c(v.map(L=>vA(L.element)).filter(L=>L!=null));const E=b??eB(v,w),T=new Map,N=[],_=[];for(const L of v){const B=L.element.style.zIndex,$=L.element.style.position,z=L.key?ue.getState().elements.find(ie=>(ie.key??ie.id)===L.key):void 0;let Y=!1;const W=L.element.getAttribute(p0),J=Ott(L.element);J&&_.push({element:L.element,ownership:J}),L.element.style.zIndex=String(L.zIndex);const ne=[{type:"inline-style",property:"z-index",value:String(L.zIndex)}];try{const ie=(k=L.element.ownerDocument)==null?void 0:k.defaultView;(W??(ie?ie.getComputedStyle(L.element).position:void 0))==="static"&&(L.element.style.position="relative",Y=!0,ne.push({type:"inline-style",property:"position",value:"relative"}))}catch{}L.key&&ue.getState().updateElement(L.key,{zIndex:L.zIndex,hasExplicitZIndex:!0}),N.push(()=>{J?ktt(L.element,J):(L.element.style.zIndex=B,Y&&(L.element.style.position=$)),L.key&&z&&ue.getState().updateElement(L.key,{zIndex:z.zIndex,hasExplicitZIndex:z.hasExplicitZIndex})});const le=T.get(L.sourceFile)??[];le.push({target:Wg({id:L.id,hfId:vA(L.element),selector:L.selector,selectorIndex:L.selectorIndex}),operations:ne}),T.set(L.sourceFile,le)}const I=[...T].map(([L,B])=>({sourceFile:L,patches:B}));ue.getState().bumpZEditVersion();const j=()=>{for(const L of N)L();ue.getState().bumpZEditVersion()};try{const L=await f(I,{label:"Reorder layers",coalesceKey:E,coalesceMs:Number.POSITIVE_INFINITY,skipReload:!0});if(!L.durable)return j(),L;for(const{element:B,ownership:$}of _)Ctt(B,$);return L}catch(L){throw j(),L}}finally{for(const E of O)E()}})(),[f,c]);return{handleDomEditElementDelete:x.useCallback(async v=>{await p([v])},[p]),handleDomEditElementsDelete:p,handleDomZIndexReorderCommit:y}}function Rtt(t){if(t.id)return{selector:Mg(t.id)};const e=t.element,n=e.ownerDocument;if(t.selector&&HE(n,t.selector,e))return{selector:t.selector};const r=e.tagName.toLowerCase();let i=r,s=1;for(;n.getElementById(i);)s+=1,i=`${r}-${s}`;return e.setAttribute("id",i),{selector:Mg(i),autoId:i}}class E3 extends Error{constructor(e,n){super(C1e(e,n)),this.statusCode=e,this.responseBody=n,this.name="GsapMutationHttpError"}}function w1e(t){return typeof t=="object"&&t!==null}function O1e(t){const e=Array.isArray(t)?t.filter(n=>typeof n=="string"):[];return e.length>0?` (${e.join(", ")})`:""}async function tB(t){return(t.headers.get("content-type")??"").includes("application/json")?await t.json().catch(()=>null):await t.text().catch(()=>null)}function C1e(t,e){return w1e(e)&&typeof e.error=="string"?e.error:`GSAP mutation failed with status ${t}`}function k1e(t){const e=t.responseBody;return w1e(e)?`Couldn't save animation: ${C1e(t.statusCode,e)}${O1e(e.fields)}`:`Couldn't save animation: ${t.message}`}async function jtt({projectId:t,targetPath:e,selection:n,autoId:r,showToast:i}){const s={target:{id:n.id,hfId:n.hfId,selector:n.selector,selectorIndex:n.selectorIndex},operations:[{type:"html-attribute",property:"id",value:r}]};if(IR(s).length>0)return i==null||i("Couldn't assign element id because the patch contains invalid values","error"),!1;const o=await fetch(`/api/projects/${encodeURIComponent(t)}/file-mutations/patch-element/${encodeURIComponent(e)}`,{method:"POST",headers:{"Content-Type":"application/json",...Zl()},body:JSON.stringify(s)});return o.ok?(await o.json()).changed===!0:(i==null||i(k1e(new E3(o.status,await tB(o))),"error"),!1)}function nK(t){return t.map(e=>e.path).join(", ")}function E1e(t){return t instanceof Error?t.message:String(t)}async function T1e(t){return(t.headers.get("content-type")??"").includes("application/json")?await t.json().catch(()=>null):null}function P1e(t){return t!=null&&t.error?`Couldn't save edit: ${t.error}${O1e(t.fields)}`:"Couldn't save edit"}function Ltt(t){return t.target.id??t.target.hfId??t.target.selector??"(unaddressed)"}function Ftt(t,e){const n=t.patches.filter((r,i)=>e[i]===!1).map(Ltt);n.length!==0&&(console.warn(`[studio] z-index reorder: server could not match ${n.length} patch target(s) in ${t.sourceFile} (the whole z-order gesture will revert on reload):`,n.join(", ")),X0({source:"dom_edit",error:new Error(`Batch patch target(s) unmatched: ${n.join(", ")}`),filePath:t.sourceFile,mutationType:"z-reorder-unmatched"}))}class M1e extends Error{constructor(e,n){super(e,n),this.name="AtomicElementPatchConvergenceError"}}function $tt(t){return typeof t=="object"&&t!==null&&"sourceFile"in t&&typeof t.sourceFile=="string"&&"changed"in t&&typeof t.changed=="boolean"&&(!("matched"in t)||Array.isArray(t.matched)&&t.matched.every(e=>typeof e=="boolean"))&&"before"in t&&typeof t.before=="string"&&"after"in t&&typeof t.after=="string"&&t.changed===(t.before!==t.after)}async function Btt(t,e){const n=JSON.stringify({batches:e});try{const r=await fetch(`/api/projects/${encodeURIComponent(t)}/file-mutations/patch-element-batches`,{method:"POST",headers:{"Content-Type":"application/json",...Zl()},body:n});if(!r.ok){const a=await T1e(r);throw new s0(P1e(a),r.status)}const i=await r.json().catch(()=>null);if(typeof i!="object"||i===null||!("durable"in i)||typeof i.durable!="boolean"||!("files"in i)||!Array.isArray(i.files)||i.files.length!==e.length||!i.files.every($tt)||!i.durable&&i.files.some(a=>a.changed))throw new s0("Invalid atomic element patch response",502);const s=i.files.map((a,o)=>{const l=e[o],c=a.matched??[];if(!l||a.sourceFile!==l.sourceFile||c.length!==0&&c.length!==l.patches.length)throw new s0("Invalid atomic element patch response",502);return Ftt(l,c),{...a,matched:c,allMatched:c.length===l.patches.length&&c.every(Boolean)}});return{durable:i.durable,files:s}}catch(r){throw new M1e(E1e(r),{cause:r})}}function Vtt(t){return t.every(e=>e.patches.every(n=>n.operations.every(r=>r.type==="inline-style")))}function Htt({activeCompPath:t,previewIframeRef:e,showToast:n,queueDomEditSave:r,writeProjectFile:i,domEditSaveTimestampRef:s,editHistory:a,fileTree:o,importedFontAssetsRef:l,projectId:c,projectIdRef:u,reloadPreview:f,domEditSelection:h,applyDomSelection:p,clearDomSelection:y,refreshDomEditSelectionFromPreview:m,buildDomSelectionFromTarget:v,forceReloadSdkSession:b,onTrySdkPersist:w,onTrySdkDelete:O,onReorderShadow:k}){const E=x.useCallback(H=>{const se=Tet(H);if(!se)return null;const fe=l.current.find(me=>me.family.toLowerCase()===se.toLowerCase());if(fe)return fe;const be=o.find(me=>b0.test(me)&&$g(me).toLowerCase()===se.toLowerCase());return be?{family:$g(be),path:be,url:`/api/projects/${c}/preview/${be}`}:null},[o,c,l]),T=x.useRef(new Set),N=x.useCallback(async(H,se,fe)=>{const be=u.current;if(!be)throw new Error("No active project");if(fe!=null&&fe.shouldSave&&!fe.shouldSave())return;const me=H.sourceFile||t||"index.html",pe=await fetch(`/api/projects/${be}/files/${encodeURIComponent(me)}`);if(!pe.ok)throw await _d(pe,`Failed to read ${me}`);const Pe=(await pe.json()).content;if(typeof Pe!="string")throw new Error(`Missing file contents for ${me}`);if(fe!=null&&fe.shouldSave&&!fe.shouldSave())return;const xe={target:Wg(H),operations:se},we=IR(xe);if(we.length>0){const Ze=nK(we);throw n("Couldn't save edit because it contains invalid layout values","error"),new Z4(`DOM patch contains unsafe values: ${Ze}`,{alreadyToasted:!0})}if(w&&!(fe!=null&&fe.prepareContent)){const Ze=await w(H,se,Pe,me,{label:fe==null?void 0:fe.label,coalesceKey:fe==null?void 0:fe.coalesceKey,skipRefresh:fe==null?void 0:fe.skipRefresh});if(Ri(Ze))return}s.current=Date.now();const Ce=await fetch(`/api/projects/${be}/file-mutations/patch-element/${encodeURIComponent(me)}`,{method:"POST",headers:{"Content-Type":"application/json",...Zl()},body:JSON.stringify(xe)});if(!Ce.ok)throw n(P1e(await T1e(Ce)),"error"),await _d(Ce,`Failed to patch ${me}`,{alreadyToasted:!0});const Me=await Ce.json();if(!Me.changed){if(Me.matched===!1){const Ze=H.selector??H.id??"selection";throw T.current.has(Ze)||(T.current.add(Ze),Pt("save_skipped_unresolvable",{target_id:H.id??void 0,target_selector:H.selector??void 0,target_source_file:H.sourceFile??void 0,composition:t??void 0})),new Pet(me)}Det(H,se);return}const Ve=typeof Me.content=="string"?Me.content:Pe;let tt=Ve;if(fe!=null&&fe.prepareContent){const Ze=fe.prepareContent(Ve,me);if(Ze!==Ve)try{await i(me,Ze,Ve),tt=Ze}catch(qe){n(`Saved, but couldn't finish updating ${me}: ${E1e(qe)}`,"error")}}await a.recordEdit({label:(fe==null?void 0:fe.label)??"Edit layer",kind:"manual",coalesceKey:fe==null?void 0:fe.coalesceKey,coalesceMs:fe==null?void 0:fe.coalesceMs,files:{[me]:{before:Pe,after:tt}}}),b==null||b(),fe!=null&&fe.skipRefresh||f()},[t,a,i,u,s,f,n,b,w]),_=x.useCallback((H,se)=>r(async()=>{const fe=u.current;if(!fe)throw new Error("No active project");const be=H.flatMap(we=>we.patches.flatMap(Ce=>IR(Ce)));if(be.length>0)throw n("Couldn't save edit because it contains invalid layout values","error"),new Z4(`DOM patch contains unsafe values: ${nK(be)}`,{alreadyToasted:!0});s.current=Date.now();const me=await Btt(fe,H),pe=me.durable&&me.files.every(we=>we.allMatched),ge=Object.fromEntries(me.files.filter(we=>we.changed).map(we=>[we.sourceFile,{before:we.before,after:we.after}])),Pe=Object.keys(ge).length>0;Pe&&(await a.recordEdit({label:se.label,kind:"manual",coalesceKey:se.coalesceKey,coalesceMs:se.coalesceMs,files:ge}),b==null||b());const ve=pe,xe=se.skipReload===!0&&Vtt(H)&&ve;return(!ve||Pe&&!xe)&&f(),{durable:ve,allMatched:pe,changed:Pe}}).catch(fe=>{throw fe instanceof M1e&&f(),(fe instanceof s0||fe instanceof Z4)&&fe.alreadyToasted||n(fe instanceof Error?fe.message:"Failed to reorder layers","error"),X0({source:"dom_edit",error:fe,filePath:H.map(me=>me.sourceFile).join(","),mutationType:"z-reorder",label:se.label}),fe}),[s,a,b,u,r,f,n]),{handleDomStyleCommit:I,handleDomAttributeCommit:j,handleDomAttributeLiveCommit:L,handleDomAttributeQuietCommit:B,handleDomHtmlAttributeCommit:$,handleDomAttributesCommit:z,handleDomTextCommit:Y,handleDomRichTextCommit:W,commitDomTextFields:J,handleDomTextFieldStyleCommit:ne,handleDomAddTextField:le,handleDomRemoveTextField:ie}=ltt({activeCompPath:t,previewIframeRef:e,domEditSelection:h,applyDomSelection:p,refreshDomEditSelectionFromPreview:m,buildDomSelectionFromTarget:v,persistDomEditOperations:N,resolveImportedFontAsset:E,showToast:n}),q=Iet({activeCompPath:t,persistDomEditOperations:N,queueDomEditSave:r,showToast:n}),{handleDomPathOffsetCommit:F,handleDomBoxSizeCommit:U,handleDomRotationCommit:Z,handleDomManualEditsReset:K}=vtt({previewIframeRef:e,showToast:n,commitPositionPatchToHtml:q}),{handleDomEditElementDelete:ee,handleDomEditElementsDelete:re,handleDomZIndexReorderCommit:Q}=_tt({activeCompPath:t,showToast:n,writeProjectFile:i,domEditSaveTimestampRef:s,editHistory:a,projectIdRef:u,reloadPreview:f,clearDomSelection:y,onTrySdkDelete:O,onReorderShadow:k,forceReloadSdkSession:b,commitDomEditPatchBatches:_});return{resolveImportedFontAsset:E,handleDomStyleCommit:I,handleDomAttributeCommit:j,handleDomAttributeLiveCommit:L,handleDomAttributeQuietCommit:B,handleDomHtmlAttributeCommit:$,handleDomAttributesCommit:z,handleDomTextCommit:Y,handleDomRichTextCommit:W,commitDomTextFields:J,handleDomTextFieldStyleCommit:ne,handleDomAddTextField:le,handleDomRemoveTextField:ie,handleDomPathOffsetCommit:F,handleDomBoxSizeCommit:U,handleDomRotationCommit:Z,handleDomManualEditsReset:K,handleDomEditElementDelete:ee,handleDomEditElementsDelete:re,handleDomZIndexReorderCommit:Q}}function Qtt(t){const e=t.map(a=>({target:Wg(a),left:a.element.offsetLeft,top:a.element.offsetTop,right:a.element.offsetLeft+a.element.offsetWidth,bottom:a.element.offsetTop+a.element.offsetHeight})),n=Math.min(...e.map(a=>a.left)),r=Math.min(...e.map(a=>a.top)),i=Math.max(...e.map(a=>a.right))-n,s=Math.max(...e.map(a=>a.bottom))-r;return{bbox:{left:n,top:r,width:i,height:s},targets:e.map(a=>a.target),rebases:e.map(a=>({target:a.target,left:a.left-n,top:a.top-r}))}}async function rK(t,e,n,r,i,s){var u;const a=await fF(t,e);s.domEditSaveTimestampRef.current=Date.now();const o=await fetch(`/api/projects/${t}/file-mutations/${n}/${encodeURIComponent(e)}`,{method:"POST",headers:{"Content-Type":"application/json",...Zl()},body:JSON.stringify(r)});if(!o.ok){const f=await o.json().catch(()=>null);throw new Error((f==null?void 0:f.error)??`Failed to ${i.toLowerCase()} in ${e}`)}const l=await o.json(),c=typeof l.content=="string"?l.content:a;return await il({projectId:t,label:i,kind:"manual",files:{[e]:c},readFile:async()=>a,writeFile:s.writeProjectFile,recordEdit:s.editHistory.recordEdit}),s.clearDomSelection(),(u=s.forceReloadSdkSession)==null||u.call(s),s.reloadPreview(),l}function ztt(t){const{activeCompPath:e,showToast:n,projectIdRef:r}=t,i=x.useCallback(async a=>{const o=r.current;if(!o||a.length===0)return null;const l=a[0].sourceFile||e||"index.html";if(a.some(y=>(y.sourceFile||e||"index.html")!==l))return n("Can't group elements from different files","error"),null;const u=`Group ${a[0].element.ownerDocument.querySelectorAll("[data-hf-group]").length+1}`,{bbox:f,targets:h,rebases:p}=Qtt(a);try{return(await rK(o,l,"wrap-elements",{targets:h,groupId:u,bbox:f,rebases:p},"Group elements",t)).groupId??u}catch(y){return n(y instanceof Error?y.message:"Failed to group elements","error"),null}},[e,r,n,t]),s=x.useCallback(async a=>{const o=r.current;if(!o)return;const l=a.sourceFile||e||"index.html";try{await rK(o,l,"unwrap-elements",{target:Wg(a)},"Ungroup elements",t)}catch(c){n(c instanceof Error?c.message:"Failed to ungroup elements","error")}},[e,r,n,t]);return{groupSelection:i,ungroupSelection:s}}function iK(t,e){if(t.size!==e.size)return!1;for(const[n,r]of t)if(e.get(n)!==r)return!1;return!0}function nm(t){const{keyframeCache:e,gsapAnimations:n}=ue.getState(),r={keyframeCache:new Map(e),gsapAnimations:new Map(n)};t(r),!(iK(e,r.keyframeCache)&&iK(n,r.gsapAnimations))&&ue.setState({keyframeCache:r.keyframeCache,gsapAnimations:r.gsapAnimations})}function Ztt(t,e,n,r,i){var p,y,m;const{elements:s,domClipChildren:a}=ue.getState(),o=new Set,l=new Map,c=new Map;for(const v of t){const b=((p=v.keyframes)==null?void 0:p.keyframes)??((y=Ng(v))==null?void 0:y.keyframes)??[];if(b.length!==0)for(const w of A_(v.targetSelector,i)){o.add(w),c.set(w,[...c.get(w)??[],v]);const{elStart:O,elDuration:k}=QE(w,e,s,a),E=jL(b,v,O,k),T=l.get(w);T?T.keyframes=LL([...T.keyframes,...E]):l.set(w,{...v.keyframes,format:((m=v.keyframes)==null?void 0:m.format)??"percentage",keyframes:E})}}const u=r.targetSelector,f=u?A_(u,i):[],h=f.length>0?f:n?[n]:[];nm(v=>{for(const[b,w]of l)N1e(v,e,b,w,c.get(b));for(const b of h)o.has(b)||T3(v,e,b)})}function N1e(t,e,n,r,i){for(const s of N0(e,n))t.keyframeCache.set(s,r),i?t.gsapAnimations.set(s,i):t.gsapAnimations.delete(s)}function T3(t,e,n){for(const r of N0(e,n))t.keyframeCache.delete(r),t.gsapAnimations.delete(r)}function RR(t,e){nm(n=>T3(n,t,e))}function Gtt(t,e,n){const r=`${t}#`,i=new Set;for(const s of[...e.keys(),...n.keys()])s.startsWith(r)&&i.add(s.slice(r.length));return i}function Utt(t){const e=new Set(t),{keyframeCache:n,gsapAnimations:r}=ue.getState(),i=new Map;for(const s of[...n.keys(),...r.keys()]){const a=s.indexOf("#");if(a<0)continue;const o=s.slice(0,a);if(e.has(o))continue;const l=i.get(o)??new Set;l.add(s.slice(a+1)),i.set(o,l)}nm(s=>{for(const[a,o]of i)for(const l of o)T3(s,a,l)})}function P3(t){return`${t.sourceFile||"index.html"}#${t.id}`}function N0(t,e){const n=typeof e=="string"?e:Xtt(e,t);return t==="index.html"?[`index.html#${n}`,n]:[`${t}#${n}`,`index.html#${n}`,n]}function Xtt(t,e){var n;return Pt("cache_key_non_string",{value_type:typeof t,constructor_name:((n=t==null?void 0:t.constructor)==null?void 0:n.name)??null,is_array:Array.isArray(t),source_file:e}),String(t)}function Wtt(t,e,n){nm(r=>{for(const i of Gtt(t,r.keyframeCache,r.gsapAnimations))T3(r,t,i);for(const[i,s]of e)N1e(r,t,i,s,n.get(i))})}function qtt(t,e,n){nm(r=>{for(const i of N0(t,e))n?r.gsapAnimations.set(i,n):r.gsapAnimations.delete(i)})}function D1e(t,e){return`${t}#${e}`}function Ytt(t,e){if(e)return ue.getState().keyframeCache.get(D1e(t,e))}function sK(t,e,n){e&&ue.getState().setKeyframeCache(D1e(t,e),n)}const Ktt=new Set(["ease","duration","delay","stagger","motionPath","overwrite","immediateRender","onComplete","onUpdate","onStart","keyframes"]);function M3(t){if(!(t!=null&&t.contentWindow))return null;try{return t.contentWindow.__timelines??null}catch{return null}}function Jtt(t){return!!t&&typeof t.x=="number"&&typeof t.y=="number"}function nB(t){return!(t>0)}function ent(t){if(!t||typeof t!="object")return null;const e=t,n=Array.isArray(t)?t:e.path;if(!Array.isArray(n))return null;const r=n.filter(Jtt).map(a=>({x:a.x,y:a.y}));if(r.length<2)return null;const i=typeof e.curviness=="number"?e.curviness:1,s=typeof e.autoRotate=="number"?e.autoRotate:e.autoRotate===!0;return{coords:r,curviness:i,autoRotate:s,isCubic:e.type==="cubic"}}function tnt(t){const e={};for(const[n,r]of Object.entries(t))Ktt.has(n)||(typeof r=="number"?e[n]=Xt(r):typeof r=="string"&&(e[n]=r));return Object.keys(e).length===0?null:[{percentage:0,properties:e},{percentage:100,properties:e}]}function rB(t){if(t.keyframes&&typeof t.keyframes=="object"){const r=MDe(t.keyframes);if(r)return r}const e=ent(t.motionPath);if(e){const r=Doe(e.coords,e.curviness,e.autoRotate,e.isCubic);if(r){const i=r.waypoints.length;return{keyframes:r.waypoints.map((a,o)=>({percentage:i>1?Math.round(o/(i-1)*100):0,properties:{x:a.x,y:a.y}})),arcPath:r.arcPath}}}const n=tnt(t);return n?{keyframes:n}:null}function iB(t,e){if(!t.targets)return!1;for(const n of t.targets())if(n===e||e.id&&n.id===e.id)return!0;return!1}function nnt(t){const e=typeof t.startTime=="function"?t.startTime():0,n=typeof t.duration=="function"?t.duration():0;return{start:Number.isFinite(e)?e:0,duration:Number.isFinite(n)?n:0}}function rnt(t,e){if(!t)return!1;for(const n of e)if(Object.prototype.hasOwnProperty.call(t,n))return!0;return!1}function int(t,e){const n=t==null?void 0:t.keyframes;return!n||typeof n!="object"?!1:(Array.isArray(n)?n:Object.values(n)).some(i=>i!=null&&typeof i=="object"&&e.some(s=>Object.prototype.hasOwnProperty.call(i,s)))}function snt(t,e,n,r,i){var f;const s=M3(t);if(!s)return null;let a=null;try{a=((f=t==null?void 0:t.contentDocument)==null?void 0:f.querySelector(e))??null}catch{return null}if(!a)return null;const o=Object.keys(s).filter(h=>{var p;return typeof((p=s[h])==null?void 0:p.getChildren)=="function"}),l=i&&i.length>0?i:null;let c=null,u=null;for(const h of o){const p=s[h];if(!(p!=null&&p.getChildren))continue;const y=typeof p.time=="function"?p.time():null;for(const m of p.getChildren(!0)){if(!m.vars||!iB(m,a))continue;const v=typeof m.duration=="function"?m.duration():0,b=!(v>0);if(!(n==="set"?!b:b)){if(l){(n==="set"?rnt(m.vars,l):int(m.vars,l))?u===null&&(u={tween:m,timeline:p}):c===null&&(c={tween:m,timeline:p});continue}if(c===null&&(c={tween:m,timeline:p}),n==="keyframe"&&y!=null){const w=typeof m.startTime=="function"?m.startTime():0;if(y>=w-.001&&y<=w+v+.001)return{tween:m,timeline:p}}}}}return u??c}function I1e(t,e){return t.keyframes.some(n=>e.some(r=>n.properties[r]!=null))}function jR(t,e,n,r){var l;const i=M3(t);if(!i)return null;let s=null;try{s=((l=t==null?void 0:t.contentDocument)==null?void 0:l.querySelector(e))??null}catch{return null}if(!s)return null;const a=Object.keys(i).filter(c=>{var u;return typeof((u=i[c])==null?void 0:u.getChildren)=="function"});if(a.length===0)return null;let o=null;for(const c of a){const u=i[c];if(!(u!=null&&u.getChildren))continue;const f=typeof u.time=="function"?u.time():null;for(const h of u.getChildren(!0)){if(!h.vars||!iB(h,s))continue;const p=typeof h.duration=="function"?h.duration():0;if(nB(p))continue;const y=rB(h.vars);if(y&&!(r&&!I1e(y,r))&&(o===null&&(o=y),f!=null)){const m=typeof h.startTime=="function"?h.startTime():0;if(f>=m-.001&&f<=m+p+.001)return y}}}return o}function qS(t,e,n,r){var l;const i=M3(t);if(!i)return!1;const s=Object.keys(i).find(c=>{var u;return typeof((u=i[c])==null?void 0:u.getChildren)=="function"});if(!s)return!1;const a=i[s];if(!(a!=null&&a.getChildren))return!1;let o=null;try{o=((l=t==null?void 0:t.contentDocument)==null?void 0:l.querySelector(e))??null}catch{return!1}if(!o)return!1;for(const c of a.getChildren(!0)){if(!c.vars||!iB(c,o))continue;const u=typeof c.duration=="function"?c.duration():0;if(nB(u))continue;const f=rB(c.vars);if(f&&(!r||I1e(f,r)))return!0}return!1}function ant(t,e,n,r){return!r||r.duration<=0?t:t.map(i=>{const s=RL(e,n,i.percentage);return{...i,percentage:Math.round((s-r.start)/r.duration*1e5)/1e3}})}function ont(t,e,n,r){return{keyframes:ant(t.keyframes,e,n,r),tweenStart:e,tweenDuration:n,...t.easeEach?{easeEach:t.easeEach}:{},...t.arcPath?{arcPath:t.arcPath}:{}}}function lnt(t,e,n){if(!e.targets||!e.vars)return;const{start:r,duration:i}=nnt(e);if(nB(i))return;const s=rB(e.vars);if(s)for(const a of e.targets()){const o=a.id;o&&!t.has(o)&&t.set(o,ont(s,r,i,n==null?void 0:n.get(o)))}}function _1e(t,e){const n=new Map,r=M3(t);if(!r)return n;for(const i of Object.values(r))if(i!=null&&i.getChildren)for(const s of i.getChildren(!0))lnt(n,s,e);return n}const cnt=["x","y","rotation","rotationX","rotationY","rotationZ","z","transformPerspective","scaleX","scaleY","scale","opacity"];function unt(t){const e={};for(const[n,r]of Object.entries(t)){if(typeof r!="number"||!Number.isFinite(r))return null;e[n]=r}return Object.keys(e).length>0?e:null}function fnt(t,e,n){var r,i;try{const s=(r=t.contentWindow)==null?void 0:r.gsap,a=((i=t.contentDocument)==null?void 0:i.querySelector(e))??null,o=unt(n);return!(s!=null&&s.set)||!a||!o?!1:(s.set(a,o),!0)}catch{return!1}}function hnt(t){var e;try{return((e=t.contentWindow)==null?void 0:e.__player)??null}catch{return null}}function dnt(t){if(t.length===0)return!1;for(const e of t){if(!e||typeof e!="object")return!1;for(const n of Object.values(e))if(typeof n!="number"||!Number.isFinite(n))return!1}return!0}function pnt(t,e){const n=t.vars;if(!n||"motionPath"in n)return!1;let r=!1;for(const i of cnt){const s=e[i];if(s!==void 0){if(typeof s!="number"||!Number.isFinite(s)||typeof n[i]=="string")return!1;n[i]=s,r=!0}}return r}function mnt(t,e){const n=t.vars;return!n||"motionPath"in n||!Array.isArray(n.keyframes)||!dnt(e)?!1:(n.keyframes=e.map(r=>({...r})),!0)}function gnt(t,e,n){const r={};for(const[s,a]of Object.entries(t))r[s]={...a};let i=null;for(const s of Object.keys(r)){const a=parseFloat(s);if(Number.isFinite(a)&&Math.abs(a-e)<.05){i=s;break}}return i===null&&(i=`${e}%`),r[i]={...r[i]??{},...n},r}function ynt(t,e,n){var u;const r=t.vars;if(!r||"motionPath"in r)return!1;const i=r.keyframes;if(!i||typeof i!="object"||Array.isArray(i))return!1;for(const f of Object.values(n))if(typeof f!="number"||!Number.isFinite(f))return!1;const s=t.parent,a=(u=t.targets)==null?void 0:u.call(t);if(!(s!=null&&s.to)||!a||a.length===0||typeof t.startTime!="function"||typeof t.kill!="function")return!1;const o=gnt(i,e,n),l={...r,keyframes:o},c=t.startTime();return t.kill(),s.to(a,l,c),!0}function xnt(t){if(t.kind==="set")return Object.keys(t.props).filter(e=>t.props[e]!==void 0);if(t.kind==="keyframe-rebuild")return Object.keys(t.props)}function bnt(t,e){var i;const n=hnt(t),r=typeof(n==null?void 0:n.getTime)=="function"?n.getTime():typeof e.time=="function"?e.time():0;(i=n==null?void 0:n.seek)==null||i.call(n,Number.isFinite(r)?r:0)}function vnt(t){return t.kind==="set"||t.kind==="global-set"?t.props.opacity!==void 0:t.kind==="keyframes"?t.keyframes.some(e=>"opacity"in e):"opacity"in t.props}function Ant(t){const e=typeof t.targets=="function"?t.targets():[];for(const n of e??[]){const r=n;if(!(r!=null&&r.style)||typeof r.getAttribute!="function")continue;const i=yhe(r);i!==null&&xhe(r.style,i)}}function Snt(t,e){return e.kind==="set"?pnt(t,e.props):e.kind==="keyframes"?mnt(t,e.keyframes):e.kind==="keyframe-rebuild"?ynt(t,e.pct,e.props):!1}function wnt(t,e,n,r,i=!1){var s;if(!t)return!1;if(n.kind==="global-set")return fnt(t,e,n.props);try{const a=snt(t,e,n.kind==="set"?"set":"keyframe",r,xnt(n));if(!a)return!1;const{tween:o,timeline:l}=a;return vnt(n)&&Ant(o),Snt(o,n)?(n.kind!=="keyframe-rebuild"&&((s=o.invalidate)==null||s.call(o)),i||bnt(t,l),!0):!1}catch{return!1}}function Ont(){const t=new Map;return function(n,r){const s=(t.get(n)??Promise.resolve()).then(r,r);return t.set(n,s),s.then(()=>{t.get(n)===s&&t.delete(n)},()=>{t.get(n)===s&&t.delete(n)}),s}}function Cnt({projectIdRef:t,activeCompPath:e,commitMutation:n,commitMutationSafely:r,showToast:i,sdkSession:s,sdkDeps:a}){const o=x.useCallback(async(p,y,m)=>{if(s&&a){const v=p.sourceFile||e||"index.html",b=await zp(v,{kind:"set",animationId:y,properties:m},s,a,{label:"Edit GSAP animation",coalesceKey:`gsap:${y}:meta`});if(Ri(b))return}r(p,{type:"update-meta",animationId:y,updates:m},{label:"Edit GSAP animation",coalesceKey:`gsap:${y}:meta`,softReload:!0})},[r,e,s,a]),l=x.useCallback(async(p,y)=>{if(s&&a){const m=p.sourceFile||e||"index.html",v=await zp(m,{kind:"remove",animationId:y},s,a,{label:"Delete GSAP animation"});if(Ri(v))return}r(p,{type:"delete",animationId:y,stripStudioEdits:!0},{label:"Delete GSAP animation"})},[r,e,s,a]),c=x.useCallback(async(p,y)=>{if(s&&a){const m=p.sourceFile||e||"index.html",v=await SJe(m,y,s,a,{label:"Delete all animations for element"});if(Ri(v))return}n(p,{type:"delete-all-for-selector",targetSelector:y},{label:"Delete all animations for element",softReload:!0})},[n,e,s,a]),u=x.useCallback(async(p,y,m)=>{var N,_;const{selector:v,autoId:b}=Rtt(p);if(b){const I=t.current,j=p.sourceFile||e||"index.html";if(!I||!await jtt({projectId:I,targetPath:j,selection:p,autoId:b,showToast:i}))return}const w=Number.parseFloat(((N=p.dataAttributes)==null?void 0:N.start)??"0")||0,O=Number.parseFloat(((_=p.dataAttributes)==null?void 0:_.duration)??"1")||1,k=Xt(w),E=Xt(O),T={from:{opacity:0},to:{x:0,y:0,opacity:1},set:{opacity:1},fromTo:{x:0,y:0,opacity:1}};if(!b&&p.hfId&&s&&a){const I=p.sourceFile||e||"index.html",j={method:y,position:k,...y!=="set"?{duration:E,ease:"power2.out"}:{},properties:T[y]??{opacity:1},...y==="fromTo"?{fromProperties:{opacity:0}}:{}},L=await zp(I,{kind:"add",target:p.hfId,spec:j},s,a,{label:`Add GSAP ${y} animation`});if(Ri(L))return}await n(p,{type:"add",targetSelector:v,method:y,position:k,duration:y==="set"?void 0:E,ease:y==="set"?void 0:"power2.out",properties:T[y]??{opacity:1},fromProperties:y==="fromTo"?{opacity:0}:void 0},{label:`Add GSAP ${y} animation`})},[e,n,t,i,s,a]),f=x.useCallback(async(p,y,m,v,b,w,O="Add animation with keyframes")=>{if(s&&a){const k=p.sourceFile||e||"index.html",E=await EJe(k,y,m,v,b,w,s,a,{label:O});if(Ri(E))return}n(p,{type:"add-with-keyframes",targetSelector:y,position:m,duration:v,keyframes:b,...w?{ease:w}:{}},{label:O,softReload:!0})},[n,e,s,a]),h=x.useCallback(async(p,y,m,v,b,w,O,k="Replace animation with keyframes")=>{if(s&&a){const E=p.sourceFile||e||"index.html",T=await TJe(E,y,m,v,b,w,O,s,a,{label:k});if(Ri(T))return}n(p,{type:"replace-with-keyframes",animationId:y,targetSelector:m,position:v,duration:b,keyframes:w,...O?{ease:O}:{}},{label:k,softReload:!0})},[n,e,s,a]);return{updateGsapMeta:o,deleteGsapAnimation:l,deleteAllForSelector:c,addGsapAnimation:u,addWithKeyframes:f,replaceWithKeyframes:h}}function knt(t){const e=x.useCallback((i,s,a)=>{t(i,{type:"set-arc-path",animationId:s,...a},{label:a.enabled?"Enable arc path":"Disable arc path",softReload:!0})},[t]),n=x.useCallback((i,s,a,o)=>{t(i,{type:"update-arc-segment",animationId:s,segmentIndex:a,...o},{label:"Update arc segment",softReload:!0})},[t]),r=x.useCallback((i,s)=>{t(i,{type:"remove-arc-path",animationId:s},{label:"Remove arc path",softReload:!0})},[t]);return{setArcPath:e,updateArcSegment:n,removeArcPath:r}}async function Ent(t){const e=t.apply();try{await t.persist()}catch{t.rollback(e)}}async function Tnt(t,e,n,r,i){const s=vc(t);if(!s)return;const a=CDe(e,n,s);if(a){const o=Nce(e,a);if(o===null)return;!!a.keyframes&&a.keyframes.keyframes.length>0||await i(t,{type:"convert-to-keyframes",animationId:a.id},{label:"Convert to keyframes",skipReload:!0});const c={};for(const u of Object.keys(r))c[u]=Pg[u]??0;await i(t,{type:"add-keyframe",animationId:a.id,percentage:o,properties:r,backfillDefaults:c},{label:`Add keyframe at ${va(e)}s`,coalesceKey:`keyframe:${a.id}:${o}`,softReload:!0})}else{const o=Ec(t);if(!o)return;await i(t,{type:"add-with-keyframes",targetSelector:o,position:e,duration:.5,keyframes:[{percentage:0,properties:r},{percentage:100,properties:r}]},{label:`New animation at ${va(e)}s`,softReload:!0})}}function aK(t){return Ent({apply:()=>{const e=Ytt(t.sourceFile,t.elementId);return e&&sK(t.sourceFile,t.elementId,t.apply(e)),e},persist:t.persist,rollback:e=>{sK(t.sourceFile,t.elementId,e)}})}function EN(t,e){return{label:t,coalesceKey:e==null?void 0:e.coalesceKey,coalesceMs:e==null?void 0:e.coalesceMs,skipRefresh:e==null?void 0:e.skipReload}}function Pnt({activeCompPath:t,commitMutation:e,commitMutationSafely:n,trackGsapSaveFailure:r,sdkSession:i,sdkDeps:s}){const a=x.useCallback((y,m,v,b,w)=>{const O=y.sourceFile||t||"index.html",k={type:"add-keyframe",animationId:m,percentage:v,properties:{[b]:w}};aK({sourceFile:O,elementId:y.id,apply:E=>{const T=E.keyframes.findIndex(N=>Math.abs((N.tweenPercentage??N.percentage)-v)<=2);if(T>=0){const N=E.keyframes.slice();return N[T]={...N[T],properties:{...N[T].properties,[b]:w}},{...E,keyframes:N}}return{...E,keyframes:[...E.keyframes,{percentage:v,properties:{[b]:w}}].sort((N,_)=>N.percentage-_.percentage)}},persist:async()=>{if(i&&s){const E=await MY(O,m,v,{[b]:w},i,s,{label:`Add keyframe at ${v}%`,coalesceKey:`gsap:${m}:kf:${v}`});if(Ri(E))return}await e(y,k,{label:`Add keyframe at ${v}%`,softReload:!0})}}).catch(E=>{r(E,y,k,`Add keyframe at ${v}%`)})},[t,e,r,i,s]),o=x.useCallback(async(y,m,v,b,w)=>{if(i&&s){const O=y.sourceFile||t||"index.html",k=await MY(O,m,v,b,i,s,EN(`Add keyframe at ${v}%`,w));if(Ri(k))return}return e(y,{type:"add-keyframe",animationId:m,percentage:v,properties:b},{label:`Add keyframe at ${v}%`,softReload:!0,...w})},[e,t,i,s]),l=x.useCallback((y,m,v,b)=>{const w=y.sourceFile||t||"index.html",O={type:"remove-keyframe",animationId:m,percentage:v};aK({sourceFile:w,elementId:y.id,apply:k=>({...k,keyframes:k.keyframes.filter(E=>Math.abs((E.tweenPercentage??E.percentage)-v)>2)}),persist:async()=>{const k=`Remove keyframe at ${v}%`;if(i&&s){const T=await vJe(w,m,v,i,s,EN(k,b));if(Ri(T))return}const E=b!=null&&b.skipReload?{label:k,...b}:{label:k,softReload:!0,...b};await e(y,O,E)}}).catch(k=>{r(k,y,O,`Remove keyframe at ${v}%`)})},[t,e,r,i,s]),c=x.useCallback(async(y,m,v,b)=>{const w={type:"move-keyframe",animationId:m,fromPercentage:v,toPercentage:b};try{let O=!1;return await e(y,w,{label:`Move keyframe to ${b}%`,softReload:!0,onResult:k=>{O=k.changed!==!1}}),O}catch(O){return r(O,y,w,`Move keyframe to ${b}%`),!1}},[e,r]),u=x.useCallback(async(y,m,v,b,w)=>{const O={type:"resize-keyframed-tween",animationId:m,position:v,duration:b,pctRemap:w};try{let k=!1;return await e(y,O,{label:"Retime keyframe (resize tween)",softReload:!0,onResult:E=>{k=E.changed!==!1}}),k}catch(k){return r(k,y,O,"Retime keyframe (resize tween)"),!1}},[e,r]),f=x.useCallback(async(y,m,v,b,w={softReload:!0})=>{if(i&&s){const O=y.sourceFile||t||"index.html",k=await OJe(O,m,v,i,s,EN("Convert to keyframes",w));if(Ri(k))return}return e(y,{type:"convert-to-keyframes",animationId:m,resolvedFromValues:v,duration:b},{label:"Convert to keyframes",...w})},[e,t,i,s]),h=x.useCallback(async(y,m)=>{var w;const v=y.sourceFile||t||"index.html",b=y.id||((w=y.element)==null?void 0:w.id);if(i&&s){const O=await wJe(v,m,i,s,{label:"Remove all keyframes"});if(Ri(O)){b&&RR(v,b);return}}await n(y,{type:"remove-all-keyframes",animationId:m},{label:"Remove all keyframes",softReload:!0,onResult:O=>{O.changed!==!1&&b&&RR(v,b)}})},[n,t,i,s]),p=x.useCallback((y,m,v,b)=>Tnt(y,m,v,b,e),[e]);return{addKeyframe:a,addKeyframeBatch:o,removeKeyframe:l,moveKeyframe:c,resizeKeyframedTween:u,convertToKeyframes:f,removeAllKeyframes:h,commitKeyframeAtTime:p}}const Mnt=150;function b8(t,e,n,r){try{const i=eC(t.serialize());if(!i)return{...n};const s=wDe(i).animations.find(o=>o.id===e);return s?{...r==="from"?s.fromProperties??{}:s.properties,...n}:{...n}}catch{return{...n}}}function Nnt(t,e){const n=x.useRef(null),r=x.useRef(null),i=x.useRef(e);i.current=e;const s=x.useCallback(async()=>{var k,E;const p=n.current;if(!p)return;n.current=null;const{selection:y,animationId:m,property:v,value:b}=p,w={type:"update-property",animationId:m,property:v,value:b},O=`Edit GSAP ${v}`;try{const{sdkSession:T,sdkDeps:N,activeCompPath:_}=i.current??{};if(T&&N){const I=y.sourceFile||_||"index.html",j=await zp(I,{kind:"set",animationId:m,properties:{properties:b8(T,m,{[v]:b},"to")}},T,N,{label:O,coalesceKey:`gsap:${m}:${v}`});if(Ri(j))return}await t(y,w,{label:O,coalesceKey:`gsap:${m}:${v}`,softReload:!0})}catch(T){(E=(k=i.current)==null?void 0:k.onFlushError)==null||E.call(k,T,y,w,O)}},[t]),a=x.useCallback((p,y,m,v)=>{n.current={selection:p,animationId:y,property:m,value:v},r.current&&clearTimeout(r.current),r.current=setTimeout(()=>{s()},Mnt)},[s]);x.useEffect(()=>()=>{r.current&&clearTimeout(r.current),s()},[s]);const o=x.useCallback(async(p,y,m)=>{var E;let v=Pg[m]??0;const b=p.element;if(m==="width"||m==="height"){const T=b.getBoundingClientRect();v=Math.round(m==="width"?T.width:T.height)}else if(m==="opacity"||m==="autoAlpha"){const T=(E=b.ownerDocument.defaultView)==null?void 0:E.getComputedStyle(b),N=T?Number.parseFloat(T.opacity):Number.NaN;v=Number.isFinite(N)?N:1}const{sdkSession:w,sdkDeps:O,activeCompPath:k}=i.current??{};if(w&&O){const T=p.sourceFile||k||"index.html",N=await zp(T,{kind:"set",animationId:y,properties:{properties:b8(w,y,{[m]:v},"to")}},w,O,{label:`Add GSAP ${m}`});if(Ri(N))return}t(p,{type:"add-property",animationId:y,property:m,defaultValue:v},{label:`Add GSAP ${m}`})},[t]),l=x.useCallback(async(p,y,m,v)=>{const{sdkSession:b,sdkDeps:w,activeCompPath:O}=i.current??{};if(b&&w){const k=p.sourceFile||O||"index.html",E=await AJe(k,y,m,v,b,w,{label:`Remove GSAP ${v?`from-${m}`:m}`});if(Ri(E))return}v?t(p,{type:"remove-from-property",animationId:y,property:m},{label:`Remove GSAP from-${m}`}):t(p,{type:"remove-property",animationId:y,property:m},{label:`Remove GSAP ${m}`})},[t]),c=x.useCallback((p,y,m)=>l(p,y,m,!1),[l]),u=x.useCallback(async(p,y,m,v)=>{const{sdkSession:b,sdkDeps:w,activeCompPath:O}=i.current??{};if(b&&w){const k=p.sourceFile||O||"index.html",E=await zp(k,{kind:"set",animationId:y,properties:{fromProperties:b8(b,y,{[m]:v},"from")}},b,w,{label:`Edit GSAP from-${m}`,coalesceKey:`gsap:${y}:from:${m}`});if(Ri(E))return}t(p,{type:"update-from-property",animationId:y,property:m,value:v},{label:`Edit GSAP from-${m}`,coalesceKey:`gsap:${y}:from:${m}`})},[t]),f=x.useCallback(async(p,y,m)=>{const v=Pg[m]??0,{sdkSession:b,sdkDeps:w,activeCompPath:O}=i.current??{};if(b&&w){const k=p.sourceFile||O||"index.html",E=await zp(k,{kind:"set",animationId:y,properties:{fromProperties:b8(b,y,{[m]:v},"from")}},b,w,{label:`Add GSAP from-${m}`});if(Ri(E))return}t(p,{type:"add-from-property",animationId:y,property:m,defaultValue:v},{label:`Add GSAP from-${m}`})},[t]),h=x.useCallback((p,y,m)=>l(p,y,m,!0),[l]);return{updateGsapProperty:a,addGsapProperty:o,removeGsapProperty:c,updateGsapFromProperty:u,addGsapFromProperty:f,removeGsapFromProperty:h}}function Dnt(t){return typeof t.type=="string"?t.type:"gsap"}function R1e(t){return x.useCallback((e,n,r,i)=>{X0({source:"gsap_commit",error:e,filePath:n.sourceFile??t??"index.html",mutationType:Dnt(r),label:i,targetId:n.id,targetSelector:n.selector,targetSourceFile:n.sourceFile})},[t])}function j1e(t,e,n){return x.useCallback((r,i,s)=>t(r,i,s).catch(a=>{e(a,r,i,s.label),n==null||n(`Couldn't save animation: ${Nu(a)}`,"error")}),[t,e,n])}async function Int(t,e,n){const r=await fetch(`/api/projects/${encodeURIComponent(t)}/gsap-mutations/${encodeURIComponent(e)}`,{method:"POST",headers:{"Content-Type":"application/json",...Zl()},body:JSON.stringify(n)});if(!r.ok)throw new E3(r.status,await tB(r));const i=await r.json();if(!i.ok)throw new Error(`Failed to update GSAP in ${e}`);return i}async function _nt(t,e,n){const r=await fetch(`/api/projects/${encodeURIComponent(t)}/gsap-mutations-batch/${encodeURIComponent(e)}`,{method:"POST",headers:{"Content-Type":"application/json",...Zl()},body:JSON.stringify({mutations:n})});if(!r.ok)throw new E3(r.status,await tB(r));const i=await r.json();if(!i.ok)throw new Error(`Failed to update GSAP in ${e}`);return i}function Rnt(t,e,n){var r;e.changed!==!1||t.length!==1||((r=t[0])==null?void 0:r.type)==="move-keyframe"&&(n==null||n("A keyframe already exists at that time","info"))}async function oK(t,e,n,r){const i=t.flatMap(s=>LC(s));if(i.length>0){if(n==null||n("Couldn't read element layout — try again at a different playhead time","error"),e.skipReload)return;throw GX(new Error(`Mutation contains unsafe values: ${i.map(s=>s.path).join(", ")}`))}try{const s=await r();return Rnt(t,s,n),s}catch(s){if(s instanceof E3&&(n==null||n(k1e(s),"error"),GX(s)),e.skipReload)return;throw s}}function jnt(t,e,n,r){var i;return e.changed!==!1?!1:(!n.skipReload&&($1e(n).length>0||(i=n.previewFallbackLatch)!=null&&i.pending)&&F1e(t,e,n,r),!0)}function Lnt(t,e,n,r,i){var s;(s=n.beforeReload)==null||s.call(n),F1e(t,e,n,r),i()}function lK(t,e,n,r){return t.current===n&&e.current===r}function Fnt({iframe:t,selection:e,mutation:n,targetPath:r,result:i,options:s,onFileContentChanged:a,forceReloadSdkSession:o,reloadPreview:l,onCacheInvalidate:c}){var u;i.after!=null&&(a==null||a(r,i.after)),o==null||o(),!s.skipReload&&((u=i.parsed)!=null&&u.animations&&Ztt(i.parsed.animations,r,e.id??void 0,n,t==null?void 0:t.contentDocument),Lnt(t,i,s,l,c))}function L1e(t,e,n,r,i){const s=ue.getState().currentTime,a=bF(t,e,{onAsyncFailure:n,currentTimeOverride:s,authoredHtml:i});a!=="applied"&&(Pt("gsap_soft_reload_outcome",{origin:r,result:a,escalated:a==="cannot-soft-reload"}),a==="cannot-soft-reload"&&n())}function F1e(t,e,n,r){var a;const i=$1e(n);let s=((a=n.previewFallbackLatch)==null?void 0:a.pending)===!0;if(i.length>0){const o=n.deferPreviewSync===!0,l=i.find((c,u)=>!wnt(t,c.selector,c.change,void 0,o||u{W.before==null||W.after==null||await r.recordEdit({label:J.label,kind:"manual",coalesceKey:J.coalesceKey,coalesceMs:J.coalesceMs,files:{[Y]:{before:W.before,after:W.after}}})},[r]),b=x.useCallback(async(Y,W,J,ne,le,ie,q)=>{if(t.current!==Y)return;const F=lK(t,y,Y,W);if(ie.changed===!1){F&&jnt(n.current,ie,q,s);return}F&&(i.current=Date.now()),await v(le,ie,q),lK(t,y,Y,W)&&Fnt({iframe:n.current,selection:J,mutation:ne,targetPath:le,result:ie,options:q,onFileContentChanged:o,forceReloadSdkSession:h,reloadPreview:s,onCacheInvalidate:a})},[t,n,i,s,a,o,h,v]),w=x.useCallback(async(Y,W,J,ne,le,ie)=>{var F;const q=await oK([le],ie,l,()=>Int(Y,J,le));q&&((F=ie.onResult)==null||F.call(ie,q),await b(Y,W,ne,le,J,q,ie))},[l,b]),O=x.useCallback(async(Y,W,J,ne,le)=>{var re;const ie=ne[0],q=ne.at(-1);if(!ie||!q)return;const F=ne.map(({mutation:Q})=>Q),U=await oK(F,le,l,()=>_nt(Y,J,F));if(!U)return;(re=le.onResult)==null||re.call(le,U);const Z=ne.map(({options:Q})=>Q.instantPatch).filter(Q=>Q!==void 0),{instantPatch:K,...ee}=le;await b(Y,W,q.selection,q.mutation,J,U,Z.length>0?{...ee,instantPatches:Z}:ee)},[l,b]),k=x.useMemo(()=>{const Y=(ne,le)=>f?wS(f,ne,le):m.current(`gsap-file:${ne}`,le),W=(ne,le,ie)=>{const q=`gsap-file:${ne}`,F=()=>Y(ne,ie);return le&&(f||le!==q)?m.current(le,F):F()},J=(ne,le,ie)=>{if(!p)return Promise.resolve();const q=ne.sourceFile||e||"index.html";return W(q,ie.serializeKey,()=>w(p,e,q,ne,le,ie))};return J.batch=(ne,le)=>{var q;if(!p)return Promise.resolve();const ie=((q=ne[0])==null?void 0:q.selection.sourceFile)||e||"index.html";return W(ie,le.serializeKey,()=>O(p,e,ie,ne,le))},J},[w,O,e,p,f]),E=R1e(e),T=x.useCallback((Y,W,J,ne)=>{E(Y,W,J,ne),cF(Y)||l==null||l(`Couldn't save animation: ${Nu(Y)}`,"error")},[l,E]),N=j1e(k,T),_=x.useCallback(Y=>{const W=eC(Y);W?L1e(n.current,W,s,"sdk_refresh",Y):s(),a()},[n,s,a]),I=x.useCallback(Y=>{if(!p)throw new Error("No active project");return fF(p,Y)},[p]),j=x.useMemo(()=>f?{editHistory:{recordEdit:r.recordEdit},writeProjectFile:f,reloadPreview:s,domEditSaveTimestampRef:i,refresh:_,compositionPath:e,readProjectFile:I,publishSession:u}:null,[r.recordEdit,f,s,i,_,e,I,u]),L=Nnt(N,{sdkSession:c,sdkDeps:j,activeCompPath:e,onFlushError:T}),B=Cnt({projectIdRef:t,activeCompPath:e,commitMutation:k,commitMutationSafely:N,showToast:l,sdkSession:c,sdkDeps:j}),$=Pnt({activeCompPath:e,commitMutation:k,commitMutationSafely:N,trackGsapSaveFailure:T,sdkSession:c,sdkDeps:j}),z=knt(N);return{commitMutation:k,...L,...B,...$,...z}}function LR(t,e,n){if(n==="opacity"&&e.getAttribute(JE)!=null&&e.id){const r=e.ownerDocument.getElementById(Lje+e.id),i=e.ownerDocument.defaultView;if(r&&i){const s=Number(i.getComputedStyle(r).opacity);if(Number.isFinite(s))return s}}return Number(t.getProperty(e,n))}function $C(t,e,n){if(!e)return null;const r=IL(t);if(!r)return null;const i=_L(t,e);if(!i)return null;try{const s=LR(r,i,n);return Number.isFinite(s)?sB.has(n)?Math.round(s):Xt(s):null}catch{return null}}const sB=new Set(["x","y","xPercent","yPercent"]),Bnt=new Set(["duration","ease","delay","stagger","id","onComplete","onUpdate","onStart","onRepeat","repeat","yoyo","repeatDelay","paused","immediateRender","lazy","overwrite","keyframes","parent"]);function SA(t,e,n,r){var v;const i={};if(!t)return i;const s=IL(t);if(!s)return i;const a=_L(t,e);if(!a)return i;let o=null;try{o=(t==null?void 0:t.contentDocument)??null}catch{}const l=new Set;if(n.keyframes)for(const b of n.keyframes.keyframes)for(const w of Object.keys(b.properties))typeof b.properties[w]=="number"&&l.add(w);else for(const b of Object.keys(n.properties))l.add(b);const c=b=>!r||rl(b)===r,u=new Set([...l].filter(c));for(const b of u){const w=LR(s,a,b);Number.isFinite(w)&&(i[b]=sB.has(b)?Math.round(w):Xt(w))}const f=new Set;try{const w=t.contentWindow.__timelines;if(w)for(const O of Object.values(w)){const k=O;if(k!=null&&k.getChildren)for(const E of k.getChildren(!0)){if(typeof E.targets!="function"||!E.targets().includes(a))continue;const N=E.vars;if(N)for(const _ of Object.keys(N))!Bnt.has(_)&&c(_)&&f.add(_)}}}catch{}for(const b of u)f.delete(b);const h={opacity:1,scale:1,scaleX:1,scaleY:1,scaleZ:1,rotation:0,rotationX:0,rotationY:0,skewX:0,skewY:0,z:0,xPercent:0,yPercent:0,transformPerspective:0,blur:0,brightness:1,contrast:1,saturate:1,hueRotate:0,grayscale:0,sepia:0,invert:0},p=new Set([...u,...f]);for(const[b,w]of Object.entries(h)){if(b in i||!p.has(b))continue;const O=LR(s,a,b);Number.isFinite(O)&&Math.round(O*1e3)!==Math.round(w*1e3)&&(i[b]=Xt(O))}const y=["borderRadius","borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius","letterSpacing","wordSpacing","lineHeight","fontSize","outlineOffset","outlineWidth","strokeDashoffset","strokeWidth","backgroundPositionX","backgroundPositionY"];let m=null;try{m=((v=o==null?void 0:o.defaultView)==null?void 0:v.getComputedStyle(a))??null}catch{}for(const b of y){if(b in i||!c(b)||f.has(b))continue;const w=Number(s.getProperty(a,b));if(!Number.isFinite(w))continue;let O=NaN;if(m){const k=m.getPropertyValue(b.replace(/[A-Z]/g,E=>`-${E.toLowerCase()}`));O=parseFloat(k)}Number.isFinite(O)&&Math.round(w*1e3)===Math.round(O*1e3)||(i[b]=Xt(w))}return i}function Fy(t,e,n){const r=t.style.getPropertyValue("--hf-studio-rotation"),s=-(Number.parseFloat(r)||0)*Math.PI/180,a=Math.cos(s),o=Math.sin(s),l=Number.parseFloat(t.getAttribute("data-hf-drag-initial-offset-x")??"")||0,c=Number.parseFloat(t.getAttribute("data-hf-drag-initial-offset-y")??"")||0,u=e.x-l,f=e.y-c,h=u*a-f*o,p=u*o+f*a,y=Number.parseFloat(t.getAttribute("data-hf-drag-gsap-base-x")??""),m=Number.parseFloat(t.getAttribute("data-hf-drag-gsap-base-y")??""),v=Number.isFinite(y)?y:n.x,b=Number.isFinite(m)?m:n.y;return{newX:Math.round(v+h),newY:Math.round(b+p),baseGsapX:v,baseGsapY:b}}let Vnt=0;const B1e=new WeakSet;function Hnt(t){return B1e.has(t)}function cK(t){const{x:e,y:n,width:r,height:i}=t.getBoundingClientRect();return{x:e,y:n,width:r,height:i}}function Qnt(t,e,n){const{coalesceKey:r,skipReload:i,softReload:s,...a}=t;return s?{...a,label:n,softReload:!0,coalesceKey:e,coalesceMs:Number.POSITIVE_INFINITY}:{...a,label:n,skipReload:!0,coalesceKey:e,coalesceMs:Number.POSITIVE_INFINITY}}function znt(t,e){return{x:e.x-t.x,y:e.y-t.y,width:e.width-t.width,height:e.height-t.height}}function Znt(t){return Object.values(t).some(e=>Math.abs(e)>1)}function v8(t){return Math.round(t*10)/10}function Gnt(t){var a;const e=t.find(({options:o})=>o.softReload),n=(e==null?void 0:e.options)??((a=t.at(-1))==null?void 0:a.options);if(!n)throw new Error("Cannot merge an empty gesture transaction");const{skipReload:r,instantPatch:i,...s}=n;return e?{...s,softReload:!0}:{...s,skipReload:!0}}function TN(t){return t.filter(({options:e})=>e.softReload).length}async function Unt(t){const e=t[0];if(!e)return 0;if(t.length===1)return await e.dispatch(e.selection,e.mutation,e.options),TN(t);if(t.every(({dispatch:r,selection:i})=>r===e.dispatch&&i.sourceFile===e.selection.sourceFile)&&e.dispatch.batch)return await e.dispatch.batch(t.map(({selection:r,mutation:i,options:s})=>({selection:r,mutation:i,options:s})),Gnt(t)),TN(t)>0?1:0;for(const{dispatch:r,selection:i,mutation:s,options:a}of t)await r(i,s,a);return TN(t)}const ub=W0("commit");function V1e(t){const e=performance.now(),n=`tx:${t.label}:${++Vnt}`;let r=0,i=0;const s=[];ub("start",{label:t.label,coalesceKey:n}),t.settle(),ub("settled",{label:t.label,coalesceKey:n});const a=t.skipPixelAssert?null:cK(t.element),o=l=>{const c=(u,f,h)=>(r+=1,s.push({dispatch:l,selection:u,mutation:f,options:Qnt(h,n,t.label)}),Promise.resolve());return B1e.add(c),c};return t.persist(o).then(async()=>{i=await Unt(s);const l=Math.round(performance.now()-e);if(ub("persisted",{label:t.label,coalesceKey:n}),a){const c=cK(t.element),u=znt(a,c);Znt(u)&&(ub("persist-changed-pixels",{label:t.label,before:a,after:c,delta:u}),Pt("commit_invariant_violation",{label:t.label,delta_x:v8(u.x),delta_y:v8(u.y),delta_w:v8(u.width),delta_h:v8(u.height),mutation_count:r,reload_count:i,duration_ms:l}))}Pt("commit_transaction",{label:t.label,mutation_count:r,reload_count:i,duration_ms:l,pixel_asserted:a!==null})}).catch(l=>{throw t.restore(),Pt("commit_transaction_failed",{label:t.label,mutation_count:r,error_name:l instanceof Error?l.name:"unknown",restore_ran:!0}),ub("restore",{label:t.label,coalesceKey:n}),l})}function Xnt(t,e,n=!1){const r={[e.property]:e.value};return{selector:t,change:{kind:n?"global-set":"set",props:r}}}function Wnt(t,e,n){return t.find(r=>r.method==="set"&&vy(r.targetSelector,e,n)&&("x"in r.properties||"y"in r.properties))??null}function H1e(t,e,n){const r=Wnt(t,e,n);return r||(t.find(i=>vy(i.targetSelector,e,n)&&i.propertyGroup==="position"&&Xo(i))??null)}function qnt(t,e,n){return t.find(r=>Xo(r)&&vy(r.targetSelector,e,n)&&"rotation"in r.properties)??null}function uK(t,e,n){return t.find(r=>Xo(r)&&vy(r.targetSelector,e,n)&&("width"in r.properties||"height"in r.properties))??null}const Ynt={"no-selector":"This layer needs a stable selector before Studio can save the edit.","unroll-required":"This motion comes from a helper or loop. Choose Unroll to edit it explicitly.","source-uneditable":"This animation is computed at runtime. Edit the animation in the Code tab."};class Vl extends Error{constructor(e){super(Ynt[e]),this.reason=e,this.name="GsapEditBlockedError"}}function Ip(t){if(t.status==="blocked")throw new Vl(t.reason)}function Knt(t){const e=Noe(t.provenance);if(e==="unroll")throw new Vl("unroll-required");if(e==="source"||t.hasUnresolvedKeyframes||t.hasUnresolvedSelector)throw new Vl("source-uneditable")}function FR(t){return t instanceof Vl}function BC(t,e){var n;return Object.keys(t.properties??{}).some(r=>e.has(r))||Object.keys(t.fromProperties??{}).some(r=>e.has(r))||!!((n=t.keyframes)!=null&&n.keyframes.some(r=>Object.keys(r.properties).some(i=>e.has(i))))}function N3(t,e){try{for(const n of t)BC(n,e)&&Knt(n);return{status:"persisted"}}catch(n){if(FR(n))return{status:"blocked",reason:n.reason};throw n}}function YS(t){return Ec(t)}function D0(t,e){return bS(ue.getState().currentTime,t,e)}function wA(t,e){const n=ai(t),r=Yi(t);n==null||!r||r<=0||ue.getState().requestSeek(Xt(n+e/100*r))}async function Jnt(t,e,n,r){const i=YS(t);if(!i)throw new Vl("no-selector");const s=async a=>{await a(t,{type:"add",targetSelector:i,method:"set",position:0,properties:n,global:!0},{label:"Move layer",skipReload:!0}),await a(t,{type:"delete",animationId:e.id},{label:"Move layer",softReload:!0})};if(Hnt(r)){await s(r);return}await V1e({element:t.element,label:"Move layer",settle:()=>{},persist:async a=>s(a(r)),restore:()=>{}})}async function KS(t,e,n,r){if(!(!t.hasUnresolvedKeyframes&&!t.hasUnresolvedSelector))throw new Vl("source-uneditable")}async function Q1e(t,e,n,r,i,s){const{newX:a,newY:o}=Fy(t.element,e,n);if(i){if(i.keyframes){await Jnt(t,i,{x:a,y:o},s.commitMutation);return}const c={type:"update-properties",animationId:i.id,properties:{x:a,y:o}},u=!!i.global;await s.commitMutation(t,c,{label:"Move layer",softReload:!0,instantPatch:{selector:r,change:{kind:u?"global-set":"set",props:c.properties}}});return}const l=YS(t);if(!l)throw new Vl("no-selector");await s.commitMutation(t,{type:"add",targetSelector:l,method:"set",position:0,properties:{x:a,y:o},global:!0},{label:"Move layer",softReload:!0,instantPatch:{selector:l,change:{kind:"global-set",props:{x:a,y:o}}}})}async function ert(t,e,n,r,i){if(r){const a={type:"update-property",animationId:r.id,property:"rotation",value:e};await i.commitMutation(t,a,{label:"Rotate layer",softReload:!0,instantPatch:Xnt(n,a,!!r.global)});return}const s=YS(t);if(!s)throw new Vl("no-selector");await i.commitMutation(t,{type:"add",targetSelector:s,method:"set",position:0,properties:{rotation:e},global:!0},{label:"Rotate layer",softReload:!0,instantPatch:{selector:s,change:{kind:"global-set",props:{rotation:e}}}})}async function trt(t,e,n,r,i){const s=Math.round(e.width),a=Math.round(e.height);if(r){await i.commitMutation(t,{type:"update-properties",animationId:r.id,properties:{width:s,height:a}},{label:"Resize layer",softReload:!0});return}const o=YS(t);if(!o)throw new Vl("no-selector");await i.commitMutation(t,{type:"add",targetSelector:o,method:"set",position:0,properties:{width:s,height:a}},{label:"Resize layer",softReload:!0})}function A8(t,e){return Number.isFinite(t)&&t>0?Math.round(t):e}function nrt(t,e,n,r){if(t)return{width:A8(Number(t.properties.width),n),height:A8(Number(t.properties.height),r)};const i=Number.parseFloat((e==null?void 0:e.getAttribute(Cy))??""),s=Number.parseFloat((e==null?void 0:e.getAttribute(ky))??"");return{width:A8(i,n),height:A8(s,r)}}async function rrt(t,e,n,r,i,s){var b;const a=ai(i)??0,o=Yi(i);if(!(o>0))return!1;const l=Math.round(e.width),c=Math.round(e.height),u=nrt(r,t.element,l,c),f=ue.getState().currentTime,h=Math.max(0,Math.min(100,Math.round((f-a)/o*1e3)/10)),p=new Set(((b=i.keyframes)==null?void 0:b.keyframes.map(w=>w.percentage))??[0,100]);p.add(0),p.add(100),p.add(h);const y=Array.from(p).sort((w,O)=>w-O).map(w=>({percentage:w,properties:Math.abs(w-h)<.05?{width:l,height:c}:{...u}})),m=`Resize (size keyframe ${h.toFixed(0)}%)`,v=YS(t);return v?(await s.commitMutation(t,{type:"add-with-keyframes",targetSelector:v,position:Xt(a),duration:Xt(o),keyframes:y},r?{label:m,skipReload:!0}:{label:m,softReload:!0}),r&&await s.commitMutation(t,{type:"delete",animationId:r.id},{label:"Resize layer",softReload:!0}),!0):!1}async function irt(t,e,n,r,i,s,a){var N,_;const o=t.element,{newX:l,newY:c,baseGsapX:u,baseGsapY:f}=Fy(o,n,r),h=l-u,p=c-f,y=Number.parseFloat(o.getAttribute("data-hf-drag-initial-offset-x")??"")||0,m=Number.parseFloat(o.getAttribute("data-hf-drag-initial-offset-y")??"")||0,v=()=>{o.style.setProperty("--hf-studio-offset-x",`${y}px`),o.style.setProperty("--hf-studio-offset-y",`${m}px`),o.removeAttribute("data-hf-drag-initial-offset-x"),o.removeAttribute("data-hf-drag-initial-offset-y")};let b=e;if(e.keyframes){const I=await KS(e,i,a.commitMutation);I&&(b={...e,id:I})}const w=ai(b),O=Yi(b),k=((N=b.keyframes)==null?void 0:N.easeEach)??b.ease;let E=((_=b.keyframes)==null?void 0:_.keyframes)??[];if(E.length===0){const I=b.fromProperties??{},j=b.properties??{},L=typeof I.x=="number"?I.x:(typeof j.x=="number",0),B=typeof I.y=="number"?I.y:(typeof j.y=="number",0),$=typeof j.x=="number"?j.x:L,z=typeof j.y=="number"?j.y:B;E=[{percentage:0,properties:{x:L,y:B}},{percentage:100,properties:{x:$,y:z}}]}const T=E.map(I=>({percentage:I.percentage,properties:{...I.properties,x:Xt((typeof I.properties.x=="number"?I.properties.x:0)+h),y:Xt((typeof I.properties.y=="number"?I.properties.y:0)+p)},...I.ease?{ease:I.ease}:{}}));await a.commitMutation(t,{type:"replace-with-keyframes",animationId:b.id,targetSelector:b.targetSelector,position:Xt(w??0),duration:Xt(O||1),keyframes:T,ease:k},{label:"Move animation path",softReload:!0,beforeReload:v})}function z1e(t,e,n){var r;return[...(((r=t.keyframes)==null?void 0:r.keyframes)??[]).filter(i=>Math.abs(i.percentage-e)>S0).map(i=>({percentage:i.percentage,properties:{...i.properties},...i.ease?{ease:i.ease}:{}})),{percentage:e,properties:n}].sort((i,s)=>i.percentage-s.percentage)}async function $R(t,e,n,r,i,s,a,o,l){var v;const c=i+s,u=Math.min(r,i),f=Math.max(r,c),h=Math.max(.01,f-u),p=((v=e.keyframes)==null?void 0:v.keyframes)??[],y=[];for(const b of p){const w=i+b.percentage/100*s,O=Math.round((w-u)/h*1e3)/10,k={...b.properties};for(const E of Object.keys(n))!(E in k)&&(l==null?void 0:l[E])!=null&&(k[E]=l[E]);y.push({percentage:O,properties:k})}const m=Math.round((r-u)/h*1e3)/10;y.push({percentage:m,properties:n}),y.sort((b,w)=>b.percentage-w.percentage),await a.commitMutation(t,{type:"replace-with-keyframes",animationId:e.id,targetSelector:e.targetSelector,position:Xt(u),duration:Xt(h),keyframes:y},{label:"Move layer (extended keyframe)",softReload:!0,beforeReload:o})}async function srt(t,e,n,r,i,s){const{activeKeyframePct:a,setActiveKeyframePct:o}=ue.getState(),l=D0(t,e),c=a??l;await r.commitMutation(t,{type:"add-keyframe",animationId:e.id,percentage:c,properties:n,...s?{backfillDefaults:s}:{}},{label:`Move layer (keyframe ${c}%)`,softReload:!0,beforeReload:i}),a!=null&&(o(null),wA(e,c))}function art(t,e){var o;if(!t||!e)return null;const n=t.contentWindow,r=n==null?void 0:n.gsap;if(typeof(r==null?void 0:r.getProperty)!="function"||typeof r.set!="function")return null;let i=null;try{i=((o=t.contentDocument)==null?void 0:o.querySelector(e))??null}catch{return null}if(!i)return null;const s=n==null?void 0:n.__timelines,a=s?Object.values(s)[0]:void 0;return typeof(a==null?void 0:a.seek)!="function"?null:{gsapLib:r,el:i,mainTl:a}}async function ort(t,e,n,r,i,s,a,o){const l=ue.getState().currentTime,c=ai(e),u=bf(e,t),{activeKeyframePct:f,setActiveKeyframePct:h}=ue.getState(),p=f==null&&c!==null&&u>0&&(lc+u+.01),y={},m=art(s,a);if(m&&c!==null){const{gsapLib:O,el:k,mainTl:E}=m,T={};for(const N of Object.keys(n)){const _=Number(O.getProperty(k,N));Number.isFinite(_)&&(T[N]=_)}try{O.set(k,{clearProps:Object.keys(n).join(",")}),E.seek(c);for(const N of Object.keys(n)){const _=Number(O.getProperty(k,N));Number.isFinite(_)&&(y[N]=Xt(_))}E.seek(l)}catch{for(const N of Object.keys(y))delete y[N]}finally{Object.keys(T).length>0&&O.set(k,T)}}if(p&&c!==null){const O=`gsap:convert-drag:${e.id}`;await r.commitMutation(t,{type:"convert-to-keyframes",animationId:e.id,...Object.keys(y).length>0?{resolvedFromValues:y}:{}},{label:"Convert to keyframes for drag",skipReload:!0,coalesceKey:O});const k=r.fetchAnimations?await r.fetchAnimations():[],E=k.find(_=>_.id===e.id&&_.keyframes)??k.find(_=>_.targetSelector===e.targetSelector&&_.keyframes)??e,T=ai(E)??c,N=Yi(E)||u;await $R(t,E,n,l,T,N,r,i);return}const v=`gsap:convert-drag:${e.id}`;await r.commitMutation(t,{type:"convert-to-keyframes",animationId:e.id,...Object.keys(y).length>0?{resolvedFromValues:y}:{}},{label:"Convert to keyframes for drag",skipReload:!0,coalesceKey:v});const b=f??D0(t,e),w=f!=null;w&&h(null),await r.commitMutation(t,{type:"add-keyframe",animationId:e.id,percentage:b,properties:n,...o?{backfillDefaults:o}:{}},{label:`Move layer (keyframe ${b}%)`,softReload:!0,beforeReload:i,coalesceKey:v}),w&&wA(e,b)}async function Z1e(t,e,n,r,i,s,a){var b,w;const o=t.element,{newX:l,newY:c,baseGsapX:u,baseGsapY:f}=Fy(o,n,r),h=Number.parseFloat(o.getAttribute("data-hf-drag-initial-offset-x")??"")||0,p=Number.parseFloat(o.getAttribute("data-hf-drag-initial-offset-y")??"")||0,y=()=>{o.style.setProperty("--hf-studio-offset-x",`${h}px`),o.style.setProperty("--hf-studio-offset-y",`${p}px`),o.removeAttribute("data-hf-drag-initial-offset-x"),o.removeAttribute("data-hf-drag-initial-offset-y")},m={x:u,y:f},v=ue.getState().currentTime;if((b=e.arcPath)!=null&&b.enabled){const{activeKeyframePct:O,setActiveKeyframePct:k}=ue.getState(),E=O??D0(t,e),T=((w=e.keyframes)==null?void 0:w.keyframes)??[],N=T.findIndex(L=>Math.abs(L.percentage-E)<=S0);if(N>=0){await a.commitMutation(t,{type:"update-motion-path-point",animationId:e.id,pointIndex:N,x:l,y:c},{label:"Move layer (waypoint)",softReload:!0,beforeReload:y}),k(null),wA(e,E);return}const _=ai(e),I=bf(e,t);if(_===null||I<=0||T.length<2)return;const j=z1e(e,E,{x:l,y:c});await a.commitMutation(t,{type:"replace-with-keyframes",animationId:e.id,targetSelector:e.targetSelector,position:Xt(_),duration:Xt(I),keyframes:j,ease:"none"},{label:"Move layer (new keyframe)",softReload:!0,beforeReload:y});return}if(e.keyframes){const O=await KS(e,i,a.commitMutation),k=O?{...e,id:O}:e,E={x:l,y:c},T=ai(k),N=bf(k,t),_=T!==null&&N>0&&(vT+N+.01),I=ue.getState().activeKeyframePct!=null;_&&!I?await $R(t,k,E,v,T,N,a,y,m):await srt(t,k,E,a,y,m)}else if(e.method==="from"||e.method==="fromTo"){const O=ue.getState().currentTime,k=ai(e),E=bf(e,t),N=!(ue.getState().activeKeyframePct!=null)&&k!==null&&E>0&&(Ok+E+.01),_={x:l,y:c};if(N&&k!==null){await a.commitMutation(t,{type:"split-into-property-groups",animationId:e.id},{label:"Split from() for drag",skipReload:!0});const j=(a.fetchAnimations?await a.fetchAnimations():[]).find(le=>le.propertyGroup==="position"&&le.targetSelector===e.targetSelector);if(j!=null&&j.keyframes){const le=ai(j),ie=bf(j,t);if(le!==null){await $R(t,j,{x:l,y:c},O,le,ie,a,y,m);return}}const L=Math.min(O,k),B=Math.max(O,k+E),$=Math.max(.01,B-L),z=O.5&&Y<99.5&&J.push({percentage:Y,properties:{x:0,y:0}}),J.push({percentage:100,properties:{x:0,y:0}})):(J.push({percentage:0,properties:{x:0,y:0}}),W>.5&&W<99.5&&J.push({percentage:W,properties:{x:0,y:0}}),J.push({percentage:100,properties:{x:l,y:c}})),J.sort((le,ie)=>le.percentage-ie.percentage);const ne={targetSelector:e.targetSelector,position:Xt(L),duration:Xt($),keyframes:J};await a.commitMutation(t,j?{type:"replace-with-keyframes",animationId:j.id,...ne}:{type:"add-with-keyframes",...ne},{label:"Move layer (from extended)",softReload:!0,beforeReload:y})}else{const I=`gsap:convert-drag:${e.id}`;await a.commitMutation(t,{type:"convert-to-keyframes",animationId:e.id},{label:"Convert from() for drag",skipReload:!0,coalesceKey:I});const{activeKeyframePct:j,setActiveKeyframePct:L}=ue.getState(),B=j??D0(t,e);j!=null&&L(null),await a.commitMutation(t,{type:"add-keyframe",animationId:e.id,percentage:B,properties:_,...m?{backfillDefaults:m}:{}},{label:`Move layer (keyframe ${B}%)`,softReload:!0,beforeReload:y,coalesceKey:I})}}else await ort(t,e,{x:l,y:c},a,y,i,s,m)}async function D3(t,e,n,r,i,s,a){var v,b,w;let o=e;if(e.keyframes){const O=await KS(e,i,s.commitMutation);O&&(o={...e,id:O})}const l=ai(o),c=Yi(o),u=((v=o.keyframes)==null?void 0:v.easeEach)??o.ease,f=Object.keys(n),h=(O,k)=>typeof O[k]=="number"?O[k]:Pg[k]??0,p=((b=o.keyframes)==null?void 0:b.keyframes)??((w=Ng(o))==null?void 0:w.keyframes);if(!p||p.length===0){await s.commitMutation(t,{type:"update-properties",animationId:o.id,properties:n},{label:a,softReload:!0});return}const y=p.reduce((O,k)=>Math.abs(k.percentage-r){const k={...O.properties};for(const E of f)k[E]=Xt(h(k,E)+(n[E]-h(y.properties,E)));return{percentage:O.percentage,properties:k,...O.ease?{ease:O.ease}:{}}});await s.commitMutation(t,{type:"replace-with-keyframes",animationId:o.id,targetSelector:o.targetSelector,position:Xt(l??0),duration:Xt(c||1),keyframes:m,ease:u},{label:a,softReload:!0})}function aB(t,e){const n=IL(t);if(!n)return null;const r=_L(t,e);if(!r)return null;const i=Number(n.getProperty(r,"x"))||0,s=Number(n.getProperty(r,"y"))||0;return{x:i,y:s}}function fK(t){var e;if((e=t.keyframes)!=null&&e.keyframes.some(n=>"x"in n.properties||"y"in n.properties))return!0;if(t.method==="fromTo"){const n=t.fromProperties;return"x"in t.properties||"y"in t.properties||!!(n&&("x"in n||"y"in n))}return"x"in t.properties||"y"in t.properties}function BR(t,e){var i;if(t.length===0)return null;const n=ue.getState().currentTime,r=t.filter(s=>fK(s)||s.keyframes||t.length===1).map(s=>{let a=0;fK(s)&&(a+=10),s.keyframes&&(a+=5),e&&s.targetSelector===e?a+=8:s.targetSelector.includes(",")&&(a-=5);const o=s.resolvedStart??(typeof s.position=="number"?s.position:0),l=s.duration??0;return n>=o-.05&&n<=o+l+.05?a+=50:a-=Math.round(Math.min(Math.abs(n-o),Math.abs(n-o-l))*5),{anim:s,score:a}});return r.sort((s,a)=>a.score-s.score),((i=r[0])==null?void 0:i.anim)??t[0]}function VR(t){if(t.length<=1)return t[0]??null;const e=ue.getState().currentTime;return t.reduce((n,r)=>{var u,f;const i=ai(r)??0,s=i+Yi(r),a=e>=i&&e<=s?0:Math.min(Math.abs(e-i),Math.abs(e-s)),o=ai(n)??0,l=o+Yi(n),c=e>=o&&e<=l?0:Math.min(Math.abs(e-o),Math.abs(e-l));return a(((f=n.keyframes)==null?void 0:f.keyframes.length)??0)?r:n})}const I3=["x","y","xPercent","yPercent","left","top","translateX","translateY"],lrt=new Set(I3),G1e=["rotation","rotationX","rotationY","rotationZ"],PN=new Set(G1e);async function oB(t,e,n,r,i){const s=e.filter(l=>l.propertyGroup===t),a=VR(s);if(a)return{anim:a,animations:e};const o=e.find(l=>!l.propertyGroup);if(o&&(await r(n,{type:"split-into-property-groups",animationId:o.id},{label:"Split mixed tween into property groups",skipReload:!0}),i)){const l=await i(),c=l.find(u=>u.propertyGroup===t);if(c)return{anim:c,animations:l}}if(!o&&i){const l=await i(),c=l.find(f=>f.propertyGroup===t);if(c)return{anim:c,animations:l};const u=l.find(f=>!f.propertyGroup);if(u){await r(n,{type:"split-into-property-groups",animationId:u.id},{label:"Split mixed tween into property groups",skipReload:!0});const f=await i(),h=f.find(p=>p.propertyGroup===t);if(h)return{anim:h,animations:f}}}return null}async function crt(t,e,n,r){const i=vc(t);if(!i)return{status:"blocked",reason:"no-selector"};const s=r?await r():[],a=[...e,...s],o=N3(a,lrt);if(o.status==="blocked")return o;const l=s.length>0?s:e,c=BR(l,i);return qS(n,i,void 0,I3)&&!c?{status:"blocked",reason:"source-uneditable"}:!c&&!Ec(t)?{status:"blocked",reason:"no-selector"}:{status:"persisted"}}async function S8(t,e,n,r,i,s,a){if(!(a!=null&&a.preflightPassed)){const w=await crt(t,n,r,s);if(w.status==="blocked"||a!=null&&a.preflightOnly)return w}const o=vc(t);if(!o)return{status:"blocked",reason:"no-selector"};let l=n;const c=w=>w.targetSelector===o&&w.propertyGroup==="position";if(n.filter(c).length>1&&s){const w=await s(),O=w.filter(c);if(O.length>1){const k=O.find(E=>E.keyframes)??O.find(E=>(E.duration??0)>0)??O[0];await i(t,{type:"consolidate-position-writes",targetSelector:o,keepAnimationId:k.id},{label:"Consolidate position writes",skipReload:!0}),l=await s()}else l=w}const u=await oB("position",l,t,i,s);let f=(u==null?void 0:u.anim)??null,h=(u==null?void 0:u.animations)??l;if(!f&&(f=BR(l,o),!f&&s)){const w=await s();h=w,f=BR(w,o)}const p=aB(r,o)??{x:0,y:0},y=qS(r,o,void 0,I3),m=!!(f!=null&&f.keyframes)&&Yi(f)>0;if(!y&&!m){const w=f&&Xo(f)&&f.targetSelector===o?f:H1e(h,o,t.element);return await Q1e(t,e,p,o,w,{commitMutation:i,fetchAnimations:s}),{status:"persisted"}}if(!f)return{status:"blocked",reason:"source-uneditable"};if(s){const O=(await s()).find(k=>k.targetSelector===f.targetSelector&&k.propertyGroup===f.propertyGroup);O&&O.id!==f.id&&(f=O)}const v={commitMutation:i,fetchAnimations:s},b=ue.getState().autoKeyframeEnabled;return a!=null&&a.altKey||!b?await irt(t,f,e,p,r,o,v):await Z1e(t,f,e,p,r,o,v),{status:"persisted"}}async function urt(t,e,n,r,i,s){const a=vc(t)??Ec(t);if(!a)return{status:"blocked",reason:"no-selector"};const o=s?await s():[],l=n.length>0?n:o,c=N3([...n,...o],PN);if(c.status==="blocked")return c;const u=l.some(E=>!E.propertyGroup)?s:void 0,f=await oB("rotation",l,t,i,u),h=(f==null?void 0:f.animations)??l;let p=f!=null&&f.anim&&BC(f.anim,PN)?f.anim:null;p||(p=l.find(E=>BC(E,PN))??null);const y=vc(t),m=y?qS(r,y,void 0,G1e):!1;if(!p&&m)return{status:"blocked",reason:"source-uneditable"};const v=Math.round(e);if(!p||Xo(p)){const E=p??qnt(h,a,t.element);return await ert(t,v,a,E,{commitMutation:i,fetchAnimations:s}),{status:"persisted"}}const b=D0(t,p);if(!ue.getState().autoKeyframeEnabled)return await D3(t,p,{rotation:v},b,r,{commitMutation:i,fetchAnimations:s},"Rotate animation"),{status:"persisted"};if(p.hasUnresolvedKeyframes||p.hasUnresolvedSelector){const E=await KS(p);E&&(p={...p,id:E})}else if(!p.keyframes){const E=a?SA(r,a,p,"rotation"):void 0;await i(t,{type:"convert-to-keyframes",animationId:p.id,resolvedFromValues:E},{label:"Convert to keyframes for rotation",skipReload:!0})}const w=SA(r,a,p,"rotation"),O={...w};"rotation"in w||(O.rotation=$C(r,a,"rotation")??0);const k={...w,rotation:v};return await i(t,{type:"add-keyframe",animationId:p.id,percentage:b,properties:k,backfillDefaults:O},{label:`Rotate (keyframe ${b}%)`,softReload:!0}),{status:"persisted"}}function frt(t){return typeof t=="object"&&t!==null&&"animations"in t&&Array.isArray(t.animations)}const fb=new Map;function OA(t,e,n={}){const r=`${t}|${e}`;n.fresh&&fb.delete(r);const i=fb.get(r);if(i)return i;const s=hrt(t,e).finally(()=>{fb.get(r)===s&&fb.delete(r)});return fb.set(r,s),s}async function hrt(t,e){try{const n=await fetch(`/api/projects/${encodeURIComponent(t)}/gsap-animations/${encodeURIComponent(e)}`,{cache:"no-store"});if(!n.ok)return null;const r=await n.json();return frt(r)?{...r,animations:r.animations.filter(i=>!fMe(i))}:null}catch{return null}}async function drt(t,e,n){const r=await OA(t,e);if(!r)return;const{elements:i,domClipChildren:s}=ue.getState(),a=new Map,o=new Map;for(const l of r.animations){if(l.hasUnresolvedKeyframes||S_(l))continue;const c=l.keyframes??Ng(l);if(c)for(const u of A_(l.targetSelector,n)){o.set(u,[...o.get(u)??[],l]);const{elStart:f,elDuration:h}=QE(u,e,i,s),p=jL(c.keyframes,l,f,h),y=a.get(u);y?y.keyframes=LL([...y.keyframes,...p]):a.set(u,{...c,keyframes:p})}}Wtt(e,a,o)}function lB(t,e,n){const r=new Set;return e.id&&r.add(`#${e.id}`),e.selector&&r.add(e.selector),r.size===0&&!n?[]:t.filter(i=>i.targetSelector.split(",").some(s=>{const a=s.trim();if(!a)return!1;if(r.has(a))return!0;const o=a.split(/\s+/).pop();if(o&&r.has(o))return!0;if(n)try{if(n.matches(a))return!0}catch{}return!1}))}function prt(t,e,n,r,i){const[s,a]=x.useState([]),[o,l]=x.useState(!1),[c,u]=x.useState(!1),f=x.useRef(""),h=x.useRef(null),p=ue(O=>O.domClipChildren.map(k=>`${k.id}<${k.hostId}`).join("|"));x.useEffect(()=>{const O=(n==null?void 0:n.id)??(n==null?void 0:n.selector)??"",k=`${t}:${e}:${r}:${O}`;if(k===f.current)return;if(f.current=k,h.current&&(clearTimeout(h.current),h.current=null),!t){a([]),l(!1),u(!1);return}let E=!1;return OA(t,e).then(T=>{if(!E){if(!T){a([]),l(!1),u(!1);return}a(T.animations),l(T.multipleTimelines===!0),u(T.unsupportedTimelinePattern===!0),T.animations.length===0&&O&&(h.current=setTimeout(()=>{E||OA(t,e).then(N=>{E||N&&N.animations.length>0&&a(N.animations)})},800))}}),()=>{E=!0,h.current&&(clearTimeout(h.current),h.current=null)}},[t,e,r,n==null?void 0:n.id,n==null?void 0:n.selector]);const y=(n==null?void 0:n.id)??null,m=(n==null?void 0:n.selector)??null,v=x.useMemo(()=>{var E;if(!y&&!m)return[];let O=null;const k=(E=i==null?void 0:i.current)==null?void 0:E.contentDocument;if(k)try{O=(y?k.getElementById(y):null)??(m?k.querySelector(m):null)}catch{O=null}return lB(s,{id:y,selector:m},O)},[s,y,m,r,i]),b=x.useMemo(()=>{const O=i==null?void 0:i.current;let k=v;if(O&&(k=k.map(E=>{if(!E.hasUnresolvedKeyframes||E.keyframes)return E;const T=jR(O,E.targetSelector);return T?{...E,keyframes:{format:"percentage",keyframes:T.keyframes,...T.easeEach?{easeEach:T.easeEach}:{}},...T.arcPath?{arcPath:T.arcPath}:{}}:E})),O&&y&&k.length===0){const E=s.filter(T=>T.hasUnresolvedSelector);if(E.length>0&&jR(O,`#${y}`)){const N=_1e(O),_=N.get(y);if(_){const j=Array.from(N.keys()).indexOf(y),L=j>=0&&j{if(!w)return;const O=b.filter(z=>!S_(z)&&(z.keyframes||Ng(z)));O.length>0&&qtt(e,w,O);const{elements:k,domClipChildren:E}=ue.getState(),{elStart:T,elDuration:N}=QE(w,e,k,E),_=[];let I="percentage",j,L;for(const z of b){if(S_(z))continue;const Y=z.keyframes??Ng(z);if(!Y)continue;const W=z.resolvedStart??(typeof z.position=="number"?z.position:0),J=z.duration??N;for(const ne of Y.keyframes){const le=RL(W,J,ne.percentage),ie=Rce(le,T,N,ne.percentage);_.push({...ne,percentage:ie,tweenPercentage:ne.percentage,propertyGroup:z.propertyGroup,animationId:z.id})}I=Y.format,Y.ease&&(j=Y.ease),Y.easeEach&&(L=Y.easeEach)}if(_.length===0){const{keyframeCache:z}=ue.getState();N0(e,w).some(W=>z.has(W))||RR(e,w);return}const B=LL(_),$={format:I,keyframes:B,...j?{ease:j}:{},...L?{easeEach:L}:{}};nm(z=>{for(const Y of N0(e,w))z.keyframeCache.set(Y,$)})},[w,e,b,p]),{animations:b,multipleTimelines:o,unsupportedTimelinePattern:c}}function mrt(){const[t,e]=x.useState(0),n=x.useCallback(()=>e(r=>r+1),[]);return{version:t,bump:n}}function grt(t,e,n,r){const i=ue(u=>u.elements.length),s=ue(u=>Array.from(new Set(u.elements.map(f=>f.compositionSrc).filter(f=>!!f))).sort().join("|")),a=ue(u=>u.domClipChildren.map(f=>`${f.id}<${f.hostId}`).join("|")),o=x.useRef(""),l=x.useRef(""),c=x.useRef("");x.useEffect(()=>{var p;const u=`kf-cache:${t}:${e}:${n}:${i}:${a}:${s}`;if(u===o.current||(o.current=u,l.current="",c.current="",!t))return;const f=Array.from(new Set([e,...s?s.split("|"):[]])),h=(p=r==null?void 0:r.current)==null?void 0:p.contentDocument;Utt(f),Promise.all(f.map(y=>drt(t,y,h))).then(()=>{c.current=u})},[t,e,n,i,a,s]),x.useEffect(()=>{if(!t)return;const u=e;let f=0;const h=10,p=()=>{if(l.current===`kf-cache:${t}:${u}:${n}`)return!0;const m=(r==null?void 0:r.current)??document.querySelector("iframe[src*='/preview/']");if(!m)return!1;const v=new Map;for(const w of ue.getState().elements)w.domId&&v.set(w.domId,{start:w.start,duration:w.duration});const b=_1e(m,v);return b.size===0?!1:(nm(w=>{for(const[O,k]of b){const E=N0(u,O);if(E.some(_=>w.keyframeCache.has(_))||k.keyframes.length===1&&Object.keys(k.keyframes[0].properties).every(_=>_==="x"||_==="y"))continue;const N={format:"percentage",keyframes:k.keyframes,...k.easeEach?{easeEach:k.easeEach}:{}};for(const _ of E)w.keyframeCache.set(_,N)}}),l.current=`kf-cache:${t}:${u}:${n}`,!0)};if(p())return;const y=setInterval(()=>{f++,(p()||f>=h)&&clearInterval(y)},500);return()=>clearInterval(y)},[t,e,n,r])}function yrt({previewIframe:t,activeCompPath:e,captionEditMode:n,domEditSelectionRef:r,domEditGroupSelectionsRef:i,domEditSelection:s,applyDomSelection:a,refreshDomEditGroupSelectionsFromPreview:o,buildDomSelectionFromTarget:l,refreshPreviewDocumentVersion:c,syncPreviewHotkeys:u,applyStudioManualEditsToPreviewRef:f,openSourceForSelection:h,getSidebarTab:p,gsapCacheVersion:y}){x.useEffect(()=>{if(!t)return;const v=async()=>{if(n)return;const w=r.current;if(!w)return;let O=null;try{O=t.contentDocument}catch{return}if(!O)return;ov(O);const k=Is(O,w,e);if(!k){const T=i.current;if(yc("preview-sync-lost",{target:w.selector??w.id??null,group:T.length}),T.length>1){await o(T);return}a(null,{revealPanel:!1});return}const E=await l(k);E&&a(E,{revealPanel:!1,preserveGroup:!0})};u(t),f.current(t),v(),c();const b=()=>{u(t),f.current(t),v(),c()};return t.addEventListener("load",b),()=>{t.removeEventListener("load",b)}},[e,a,l,n,i,r,t,o,c,u,f,y]);const m=x.useRef(h);m.current=h,x.useEffect(()=>{!s||!m.current||!p||s.sourceFile&&p()==="code"&&m.current(s.sourceFile,{id:s.id,selector:s.selector,selectorIndex:s.selectorIndex})},[s,p])}const xrt=5,brt=120,vrt=1,Art=120,hK=t=>new Promise(e=>setTimeout(e,t));function Srt(t,e){return t?t.animations.length===0?{kind:"cold"}:{kind:"resolved",animations:lB(t.animations,e)}:{kind:"fetch-error"}}async function wrt(t,e,n,r,i){let s=0,a=0;for(;;){const o=await OA(t,e,{fresh:i});i=!1;const l=Srt(o,n);if(l.kind==="resolved")return l.animations;if(l.kind==="fetch-error"){if(a>=vrt){if(r)throw new Error("GSAP animation ownership could not be verified");return[]}a++,await hK(Art);continue}if(s>=xrt)return[];s++,await hK(brt)}}function Ort(t,e){return x.useCallback((n,r)=>async()=>{if(!t)return[];const i={id:n.id??null,selector:n.selector??null};return wrt(t,e,i,(r==null?void 0:r.failOnFetchError)===!0,(r==null?void 0:r.fresh)===!0)},[t,e])}function Crt(t,e){return x.useCallback((n,r,i,s)=>{(FR(n)?bje:X0)({source:"gsap_commit",error:n,filePath:(r==null?void 0:r.sourceFile)??t??"index.html",mutationType:i,label:s,targetId:r==null?void 0:r.id,targetSelector:r==null?void 0:r.selector,targetSourceFile:r==null?void 0:r.sourceFile}),e(FR(n)?n.message:"Failed to save animated edit.","error")},[t,e])}function krt({domEditSelection:t,updateGsapProperty:e,updateGsapMeta:n,deleteGsapAnimation:r,deleteAllForSelector:i,addGsapAnimation:s,addGsapProperty:a,removeGsapProperty:o,updateGsapFromProperty:l,addGsapFromProperty:c,removeGsapFromProperty:u,addKeyframe:f,addKeyframeBatch:h,removeKeyframe:p,moveKeyframe:y,resizeKeyframedTween:m,convertToKeyframes:v,removeAllKeyframes:b,handleDomManualEditsReset:w,selectedGsapAnimations:O,showToast:k}){const E=x.useRef(null);t&&(E.current=t);const T=x.useCallback(Q=>Q===void 0?t??E.current:Q,[t]),N=x.useCallback((Q,H,se,fe)=>{X0({source:"gsap_commit",error:Q,filePath:H.sourceFile??void 0,mutationType:se,label:fe,targetId:H.id,targetSelector:H.selector,targetSourceFile:H.sourceFile}),cF(Q)||k(`Couldn't save animation: ${Nu(Q)}`,"error")},[k]),_=x.useCallback((Q,H,se,fe)=>Q.then(()=>!0,be=>(N(be,H,se,fe),!1)),[N]),I=x.useCallback((Q,H,se)=>{t&&e(t,Q,H,se)},[t,e]),j=x.useCallback((Q,H,se)=>{const fe=T(se);return fe?_(n(fe,Q,H),fe,"update-meta","Edit GSAP animation"):Promise.resolve(!1)},[T,_,n]),L=x.useCallback((Q,H)=>{const se=T(H);se&&_(r(se,Q),se,"delete","Delete GSAP animation")},[T,r,_]),B=x.useCallback(Q=>{const H=t??E.current;H&&(Pt("keyframe",{action:"delete_all"}),_(i(H,Q),H,"delete-all-for-selector","Delete all animations for element"))},[t,i,_]),$=x.useCallback(Q=>{t&&(s(t,Q,ue.getState().currentTime).catch(H=>{N(H,t,"add",`Add GSAP ${Q} animation`)}),t.element.hasAttribute("data-hf-studio-path-offset")&&w(t).catch(()=>{}))},[t,s,w,N]),z=x.useCallback((Q,H)=>{t&&_(a(t,Q,H),t,"add-property",`Add GSAP ${H}`)},[t,a,_]),Y=x.useCallback((Q,H)=>{t&&_(o(t,Q,H),t,"remove-property",`Remove GSAP ${H}`)},[t,_,o]),W=x.useCallback((Q,H,se)=>{t&&_(l(t,Q,H,se),t,"update-from-property",`Edit GSAP from-${H}`)},[t,_,l]),J=x.useCallback((Q,H)=>{t&&_(c(t,Q,H),t,"add-from-property",`Add GSAP from-${H}`)},[t,c,_]),ne=x.useCallback((Q,H)=>{t&&_(u(t,Q,H),t,"remove-from-property",`Remove GSAP from-${H}`)},[t,_,u]),le=x.useCallback((Q,H,se,fe,be)=>{const me=T(be);me&&(Pt("keyframe",{action:"add",property:se}),f(me,Q,H,se,fe))},[T,f]),ie=x.useCallback((Q,H,se,fe,be)=>{const me=T(be);return me?h(me,Q,H,se,fe).catch(pe=>{N(pe,me,"add-keyframe","Add keyframe")}):Promise.resolve()},[T,h,N]),q=x.useCallback((Q,H,se,fe)=>{const be=T(fe);be&&(Pt("keyframe",{action:"remove"}),p(be,Q,H,se))},[T,p]),F=x.useCallback((Q,H,se,fe)=>{const be=T(se);if(!be)return;const me=fe??O.find(ge=>ge.id===Q),pe=D0(be,me);Pt("keyframe",{action:"move_to_playhead"}),y(be,Q,H,pe)},[T,O,y]),U=x.useCallback((Q,H,se,fe)=>{const be=T(fe);return be?(Pt("keyframe",{action:"retime"}),y(be,Q,H,se)):Promise.resolve(!1)},[T,y]),Z=x.useCallback((Q,H,se,fe,be)=>{const me=T(be);return me?(Pt("keyframe",{action:"retime_resize"}),m(me,Q,H,se,fe)):Promise.resolve(!1)},[T,m]),K=x.useCallback((Q,H,se,fe,be)=>{const me=T(be);return me?v(me,Q,H,se,fe).catch(pe=>{N(pe,me,"convert-to-keyframes","Convert to keyframes")}):Promise.resolve()},[T,v,N]),ee=x.useCallback((Q,H)=>{const se=T(H);return se?_(b(se,Q),se,"remove-all-keyframes","Remove all keyframes"):Promise.resolve(!1)},[T,_,b]),re=x.useCallback(()=>{if(!t)return!1;const Q=O.find(H=>H.keyframes);return Q?(_(b(t,Q.id),t,"remove-all-keyframes","Remove all keyframes"),!0):!1},[t,_,b,O]);return{handleGsapUpdateProperty:I,handleGsapUpdateMeta:j,handleGsapDeleteAnimation:L,handleGsapDeleteAllForElement:B,handleGsapAddAnimation:$,handleGsapAddProperty:z,handleGsapRemoveProperty:Y,handleGsapUpdateFromProperty:W,handleGsapAddFromProperty:J,handleGsapRemoveFromProperty:ne,handleGsapAddKeyframe:le,handleGsapAddKeyframeBatch:ie,handleGsapRemoveKeyframe:q,handleGsapMoveKeyframeToPlayhead:F,handleGsapMoveKeyframe:U,handleGsapResizeKeyframedTween:Z,handleGsapConvertToKeyframes:K,handleGsapRemoveAllKeyframes:ee,handleResetSelectedElementKeyframes:re}}function Ert({projectId:t,activeCompPath:e,domEditSelection:n,domEditSelectionRef:r,domEditGroupSelectionsRef:i,refreshDomEditGroupSelectionsFromPreview:s,previewIframeRef:a,previewIframe:o,captionEditMode:l,refreshKey:c,gsapCacheVersion:u,bumpGsapCache:f,showToast:h,refreshPreviewDocumentVersion:p,syncPreviewHotkeys:y,applyStudioManualEditsToPreviewRef:m,applyDomSelection:v,buildDomSelectionFromTarget:b,openSourceForSelection:w,selectSidebarTab:O,getSidebarTab:k,updateGsapProperty:E,updateGsapMeta:T,deleteGsapAnimation:N,deleteAllForSelector:_,addGsapAnimation:I,addGsapProperty:j,removeGsapProperty:L,updateGsapFromProperty:B,addGsapFromProperty:$,removeGsapFromProperty:z,addKeyframe:Y,addKeyframeBatch:W,removeKeyframe:J,moveKeyframe:ne,resizeKeyframedTween:le,convertToKeyframes:ie,removeAllKeyframes:q,handleDomManualEditsReset:F}){const U=x.useCallback(be=>{!w||!O||be.sourceFile&&(O("code"),w(be.sourceFile,{id:be.id,selector:be.selector,selectorIndex:be.selectorIndex}))},[w,O]);x.useEffect(()=>{if(!(n!=null&&n.id))return;const{selectedElementId:be,elements:me,setSelectedElementId:pe}=ue.getState(),ge=me.find(ve=>ve.domId===n.id||ve.id===n.id),Pe=ge?ge.key??ge.id:null;Pe&&Pe!==be&&pe(Pe)},[n==null?void 0:n.id]);const Z=x.useRef(c);x.useEffect(()=>{c!==Z.current&&(Z.current=c,f())},[c,f]);const K=(n==null?void 0:n.sourceFile)||e||"index.html";grt(t??null,K,u,a);const{animations:ee,multipleTimelines:re,unsupportedTimelinePattern:Q}=prt(t??null,K,n?{id:n.id??null,selector:n.selector??null}:null,u,a),H=Crt(e,h),se=Ort(t,K),fe=krt({domEditSelection:n,updateGsapProperty:E,updateGsapMeta:T,deleteGsapAnimation:N,deleteAllForSelector:_,addGsapAnimation:I,addGsapProperty:j,removeGsapProperty:L,updateGsapFromProperty:B,addGsapFromProperty:$,removeGsapFromProperty:z,addKeyframe:Y,addKeyframeBatch:W,removeKeyframe:J,moveKeyframe:ne,resizeKeyframedTween:le,convertToKeyframes:ie,removeAllKeyframes:q,handleDomManualEditsReset:F,selectedGsapAnimations:ee,showToast:h});return yrt({previewIframe:o,activeCompPath:e,captionEditMode:l,domEditSelectionRef:r,domEditGroupSelectionsRef:i,domEditSelection:n,applyDomSelection:v,refreshDomEditGroupSelectionsFromPreview:s,buildDomSelectionFromTarget:b,refreshPreviewDocumentVersion:p,syncPreviewHotkeys:y,applyStudioManualEditsToPreviewRef:m,openSourceForSelection:w,getSidebarTab:k,gsapCacheVersion:u}),{onClickToSource:U,selectedGsapAnimations:ee,gsapMultipleTimelines:re,gsapUnsupportedTimelinePattern:Q,trackGsapInteractionFailure:H,makeFetchFallback:se,...fe}}function cB(t){var e;return(e=t.ownerDocument.defaultView)==null?void 0:e.gsap}function HR(t,e,n){const r=cB(t);return r!=null&&r.set?(r.set(t,{x:e,y:n}),!0):!1}function Trt(t,e,n){const r=cB(t);return r!=null&&r.set?(r.set(t,{scaleX:e,scaleY:n}),!0):!1}function dK(t,e){var r,i;const n=Number((i=(r=cB(t))==null?void 0:r.getProperty)==null?void 0:i.call(r,t,e));return Number.isFinite(n)?n:null}const oa=W0("resize");let U4=0;function Prt(t){oa("move",()=>(U4+=1,U4%8===1?{n:U4,...t}:null))}function Mrt(){U4=0}function QR(t,e){const n=r=>{var a;const i=t.getBoundingClientRect(),s=(a=t.ownerDocument.defaultView)==null?void 0:a.getComputedStyle(t);return{tag:e,phase:r,rect:{x:i.x,y:i.y,w:i.width,h:i.height},cssW:s==null?void 0:s.width,cssH:s==null?void 0:s.height,transform:s==null?void 0:s.transform,inlineStyle:t.getAttribute("style")}};oa("settle",()=>{var i;const r=n("t0");return(i=t.ownerDocument.defaultView)==null||i.setTimeout(()=>oa("settle",()=>n("t200")),200),r})}const zR=new Set(["opacity","autoAlpha","scale","scaleX","scaleY"]);function pK(t){const e={};for(const[n,r]of Object.entries(t))typeof r=="number"?e[n]=zR.has(n)?1:0:e[n]=r;return e}function mK(t,e,n){const r=Number.parseFloat((t==null?void 0:t.getAttribute(e))??"");if(Number.isFinite(r)&&r>0)return r;const i=Number.parseFloat((t==null?void 0:t.getAttribute(`data-hf-studio-original-${n}`))??"");return Number.isFinite(i)&&i>0?i:null}function Nrt(t){var r;const e=i=>i==="scaleX"||i==="scaleY";return(((r=t==null?void 0:t.keyframes)==null?void 0:r.keyframes)??[]).some(i=>Object.keys(i.properties??{}).some(e))||Object.keys((t==null?void 0:t.properties)??{}).some(e)}async function Drt(t,e,n,r,i,s){var q,F;const a=s?await s():[],o=[...n,...a],l=o.some(U=>U.propertyGroup==="scale"),c=l?"scale":"size",u=c==="scale"?new Set(["scale","scaleX","scaleY"]):new Set(["width","height"]),f=N3(o,u);if(f.status==="blocked")return f;const h=n.length>0?n:a,p=h.some(U=>!U.propertyGroup)?s:void 0,y=await oB(c,h,t,i,p);let m=y!=null&&y.anim&&BC(y.anim,u)?y.anim:null;const v=vc(t),b=v?qS(r,v,void 0,[...u]):!1;if(!m&&b)return{status:"blocked",reason:"source-uneditable"};if(oa("intercept-enter",{hasScaleGroup:l,resizeGroup:c,animMethod:(m==null?void 0:m.method)??null,animId:(m==null?void 0:m.id)??null,size:e}),!m||Xo(m)){const U=vc(t)??Ec(t);if(!U)return{status:"blocked",reason:"no-selector"};const Z=c==="size"?m??uK(h,U,t.element):uK(h,U,t.element);if(c==="size"){const K=VR(h.filter(ee=>!Xo(ee)&&Yi(ee)>0));if(K&&(oa("intercept-route",{route:"keyframed-size",tweenId:K.id}),await rrt(t,e,U,Z,K,{commitMutation:i,fetchAnimations:s})))return{status:"persisted"}}return oa("intercept-route",{route:"static-size-set",hadSizeSet:!!Z,resizeGroup:c}),await trt(t,e,U,Z,{commitMutation:i,fetchAnimations:s}),{status:"persisted"}}const w=Yi(m);if(w<=0)return{status:"blocked",reason:"source-uneditable"};const{activeKeyframePct:O,setActiveKeyframePct:k}=ue.getState(),E=O??D0(t,m);O!=null&&k(null);const T=vc(t),N=T?SA(r,T,m,c):{};let _,I=null,j=null,L=null,B=!1,$=!1;if(c==="scale"){const U=(q=r==null?void 0:r.contentDocument)==null?void 0:q.querySelector(T??""),Z=mK(U,Vg,"width")??200,K=mK(U,Hg,"height")??Z,ee=$C(r,T??null,"scaleX")??1,re=$C(r,T??null,"scaleY")??1,Q=ee>0?ee:1,H=re>0?re:1,se=Xt(e.width*Q/Z),fe=Xt(e.height*H/K);if(B=Math.abs(se-fe)*K>.5,$=B||Nrt(m),_=$?{scaleX:se,scaleY:fe}:{scale:se},oa("intercept-route",{route:"scale-tween",cssW:Z,cssH:K,liveScaleX:Q,liveScaleY:H,newScaleX:se,newScaleY:fe,nonUniformScale:B}),I=U,L=$?{x:se,y:fe}:{x:se,y:se},U){const me=U.getBoundingClientRect();j={x:me.x,y:me.y}}}else _={width:Math.round(e.width),height:Math.round(e.height)};const z=async()=>{if(!I||(zde(I),!j||!T))return!1;L&&Trt(I,L.x,L.y);const U=aB(r,T)??{x:0,y:0},{baseGsapX:Z,baseGsapY:K}=Fy(t.element,{x:0,y:0},U),ee={x:Z,y:K};HR(I,ee.x,ee.y);const re=I.getBoundingClientRect(),Q={x:j.x-re.x,y:j.y-re.y};if(!Number.isFinite(Q.x)||!Number.isFinite(Q.y))return!1;if(Math.abs(Q.x)<.5&&Math.abs(Q.y)<.5)return oa("scale-finalize",{skipped:"already-on-drop-point",residual:Q,base:ee}),!0;const H={x:Math.round(ee.x+Q.x),y:Math.round(ee.y+Q.y)};oa("scale-finalize",{dropPoint:j,post:{x:re.x,y:re.y},residual:Q,gsapPos:U,base:ee,corrected:H}),HR(I,H.x,H.y);const se=s?await s():(y==null?void 0:y.animations)??n,fe={x:H.x-ee.x,y:H.y-ee.y},be=VR(se.filter(pe=>pe.propertyGroup==="position"&&!Xo(pe)&&Yi(pe)>0));if(be)return oa("scale-finalize",{route:"position-keyframe",tweenId:be.id}),await Z1e(t,be,fe,ee,r,T,{commitMutation:i,fetchAnimations:s}),!0;const me=H1e(se,T,t.element);return await Q1e(t,fe,ee,T,me,{commitMutation:i,fetchAnimations:s}),!0};if(!ue.getState().autoKeyframeEnabled)return O!=null&&k(null),await D3(t,m,_,E,r,{commitMutation:i,fetchAnimations:s},"Resize animation"),{status:"persisted",ownsDragOffset:await z()};const Y=ue.getState().currentTime,W=ai(m),J=w,ne=W!==null&&J>0&&(YW+J+.01);if(!ne){if(m.hasUnresolvedKeyframes||m.hasUnresolvedSelector){const U=await KS(m);U&&(m={...m,id:U})}else if(!m.keyframes){const U=T?SA(r,T,m,c):void 0;if(await i(t,{type:"convert-to-keyframes",animationId:m.id,resolvedFromValues:U},{label:"Convert to keyframes for resize"}),s){const K=(await s()).find(ee=>ee.targetSelector===m.targetSelector&&ee.keyframes);K&&(m=K)}}}if((ne||$)&&W!==null){const U=((F=m.keyframes)==null?void 0:F.keyframes)??(()=>{const fe=m.method==="from"||m.method==="fromTo"?{...m.properties}:pK(m.properties),be=m.method==="from"?pK(m.properties):{...m.properties};return[{percentage:0,properties:fe},{percentage:100,properties:be}]})(),Z=Math.min(Y,W),K=Math.max(Y,W+J),ee=Math.max(.01,K-Z),re=U,Q=[];for(const fe of re){const be=W+fe.percentage/100*J,me=Math.round((be-Z)/ee*1e3)/10,pe={...fe.properties};if(B&&"scale"in pe){const ge=pe.scale;typeof ge=="number"&&(pe.scaleX=ge,pe.scaleY=ge),delete pe.scale}for(const ge of Object.keys(_))ge in pe||ge==="width"||ge==="height"||(pe[ge]=zR.has(ge)?1:0);Q.push({percentage:me,properties:pe})}const H=Math.round((Y-Z)/ee*1e3)/10,se=Q.find(fe=>Math.abs(fe.percentage-H)<.05);return se?Object.assign(se.properties,_):Q.push({percentage:H,properties:_}),Q.sort((fe,be)=>fe.percentage-be.percentage),await i(t,{type:"replace-with-keyframes",animationId:m.id,targetSelector:m.targetSelector,position:Xt(Z),duration:Xt(ee),keyframes:Q},{label:ne?`Resize (extended to ${Y.toFixed(2)}s)`:`Resize (keyframe ${Math.round((Y-Z)/ee*1e3)/10}%)`,softReload:!0}),{status:"persisted",ownsDragOffset:await z()}}const le=new Set(["width","height"]),ie={};for(const U of Object.keys(N))le.has(U)||(ie[U]=zR.has(U)?1:0);return await i(t,{type:"add-keyframe",animationId:m.id,percentage:E,properties:_,backfillDefaults:ie},{label:`Resize (keyframe ${E}%)`,softReload:!0}),{status:"persisted",ownsDragOffset:await z()}}function Irt(t,e,n){var o;const r=n?rl(n):void 0,i=r!==void 0?t.filter(l=>l.propertyGroup===r):t;if(i.length===0)return;if(i.length===1)return i[0];const s=ue.getState().currentTime,a=i.map(l=>{let c=0;l.keyframes&&(c+=10),e&&l.targetSelector===e?c+=5:l.targetSelector.includes(",")&&(c-=3);const u=l.resolvedStart??(typeof l.position=="number"?l.position:0),f=l.duration??0;return s>=u-.05&&s<=u+f+.05&&(c+=8),{anim:l,score:c}});return a.sort((l,c)=>c.score-l.score),(o=a[0])==null?void 0:o.anim}async function _rt(t,e,n,r){const i=n.find(s=>s.keyframes&&s.id!==e.id);i&&await r(t,{type:"convert-to-keyframes",animationId:e.id,duration:i.duration??1},{label:"Keyframe 3D transform",softReload:!0})}const Rrt={position:"Move layer",scale:"Resize layer",size:"Resize layer",rotation:"Rotate layer",visual:"Set opacity",other:"Set 3D transform"};function uB(t){const e=new Set(t.map(([r])=>rl(r))),n=e.size===1?[...e][0]:void 0;return n&&Rrt[n]||"Set properties"}async function jrt(t,e,n,r,i,s){const a=U1e(t,e,n,r);await s(a.selection,a.mutation,a.options),await _rt(t,e,i,s)}function U1e(t,e,n,r){const i=Object.fromEntries(n),s={};for(const[o,l]of n)typeof l=="number"&&(s[o]=l);const a=r&&Object.keys(s).length>0?{selector:r,change:{kind:e.global?"global-set":"set",props:s}}:void 0;return{selection:t,mutation:{type:"update-properties",animationId:e.id,properties:i},options:{label:uB(n),softReload:!0,...a?{instantPatch:a}:{}}}}async function Lrt(t,e,n,r,i){const s=$rt(t,e,n,r),a=s[0];if(a){if(s.length===1){await i(a.selection,a.mutation,a.options);return}if(!i.batch)throw new Error("Atomic GSAP property batch is unavailable");await i.batch(s,{label:uB(e),softReload:!0})}}function Frt(t){const e=new Map;for(const n of t){const r=rl(n[0]),i=e.get(r)??[];i.push(n),e.set(r,i)}return e}function $rt(t,e,n,r){const i=Frt(e),s=n?r.filter(l=>Xo(l)&&vy(l.targetSelector,n,t.element)):[],a=new Map,o=[];for(const[l,c]of i){const u=Brt(s,l);u?a.set(u,[...a.get(u)??[],...c]):o.push(c)}return[...[...a].map(([l,c])=>U1e(t,l,c,n)),...o.map(l=>Vrt(t,l))]}function Brt(t,e){return t.find(n=>n.propertyGroup===e)??t.find(n=>Object.keys(n.properties).some(r=>rl(r)===e))}function Vrt(t,e){const n={};for(const[i,s]of e)typeof s=="number"&&(n[i]=s);const r=Ec(t);if(!r)throw new Vl("no-selector");return{selection:t,mutation:{type:"add",targetSelector:r,method:"set",position:0,properties:Object.fromEntries(e),global:!0},options:{label:uB(e),softReload:!0,...Object.keys(n).length>0?{instantPatch:{selector:r,change:{kind:"global-set",props:n}}}:{}}}}async function Hrt(t,e,n,r,i,s,a,o){var N,_;const l=!!e.keyframes;l||await o(t,{type:"convert-to-keyframes",animationId:e.id},{label:"Convert to keyframes",skipReload:!0});const c=ue.getState().currentTime,u=s?SA(a,s,e):{},f={...u,...n},h={...u};for(const[I,j]of r){if(!(I in u)&&s){const L=$C(a,s,I);L!=null&&(h[I]=L)}h[I]=j}const p=(N=e.keyframes)==null?void 0:N.keyframes,y=ai(e),m=Yi(e),v=ue.getState().activeKeyframePct!=null,b=y!==null&&m>0&&(cy+m+.01);if(l&&!!p&&b&&!v&&p&&y!==null){const I=Math.min(c,y),j=Math.max(c,y+m),L=Math.max(.01,j-I),B=p.map($=>{const z=y+$.percentage/100*m,Y=Math.round((z-I)/L*1e3)/10,W={...$.properties};for(const J of Object.keys(f))!(J in W)&&h[J]!=null&&(W[J]=h[J]);return{percentage:Y,properties:W}});B.push({percentage:Math.round((c-I)/L*1e3)/10,properties:f}),B.sort(($,z)=>$.percentage-z.percentage),await o(t,{type:"replace-with-keyframes",animationId:e.id,targetSelector:e.targetSelector,position:Xt(I),duration:Xt(L),keyframes:B},{label:`Edit ${i} (extended keyframe)`,softReload:!0});return}const O=bS(c,t,e),k=(_=e.keyframes)==null?void 0:_.keyframes.some(I=>Math.abs(I.percentage-O)<.05),E={};for(const[I,j]of Object.entries(f))typeof j=="number"&&(E[I]=j);const T=s&&Object.keys(E).length>0?{selector:s,change:{kind:"keyframe-rebuild",pct:O,props:E}}:void 0;await o(t,k?{type:"update-keyframe",animationId:e.id,percentage:O,properties:f}:{type:"add-keyframe",animationId:e.id,percentage:O,properties:f,backfillDefaults:h},{label:`Edit ${i} (keyframe ${O}%)`,softReload:!0,...T?{instantPatch:T}:{}})}function Qrt(t){const{selectedGsapAnimations:e,gsapCommitMutation:n,previewIframeRef:r,bumpGsapCache:i}=t,s=x.useCallback(async(o,l)=>{if(!n)return;const c=Object.entries(l);if(c.length===0)return;const u=c[0][0];Ip(N3(e,new Set(c.map(([m])=>m))));const f=r.current,h=vc(o),p=Irt(e,h,u);if(!p&&!Ec(o))throw new Vl("no-selector");const y=e.some(m=>!!m.keyframes);try{if(y&&p){if(!ue.getState().autoKeyframeEnabled){const v=bS(ue.getState().currentTime,o,p);await D3(o,p,Object.fromEntries(c.filter(b=>typeof b[1]=="number")),v,f,{commitMutation:n},`Edit ${u} (whole animation)`);return}await Hrt(o,p,l,c,u,h,f,n);return}if(!y){await Lrt(o,c,h,e,n);return}if(p&&Xo(p)){await jrt(o,p,c,h,e,n);return}const m=Ec(o);if(m){const v=e.find(N=>!!N.keyframes),b=v?ai(v)??0:0,w=v&&Yi(v)||1,O=ue.getState().currentTime,k=w>0?Math.max(0,Math.min(100,Math.round((O-b)/w*1e3)/10)):0,E=Object.fromEntries(c),T=k<=.05?[{percentage:0,properties:E}]:[{percentage:0,properties:{...E,_auto:1}},{percentage:k,properties:E}];await n(o,{type:"add-with-keyframes",targetSelector:m,position:Xt(b),duration:Xt(w),keyframes:T},{label:`Add ${u} keyframe`,softReload:!0});return}throw new Vl("no-selector")}catch(m){throw i(),m}},[e,n,r,i]);return{commitAnimatedProperty:x.useCallback((o,l,c)=>s(o,{[l]:c}),[s]),commitAnimatedProperties:s}}let zrt=0;function Zrt(t,e){var n;for(const[r,i]of t.entries()){if(i.status!=="rejected")continue;const s=(n=e[r])==null?void 0:n.selection;if(s)return{error:i.reason,selection:s}}return null}function Grt({domEditSelection:t,selectedGsapAnimations:e,gsapCommitMutation:n,previewIframeRef:r,showToast:i,bumpGsapCache:s,makeFetchFallback:a,trackGsapInteractionFailure:o,handleDomBoxSizeCommit:l,addGsapAnimation:c,convertToKeyframes:u,setArcPath:f,updateArcSegment:h}){const p=x.useCallback(async(B,$,z)=>{if(n)try{const Y=await S8(B,$,e,r.current,n,a(B),z);Ip(Y)}catch(Y){throw o(Y,B,"drag","Move animated layer"),Y}},[e,n,r,a,o]),y=x.useCallback(async B=>{if(!n||B.length===0)return;const $=`group-drag:${++zrt}`;let z=!1;const Y={pending:!1},W=U=>({...U,coalesceKey:$,coalesceMs:Number.POSITIVE_INFINITY,deferPreviewSync:!z,previewFallbackLatch:Y}),J=[],ne=async()=>{var Z;if(J.length===0)return;const U=J.splice(0,J.length);if(!n.batch){for(const K of U)await n(K.selection,K.mutation,K.options);return}await n.batch(U,{...((Z=U.at(-1))==null?void 0:Z.options)??{label:"Move animated layer (group)"},label:"Move animated layer (group)"})},le=(U,Z,K)=>(J.push({selection:U,mutation:Z,options:W(K)}),Promise.resolve()),ie=new Map,q=await Promise.allSettled(B.map(async({selection:U})=>{const Z=await a(U,{failOnFetchError:!0})();ie.set(U,Z);const K=await S8(U,{x:0,y:0},Z,r.current,le,void 0,{preflightOnly:!0});Ip(K)})),F=Zrt(q,B);if(F)throw o(F.error,F.selection,"drag","Move animated layer (group)"),F.error;for(const[U,{selection:Z,next:K}]of B.entries()){z=U===B.length-1;try{const ee=await S8(Z,K,ie.get(Z)??[],r.current,le,async()=>(await ne(),a(Z,{fresh:!0})()),{preflightPassed:!0});Ip(ee)}catch(ee){throw o(ee,Z,"drag","Move animated layer (group)"),ee}}try{await ne()}catch(U){throw o(U,null,"drag","Move animated layer (group)"),U}},[n,r,a,o]),m=x.useCallback(async(B,$,z,Y=()=>{})=>{const W=e.some(le=>le.propertyGroup==="scale"),J=vc(B),ne=J?qS(r.current,J,void 0,I3):!1;return oa("commit-route",{next:$,offset:z??null,scaleRoute:W,animCount:e.length,animGroups:e.map(le=>`${le.propertyGroup}:${le.method}`)}),V1e({element:B.element,label:"Resize layer",settle:()=>{if(!z||W||!J)return;const le=aB(r.current,J)??{x:0,y:0},{newX:ie,newY:q}=Fy(B.element,z,le);oa("sync-settle",{gsapPos:le,offset:z,newX:ie,newY:q}),HR(B.element,ie,q)},persist:async le=>{if(n){const ie=le(n);try{const q=await Drt(B,$,e,r.current,ie,a(B));Ip(q);const F=q.status==="persisted"&&q.ownsDragOffset===!0;if(oa("intercept-handled",{scaleRoute:W,ownsDragOffset:F,willForwardOffset:!!(z&&!F)}),z&&!F){const U=await S8(B,z,e,r.current,ie,a(B));Ip(U)}QR(B.element,F?"gsap-scale":"gsap-size");return}catch(q){throw o(q,B,"resize","Resize animated layer"),q}}oa("dom-route",{next:$,offset:z??null,hadGsapMutation:!!n}),QR(B.element,"dom-route"),await l(B,$,z)},restore:Y,skipPixelAssert:ne})},[l,e,n,r,a,o]),v=x.useCallback(async(B,$)=>{if(n)try{const z=await urt(B,$.angle,e,r.current,n,a(B));Ip(z)}catch(z){throw o(z,B,"rotation","Rotate animated layer"),z}},[e,n,r,a,o]),{commitAnimatedProperty:b,commitAnimatedProperties:w}=Qrt({selectedGsapAnimations:e,gsapCommitMutation:n,previewIframeRef:r,bumpGsapCache:s}),O=x.useCallback(async(B,$)=>{try{await w(B,$)}catch(z){throw o(z,B,"property","Edit animated property"),z}},[w,o]),k=x.useCallback(async(B,$,z)=>{try{await b(B,$,z)}catch(Y){throw o(Y,B,"property","Edit animated property"),Y}},[b,o]),E=x.useCallback((B,$)=>{t&&f(t,B,$)},[t,f]),T=x.useCallback((B,$,z)=>{t&&h(t,B,$,z)},[t,h]),N=x.useCallback(async()=>{},[]),_=R1e(null),I=j1e(n??N,_,i),j=x.useCallback(async(B,$)=>{t&&await I(t,B,$)},[t,I]),L=x.useCallback(()=>{j({type:"unroll-timeline"},{label:"Unroll to literal tweens",softReload:!0})},[j]);return{handleGsapAwarePathOffsetCommit:p,handleGsapAwareGroupPathOffsetCommit:y,handleGsapAwareBoxSizeCommit:m,handleGsapAwareRotationCommit:v,commitAnimatedProperty:k,commitAnimatedProperties:O,handleSetArcPath:E,handleUpdateArcSegment:T,handleUnroll:L,commitMutation:j}}function p1(t){return Math.round(t*1e3)/1e3}function Urt({projectId:t,selection:e,currentTime:n}){const r=encodeURIComponent(e.compositionPath||e.sourceFile||"index.html"),i=new URLSearchParams({t:String(p1(n)),format:"png",output:"source"});return e.selector&&i.set("selector",e.selector),e.selectorIndex!=null&&i.set("selectorIndex",String(e.selectorIndex)),`/api/projects/${encodeURIComponent(t)}/thumbnail/${r}?${i.toString()}`}function Xrt({projectId:t,selection:e,currentTime:n}){return{schemaVersion:1,projectId:t,compositionPath:e.compositionPath,sourceFile:e.sourceFile,currentTime:p1(n),target:{id:e.id,hfId:e.hfId,selector:e.selector,selectorIndex:e.selectorIndex},label:e.label,tagName:e.tagName,boundingBox:{x:p1(e.boundingBox.x),y:p1(e.boundingBox.y),width:p1(e.boundingBox.width),height:p1(e.boundingBox.height)},textContent:e.textContent,dataAttributes:{...e.dataAttributes},inlineStyles:{...e.inlineStyles},computedStyles:{...e.computedStyles},textFields:e.textFields.map(r=>({key:r.key,label:r.label,value:r.value,tagName:r.tagName,source:r.source})),capabilities:{...e.capabilities},thumbnailUrl:Urt({projectId:t,selection:e,currentTime:n})}}function MN(t){if(t instanceof Error&&t.name==="AbortError")return;const e=t instanceof Error?t.name:typeof t,n=t instanceof Error?t.message:String(t);Pt("studio_selection_publish_failed",{error_name:e,error_message:n.slice(0,500)}),console.warn("[Studio] Failed to update agent selection context",t)}function NN(t,e,n){return fetch(`/api/projects/${encodeURIComponent(t)}/selection`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({selection:e}),signal:n}).then(()=>{})}function Wrt({projectId:t,domEditSelection:e,domEditSelectionRef:n,refreshKey:r,previewDocumentVersion:i,refreshDomEditSelectionFromPreview:s}){const a=x.useRef(r),o=x.useRef(null);x.useEffect(()=>{if(!t)return;const l=e!=null&&e.element.isConnected?Xrt({projectId:t,selection:e,currentTime:ue.getState().currentTime}):null,c=new AbortController;return NN(t,l,c.signal).catch(MN),()=>c.abort()},[e,t]),x.useEffect(()=>{if(t)return()=>{NN(t,null).catch(MN)}},[t]),x.useEffect(()=>{if(a.current===r||(a.current=r,o.current=n.current?r:null,!t||!n.current))return;const l=new AbortController;return NN(t,null,l.signal).catch(MN),()=>l.abort()},[n,t,r]),x.useEffect(()=>{if(o.current===null)return;o.current=null;const l=n.current;l&&s(l)},[n,i,s])}function qrt({gsapCommitMutation:t,domEditSelectionRef:e}){const n=x.useCallback((s,a)=>{const o=e.current;if(!o||s.length===0)return;const l={label:s.length===1?"Update keyframe ease":"Update segment ease",softReload:!0},c=s.map(({animationId:f,tweenPercentage:h})=>({selection:o,mutation:{type:"update-keyframe",animationId:f,percentage:h,properties:{},ease:a},options:l}));if(c.length===1){const f=c[0];f&&t(f.selection,f.mutation,f.options);return}const u=t.batch;if(u){u(c,l);return}for(const f of c)t(f.selection,f.mutation,f.options)},[t,e]),r=x.useCallback((s,a,o)=>n([{animationId:s,tweenPercentage:a}],o),[n]),i=x.useCallback((s,a)=>{const o=e.current;o&&t(o,{type:"update-meta",animationId:s,updates:{easeEach:a,resetKeyframeEases:!0}},{label:"Apply ease to all segments",softReload:!0})},[t,e]);return{handleUpdateSegmentEase:n,handleUpdateKeyframeEase:r,handleSetAllKeyframeEases:i}}function Yrt(t,e,n){return n!=null&&n.expandGroup&&e.length>0?e:[t]}function Krt({projectId:t,activeCompPath:e,compIdToSrc:n,captionEditMode:r,compositionLoading:i,previewIframeRef:s,timelineElements:a,getTimelineSelectionSet:o,setSelectedTimelineElementId:l,setTimelineSelectionSet:c,setRightCollapsed:u,setRightPanelTab:f,showToast:h,isRecordingRef:p,refreshPreviewDocumentVersion:y,queueDomEditSave:m,readProjectFile:v,writeProjectFile:b,updateEditingFileContent:w,domEditSaveTimestampRef:O,editHistory:k,fileTree:E,importedFontAssetsRef:T,projectDir:N,projectIdRef:_,previewIframe:I,refreshKey:j,previewDocumentVersion:L,rightPanelTab:B,applyStudioManualEditsToPreviewRef:$,syncPreviewHotkeys:z,reloadPreview:Y,setRefreshKey:W,openSourceForSelection:J,selectSidebarTab:ne,getSidebarTab:le,sdkSession:ie,publishSdkSession:q,forceReloadSdkSession:F}){const U=!e||e==="index.html",{domEditSelection:Z,domEditGroupSelections:K,domEditHoverSelection:ee,activeGroupElement:re,domEditSelectionRef:Q,domEditGroupSelectionsRef:H,setActiveGroupElement:se,applyDomSelection:fe,clearDomSelection:be,buildDomSelectionFromTarget:me,resolveDomSelectionFromPreviewPoint:pe,resolveAllDomSelectionsFromPreviewPoint:ge,updateDomEditHoverSelection:Pe,buildDomSelectionForTimelineElement:ve,handleTimelineElementSelect:xe,refreshDomEditSelectionFromPreview:we,refreshDomEditGroupSelectionsFromPreview:Ce,applyMarqueeSelection:Me}=vet({projectId:t,activeCompPath:e,isMasterView:U,compIdToSrc:n,captionEditMode:r,previewIframeRef:s,timelineElements:a,getTimelineSelectionSet:o,setSelectedTimelineElementId:l,setTimelineSelectionSet:c,setRightCollapsed:u,setRightPanelTab:f,previewIframe:I,refreshKey:j,rightPanelTab:B}),{agentModalOpen:Ve,agentModalAnchorPoint:tt,copiedAgentPrompt:Ze,agentPromptSelectionContext:qe,setAgentModalOpen:pt,setAgentPromptSelectionContext:it,setAgentModalAnchorPoint:vt,handleAskAgent:Ot,handleAgentModalSubmit:Kt}=YJe({activeCompPath:e,projectDir:N,projectIdRef:_,showToast:h,domEditSelectionRef:Q,domEditSelection:Z});Wrt({projectId:t,domEditSelection:Z,domEditSelectionRef:Q,refreshKey:j,previewDocumentVersion:L,refreshDomEditSelectionFromPreview:we});const{version:qt,bump:fn}=mrt(),{commitMutation:Jt,updateGsapProperty:Je,updateGsapMeta:St,deleteGsapAnimation:At,deleteAllForSelector:Ke,addGsapAnimation:Be,addGsapProperty:We,removeGsapProperty:Ye,updateGsapFromProperty:Zt,addGsapFromProperty:Te,removeGsapFromProperty:De,addKeyframe:ze,addKeyframeBatch:st,removeKeyframe:Gt,moveKeyframe:ln,resizeKeyframedTween:Yt,convertToKeyframes:Nn,removeAllKeyframes:Mr,setArcPath:mt,updateArcSegment:vn}=$nt({projectIdRef:_,activeCompPath:e,previewIframeRef:s,editHistory:k,domEditSaveTimestampRef:O,reloadPreview:Y,onCacheInvalidate:fn,onFileContentChanged:w,showToast:h,sdkSession:ie,publishSdkSession:q,writeProjectFile:b,forceReloadSdkSession:F}),{resolveImportedFontAsset:mn,handleDomStyleCommit:Tn,handleDomAttributeCommit:Ln,handleDomAttributeLiveCommit:et,handleDomAttributeQuietCommit:Yn,handleDomHtmlAttributeCommit:Mt,handleDomAttributesCommit:hn,handleDomTextCommit:Ht,handleDomRichTextCommit:dn,handleDomTextFieldStyleCommit:tr,handleDomAddTextField:_n,handleDomRemoveTextField:xr,handleDomBoxSizeCommit:nr,handleDomManualEditsReset:gt,handleDomEditElementsDelete:rr,handleDomZIndexReorderCommit:Cn}=Htt({activeCompPath:e,previewIframeRef:s,showToast:h,queueDomEditSave:m,writeProjectFile:b,domEditSaveTimestampRef:O,editHistory:k,fileTree:E,importedFontAssetsRef:T,projectId:t,projectIdRef:_,reloadPreview:Y,domEditSelection:Z,applyDomSelection:fe,clearDomSelection:be,refreshDomEditSelectionFromPreview:we,buildDomSelectionFromTarget:me,forceReloadSdkSession:F,onTrySdkPersist:ie?(Hr,lt,kt,Ai,ph)=>(QKe(ie,Hr.hfId,lt,kt,{targetPath:Ai,compositionPath:e}),xJe(Hr,lt,kt,Ai,ie,{editHistory:k,writeProjectFile:b,reloadPreview:Y,domEditSaveTimestampRef:O,compositionPath:e,readProjectFile:v,publishSession:q},ph)):void 0,onTrySdkDelete:ie?(Hr,lt,kt)=>PJe(Hr,lt,kt,ie,{editHistory:k,writeProjectFile:b,reloadPreview:Y,domEditSaveTimestampRef:O,compositionPath:e,readProjectFile:v,publishSession:q}):void 0,onReorderShadow:ie?Hr=>{let lt;const kt=e?()=>lt??(lt=v(e)):void 0;for(const Ai of Hr)XS(ie,Ai,"reorderElements",kt)}:void 0}),{groupSelection:Rn,ungroupSelection:xt}=ztt({activeCompPath:e,showToast:h,writeProjectFile:b,domEditSaveTimestampRef:O,editHistory:k,projectIdRef:_,reloadPreview:Y,clearDomSelection:be,forceReloadSdkSession:F}),Ut=x.useCallback(async(Hr,lt)=>{if(p!=null&&p.current){h("Cannot edit timeline while recording","error");return}const kt=Yrt(Hr,H.current,lt);await rr(kt)},[H,rr,p,h]),Ct=x.useCallback(()=>{const Hr=H.current,lt=Q.current,kt=Hr.length>0?Hr:lt?[lt]:[];if(kt.length<2){h("Select at least 2 elements to group","info");return}if(kt.some(Ai=>Yv(Ai.element))){h(kt.every(Ai=>Yv(Ai.element))?"Audio clips group into a bus — use FX on the track header":"Can't group audio clips with layout elements","info");return}Pt("group",{action:"create",count:kt.length}),Rn(kt)},[H,Q,Rn,h]),fr=x.useCallback(()=>{const Hr=Q.current;if(!(Hr!=null&&Hr.element.hasAttribute("data-hf-group"))){h("Select a group to ungroup","info");return}Pt("group",{action:"ungroup"}),se(null),xt(Hr)},[Q,xt,se,h]),{onClickToSource:Dt,selectedGsapAnimations:wt,gsapMultipleTimelines:gn,gsapUnsupportedTimelinePattern:Lt,trackGsapInteractionFailure:rn,makeFetchFallback:hs,handleGsapUpdateProperty:Fn,handleGsapUpdateMeta:ri,handleGsapDeleteAnimation:cn,handleGsapDeleteAllForElement:kn,handleGsapAddAnimation:ir,handleGsapAddProperty:Pi,handleGsapRemoveProperty:Jr,handleGsapUpdateFromProperty:Vi,handleGsapAddFromProperty:ds,handleGsapRemoveFromProperty:Nr,handleGsapAddKeyframe:Qa,handleGsapAddKeyframeBatch:bi,handleGsapRemoveKeyframe:wa,handleGsapMoveKeyframeToPlayhead:ft,handleGsapMoveKeyframe:Ae,handleGsapResizeKeyframedTween:_e,handleGsapConvertToKeyframes:ot,handleGsapRemoveAllKeyframes:bt,handleResetSelectedElementKeyframes:en}=Ert({projectId:t,activeCompPath:e,domEditSelection:Z,domEditSelectionRef:Q,domEditGroupSelectionsRef:H,refreshDomEditGroupSelectionsFromPreview:Ce,previewIframeRef:s,previewIframe:I,captionEditMode:r,refreshKey:j,gsapCacheVersion:qt,bumpGsapCache:fn,showToast:h,refreshPreviewDocumentVersion:y,syncPreviewHotkeys:z,applyStudioManualEditsToPreviewRef:$,applyDomSelection:fe,buildDomSelectionFromTarget:me,openSourceForSelection:J,selectSidebarTab:ne,getSidebarTab:le,updateGsapProperty:Je,updateGsapMeta:St,deleteGsapAnimation:At,deleteAllForSelector:Ke,addGsapAnimation:Be,addGsapProperty:We,removeGsapProperty:Ye,updateGsapFromProperty:Zt,addGsapFromProperty:Te,removeGsapFromProperty:De,addKeyframe:ze,addKeyframeBatch:st,removeKeyframe:Gt,moveKeyframe:ln,resizeKeyframedTween:Yt,convertToKeyframes:Nn,removeAllKeyframes:Mr,handleDomManualEditsReset:gt}),{handlePreviewCanvasMouseDown:Pn,handlePreviewCanvasPointerMove:Br,handlePreviewCanvasPointerLeave:lr,handleBlockedDomMove:vi,handleDomManualDragStart:ps}=Oet({captionEditMode:r,compositionLoading:i,previewIframeRef:s,showToast:h,applyDomSelection:fe,resolveDomSelectionFromPreviewPoint:pe,resolveAllDomSelectionsFromPreviewPoint:ge,updateDomEditHoverSelection:Pe,setActiveGroupElement:se,onClickToSource:Dt}),{handleGsapAwarePathOffsetCommit:ql,handleGsapAwareGroupPathOffsetCommit:Vr,handleGsapAwareBoxSizeCommit:As,handleGsapAwareRotationCommit:Bc,commitAnimatedProperty:ju,commitAnimatedProperties:Oa,handleSetArcPath:Ca,handleUpdateArcSegment:Vc,handleUnroll:Lu,commitMutation:Yl}=Grt({domEditSelection:Z,selectedGsapAnimations:wt,gsapCommitMutation:Jt,previewIframeRef:s,showToast:h,bumpGsapCache:fn,makeFetchFallback:hs,trackGsapInteractionFailure:rn,handleDomBoxSizeCommit:nr,addGsapAnimation:Be,convertToKeyframes:Nn,setArcPath:mt,updateArcSegment:vn}),{handleUpdateSegmentEase:Kl,handleUpdateKeyframeEase:Rs,handleSetAllKeyframeEases:Fu}=qrt({gsapCommitMutation:Jt,domEditSelectionRef:Q});return{domEditSelection:Z,domEditGroupSelections:K,domEditHoverSelection:ee,activeGroupElement:re,agentModalOpen:Ve,agentModalAnchorPoint:tt,copiedAgentPrompt:Ze,agentPromptSelectionContext:qe,domEditSelectionRef:Q,handleTimelineElementSelect:xe,handlePreviewCanvasMouseDown:Pn,handlePreviewCanvasPointerMove:Br,handlePreviewCanvasPointerLeave:lr,applyDomSelection:fe,clearDomSelection:be,handleDomStyleCommit:Tn,handleDomAttributeCommit:Ln,handleDomAttributeLiveCommit:et,handleDomAttributeQuietCommit:Yn,handleDomHtmlAttributeCommit:Mt,handleDomAttributesCommit:hn,handleDomPathOffsetCommit:ql,handleDomGroupPathOffsetCommit:Vr,handleDomZIndexReorderCommit:Cn,handleDomBoxSizeCommit:As,handleDomRotationCommit:Bc,handleDomManualEditsReset:gt,handleDomTextCommit:Ht,handleDomRichTextCommit:dn,handleDomTextFieldStyleCommit:tr,handleDomAddTextField:_n,handleDomRemoveTextField:xr,handleAskAgent:Ot,handleAgentModalSubmit:Kt,handleBlockedDomMove:vi,handleDomManualDragStart:ps,handleDomEditElementDelete:Ut,handleGroupSelection:Ct,handleUngroupSelection:fr,setActiveGroupElement:se,buildDomSelectionFromTarget:me,buildDomSelectionForTimelineElement:ve,updateDomEditHoverSelection:Pe,applyMarqueeSelection:Me,resolveImportedFontAsset:mn,setAgentModalOpen:pt,setAgentPromptSelectionContext:it,setAgentModalAnchorPoint:vt,selectedGsapAnimations:wt,gsapMultipleTimelines:gn,gsapUnsupportedTimelinePattern:Lt,handleGsapUpdateProperty:Fn,handleGsapUpdateMeta:ri,handleGsapDeleteAnimation:cn,handleGsapDeleteAllForElement:kn,handleGsapAddAnimation:ir,handleGsapAddProperty:Pi,handleGsapRemoveProperty:Jr,handleGsapUpdateFromProperty:Vi,handleGsapAddFromProperty:ds,handleGsapRemoveFromProperty:Nr,handleGsapAddKeyframe:Qa,handleGsapAddKeyframeBatch:bi,handleGsapRemoveKeyframe:wa,handleGsapMoveKeyframeToPlayhead:ft,handleGsapMoveKeyframe:Ae,handleGsapResizeKeyframedTween:_e,handleGsapConvertToKeyframes:ot,handleGsapRemoveAllKeyframes:bt,handleResetSelectedElementKeyframes:en,handleUpdateKeyframeEase:Rs,handleUpdateSegmentEase:Kl,handleSetAllKeyframeEases:Fu,commitAnimatedProperty:ju,commitAnimatedProperties:Oa,handleSetArcPath:Ca,handleUpdateArcSegment:Vc,handleUnroll:Lu,invalidateGsapCache:fn,previewIframeRef:s,commitMutation:Yl}}function Jrt(t,e){return(t.length>0?t:e?[e]:[]).flatMap(r=>r.hfId?[r.hfId]:[])}function eit(t,e,n){x.useEffect(()=>{t&&t.setSelection(Jrt(n,e))},[t,e,n])}const ZR=new Set;function tit(t){return ZR.add(t),()=>ZR.delete(t)}function nit(t){for(const e of ZR)try{e(t)}catch{}}async function rit(t,e){if(e.includes("\0")||e.includes(".."))return;const n=await fetch(`/api/projects/${encodeURIComponent(t)}/files/${encodeURIComponent(e)}?optional=1`);if(!n.ok)return;const r=await n.json();return typeof r.content=="string"?r.content:void 0}function iit(t,e,n,r){return t?t.projectId===e&&t.path===n&&t.path===r:!1}function sit(t,e,n,r,i){return t.generation===e&&t.projectId===n&&t.path===r&&t.reloadToken===i}function ait(t,e,n,r){return t?t.session===n&&t.generation===e.generation&&t.reloadToken===r:!1}function r1(t){try{t.dispose()}catch(e){Pt("sdk_session_dispose_failed",{error:e instanceof Error?e.message:String(e)})}}function X1e(t,e){const[n,r]=x.useState(null),i=x.useRef(null),s=x.useRef(new WeakMap),a=x.useRef(0),o=x.useRef(t);o.current=t;const l=x.useRef(e);l.current=e;const[c,u]=x.useState(0),f=x.useRef(c);f.current=c,x.useEffect(()=>tit(m=>{m===l.current&&u(v=>v+1)}),[]),x.useEffect(()=>{const m=++a.current;let v=!1;const b=i.current;if(i.current=null,r(null),b&&r1(b.session),!t||!e)return()=>{v=!0};const w={projectId:t,path:e,reloadToken:c,generation:m};return rit(t,e).then(async O=>{if(v||typeof O!="string")return;const k=await US(O,{history:!1});if(v){r1(k);return}if(!sit(w,a.current,o.current,l.current,f.current)){r1(k);return}const E=i.current,T={...w,session:k};s.current.set(k,w),i.current=T,r(T),E&&E.session!==k&&r1(E.session)}).catch(()=>{!v&&a.current===m&&r(null)}),()=>{v=!0;const O=i.current;(O==null?void 0:O.generation)===m&&(i.current=null,r1(O.session))}},[t,e,c]);const h=x.useCallback(()=>u(m=>m+1),[]),p=x.useCallback(({candidate:m,expectedSession:v,targetPath:b})=>{const w=s.current.get(v),O=i.current;if(!iit(w,o.current,l.current,b))return"rejected-inactive-target";if(!ait(O,w,v,f.current))return u(E=>E+1),"rejected-active-target";const k={...O,session:m};return s.current.set(m,O),i.current=k,r(k),O.session!==m&&r1(O.session),"published"},[]);return{session:(n==null?void 0:n.projectId)===t&&n.path===e&&n.reloadToken===c?n.session:null,publish:p,forceReload:h}}function oit(t,e,n){const r=X1e(t,e??n),i=e?r.session:null;return x.useEffect(()=>{_v.getState().setValues(null)},[t,e]),{sdkHandle:r,editFlowSdkSession:i}}const lit="hyperframes-studio-external-conflicts",cit=1,VC="file-conflicts";function DN(t,e){return`${t}\0${e}`}function uit(){return new Promise((t,e)=>{if(!globalThis.indexedDB){e(new Error("IndexedDB is unavailable; conflict recovery snapshot was not saved"));return}const n=globalThis.indexedDB.open(lit,cit);n.onupgradeneeded=()=>{n.result.objectStoreNames.contains(VC)||n.result.createObjectStore(VC)},n.onerror=()=>e(n.error??new Error("Failed to open conflict storage")),n.onsuccess=()=>t(n.result)})}function IN(t,e){return uit().then(n=>new Promise((r,i)=>{const s=n.transaction(VC,t),a=e(s.objectStore(VC));let o;a.onerror=()=>i(a.error??new Error("Conflict storage failed")),a.onsuccess=()=>{o=a.result},s.oncomplete=()=>{n.close(),r(o)},s.onerror=()=>{n.close(),i(s.error??new Error("Conflict storage transaction failed"))},s.onabort=()=>{n.close(),i(s.error??new Error("Conflict storage transaction was aborted"))}}))}function fit(){return{async get(t,e){return await IN("readonly",n=>n.get(DN(t,e)))??null},async set(t){await IN("readwrite",e=>e.put(t,DN(t.projectId,t.filePath)))},async delete(t,e){await IN("readwrite",n=>n.delete(DN(t,e)))}}}const _3=fit();async function hit(t,e){await _3.set({kind:"conflict",projectId:t,filePath:e.filePath,externalVersion:e.currentVersion,externalContent:e.currentContent,studioContent:e.attemptedContent,createdAt:Date.now()})}async function dit(t,e,n,r,i,s){await _3.set({kind:"failed",projectId:t,filePath:e,externalVersion:r,externalContent:i,studioContent:n,failureMessage:s instanceof Error?s.message:String(s),createdAt:Date.now()})}async function pit(t,e){return _3.get(t,e)}async function mit(t,e){await _3.delete(t,e)}function git(){const t=globalThis.__HF_STUDIO_HOT_TEST_ADAPTER__;if(!t||typeof t!="object")return null;const e=t;return typeof e.on=="function"&&typeof e.off=="function"?e:null}function HC(t){if(!t||typeof t!="object")return null;const e=t;return typeof e.content=="string"?e.content:"data"in e?HC(e.data):null}function QC(t){if(!t||typeof t!="object")return null;const e=t;return typeof e.version=="string"?e.version:"data"in e?QC(e.data):null}function W1e(t){if(!t||typeof t!="object")return null;const e=t;return typeof e.writeToken=="string"?e.writeToken:"data"in e?W1e(e.data):null}function yit(t,e){const n=QC(e);if(n)return`${t}\0${n}`;const r=HC(e);return r==null?null:`${t}\0${r.length}\0${r}`}function xit({projectId:t,activeCompPath:e,recoveryFilePath:n=e,pendingTimelineEditPathRef:r,drainPendingChanges:i,getPendingCandidate:s,discardPendingChanges:a,reloadPreview:o,reloadSdkSession:l,persistConflictSnapshot:c,persistFailureSnapshot:u,loadConflictSnapshot:f,deleteConflictSnapshot:h,overwriteConflict:p,readProjectFile:y,onUseExternalFile:m,resetSaveQueues:v}){const[b,w]=x.useState(null),O=x.useRef(0),k=x.useRef(!0),E=x.useRef(null),T=x.useRef(b),N=x.useRef(Promise.resolve());T.current=b,x.useEffect(()=>(k.current=!0,()=>{k.current=!1,O.current+=1}),[]),x.useEffect(()=>{O.current+=1,w(null),E.current=null},[t,e]),x.useEffect(()=>{if(!t||!n||!f)return;const z=++O.current;let Y=!1;return f(t,n).then(W=>{if(Y||!W||!k.current||z!==O.current)return;const J={path:W.filePath,version:W.externalVersion,content:W.externalContent};if(W.kind==="failed")w({status:"failed",generation:z,path:W.filePath,error:new Error(W.failureMessage),payload:J,studioContent:W.studioContent,recovered:!0});else{const ne=new O0({filePath:W.filePath,currentVersion:W.externalVersion,currentContent:W.externalContent,attemptedContent:W.studioContent});w({status:"conflict",generation:z,error:ne,payload:J})}}).catch(()=>{}),()=>{Y=!0}},[f,t,n]);const _=x.useCallback(z=>{f1("reload",{path:z,by:"external-change coordinator"}),o(),l(z)},[o,l]),I=x.useCallback(async z=>{const Y=N.current.catch(()=>{}).then(z);N.current=Y.then(()=>{},()=>{}),await Y},[]),j=x.useCallback(async(z,Y=!1)=>{const W=hQe(z);if(!W||!t)return;r.current.delete(W);const ne=HC(z),le=W1e(z);if(f1("file-change",{path:W,token:le??null,hasContent:ne!=null}),gLe(le)){f1("suppressed",{path:W,why:"own write token"});return}if(ne!=null&&fJe(W,ne)){f1("suppressed",{path:W,why:"own content echo"});return}const ie=yit(W,z);if(!Y&&ie!=null&&ie===E.current){f1("suppressed",{path:W,why:"duplicate event"});return}E.current=ie;const q=++O.current,F=await i();if(!(!k.current||q!==O.current)){if(F.status==="clean"){const U=T.current;if((U==null?void 0:U.status)==="failed"&&h)try{await h(t,W)}catch(Z){k.current&&q===O.current&&w({...U,generation:q,error:Z});return}if(!k.current||q!==O.current)return;w(null),_(W);return}if(F.status==="failed"){const U=s==null?void 0:s(),Z=(U==null?void 0:U.path)===W?U.content:null;let K=F.error;if(Z!=null&&u)try{await I(()=>u(t,W,Z,QC(z),ne,F.error))}catch(ee){K=new Error(`Studio could not save the edit or its recovery snapshot: ${ee instanceof Error?ee.message:String(ee)}`,{cause:F.error})}if(!k.current||q!==O.current)return;w({status:"failed",generation:q,path:W,error:K,payload:z,studioContent:Z,recovered:!1});return}try{await I(()=>c(t,F.error))}catch(U){if(!k.current||q!==O.current)return;w({status:"failed",generation:q,path:W,error:U,payload:z,studioContent:F.error.attemptedContent,recovered:!1});return}!k.current||q!==O.current||w({status:"conflict",generation:q,error:F.error,payload:z})}},[t,r,i,h,s,c,u,I,_]);x.useEffect(()=>{const z=J=>j(J),Y=git();if(Y)return Y.on("hf:file-change",z),()=>Y.off("hf:file-change",z);const W=new EventSource("/api/events");return W.addEventListener("file-change",z),()=>W.close()},[j]);const L=x.useCallback(async()=>{const z=T.current;!z||z.status==="conflict"||z.recovered||(v==null||v(),E.current=null,await j(z.payload,!0))},[j,v]),B=x.useCallback(async()=>{const z=T.current;if(!z||!t||z.generation!==O.current)return;const Y=z.status==="conflict"?z.error.filePath:z.path,W=z.status==="conflict"&&z.error.currentContent!=null?z.error.currentContent:await y(Y);z.generation===O.current&&(a(),v==null||v(),m==null||m(Y,W),await(h==null?void 0:h(t,Y)),w(null),_(Y))},[h,a,m,t,y,_,v]),$=x.useCallback(async()=>{const z=T.current;if(!z||!t||z.generation!==O.current)return;let Y;if(z.status==="conflict")Y=z.error;else{if(!z.recovered||z.studioContent==null)return;try{const W=HC(z.payload)??await y(z.path);Y=new O0({filePath:z.path,currentVersion:QC(z.payload),currentContent:W,attemptedContent:z.studioContent})}catch(W){z.generation===O.current&&w({...z,error:W});return}}try{await p(Y)}catch(W){z.generation===O.current&&w({status:"failed",generation:z.generation,path:Y.filePath,error:W,payload:z.payload,studioContent:Y.attemptedContent,recovered:z.status==="failed"&&z.recovered});return}z.generation===O.current&&(a(),v==null||v(),await(h==null?void 0:h(t,Y.filePath)),w(null),_(Y.filePath))},[h,a,p,t,y,_,v]);return{blocked:b,retry:L,useExternalFile:B,keepStudioFile:$}}function bit({projectId:t,activeCompPath:e,masterCompPath:n,fileManager:r,previewPersistence:i,pendingTimelineEditPathRef:s,reloadPreview:a}){var p;const{flushPendingSourceSave:o,discardPendingSourceSave:l}=r,{drainPendingDomEditSaves:c,resetDomEditSaveQueueBreaker:u}=i,f=x.useCallback(async()=>{const y=await o();return y.status!=="clean"?y:c()},[c,o]),h=x.useCallback(()=>{l(),u()},[l,u]);return xit({projectId:t,activeCompPath:e,recoveryFilePath:((p=r.editingFile)==null?void 0:p.path)??e??n,pendingTimelineEditPathRef:s,drainPendingChanges:f,getPendingCandidate:r.getPendingSourceCandidate,discardPendingChanges:h,reloadPreview:a,reloadSdkSession:nit,persistConflictSnapshot:hit,persistFailureSnapshot:dit,loadConflictSnapshot:pit,deleteConflictSnapshot:mit,overwriteConflict:r.overwriteExternalConflict,readProjectFile:r.readProjectFile,onUseExternalFile:r.updateEditingFileContent,resetSaveQueues:u})}function vit(t){try{const e=t==null?void 0:t.contentDocument;if(!e)return 0;let n=0;for(const r of e.body.querySelectorAll("*")){const i=parseInt(getComputedStyle(r).zIndex,10);Number.isFinite(i)&&i>n&&(n=i)}return n}catch{return 0}}function Ait(t,e){const n=new Set(e);if(!n.has(t))return t;let r=2;for(;n.has(`${t}_${r}`);)r++;return`${t}_${r}`}async function Sit({projectId:t,blockName:e,showToast:n}){const r=await fetch(`/api/projects/${t}/registry/install`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({blockName:e})});if(!r.ok){const o=await r.json().catch(()=>({error:"Install failed"}));return n(o.error||"Failed to install block"),null}const{written:i,block:s}=await r.json(),a=i.find(o=>o.endsWith(".html"))??i[0];return a?{block:s,compositionFile:a}:(n("Installed but no composition file was written"),null)}async function wit(t,e,n,r){if(t.type!=="hyperframes:component")return;const i=await n(e),s=i.replace(/background:\s*(?:#(?:0a0a0a|000000|000|0a0805)|rgba?\([^)]*\))\s*;/g,"background: transparent;");s!==i&&await r(e,s)}function Oit({block:t,placement:e,timelineElements:n,currentTime:r}){const i=t.type==="hyperframes:block",{start:s=r,duration:a,track:o}=e??{},l=Number(mi(s)),c="duration"in t?t.duration:void 0,u=a??c??n.reduce((p,y)=>Math.max(p,(y.start??0)+(y.duration??0)),10),f=Math.max(0,...n.map(p=>p.track))+1;return{duration:u,isBlock:i,start:l,track:o??(i?0:f)}}function Cit({id:t,compositionFile:e,start:n,duration:r,track:i,width:s,height:a,left:o,top:l,zIndex:c}){return[""].join(` +${t}`}class Pet extends Error{constructor(e){super(`Couldn't find this element in the source file (${e})`),this.name="DomEditPersistUnresolvableError"}}class Z4 extends Error{constructor(n,r={}){super(n);Et(this,"alreadyToasted");this.name="DomEditPersistUnsafeValueError",this.alreadyToasted=r.alreadyToasted??!1}}function h1e(t){return t.map(e=>`${e.type}:${e.property}`).join(", ")}function d1e(t){return{hfId:t.hfId,id:t.id,selector:t.selector,selectorIndex:t.selectorIndex,sourceFile:t.sourceFile}}function Met(t){return t instanceof Error?t.message:String(t)}function Net(t){return t.label||t.selector||t.id||"this element"}function Zp(t,e,n,r){const i=Met(n);console.warn("[Studio] DOM edit persist failed",{target:d1e(t),operations:h1e(e),error:i}),!((n instanceof Z4||n instanceof s0)&&n.alreadyToasted)&&r(`Couldn't save "${Net(t)}": ${i}`,"error")}function Det(t,e){console.warn("[Studio] DOM edit persist no-op",{target:d1e(t),operations:h1e(e),detail:"Server matched the target but reported no change even though the client believed the value changed."})}function Iet({activeCompPath:t,persistDomEditOperations:e,queueDomEditSave:n,showToast:r}){return x.useCallback((i,s,a)=>n(async()=>{await e(i,s,{label:a.label,coalesceKey:a.coalesceKey,coalesceMs:a.coalesceMs,skipRefresh:a.skipRefresh??!0})}).catch(o=>{throw o instanceof GF||(r(o instanceof Error?o.message:"Failed to save position"),X0({source:"dom_edit",error:o,filePath:i.sourceFile??t??"index.html",mutationType:"position",label:a.label,targetId:i.id,targetSelector:i.selector,targetSourceFile:i.sourceFile})),o}),[t,e,n,r])}const p1e=new Set(["SPAN","B","STRONG","I","EM","U","BR"]),_et=new Set(["color","background-color","font-weight","font-style","text-decoration-line","font-family","font-size","letter-spacing","line-height","-webkit-text-fill-color"]),Ret=new Set(["data-hf-text-key","data-hf-id"]),jet=/^[A-Za-z0-9_:-]+$/,Let=new Set(["SCRIPT","STYLE","TEMPLATE","NOSCRIPT","IFRAME","OBJECT","EMBED","SVG","MATH"]),Fet=/url\(|expression\(|javascript:|vbscript:|@import|<\//i,$et=1,Bet=3;function Y$(t){return p1e.has(t.toUpperCase())}function m1e(t,e){return Ret.has(t.toLowerCase())&&jet.test(e)}function g1e(t,e){return _et.has(t.toLowerCase())&&e.length>0&&!Fet.test(e)}function Vet(t){return t.nodeType===$et}function Het(t){var n,r;const e=Array.from(t.childNodes,i=>({phase:"visit",node:i})).reverse();for(let i=e.pop();i;i=e.pop()){if(i.phase==="sanitize"){p1e.has(i.tag)?zet(i.element):Qet(i.element);continue}const s=i.node;if(s.nodeType===Bet)continue;if(!Vet(s)){(n=s.parentNode)==null||n.removeChild(s);continue}const a=s,o=a.tagName.toUpperCase();if(Let.has(o)){(r=a.parentNode)==null||r.removeChild(a);continue}e.push({phase:"sanitize",element:a,tag:o});for(const l of Array.from(a.childNodes).reverse())e.push({phase:"visit",node:l})}}function Qet(t){const e=t.parentNode;if(e){for(;t.firstChild;)e.insertBefore(t.firstChild,t);e.removeChild(t)}}function zet(t){const e=t.getAttribute("style");for(const r of Array.from(t.getAttributeNames())){const i=t.getAttribute(r)??"";m1e(r,i)||t.removeAttribute(r)}if(e===null)return;const n=Zet(e);n?t.setAttribute("style",n):t.removeAttribute("style")}function Zet(t){return Wet(t).map(e=>{const n=e.indexOf(":");if(n===-1)return null;const r=e.slice(0,n).trim().toLowerCase(),i=e.slice(n+1).trim();return g1e(r,i)?`${r}: ${i}`:null}).filter(e=>e!==null).join("; ")}function Get(t){return t==="'"||t==='"'}function Uet(t,e){return e==="("?t+1:e===")"?Math.max(0,t-1):t}function Xet(t,e,n){return t===";"&&e===0&&n===null}function Wet(t){const e=[];let n="",r=0,i=null;for(const s of t){if(s===i)i=null;else if(i===null&&Get(s))i=s;else if(Xet(s,r,i)){e.push(n),n="";continue}else i===null&&(r=Uet(r,s));n+=s}return n.trim()&&e.push(n),e}function qet(t){return!t||!ih(t)||t.isCompositionHost||t.isInsideLockedComposition?!1:t.textFields.length<=1?!0:K$(t.element)}function K$(t){if(!t)return!1;const e=t.tagName;return e==="BODY"||e==="HTML"||!y1e(t)||t.isContentEditable?!1:(t.textContent??"").trim().length>0}function y1e(t){var n;const e=(n=t.ownerDocument.defaultView)==null?void 0:n.HTMLElement;if(!e)return!1;for(const r of Array.from(t.children))if(!Y$(r.tagName)||!(r instanceof e)||!y1e(r))return!1;return!0}const Yet=450,GY=6;function Ket(t,e){return t?e.element!==null&&t.element===e.element&&e.at-t.at<=Yet&&Math.abs(e.x-t.x)<=GY&&Math.abs(e.y-t.y)<=GY:!1}function Jet(t,e){return t.every((n,r)=>{var i;return((i=e[r])==null?void 0:i.key)===n.key})}function UY(t,e){return Object.prototype.hasOwnProperty.call(t,e)?t[e]:null}function ett(t,e){return Array.from(new Set([...Object.keys(t),...Object.keys(e)]))}function ttt(t,e){if(t.length!==e.length||!Jet(t,e)||e.some(i=>i.source==="text-node")||e.some(i=>i.source!=="child")||t.some(i=>i.source!=="child"))return null;const n=new Map(t.map(i=>[i.key,i])),r=[];for(const i of e){const s=n.get(i.key),a=a1e(t,i.key);if(!s||!a)return null;i.value!==s.value&&r.push(W$(i.value,a));for(const o of ett(s.inlineStyles,i.inlineStyles)){const l=UY(s.inlineStyles,o),c=UY(i.inlineStyles,o);c!==l&&r.push(j1(o,c,a))}}return r}function mv(t){const e=t.current+1;return t.current=e,()=>t.current===e}function G4(t,e){const n=(t.get(e)??0)+1;return t.set(e,n),()=>t.get(e)===n}async function ag(t){var e,n;t.capture(),t.apply();try{await t.persist(),(e=t.onSettled)==null||e.call(t,!0)}catch(r){t.shouldRevert(r)&&t.revert(),t.onError(r),(n=t.onSettled)==null||n.call(t,!1)}t.shouldResync()&&await t.resync()}function hu(t){return{ok:!1,reason:t}}async function XY(t){let e=!1;return await ag({...t,onSettled:n=>{var r;e=n,(r=t.onSettled)==null||r.call(t,n)}}),e?{ok:!0}:hu("persist-failed")}function WY(t,e){return t.startsWith("data-")?t:`data-${t}`}function n1(t,e,n){n===null?t.removeAttribute(e):t.setAttribute(e,n),(t.tagName.toLowerCase()===ya||e===Go)&&AE(t.ownerDocument)}function x1e(t,e,n){return t?Is(t,e,n):null}function ntt(t,e,n,r){const i=x1e(t,e,n);if(!i)return null;const s=new Map(r.map(a=>[a,i.getAttribute(a)]));return{element:i,previousValues:s}}function qY(t,e,n,r){const i=x1e(t,e,n);return i?{element:i,previousValue:i.getAttribute(r)}:null}function rtt({activeCompPath:t,previewIframeRef:e,showToast:n,domEditSelection:r,refreshDomEditSelectionFromPreview:i,persistDomEditOperations:s}){const a=x.useRef(new Map),o=x.useCallback(async(y,m,v)=>{var _;if(!r)return;const b=e.current,w=WY(y),O=((_=v.coalesce)==null?void 0:_.key)??`${v.coalescePrefix}:${y}:${gc(r)}`,k=G4(a.current,O),E={type:"attribute",property:y,value:m};let T=null,N=null;await ag({capture:()=>{const I=qY(b==null?void 0:b.contentDocument,r,t,w);I&&(T=I.element,N=I.previousValue)},apply:()=>{if(!T)return;n1(T,w,m===null||m===""?null:m)},persist:v.previewOnly?async()=>{}:()=>s(r,[E],{label:v.label,coalesceKey:O,...v.coalesce?{coalesceMs:v.coalesce.ms}:{},skipRefresh:v.skipRefresh}),shouldRevert:()=>k(),revert:()=>{T&&n1(T,w,N)},onError:I=>Zp(r,[E],I,n),shouldResync:()=>k()&&!!v.refreshAfter,resync:()=>{var I;i(r),cR(((I=e.current)==null?void 0:I.contentDocument)??null)},onSettled:v.onSettled})},[t,r,s,i,n,e]),l=x.useCallback(async(y,m,v)=>{const b=e.current,w=Object.entries(m).map(([N,_])=>({attr:N,fullAttr:WY(N),value:_})),O=`${v.coalescePrefix}:${w.map(N=>N.attr).sort().join(",")}:${gc(y)}`,k=G4(a.current,O),E=w.map(N=>({type:"attribute",property:N.attr,value:N.value}));let T=null;await ag({capture:()=>{T=ntt(b==null?void 0:b.contentDocument,y,t,w.map(N=>N.fullAttr))},apply:()=>{if(T)for(const N of w){const _=N.value===null||N.value===""?null:N.value;n1(T.element,N.fullAttr,_)}},persist:()=>s(y,E,{label:v.label,coalesceKey:O,skipRefresh:v.skipRefresh}),shouldRevert:()=>k(),revert:()=>{if(T)for(const N of w)n1(T.element,N.fullAttr,T.previousValues.get(N.fullAttr)??null)},onError:N=>Zp(y,E,N,n),shouldResync:()=>k()&&!!v.refreshAfter,resync:()=>i(y),onSettled:v.onSettled})},[t,s,i,n,e]),c=x.useCallback(async(y,m)=>{await l(y,m,{label:"Edit timing",coalescePrefix:"attrs",skipRefresh:!1,refreshAfter:!0})},[l]),u=x.useCallback(async(y,m)=>{await o(y,m,{label:`Edit ${y.replace(/-/g," ")}`,coalescePrefix:"attr",skipRefresh:!1,refreshAfter:!0})},[o]),f=x.useCallback(async(y,m,v,b)=>{await o(y,m,{label:`Edit ${y.replace(/^(data-)?/,"").replace(/-/g," ")}`,coalescePrefix:"attr-live",skipRefresh:!0,onSettled:v,...b!=null&&b.coalesce?{coalesce:b.coalesce}:{},...b!=null&&b.previewOnly?{previewOnly:!0}:{}})},[o]),h=x.useCallback(async(y,m,v)=>{await o(y,m,{label:`Edit ${y.replace(/^(data-)?/,"").replace(/-/g," ")}`,coalescePrefix:"attr-quiet",skipRefresh:!0,refreshAfter:!0,...v?{coalesce:v}:{}})},[o]),p=x.useCallback(async(y,m)=>{if(!r)return;const v=e.current,b=`html-attr:${y}:${gc(r)}`,w=G4(a.current,b),O={type:"html-attribute",property:y,value:m};let k=null,E=null;await ag({capture:()=>{const T=qY(v==null?void 0:v.contentDocument,r,t,y);T&&(k=T.element,E=T.previousValue)},apply:()=>{if(!k)return;n1(k,y,m===null||m==="false"?null:m)},persist:()=>s(r,[O],{label:`Edit ${y}`,coalesceKey:b,skipRefresh:!1}),shouldRevert:()=>w(),revert:()=>{k&&n1(k,y,E)},onError:T=>Zp(r,[O],T,n),shouldResync:()=>w(),resync:()=>{var T;i(r),cR(((T=e.current)==null?void 0:T.contentDocument)??null)}})},[t,r,s,i,n,e]);return{handleDomAttributeCommit:u,handleDomAttributeLiveCommit:f,handleDomAttributeQuietCommit:h,handleDomHtmlAttributeCommit:p,handleDomAttributesCommit:c}}function itt(t,e){return t.isCompositionHost||t.isInsideLockedComposition?!1:K$(e)}function stt(t,e,n){return!n||!e.isConnected?!1:e===t.element&&e.ownerDocument===n}function att(t,e,n){const r=[j1(t,k_(t,e))];return n&&r.push(j1("background-position","center"),j1("background-repeat","no-repeat"),j1("background-size","contain")),r}function ott(t,e,n){return t.length===0?[]:t.map(r=>r.key===n?{...r,value:e}:r)}function YY(t,e,n){const r=e.length>1||e.some(o=>o.source==="child"),i=r?i1e(e):n,s=r?ttt(t,e):null,a=s??(r?[q$(i)]:[W$(i)]);return{usesSerializedTextFields:r,nextContent:i,childOperations:s,operations:a}}async function wN(t,e,n,r,i){if(!t)return;const s=Is(t,e,n);if(!s)return;const a=await r(s);a&&i(a,{revealPanel:!1,preserveGroup:!0})}function ltt({activeCompPath:t,previewIframeRef:e,showToast:n,domEditSelection:r,applyDomSelection:i,refreshDomEditSelectionFromPreview:s,buildDomSelectionFromTarget:a,persistDomEditOperations:o,resolveImportedFontAsset:l}){const c=x.useRef(0),u=x.useRef(new Map),{handleDomAttributeCommit:f,handleDomAttributeLiveCommit:h,handleDomAttributeQuietCommit:p,handleDomHtmlAttributeCommit:y,handleDomAttributesCommit:m}=rtt({activeCompPath:t,previewIframeRef:e,showToast:n,domEditSelection:r,refreshDomEditSelectionFromPreview:s,persistDomEditOperations:o}),v=x.useCallback(async(N,_)=>{if(!r)return hu("no-selection");if(_Ie(N))return hu("geometry-property");if(!r.capabilities.canEditStyles)return hu("styles-not-editable");const I=`${gc(r)}:${N}`,j=G4(u.current,I),L=N==="font-family"?l(_):null,B=e.current,$=B==null?void 0:B.contentDocument,z=k_(N,_),Y=N==="background-image"&&IIe(_);let W=null,J=null;const ne=att(N,_,Y),le=!0;return XY({capture:()=>{if(!$)return;const ie=Is($,r,t);ie&&(W=ie,J=ie.style.getPropertyValue(N))},apply:()=>{W&&(W.style.setProperty(N,z),N==="font-family"&&$&&(QY($,_),L&&zY($,L)),Y&&(W.style.setProperty("background-position","center"),W.style.setProperty("background-repeat","no-repeat"),W.style.setProperty("background-size","contain")))},persist:()=>o(r,ne,{label:"Edit layer style",skipRefresh:le,prepareContent:L?(ie,q)=>ZY(ie,L,q):void 0}),shouldRevert:()=>j(),revert:()=>{!W||J===null||(J===""?W.style.removeProperty(N):W.style.setProperty(N,J))},onError:ie=>Zp(r,ne,ie,n),shouldResync:j,resync:()=>s(r)})},[t,r,o,s,l,n,e]),b=x.useCallback(async(N,_)=>{if(!r)return hu("no-selection");if(!ih(r))return hu("not-text-editable");const I=mv(c),j=ott(r.textFields,N,_),L=YY(r.textFields,j,N),B=e.current,$=B==null?void 0:B.contentDocument;let z=null,Y=null;return XY({capture:()=>{if(!$)return;const W=Is($,r,t);W&&(z=W,Y=W.innerHTML)},apply:()=>{z&&(L.usesSerializedTextFields?z.innerHTML=L.nextContent:z.textContent=N)},persist:async()=>{await o(r,L.operations,{label:"Edit text",skipRefresh:!0,shouldSave:I})},shouldRevert:()=>I(),revert:()=>{!z||Y===null||(z.innerHTML=Y)},onError:W=>Zp(r,L.operations,W,n),shouldResync:I,resync:()=>wN($,r,t,a,i)})},[t,i,a,r,o,e,n]),w=x.useCallback(async({element:N,html:_,previousHtml:I})=>{if(!r||!itt(r,N))return;const j=e.current,L=j==null?void 0:j.contentDocument;if(!stt(r,N,L))return;const B=mv(c),$=[q$(_)];let z="";await ag({capture:()=>{},apply:()=>{N.innerHTML=_,z=N.innerHTML},persist:async()=>{await o(r,$,{label:"Edit text",skipRefresh:!0,shouldSave:B})},shouldRevert:()=>B(),revert:()=>{N.isConnected&&N.innerHTML===z&&(N.innerHTML=I)},onError:Y=>Zp(r,$,Y,n),shouldResync:B,resync:()=>wN(L,r,t,a,i)})},[t,i,a,r,o,e,n]),O=x.useCallback(async(N,_,I)=>{var J;const j=mv(c),L=YY(N.textFields,_,((J=_[0])==null?void 0:J.value)??""),B=e.current,$=B==null?void 0:B.contentDocument;let z=null,Y=null;const W=(I==null?void 0:I.importedFont)??null;await ag({capture:()=>{if(!$)return;const ne=Is($,N,t);ne&&(z=ne,Y=ne.innerHTML)},apply:()=>{z&&(L.usesSerializedTextFields?z.innerHTML=L.nextContent:z.textContent=L.nextContent)},persist:async()=>{await o(N,L.operations,{label:"Edit text",skipRefresh:!0,prepareContent:W?(ne,le)=>ZY(ne,W,le):void 0})},shouldRevert:()=>j(),revert:()=>{!z||Y===null||(z.innerHTML=Y)},onError:ne=>Zp(N,L.operations,ne,n),shouldResync:j,resync:()=>wN($,N,t,a,i)})},[t,i,a,o,e,n]),k=x.useCallback(async(N,_,I)=>{var z;if(!r)return;const j=r.textFields.find(Y=>Y.key===N);if(!j)return;if(j.source==="self"){await v(_,I);return}const L=k_(_,I),B=_==="font-family"?l(I):null;if(_==="font-family"){const Y=(z=e.current)==null?void 0:z.contentDocument;Y&&(QY(Y,L),B&&zY(Y,B))}const $=r.textFields.map(Y=>Y.key===N?{...Y,inlineStyles:{...Y.inlineStyles,[_]:L},computedStyles:{...Y.computedStyles,[_]:L}}:Y);await O(r,$,{importedFont:B})},[O,r,v,l,e]),E=x.useCallback(async N=>{if(!r||!r.textFields.some(B=>B.source==="child"))return null;const _=r.textFields.findIndex(B=>B.key===N),I=r.textFields[_>=0?_:0]??r.textFields[0],j=s1e(I),L=[...r.textFields];return L.splice(_>=0?_+1:L.length,0,j),await O(r,L),j.key},[O,r]),T=x.useCallback(async N=>{if(!r)return;const _=r.textFields.find(j=>j.key===N);if(!_)return;if(_.source==="self"){await b("",N);return}const I=r.textFields.filter(j=>j.key!==N);await O(r,I)},[O,r,b]);return{handleDomStyleCommit:v,handleDomAttributeCommit:f,handleDomAttributeLiveCommit:h,handleDomAttributeQuietCommit:p,handleDomHtmlAttributeCommit:y,handleDomAttributesCommit:m,handleDomTextCommit:b,handleDomRichTextCommit:w,commitDomTextFields:O,handleDomTextFieldStyleCommit:k,handleDomAddTextField:E,handleDomRemoveTextField:T}}function AA(t,e,n){for(const r of e){const i=t.style.getPropertyValue(r);i&&n.push({type:"inline-style",property:r,value:i})}}function FC(t,e,n){for(const r of e){const i=t.getAttribute(r);i!==null&&n.push({type:"attribute",property:r,value:i})}}function b1e(t,e){const n=t.getAttribute(th);n!==null&&(e.push({type:"inline-style",property:"display",value:n||null}),e.push({type:"attribute",property:th,value:null}))}function KY(t){const e=[];AA(t,[La,po],e);const n=t.style.getPropertyValue("translate"),r=t.style.getPropertyValue(La)||t.style.getPropertyValue(po),i=n&&n!=="none"?n:r?`var(${La}, 0px) var(${po}, 0px)`:null;return i&&e.push({type:"inline-style",property:"translate",value:i}),e.push({type:"attribute",property:Xf,value:"true"}),FC(t,[Yf,Kf],e),AA(t,["display"],e),FC(t,[th],e),e}function ctt(t){const e=t.getAttribute(Kf),n=[{type:"inline-style",property:La,value:null},{type:"inline-style",property:po,value:null},{type:"inline-style",property:"translate",value:e||null},{type:"attribute",property:Xf,value:null},{type:"attribute",property:Yf,value:null},{type:"attribute",property:Kf,value:null}];return b1e(t,n),n}const utt=["width","height","min-width","min-height","max-width","max-height","flex-basis","flex-grow","flex-shrink","box-sizing","scale","transform-origin","display"],v1e=[[Cy,"width"],[ky,"height"],[Vg,""],[Hg,""],[MS,"min-width"],[NS,"min-height"],[DS,"max-width"],[IS,"max-height"],[_S,"flex-basis"],[RS,"flex-grow"],[jS,"flex-shrink"],[LS,"box-sizing"],[Pf,"scale"],[k0,"transform-origin"],[FS,"display"],[th,""]];function ftt(t){const e=[];return AA(t,[hh,dh],e),AA(t,utt,e),e.push({type:"attribute",property:Wf,value:"true"}),FC(t,v1e.map(([n])=>n),e),e}function htt(t){const e=[{type:"inline-style",property:hh,value:null},{type:"inline-style",property:dh,value:null},{type:"attribute",property:Wf,value:null}];for(const[n,r]of v1e){const i=t.getAttribute(n);i!==null&&r&&e.push({type:"inline-style",property:r,value:i||null}),e.push({type:"attribute",property:n,value:null})}return e}const dtt=[jc,"rotate","transform-origin","display"],ptt=[Jf,eh,Du,th];function mtt(t){const e=[];return AA(t,dtt,e),e.push({type:"attribute",property:qf,value:"true"}),FC(t,ptt,e),e}function gtt(t){const e=t.getAttribute(eh),n=t.getAttribute(Du),r=[{type:"inline-style",property:jc,value:null},{type:"inline-style",property:"rotate",value:e||null},{type:"inline-style",property:"transform-origin",value:n!==null&&n||null},{type:"attribute",property:qf,value:null},{type:"attribute",property:q0,value:null},{type:"attribute",property:Jf,value:null},{type:"attribute",property:eh,value:null},{type:"attribute",property:Du,value:null}];return b1e(t,r),r}let JY,eK,tK;function ytt(t,e,n){var i,s;const r=(i=t.getChildren)==null?void 0:i.call(t,!0);if(r)for(const a of r){const o=(s=a.targets)==null?void 0:s.call(a);if(o)for(const l of o)n.add(l),l.id&&e.add(l.id)}}function xtt(t){const e=new Set,n=new WeakSet;for(const r of Object.values(t))if(r)try{ytt(r,e,n)}catch{}return{ids:e,nodes:n}}function btt(t){if(t!=null&&t.contentWindow)try{return t.contentWindow.__timelines}catch{return}}function ON(t,e){const n=btt(t);if(!n)return!1;if(n!==JY){const r=xtt(n);eK=r.ids,tK=r.nodes,JY=n}return tK.has(e)||!!(e.id&&eK.has(e.id))}const CN="This element is GSAP-animated — dragging via CSS would corrupt keyframes";function vtt({previewIframeRef:t,showToast:e,commitPositionPatchToHtml:n}){const r=x.useCallback((o,l)=>{if(ON(t.current,o.element)){const f=new Error(CN);return e(f.message,"error"),Promise.reject(f)}const u=rg(o.element);return gC(o.element,l),n(o,KY(o.element),{label:"Move layer",coalesceKey:`path-offset:${gc(o)}`}).catch(f=>{throw fc(o.element,u),f})},[n,t,e]),i=x.useCallback((o,l,c)=>{if(ON(t.current,o.element)){const p=new Error(CN);return e(p.message,"error"),Promise.reject(p)}const u=sR(o.element),f=c?rg(o.element):null;BF(o.element,l);const h=ftt(o.element);return c&&(gC(o.element,c),h.push(...KY(o.element))),n(o,h,{label:"Resize layer box",coalesceKey:`box-size:${gc(o)}`}).catch(p=>{throw lv(o.element,u),f&&fc(o.element,f),p})},[n,t,e]),s=x.useCallback((o,l)=>{if(ON(t.current,o.element)){const u=new Error(CN);return e(u.message,"error"),Promise.reject(u)}const c=aR(o.element);return HF(o.element,l),n(o,mtt(o.element),{label:"Rotate layer",coalesceKey:`rotation:${gc(o)}`}).catch(u=>{throw yC(o.element,c),u})},[n,t,e]),a=x.useCallback(o=>{const l=o.element,c=rg(l),u=sR(l),f=aR(l),h=[...ctt(l),...htt(l),...gtt(l)];return Qde(l),zde(l),MQe(l),n(o,h,{label:"Reset layer edits",coalesceKey:`manual-reset:${gc(o)}`,skipRefresh:!1}).catch(p=>{throw fc(l,c),lv(l,u),yC(l,f),p})},[n]);return{handleDomPathOffsetCommit:r,handleDomBoxSizeCommit:i,handleDomRotationCommit:s,handleDomManualEditsReset:a}}const A1e="2147483000",k3="data-hf-studio-reveal-pending-commit";let Att=0;const d1=new WeakMap,Stt=16;function wtt(t){d1.set(t,(d1.get(t)??0)+1);let e=!1;return()=>{if(e)return;e=!0;const n=(d1.get(t)??1)-1;n>0?d1.set(t,n):d1.delete(t)}}function Gp(t,e,n){n?t.style.setProperty(e,n):t.style.removeProperty(e)}function J$(t){const e=t.getAttribute(k3);if(!e)return null;try{const n=JSON.parse(e);if(typeof n!="object"||n===null||!("token"in n))return null;const r=n.token;if(typeof r!="string")return null;if(!("releasedPriors"in n)||n.releasedPriors===void 0)return{token:r};const i=n.releasedPriors;if(typeof i!="object"||i===null||!("zIndex"in i)||!("position"in i))return null;const{zIndex:s,position:a}=i;return typeof s=="string"&&typeof a=="string"?{token:r,releasedPriors:{zIndex:s,position:a}}:null}catch{return null}}function S1e(t,e){t.setAttribute(k3,JSON.stringify(e))}function Ott(t){const e=t.getAttribute(Vf);if(e==null)return null;const n={token:`reveal-z-${Att++}`,priorZ:e,priorPosition:t.getAttribute(p0),activeLiftStyles:{zIndex:t.style.zIndex,position:t.style.position}};return S1e(t,{token:n.token}),t.removeAttribute(Vf),t.removeAttribute(p0),n}function Ctt(t,e){var n;((n=J$(t))==null?void 0:n.token)===e.token&&t.removeAttribute(k3)}function ktt(t,e){const n=J$(t);if((n==null?void 0:n.token)===e.token){if(t.removeAttribute(k3),t.removeAttribute(Vf),t.removeAttribute(p0),n.releasedPriors){Gp(t,"z-index",n.releasedPriors.zIndex),Gp(t,"position",n.releasedPriors.position);return}Gp(t,"z-index",e.activeLiftStyles.zIndex),Gp(t,"position",e.activeLiftStyles.position),t.setAttribute(Vf,e.priorZ),e.priorPosition!=null&&t.setAttribute(p0,e.priorPosition)}}function kN(t,e,n,r){n!=null&&t.style.getPropertyValue(e)===n&&Gp(t,e,r)}function Ett(t,e){const n=e.getComputedStyle(t),r=Number.parseFloat(n.opacity);return{display:n.display==="none",visibility:n.visibility==="hidden"||n.visibility==="collapse",opacity:Number.isFinite(r)&&r<=.01}}function Ttt(t,e,n){const r={display:t.style.display,visibility:t.style.visibility,opacity:t.style.opacity},i={};return n.display&&(t.style.removeProperty("display"),e.getComputedStyle(t).display==="none"&&(t.style.display="block"),i.display=t.style.display),n.visibility&&(t.style.visibility="visible",i.visibility="visible"),n.opacity&&(t.style.opacity="1",i.opacity="1"),{element:t,priors:r,applied:i}}function Ptt(t){const e=t.ownerDocument,n=e.defaultView;if(!n)return[];const r=[];let i=t;for(;i&&i!==e.body&&i!==e.documentElement;){let s;try{s=Ett(i,n)}catch{break}(s.display||s.visibility||s.opacity)&&r.push(Ttt(i,n,s)),i=i.parentElement}return r}function Mtt(t){const e=t.ownerDocument.defaultView;if(!e)return null;const n={zIndex:t.style.zIndex,position:t.style.position};let r=!1;try{t.setAttribute(Vf,String(i3(t))),e.getComputedStyle(t).position==="static"&&(t.setAttribute(p0,"static"),t.style.position="relative",r=!0)}catch{return t.removeAttribute(Vf),null}return t.style.zIndex=A1e,{priors:n,positionLifted:r}}function Ntt(t,e){if(!t.hasAttribute(Vf)){const n=J$(t);n&&!n.releasedPriors&&S1e(t,{...n,releasedPriors:e.priors});return}t.removeAttribute(Vf),t.removeAttribute(p0),t.style.zIndex===A1e&&Gp(t,"z-index",e.priors.zIndex),e.positionLifted&&t.style.position==="relative"&&Gp(t,"position",e.priors.position)}function Dtt({isPlaying:t,selectedElement:e}){const n=x.useRef(null),r=x.useRef(null),i=x.useRef({isPlaying:t,selectedElement:e});i.current={isPlaying:t,selectedElement:e};const s=x.useCallback(()=>{const c=n.current;if(n.current=null,!!c){for(const{element:u,priors:f,applied:h}of c.nodes)u.isConnected&&(kN(u,"display",h.display,f.display),kN(u,"visibility",h.visibility,f.visibility),kN(u,"opacity",h.opacity,f.opacity));c.lift&&c.base.isConnected&&Ntt(c.base,c.lift)}},[]),a=x.useCallback(c=>{s();const u=Ptt(c),f=Mtt(c);(u.length>0||f)&&(n.current={base:c,nodes:u,lift:f})},[s]),o=x.useCallback(()=>{const c=r.current;r.current=null,c&&window.clearTimeout(c.timer)},[]),l=x.useCallback((c,u)=>{if(o(),i.current.isPlaying)return;const h=()=>{const y=i.current;if(y.isPlaying||y.selectedElement!==c||!c.isConnected){r.current=null;return}if(d1.has(c)){const m=window.setTimeout(h,Stt);r.current={timer:m,element:c};return}r.current=null,a(c)},p=window.setTimeout(h,u);r.current={timer:p,element:c}},[o,a]);return x.useEffect(()=>{var f;const c=r.current;(t||c&&c.element!==e)&&o();const u=(f=n.current)==null?void 0:f.base;(t||u&&e!==u)&&s()},[o,t,s,e]),x.useEffect(()=>()=>{o(),s()},[o,s]),{scheduleReveal:l}}let Itt=0;function eB(t,e){const n=t.map(r=>r.id??r.selector??r.element.getAttribute("data-hf-id")??"el").join(":");return`z-reorder:${e??"reorder"}:${n}:g${Itt++}`}function _tt({activeCompPath:t,showToast:e,writeProjectFile:n,domEditSaveTimestampRef:r,editHistory:i,projectIdRef:s,reloadPreview:a,clearDomSelection:o,onTrySdkDelete:l,onReorderShadow:c,forceReloadSdkSession:u,commitDomEditPatchBatches:f,onElementDeleted:h}){const p=x.useCallback(async v=>{const b=s.current;if(!b)return hu("no-project");const[w]=v;if(!w)return hu("no-selection");const O=v.length===1?w.label||w.id||w.selector||w.tagName:`${v.length} elements`;v.length>1&&e(`Deleting ${O}...`,"info");const k=w.sourceFile||t||"index.html",E=v.filter(T=>(T.sourceFile||t||"index.html")===k);try{const T=await fF(b,k),N=E.map(B=>Wg(B));if(N.some(B=>!B.id&&!B.selector&&!B.hfId))throw new Error("Selected element has no patchable target");const _=E.map(B=>B.hfId).filter(B=>!!B);if(l&&_.length===E.length){let B=!0;for(const $ of _){const z=await l($,T,k);if(!Ri(z)){B=!1;break}}if(B)return o(),ue.getState().setSelectedElementId(null),e(`Deleted ${O}. Use Undo to restore ${E.length===1?"it":"them"}.`,"info"),{ok:!0}}r.current=Date.now();const I=await fetch(`/api/projects/${b}/file-mutations/remove-elements/${encodeURIComponent(k)}`,{method:"POST",headers:{"Content-Type":"application/json",...Zl()},body:JSON.stringify({targets:N})});if(!I.ok)throw await _d(I,`Failed to delete element from ${k}`);const j=await I.json();if(!j.changed)return a(),e("Nothing to delete, the preview was out of date. Try again."),hu("preview-stale");const L=typeof j.content=="string"?j.content:T;await il({projectId:b,label:"Delete element",kind:"timeline",files:{[k]:L},readFile:async()=>T,diskContent:{[k]:L},writeFile:n,recordEdit:i.recordEdit}),o(),ue.getState().setSelectedElementId(null),u==null||u(),a();for(const B of E)h==null||h(B);return e(`Deleted ${O}. Use Undo to restore ${E.length===1?"it":"them"}.`,"info"),{ok:!0}}catch(T){const N=T instanceof Error?T.message:"Failed to delete element";return e(N),hu("persist-failed")}},[t,o,r,i.recordEdit,l,h,u,s,a,e,n]),y=x.useCallback((v,b,w)=>v.length===0?Promise.resolve():(async()=>{var k;const O=v.map(E=>wtt(E.element));try{c==null||c(v.map(L=>vA(L.element)).filter(L=>L!=null));const E=b??eB(v,w),T=new Map,N=[],_=[];for(const L of v){const B=L.element.style.zIndex,$=L.element.style.position,z=L.key?ue.getState().elements.find(ie=>(ie.key??ie.id)===L.key):void 0;let Y=!1;const W=L.element.getAttribute(p0),J=Ott(L.element);J&&_.push({element:L.element,ownership:J}),L.element.style.zIndex=String(L.zIndex);const ne=[{type:"inline-style",property:"z-index",value:String(L.zIndex)}];try{const ie=(k=L.element.ownerDocument)==null?void 0:k.defaultView;(W??(ie?ie.getComputedStyle(L.element).position:void 0))==="static"&&(L.element.style.position="relative",Y=!0,ne.push({type:"inline-style",property:"position",value:"relative"}))}catch{}L.key&&ue.getState().updateElement(L.key,{zIndex:L.zIndex,hasExplicitZIndex:!0}),N.push(()=>{J?ktt(L.element,J):(L.element.style.zIndex=B,Y&&(L.element.style.position=$)),L.key&&z&&ue.getState().updateElement(L.key,{zIndex:z.zIndex,hasExplicitZIndex:z.hasExplicitZIndex})});const le=T.get(L.sourceFile)??[];le.push({target:Wg({id:L.id,hfId:vA(L.element),selector:L.selector,selectorIndex:L.selectorIndex}),operations:ne}),T.set(L.sourceFile,le)}const I=[...T].map(([L,B])=>({sourceFile:L,patches:B}));ue.getState().bumpZEditVersion();const j=()=>{for(const L of N)L();ue.getState().bumpZEditVersion()};try{const L=await f(I,{label:"Reorder layers",coalesceKey:E,coalesceMs:Number.POSITIVE_INFINITY,skipReload:!0});if(!L.durable)return j(),L;for(const{element:B,ownership:$}of _)Ctt(B,$);return L}catch(L){throw j(),L}}finally{for(const E of O)E()}})(),[f,c]);return{handleDomEditElementDelete:x.useCallback(async v=>{await p([v])},[p]),handleDomEditElementsDelete:p,handleDomZIndexReorderCommit:y}}function Rtt(t){if(t.id)return{selector:Mg(t.id)};const e=t.element,n=e.ownerDocument;if(t.selector&&HE(n,t.selector,e))return{selector:t.selector};const r=e.tagName.toLowerCase();let i=r,s=1;for(;n.getElementById(i);)s+=1,i=`${r}-${s}`;return e.setAttribute("id",i),{selector:Mg(i),autoId:i}}class E3 extends Error{constructor(e,n){super(C1e(e,n)),this.statusCode=e,this.responseBody=n,this.name="GsapMutationHttpError"}}function w1e(t){return typeof t=="object"&&t!==null}function O1e(t){const e=Array.isArray(t)?t.filter(n=>typeof n=="string"):[];return e.length>0?` (${e.join(", ")})`:""}async function tB(t){return(t.headers.get("content-type")??"").includes("application/json")?await t.json().catch(()=>null):await t.text().catch(()=>null)}function C1e(t,e){return w1e(e)&&typeof e.error=="string"?e.error:`GSAP mutation failed with status ${t}`}function k1e(t){const e=t.responseBody;return w1e(e)?`Couldn't save animation: ${C1e(t.statusCode,e)}${O1e(e.fields)}`:`Couldn't save animation: ${t.message}`}async function jtt({projectId:t,targetPath:e,selection:n,autoId:r,showToast:i}){const s={target:{id:n.id,hfId:n.hfId,selector:n.selector,selectorIndex:n.selectorIndex},operations:[{type:"html-attribute",property:"id",value:r}]};if(IR(s).length>0)return i==null||i("Couldn't assign element id because the patch contains invalid values","error"),!1;const o=await fetch(`/api/projects/${encodeURIComponent(t)}/file-mutations/patch-element/${encodeURIComponent(e)}`,{method:"POST",headers:{"Content-Type":"application/json",...Zl()},body:JSON.stringify(s)});return o.ok?(await o.json()).changed===!0:(i==null||i(k1e(new E3(o.status,await tB(o))),"error"),!1)}function nK(t){return t.map(e=>e.path).join(", ")}function E1e(t){return t instanceof Error?t.message:String(t)}async function T1e(t){return(t.headers.get("content-type")??"").includes("application/json")?await t.json().catch(()=>null):null}function P1e(t){return t!=null&&t.error?`Couldn't save edit: ${t.error}${O1e(t.fields)}`:"Couldn't save edit"}function Ltt(t){return t.target.id??t.target.hfId??t.target.selector??"(unaddressed)"}function Ftt(t,e){const n=t.patches.filter((r,i)=>e[i]===!1).map(Ltt);n.length!==0&&(console.warn(`[studio] z-index reorder: server could not match ${n.length} patch target(s) in ${t.sourceFile} (the whole z-order gesture will revert on reload):`,n.join(", ")),X0({source:"dom_edit",error:new Error(`Batch patch target(s) unmatched: ${n.join(", ")}`),filePath:t.sourceFile,mutationType:"z-reorder-unmatched"}))}class M1e extends Error{constructor(e,n){super(e,n),this.name="AtomicElementPatchConvergenceError"}}function $tt(t){return typeof t=="object"&&t!==null&&"sourceFile"in t&&typeof t.sourceFile=="string"&&"changed"in t&&typeof t.changed=="boolean"&&(!("matched"in t)||Array.isArray(t.matched)&&t.matched.every(e=>typeof e=="boolean"))&&"before"in t&&typeof t.before=="string"&&"after"in t&&typeof t.after=="string"&&t.changed===(t.before!==t.after)}async function Btt(t,e){const n=JSON.stringify({batches:e});try{const r=await fetch(`/api/projects/${encodeURIComponent(t)}/file-mutations/patch-element-batches`,{method:"POST",headers:{"Content-Type":"application/json",...Zl()},body:n});if(!r.ok){const a=await T1e(r);throw new s0(P1e(a),r.status)}const i=await r.json().catch(()=>null);if(typeof i!="object"||i===null||!("durable"in i)||typeof i.durable!="boolean"||!("files"in i)||!Array.isArray(i.files)||i.files.length!==e.length||!i.files.every($tt)||!i.durable&&i.files.some(a=>a.changed))throw new s0("Invalid atomic element patch response",502);const s=i.files.map((a,o)=>{const l=e[o],c=a.matched??[];if(!l||a.sourceFile!==l.sourceFile||c.length!==0&&c.length!==l.patches.length)throw new s0("Invalid atomic element patch response",502);return Ftt(l,c),{...a,matched:c,allMatched:c.length===l.patches.length&&c.every(Boolean)}});return{durable:i.durable,files:s}}catch(r){throw new M1e(E1e(r),{cause:r})}}function Vtt(t){return t.every(e=>e.patches.every(n=>n.operations.every(r=>r.type==="inline-style")))}function Htt({activeCompPath:t,previewIframeRef:e,showToast:n,queueDomEditSave:r,writeProjectFile:i,domEditSaveTimestampRef:s,editHistory:a,fileTree:o,importedFontAssetsRef:l,projectId:c,projectIdRef:u,reloadPreview:f,domEditSelection:h,applyDomSelection:p,clearDomSelection:y,refreshDomEditSelectionFromPreview:m,buildDomSelectionFromTarget:v,forceReloadSdkSession:b,onTrySdkPersist:w,onTrySdkDelete:O,onReorderShadow:k}){const E=x.useCallback(H=>{const se=Tet(H);if(!se)return null;const fe=l.current.find(me=>me.family.toLowerCase()===se.toLowerCase());if(fe)return fe;const be=o.find(me=>b0.test(me)&&$g(me).toLowerCase()===se.toLowerCase());return be?{family:$g(be),path:be,url:`/api/projects/${c}/preview/${be}`}:null},[o,c,l]),T=x.useRef(new Set),N=x.useCallback(async(H,se,fe)=>{const be=u.current;if(!be)throw new Error("No active project");if(fe!=null&&fe.shouldSave&&!fe.shouldSave())return;const me=H.sourceFile||t||"index.html",pe=await fetch(`/api/projects/${be}/files/${encodeURIComponent(me)}`);if(!pe.ok)throw await _d(pe,`Failed to read ${me}`);const Pe=(await pe.json()).content;if(typeof Pe!="string")throw new Error(`Missing file contents for ${me}`);if(fe!=null&&fe.shouldSave&&!fe.shouldSave())return;const xe={target:Wg(H),operations:se},we=IR(xe);if(we.length>0){const Ze=nK(we);throw n("Couldn't save edit because it contains invalid layout values","error"),new Z4(`DOM patch contains unsafe values: ${Ze}`,{alreadyToasted:!0})}if(w&&!(fe!=null&&fe.prepareContent)){const Ze=await w(H,se,Pe,me,{label:fe==null?void 0:fe.label,coalesceKey:fe==null?void 0:fe.coalesceKey,skipRefresh:fe==null?void 0:fe.skipRefresh});if(Ri(Ze))return}s.current=Date.now();const Ce=await fetch(`/api/projects/${be}/file-mutations/patch-element/${encodeURIComponent(me)}`,{method:"POST",headers:{"Content-Type":"application/json",...Zl()},body:JSON.stringify(xe)});if(!Ce.ok)throw n(P1e(await T1e(Ce)),"error"),await _d(Ce,`Failed to patch ${me}`,{alreadyToasted:!0});const Me=await Ce.json();if(!Me.changed){if(Me.matched===!1){const Ze=H.selector??H.id??"selection";throw T.current.has(Ze)||(T.current.add(Ze),Pt("save_skipped_unresolvable",{target_id:H.id??void 0,target_selector:H.selector??void 0,target_source_file:H.sourceFile??void 0,composition:t??void 0})),new Pet(me)}Det(H,se);return}const Ve=typeof Me.content=="string"?Me.content:Pe;let tt=Ve;if(fe!=null&&fe.prepareContent){const Ze=fe.prepareContent(Ve,me);if(Ze!==Ve)try{await i(me,Ze,Ve),tt=Ze}catch(qe){n(`Saved, but couldn't finish updating ${me}: ${E1e(qe)}`,"error")}}await a.recordEdit({label:(fe==null?void 0:fe.label)??"Edit layer",kind:"manual",coalesceKey:fe==null?void 0:fe.coalesceKey,coalesceMs:fe==null?void 0:fe.coalesceMs,files:{[me]:{before:Pe,after:tt}}}),b==null||b(),fe!=null&&fe.skipRefresh||f()},[t,a,i,u,s,f,n,b,w]),_=x.useCallback((H,se)=>r(async()=>{const fe=u.current;if(!fe)throw new Error("No active project");const be=H.flatMap(we=>we.patches.flatMap(Ce=>IR(Ce)));if(be.length>0)throw n("Couldn't save edit because it contains invalid layout values","error"),new Z4(`DOM patch contains unsafe values: ${nK(be)}`,{alreadyToasted:!0});s.current=Date.now();const me=await Btt(fe,H),pe=me.durable&&me.files.every(we=>we.allMatched),ge=Object.fromEntries(me.files.filter(we=>we.changed).map(we=>[we.sourceFile,{before:we.before,after:we.after}])),Pe=Object.keys(ge).length>0;Pe&&(await a.recordEdit({label:se.label,kind:"manual",coalesceKey:se.coalesceKey,coalesceMs:se.coalesceMs,files:ge}),b==null||b());const ve=pe,xe=se.skipReload===!0&&Vtt(H)&&ve;return(!ve||Pe&&!xe)&&f(),{durable:ve,allMatched:pe,changed:Pe}}).catch(fe=>{throw fe instanceof M1e&&f(),(fe instanceof s0||fe instanceof Z4)&&fe.alreadyToasted||n(fe instanceof Error?fe.message:"Failed to reorder layers","error"),X0({source:"dom_edit",error:fe,filePath:H.map(me=>me.sourceFile).join(","),mutationType:"z-reorder",label:se.label}),fe}),[s,a,b,u,r,f,n]),{handleDomStyleCommit:I,handleDomAttributeCommit:j,handleDomAttributeLiveCommit:L,handleDomAttributeQuietCommit:B,handleDomHtmlAttributeCommit:$,handleDomAttributesCommit:z,handleDomTextCommit:Y,handleDomRichTextCommit:W,commitDomTextFields:J,handleDomTextFieldStyleCommit:ne,handleDomAddTextField:le,handleDomRemoveTextField:ie}=ltt({activeCompPath:t,previewIframeRef:e,domEditSelection:h,applyDomSelection:p,refreshDomEditSelectionFromPreview:m,buildDomSelectionFromTarget:v,persistDomEditOperations:N,resolveImportedFontAsset:E,showToast:n}),q=Iet({activeCompPath:t,persistDomEditOperations:N,queueDomEditSave:r,showToast:n}),{handleDomPathOffsetCommit:F,handleDomBoxSizeCommit:U,handleDomRotationCommit:Z,handleDomManualEditsReset:K}=vtt({previewIframeRef:e,showToast:n,commitPositionPatchToHtml:q}),{handleDomEditElementDelete:ee,handleDomEditElementsDelete:re,handleDomZIndexReorderCommit:Q}=_tt({activeCompPath:t,showToast:n,writeProjectFile:i,domEditSaveTimestampRef:s,editHistory:a,projectIdRef:u,reloadPreview:f,clearDomSelection:y,onTrySdkDelete:O,onReorderShadow:k,forceReloadSdkSession:b,commitDomEditPatchBatches:_});return{resolveImportedFontAsset:E,handleDomStyleCommit:I,handleDomAttributeCommit:j,handleDomAttributeLiveCommit:L,handleDomAttributeQuietCommit:B,handleDomHtmlAttributeCommit:$,handleDomAttributesCommit:z,handleDomTextCommit:Y,handleDomRichTextCommit:W,commitDomTextFields:J,handleDomTextFieldStyleCommit:ne,handleDomAddTextField:le,handleDomRemoveTextField:ie,handleDomPathOffsetCommit:F,handleDomBoxSizeCommit:U,handleDomRotationCommit:Z,handleDomManualEditsReset:K,handleDomEditElementDelete:ee,handleDomEditElementsDelete:re,handleDomZIndexReorderCommit:Q}}function Qtt(t){const e=t.map(a=>({target:Wg(a),left:a.element.offsetLeft,top:a.element.offsetTop,right:a.element.offsetLeft+a.element.offsetWidth,bottom:a.element.offsetTop+a.element.offsetHeight})),n=Math.min(...e.map(a=>a.left)),r=Math.min(...e.map(a=>a.top)),i=Math.max(...e.map(a=>a.right))-n,s=Math.max(...e.map(a=>a.bottom))-r;return{bbox:{left:n,top:r,width:i,height:s},targets:e.map(a=>a.target),rebases:e.map(a=>({target:a.target,left:a.left-n,top:a.top-r}))}}async function rK(t,e,n,r,i,s){var u;const a=await fF(t,e);s.domEditSaveTimestampRef.current=Date.now();const o=await fetch(`/api/projects/${t}/file-mutations/${n}/${encodeURIComponent(e)}`,{method:"POST",headers:{"Content-Type":"application/json",...Zl()},body:JSON.stringify(r)});if(!o.ok){const f=await o.json().catch(()=>null);throw new Error((f==null?void 0:f.error)??`Failed to ${i.toLowerCase()} in ${e}`)}const l=await o.json(),c=typeof l.content=="string"?l.content:a;return await il({projectId:t,label:i,kind:"manual",files:{[e]:c},readFile:async()=>a,writeFile:s.writeProjectFile,recordEdit:s.editHistory.recordEdit}),s.clearDomSelection(),(u=s.forceReloadSdkSession)==null||u.call(s),s.reloadPreview(),l}function ztt(t){const{activeCompPath:e,showToast:n,projectIdRef:r}=t,i=x.useCallback(async a=>{const o=r.current;if(!o||a.length===0)return null;const l=a[0].sourceFile||e||"index.html";if(a.some(y=>(y.sourceFile||e||"index.html")!==l))return n("Can't group elements from different files","error"),null;const u=`Group ${a[0].element.ownerDocument.querySelectorAll("[data-hf-group]").length+1}`,{bbox:f,targets:h,rebases:p}=Qtt(a);try{return(await rK(o,l,"wrap-elements",{targets:h,groupId:u,bbox:f,rebases:p},"Group elements",t)).groupId??u}catch(y){return n(y instanceof Error?y.message:"Failed to group elements","error"),null}},[e,r,n,t]),s=x.useCallback(async a=>{const o=r.current;if(!o)return;const l=a.sourceFile||e||"index.html";try{await rK(o,l,"unwrap-elements",{target:Wg(a)},"Ungroup elements",t)}catch(c){n(c instanceof Error?c.message:"Failed to ungroup elements","error")}},[e,r,n,t]);return{groupSelection:i,ungroupSelection:s}}function iK(t,e){if(t.size!==e.size)return!1;for(const[n,r]of t)if(e.get(n)!==r)return!1;return!0}function nm(t){const{keyframeCache:e,gsapAnimations:n}=ue.getState(),r={keyframeCache:new Map(e),gsapAnimations:new Map(n)};t(r),!(iK(e,r.keyframeCache)&&iK(n,r.gsapAnimations))&&ue.setState({keyframeCache:r.keyframeCache,gsapAnimations:r.gsapAnimations})}function Ztt(t,e,n,r,i){var p,y,m;const{elements:s,domClipChildren:a}=ue.getState(),o=new Set,l=new Map,c=new Map;for(const v of t){const b=((p=v.keyframes)==null?void 0:p.keyframes)??((y=Ng(v))==null?void 0:y.keyframes)??[];if(b.length!==0)for(const w of A_(v.targetSelector,i)){o.add(w),c.set(w,[...c.get(w)??[],v]);const{elStart:O,elDuration:k}=QE(w,e,s,a),E=jL(b,v,O,k),T=l.get(w);T?T.keyframes=LL([...T.keyframes,...E]):l.set(w,{...v.keyframes,format:((m=v.keyframes)==null?void 0:m.format)??"percentage",keyframes:E})}}const u=r.targetSelector,f=u?A_(u,i):[],h=f.length>0?f:n?[n]:[];nm(v=>{for(const[b,w]of l)N1e(v,e,b,w,c.get(b));for(const b of h)o.has(b)||T3(v,e,b)})}function N1e(t,e,n,r,i){for(const s of N0(e,n))t.keyframeCache.set(s,r),i?t.gsapAnimations.set(s,i):t.gsapAnimations.delete(s)}function T3(t,e,n){for(const r of N0(e,n))t.keyframeCache.delete(r),t.gsapAnimations.delete(r)}function RR(t,e){nm(n=>T3(n,t,e))}function Gtt(t,e,n){const r=`${t}#`,i=new Set;for(const s of[...e.keys(),...n.keys()])s.startsWith(r)&&i.add(s.slice(r.length));return i}function Utt(t){const e=new Set(t),{keyframeCache:n,gsapAnimations:r}=ue.getState(),i=new Map;for(const s of[...n.keys(),...r.keys()]){const a=s.indexOf("#");if(a<0)continue;const o=s.slice(0,a);if(e.has(o))continue;const l=i.get(o)??new Set;l.add(s.slice(a+1)),i.set(o,l)}nm(s=>{for(const[a,o]of i)for(const l of o)T3(s,a,l)})}function P3(t){return`${t.sourceFile||"index.html"}#${t.id}`}function N0(t,e){const n=typeof e=="string"?e:Xtt(e,t);return t==="index.html"?[`index.html#${n}`,n]:[`${t}#${n}`,`index.html#${n}`,n]}function Xtt(t,e){var n;return Pt("cache_key_non_string",{value_type:typeof t,constructor_name:((n=t==null?void 0:t.constructor)==null?void 0:n.name)??null,is_array:Array.isArray(t),source_file:e}),String(t)}function Wtt(t,e,n){nm(r=>{for(const i of Gtt(t,r.keyframeCache,r.gsapAnimations))T3(r,t,i);for(const[i,s]of e)N1e(r,t,i,s,n.get(i))})}function qtt(t,e,n){nm(r=>{for(const i of N0(t,e))n?r.gsapAnimations.set(i,n):r.gsapAnimations.delete(i)})}function D1e(t,e){return`${t}#${e}`}function Ytt(t,e){if(e)return ue.getState().keyframeCache.get(D1e(t,e))}function sK(t,e,n){e&&ue.getState().setKeyframeCache(D1e(t,e),n)}const Ktt=new Set(["ease","duration","delay","stagger","motionPath","overwrite","immediateRender","onComplete","onUpdate","onStart","keyframes"]);function M3(t){if(!(t!=null&&t.contentWindow))return null;try{return t.contentWindow.__timelines??null}catch{return null}}function Jtt(t){return!!t&&typeof t.x=="number"&&typeof t.y=="number"}function nB(t){return!(t>0)}function ent(t){if(!t||typeof t!="object")return null;const e=t,n=Array.isArray(t)?t:e.path;if(!Array.isArray(n))return null;const r=n.filter(Jtt).map(a=>({x:a.x,y:a.y}));if(r.length<2)return null;const i=typeof e.curviness=="number"?e.curviness:1,s=typeof e.autoRotate=="number"?e.autoRotate:e.autoRotate===!0;return{coords:r,curviness:i,autoRotate:s,isCubic:e.type==="cubic"}}function tnt(t){const e={};for(const[n,r]of Object.entries(t))Ktt.has(n)||(typeof r=="number"?e[n]=Xt(r):typeof r=="string"&&(e[n]=r));return Object.keys(e).length===0?null:[{percentage:0,properties:e},{percentage:100,properties:e}]}function rB(t){if(t.keyframes&&typeof t.keyframes=="object"){const r=MDe(t.keyframes);if(r)return r}const e=ent(t.motionPath);if(e){const r=Doe(e.coords,e.curviness,e.autoRotate,e.isCubic);if(r){const i=r.waypoints.length;return{keyframes:r.waypoints.map((a,o)=>({percentage:i>1?Math.round(o/(i-1)*100):0,properties:{x:a.x,y:a.y}})),arcPath:r.arcPath}}}const n=tnt(t);return n?{keyframes:n}:null}function iB(t,e){if(!t.targets)return!1;for(const n of t.targets())if(n===e||e.id&&n.id===e.id)return!0;return!1}function nnt(t){const e=typeof t.startTime=="function"?t.startTime():0,n=typeof t.duration=="function"?t.duration():0;return{start:Number.isFinite(e)?e:0,duration:Number.isFinite(n)?n:0}}function rnt(t,e){if(!t)return!1;for(const n of e)if(Object.prototype.hasOwnProperty.call(t,n))return!0;return!1}function int(t,e){const n=t==null?void 0:t.keyframes;return!n||typeof n!="object"?!1:(Array.isArray(n)?n:Object.values(n)).some(i=>i!=null&&typeof i=="object"&&e.some(s=>Object.prototype.hasOwnProperty.call(i,s)))}function snt(t,e,n,r,i){var f;const s=M3(t);if(!s)return null;let a=null;try{a=((f=t==null?void 0:t.contentDocument)==null?void 0:f.querySelector(e))??null}catch{return null}if(!a)return null;const o=Object.keys(s).filter(h=>{var p;return typeof((p=s[h])==null?void 0:p.getChildren)=="function"}),l=i&&i.length>0?i:null;let c=null,u=null;for(const h of o){const p=s[h];if(!(p!=null&&p.getChildren))continue;const y=typeof p.time=="function"?p.time():null;for(const m of p.getChildren(!0)){if(!m.vars||!iB(m,a))continue;const v=typeof m.duration=="function"?m.duration():0,b=!(v>0);if(!(n==="set"?!b:b)){if(l){(n==="set"?rnt(m.vars,l):int(m.vars,l))?u===null&&(u={tween:m,timeline:p}):c===null&&(c={tween:m,timeline:p});continue}if(c===null&&(c={tween:m,timeline:p}),n==="keyframe"&&y!=null){const w=typeof m.startTime=="function"?m.startTime():0;if(y>=w-.001&&y<=w+v+.001)return{tween:m,timeline:p}}}}}return u??c}function I1e(t,e){return t.keyframes.some(n=>e.some(r=>n.properties[r]!=null))}function jR(t,e,n,r){var l;const i=M3(t);if(!i)return null;let s=null;try{s=((l=t==null?void 0:t.contentDocument)==null?void 0:l.querySelector(e))??null}catch{return null}if(!s)return null;const a=Object.keys(i).filter(c=>{var u;return typeof((u=i[c])==null?void 0:u.getChildren)=="function"});if(a.length===0)return null;let o=null;for(const c of a){const u=i[c];if(!(u!=null&&u.getChildren))continue;const f=typeof u.time=="function"?u.time():null;for(const h of u.getChildren(!0)){if(!h.vars||!iB(h,s))continue;const p=typeof h.duration=="function"?h.duration():0;if(nB(p))continue;const y=rB(h.vars);if(y&&!(r&&!I1e(y,r))&&(o===null&&(o=y),f!=null)){const m=typeof h.startTime=="function"?h.startTime():0;if(f>=m-.001&&f<=m+p+.001)return y}}}return o}function qS(t,e,n,r){var l;const i=M3(t);if(!i)return!1;const s=Object.keys(i).find(c=>{var u;return typeof((u=i[c])==null?void 0:u.getChildren)=="function"});if(!s)return!1;const a=i[s];if(!(a!=null&&a.getChildren))return!1;let o=null;try{o=((l=t==null?void 0:t.contentDocument)==null?void 0:l.querySelector(e))??null}catch{return!1}if(!o)return!1;for(const c of a.getChildren(!0)){if(!c.vars||!iB(c,o))continue;const u=typeof c.duration=="function"?c.duration():0;if(nB(u))continue;const f=rB(c.vars);if(f&&(!r||I1e(f,r)))return!0}return!1}function ant(t,e,n,r){return!r||r.duration<=0?t:t.map(i=>{const s=RL(e,n,i.percentage);return{...i,percentage:Math.round((s-r.start)/r.duration*1e5)/1e3}})}function ont(t,e,n,r){return{keyframes:ant(t.keyframes,e,n,r),tweenStart:e,tweenDuration:n,...t.easeEach?{easeEach:t.easeEach}:{},...t.arcPath?{arcPath:t.arcPath}:{}}}function lnt(t,e,n){if(!e.targets||!e.vars)return;const{start:r,duration:i}=nnt(e);if(nB(i))return;const s=rB(e.vars);if(s)for(const a of e.targets()){const o=a.id;o&&!t.has(o)&&t.set(o,ont(s,r,i,n==null?void 0:n.get(o)))}}function _1e(t,e){const n=new Map,r=M3(t);if(!r)return n;for(const i of Object.values(r))if(i!=null&&i.getChildren)for(const s of i.getChildren(!0))lnt(n,s,e);return n}const cnt=["x","y","rotation","rotationX","rotationY","rotationZ","z","transformPerspective","scaleX","scaleY","scale","opacity"];function unt(t){const e={};for(const[n,r]of Object.entries(t)){if(typeof r!="number"||!Number.isFinite(r))return null;e[n]=r}return Object.keys(e).length>0?e:null}function fnt(t,e,n){var r,i;try{const s=(r=t.contentWindow)==null?void 0:r.gsap,a=((i=t.contentDocument)==null?void 0:i.querySelector(e))??null,o=unt(n);return!(s!=null&&s.set)||!a||!o?!1:(s.set(a,o),!0)}catch{return!1}}function hnt(t){var e;try{return((e=t.contentWindow)==null?void 0:e.__player)??null}catch{return null}}function dnt(t){if(t.length===0)return!1;for(const e of t){if(!e||typeof e!="object")return!1;for(const n of Object.values(e))if(typeof n!="number"||!Number.isFinite(n))return!1}return!0}function pnt(t,e){const n=t.vars;if(!n||"motionPath"in n)return!1;let r=!1;for(const i of cnt){const s=e[i];if(s!==void 0){if(typeof s!="number"||!Number.isFinite(s)||typeof n[i]=="string")return!1;n[i]=s,r=!0}}return r}function mnt(t,e){const n=t.vars;return!n||"motionPath"in n||!Array.isArray(n.keyframes)||!dnt(e)?!1:(n.keyframes=e.map(r=>({...r})),!0)}function gnt(t,e,n){const r={};for(const[s,a]of Object.entries(t))r[s]={...a};let i=null;for(const s of Object.keys(r)){const a=parseFloat(s);if(Number.isFinite(a)&&Math.abs(a-e)<.05){i=s;break}}return i===null&&(i=`${e}%`),r[i]={...r[i]??{},...n},r}function ynt(t,e,n){var u;const r=t.vars;if(!r||"motionPath"in r)return!1;const i=r.keyframes;if(!i||typeof i!="object"||Array.isArray(i))return!1;for(const f of Object.values(n))if(typeof f!="number"||!Number.isFinite(f))return!1;const s=t.parent,a=(u=t.targets)==null?void 0:u.call(t);if(!(s!=null&&s.to)||!a||a.length===0||typeof t.startTime!="function"||typeof t.kill!="function")return!1;const o=gnt(i,e,n),l={...r,keyframes:o},c=t.startTime();return t.kill(),s.to(a,l,c),!0}function xnt(t){if(t.kind==="set")return Object.keys(t.props).filter(e=>t.props[e]!==void 0);if(t.kind==="keyframe-rebuild")return Object.keys(t.props)}function bnt(t,e){var i;const n=hnt(t),r=typeof(n==null?void 0:n.getTime)=="function"?n.getTime():typeof e.time=="function"?e.time():0;(i=n==null?void 0:n.seek)==null||i.call(n,Number.isFinite(r)?r:0)}function vnt(t){return t.kind==="set"||t.kind==="global-set"?t.props.opacity!==void 0:t.kind==="keyframes"?t.keyframes.some(e=>"opacity"in e):"opacity"in t.props}function Ant(t){const e=typeof t.targets=="function"?t.targets():[];for(const n of e??[]){const r=n;if(!(r!=null&&r.style)||typeof r.getAttribute!="function")continue;const i=yhe(r);i!==null&&xhe(r.style,i)}}function Snt(t,e){return e.kind==="set"?pnt(t,e.props):e.kind==="keyframes"?mnt(t,e.keyframes):e.kind==="keyframe-rebuild"?ynt(t,e.pct,e.props):!1}function wnt(t,e,n,r,i=!1){var s;if(!t)return!1;if(n.kind==="global-set")return fnt(t,e,n.props);try{const a=snt(t,e,n.kind==="set"?"set":"keyframe",r,xnt(n));if(!a)return!1;const{tween:o,timeline:l}=a;return vnt(n)&&Ant(o),Snt(o,n)?(n.kind!=="keyframe-rebuild"&&((s=o.invalidate)==null||s.call(o)),i||bnt(t,l),!0):!1}catch{return!1}}function Ont(){const t=new Map;return function(n,r){const s=(t.get(n)??Promise.resolve()).then(r,r);return t.set(n,s),s.then(()=>{t.get(n)===s&&t.delete(n)},()=>{t.get(n)===s&&t.delete(n)}),s}}function Cnt({projectIdRef:t,activeCompPath:e,commitMutation:n,commitMutationSafely:r,showToast:i,sdkSession:s,sdkDeps:a}){const o=x.useCallback(async(p,y,m)=>{if(s&&a){const v=p.sourceFile||e||"index.html",b=await zp(v,{kind:"set",animationId:y,properties:m},s,a,{label:"Edit GSAP animation",coalesceKey:`gsap:${y}:meta`});if(Ri(b))return}r(p,{type:"update-meta",animationId:y,updates:m},{label:"Edit GSAP animation",coalesceKey:`gsap:${y}:meta`,softReload:!0})},[r,e,s,a]),l=x.useCallback(async(p,y)=>{if(s&&a){const m=p.sourceFile||e||"index.html",v=await zp(m,{kind:"remove",animationId:y},s,a,{label:"Delete GSAP animation"});if(Ri(v))return}r(p,{type:"delete",animationId:y,stripStudioEdits:!0},{label:"Delete GSAP animation"})},[r,e,s,a]),c=x.useCallback(async(p,y)=>{if(s&&a){const m=p.sourceFile||e||"index.html",v=await SJe(m,y,s,a,{label:"Delete all animations for element"});if(Ri(v))return}n(p,{type:"delete-all-for-selector",targetSelector:y},{label:"Delete all animations for element",softReload:!0})},[n,e,s,a]),u=x.useCallback(async(p,y,m)=>{var N,_;const{selector:v,autoId:b}=Rtt(p);if(b){const I=t.current,j=p.sourceFile||e||"index.html";if(!I||!await jtt({projectId:I,targetPath:j,selection:p,autoId:b,showToast:i}))return}const w=Number.parseFloat(((N=p.dataAttributes)==null?void 0:N.start)??"0")||0,O=Number.parseFloat(((_=p.dataAttributes)==null?void 0:_.duration)??"1")||1,k=Xt(w),E=Xt(O),T={from:{opacity:0},to:{x:0,y:0,opacity:1},set:{opacity:1},fromTo:{x:0,y:0,opacity:1}};if(!b&&p.hfId&&s&&a){const I=p.sourceFile||e||"index.html",j={method:y,position:k,...y!=="set"?{duration:E,ease:"power2.out"}:{},properties:T[y]??{opacity:1},...y==="fromTo"?{fromProperties:{opacity:0}}:{}},L=await zp(I,{kind:"add",target:p.hfId,spec:j},s,a,{label:`Add GSAP ${y} animation`});if(Ri(L))return}await n(p,{type:"add",targetSelector:v,method:y,position:k,duration:y==="set"?void 0:E,ease:y==="set"?void 0:"power2.out",properties:T[y]??{opacity:1},fromProperties:y==="fromTo"?{opacity:0}:void 0},{label:`Add GSAP ${y} animation`})},[e,n,t,i,s,a]),f=x.useCallback(async(p,y,m,v,b,w,O="Add animation with keyframes")=>{if(s&&a){const k=p.sourceFile||e||"index.html",E=await EJe(k,y,m,v,b,w,s,a,{label:O});if(Ri(E))return}n(p,{type:"add-with-keyframes",targetSelector:y,position:m,duration:v,keyframes:b,...w?{ease:w}:{}},{label:O,softReload:!0})},[n,e,s,a]),h=x.useCallback(async(p,y,m,v,b,w,O,k="Replace animation with keyframes")=>{if(s&&a){const E=p.sourceFile||e||"index.html",T=await TJe(E,y,m,v,b,w,O,s,a,{label:k});if(Ri(T))return}n(p,{type:"replace-with-keyframes",animationId:y,targetSelector:m,position:v,duration:b,keyframes:w,...O?{ease:O}:{}},{label:k,softReload:!0})},[n,e,s,a]);return{updateGsapMeta:o,deleteGsapAnimation:l,deleteAllForSelector:c,addGsapAnimation:u,addWithKeyframes:f,replaceWithKeyframes:h}}function knt(t){const e=x.useCallback((i,s,a)=>{t(i,{type:"set-arc-path",animationId:s,...a},{label:a.enabled?"Enable arc path":"Disable arc path",softReload:!0})},[t]),n=x.useCallback((i,s,a,o)=>{t(i,{type:"update-arc-segment",animationId:s,segmentIndex:a,...o},{label:"Update arc segment",softReload:!0})},[t]),r=x.useCallback((i,s)=>{t(i,{type:"remove-arc-path",animationId:s},{label:"Remove arc path",softReload:!0})},[t]);return{setArcPath:e,updateArcSegment:n,removeArcPath:r}}async function Ent(t){const e=t.apply();try{await t.persist()}catch{t.rollback(e)}}async function Tnt(t,e,n,r,i){const s=vc(t);if(!s)return;const a=CDe(e,n,s);if(a){const o=Nce(e,a);if(o===null)return;!!a.keyframes&&a.keyframes.keyframes.length>0||await i(t,{type:"convert-to-keyframes",animationId:a.id},{label:"Convert to keyframes",skipReload:!0});const c={};for(const u of Object.keys(r))c[u]=Pg[u]??0;await i(t,{type:"add-keyframe",animationId:a.id,percentage:o,properties:r,backfillDefaults:c},{label:`Add keyframe at ${va(e)}s`,coalesceKey:`keyframe:${a.id}:${o}`,softReload:!0})}else{const o=Ec(t);if(!o)return;await i(t,{type:"add-with-keyframes",targetSelector:o,position:e,duration:.5,keyframes:[{percentage:0,properties:r},{percentage:100,properties:r}]},{label:`New animation at ${va(e)}s`,softReload:!0})}}function aK(t){return Ent({apply:()=>{const e=Ytt(t.sourceFile,t.elementId);return e&&sK(t.sourceFile,t.elementId,t.apply(e)),e},persist:t.persist,rollback:e=>{sK(t.sourceFile,t.elementId,e)}})}function EN(t,e){return{label:t,coalesceKey:e==null?void 0:e.coalesceKey,coalesceMs:e==null?void 0:e.coalesceMs,skipRefresh:e==null?void 0:e.skipReload}}function Pnt({activeCompPath:t,commitMutation:e,commitMutationSafely:n,trackGsapSaveFailure:r,sdkSession:i,sdkDeps:s}){const a=x.useCallback((y,m,v,b,w)=>{const O=y.sourceFile||t||"index.html",k={type:"add-keyframe",animationId:m,percentage:v,properties:{[b]:w}};aK({sourceFile:O,elementId:y.id,apply:E=>{const T=E.keyframes.findIndex(N=>Math.abs((N.tweenPercentage??N.percentage)-v)<=2);if(T>=0){const N=E.keyframes.slice();return N[T]={...N[T],properties:{...N[T].properties,[b]:w}},{...E,keyframes:N}}return{...E,keyframes:[...E.keyframes,{percentage:v,properties:{[b]:w}}].sort((N,_)=>N.percentage-_.percentage)}},persist:async()=>{if(i&&s){const E=await MY(O,m,v,{[b]:w},i,s,{label:`Add keyframe at ${v}%`,coalesceKey:`gsap:${m}:kf:${v}`});if(Ri(E))return}await e(y,k,{label:`Add keyframe at ${v}%`,softReload:!0})}}).catch(E=>{r(E,y,k,`Add keyframe at ${v}%`)})},[t,e,r,i,s]),o=x.useCallback(async(y,m,v,b,w)=>{if(i&&s){const O=y.sourceFile||t||"index.html",k=await MY(O,m,v,b,i,s,EN(`Add keyframe at ${v}%`,w));if(Ri(k))return}return e(y,{type:"add-keyframe",animationId:m,percentage:v,properties:b},{label:`Add keyframe at ${v}%`,softReload:!0,...w})},[e,t,i,s]),l=x.useCallback((y,m,v,b)=>{const w=y.sourceFile||t||"index.html",O={type:"remove-keyframe",animationId:m,percentage:v};aK({sourceFile:w,elementId:y.id,apply:k=>({...k,keyframes:k.keyframes.filter(E=>Math.abs((E.tweenPercentage??E.percentage)-v)>2)}),persist:async()=>{const k=`Remove keyframe at ${v}%`;if(i&&s){const T=await vJe(w,m,v,i,s,EN(k,b));if(Ri(T))return}const E=b!=null&&b.skipReload?{label:k,...b}:{label:k,softReload:!0,...b};await e(y,O,E)}}).catch(k=>{r(k,y,O,`Remove keyframe at ${v}%`)})},[t,e,r,i,s]),c=x.useCallback(async(y,m,v,b)=>{const w={type:"move-keyframe",animationId:m,fromPercentage:v,toPercentage:b};try{let O=!1;return await e(y,w,{label:`Move keyframe to ${b}%`,softReload:!0,onResult:k=>{O=k.changed!==!1}}),O}catch(O){return r(O,y,w,`Move keyframe to ${b}%`),!1}},[e,r]),u=x.useCallback(async(y,m,v,b,w)=>{const O={type:"resize-keyframed-tween",animationId:m,position:v,duration:b,pctRemap:w};try{let k=!1;return await e(y,O,{label:"Retime keyframe (resize tween)",softReload:!0,onResult:E=>{k=E.changed!==!1}}),k}catch(k){return r(k,y,O,"Retime keyframe (resize tween)"),!1}},[e,r]),f=x.useCallback(async(y,m,v,b,w={softReload:!0})=>{if(i&&s){const O=y.sourceFile||t||"index.html",k=await OJe(O,m,v,i,s,EN("Convert to keyframes",w));if(Ri(k))return}return e(y,{type:"convert-to-keyframes",animationId:m,resolvedFromValues:v,duration:b},{label:"Convert to keyframes",...w})},[e,t,i,s]),h=x.useCallback(async(y,m)=>{var w;const v=y.sourceFile||t||"index.html",b=y.id||((w=y.element)==null?void 0:w.id);if(i&&s){const O=await wJe(v,m,i,s,{label:"Remove all keyframes"});if(Ri(O)){b&&RR(v,b);return}}await n(y,{type:"remove-all-keyframes",animationId:m},{label:"Remove all keyframes",softReload:!0,onResult:O=>{O.changed!==!1&&b&&RR(v,b)}})},[n,t,i,s]),p=x.useCallback((y,m,v,b)=>Tnt(y,m,v,b,e),[e]);return{addKeyframe:a,addKeyframeBatch:o,removeKeyframe:l,moveKeyframe:c,resizeKeyframedTween:u,convertToKeyframes:f,removeAllKeyframes:h,commitKeyframeAtTime:p}}const Mnt=150;function b8(t,e,n,r){try{const i=eC(t.serialize());if(!i)return{...n};const s=wDe(i).animations.find(o=>o.id===e);return s?{...r==="from"?s.fromProperties??{}:s.properties,...n}:{...n}}catch{return{...n}}}function Nnt(t,e){const n=x.useRef(null),r=x.useRef(null),i=x.useRef(e);i.current=e;const s=x.useCallback(async()=>{var k,E;const p=n.current;if(!p)return;n.current=null;const{selection:y,animationId:m,property:v,value:b}=p,w={type:"update-property",animationId:m,property:v,value:b},O=`Edit GSAP ${v}`;try{const{sdkSession:T,sdkDeps:N,activeCompPath:_}=i.current??{};if(T&&N){const I=y.sourceFile||_||"index.html",j=await zp(I,{kind:"set",animationId:m,properties:{properties:b8(T,m,{[v]:b},"to")}},T,N,{label:O,coalesceKey:`gsap:${m}:${v}`});if(Ri(j))return}await t(y,w,{label:O,coalesceKey:`gsap:${m}:${v}`,softReload:!0})}catch(T){(E=(k=i.current)==null?void 0:k.onFlushError)==null||E.call(k,T,y,w,O)}},[t]),a=x.useCallback((p,y,m,v)=>{n.current={selection:p,animationId:y,property:m,value:v},r.current&&clearTimeout(r.current),r.current=setTimeout(()=>{s()},Mnt)},[s]);x.useEffect(()=>()=>{r.current&&clearTimeout(r.current),s()},[s]);const o=x.useCallback(async(p,y,m)=>{var E;let v=Pg[m]??0;const b=p.element;if(m==="width"||m==="height"){const T=b.getBoundingClientRect();v=Math.round(m==="width"?T.width:T.height)}else if(m==="opacity"||m==="autoAlpha"){const T=(E=b.ownerDocument.defaultView)==null?void 0:E.getComputedStyle(b),N=T?Number.parseFloat(T.opacity):Number.NaN;v=Number.isFinite(N)?N:1}const{sdkSession:w,sdkDeps:O,activeCompPath:k}=i.current??{};if(w&&O){const T=p.sourceFile||k||"index.html",N=await zp(T,{kind:"set",animationId:y,properties:{properties:b8(w,y,{[m]:v},"to")}},w,O,{label:`Add GSAP ${m}`});if(Ri(N))return}t(p,{type:"add-property",animationId:y,property:m,defaultValue:v},{label:`Add GSAP ${m}`})},[t]),l=x.useCallback(async(p,y,m,v)=>{const{sdkSession:b,sdkDeps:w,activeCompPath:O}=i.current??{};if(b&&w){const k=p.sourceFile||O||"index.html",E=await AJe(k,y,m,v,b,w,{label:`Remove GSAP ${v?`from-${m}`:m}`});if(Ri(E))return}v?t(p,{type:"remove-from-property",animationId:y,property:m},{label:`Remove GSAP from-${m}`}):t(p,{type:"remove-property",animationId:y,property:m},{label:`Remove GSAP ${m}`})},[t]),c=x.useCallback((p,y,m)=>l(p,y,m,!1),[l]),u=x.useCallback(async(p,y,m,v)=>{const{sdkSession:b,sdkDeps:w,activeCompPath:O}=i.current??{};if(b&&w){const k=p.sourceFile||O||"index.html",E=await zp(k,{kind:"set",animationId:y,properties:{fromProperties:b8(b,y,{[m]:v},"from")}},b,w,{label:`Edit GSAP from-${m}`,coalesceKey:`gsap:${y}:from:${m}`});if(Ri(E))return}t(p,{type:"update-from-property",animationId:y,property:m,value:v},{label:`Edit GSAP from-${m}`,coalesceKey:`gsap:${y}:from:${m}`})},[t]),f=x.useCallback(async(p,y,m)=>{const v=Pg[m]??0,{sdkSession:b,sdkDeps:w,activeCompPath:O}=i.current??{};if(b&&w){const k=p.sourceFile||O||"index.html",E=await zp(k,{kind:"set",animationId:y,properties:{fromProperties:b8(b,y,{[m]:v},"from")}},b,w,{label:`Add GSAP from-${m}`});if(Ri(E))return}t(p,{type:"add-from-property",animationId:y,property:m,defaultValue:v},{label:`Add GSAP from-${m}`})},[t]),h=x.useCallback((p,y,m)=>l(p,y,m,!0),[l]);return{updateGsapProperty:a,addGsapProperty:o,removeGsapProperty:c,updateGsapFromProperty:u,addGsapFromProperty:f,removeGsapFromProperty:h}}function Dnt(t){return typeof t.type=="string"?t.type:"gsap"}function R1e(t){return x.useCallback((e,n,r,i)=>{X0({source:"gsap_commit",error:e,filePath:n.sourceFile??t??"index.html",mutationType:Dnt(r),label:i,targetId:n.id,targetSelector:n.selector,targetSourceFile:n.sourceFile})},[t])}function j1e(t,e,n){return x.useCallback((r,i,s)=>t(r,i,s).catch(a=>{e(a,r,i,s.label),n==null||n(`Couldn't save animation: ${Nu(a)}`,"error")}),[t,e,n])}async function Int(t,e,n){const r=await fetch(`/api/projects/${encodeURIComponent(t)}/gsap-mutations/${encodeURIComponent(e)}`,{method:"POST",headers:{"Content-Type":"application/json",...Zl()},body:JSON.stringify(n)});if(!r.ok)throw new E3(r.status,await tB(r));const i=await r.json();if(!i.ok)throw new Error(`Failed to update GSAP in ${e}`);return i}async function _nt(t,e,n){const r=await fetch(`/api/projects/${encodeURIComponent(t)}/gsap-mutations-batch/${encodeURIComponent(e)}`,{method:"POST",headers:{"Content-Type":"application/json",...Zl()},body:JSON.stringify({mutations:n})});if(!r.ok)throw new E3(r.status,await tB(r));const i=await r.json();if(!i.ok)throw new Error(`Failed to update GSAP in ${e}`);return i}function Rnt(t,e,n){var r;e.changed!==!1||t.length!==1||((r=t[0])==null?void 0:r.type)==="move-keyframe"&&(n==null||n("A keyframe already exists at that time","info"))}async function oK(t,e,n,r){const i=t.flatMap(s=>LC(s));if(i.length>0){if(n==null||n("Couldn't read element layout — try again at a different playhead time","error"),e.skipReload)return;throw GX(new Error(`Mutation contains unsafe values: ${i.map(s=>s.path).join(", ")}`))}try{const s=await r();return Rnt(t,s,n),s}catch(s){if(s instanceof E3&&(n==null||n(k1e(s),"error"),GX(s)),e.skipReload)return;throw s}}function jnt(t,e,n,r){var i;return e.changed!==!1?!1:(!n.skipReload&&($1e(n).length>0||(i=n.previewFallbackLatch)!=null&&i.pending)&&F1e(t,e,n,r),!0)}function Lnt(t,e,n,r,i){var s;(s=n.beforeReload)==null||s.call(n),F1e(t,e,n,r),i()}function lK(t,e,n,r){return t.current===n&&e.current===r}function Fnt({iframe:t,selection:e,mutation:n,targetPath:r,result:i,options:s,onFileContentChanged:a,forceReloadSdkSession:o,reloadPreview:l,onCacheInvalidate:c}){var u;i.after!=null&&(a==null||a(r,i.after)),o==null||o(),!s.skipReload&&((u=i.parsed)!=null&&u.animations&&Ztt(i.parsed.animations,r,e.id??void 0,n,t==null?void 0:t.contentDocument),Lnt(t,i,s,l,c))}function L1e(t,e,n,r,i){const s=ue.getState().currentTime,a=bF(t,e,{onAsyncFailure:n,currentTimeOverride:s,authoredHtml:i});a!=="applied"&&(Pt("gsap_soft_reload_outcome",{origin:r,result:a,escalated:a==="cannot-soft-reload"}),a==="cannot-soft-reload"&&n())}function F1e(t,e,n,r){var a;const i=$1e(n);let s=((a=n.previewFallbackLatch)==null?void 0:a.pending)===!0;if(i.length>0){const o=n.deferPreviewSync===!0,l=i.find((c,u)=>!wnt(t,c.selector,c.change,void 0,o||u{W.before==null||W.after==null||await r.recordEdit({label:J.label,kind:"manual",coalesceKey:J.coalesceKey,coalesceMs:J.coalesceMs,files:{[Y]:{before:W.before,after:W.after}}})},[r]),b=x.useCallback(async(Y,W,J,ne,le,ie,q)=>{if(t.current!==Y)return;const F=lK(t,y,Y,W);if(ie.changed===!1){F&&jnt(n.current,ie,q,s);return}F&&(i.current=Date.now()),await v(le,ie,q),lK(t,y,Y,W)&&Fnt({iframe:n.current,selection:J,mutation:ne,targetPath:le,result:ie,options:q,onFileContentChanged:o,forceReloadSdkSession:h,reloadPreview:s,onCacheInvalidate:a})},[t,n,i,s,a,o,h,v]),w=x.useCallback(async(Y,W,J,ne,le,ie)=>{var F;const q=await oK([le],ie,l,()=>Int(Y,J,le));q&&((F=ie.onResult)==null||F.call(ie,q),await b(Y,W,ne,le,J,q,ie))},[l,b]),O=x.useCallback(async(Y,W,J,ne,le)=>{var re;const ie=ne[0],q=ne.at(-1);if(!ie||!q)return;const F=ne.map(({mutation:Q})=>Q),U=await oK(F,le,l,()=>_nt(Y,J,F));if(!U)return;(re=le.onResult)==null||re.call(le,U);const Z=ne.map(({options:Q})=>Q.instantPatch).filter(Q=>Q!==void 0),{instantPatch:K,...ee}=le;await b(Y,W,q.selection,q.mutation,J,U,Z.length>0?{...ee,instantPatches:Z}:ee)},[l,b]),k=x.useMemo(()=>{const Y=(ne,le)=>f?wS(f,ne,le):m.current(`gsap-file:${ne}`,le),W=(ne,le,ie)=>{const q=`gsap-file:${ne}`,F=()=>Y(ne,ie);return le&&(f||le!==q)?m.current(le,F):F()},J=(ne,le,ie)=>{if(!p)return Promise.resolve();const q=ne.sourceFile||e||"index.html";return W(q,ie.serializeKey,()=>w(p,e,q,ne,le,ie))};return J.batch=(ne,le)=>{var q;if(!p)return Promise.resolve();const ie=((q=ne[0])==null?void 0:q.selection.sourceFile)||e||"index.html";return W(ie,le.serializeKey,()=>O(p,e,ie,ne,le))},J},[w,O,e,p,f]),E=R1e(e),T=x.useCallback((Y,W,J,ne)=>{E(Y,W,J,ne),cF(Y)||l==null||l(`Couldn't save animation: ${Nu(Y)}`,"error")},[l,E]),N=j1e(k,T),_=x.useCallback(Y=>{const W=eC(Y);W?L1e(n.current,W,s,"sdk_refresh",Y):s(),a()},[n,s,a]),I=x.useCallback(Y=>{if(!p)throw new Error("No active project");return fF(p,Y)},[p]),j=x.useMemo(()=>f?{editHistory:{recordEdit:r.recordEdit},writeProjectFile:f,reloadPreview:s,domEditSaveTimestampRef:i,refresh:_,compositionPath:e,readProjectFile:I,publishSession:u}:null,[r.recordEdit,f,s,i,_,e,I,u]),L=Nnt(N,{sdkSession:c,sdkDeps:j,activeCompPath:e,onFlushError:T}),B=Cnt({projectIdRef:t,activeCompPath:e,commitMutation:k,commitMutationSafely:N,showToast:l,sdkSession:c,sdkDeps:j}),$=Pnt({activeCompPath:e,commitMutation:k,commitMutationSafely:N,trackGsapSaveFailure:T,sdkSession:c,sdkDeps:j}),z=knt(N);return{commitMutation:k,...L,...B,...$,...z}}function LR(t,e,n){if(n==="opacity"&&e.getAttribute(JE)!=null&&e.id){const r=e.ownerDocument.getElementById(Lje+e.id),i=e.ownerDocument.defaultView;if(r&&i){const s=Number(i.getComputedStyle(r).opacity);if(Number.isFinite(s))return s}}return Number(t.getProperty(e,n))}function $C(t,e,n){if(!e)return null;const r=IL(t);if(!r)return null;const i=_L(t,e);if(!i)return null;try{const s=LR(r,i,n);return Number.isFinite(s)?sB.has(n)?Math.round(s):Xt(s):null}catch{return null}}const sB=new Set(["x","y","xPercent","yPercent"]),Bnt=new Set(["duration","ease","delay","stagger","id","onComplete","onUpdate","onStart","onRepeat","repeat","yoyo","repeatDelay","paused","immediateRender","lazy","overwrite","keyframes","parent"]);function SA(t,e,n,r){var v;const i={};if(!t)return i;const s=IL(t);if(!s)return i;const a=_L(t,e);if(!a)return i;let o=null;try{o=(t==null?void 0:t.contentDocument)??null}catch{}const l=new Set;if(n.keyframes)for(const b of n.keyframes.keyframes)for(const w of Object.keys(b.properties))typeof b.properties[w]=="number"&&l.add(w);else for(const b of Object.keys(n.properties))l.add(b);const c=b=>!r||rl(b)===r,u=new Set([...l].filter(c));for(const b of u){const w=LR(s,a,b);Number.isFinite(w)&&(i[b]=sB.has(b)?Math.round(w):Xt(w))}const f=new Set;try{const w=t.contentWindow.__timelines;if(w)for(const O of Object.values(w)){const k=O;if(k!=null&&k.getChildren)for(const E of k.getChildren(!0)){if(typeof E.targets!="function"||!E.targets().includes(a))continue;const N=E.vars;if(N)for(const _ of Object.keys(N))!Bnt.has(_)&&c(_)&&f.add(_)}}}catch{}for(const b of u)f.delete(b);const h={opacity:1,scale:1,scaleX:1,scaleY:1,scaleZ:1,rotation:0,rotationX:0,rotationY:0,skewX:0,skewY:0,z:0,xPercent:0,yPercent:0,transformPerspective:0,blur:0,brightness:1,contrast:1,saturate:1,hueRotate:0,grayscale:0,sepia:0,invert:0},p=new Set([...u,...f]);for(const[b,w]of Object.entries(h)){if(b in i||!p.has(b))continue;const O=LR(s,a,b);Number.isFinite(O)&&Math.round(O*1e3)!==Math.round(w*1e3)&&(i[b]=Xt(O))}const y=["borderRadius","borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius","letterSpacing","wordSpacing","lineHeight","fontSize","outlineOffset","outlineWidth","strokeDashoffset","strokeWidth","backgroundPositionX","backgroundPositionY"];let m=null;try{m=((v=o==null?void 0:o.defaultView)==null?void 0:v.getComputedStyle(a))??null}catch{}for(const b of y){if(b in i||!c(b)||f.has(b))continue;const w=Number(s.getProperty(a,b));if(!Number.isFinite(w))continue;let O=NaN;if(m){const k=m.getPropertyValue(b.replace(/[A-Z]/g,E=>`-${E.toLowerCase()}`));O=parseFloat(k)}Number.isFinite(O)&&Math.round(w*1e3)===Math.round(O*1e3)||(i[b]=Xt(w))}return i}function Fy(t,e,n){const r=t.style.getPropertyValue("--hf-studio-rotation"),s=-(Number.parseFloat(r)||0)*Math.PI/180,a=Math.cos(s),o=Math.sin(s),l=Number.parseFloat(t.getAttribute("data-hf-drag-initial-offset-x")??"")||0,c=Number.parseFloat(t.getAttribute("data-hf-drag-initial-offset-y")??"")||0,u=e.x-l,f=e.y-c,h=u*a-f*o,p=u*o+f*a,y=Number.parseFloat(t.getAttribute("data-hf-drag-gsap-base-x")??""),m=Number.parseFloat(t.getAttribute("data-hf-drag-gsap-base-y")??""),v=Number.isFinite(y)?y:n.x,b=Number.isFinite(m)?m:n.y;return{newX:Math.round(v+h),newY:Math.round(b+p),baseGsapX:v,baseGsapY:b}}let Vnt=0;const B1e=new WeakSet;function Hnt(t){return B1e.has(t)}function cK(t){const{x:e,y:n,width:r,height:i}=t.getBoundingClientRect();return{x:e,y:n,width:r,height:i}}function Qnt(t,e,n){const{coalesceKey:r,skipReload:i,softReload:s,...a}=t;return s?{...a,label:n,softReload:!0,coalesceKey:e,coalesceMs:Number.POSITIVE_INFINITY}:{...a,label:n,skipReload:!0,coalesceKey:e,coalesceMs:Number.POSITIVE_INFINITY}}function znt(t,e){return{x:e.x-t.x,y:e.y-t.y,width:e.width-t.width,height:e.height-t.height}}function Znt(t){return Object.values(t).some(e=>Math.abs(e)>1)}function v8(t){return Math.round(t*10)/10}function Gnt(t){var a;const e=t.find(({options:o})=>o.softReload),n=(e==null?void 0:e.options)??((a=t.at(-1))==null?void 0:a.options);if(!n)throw new Error("Cannot merge an empty gesture transaction");const{skipReload:r,instantPatch:i,...s}=n;return e?{...s,softReload:!0}:{...s,skipReload:!0}}function TN(t){return t.filter(({options:e})=>e.softReload).length}async function Unt(t){const e=t[0];if(!e)return 0;if(t.length===1)return await e.dispatch(e.selection,e.mutation,e.options),TN(t);if(t.every(({dispatch:r,selection:i})=>r===e.dispatch&&i.sourceFile===e.selection.sourceFile)&&e.dispatch.batch)return await e.dispatch.batch(t.map(({selection:r,mutation:i,options:s})=>({selection:r,mutation:i,options:s})),Gnt(t)),TN(t)>0?1:0;for(const{dispatch:r,selection:i,mutation:s,options:a}of t)await r(i,s,a);return TN(t)}const ub=W0("commit");function V1e(t){const e=performance.now(),n=`tx:${t.label}:${++Vnt}`;let r=0,i=0;const s=[];ub("start",{label:t.label,coalesceKey:n}),t.settle(),ub("settled",{label:t.label,coalesceKey:n});const a=t.skipPixelAssert?null:cK(t.element),o=l=>{const c=(u,f,h)=>(r+=1,s.push({dispatch:l,selection:u,mutation:f,options:Qnt(h,n,t.label)}),Promise.resolve());return B1e.add(c),c};return t.persist(o).then(async()=>{i=await Unt(s);const l=Math.round(performance.now()-e);if(ub("persisted",{label:t.label,coalesceKey:n}),a){const c=cK(t.element),u=znt(a,c);Znt(u)&&(ub("persist-changed-pixels",{label:t.label,before:a,after:c,delta:u}),Pt("commit_invariant_violation",{label:t.label,delta_x:v8(u.x),delta_y:v8(u.y),delta_w:v8(u.width),delta_h:v8(u.height),mutation_count:r,reload_count:i,duration_ms:l}))}Pt("commit_transaction",{label:t.label,mutation_count:r,reload_count:i,duration_ms:l,pixel_asserted:a!==null})}).catch(l=>{throw t.restore(),Pt("commit_transaction_failed",{label:t.label,mutation_count:r,error_name:l instanceof Error?l.name:"unknown",restore_ran:!0}),ub("restore",{label:t.label,coalesceKey:n}),l})}function Xnt(t,e,n=!1){const r={[e.property]:e.value};return{selector:t,change:{kind:n?"global-set":"set",props:r}}}function Wnt(t,e,n){return t.find(r=>r.method==="set"&&vy(r.targetSelector,e,n)&&("x"in r.properties||"y"in r.properties))??null}function H1e(t,e,n){const r=Wnt(t,e,n);return r||(t.find(i=>vy(i.targetSelector,e,n)&&i.propertyGroup==="position"&&Xo(i))??null)}function qnt(t,e,n){return t.find(r=>Xo(r)&&vy(r.targetSelector,e,n)&&"rotation"in r.properties)??null}function uK(t,e,n){return t.find(r=>Xo(r)&&vy(r.targetSelector,e,n)&&("width"in r.properties||"height"in r.properties))??null}const Ynt={"no-selector":"This layer needs a stable selector before Studio can save the edit.","unroll-required":"This motion comes from a helper or loop. Choose Unroll to edit it explicitly.","source-uneditable":"This animation is computed at runtime. Edit the animation in the Code tab."};class Vl extends Error{constructor(e){super(Ynt[e]),this.reason=e,this.name="GsapEditBlockedError"}}function Ip(t){if(t.status==="blocked")throw new Vl(t.reason)}function Knt(t){const e=Noe(t.provenance);if(e==="unroll")throw new Vl("unroll-required");if(e==="source"||t.hasUnresolvedKeyframes||t.hasUnresolvedSelector)throw new Vl("source-uneditable")}function FR(t){return t instanceof Vl}function BC(t,e){var n;return Object.keys(t.properties??{}).some(r=>e.has(r))||Object.keys(t.fromProperties??{}).some(r=>e.has(r))||!!((n=t.keyframes)!=null&&n.keyframes.some(r=>Object.keys(r.properties).some(i=>e.has(i))))}function N3(t,e){try{for(const n of t)BC(n,e)&&Knt(n);return{status:"persisted"}}catch(n){if(FR(n))return{status:"blocked",reason:n.reason};throw n}}function YS(t){return Ec(t)}function D0(t,e){return bS(ue.getState().currentTime,t,e)}function wA(t,e){const n=ai(t),r=Yi(t);n==null||!r||r<=0||ue.getState().requestSeek(Xt(n+e/100*r))}async function Jnt(t,e,n,r){const i=YS(t);if(!i)throw new Vl("no-selector");const s=async a=>{await a(t,{type:"add",targetSelector:i,method:"set",position:0,properties:n,global:!0},{label:"Move layer",skipReload:!0}),await a(t,{type:"delete",animationId:e.id},{label:"Move layer",softReload:!0})};if(Hnt(r)){await s(r);return}await V1e({element:t.element,label:"Move layer",settle:()=>{},persist:async a=>s(a(r)),restore:()=>{}})}async function KS(t,e,n,r){if(!(!t.hasUnresolvedKeyframes&&!t.hasUnresolvedSelector))throw new Vl("source-uneditable")}async function Q1e(t,e,n,r,i,s){const{newX:a,newY:o}=Fy(t.element,e,n);if(i){if(i.keyframes){await Jnt(t,i,{x:a,y:o},s.commitMutation);return}const c={type:"update-properties",animationId:i.id,properties:{x:a,y:o}},u=!!i.global;await s.commitMutation(t,c,{label:"Move layer",softReload:!0,instantPatch:{selector:r,change:{kind:u?"global-set":"set",props:c.properties}}});return}const l=YS(t);if(!l)throw new Vl("no-selector");await s.commitMutation(t,{type:"add",targetSelector:l,method:"set",position:0,properties:{x:a,y:o},global:!0},{label:"Move layer",softReload:!0,instantPatch:{selector:l,change:{kind:"global-set",props:{x:a,y:o}}}})}async function ert(t,e,n,r,i){if(r){const a={type:"update-property",animationId:r.id,property:"rotation",value:e};await i.commitMutation(t,a,{label:"Rotate layer",softReload:!0,instantPatch:Xnt(n,a,!!r.global)});return}const s=YS(t);if(!s)throw new Vl("no-selector");await i.commitMutation(t,{type:"add",targetSelector:s,method:"set",position:0,properties:{rotation:e},global:!0},{label:"Rotate layer",softReload:!0,instantPatch:{selector:s,change:{kind:"global-set",props:{rotation:e}}}})}async function trt(t,e,n,r,i){const s=Math.round(e.width),a=Math.round(e.height);if(r){await i.commitMutation(t,{type:"update-properties",animationId:r.id,properties:{width:s,height:a}},{label:"Resize layer",softReload:!0});return}const o=YS(t);if(!o)throw new Vl("no-selector");await i.commitMutation(t,{type:"add",targetSelector:o,method:"set",position:0,properties:{width:s,height:a}},{label:"Resize layer",softReload:!0})}function A8(t,e){return Number.isFinite(t)&&t>0?Math.round(t):e}function nrt(t,e,n,r){if(t)return{width:A8(Number(t.properties.width),n),height:A8(Number(t.properties.height),r)};const i=Number.parseFloat((e==null?void 0:e.getAttribute(Cy))??""),s=Number.parseFloat((e==null?void 0:e.getAttribute(ky))??"");return{width:A8(i,n),height:A8(s,r)}}async function rrt(t,e,n,r,i,s){var b;const a=ai(i)??0,o=Yi(i);if(!(o>0))return!1;const l=Math.round(e.width),c=Math.round(e.height),u=nrt(r,t.element,l,c),f=ue.getState().currentTime,h=Math.max(0,Math.min(100,Math.round((f-a)/o*1e3)/10)),p=new Set(((b=i.keyframes)==null?void 0:b.keyframes.map(w=>w.percentage))??[0,100]);p.add(0),p.add(100),p.add(h);const y=Array.from(p).sort((w,O)=>w-O).map(w=>({percentage:w,properties:Math.abs(w-h)<.05?{width:l,height:c}:{...u}})),m=`Resize (size keyframe ${h.toFixed(0)}%)`,v=YS(t);return v?(await s.commitMutation(t,{type:"add-with-keyframes",targetSelector:v,position:Xt(a),duration:Xt(o),keyframes:y},r?{label:m,skipReload:!0}:{label:m,softReload:!0}),r&&await s.commitMutation(t,{type:"delete",animationId:r.id},{label:"Resize layer",softReload:!0}),!0):!1}async function irt(t,e,n,r,i,s,a){var N,_;const o=t.element,{newX:l,newY:c,baseGsapX:u,baseGsapY:f}=Fy(o,n,r),h=l-u,p=c-f,y=Number.parseFloat(o.getAttribute("data-hf-drag-initial-offset-x")??"")||0,m=Number.parseFloat(o.getAttribute("data-hf-drag-initial-offset-y")??"")||0,v=()=>{o.style.setProperty("--hf-studio-offset-x",`${y}px`),o.style.setProperty("--hf-studio-offset-y",`${m}px`),o.removeAttribute("data-hf-drag-initial-offset-x"),o.removeAttribute("data-hf-drag-initial-offset-y")};let b=e;if(e.keyframes){const I=await KS(e,i,a.commitMutation);I&&(b={...e,id:I})}const w=ai(b),O=Yi(b),k=((N=b.keyframes)==null?void 0:N.easeEach)??b.ease;let E=((_=b.keyframes)==null?void 0:_.keyframes)??[];if(E.length===0){const I=b.fromProperties??{},j=b.properties??{},L=typeof I.x=="number"?I.x:(typeof j.x=="number",0),B=typeof I.y=="number"?I.y:(typeof j.y=="number",0),$=typeof j.x=="number"?j.x:L,z=typeof j.y=="number"?j.y:B;E=[{percentage:0,properties:{x:L,y:B}},{percentage:100,properties:{x:$,y:z}}]}const T=E.map(I=>({percentage:I.percentage,properties:{...I.properties,x:Xt((typeof I.properties.x=="number"?I.properties.x:0)+h),y:Xt((typeof I.properties.y=="number"?I.properties.y:0)+p)},...I.ease?{ease:I.ease}:{}}));await a.commitMutation(t,{type:"replace-with-keyframes",animationId:b.id,targetSelector:b.targetSelector,position:Xt(w??0),duration:Xt(O||1),keyframes:T,ease:k},{label:"Move animation path",softReload:!0,beforeReload:v})}function z1e(t,e,n){var r;return[...(((r=t.keyframes)==null?void 0:r.keyframes)??[]).filter(i=>Math.abs(i.percentage-e)>S0).map(i=>({percentage:i.percentage,properties:{...i.properties},...i.ease?{ease:i.ease}:{}})),{percentage:e,properties:n}].sort((i,s)=>i.percentage-s.percentage)}async function $R(t,e,n,r,i,s,a,o,l){var v;const c=i+s,u=Math.min(r,i),f=Math.max(r,c),h=Math.max(.01,f-u),p=((v=e.keyframes)==null?void 0:v.keyframes)??[],y=[];for(const b of p){const w=i+b.percentage/100*s,O=Math.round((w-u)/h*1e3)/10,k={...b.properties};for(const E of Object.keys(n))!(E in k)&&(l==null?void 0:l[E])!=null&&(k[E]=l[E]);y.push({percentage:O,properties:k})}const m=Math.round((r-u)/h*1e3)/10;y.push({percentage:m,properties:n}),y.sort((b,w)=>b.percentage-w.percentage),await a.commitMutation(t,{type:"replace-with-keyframes",animationId:e.id,targetSelector:e.targetSelector,position:Xt(u),duration:Xt(h),keyframes:y},{label:"Move layer (extended keyframe)",softReload:!0,beforeReload:o})}async function srt(t,e,n,r,i,s){const{activeKeyframePct:a,setActiveKeyframePct:o}=ue.getState(),l=D0(t,e),c=a??l;await r.commitMutation(t,{type:"add-keyframe",animationId:e.id,percentage:c,properties:n,...s?{backfillDefaults:s}:{}},{label:`Move layer (keyframe ${c}%)`,softReload:!0,beforeReload:i}),a!=null&&(o(null),wA(e,c))}function art(t,e){var o;if(!t||!e)return null;const n=t.contentWindow,r=n==null?void 0:n.gsap;if(typeof(r==null?void 0:r.getProperty)!="function"||typeof r.set!="function")return null;let i=null;try{i=((o=t.contentDocument)==null?void 0:o.querySelector(e))??null}catch{return null}if(!i)return null;const s=n==null?void 0:n.__timelines,a=s?Object.values(s)[0]:void 0;return typeof(a==null?void 0:a.seek)!="function"?null:{gsapLib:r,el:i,mainTl:a}}async function ort(t,e,n,r,i,s,a,o){const l=ue.getState().currentTime,c=ai(e),u=bf(e,t),{activeKeyframePct:f,setActiveKeyframePct:h}=ue.getState(),p=f==null&&c!==null&&u>0&&(lc+u+.01),y={},m=art(s,a);if(m&&c!==null){const{gsapLib:O,el:k,mainTl:E}=m,T={};for(const N of Object.keys(n)){const _=Number(O.getProperty(k,N));Number.isFinite(_)&&(T[N]=_)}try{O.set(k,{clearProps:Object.keys(n).join(",")}),E.seek(c);for(const N of Object.keys(n)){const _=Number(O.getProperty(k,N));Number.isFinite(_)&&(y[N]=Xt(_))}E.seek(l)}catch{for(const N of Object.keys(y))delete y[N]}finally{Object.keys(T).length>0&&O.set(k,T)}}if(p&&c!==null){const O=`gsap:convert-drag:${e.id}`;await r.commitMutation(t,{type:"convert-to-keyframes",animationId:e.id,...Object.keys(y).length>0?{resolvedFromValues:y}:{}},{label:"Convert to keyframes for drag",skipReload:!0,coalesceKey:O});const k=r.fetchAnimations?await r.fetchAnimations():[],E=k.find(_=>_.id===e.id&&_.keyframes)??k.find(_=>_.targetSelector===e.targetSelector&&_.keyframes)??e,T=ai(E)??c,N=Yi(E)||u;await $R(t,E,n,l,T,N,r,i);return}const v=`gsap:convert-drag:${e.id}`;await r.commitMutation(t,{type:"convert-to-keyframes",animationId:e.id,...Object.keys(y).length>0?{resolvedFromValues:y}:{}},{label:"Convert to keyframes for drag",skipReload:!0,coalesceKey:v});const b=f??D0(t,e),w=f!=null;w&&h(null),await r.commitMutation(t,{type:"add-keyframe",animationId:e.id,percentage:b,properties:n,...o?{backfillDefaults:o}:{}},{label:`Move layer (keyframe ${b}%)`,softReload:!0,beforeReload:i,coalesceKey:v}),w&&wA(e,b)}async function Z1e(t,e,n,r,i,s,a){var b,w;const o=t.element,{newX:l,newY:c,baseGsapX:u,baseGsapY:f}=Fy(o,n,r),h=Number.parseFloat(o.getAttribute("data-hf-drag-initial-offset-x")??"")||0,p=Number.parseFloat(o.getAttribute("data-hf-drag-initial-offset-y")??"")||0,y=()=>{o.style.setProperty("--hf-studio-offset-x",`${h}px`),o.style.setProperty("--hf-studio-offset-y",`${p}px`),o.removeAttribute("data-hf-drag-initial-offset-x"),o.removeAttribute("data-hf-drag-initial-offset-y")},m={x:u,y:f},v=ue.getState().currentTime;if((b=e.arcPath)!=null&&b.enabled){const{activeKeyframePct:O,setActiveKeyframePct:k}=ue.getState(),E=O??D0(t,e),T=((w=e.keyframes)==null?void 0:w.keyframes)??[],N=T.findIndex(L=>Math.abs(L.percentage-E)<=S0);if(N>=0){await a.commitMutation(t,{type:"update-motion-path-point",animationId:e.id,pointIndex:N,x:l,y:c},{label:"Move layer (waypoint)",softReload:!0,beforeReload:y}),k(null),wA(e,E);return}const _=ai(e),I=bf(e,t);if(_===null||I<=0||T.length<2)return;const j=z1e(e,E,{x:l,y:c});await a.commitMutation(t,{type:"replace-with-keyframes",animationId:e.id,targetSelector:e.targetSelector,position:Xt(_),duration:Xt(I),keyframes:j,ease:"none"},{label:"Move layer (new keyframe)",softReload:!0,beforeReload:y});return}if(e.keyframes){const O=await KS(e,i,a.commitMutation),k=O?{...e,id:O}:e,E={x:l,y:c},T=ai(k),N=bf(k,t),_=T!==null&&N>0&&(vT+N+.01),I=ue.getState().activeKeyframePct!=null;_&&!I?await $R(t,k,E,v,T,N,a,y,m):await srt(t,k,E,a,y,m)}else if(e.method==="from"||e.method==="fromTo"){const O=ue.getState().currentTime,k=ai(e),E=bf(e,t),N=!(ue.getState().activeKeyframePct!=null)&&k!==null&&E>0&&(Ok+E+.01),_={x:l,y:c};if(N&&k!==null){await a.commitMutation(t,{type:"split-into-property-groups",animationId:e.id},{label:"Split from() for drag",skipReload:!0});const j=(a.fetchAnimations?await a.fetchAnimations():[]).find(le=>le.propertyGroup==="position"&&le.targetSelector===e.targetSelector);if(j!=null&&j.keyframes){const le=ai(j),ie=bf(j,t);if(le!==null){await $R(t,j,{x:l,y:c},O,le,ie,a,y,m);return}}const L=Math.min(O,k),B=Math.max(O,k+E),$=Math.max(.01,B-L),z=O.5&&Y<99.5&&J.push({percentage:Y,properties:{x:0,y:0}}),J.push({percentage:100,properties:{x:0,y:0}})):(J.push({percentage:0,properties:{x:0,y:0}}),W>.5&&W<99.5&&J.push({percentage:W,properties:{x:0,y:0}}),J.push({percentage:100,properties:{x:l,y:c}})),J.sort((le,ie)=>le.percentage-ie.percentage);const ne={targetSelector:e.targetSelector,position:Xt(L),duration:Xt($),keyframes:J};await a.commitMutation(t,j?{type:"replace-with-keyframes",animationId:j.id,...ne}:{type:"add-with-keyframes",...ne},{label:"Move layer (from extended)",softReload:!0,beforeReload:y})}else{const I=`gsap:convert-drag:${e.id}`;await a.commitMutation(t,{type:"convert-to-keyframes",animationId:e.id},{label:"Convert from() for drag",skipReload:!0,coalesceKey:I});const{activeKeyframePct:j,setActiveKeyframePct:L}=ue.getState(),B=j??D0(t,e);j!=null&&L(null),await a.commitMutation(t,{type:"add-keyframe",animationId:e.id,percentage:B,properties:_,...m?{backfillDefaults:m}:{}},{label:`Move layer (keyframe ${B}%)`,softReload:!0,beforeReload:y,coalesceKey:I})}}else await ort(t,e,{x:l,y:c},a,y,i,s,m)}async function D3(t,e,n,r,i,s,a){var v,b,w;let o=e;if(e.keyframes){const O=await KS(e,i,s.commitMutation);O&&(o={...e,id:O})}const l=ai(o),c=Yi(o),u=((v=o.keyframes)==null?void 0:v.easeEach)??o.ease,f=Object.keys(n),h=(O,k)=>typeof O[k]=="number"?O[k]:Pg[k]??0,p=((b=o.keyframes)==null?void 0:b.keyframes)??((w=Ng(o))==null?void 0:w.keyframes);if(!p||p.length===0){await s.commitMutation(t,{type:"update-properties",animationId:o.id,properties:n},{label:a,softReload:!0});return}const y=p.reduce((O,k)=>Math.abs(k.percentage-r){const k={...O.properties};for(const E of f)k[E]=Xt(h(k,E)+(n[E]-h(y.properties,E)));return{percentage:O.percentage,properties:k,...O.ease?{ease:O.ease}:{}}});await s.commitMutation(t,{type:"replace-with-keyframes",animationId:o.id,targetSelector:o.targetSelector,position:Xt(l??0),duration:Xt(c||1),keyframes:m,ease:u},{label:a,softReload:!0})}function aB(t,e){const n=IL(t);if(!n)return null;const r=_L(t,e);if(!r)return null;const i=Number(n.getProperty(r,"x"))||0,s=Number(n.getProperty(r,"y"))||0;return{x:i,y:s}}function fK(t){var e;if((e=t.keyframes)!=null&&e.keyframes.some(n=>"x"in n.properties||"y"in n.properties))return!0;if(t.method==="fromTo"){const n=t.fromProperties;return"x"in t.properties||"y"in t.properties||!!(n&&("x"in n||"y"in n))}return"x"in t.properties||"y"in t.properties}function BR(t,e){var i;if(t.length===0)return null;const n=ue.getState().currentTime,r=t.filter(s=>fK(s)||s.keyframes||t.length===1).map(s=>{let a=0;fK(s)&&(a+=10),s.keyframes&&(a+=5),e&&s.targetSelector===e?a+=8:s.targetSelector.includes(",")&&(a-=5);const o=s.resolvedStart??(typeof s.position=="number"?s.position:0),l=s.duration??0;return n>=o-.05&&n<=o+l+.05?a+=50:a-=Math.round(Math.min(Math.abs(n-o),Math.abs(n-o-l))*5),{anim:s,score:a}});return r.sort((s,a)=>a.score-s.score),((i=r[0])==null?void 0:i.anim)??t[0]}function VR(t){if(t.length<=1)return t[0]??null;const e=ue.getState().currentTime;return t.reduce((n,r)=>{var u,f;const i=ai(r)??0,s=i+Yi(r),a=e>=i&&e<=s?0:Math.min(Math.abs(e-i),Math.abs(e-s)),o=ai(n)??0,l=o+Yi(n),c=e>=o&&e<=l?0:Math.min(Math.abs(e-o),Math.abs(e-l));return a(((f=n.keyframes)==null?void 0:f.keyframes.length)??0)?r:n})}const I3=["x","y","xPercent","yPercent","left","top","translateX","translateY"],lrt=new Set(I3),G1e=["rotation","rotationX","rotationY","rotationZ"],PN=new Set(G1e);async function oB(t,e,n,r,i){const s=e.filter(l=>l.propertyGroup===t),a=VR(s);if(a)return{anim:a,animations:e};const o=e.find(l=>!l.propertyGroup);if(o&&(await r(n,{type:"split-into-property-groups",animationId:o.id},{label:"Split mixed tween into property groups",skipReload:!0}),i)){const l=await i(),c=l.find(u=>u.propertyGroup===t);if(c)return{anim:c,animations:l}}if(!o&&i){const l=await i(),c=l.find(f=>f.propertyGroup===t);if(c)return{anim:c,animations:l};const u=l.find(f=>!f.propertyGroup);if(u){await r(n,{type:"split-into-property-groups",animationId:u.id},{label:"Split mixed tween into property groups",skipReload:!0});const f=await i(),h=f.find(p=>p.propertyGroup===t);if(h)return{anim:h,animations:f}}}return null}async function crt(t,e,n,r){const i=vc(t);if(!i)return{status:"blocked",reason:"no-selector"};const s=r?await r():[],a=[...e,...s],o=N3(a,lrt);if(o.status==="blocked")return o;const l=s.length>0?s:e,c=BR(l,i);return qS(n,i,void 0,I3)&&!c?{status:"blocked",reason:"source-uneditable"}:!c&&!Ec(t)?{status:"blocked",reason:"no-selector"}:{status:"persisted"}}async function S8(t,e,n,r,i,s,a){if(!(a!=null&&a.preflightPassed)){const w=await crt(t,n,r,s);if(w.status==="blocked"||a!=null&&a.preflightOnly)return w}const o=vc(t);if(!o)return{status:"blocked",reason:"no-selector"};let l=n;const c=w=>w.targetSelector===o&&w.propertyGroup==="position";if(n.filter(c).length>1&&s){const w=await s(),O=w.filter(c);if(O.length>1){const k=O.find(E=>E.keyframes)??O.find(E=>(E.duration??0)>0)??O[0];await i(t,{type:"consolidate-position-writes",targetSelector:o,keepAnimationId:k.id},{label:"Consolidate position writes",skipReload:!0}),l=await s()}else l=w}const u=await oB("position",l,t,i,s);let f=(u==null?void 0:u.anim)??null,h=(u==null?void 0:u.animations)??l;if(!f&&(f=BR(l,o),!f&&s)){const w=await s();h=w,f=BR(w,o)}const p=aB(r,o)??{x:0,y:0},y=qS(r,o,void 0,I3),m=!!(f!=null&&f.keyframes)&&Yi(f)>0;if(!y&&!m){const w=f&&Xo(f)&&f.targetSelector===o?f:H1e(h,o,t.element);return await Q1e(t,e,p,o,w,{commitMutation:i,fetchAnimations:s}),{status:"persisted"}}if(!f)return{status:"blocked",reason:"source-uneditable"};if(s){const O=(await s()).find(k=>k.targetSelector===f.targetSelector&&k.propertyGroup===f.propertyGroup);O&&O.id!==f.id&&(f=O)}const v={commitMutation:i,fetchAnimations:s},b=ue.getState().autoKeyframeEnabled;return a!=null&&a.altKey||!b?await irt(t,f,e,p,r,o,v):await Z1e(t,f,e,p,r,o,v),{status:"persisted"}}async function urt(t,e,n,r,i,s){const a=vc(t)??Ec(t);if(!a)return{status:"blocked",reason:"no-selector"};const o=s?await s():[],l=n.length>0?n:o,c=N3([...n,...o],PN);if(c.status==="blocked")return c;const u=l.some(E=>!E.propertyGroup)?s:void 0,f=await oB("rotation",l,t,i,u),h=(f==null?void 0:f.animations)??l;let p=f!=null&&f.anim&&BC(f.anim,PN)?f.anim:null;p||(p=l.find(E=>BC(E,PN))??null);const y=vc(t),m=y?qS(r,y,void 0,G1e):!1;if(!p&&m)return{status:"blocked",reason:"source-uneditable"};const v=Math.round(e);if(!p||Xo(p)){const E=p??qnt(h,a,t.element);return await ert(t,v,a,E,{commitMutation:i,fetchAnimations:s}),{status:"persisted"}}const b=D0(t,p);if(!ue.getState().autoKeyframeEnabled)return await D3(t,p,{rotation:v},b,r,{commitMutation:i,fetchAnimations:s},"Rotate animation"),{status:"persisted"};if(p.hasUnresolvedKeyframes||p.hasUnresolvedSelector){const E=await KS(p);E&&(p={...p,id:E})}else if(!p.keyframes){const E=a?SA(r,a,p,"rotation"):void 0;await i(t,{type:"convert-to-keyframes",animationId:p.id,resolvedFromValues:E},{label:"Convert to keyframes for rotation",skipReload:!0})}const w=SA(r,a,p,"rotation"),O={...w};"rotation"in w||(O.rotation=$C(r,a,"rotation")??0);const k={...w,rotation:v};return await i(t,{type:"add-keyframe",animationId:p.id,percentage:b,properties:k,backfillDefaults:O},{label:`Rotate (keyframe ${b}%)`,softReload:!0}),{status:"persisted"}}function frt(t){return typeof t=="object"&&t!==null&&"animations"in t&&Array.isArray(t.animations)}const fb=new Map;function OA(t,e,n={}){const r=`${t}|${e}`;n.fresh&&fb.delete(r);const i=fb.get(r);if(i)return i;const s=hrt(t,e).finally(()=>{fb.get(r)===s&&fb.delete(r)});return fb.set(r,s),s}async function hrt(t,e){try{const n=await fetch(`/api/projects/${encodeURIComponent(t)}/gsap-animations/${encodeURIComponent(e)}`,{cache:"no-store"});if(!n.ok)return null;const r=await n.json();return frt(r)?{...r,animations:r.animations.filter(i=>!fMe(i))}:null}catch{return null}}async function drt(t,e,n){const r=await OA(t,e);if(!r)return;const{elements:i,domClipChildren:s}=ue.getState(),a=new Map,o=new Map;for(const l of r.animations){if(l.hasUnresolvedKeyframes||S_(l))continue;const c=l.keyframes??Ng(l);if(c)for(const u of A_(l.targetSelector,n)){o.set(u,[...o.get(u)??[],l]);const{elStart:f,elDuration:h}=QE(u,e,i,s),p=jL(c.keyframes,l,f,h),y=a.get(u);y?y.keyframes=LL([...y.keyframes,...p]):a.set(u,{...c,keyframes:p})}}Wtt(e,a,o)}function lB(t,e,n){const r=new Set;return e.id&&r.add(`#${e.id}`),e.selector&&r.add(e.selector),r.size===0&&!n?[]:t.filter(i=>i.targetSelector.split(",").some(s=>{const a=s.trim();if(!a)return!1;if(r.has(a))return!0;const o=a.split(/\s+/).pop();if(o&&r.has(o))return!0;if(n)try{if(n.matches(a))return!0}catch{}return!1}))}function prt(t,e,n,r,i){const[s,a]=x.useState([]),[o,l]=x.useState(!1),[c,u]=x.useState(!1),f=x.useRef(""),h=x.useRef(null),p=ue(O=>O.domClipChildren.map(k=>`${k.id}<${k.hostId}`).join("|"));x.useEffect(()=>{const O=(n==null?void 0:n.id)??(n==null?void 0:n.selector)??"",k=`${t}:${e}:${r}:${O}`;if(k===f.current)return;if(f.current=k,h.current&&(clearTimeout(h.current),h.current=null),!t){a([]),l(!1),u(!1);return}let E=!1;return OA(t,e).then(T=>{if(!E){if(!T){a([]),l(!1),u(!1);return}a(T.animations),l(T.multipleTimelines===!0),u(T.unsupportedTimelinePattern===!0),T.animations.length===0&&O&&(h.current=setTimeout(()=>{E||OA(t,e).then(N=>{E||N&&N.animations.length>0&&a(N.animations)})},800))}}),()=>{E=!0,h.current&&(clearTimeout(h.current),h.current=null)}},[t,e,r,n==null?void 0:n.id,n==null?void 0:n.selector]);const y=(n==null?void 0:n.id)??null,m=(n==null?void 0:n.selector)??null,v=x.useMemo(()=>{var E;if(!y&&!m)return[];let O=null;const k=(E=i==null?void 0:i.current)==null?void 0:E.contentDocument;if(k)try{O=(y?k.getElementById(y):null)??(m?k.querySelector(m):null)}catch{O=null}return lB(s,{id:y,selector:m},O)},[s,y,m,r,i]),b=x.useMemo(()=>{const O=i==null?void 0:i.current;let k=v;if(O&&(k=k.map(E=>{if(!E.hasUnresolvedKeyframes||E.keyframes)return E;const T=jR(O,E.targetSelector);return T?{...E,keyframes:{format:"percentage",keyframes:T.keyframes,...T.easeEach?{easeEach:T.easeEach}:{}},...T.arcPath?{arcPath:T.arcPath}:{}}:E})),O&&y&&k.length===0){const E=s.filter(T=>T.hasUnresolvedSelector);if(E.length>0&&jR(O,`#${y}`)){const N=_1e(O),_=N.get(y);if(_){const j=Array.from(N.keys()).indexOf(y),L=j>=0&&j{if(!w)return;const O=b.filter(z=>!S_(z)&&(z.keyframes||Ng(z)));O.length>0&&qtt(e,w,O);const{elements:k,domClipChildren:E}=ue.getState(),{elStart:T,elDuration:N}=QE(w,e,k,E),_=[];let I="percentage",j,L;for(const z of b){if(S_(z))continue;const Y=z.keyframes??Ng(z);if(!Y)continue;const W=z.resolvedStart??(typeof z.position=="number"?z.position:0),J=z.duration??N;for(const ne of Y.keyframes){const le=RL(W,J,ne.percentage),ie=Rce(le,T,N,ne.percentage);_.push({...ne,percentage:ie,tweenPercentage:ne.percentage,propertyGroup:z.propertyGroup,animationId:z.id})}I=Y.format,Y.ease&&(j=Y.ease),Y.easeEach&&(L=Y.easeEach)}if(_.length===0){const{keyframeCache:z}=ue.getState();N0(e,w).some(W=>z.has(W))||RR(e,w);return}const B=LL(_),$={format:I,keyframes:B,...j?{ease:j}:{},...L?{easeEach:L}:{}};nm(z=>{for(const Y of N0(e,w))z.keyframeCache.set(Y,$)})},[w,e,b,p]),{animations:b,multipleTimelines:o,unsupportedTimelinePattern:c}}function mrt(){const[t,e]=x.useState(0),n=x.useCallback(()=>e(r=>r+1),[]);return{version:t,bump:n}}function grt(t,e,n,r){const i=ue(u=>u.elements.length),s=ue(u=>Array.from(new Set(u.elements.map(f=>f.compositionSrc).filter(f=>!!f))).sort().join("|")),a=ue(u=>u.domClipChildren.map(f=>`${f.id}<${f.hostId}`).join("|")),o=x.useRef(""),l=x.useRef(""),c=x.useRef("");x.useEffect(()=>{var p;const u=`kf-cache:${t}:${e}:${n}:${i}:${a}:${s}`;if(u===o.current||(o.current=u,l.current="",c.current="",!t))return;const f=Array.from(new Set([e,...s?s.split("|"):[]])),h=(p=r==null?void 0:r.current)==null?void 0:p.contentDocument;Utt(f),Promise.all(f.map(y=>drt(t,y,h))).then(()=>{c.current=u})},[t,e,n,i,a,s]),x.useEffect(()=>{if(!t)return;const u=e;let f=0;const h=10,p=()=>{if(l.current===`kf-cache:${t}:${u}:${n}`)return!0;const m=(r==null?void 0:r.current)??document.querySelector("iframe[src*='/preview/']");if(!m)return!1;const v=new Map;for(const w of ue.getState().elements)w.domId&&v.set(w.domId,{start:w.start,duration:w.duration});const b=_1e(m,v);return b.size===0?!1:(nm(w=>{for(const[O,k]of b){const E=N0(u,O);if(E.some(_=>w.keyframeCache.has(_))||k.keyframes.length===1&&Object.keys(k.keyframes[0].properties).every(_=>_==="x"||_==="y"))continue;const N={format:"percentage",keyframes:k.keyframes,...k.easeEach?{easeEach:k.easeEach}:{}};for(const _ of E)w.keyframeCache.set(_,N)}}),l.current=`kf-cache:${t}:${u}:${n}`,!0)};if(p())return;const y=setInterval(()=>{f++,(p()||f>=h)&&clearInterval(y)},500);return()=>clearInterval(y)},[t,e,n,r])}function yrt({previewIframe:t,activeCompPath:e,captionEditMode:n,domEditSelectionRef:r,domEditGroupSelectionsRef:i,domEditSelection:s,applyDomSelection:a,refreshDomEditGroupSelectionsFromPreview:o,buildDomSelectionFromTarget:l,refreshPreviewDocumentVersion:c,syncPreviewHotkeys:u,applyStudioManualEditsToPreviewRef:f,openSourceForSelection:h,getSidebarTab:p,gsapCacheVersion:y}){x.useEffect(()=>{if(!t)return;const v=async()=>{if(n)return;const w=r.current;if(!w)return;let O=null;try{O=t.contentDocument}catch{return}if(!O)return;ov(O);const k=Is(O,w,e);if(!k){const T=i.current;if(yc("preview-sync-lost",{target:w.selector??w.id??null,group:T.length}),T.length>1){await o(T);return}a(null,{revealPanel:!1});return}const E=await l(k);E&&a(E,{revealPanel:!1,preserveGroup:!0})};u(t),f.current(t),v(),c();const b=()=>{u(t),f.current(t),v(),c()};return t.addEventListener("load",b),()=>{t.removeEventListener("load",b)}},[e,a,l,n,i,r,t,o,c,u,f,y]);const m=x.useRef(h);m.current=h,x.useEffect(()=>{!s||!m.current||!p||s.sourceFile&&p()==="code"&&m.current(s.sourceFile,{id:s.id,selector:s.selector,selectorIndex:s.selectorIndex})},[s,p])}const xrt=5,brt=120,vrt=1,Art=120,hK=t=>new Promise(e=>setTimeout(e,t));function Srt(t,e){return t?t.animations.length===0?{kind:"cold"}:{kind:"resolved",animations:lB(t.animations,e)}:{kind:"fetch-error"}}async function wrt(t,e,n,r,i){let s=0,a=0;for(;;){const o=await OA(t,e,{fresh:i});i=!1;const l=Srt(o,n);if(l.kind==="resolved")return l.animations;if(l.kind==="fetch-error"){if(a>=vrt){if(r)throw new Error("GSAP animation ownership could not be verified");return[]}a++,await hK(Art);continue}if(s>=xrt)return[];s++,await hK(brt)}}function Ort(t,e){return x.useCallback((n,r)=>async()=>{if(!t)return[];const i={id:n.id??null,selector:n.selector??null};return wrt(t,e,i,(r==null?void 0:r.failOnFetchError)===!0,(r==null?void 0:r.fresh)===!0)},[t,e])}function Crt(t,e){return x.useCallback((n,r,i,s)=>{(FR(n)?bje:X0)({source:"gsap_commit",error:n,filePath:(r==null?void 0:r.sourceFile)??t??"index.html",mutationType:i,label:s,targetId:r==null?void 0:r.id,targetSelector:r==null?void 0:r.selector,targetSourceFile:r==null?void 0:r.sourceFile}),e(FR(n)?n.message:"Failed to save animated edit.","error")},[t,e])}function krt({domEditSelection:t,updateGsapProperty:e,updateGsapMeta:n,deleteGsapAnimation:r,deleteAllForSelector:i,addGsapAnimation:s,addGsapProperty:a,removeGsapProperty:o,updateGsapFromProperty:l,addGsapFromProperty:c,removeGsapFromProperty:u,addKeyframe:f,addKeyframeBatch:h,removeKeyframe:p,moveKeyframe:y,resizeKeyframedTween:m,convertToKeyframes:v,removeAllKeyframes:b,handleDomManualEditsReset:w,selectedGsapAnimations:O,showToast:k}){const E=x.useRef(null);t&&(E.current=t);const T=x.useCallback(Q=>Q===void 0?t??E.current:Q,[t]),N=x.useCallback((Q,H,se,fe)=>{X0({source:"gsap_commit",error:Q,filePath:H.sourceFile??void 0,mutationType:se,label:fe,targetId:H.id,targetSelector:H.selector,targetSourceFile:H.sourceFile}),cF(Q)||k(`Couldn't save animation: ${Nu(Q)}`,"error")},[k]),_=x.useCallback((Q,H,se,fe)=>Q.then(()=>!0,be=>(N(be,H,se,fe),!1)),[N]),I=x.useCallback((Q,H,se)=>{t&&e(t,Q,H,se)},[t,e]),j=x.useCallback((Q,H,se)=>{const fe=T(se);return fe?_(n(fe,Q,H),fe,"update-meta","Edit GSAP animation"):Promise.resolve(!1)},[T,_,n]),L=x.useCallback((Q,H)=>{const se=T(H);se&&_(r(se,Q),se,"delete","Delete GSAP animation")},[T,r,_]),B=x.useCallback(Q=>{const H=t??E.current;H&&(Pt("keyframe",{action:"delete_all"}),_(i(H,Q),H,"delete-all-for-selector","Delete all animations for element"))},[t,i,_]),$=x.useCallback(Q=>{t&&(s(t,Q,ue.getState().currentTime).catch(H=>{N(H,t,"add",`Add GSAP ${Q} animation`)}),t.element.hasAttribute("data-hf-studio-path-offset")&&w(t).catch(()=>{}))},[t,s,w,N]),z=x.useCallback((Q,H)=>{t&&_(a(t,Q,H),t,"add-property",`Add GSAP ${H}`)},[t,a,_]),Y=x.useCallback((Q,H)=>{t&&_(o(t,Q,H),t,"remove-property",`Remove GSAP ${H}`)},[t,_,o]),W=x.useCallback((Q,H,se)=>{t&&_(l(t,Q,H,se),t,"update-from-property",`Edit GSAP from-${H}`)},[t,_,l]),J=x.useCallback((Q,H)=>{t&&_(c(t,Q,H),t,"add-from-property",`Add GSAP from-${H}`)},[t,c,_]),ne=x.useCallback((Q,H)=>{t&&_(u(t,Q,H),t,"remove-from-property",`Remove GSAP from-${H}`)},[t,_,u]),le=x.useCallback((Q,H,se,fe,be)=>{const me=T(be);me&&(Pt("keyframe",{action:"add",property:se}),f(me,Q,H,se,fe))},[T,f]),ie=x.useCallback((Q,H,se,fe,be)=>{const me=T(be);return me?h(me,Q,H,se,fe).catch(pe=>{N(pe,me,"add-keyframe","Add keyframe")}):Promise.resolve()},[T,h,N]),q=x.useCallback((Q,H,se,fe)=>{const be=T(fe);be&&(Pt("keyframe",{action:"remove"}),p(be,Q,H,se))},[T,p]),F=x.useCallback((Q,H,se,fe)=>{const be=T(se);if(!be)return;const me=fe??O.find(ge=>ge.id===Q),pe=D0(be,me);Pt("keyframe",{action:"move_to_playhead"}),y(be,Q,H,pe)},[T,O,y]),U=x.useCallback((Q,H,se,fe)=>{const be=T(fe);return be?(Pt("keyframe",{action:"retime"}),y(be,Q,H,se)):Promise.resolve(!1)},[T,y]),Z=x.useCallback((Q,H,se,fe,be)=>{const me=T(be);return me?(Pt("keyframe",{action:"retime_resize"}),m(me,Q,H,se,fe)):Promise.resolve(!1)},[T,m]),K=x.useCallback((Q,H,se,fe,be)=>{const me=T(be);return me?v(me,Q,H,se,fe).catch(pe=>{N(pe,me,"convert-to-keyframes","Convert to keyframes")}):Promise.resolve()},[T,v,N]),ee=x.useCallback((Q,H)=>{const se=T(H);return se?_(b(se,Q),se,"remove-all-keyframes","Remove all keyframes"):Promise.resolve(!1)},[T,_,b]),re=x.useCallback(()=>{if(!t)return!1;const Q=O.find(H=>H.keyframes);return Q?(_(b(t,Q.id),t,"remove-all-keyframes","Remove all keyframes"),!0):!1},[t,_,b,O]);return{handleGsapUpdateProperty:I,handleGsapUpdateMeta:j,handleGsapDeleteAnimation:L,handleGsapDeleteAllForElement:B,handleGsapAddAnimation:$,handleGsapAddProperty:z,handleGsapRemoveProperty:Y,handleGsapUpdateFromProperty:W,handleGsapAddFromProperty:J,handleGsapRemoveFromProperty:ne,handleGsapAddKeyframe:le,handleGsapAddKeyframeBatch:ie,handleGsapRemoveKeyframe:q,handleGsapMoveKeyframeToPlayhead:F,handleGsapMoveKeyframe:U,handleGsapResizeKeyframedTween:Z,handleGsapConvertToKeyframes:K,handleGsapRemoveAllKeyframes:ee,handleResetSelectedElementKeyframes:re}}function Ert({projectId:t,activeCompPath:e,domEditSelection:n,domEditSelectionRef:r,domEditGroupSelectionsRef:i,refreshDomEditGroupSelectionsFromPreview:s,previewIframeRef:a,previewIframe:o,captionEditMode:l,refreshKey:c,gsapCacheVersion:u,bumpGsapCache:f,showToast:h,refreshPreviewDocumentVersion:p,syncPreviewHotkeys:y,applyStudioManualEditsToPreviewRef:m,applyDomSelection:v,buildDomSelectionFromTarget:b,openSourceForSelection:w,selectSidebarTab:O,getSidebarTab:k,updateGsapProperty:E,updateGsapMeta:T,deleteGsapAnimation:N,deleteAllForSelector:_,addGsapAnimation:I,addGsapProperty:j,removeGsapProperty:L,updateGsapFromProperty:B,addGsapFromProperty:$,removeGsapFromProperty:z,addKeyframe:Y,addKeyframeBatch:W,removeKeyframe:J,moveKeyframe:ne,resizeKeyframedTween:le,convertToKeyframes:ie,removeAllKeyframes:q,handleDomManualEditsReset:F}){const U=x.useCallback(be=>{!w||!O||be.sourceFile&&(O("code"),w(be.sourceFile,{id:be.id,selector:be.selector,selectorIndex:be.selectorIndex}))},[w,O]);x.useEffect(()=>{if(!(n!=null&&n.id))return;const{selectedElementId:be,elements:me,setSelectedElementId:pe}=ue.getState(),ge=me.find(ve=>ve.domId===n.id||ve.id===n.id),Pe=ge?ge.key??ge.id:null;Pe&&Pe!==be&&pe(Pe)},[n==null?void 0:n.id]);const Z=x.useRef(c);x.useEffect(()=>{c!==Z.current&&(Z.current=c,f())},[c,f]);const K=(n==null?void 0:n.sourceFile)||e||"index.html";grt(t??null,K,u,a);const{animations:ee,multipleTimelines:re,unsupportedTimelinePattern:Q}=prt(t??null,K,n?{id:n.id??null,selector:n.selector??null}:null,u,a),H=Crt(e,h),se=Ort(t,K),fe=krt({domEditSelection:n,updateGsapProperty:E,updateGsapMeta:T,deleteGsapAnimation:N,deleteAllForSelector:_,addGsapAnimation:I,addGsapProperty:j,removeGsapProperty:L,updateGsapFromProperty:B,addGsapFromProperty:$,removeGsapFromProperty:z,addKeyframe:Y,addKeyframeBatch:W,removeKeyframe:J,moveKeyframe:ne,resizeKeyframedTween:le,convertToKeyframes:ie,removeAllKeyframes:q,handleDomManualEditsReset:F,selectedGsapAnimations:ee,showToast:h});return yrt({previewIframe:o,activeCompPath:e,captionEditMode:l,domEditSelectionRef:r,domEditGroupSelectionsRef:i,domEditSelection:n,applyDomSelection:v,refreshDomEditGroupSelectionsFromPreview:s,buildDomSelectionFromTarget:b,refreshPreviewDocumentVersion:p,syncPreviewHotkeys:y,applyStudioManualEditsToPreviewRef:m,openSourceForSelection:w,getSidebarTab:k,gsapCacheVersion:u}),{onClickToSource:U,selectedGsapAnimations:ee,gsapMultipleTimelines:re,gsapUnsupportedTimelinePattern:Q,trackGsapInteractionFailure:H,makeFetchFallback:se,...fe}}function cB(t){var e;return(e=t.ownerDocument.defaultView)==null?void 0:e.gsap}function HR(t,e,n){const r=cB(t);return r!=null&&r.set?(r.set(t,{x:e,y:n}),!0):!1}function Trt(t,e,n){const r=cB(t);return r!=null&&r.set?(r.set(t,{scaleX:e,scaleY:n}),!0):!1}function dK(t,e){var r,i;const n=Number((i=(r=cB(t))==null?void 0:r.getProperty)==null?void 0:i.call(r,t,e));return Number.isFinite(n)?n:null}const oa=W0("resize");let U4=0;function Prt(t){oa("move",()=>(U4+=1,U4%8===1?{n:U4,...t}:null))}function Mrt(){U4=0}function QR(t,e){const n=r=>{var a;const i=t.getBoundingClientRect(),s=(a=t.ownerDocument.defaultView)==null?void 0:a.getComputedStyle(t);return{tag:e,phase:r,rect:{x:i.x,y:i.y,w:i.width,h:i.height},cssW:s==null?void 0:s.width,cssH:s==null?void 0:s.height,transform:s==null?void 0:s.transform,inlineStyle:t.getAttribute("style")}};oa("settle",()=>{var i;const r=n("t0");return(i=t.ownerDocument.defaultView)==null||i.setTimeout(()=>oa("settle",()=>n("t200")),200),r})}const zR=new Set(["opacity","autoAlpha","scale","scaleX","scaleY"]);function pK(t){const e={};for(const[n,r]of Object.entries(t))typeof r=="number"?e[n]=zR.has(n)?1:0:e[n]=r;return e}function mK(t,e,n){const r=Number.parseFloat((t==null?void 0:t.getAttribute(e))??"");if(Number.isFinite(r)&&r>0)return r;const i=Number.parseFloat((t==null?void 0:t.getAttribute(`data-hf-studio-original-${n}`))??"");return Number.isFinite(i)&&i>0?i:null}function Nrt(t){var r;const e=i=>i==="scaleX"||i==="scaleY";return(((r=t==null?void 0:t.keyframes)==null?void 0:r.keyframes)??[]).some(i=>Object.keys(i.properties??{}).some(e))||Object.keys((t==null?void 0:t.properties)??{}).some(e)}async function Drt(t,e,n,r,i,s){var q,F;const a=s?await s():[],o=[...n,...a],l=o.some(U=>U.propertyGroup==="scale"),c=l?"scale":"size",u=c==="scale"?new Set(["scale","scaleX","scaleY"]):new Set(["width","height"]),f=N3(o,u);if(f.status==="blocked")return f;const h=n.length>0?n:a,p=h.some(U=>!U.propertyGroup)?s:void 0,y=await oB(c,h,t,i,p);let m=y!=null&&y.anim&&BC(y.anim,u)?y.anim:null;const v=vc(t),b=v?qS(r,v,void 0,[...u]):!1;if(!m&&b)return{status:"blocked",reason:"source-uneditable"};if(oa("intercept-enter",{hasScaleGroup:l,resizeGroup:c,animMethod:(m==null?void 0:m.method)??null,animId:(m==null?void 0:m.id)??null,size:e}),!m||Xo(m)){const U=vc(t)??Ec(t);if(!U)return{status:"blocked",reason:"no-selector"};const Z=c==="size"?m??uK(h,U,t.element):uK(h,U,t.element);if(c==="size"){const K=VR(h.filter(ee=>!Xo(ee)&&Yi(ee)>0));if(K&&(oa("intercept-route",{route:"keyframed-size",tweenId:K.id}),await rrt(t,e,U,Z,K,{commitMutation:i,fetchAnimations:s})))return{status:"persisted"}}return oa("intercept-route",{route:"static-size-set",hadSizeSet:!!Z,resizeGroup:c}),await trt(t,e,U,Z,{commitMutation:i,fetchAnimations:s}),{status:"persisted"}}const w=Yi(m);if(w<=0)return{status:"blocked",reason:"source-uneditable"};const{activeKeyframePct:O,setActiveKeyframePct:k}=ue.getState(),E=O??D0(t,m);O!=null&&k(null);const T=vc(t),N=T?SA(r,T,m,c):{};let _,I=null,j=null,L=null,B=!1,$=!1;if(c==="scale"){const U=(q=r==null?void 0:r.contentDocument)==null?void 0:q.querySelector(T??""),Z=mK(U,Vg,"width")??200,K=mK(U,Hg,"height")??Z,ee=$C(r,T??null,"scaleX")??1,re=$C(r,T??null,"scaleY")??1,Q=ee>0?ee:1,H=re>0?re:1,se=Xt(e.width*Q/Z),fe=Xt(e.height*H/K);if(B=Math.abs(se-fe)*K>.5,$=B||Nrt(m),_=$?{scaleX:se,scaleY:fe}:{scale:se},oa("intercept-route",{route:"scale-tween",cssW:Z,cssH:K,liveScaleX:Q,liveScaleY:H,newScaleX:se,newScaleY:fe,nonUniformScale:B}),I=U,L=$?{x:se,y:fe}:{x:se,y:se},U){const me=U.getBoundingClientRect();j={x:me.x,y:me.y}}}else _={width:Math.round(e.width),height:Math.round(e.height)};const z=async()=>{if(!I||(zde(I),!j||!T))return!1;L&&Trt(I,L.x,L.y);const U=aB(r,T)??{x:0,y:0},{baseGsapX:Z,baseGsapY:K}=Fy(t.element,{x:0,y:0},U),ee={x:Z,y:K};HR(I,ee.x,ee.y);const re=I.getBoundingClientRect(),Q={x:j.x-re.x,y:j.y-re.y};if(!Number.isFinite(Q.x)||!Number.isFinite(Q.y))return!1;if(Math.abs(Q.x)<.5&&Math.abs(Q.y)<.5)return oa("scale-finalize",{skipped:"already-on-drop-point",residual:Q,base:ee}),!0;const H={x:Math.round(ee.x+Q.x),y:Math.round(ee.y+Q.y)};oa("scale-finalize",{dropPoint:j,post:{x:re.x,y:re.y},residual:Q,gsapPos:U,base:ee,corrected:H}),HR(I,H.x,H.y);const se=s?await s():(y==null?void 0:y.animations)??n,fe={x:H.x-ee.x,y:H.y-ee.y},be=VR(se.filter(pe=>pe.propertyGroup==="position"&&!Xo(pe)&&Yi(pe)>0));if(be)return oa("scale-finalize",{route:"position-keyframe",tweenId:be.id}),await Z1e(t,be,fe,ee,r,T,{commitMutation:i,fetchAnimations:s}),!0;const me=H1e(se,T,t.element);return await Q1e(t,fe,ee,T,me,{commitMutation:i,fetchAnimations:s}),!0};if(!ue.getState().autoKeyframeEnabled)return O!=null&&k(null),await D3(t,m,_,E,r,{commitMutation:i,fetchAnimations:s},"Resize animation"),{status:"persisted",ownsDragOffset:await z()};const Y=ue.getState().currentTime,W=ai(m),J=w,ne=W!==null&&J>0&&(YW+J+.01);if(!ne){if(m.hasUnresolvedKeyframes||m.hasUnresolvedSelector){const U=await KS(m);U&&(m={...m,id:U})}else if(!m.keyframes){const U=T?SA(r,T,m,c):void 0;if(await i(t,{type:"convert-to-keyframes",animationId:m.id,resolvedFromValues:U},{label:"Convert to keyframes for resize"}),s){const K=(await s()).find(ee=>ee.targetSelector===m.targetSelector&&ee.keyframes);K&&(m=K)}}}if((ne||$)&&W!==null){const U=((F=m.keyframes)==null?void 0:F.keyframes)??(()=>{const fe=m.method==="from"||m.method==="fromTo"?{...m.properties}:pK(m.properties),be=m.method==="from"?pK(m.properties):{...m.properties};return[{percentage:0,properties:fe},{percentage:100,properties:be}]})(),Z=Math.min(Y,W),K=Math.max(Y,W+J),ee=Math.max(.01,K-Z),re=U,Q=[];for(const fe of re){const be=W+fe.percentage/100*J,me=Math.round((be-Z)/ee*1e3)/10,pe={...fe.properties};if(B&&"scale"in pe){const ge=pe.scale;typeof ge=="number"&&(pe.scaleX=ge,pe.scaleY=ge),delete pe.scale}for(const ge of Object.keys(_))ge in pe||ge==="width"||ge==="height"||(pe[ge]=zR.has(ge)?1:0);Q.push({percentage:me,properties:pe})}const H=Math.round((Y-Z)/ee*1e3)/10,se=Q.find(fe=>Math.abs(fe.percentage-H)<.05);return se?Object.assign(se.properties,_):Q.push({percentage:H,properties:_}),Q.sort((fe,be)=>fe.percentage-be.percentage),await i(t,{type:"replace-with-keyframes",animationId:m.id,targetSelector:m.targetSelector,position:Xt(Z),duration:Xt(ee),keyframes:Q},{label:ne?`Resize (extended to ${Y.toFixed(2)}s)`:`Resize (keyframe ${Math.round((Y-Z)/ee*1e3)/10}%)`,softReload:!0}),{status:"persisted",ownsDragOffset:await z()}}const le=new Set(["width","height"]),ie={};for(const U of Object.keys(N))le.has(U)||(ie[U]=zR.has(U)?1:0);return await i(t,{type:"add-keyframe",animationId:m.id,percentage:E,properties:_,backfillDefaults:ie},{label:`Resize (keyframe ${E}%)`,softReload:!0}),{status:"persisted",ownsDragOffset:await z()}}function Irt(t,e,n){var o;const r=n?rl(n):void 0,i=r!==void 0?t.filter(l=>l.propertyGroup===r):t;if(i.length===0)return;if(i.length===1)return i[0];const s=ue.getState().currentTime,a=i.map(l=>{let c=0;l.keyframes&&(c+=10),e&&l.targetSelector===e?c+=5:l.targetSelector.includes(",")&&(c-=3);const u=l.resolvedStart??(typeof l.position=="number"?l.position:0),f=l.duration??0;return s>=u-.05&&s<=u+f+.05&&(c+=8),{anim:l,score:c}});return a.sort((l,c)=>c.score-l.score),(o=a[0])==null?void 0:o.anim}async function _rt(t,e,n,r){const i=n.find(s=>s.keyframes&&s.id!==e.id);i&&await r(t,{type:"convert-to-keyframes",animationId:e.id,duration:i.duration??1},{label:"Keyframe 3D transform",softReload:!0})}const Rrt={position:"Move layer",scale:"Resize layer",size:"Resize layer",rotation:"Rotate layer",visual:"Set opacity",other:"Set 3D transform"};function uB(t){const e=new Set(t.map(([r])=>rl(r))),n=e.size===1?[...e][0]:void 0;return n&&Rrt[n]||"Set properties"}async function jrt(t,e,n,r,i,s){const a=U1e(t,e,n,r);await s(a.selection,a.mutation,a.options),await _rt(t,e,i,s)}function U1e(t,e,n,r){const i=Object.fromEntries(n),s={};for(const[o,l]of n)typeof l=="number"&&(s[o]=l);const a=r&&Object.keys(s).length>0?{selector:r,change:{kind:e.global?"global-set":"set",props:s}}:void 0;return{selection:t,mutation:{type:"update-properties",animationId:e.id,properties:i},options:{label:uB(n),softReload:!0,...a?{instantPatch:a}:{}}}}async function Lrt(t,e,n,r,i){const s=$rt(t,e,n,r),a=s[0];if(a){if(s.length===1){await i(a.selection,a.mutation,a.options);return}if(!i.batch)throw new Error("Atomic GSAP property batch is unavailable");await i.batch(s,{label:uB(e),softReload:!0})}}function Frt(t){const e=new Map;for(const n of t){const r=rl(n[0]),i=e.get(r)??[];i.push(n),e.set(r,i)}return e}function $rt(t,e,n,r){const i=Frt(e),s=n?r.filter(l=>Xo(l)&&vy(l.targetSelector,n,t.element)):[],a=new Map,o=[];for(const[l,c]of i){const u=Brt(s,l);u?a.set(u,[...a.get(u)??[],...c]):o.push(c)}return[...[...a].map(([l,c])=>U1e(t,l,c,n)),...o.map(l=>Vrt(t,l))]}function Brt(t,e){return t.find(n=>n.propertyGroup===e)??t.find(n=>Object.keys(n.properties).some(r=>rl(r)===e))}function Vrt(t,e){const n={};for(const[i,s]of e)typeof s=="number"&&(n[i]=s);const r=Ec(t);if(!r)throw new Vl("no-selector");return{selection:t,mutation:{type:"add",targetSelector:r,method:"set",position:0,properties:Object.fromEntries(e),global:!0},options:{label:uB(e),softReload:!0,...Object.keys(n).length>0?{instantPatch:{selector:r,change:{kind:"global-set",props:n}}}:{}}}}async function Hrt(t,e,n,r,i,s,a,o){var N,_;const l=!!e.keyframes;l||await o(t,{type:"convert-to-keyframes",animationId:e.id},{label:"Convert to keyframes",skipReload:!0});const c=ue.getState().currentTime,u=s?SA(a,s,e):{},f={...u,...n},h={...u};for(const[I,j]of r){if(!(I in u)&&s){const L=$C(a,s,I);L!=null&&(h[I]=L)}h[I]=j}const p=(N=e.keyframes)==null?void 0:N.keyframes,y=ai(e),m=Yi(e),v=ue.getState().activeKeyframePct!=null,b=y!==null&&m>0&&(cy+m+.01);if(l&&!!p&&b&&!v&&p&&y!==null){const I=Math.min(c,y),j=Math.max(c,y+m),L=Math.max(.01,j-I),B=p.map($=>{const z=y+$.percentage/100*m,Y=Math.round((z-I)/L*1e3)/10,W={...$.properties};for(const J of Object.keys(f))!(J in W)&&h[J]!=null&&(W[J]=h[J]);return{percentage:Y,properties:W}});B.push({percentage:Math.round((c-I)/L*1e3)/10,properties:f}),B.sort(($,z)=>$.percentage-z.percentage),await o(t,{type:"replace-with-keyframes",animationId:e.id,targetSelector:e.targetSelector,position:Xt(I),duration:Xt(L),keyframes:B},{label:`Edit ${i} (extended keyframe)`,softReload:!0});return}const O=bS(c,t,e),k=(_=e.keyframes)==null?void 0:_.keyframes.some(I=>Math.abs(I.percentage-O)<.05),E={};for(const[I,j]of Object.entries(f))typeof j=="number"&&(E[I]=j);const T=s&&Object.keys(E).length>0?{selector:s,change:{kind:"keyframe-rebuild",pct:O,props:E}}:void 0;await o(t,k?{type:"update-keyframe",animationId:e.id,percentage:O,properties:f}:{type:"add-keyframe",animationId:e.id,percentage:O,properties:f,backfillDefaults:h},{label:`Edit ${i} (keyframe ${O}%)`,softReload:!0,...T?{instantPatch:T}:{}})}function Qrt(t){const{selectedGsapAnimations:e,gsapCommitMutation:n,previewIframeRef:r,bumpGsapCache:i}=t,s=x.useCallback(async(o,l)=>{if(!n)return;const c=Object.entries(l);if(c.length===0)return;const u=c[0][0];Ip(N3(e,new Set(c.map(([m])=>m))));const f=r.current,h=vc(o),p=Irt(e,h,u);if(!p&&!Ec(o))throw new Vl("no-selector");const y=e.some(m=>!!m.keyframes);try{if(y&&p){if(!ue.getState().autoKeyframeEnabled){const v=bS(ue.getState().currentTime,o,p);await D3(o,p,Object.fromEntries(c.filter(b=>typeof b[1]=="number")),v,f,{commitMutation:n},`Edit ${u} (whole animation)`);return}await Hrt(o,p,l,c,u,h,f,n);return}if(!y){await Lrt(o,c,h,e,n);return}if(p&&Xo(p)){await jrt(o,p,c,h,e,n);return}const m=Ec(o);if(m){const v=e.find(N=>!!N.keyframes),b=v?ai(v)??0:0,w=v&&Yi(v)||1,O=ue.getState().currentTime,k=w>0?Math.max(0,Math.min(100,Math.round((O-b)/w*1e3)/10)):0,E=Object.fromEntries(c),T=k<=.05?[{percentage:0,properties:E}]:[{percentage:0,properties:{...E,_auto:1}},{percentage:k,properties:E}];await n(o,{type:"add-with-keyframes",targetSelector:m,position:Xt(b),duration:Xt(w),keyframes:T},{label:`Add ${u} keyframe`,softReload:!0});return}throw new Vl("no-selector")}catch(m){throw i(),m}},[e,n,r,i]);return{commitAnimatedProperty:x.useCallback((o,l,c)=>s(o,{[l]:c}),[s]),commitAnimatedProperties:s}}let zrt=0;function Zrt(t,e){var n;for(const[r,i]of t.entries()){if(i.status!=="rejected")continue;const s=(n=e[r])==null?void 0:n.selection;if(s)return{error:i.reason,selection:s}}return null}function Grt({domEditSelection:t,selectedGsapAnimations:e,gsapCommitMutation:n,previewIframeRef:r,showToast:i,bumpGsapCache:s,makeFetchFallback:a,trackGsapInteractionFailure:o,handleDomBoxSizeCommit:l,addGsapAnimation:c,convertToKeyframes:u,setArcPath:f,updateArcSegment:h}){const p=x.useCallback(async(B,$,z)=>{if(n)try{const Y=await S8(B,$,e,r.current,n,a(B),z);Ip(Y)}catch(Y){throw o(Y,B,"drag","Move animated layer"),Y}},[e,n,r,a,o]),y=x.useCallback(async B=>{if(!n||B.length===0)return;const $=`group-drag:${++zrt}`;let z=!1;const Y={pending:!1},W=U=>({...U,coalesceKey:$,coalesceMs:Number.POSITIVE_INFINITY,deferPreviewSync:!z,previewFallbackLatch:Y}),J=[],ne=async()=>{var Z;if(J.length===0)return;const U=J.splice(0,J.length);if(!n.batch){for(const K of U)await n(K.selection,K.mutation,K.options);return}await n.batch(U,{...((Z=U.at(-1))==null?void 0:Z.options)??{label:"Move animated layer (group)"},label:"Move animated layer (group)"})},le=(U,Z,K)=>(J.push({selection:U,mutation:Z,options:W(K)}),Promise.resolve()),ie=new Map,q=await Promise.allSettled(B.map(async({selection:U})=>{const Z=await a(U,{failOnFetchError:!0})();ie.set(U,Z);const K=await S8(U,{x:0,y:0},Z,r.current,le,void 0,{preflightOnly:!0});Ip(K)})),F=Zrt(q,B);if(F)throw o(F.error,F.selection,"drag","Move animated layer (group)"),F.error;for(const[U,{selection:Z,next:K}]of B.entries()){z=U===B.length-1;try{const ee=await S8(Z,K,ie.get(Z)??[],r.current,le,async()=>(await ne(),a(Z,{fresh:!0})()),{preflightPassed:!0});Ip(ee)}catch(ee){throw o(ee,Z,"drag","Move animated layer (group)"),ee}}try{await ne()}catch(U){throw o(U,null,"drag","Move animated layer (group)"),U}},[n,r,a,o]),m=x.useCallback(async(B,$,z,Y=()=>{})=>{const W=e.some(le=>le.propertyGroup==="scale"),J=vc(B),ne=J?qS(r.current,J,void 0,I3):!1;return oa("commit-route",{next:$,offset:z??null,scaleRoute:W,animCount:e.length,animGroups:e.map(le=>`${le.propertyGroup}:${le.method}`)}),V1e({element:B.element,label:"Resize layer",settle:()=>{if(!z||W||!J)return;const le=aB(r.current,J)??{x:0,y:0},{newX:ie,newY:q}=Fy(B.element,z,le);oa("sync-settle",{gsapPos:le,offset:z,newX:ie,newY:q}),HR(B.element,ie,q)},persist:async le=>{if(n){const ie=le(n);try{const q=await Drt(B,$,e,r.current,ie,a(B));Ip(q);const F=q.status==="persisted"&&q.ownsDragOffset===!0;if(oa("intercept-handled",{scaleRoute:W,ownsDragOffset:F,willForwardOffset:!!(z&&!F)}),z&&!F){const U=await S8(B,z,e,r.current,ie,a(B));Ip(U)}QR(B.element,F?"gsap-scale":"gsap-size");return}catch(q){throw o(q,B,"resize","Resize animated layer"),q}}oa("dom-route",{next:$,offset:z??null,hadGsapMutation:!!n}),QR(B.element,"dom-route"),await l(B,$,z)},restore:Y,skipPixelAssert:ne})},[l,e,n,r,a,o]),v=x.useCallback(async(B,$)=>{if(n)try{const z=await urt(B,$.angle,e,r.current,n,a(B));Ip(z)}catch(z){throw o(z,B,"rotation","Rotate animated layer"),z}},[e,n,r,a,o]),{commitAnimatedProperty:b,commitAnimatedProperties:w}=Qrt({selectedGsapAnimations:e,gsapCommitMutation:n,previewIframeRef:r,bumpGsapCache:s}),O=x.useCallback(async(B,$)=>{try{await w(B,$)}catch(z){throw o(z,B,"property","Edit animated property"),z}},[w,o]),k=x.useCallback(async(B,$,z)=>{try{await b(B,$,z)}catch(Y){throw o(Y,B,"property","Edit animated property"),Y}},[b,o]),E=x.useCallback((B,$)=>{t&&f(t,B,$)},[t,f]),T=x.useCallback((B,$,z)=>{t&&h(t,B,$,z)},[t,h]),N=x.useCallback(async()=>{},[]),_=R1e(null),I=j1e(n??N,_,i),j=x.useCallback(async(B,$)=>{t&&await I(t,B,$)},[t,I]),L=x.useCallback(()=>{j({type:"unroll-timeline"},{label:"Unroll to literal tweens",softReload:!0})},[j]);return{handleGsapAwarePathOffsetCommit:p,handleGsapAwareGroupPathOffsetCommit:y,handleGsapAwareBoxSizeCommit:m,handleGsapAwareRotationCommit:v,commitAnimatedProperty:k,commitAnimatedProperties:O,handleSetArcPath:E,handleUpdateArcSegment:T,handleUnroll:L,commitMutation:j}}function p1(t){return Math.round(t*1e3)/1e3}function Urt({projectId:t,selection:e,currentTime:n}){const r=encodeURIComponent(e.compositionPath||e.sourceFile||"index.html"),i=new URLSearchParams({t:String(p1(n)),format:"png",output:"source"});return e.selector&&i.set("selector",e.selector),e.selectorIndex!=null&&i.set("selectorIndex",String(e.selectorIndex)),`/api/projects/${encodeURIComponent(t)}/thumbnail/${r}?${i.toString()}`}function Xrt({projectId:t,selection:e,currentTime:n}){return{schemaVersion:1,projectId:t,compositionPath:e.compositionPath,sourceFile:e.sourceFile,currentTime:p1(n),target:{id:e.id,hfId:e.hfId,selector:e.selector,selectorIndex:e.selectorIndex},label:e.label,tagName:e.tagName,boundingBox:{x:p1(e.boundingBox.x),y:p1(e.boundingBox.y),width:p1(e.boundingBox.width),height:p1(e.boundingBox.height)},textContent:e.textContent,dataAttributes:{...e.dataAttributes},inlineStyles:{...e.inlineStyles},computedStyles:{...e.computedStyles},textFields:e.textFields.map(r=>({key:r.key,label:r.label,value:r.value,tagName:r.tagName,source:r.source})),capabilities:{...e.capabilities},thumbnailUrl:Urt({projectId:t,selection:e,currentTime:n})}}function MN(t){if(t instanceof Error&&t.name==="AbortError")return;const e=t instanceof Error?t.name:typeof t,n=t instanceof Error?t.message:String(t);Pt("studio_selection_publish_failed",{error_name:e,error_message:n.slice(0,500)}),console.warn("[Studio] Failed to update agent selection context",t)}function NN(t,e,n){return fetch(`/api/projects/${encodeURIComponent(t)}/selection`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({selection:e}),signal:n}).then(()=>{})}function Wrt({projectId:t,domEditSelection:e,domEditSelectionRef:n,refreshKey:r,previewDocumentVersion:i,refreshDomEditSelectionFromPreview:s}){const a=x.useRef(r),o=x.useRef(null);x.useEffect(()=>{if(!t)return;const l=e!=null&&e.element.isConnected?Xrt({projectId:t,selection:e,currentTime:ue.getState().currentTime}):null,c=new AbortController;return NN(t,l,c.signal).catch(MN),()=>c.abort()},[e,t]),x.useEffect(()=>{if(t)return()=>{NN(t,null).catch(MN)}},[t]),x.useEffect(()=>{if(a.current===r||(a.current=r,o.current=n.current?r:null,!t||!n.current))return;const l=new AbortController;return NN(t,null,l.signal).catch(MN),()=>l.abort()},[n,t,r]),x.useEffect(()=>{if(o.current===null)return;o.current=null;const l=n.current;l&&s(l)},[n,i,s])}function qrt({gsapCommitMutation:t,domEditSelectionRef:e}){const n=x.useCallback((s,a)=>{const o=e.current;if(!o||s.length===0)return;const l={label:s.length===1?"Update keyframe ease":"Update segment ease",softReload:!0},c=s.map(({animationId:f,tweenPercentage:h})=>({selection:o,mutation:{type:"update-keyframe",animationId:f,percentage:h,properties:{},ease:a},options:l}));if(c.length===1){const f=c[0];f&&t(f.selection,f.mutation,f.options);return}const u=t.batch;if(u){u(c,l);return}for(const f of c)t(f.selection,f.mutation,f.options)},[t,e]),r=x.useCallback((s,a,o)=>n([{animationId:s,tweenPercentage:a}],o),[n]),i=x.useCallback((s,a)=>{const o=e.current;o&&t(o,{type:"update-meta",animationId:s,updates:{easeEach:a,resetKeyframeEases:!0}},{label:"Apply ease to all segments",softReload:!0})},[t,e]);return{handleUpdateSegmentEase:n,handleUpdateKeyframeEase:r,handleSetAllKeyframeEases:i}}function Yrt(t,e,n){return n!=null&&n.expandGroup&&e.length>0?e:[t]}function Krt({projectId:t,activeCompPath:e,compIdToSrc:n,captionEditMode:r,compositionLoading:i,previewIframeRef:s,timelineElements:a,getTimelineSelectionSet:o,setSelectedTimelineElementId:l,setTimelineSelectionSet:c,setRightCollapsed:u,setRightPanelTab:f,showToast:h,isRecordingRef:p,refreshPreviewDocumentVersion:y,queueDomEditSave:m,readProjectFile:v,writeProjectFile:b,updateEditingFileContent:w,domEditSaveTimestampRef:O,editHistory:k,fileTree:E,importedFontAssetsRef:T,projectDir:N,projectIdRef:_,previewIframe:I,refreshKey:j,previewDocumentVersion:L,rightPanelTab:B,applyStudioManualEditsToPreviewRef:$,syncPreviewHotkeys:z,reloadPreview:Y,setRefreshKey:W,openSourceForSelection:J,selectSidebarTab:ne,getSidebarTab:le,sdkSession:ie,publishSdkSession:q,forceReloadSdkSession:F}){const U=!e||e==="index.html",{domEditSelection:Z,domEditGroupSelections:K,domEditHoverSelection:ee,activeGroupElement:re,domEditSelectionRef:Q,domEditGroupSelectionsRef:H,setActiveGroupElement:se,applyDomSelection:fe,clearDomSelection:be,buildDomSelectionFromTarget:me,resolveDomSelectionFromPreviewPoint:pe,resolveAllDomSelectionsFromPreviewPoint:ge,updateDomEditHoverSelection:Pe,buildDomSelectionForTimelineElement:ve,handleTimelineElementSelect:xe,refreshDomEditSelectionFromPreview:we,refreshDomEditGroupSelectionsFromPreview:Ce,applyMarqueeSelection:Me}=vet({projectId:t,activeCompPath:e,isMasterView:U,compIdToSrc:n,captionEditMode:r,previewIframeRef:s,timelineElements:a,getTimelineSelectionSet:o,setSelectedTimelineElementId:l,setTimelineSelectionSet:c,setRightCollapsed:u,setRightPanelTab:f,previewIframe:I,refreshKey:j,rightPanelTab:B}),{agentModalOpen:Ve,agentModalAnchorPoint:tt,copiedAgentPrompt:Ze,agentPromptSelectionContext:qe,setAgentModalOpen:pt,setAgentPromptSelectionContext:it,setAgentModalAnchorPoint:vt,handleAskAgent:Ot,handleAgentModalSubmit:Kt}=YJe({activeCompPath:e,projectDir:N,projectIdRef:_,showToast:h,domEditSelectionRef:Q,domEditSelection:Z});Wrt({projectId:t,domEditSelection:Z,domEditSelectionRef:Q,refreshKey:j,previewDocumentVersion:L,refreshDomEditSelectionFromPreview:we});const{version:qt,bump:fn}=mrt(),{commitMutation:Jt,updateGsapProperty:Je,updateGsapMeta:St,deleteGsapAnimation:At,deleteAllForSelector:Ke,addGsapAnimation:Be,addGsapProperty:We,removeGsapProperty:Ye,updateGsapFromProperty:Zt,addGsapFromProperty:Te,removeGsapFromProperty:De,addKeyframe:ze,addKeyframeBatch:st,removeKeyframe:Gt,moveKeyframe:ln,resizeKeyframedTween:Yt,convertToKeyframes:Nn,removeAllKeyframes:Mr,setArcPath:mt,updateArcSegment:vn}=$nt({projectIdRef:_,activeCompPath:e,previewIframeRef:s,editHistory:k,domEditSaveTimestampRef:O,reloadPreview:Y,onCacheInvalidate:fn,onFileContentChanged:w,showToast:h,sdkSession:ie,publishSdkSession:q,writeProjectFile:b,forceReloadSdkSession:F}),{resolveImportedFontAsset:mn,handleDomStyleCommit:Tn,handleDomAttributeCommit:Ln,handleDomAttributeLiveCommit:et,handleDomAttributeQuietCommit:Yn,handleDomHtmlAttributeCommit:Mt,handleDomAttributesCommit:hn,handleDomTextCommit:Ht,handleDomRichTextCommit:dn,handleDomTextFieldStyleCommit:tr,handleDomAddTextField:_n,handleDomRemoveTextField:xr,handleDomBoxSizeCommit:nr,handleDomManualEditsReset:gt,handleDomEditElementsDelete:rr,handleDomZIndexReorderCommit:Cn}=Htt({activeCompPath:e,previewIframeRef:s,showToast:h,queueDomEditSave:m,writeProjectFile:b,domEditSaveTimestampRef:O,editHistory:k,fileTree:E,importedFontAssetsRef:T,projectId:t,projectIdRef:_,reloadPreview:Y,domEditSelection:Z,applyDomSelection:fe,clearDomSelection:be,refreshDomEditSelectionFromPreview:we,buildDomSelectionFromTarget:me,forceReloadSdkSession:F,onTrySdkPersist:ie?(Hr,lt,kt,Ai,ph)=>(QKe(ie,Hr.hfId,lt,kt,{targetPath:Ai,compositionPath:e}),xJe(Hr,lt,kt,Ai,ie,{editHistory:k,writeProjectFile:b,reloadPreview:Y,domEditSaveTimestampRef:O,compositionPath:e,readProjectFile:v,publishSession:q},ph)):void 0,onTrySdkDelete:ie?(Hr,lt,kt)=>PJe(Hr,lt,kt,ie,{editHistory:k,writeProjectFile:b,reloadPreview:Y,domEditSaveTimestampRef:O,compositionPath:e,readProjectFile:v,publishSession:q}):void 0,onReorderShadow:ie?Hr=>{let lt;const kt=e?()=>lt??(lt=v(e)):void 0;for(const Ai of Hr)XS(ie,Ai,"reorderElements",kt)}:void 0}),{groupSelection:Rn,ungroupSelection:xt}=ztt({activeCompPath:e,showToast:h,writeProjectFile:b,domEditSaveTimestampRef:O,editHistory:k,projectIdRef:_,reloadPreview:Y,clearDomSelection:be,forceReloadSdkSession:F}),Ut=x.useCallback(async(Hr,lt)=>{if(p!=null&&p.current){h("Cannot edit timeline while recording","error");return}const kt=Yrt(Hr,H.current,lt);await rr(kt)},[H,rr,p,h]),Ct=x.useCallback(()=>{const Hr=H.current,lt=Q.current,kt=Hr.length>0?Hr:lt?[lt]:[];if(kt.length<2){h("Select at least 2 elements to group","info");return}if(kt.some(Ai=>Yv(Ai.element))){h(kt.every(Ai=>Yv(Ai.element))?"Audio clips group into a bus — use FX on the track header":"Can't group audio clips with layout elements","info");return}Pt("group",{action:"create",count:kt.length}),Rn(kt)},[H,Q,Rn,h]),fr=x.useCallback(()=>{const Hr=Q.current;if(!(Hr!=null&&Hr.element.hasAttribute("data-hf-group"))){h("Select a group to ungroup","info");return}Pt("group",{action:"ungroup"}),se(null),xt(Hr)},[Q,xt,se,h]),{onClickToSource:Dt,selectedGsapAnimations:wt,gsapMultipleTimelines:gn,gsapUnsupportedTimelinePattern:Lt,trackGsapInteractionFailure:rn,makeFetchFallback:hs,handleGsapUpdateProperty:Fn,handleGsapUpdateMeta:ri,handleGsapDeleteAnimation:cn,handleGsapDeleteAllForElement:kn,handleGsapAddAnimation:ir,handleGsapAddProperty:Pi,handleGsapRemoveProperty:Jr,handleGsapUpdateFromProperty:Vi,handleGsapAddFromProperty:ds,handleGsapRemoveFromProperty:Nr,handleGsapAddKeyframe:Qa,handleGsapAddKeyframeBatch:bi,handleGsapRemoveKeyframe:wa,handleGsapMoveKeyframeToPlayhead:ft,handleGsapMoveKeyframe:Ae,handleGsapResizeKeyframedTween:_e,handleGsapConvertToKeyframes:ot,handleGsapRemoveAllKeyframes:bt,handleResetSelectedElementKeyframes:en}=Ert({projectId:t,activeCompPath:e,domEditSelection:Z,domEditSelectionRef:Q,domEditGroupSelectionsRef:H,refreshDomEditGroupSelectionsFromPreview:Ce,previewIframeRef:s,previewIframe:I,captionEditMode:r,refreshKey:j,gsapCacheVersion:qt,bumpGsapCache:fn,showToast:h,refreshPreviewDocumentVersion:y,syncPreviewHotkeys:z,applyStudioManualEditsToPreviewRef:$,applyDomSelection:fe,buildDomSelectionFromTarget:me,openSourceForSelection:J,selectSidebarTab:ne,getSidebarTab:le,updateGsapProperty:Je,updateGsapMeta:St,deleteGsapAnimation:At,deleteAllForSelector:Ke,addGsapAnimation:Be,addGsapProperty:We,removeGsapProperty:Ye,updateGsapFromProperty:Zt,addGsapFromProperty:Te,removeGsapFromProperty:De,addKeyframe:ze,addKeyframeBatch:st,removeKeyframe:Gt,moveKeyframe:ln,resizeKeyframedTween:Yt,convertToKeyframes:Nn,removeAllKeyframes:Mr,handleDomManualEditsReset:gt}),{handlePreviewCanvasMouseDown:Pn,handlePreviewCanvasPointerMove:Br,handlePreviewCanvasPointerLeave:lr,handleBlockedDomMove:vi,handleDomManualDragStart:ps}=Oet({captionEditMode:r,compositionLoading:i,previewIframeRef:s,showToast:h,applyDomSelection:fe,resolveDomSelectionFromPreviewPoint:pe,resolveAllDomSelectionsFromPreviewPoint:ge,updateDomEditHoverSelection:Pe,setActiveGroupElement:se,onClickToSource:Dt}),{handleGsapAwarePathOffsetCommit:ql,handleGsapAwareGroupPathOffsetCommit:Vr,handleGsapAwareBoxSizeCommit:As,handleGsapAwareRotationCommit:Bc,commitAnimatedProperty:ju,commitAnimatedProperties:Oa,handleSetArcPath:Ca,handleUpdateArcSegment:Vc,handleUnroll:Lu,commitMutation:Yl}=Grt({domEditSelection:Z,selectedGsapAnimations:wt,gsapCommitMutation:Jt,previewIframeRef:s,showToast:h,bumpGsapCache:fn,makeFetchFallback:hs,trackGsapInteractionFailure:rn,handleDomBoxSizeCommit:nr,addGsapAnimation:Be,convertToKeyframes:Nn,setArcPath:mt,updateArcSegment:vn}),{handleUpdateSegmentEase:Kl,handleUpdateKeyframeEase:Rs,handleSetAllKeyframeEases:Fu}=qrt({gsapCommitMutation:Jt,domEditSelectionRef:Q});return{domEditSelection:Z,domEditGroupSelections:K,domEditHoverSelection:ee,activeGroupElement:re,agentModalOpen:Ve,agentModalAnchorPoint:tt,copiedAgentPrompt:Ze,agentPromptSelectionContext:qe,domEditSelectionRef:Q,handleTimelineElementSelect:xe,handlePreviewCanvasMouseDown:Pn,handlePreviewCanvasPointerMove:Br,handlePreviewCanvasPointerLeave:lr,applyDomSelection:fe,clearDomSelection:be,handleDomStyleCommit:Tn,handleDomAttributeCommit:Ln,handleDomAttributeLiveCommit:et,handleDomAttributeQuietCommit:Yn,handleDomHtmlAttributeCommit:Mt,handleDomAttributesCommit:hn,handleDomPathOffsetCommit:ql,handleDomGroupPathOffsetCommit:Vr,handleDomZIndexReorderCommit:Cn,handleDomBoxSizeCommit:As,handleDomRotationCommit:Bc,handleDomManualEditsReset:gt,handleDomTextCommit:Ht,handleDomRichTextCommit:dn,handleDomTextFieldStyleCommit:tr,handleDomAddTextField:_n,handleDomRemoveTextField:xr,handleAskAgent:Ot,handleAgentModalSubmit:Kt,handleBlockedDomMove:vi,handleDomManualDragStart:ps,handleDomEditElementDelete:Ut,handleGroupSelection:Ct,handleUngroupSelection:fr,setActiveGroupElement:se,buildDomSelectionFromTarget:me,buildDomSelectionForTimelineElement:ve,updateDomEditHoverSelection:Pe,applyMarqueeSelection:Me,resolveImportedFontAsset:mn,setAgentModalOpen:pt,setAgentPromptSelectionContext:it,setAgentModalAnchorPoint:vt,selectedGsapAnimations:wt,gsapMultipleTimelines:gn,gsapUnsupportedTimelinePattern:Lt,handleGsapUpdateProperty:Fn,handleGsapUpdateMeta:ri,handleGsapDeleteAnimation:cn,handleGsapDeleteAllForElement:kn,handleGsapAddAnimation:ir,handleGsapAddProperty:Pi,handleGsapRemoveProperty:Jr,handleGsapUpdateFromProperty:Vi,handleGsapAddFromProperty:ds,handleGsapRemoveFromProperty:Nr,handleGsapAddKeyframe:Qa,handleGsapAddKeyframeBatch:bi,handleGsapRemoveKeyframe:wa,handleGsapMoveKeyframeToPlayhead:ft,handleGsapMoveKeyframe:Ae,handleGsapResizeKeyframedTween:_e,handleGsapConvertToKeyframes:ot,handleGsapRemoveAllKeyframes:bt,handleResetSelectedElementKeyframes:en,handleUpdateKeyframeEase:Rs,handleUpdateSegmentEase:Kl,handleSetAllKeyframeEases:Fu,commitAnimatedProperty:ju,commitAnimatedProperties:Oa,handleSetArcPath:Ca,handleUpdateArcSegment:Vc,handleUnroll:Lu,invalidateGsapCache:fn,previewIframeRef:s,commitMutation:Yl}}function Jrt(t,e){return(t.length>0?t:e?[e]:[]).flatMap(r=>r.hfId?[r.hfId]:[])}function eit(t,e,n){x.useEffect(()=>{t&&t.setSelection(Jrt(n,e))},[t,e,n])}const ZR=new Set;function tit(t){return ZR.add(t),()=>ZR.delete(t)}function nit(t){for(const e of ZR)try{e(t)}catch{}}async function rit(t,e){if(e.includes("\0")||e.includes(".."))return;const n=await fetch(`/api/projects/${encodeURIComponent(t)}/files/${encodeURIComponent(e)}?optional=1`);if(!n.ok)return;const r=await n.json();return typeof r.content=="string"?r.content:void 0}function iit(t,e,n,r){return t?t.projectId===e&&t.path===n&&t.path===r:!1}function sit(t,e,n,r,i){return t.generation===e&&t.projectId===n&&t.path===r&&t.reloadToken===i}function ait(t,e,n,r){return t?t.session===n&&t.generation===e.generation&&t.reloadToken===r:!1}function r1(t){try{t.dispose()}catch(e){Pt("sdk_session_dispose_failed",{error:e instanceof Error?e.message:String(e)})}}function X1e(t,e){const[n,r]=x.useState(null),i=x.useRef(null),s=x.useRef(new WeakMap),a=x.useRef(0),o=x.useRef(t);o.current=t;const l=x.useRef(e);l.current=e;const[c,u]=x.useState(0),f=x.useRef(c);f.current=c,x.useEffect(()=>tit(m=>{m===l.current&&u(v=>v+1)}),[]),x.useEffect(()=>{const m=++a.current;let v=!1;const b=i.current;if(i.current=null,r(null),b&&r1(b.session),!t||!e)return()=>{v=!0};const w={projectId:t,path:e,reloadToken:c,generation:m};return rit(t,e).then(async O=>{if(v||typeof O!="string")return;const k=await US(O,{history:!1});if(v){r1(k);return}if(!sit(w,a.current,o.current,l.current,f.current)){r1(k);return}const E=i.current,T={...w,session:k};s.current.set(k,w),i.current=T,r(T),E&&E.session!==k&&r1(E.session)}).catch(()=>{!v&&a.current===m&&r(null)}),()=>{v=!0;const O=i.current;(O==null?void 0:O.generation)===m&&(i.current=null,r1(O.session))}},[t,e,c]);const h=x.useCallback(()=>u(m=>m+1),[]),p=x.useCallback(({candidate:m,expectedSession:v,targetPath:b})=>{const w=s.current.get(v),O=i.current;if(!iit(w,o.current,l.current,b))return"rejected-inactive-target";if(!ait(O,w,v,f.current))return u(E=>E+1),"rejected-active-target";const k={...O,session:m};return s.current.set(m,O),i.current=k,r(k),O.session!==m&&r1(O.session),"published"},[]);return{session:(n==null?void 0:n.projectId)===t&&n.path===e&&n.reloadToken===c?n.session:null,publish:p,forceReload:h}}function oit(t,e,n){const r=X1e(t,e??n),i=e?r.session:null;return x.useEffect(()=>{_v.getState().setValues(null)},[t,e]),{sdkHandle:r,editFlowSdkSession:i}}const lit="hyperframes-studio-external-conflicts",cit=1,VC="file-conflicts";function DN(t,e){return`${t}\0${e}`}function uit(){return new Promise((t,e)=>{if(!globalThis.indexedDB){e(new Error("IndexedDB is unavailable; conflict recovery snapshot was not saved"));return}const n=globalThis.indexedDB.open(lit,cit);n.onupgradeneeded=()=>{n.result.objectStoreNames.contains(VC)||n.result.createObjectStore(VC)},n.onerror=()=>e(n.error??new Error("Failed to open conflict storage")),n.onsuccess=()=>t(n.result)})}function IN(t,e){return uit().then(n=>new Promise((r,i)=>{const s=n.transaction(VC,t),a=e(s.objectStore(VC));let o;a.onerror=()=>i(a.error??new Error("Conflict storage failed")),a.onsuccess=()=>{o=a.result},s.oncomplete=()=>{n.close(),r(o)},s.onerror=()=>{n.close(),i(s.error??new Error("Conflict storage transaction failed"))},s.onabort=()=>{n.close(),i(s.error??new Error("Conflict storage transaction was aborted"))}}))}function fit(){return{async get(t,e){return await IN("readonly",n=>n.get(DN(t,e)))??null},async set(t){await IN("readwrite",e=>e.put(t,DN(t.projectId,t.filePath)))},async delete(t,e){await IN("readwrite",n=>n.delete(DN(t,e)))}}}const _3=fit();async function hit(t,e){await _3.set({kind:"conflict",projectId:t,filePath:e.filePath,externalVersion:e.currentVersion,externalContent:e.currentContent,studioContent:e.attemptedContent,createdAt:Date.now()})}async function dit(t,e,n,r,i,s){await _3.set({kind:"failed",projectId:t,filePath:e,externalVersion:r,externalContent:i,studioContent:n,failureMessage:s instanceof Error?s.message:String(s),createdAt:Date.now()})}async function pit(t,e){return _3.get(t,e)}async function mit(t,e){await _3.delete(t,e)}function git(){const t=globalThis.__HF_STUDIO_HOT_TEST_ADAPTER__;if(!t||typeof t!="object")return null;const e=t;return typeof e.on=="function"&&typeof e.off=="function"?e:null}function HC(t){if(!t||typeof t!="object")return null;const e=t;return typeof e.content=="string"?e.content:"data"in e?HC(e.data):null}function QC(t){if(!t||typeof t!="object")return null;const e=t;return typeof e.version=="string"?e.version:"data"in e?QC(e.data):null}function W1e(t){if(!t||typeof t!="object")return null;const e=t;return typeof e.writeToken=="string"?e.writeToken:"data"in e?W1e(e.data):null}function yit(t,e){const n=QC(e);if(n)return`${t}\0${n}`;const r=HC(e);return r==null?null:`${t}\0${r.length}\0${r}`}function xit({projectId:t,activeCompPath:e,recoveryFilePath:n=e,pendingTimelineEditPathRef:r,drainPendingChanges:i,getPendingCandidate:s,discardPendingChanges:a,reloadPreview:o,reloadSdkSession:l,persistConflictSnapshot:c,persistFailureSnapshot:u,loadConflictSnapshot:f,deleteConflictSnapshot:h,overwriteConflict:p,readProjectFile:y,onUseExternalFile:m,resetSaveQueues:v}){const[b,w]=x.useState(null),O=x.useRef(0),k=x.useRef(!0),E=x.useRef(null),T=x.useRef(b),N=x.useRef(Promise.resolve());T.current=b,x.useEffect(()=>(k.current=!0,()=>{k.current=!1,O.current+=1}),[]),x.useEffect(()=>{O.current+=1,w(null),E.current=null},[t,e]),x.useEffect(()=>{if(!t||!n||!f)return;const z=++O.current;let Y=!1;return f(t,n).then(W=>{if(Y||!W||!k.current||z!==O.current)return;const J={path:W.filePath,version:W.externalVersion,content:W.externalContent};if(W.kind==="failed")w({status:"failed",generation:z,path:W.filePath,error:new Error(W.failureMessage),payload:J,studioContent:W.studioContent,recovered:!0});else{const ne=new O0({filePath:W.filePath,currentVersion:W.externalVersion,currentContent:W.externalContent,attemptedContent:W.studioContent});w({status:"conflict",generation:z,error:ne,payload:J})}}).catch(()=>{}),()=>{Y=!0}},[f,t,n]);const _=x.useCallback(z=>{f1("reload",{path:z,by:"external-change coordinator"}),o(),l(z)},[o,l]),I=x.useCallback(async z=>{const Y=N.current.catch(()=>{}).then(z);N.current=Y.then(()=>{},()=>{}),await Y},[]),j=x.useCallback(async(z,Y=!1)=>{const W=hQe(z);if(!W||!t)return;r.current.delete(W);const ne=HC(z),le=W1e(z);if(f1("file-change",{path:W,token:le??null,hasContent:ne!=null}),gLe(le)){f1("suppressed",{path:W,why:"own write token"});return}if(ne!=null&&fJe(W,ne)){f1("suppressed",{path:W,why:"own content echo"});return}const ie=yit(W,z);if(!Y&&ie!=null&&ie===E.current){f1("suppressed",{path:W,why:"duplicate event"});return}E.current=ie;const q=++O.current,F=await i();if(!(!k.current||q!==O.current)){if(F.status==="clean"){const U=T.current;if((U==null?void 0:U.status)==="failed"&&h)try{await h(t,W)}catch(Z){k.current&&q===O.current&&w({...U,generation:q,error:Z});return}if(!k.current||q!==O.current)return;w(null),_(W);return}if(F.status==="failed"){const U=s==null?void 0:s(),Z=(U==null?void 0:U.path)===W?U.content:null;let K=F.error;if(Z!=null&&u)try{await I(()=>u(t,W,Z,QC(z),ne,F.error))}catch(ee){K=new Error(`Studio could not save the edit or its recovery snapshot: ${ee instanceof Error?ee.message:String(ee)}`,{cause:F.error})}if(!k.current||q!==O.current)return;w({status:"failed",generation:q,path:W,error:K,payload:z,studioContent:Z,recovered:!1});return}try{await I(()=>c(t,F.error))}catch(U){if(!k.current||q!==O.current)return;w({status:"failed",generation:q,path:W,error:U,payload:z,studioContent:F.error.attemptedContent,recovered:!1});return}!k.current||q!==O.current||w({status:"conflict",generation:q,error:F.error,payload:z})}},[t,r,i,h,s,c,u,I,_]);const crocoFileChangeRef=x.useRef(j);crocoFileChangeRef.current=j;x.useEffect(()=>{const z=J=>crocoFileChangeRef.current(J),Y=git();if(Y)return Y.on("hf:file-change",z),()=>Y.off("hf:file-change",z);const W=new EventSource("/api/events");return W.addEventListener("file-change",event=>{let payload;try{payload=JSON.parse(event.data)}catch{return}void z(payload)}),()=>W.close()},[]);const L=x.useCallback(async()=>{const z=T.current;!z||z.status==="conflict"||z.recovered||(v==null||v(),E.current=null,await j(z.payload,!0))},[j,v]),B=x.useCallback(async()=>{const z=T.current;if(!z||!t||z.generation!==O.current)return;const Y=z.status==="conflict"?z.error.filePath:z.path,W=z.status==="conflict"&&z.error.currentContent!=null?z.error.currentContent:await y(Y);z.generation===O.current&&(a(),v==null||v(),m==null||m(Y,W),await(h==null?void 0:h(t,Y)),w(null),_(Y))},[h,a,m,t,y,_,v]),$=x.useCallback(async()=>{const z=T.current;if(!z||!t||z.generation!==O.current)return;let Y;if(z.status==="conflict")Y=z.error;else{if(!z.recovered||z.studioContent==null)return;try{const W=HC(z.payload)??await y(z.path);Y=new O0({filePath:z.path,currentVersion:QC(z.payload),currentContent:W,attemptedContent:z.studioContent})}catch(W){z.generation===O.current&&w({...z,error:W});return}}try{await p(Y)}catch(W){z.generation===O.current&&w({status:"failed",generation:z.generation,path:Y.filePath,error:W,payload:z.payload,studioContent:Y.attemptedContent,recovered:z.status==="failed"&&z.recovered});return}z.generation===O.current&&(a(),v==null||v(),await(h==null?void 0:h(t,Y.filePath)),w(null),_(Y.filePath))},[h,a,p,t,y,_,v]);return{blocked:b,retry:L,useExternalFile:B,keepStudioFile:$}}function bit({projectId:t,activeCompPath:e,masterCompPath:n,fileManager:r,previewPersistence:i,pendingTimelineEditPathRef:s,reloadPreview:a}){var p;const{flushPendingSourceSave:o,discardPendingSourceSave:l}=r,{drainPendingDomEditSaves:c,resetDomEditSaveQueueBreaker:u}=i,f=x.useCallback(async()=>{const y=await o();return y.status!=="clean"?y:c()},[c,o]),h=x.useCallback(()=>{l(),u()},[l,u]);return xit({projectId:t,activeCompPath:e,recoveryFilePath:((p=r.editingFile)==null?void 0:p.path)??e??n,pendingTimelineEditPathRef:s,drainPendingChanges:f,getPendingCandidate:r.getPendingSourceCandidate,discardPendingChanges:h,reloadPreview:a,reloadSdkSession:nit,persistConflictSnapshot:hit,persistFailureSnapshot:dit,loadConflictSnapshot:pit,deleteConflictSnapshot:mit,overwriteConflict:r.overwriteExternalConflict,readProjectFile:r.readProjectFile,onUseExternalFile:r.updateEditingFileContent,resetSaveQueues:u})}function vit(t){try{const e=t==null?void 0:t.contentDocument;if(!e)return 0;let n=0;for(const r of e.body.querySelectorAll("*")){const i=parseInt(getComputedStyle(r).zIndex,10);Number.isFinite(i)&&i>n&&(n=i)}return n}catch{return 0}}function Ait(t,e){const n=new Set(e);if(!n.has(t))return t;let r=2;for(;n.has(`${t}_${r}`);)r++;return`${t}_${r}`}async function Sit({projectId:t,blockName:e,showToast:n}){const r=await fetch(`/api/projects/${t}/registry/install`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({blockName:e})});if(!r.ok){const o=await r.json().catch(()=>({error:"Install failed"}));return n(o.error||"Failed to install block"),null}const{written:i,block:s}=await r.json(),a=i.find(o=>o.endsWith(".html"))??i[0];return a?{block:s,compositionFile:a}:(n("Installed but no composition file was written"),null)}async function wit(t,e,n,r){if(t.type!=="hyperframes:component")return;const i=await n(e),s=i.replace(/background:\s*(?:#(?:0a0a0a|000000|000|0a0805)|rgba?\([^)]*\))\s*;/g,"background: transparent;");s!==i&&await r(e,s)}function Oit({block:t,placement:e,timelineElements:n,currentTime:r}){const i=t.type==="hyperframes:block",{start:s=r,duration:a,track:o}=e??{},l=Number(mi(s)),c="duration"in t?t.duration:void 0,u=a??c??n.reduce((p,y)=>Math.max(p,(y.start??0)+(y.duration??0)),10),f=Math.max(0,...n.map(p=>p.track))+1;return{duration:u,isBlock:i,start:l,track:o??(i?0:f)}}function Cit({id:t,compositionFile:e,start:n,duration:r,track:i,width:s,height:a,left:o,top:l,zIndex:c}){return[""].join(` `)}async function w8(t){const{projectId:e,blockName:n,activeCompPath:r,placement:i,visualPosition:s,timelineElements:a,readProjectFile:o,writeProjectFile:l,recordEdit:c,refreshFileTree:u,reloadPreview:f,showToast:h}=t;try{const p=await Sit({projectId:e,blockName:n,showToast:h});if(!p)return null;const{block:y,compositionFile:m}=p;await wit(y,m,o,l);const v=r||"index.html",b=await o(v),w=a.filter(L=>(L.sourceFile||v)===v),{duration:O,isBlock:k,start:E,track:T}=Oit({block:y,placement:i,timelineElements:w,currentTime:t.currentTime??0}),{width:N,height:_}=Kae(b),I=Cit({id:Ait(y.name,UL(b)),compositionFile:m,start:E,duration:O,track:T,width:N,height:_,left:s?Math.round(s.left):0,top:s?Math.round(s.top):0,zIndex:vit(t.previewIframe??null)+1}),j=E5e(Uj(b,I),E+O);return await il({projectId:e,label:`Add ${k?"block":"component"}: ${y.title}`,kind:"timeline",files:{[v]:j},readFile:async()=>b,writeFile:l,recordEdit:c}),await u(),f(),{block:y,compositionPath:m}}catch(p){const y=p instanceof Error?p.message:"Failed to add block";return h(y),null}}function kit({projectId:t,blockCtxDeps:e,previewIframeRef:n,setRightCollapsed:r,setRightPanelTab:i}){const[s,a]=x.useState(null),o=x.useMemo(()=>({activeCompPath:e.activeCompPath,timelineElements:e.timelineElements,readProjectFile:e.readProjectFile,writeProjectFile:e.writeProjectFile,recordEdit:e.recordEdit,refreshFileTree:e.refreshFileTree,reloadPreview:e.reloadPreview,showToast:e.showToast}),[e.activeCompPath,e.timelineElements,e.readProjectFile,e.writeProjectFile,e.recordEdit,e.refreshFileTree,e.reloadPreview,e.showToast]),l=x.useRef(!1),c=x.useCallback(async(y,m)=>{if(l.current)return o.showToast("A block is already installing — one moment…","info"),null;l.current=!0,o.showToast(`Adding ${y}…`,"info");try{return await m()}finally{l.current=!1}},[o]),u=x.useCallback(y=>{t&&(async()=>{const m=await c(y,()=>w8({projectId:t,blockName:y,...o,previewIframe:n.current,currentTime:ue.getState().currentTime}));if(m===null)return;const v=(m==null?void 0:m.block.type)==="hyperframes:block"?m.block.params:void 0;v!=null&&v.length&&(a({blockName:m.block.name,blockTitle:m.block.title,params:v,compositionPath:m.compositionPath}),r(!1),i("block-params"))})()},[t,o,n,c,r,i]),f=x.useCallback((y,m)=>{t&&c(y,()=>w8({projectId:t,blockName:y,placement:m,...o,previewIframe:n.current,currentTime:ue.getState().currentTime}))},[t,o,n,c]),h=x.useCallback(async(y,m)=>{if(!t)return;const{compositionPath:v,...b}=m;await c(y,()=>w8({projectId:t,blockName:y,...o,activeCompPath:v??o.activeCompPath,placement:b,previewIframe:n.current,currentTime:ue.getState().currentTime}))},[t,o,n,c]),p=x.useCallback((y,m)=>{t&&c(y,()=>w8({projectId:t,blockName:y,visualPosition:m,...o,previewIframe:n.current,currentTime:ue.getState().currentTime}))},[t,o,n,c]);return{activeBlockParams:s,setActiveBlockParams:a,handleAddBlock:u,handleTimelineBlockDrop:f,handleAddMediaOverlay:h,handlePreviewBlockDrop:p}}function Eit(t,e,n){var p,y;let r=null,i=null;try{r=t.contentDocument,i=t.contentWindow}catch{return[]}if(!r||!i)return[];const s=t.getBoundingClientRect(),a=n.getBoundingClientRect(),o=parseFloat(t.style.width)||s.width,l=s.width/o,c=s.left-a.left,u=s.top-a.top,f=r.querySelectorAll(".caption-group"),h=[];for(let m=0;m span");N&&k.push(N)}else T.tagName==="SPAN"&&k.push(T)}if(k.length===0&&((p=w.textContent)!=null&&p.trim())){const E=w.childNodes[0];if(E&&E.nodeType===Node.TEXT_NODE){const T=(E.textContent||"").split(/\s+/).filter(Boolean),N=r.createDocumentFragment();for(const _ of T){const I=r.createElement("span");I.textContent=_+" ",I.style.display="inline",N.appendChild(I),k.push(I)}w.replaceChild(N,E)}else{const T=w.querySelector(":scope > span");if(T&&((y=T.textContent)!=null&&y.trim())){const N=T.textContent.split(/\s+/).filter(Boolean),_=r.createDocumentFragment();for(const I of N){const j=r.createElement("span");j.textContent=I+" ",j.style.display="inline",_.appendChild(j),k.push(j)}T.replaceWith(_)}}}for(let E=0;E span");l&&s.push(l)}else o.tagName==="SPAN"&&s.push(o)}return s[n]??null}function C2(t,e){const n=e.gsap;if(n&&n.getProperty)return{x:n.getProperty(t,"x")||0,y:n.getProperty(t,"y")||0,scale:n.getProperty(t,"scale")||1,rotation:n.getProperty(t,"rotation")||0};const r=t.style.transform||"",i=r.match(/scale\(([^)]+)\)/),s=r.match(/rotate\(([^)]+)deg\)/),a=r.match(/translate\(([^,]+)px,\s*([^)]+)px\)/);return{x:a?parseFloat(a[1]):0,y:a?parseFloat(a[2]):0,scale:i?parseFloat(i[1]):1,rotation:s?parseFloat(s[1]):0}}function L1(t){var i;if(t.dataset.captionWrapper==="true")return t;const e=t.parentElement;if(e&&e.dataset.captionWrapper==="true")return e;const r=t.ownerDocument.createElement("span");return r.style.display="inline-block",r.dataset.captionWrapper="true",(i=t.parentNode)==null||i.insertBefore(r,t),r.appendChild(t),r}function m1(t,e,n,r,i,s){const a=L1(t),o=e.gsap;o&&o.set?o.set(a,{x:n,y:r,scale:i,rotation:s}):a.style.transform=`translate(${n.toFixed(1)}px, ${r.toFixed(1)}px) rotate(${s.toFixed(1)}deg) scale(${i.toFixed(3)})`}let Df=null;function Tit(t){return Df=t,()=>{Df===t&&(Df=null)}}function Pit(){const t=Df==null?void 0:Df.current;return!!(t!=null&&t.isConnected&&t.offsetParent!==null)}function Mit(t){const e=Df==null?void 0:Df.current;if(!e)return;let n=null;try{n=e.contentWindow}catch{return}if(n)for(let r=0;r.5&&(o.x=r),Math.abs(i)>.5&&(o.y=i),Math.abs(s-1)>.001&&(o.scaleX=s,o.scaleY=s),Math.abs(a)>.1&&(o.rotation=a),o}function Dit(t){try{return(t==null?void 0:t.contentWindow)??null}catch{return null}}function gK(t,e,n,r=!1){try{t==null||t.addEventListener(e,n,r)}catch{}}function yK(t,e,n){try{t==null||t.removeEventListener(e,n)}catch{}}function q1e(t,e,n){const r=t.key.toLowerCase();return r==="z"&&!t.shiftKey?(t.preventDefault(),e(),!0):r==="z"&&t.shiftKey||t.ctrlKey&&!t.metaKey&&r==="y"?(t.preventDefault(),n(),!0):!1}function Iit(t,e,n){var c,u;const r=ue.getState(),i=t==="undo"?r.beatUndo:r.beatRedo,s=((c=i[i.length-1])==null?void 0:c.at)??null;if(s===null)return!1;const a=e[t],o=((u=a[a.length-1])==null?void 0:u.createdAt)??null;if(o!==null&&(t==="undo"?so))return!1;const l=t==="undo"?r.undoBeatEdits():r.redoBeatEdits();return l&&n(`${t==="undo"?"Undid":"Redid"} ${l}`,"info"),!0}function _it(t,e,n){var r,i,s,a;if(!Jce(t.target)&&q1e(t,()=>{Pt("keyboard_shortcut",{action:"undo"}),n.handleUndo()},()=>{Pt("keyboard_shortcut",{action:"redo"}),n.handleRedo()}))return!0;if(t.key==="1")return t.preventDefault(),Pt("keyboard_shortcut",{action:"tab_compositions"}),(r=n.leftSidebarRef.current)==null||r.selectTab("compositions"),!0;if(t.key==="2")return t.preventDefault(),Pt("keyboard_shortcut",{action:"tab_assets"}),(i=n.leftSidebarRef.current)==null||i.selectTab("assets"),!0;if(e==="g"&&!t.altKey&&!Zf(t.target))return t.preventDefault(),t.shiftKey?(s=n.onUngroupSelection)==null||s.call(n):(a=n.onGroupSelection)==null||a.call(n),!0;if(!t.shiftKey&&!t.altKey&&!Zf(t.target)){if(JIe(t))return!0;if(e==="c")return n.handleCopy()&&(t.preventDefault(),Pt("keyboard_shortcut",{action:"copy"})),!0;if(e==="v")return t.preventDefault(),Pt("keyboard_shortcut",{action:"paste"}),n.handlePaste(),!0;if(e==="x")return(ue.getState().selectedElementId||n.domEditSelectionRef.current)&&(t.preventDefault(),Pt("keyboard_shortcut",{action:"cut"}),n.handleCut()),!0}return!1}function Rit(t,e,n){var r;if(e==="f"&&!t.shiftKey&&!t.altKey){t.preventDefault(),document.fullscreenElement?document.exitFullscreen():(r=document.querySelector("[data-studio-fullscreen-target]"))==null||r.requestFullscreen();return}if(t.key==="s"&&!t.altKey){t.preventDefault();const{selectedElementId:i,elements:s,currentTime:a}=ue.getState();if(i){const o=s.find(l=>(l.key??l.id)===i);if(o&&n3(o)&&a>o.start&&a0){n.onDeleteSelectedKeyframes(),ue.getState().clearSelectedKeyframes(),t.preventDefault();return}if(ue.getState().automationSelection)return;if(t.key==="Backspace"){const{selectedElementId:u,keyframeCache:f}=ue.getState();if(u&&f.has(u)&&n.onResetKeyframes()){t.preventDefault();return}}const i=n.domEditSelectionRef.current;if(i){t.preventDefault(),n.handleDomEditElementDelete(i,{expandGroup:!0});return}const{selectedElementId:s,selectedElementIds:a,elements:o}=ue.getState(),l=new Set(a);s&&l.add(s);const c=o.filter(u=>l.has(u.key??u.id));c.length>0&&(t.preventDefault(),n.handleTimelineElementsDelete(c));return}t.key==="r"&&!t.shiftKey&&!t.altKey&&n.onToggleRecording&&(t.preventDefault(),n.onToggleRecording())}function jit({handleTimelineElementsDelete:t,handleTimelineElementSplit:e,handleDomEditElementDelete:n,domEditSelectionRef:r,editHistory:i,readOptionalProjectFile:s,readProjectFile:a,writeProjectFile:o,domEditSaveTimestampRef:l,showToast:c,syncHistoryPreviewAfterApply:u,waitForPendingDomEditSaves:f,leftSidebarRef:h,handleCopy:p,handlePaste:y,handleCut:m,onResetKeyframes:v,onDeleteSelectedKeyframes:b,onAfterUndoRedo:w,onToggleRecording:O,onGroupSelection:k,onUngroupSelection:E,activeCompPath:T,forceReloadSdkSession:N}){const _=x.useRef(null),I=x.useCallback(le=>le===u_?s(le):a(le),[s,a]),j=x.useCallback(async(le,ie)=>{l.current=Date.now(),await o(le,ie)},[l,o]),L=x.useCallback((le,ie)=>lF(o,le,ie),[o]),B=x.useCallback(async le=>{var F;const ie=An.getState();if(ie.isEditMode&&Pit()){const U=le==="undo"?ie.undo():ie.redo();if(U){Mit(U),c(`${le==="undo"?"Undid":"Redid"} caption edit`,"info");return}}if(Iit(le,i.state,c))return;await f();const q=await i[le]({readFile:I,writeFile:j,serialize:L});if(!q.ok&&q.reason==="content-mismatch"){c(`File changed outside Studio. ${le==="undo"?"Undo":"Redo"} history was not applied.`,"info");return}q.ok&&q.label&&(w==null||w(),T&&((F=q.paths)!=null&&F.includes(T))&&(N==null||N()),await u({paths:q.paths,files:q.files}),c(`${le==="undo"?"Undid":"Redid"} ${q.label}`,"info"))},[i,I,c,u,f,j,L,w,T,N]),$=x.useCallback(()=>B("undo"),[B]),z=x.useCallback(()=>B("redo"),[B]),Y=x.useRef(null);Y.current={handleTimelineElementsDelete:t,handleTimelineElementSplit:e,handleDomEditElementDelete:n,handleUndo:$,handleRedo:z,handleCopy:p,handlePaste:y,handleCut:m,onResetKeyframes:v,onDeleteSelectedKeyframes:b,onToggleRecording:O,onGroupSelection:k,onUngroupSelection:E,leftSidebarRef:h,domEditSelectionRef:r,showToast:c};const W=x.useCallback(le=>{const ie=Y.current,q=le.key.toLowerCase();if(le.metaKey||le.ctrlKey){_it(le,q,ie);return}Zf(le.target)||Rit(le,q,ie)},[]);x.useEffect(()=>(window.addEventListener("keydown",W,!0),()=>window.removeEventListener("keydown",W,!0)),[W]);const J=x.useCallback(le=>{!(le.metaKey||le.ctrlKey)||Jce(le.target)||q1e(le,()=>void Y.current.handleUndo(),()=>void Y.current.handleRedo())},[]),ne=x.useCallback(le=>{var Z;(Z=_.current)==null||Z.call(_),_.current=null;const ie=Dit(le);let q=null;try{q=(le==null?void 0:le.contentDocument)??null}catch{q=null}if(!ie&&!q)return;const F=J,U=W;gK(ie,"keydown",F,!0),gK(ie,"keydown",U,!0),q==null||q.addEventListener("keydown",J,!0),_.current=()=>{yK(ie,"keydown",F),yK(ie,"keydown",U),q==null||q.removeEventListener("keydown",J,!0)}},[W,J]);return x.useEffect(()=>()=>{var le;(le=_.current)==null||le.call(_),_.current=null},[]),{handleUndo:$,handleRedo:z,syncPreviewHotkeys:ne}}function Lit(t,e,n,r){if(n){const s=r??0;let a=0,o=null;if(n.startsWith("#")){const l=n.slice(1);o=new RegExp(`<[a-z][^>]*\\bid="${l}"[^>]*>`,"gi")}else if(n.startsWith(".")){const l=n.slice(1);o=new RegExp(`<[a-z][^>]*\\bclass="[^"]*\\b${l}\\b[^"]*"[^>]*>`,"gi")}else if(n.startsWith("[")){const l=n.slice(1,-1);o=new RegExp(`<[a-z][^>]*\\b${l}[^>]*>`,"gi")}if(o){let l;for(;(l=o.exec(t))!==null;){if(a===s){const c=Fit(t,l.index);if(c>0)return t.slice(0,c)+` `+e+t.slice(c)}a++}}}const i=Wae.exec(t);if(i&&i.index!=null){const s=i.index+i[0].length;return t.slice(0,s)+e+t.slice(s)}return t+e}function Fit(t,e){const n=t.indexOf(">",e);if(n<0)return-1;if(t[n-1]==="/")return n+1;const r=t.slice(e).match(/^<([a-z][a-z0-9]*)/i);if(!r)return-1;const i=r[1];let s=1,a=n+1;const o=new RegExp(`<${i}(?:\\s|>|/>)`,"gi"),l=new RegExp(``,"gi");for(;s>0&&a",c.index))>c.index||s++,a=t.indexOf(">",c.index)+1;else{if(s--,s===0)return u.index+u[0].length;a=u.index+u[0].length}}return-1}function $it(t,e){const n=new Set(e);return t.replace(new RegExp('(?<=\\s)id="([^"]+)"',"g"),(r,i)=>{if(!n.has(i))return r;let s=2;for(;n.has(`${i}-${s}`);)s++;const a=`${i}-${s}`;return n.add(a),`id="${a}"`})}function Bit(t,e,n){var i,s;let r=null;try{r=((i=t.current)==null?void 0:i.contentDocument)??null}catch{return null}return r?((s=Is(r,e,n))==null?void 0:s.outerHTML)??null:null}function Vit({projectId:t,activeCompPath:e,domEditSelectionRef:n,showToast:r,writeProjectFile:i,recordEdit:s,domEditSaveTimestampRef:a,reloadPreview:o,handleTimelineElementDelete:l,handleDomEditElementDelete:c,previewIframeRef:u}){const f=x.useRef(null),h=x.useRef(t);h.current=t;const p=x.useCallback(()=>{var O,k;const{selectedElementId:v,elements:b}=ue.getState();if(v){const E=b.find(I=>(I.key??I.id)===v);if(!E)return!1;const T=E.sourceFile||e||"index.html";let N=null;try{const I=(O=u.current)==null?void 0:O.contentDocument;I&&(N=((k=Is(I,{hfId:E.hfId,id:E.domId,selector:E.selector,selectorIndex:E.selectorIndex,sourceFile:T},e))==null?void 0:k.outerHTML)??null)}catch{}if(!N)return r("Unable to copy this element.","info"),!1;const _={kind:"timeline-clip",html:N,sourceFile:T};return f.current=_,r("Copied clip","info"),!0}const w=n.current;if(w){const E=Bit(u,w,e);if(!E)return r("Unable to copy this element.","info"),!1;const T=w.sourceFile||e||"index.html",N={kind:"dom-element",html:E,sourceFile:T,originSelector:w.selector,originSelectorIndex:w.selectorIndex};return f.current=N,r("Copied element","info"),!0}return!1},[e,n,u,r]),y=x.useCallback(async()=>{const v=f.current;if(!v){r("Nothing to paste.","info");return}const b=h.current;if(!b)return;const w=e||"index.html";try{const O=await ea(b,w),k=UL(O),E=$it(v.html,k);let T;if(v.kind==="timeline-clip"){const{currentTime:N}=ue.getState(),_=E.indexOf(">"),L=(_>=0?E.slice(0,_+1):E).replace(/data-start="[^"]*"/,`data-start="${mi(N)}"`)+E.slice(_+1);T=Uj(O,L)}else T=Lit(O,E,v.originSelector,v.originSelectorIndex);a.current=Date.now(),await il({projectId:b,label:v.kind==="timeline-clip"?"Paste clip":"Paste element",kind:"timeline",files:{[w]:T},readFile:async()=>O,writeFile:i,recordEdit:s}),o(),r(v.kind==="timeline-clip"?"Pasted clip":"Pasted element","info")}catch(O){const k=O instanceof Error?O.message:"Failed to paste";r(k)}},[e,a,s,o,r,i]),m=x.useCallback(async()=>{if(!p())return!1;const{selectedElementId:b,elements:w}=ue.getState();if(b){const k=w.find(E=>(E.key??E.id)===b);if(k)return await l(k),!0}const O=n.current;return O&&await c(O),!0},[p,n,l,c]);return{handleCopy:p,handlePaste:y,handleCut:m}}const Y1e={fontFamily:"sans-serif",fontSize:48,fontWeight:700,fontStyle:"normal",textDecoration:"none",textTransform:"none",letterSpacing:0,lineHeight:1.2,color:"#ffffff",activeColor:"#ffffff",dimColor:"rgba(255, 255, 255, 0.3)",opacity:1,gradientFill:null,strokeWidth:0,strokeColor:"#000000",shadows:[],glow:null,x:0,y:0,rotation:0,scaleX:1,scaleY:1,skewX:0,skewY:0,transformOrigin:"center center",blendMode:"normal"},Hit={backgroundColor:"transparent",backgroundOpacity:0,paddingTop:0,paddingRight:0,paddingBottom:0,paddingLeft:0,borderRadius:0,borderWidth:0,borderColor:"transparent",borderStyle:"solid",boxShadow:"none"},xK={preset:"fade",duration:.2,ease:"power2.out",stagger:0,staggerDirection:"start",intensity:1},i1={entrance:xK,highlight:null,exit:{...xK}};function Qit(t,e){const{width:n,height:r,duration:i,wordsPerGroup:s=5}=e,a=new Map,o=new Map,l=[];for(let c=0;c{const v=`segment-${c+m}`,b={id:v,wordId:y.id??`w${c+m}`,text:y.text,start:y.start,end:y.end,groupIndex:m,style:{},animation:{}};a.set(v,b),h.push(v)});const p={id:f,segmentIds:h,style:{...Y1e},animation:{entrance:{...i1.entrance},highlight:i1.highlight,exit:{...i1.exit}},containerStyle:{...Hit}};o.set(f,p),l.push(f)}return{width:n,height:r,duration:i,segments:a,groups:o,groupOrder:l,defaultAnimation:{entrance:{...i1.entrance},highlight:i1.highlight,exit:{...i1.exit}}}}function zit(t){const e=/(?:const|let|var)\s+(?:TRANSCRIPT|script)\s*=\s*(\[[\s\S]*?\]);/,n=t.match(e);if(!n)return[];const r=n[1];try{return Git(r)}catch{return[]}}function Zit(t,e,n,r,i,s){const a=zit(n);if(a.length===0)return null;const o=t.querySelectorAll(".caption-group, .caption-line, .caption-block"),l=t.querySelectorAll(".word, .caption-word");let c=5;o.length>0&&l.length>0&&(c=Math.round(l.length/o.length),c<1&&(c=1));const u=Qit(a,{width:r,height:i,duration:s,wordsPerGroup:c}),f=l.item(0),h=o.item(0),p=f??h;if(p){const y=e.getComputedStyle(p),m={},v=parseFloat(y.fontSize);!isNaN(v)&&v>0&&(m.fontSize=v);const b=y.fontWeight;if(b){const N=parseInt(b,10);m.fontWeight=isNaN(N)?b:N}const w=y.fontFamily;w&&(m.fontFamily=w);const O=y.color;O&&(m.color=O);const k=y.textTransform;(k==="none"||k==="uppercase"||k==="lowercase"||k==="capitalize")&&(m.textTransform=k);const E=y.letterSpacing;if(E&&E!=="normal"){const N=parseFloat(E),_=m.fontSize??Y1e.fontSize;!isNaN(N)&&_>0&&(m.letterSpacing=N/_)}const T={};if(h){const N=e.getComputedStyle(h),_=N.backgroundColor;_&&_!=="rgba(0, 0, 0, 0)"&&_!=="transparent"&&(T.backgroundColor=_,T.backgroundOpacity=1);const I=parseFloat(N.borderRadius);!isNaN(I)&&I>0&&(T.borderRadius=I);const j=parseFloat(N.paddingTop),L=parseFloat(N.paddingRight),B=parseFloat(N.paddingBottom),$=parseFloat(N.paddingLeft);isNaN(j)||(T.paddingTop=j),isNaN(L)||(T.paddingRight=L),isNaN(B)||(T.paddingBottom=B),isNaN($)||(T.paddingLeft=$)}for(const N of u.groupOrder){const _=u.groups.get(N);_&&(_.style={..._.style,...m},_.containerStyle={..._.containerStyle,...T})}}return u}function Git(t){let e;try{e=JSON.parse(t)}catch{let r=t;r=r.replace(/'((?:[^'\\]|\\.)*)'/g,(i,s)=>`"${s.replace(/\\'/g,"'").replace(/"/g,'\\"')}"`),r=r.replace(/([{,]\s*)([a-zA-Z_$][a-zA-Z0-9_$]*)\s*:/g,'$1"$2":'),r=r.replace(/,(\s*[}\]])/g,"$1"),e=JSON.parse(r)}if(!Array.isArray(e))return[];const n=[];for(const r of e)if(r!==null&&typeof r=="object"&&typeof r.text=="string"&&typeof r.start=="number"&&typeof r.end=="number"){const i=r;n.push({...typeof i.id=="string"?{id:i.id}:{},text:i.text,start:i.start,end:i.end})}return n}function Uit({projectId:t,activeCompPath:e,compIdToSrc:n,captionEditMode:r,captionHasSelection:i,previewIframeRef:s,captionSync:a,setRightCollapsed:o}){const l=x.useRef(e);x.useEffect(()=>{var c;if(l.current!==e){l.current=e;const u=An.getState();(u.model||u.isEditMode)&&((c=u.retrySave)==null||c.call(u),u.reset())}},[e]),x.useEffect(()=>{if(!t)return;let c=!1;const u=()=>{const h=An.getState();if(h.isEditMode||h.dismissed||c)return;const p=s.current;let y=null,m=null;try{y=(p==null?void 0:p.contentDocument)??null,m=(p==null?void 0:p.contentWindow)??null}catch{return}if(!y||!m||y.querySelectorAll(".caption-group").length===0)return;let b=null;const w=y.querySelectorAll("[data-composition-src], [data-composition-file]");for(const k of w){const E=k.getAttribute("data-composition-src")||k.getAttribute("data-composition-file");if(E&&E.includes("captions")){b=E;break}}if(!b){for(const[k,E]of n)if(k.includes("caption")||E.includes("caption")){b=E;break}}if(!b&&(e!=null&&e.includes("captions"))&&(b=e),!b){const k=y.querySelector('[data-composition-id*="caption"]');if(k){const E=k.getAttribute("data-composition-id")||"";b=n.get(E)||null}}if(!b)return;c=!0;const O=b;fetch(`/api/projects/${t}/files/${encodeURIComponent(O)}`).then(k=>k.json()).then(k=>{if(!k.content||!y||!m||An.getState().isEditMode)return;const E=y.querySelector("[data-composition-id]"),T=parseInt((E==null?void 0:E.getAttribute("data-width"))??"1920",10),N=parseInt((E==null?void 0:E.getAttribute("data-height"))??"1080",10),_=parseFloat((E==null?void 0:E.getAttribute("data-duration"))??"0"),I=Zit(y,m,k.content,T,N,_);if(!I)return;const j=An.getState();j.setModel(I),j.setSourceFilePath(O),j.setEditMode(!0),a.loadOverrides()}).catch(()=>{}).finally(()=>{c=!1})},f=h=>{const p=h.data;if((p==null?void 0:p.source)==="hf-preview"&&((p==null?void 0:p.type)==="state"||(p==null?void 0:p.type)==="timeline")){if(!wE(p))return;u()}};return window.addEventListener("message",f),u(),()=>{window.removeEventListener("message",f)}},[e,t,n,a,s]),x.useEffect(()=>{r&&o(!i)},[i,r,o])}const Xit=2,bK=3;function Wit(t,e){const n=[],r=Math.floor(t.length/e);if(r===0)return Array(e).fill(0);for(let s=0;ss/i)}async function qit(t,e,n){return e?await Yit(e,n):await Kit(t,n)}async function Yit(t,e){const n=await fetch(t,{signal:e});if(!n.ok)throw new Error(`Waveform request failed (${n.status})`);const r=await n.json();if(typeof r!="object"||r===null||!("peaks"in r)||!Array.isArray(r.peaks)||!r.peaks.every(i=>typeof i=="number"))throw new Error("Invalid waveform response");return r.peaks}async function Kit(t,e){const n=await fetch(t,{signal:e});if(!n.ok)throw new Error(`Audio request failed (${n.status})`);const r=await n.arrayBuffer();if(e.aborted)throw new DOMException("Aborted","AbortError");const i=new AudioContext;try{const s=await i.decodeAudioData(r);if(e.aborted)throw new DOMException("Aborted","AbortError");return Wit(s.getChannelData(0),4e3)}finally{await i.close()}}const Jit=x.memo(function({audioUrl:e,waveformUrl:n,label:r,labelColor:i,trimStartFraction:s,trimEndFraction:a,projectId:o,sessionEpoch:l,priority:c}){const u=x.useRef(null),f=x.useRef(null),h=n??e,p=x.useMemo(()=>({key:TS({kind:"waveform",source:h}),projectId:o,sessionEpoch:l,kind:"waveform",priority:c,rich:!1,load:async w=>{const O=await qit(e,n,w);return{value:{kind:"waveform",peaks:O},weight:O.length*Float64Array.BYTES_PER_ELEMENT}}}),[e,h,c,o,l,n]),y=o3(h?p:null),m=y.status==="ready"&&y.value.kind==="waveform"?y.value.peaks:null,v=x.useCallback(()=>{const w=u.current;if(!w||!m)return;const O=Math.max(1,w.clientWidth),k=Math.max(1,w.clientHeight),E=window.devicePixelRatio||1;w.width=Math.ceil(O*E),w.height=Math.ceil(k*E);const T=w.getContext("2d");if(!T)return;T.scale(E,E),T.clearRect(0,0,O,k);const N=Math.max(0,Math.min(1,s??0)),_=Math.max(N,Math.min(1,a??1)),I=Math.floor(N*m.length),L=Math.max(I+1,Math.ceil(_*m.length))-I,B=Math.floor(O/bK);for(let $=0;${var O;(O=f.current)==null||O.disconnect(),u.current=w,w&&(v(),f.current=new ResizeObserver(v),f.current.observe(w))},[v]);return Or(()=>()=>{var w;return(w=f.current)==null?void 0:w.disconnect()}),d.jsxs("div",{className:"absolute inset-0 overflow-hidden",children:[d.jsx("canvas",{ref:b,className:"absolute inset-x-0 bottom-0 w-full",style:{top:16}}),y.status==="loading"&&d.jsx("div",{className:"absolute inset-x-0 bottom-0 top-4 animate-pulse",style:{background:"linear-gradient(90deg, rgba(255,255,255,0.02) 0%, rgba(255,255,255,0.05) 50%, rgba(255,255,255,0.02) 100%)"}}),y.status==="error"&&d.jsxs("div",{className:"absolute inset-x-0 flex items-center justify-center gap-1.5",style:{top:16,bottom:0},children:[d.jsx("div",{className:"absolute inset-x-0",style:{bottom:"20%",height:2,background:"repeating-linear-gradient(90deg, rgba(75,163,210,0.35) 0 2px, transparent 2px 5px)"}}),d.jsx("span",{className:"relative rounded bg-black/50 px-1 text-[8px] text-neutral-500",children:"waveform unavailable"})]}),r&&d.jsx("div",{className:"absolute inset-x-0 top-0 z-10 px-1.5 py-0.5",children:d.jsx("span",{className:"block truncate text-[9px] font-semibold leading-tight",style:{color:i,textShadow:"0 1px 3px rgba(0,0,0,0.9)"},children:r})})]})}),est=x.memo(function({imageSrc:e,label:n,labelColor:r,projectId:i=e,sessionEpoch:s=0,priority:a="visible",rich:o=!1}){const[l,c]=x.useState(0),u=x.useRef(null),f=x.useMemo(()=>({key:TS({kind:"image",source:e,rich:Number(o)}),projectId:i,sessionEpoch:s,kind:"image",priority:a,rich:o,load:async w=>{const O=await yde(e,w,!0);return{value:{kind:"image",url:e,aspect:O},weight:tl.posterMaxPhysicalWidth*tl.posterMaxPhysicalHeight*4}}}),[e,a,i,o,s]),h=o3(f),p=h.status==="ready"?h.value:null,y=(p==null?void 0:p.kind)==="image"?p.aspect:16/9,{frameW:m,frameCount:v}=NF(l,y),b=x.useCallback(w=>{var k;if((k=u.current)==null||k.disconnect(),!w)return;const O=w.parentElement??w;c(O.clientWidth),u.current=new ResizeObserver(([E])=>c(E.contentRect.width)),u.current.observe(O)},[]);return Or(()=>()=>{var w;return(w=u.current)==null?void 0:w.disconnect()}),d.jsxs("div",{ref:b,className:"absolute inset-0 overflow-hidden",children:[(p==null?void 0:p.kind)==="image"&&d.jsx("div",{className:"absolute inset-0 flex",children:Array.from({length:v},(w,O)=>d.jsx("div",{className:"relative h-full flex-shrink-0 overflow-hidden bg-neutral-900",style:{width:m},children:d.jsx("img",{src:p.url,alt:"",draggable:!1,loading:"lazy",className:"absolute inset-0 h-full w-full object-cover"})},O))}),h.status==="loading"&&d.jsx("div",{className:"absolute inset-0 animate-pulse",style:{background:"linear-gradient(90deg, rgba(255,255,255,0.02) 0%, rgba(255,255,255,0.05) 50%, rgba(255,255,255,0.02) 100%)"}}),n&&d.jsx("div",{className:"absolute inset-x-0 bottom-0 z-10 px-1.5 pb-0.5 pt-3",style:{background:"linear-gradient(to top, rgba(0,0,0,0.85) 0%, rgba(0,0,0,0.4) 60%, transparent 100%)"},children:d.jsx("span",{className:"block truncate text-[9px] font-semibold leading-tight",style:{color:r,textShadow:"0 1px 2px rgba(0,0,0,0.9)"},children:n})})]})});function tst(t,e,n){try{const r=new URL(t,n),i=`/api/projects/${e}/preview/`;if(r.pathname.startsWith(i))return r.pathname.slice(i.length)}catch{}return t}function nst(t,e,n){if(!t)return null;try{const r=new URL(t,n),i=new URL(`/api/projects/${e}/preview/`,n).pathname;return r.pathname.startsWith(i)?decodeURIComponent(r.pathname.slice(i.length)):null}catch{return null}}function rst(t){const e=t.sourceDuration;if(e==null||e<=0)return{};const n=t.playbackStart??0,r=t.playbackRate??1,i=Math.max(0,Math.min(1,n/e)),s=Math.max(i,Math.min(1,(n+t.duration*r)/e));return{start:i,end:s}}function vK(t,e,n,r,i){const s=Oy(t.src??"",e,window.location.origin),a=nst(s,e,window.location.origin),o=a?yA(a):null,l=o?`/api/projects/${e}/waveform/${o}`:void 0,{start:c,end:u}=rst(t);return x.createElement(Jit,{audioUrl:s,waveformUrl:l,label:"",labelColor:r,trimStartFraction:c,trimEndFraction:u,projectId:e,sessionEpoch:n,priority:i.priority})}function ist({projectIdRef:t,compIdToSrc:e,activePreviewUrl:n,effectiveTimelineDuration:r}){const i=ue(o=>o.thumbnailMode),s=WCe(i),a=ue(o=>o.timelineSessionEpoch);return x.useCallback((o,l,c={priority:"visible",rich:!1})=>{const u=t.current;if(!u)return null;if(s==="hidden")return o.tag==="audio"?vK(o,u,a,l.label,c):null;let f=o.compositionSrc;if(f&&(f=tst(f,u,window.location.origin)),f&&e.size>0){const p=e.get(o.id)||e.get(f.replace(/^compositions\//,"").replace(/\.html$/,""));p&&(f=p)}if(f)return x.createElement(EM,{previewUrl:`/api/projects/${u}/preview/comp/${yA(f)}`,label:"",labelColor:l.label,seekTime:0,duration:o.duration,projectId:u,sessionEpoch:a,priority:c.priority,rich:c.rich});if(o.tag==="audio")return vK(o,u,a,l.label,c);if(n&&o.duration>0)return x.createElement(EM,{previewUrl:n,label:"",labelColor:l.label,selector:o.selector,selectorIndex:o.selectorIndex,seekTime:o.start,duration:o.duration,projectId:u,sessionEpoch:a,priority:c.priority,rich:c.rich});const h=o.duration>0&&r>0&&o.duration{r.current=[],n(null)},[]);return x.useEffect(()=>{if(!t)return;let s=null,a=null,o=null;const l=()=>{const f=s;if(f){s=null;try{f.console.error=a,f.removeEventListener("error",o),delete f.__hfErrorCapture}catch{}a=null,o=null}},c=()=>{l();try{const f=t.contentWindow;if(!f||f.__hfErrorCapture)return;f.__hfErrorCapture=!0,s=f,a=f.console.error.bind(f.console),f.console.error=function(...h){a(...h);const p=h.map(y=>y instanceof Error?y.message:String(y)).join(" ");p.includes("favicon")||(r.current=[...r.current,{severity:"error",message:p}],n([...r.current]))},o=h=>{const p=h.message||String(h);r.current=[...r.current,{severity:"error",message:p}],n([...r.current])},f.addEventListener("error",o)}catch{}};c();const u=()=>{r.current=[],n(null),c()};return t.addEventListener("load",u),()=>{t.removeEventListener("load",u),l()}},[t]),{consoleErrors:e,setConsoleErrors:n,resetErrors:i}}function K1e(t){return t&&t!=="master"?t:"index.html"}function GR({projectId:t,compositionPath:e,currentTime:n,origin:r=window.location.origin}){const i=K1e(e),s=new URL(E0(t,`/thumbnail/${encodeURIComponent(i)}`),r);return s.searchParams.set("t",Math.max(0,n).toFixed(3)),s.searchParams.set("format","png"),s.searchParams.set("output","source"),s.searchParams.set("v",String(Date.now())),s.toString()}function AK(t,e){var s;const r=((s=K1e(t).split("/").pop())==null?void 0:s.replace(/\.html$/i,""))||"frame",i=Math.max(0,e).toFixed(3).replace(".","-");return`${r}-${i}s.png`}function ast({projectId:t,activeCompPath:e,showToast:n,waitForPendingDomEditSaves:r}){const[i,s]=x.useState(0),[a,o]=x.useState(!1),l=x.useRef(!1);Or(()=>(s(ue.getState().currentTime),xa.subscribe(s)));const c=x.useCallback(()=>{s(ue.getState().currentTime)},[]),u=x.useCallback(async p=>{if(t&&(p.preventDefault(),!l.current)){l.current=!0,o(!0);try{const y=ue.getState().currentTime;s(y),await Promise.race([r(),new Promise((O,k)=>setTimeout(()=>k(new Error("Save queue timed out")),5e3))]);const m=GR({projectId:t,compositionPath:e,currentTime:y}),v=AK(e,y),b=new AbortController,w=setTimeout(()=>b.abort(),3e4);try{const O=await fetch(m,{cache:"no-store",signal:b.signal});if(clearTimeout(w),!O.ok){let N=`Capture failed (${O.status})`;try{const _=await O.json();_!=null&&_.error&&(N=_.error)}catch{}throw new Error(N)}const k=await O.blob(),E=URL.createObjectURL(k),T=document.createElement("a");T.href=E,T.download=v,document.body.appendChild(T),T.click(),T.remove(),setTimeout(()=>URL.revokeObjectURL(E),1e3)}catch(O){throw clearTimeout(w),O instanceof DOMException&&O.name==="AbortError"?new Error("Capture timed out — the server took too long to respond"):O}}catch(y){n(y instanceof Error?y.message:"Capture failed","error")}finally{l.current=!1,o(!1)}}},[e,t,n,r]),f=t?GR({projectId:t,compositionPath:e,currentTime:i}):"#",h=AK(e,i);return{captureFrameHref:f,captureFrameFilename:h,handleCaptureFrameClick:u,refreshCaptureFrameTime:c,capturing:a}}function ost(t){return{severity:t.severity==="error"?"error":"warning",message:t.message??"",file:t.file,fixHint:t.fixHint,elementId:t.elementId}}function lst(t,e){const[n,r]=x.useState(null),[i,s]=x.useState(!1),[a,o]=x.useState([]),l=x.useRef(!1),c=x.useCallback(async v=>{if(t){v!=null&&v.background||s(!0);try{const O=((await(await fetch(`/api/projects/${t}/lint`)).json()).findings??[]).map(ost);v!=null&&v.background||r(O),o(O)}catch(b){if(!(v!=null&&v.background)){const w=b instanceof Error?b.message:String(b);r([{severity:"error",message:`Failed to run lint: ${w}`}])}}finally{v!=null&&v.background||s(!1)}}},[t]),u=x.useCallback(()=>c(),[c]),f=x.useRef(t);x.useEffect(()=>{t!==f.current&&(l.current=!1,f.current=t),!(!t||l.current)&&(l.current=!0,c({background:!0}))},[t,c]),x.useEffect(()=>{if(!t||!e)return;const v=setTimeout(()=>void c({background:!0}),1e3);return()=>clearTimeout(v)},[t,e,c]);const h=x.useCallback(()=>r(null),[]),p=x.useCallback(v=>{const b=new Map;for(const w of a){const O=v(w);if(!O)continue;const k=b.get(O)??{count:0,messages:[]};k.count+=1,k.messages.push(w.message),b.set(O,k)}return b},[a]),y=x.useMemo(()=>p(v=>v.elementId),[p]),m=x.useMemo(()=>p(v=>v.file),[p]);return x.useEffect(()=>{ue.getState().setLintFindingsByElement(y)},[y]),{lintModal:n,linting:i,handleLint:u,closeLintModal:h,backgroundFindings:a,findingsByElement:y,findingsByFile:m}}function cst(t){if(!ust(t))return null;const e=t;return wE(e)?fst(e.width,e.height):null}function ust(t){if(typeof t!="object"||t===null)return!1;const e=t;return e.source==="hf-preview"&&e.type==="stage-size"}function SK(t){return typeof t!="number"?null:Number.isFinite(t)&&t>0?t:null}function fst(t,e){const n=SK(t),r=SK(e);return n===null||r===null?null:{width:n,height:r}}function J1e(){const[t,e]=x.useState(null);return Or(()=>{const n=r=>{const i=cst(r.data);i&&e(s=>s&&s.width===i.width&&s.height===i.height?s:i)};return window.addEventListener("message",n),()=>window.removeEventListener("message",n)}),t}const hst=4e3,dst=160,pst=3;let mst=1;function gst(){const[t,e]=x.useState([]),n=x.useRef(new Map),r=x.useCallback(o=>{const l=n.current.get(o);l&&(clearTimeout(l),n.current.delete(o))},[]),i=x.useCallback(o=>{r(o),e(l=>l.filter(c=>c.id!==o))},[r]),s=x.useCallback(o=>{r(o),e(c=>c.map(u=>u.id===o?{...u,leaving:!0}:u));const l=setTimeout(()=>i(o),dst);n.current.set(o,l)},[r,i]),a=x.useCallback((o,l="error")=>{const c=mst++;if(e(u=>{const f=[...u,{id:c,message:o,tone:l}];for(;f.length>pst;){const h=f.shift();h&&r(h.id)}return f}),l!=="error"){const u=setTimeout(()=>s(c),hst);n.current.set(c,u)}},[r,s]);return Or(()=>()=>{for(const o of n.current.values())clearTimeout(o);n.current.clear()}),{toasts:t,showToast:a,dismissToast:s}}function yst({projectId:t,setEditingFile:e,setActiveCompPath:n,showToast:r}){return x.useCallback(i=>{n(i.endsWith(".html")?i:null),e({path:i,content:null}),fetch(`/api/projects/${t}/files/${i}`).then(async s=>{if(!s.ok)throw new Error(`Failed to load ${i} (${s.status})`);return s.json()}).then(s=>{if(typeof s.content!="string")throw new Error(`No content returned for ${i}`);e({path:i,content:s.content})}).catch(s=>{r(s instanceof Error?s.message:`Failed to load ${i}`,"error")})},[t,e,n,r])}const ege=["layers","design","renders","slideshow","variables"];function tge(t){return t.includes("index.html")?"index.html":t.find(e=>e.endsWith(".html"))??null}function xst(t){return!t||!ege.includes(t)?null:t}function bst(t,e){return!t||t==="index.html"?null:e.includes(t)?t:null}function wK(t){return t==="1"?!0:t==="0"?!1:null}function nge(t){if(t==null||t==="")return null;const e=Number(t);return Number.isFinite(e)?e:null}function vst(t){return ege.includes(t)?t:null}function _N(t){return typeof t=="string"?t:void 0}function Ast(t){return typeof t=="number"&&Number.isFinite(t)?Math.max(0,Math.floor(t)):void 0}function Sst(t){if(!t||typeof t!="object")return null;const e=_N(Reflect.get(t,"sourceFile")),n=_N(Reflect.get(t,"id")),r=_N(Reflect.get(t,"selector"));return!n&&!r?null:{sourceFile:e,id:n,selector:r,selectorIndex:Ast(Reflect.get(t,"selectorIndex"))}}function wst(t){if(!t)return;let e;try{e=JSON.parse(t)}catch{const r=t.split(",").map(i=>i.trim()).filter(Boolean).map(i=>({id:i}));return r.length>0?r:void 0}if(!Array.isArray(e))return;const n=e.map(Sst).filter(r=>r!==null);return n.length>0?n:void 0}function Ost(t){const e=t.get("selFile")||void 0,n=t.get("selId")||void 0,r=t.get("selSelector")||void 0;if(!e&&!n&&!r)return null;const i=nge(t.get("selIndex"));return{sourceFile:e,id:n,selector:r,selectorIndex:i!=null?Math.max(0,Math.floor(i)):void 0,group:wst(t.get("selGroup"))}}function rge(){return{activeCompPath:null,currentTime:null,rightPanelTab:null,rightCollapsed:null,timelineVisible:null,selection:null}}function ige(t){const e=Yde(t);if(!e)return rge();const{params:n}=e;return{activeCompPath:n.get("comp")||null,currentTime:nge(n.get("t")),rightPanelTab:xst(vst(n.get("tab"))),rightCollapsed:wK(n.get("rc")),timelineVisible:wK(n.get("tv")),selection:Ost(n)}}function Cst(){return typeof window>"u"?rge():ige(window.location.hash)}function OK(t,e){var r;const n=new URLSearchParams;return n.set("v","1"),e.activeCompPath&&n.set("comp",e.activeCompPath),e.currentTime!=null&&Number.isFinite(e.currentTime)&&n.set("t",String(Math.max(0,Xt(e.currentTime)))),e.rightPanelTab&&n.set("tab",e.rightPanelTab),e.rightCollapsed!=null&&n.set("rc",e.rightCollapsed?"1":"0"),e.timelineVisible!=null&&n.set("tv",e.timelineVisible?"1":"0"),e.selection&&(e.selection.sourceFile&&n.set("selFile",e.selection.sourceFile),e.selection.id&&n.set("selId",e.selection.id),e.selection.selector&&n.set("selSelector",e.selection.selector),typeof e.selection.selectorIndex=="number"&&n.set("selIndex",String(Math.max(0,Math.floor(e.selection.selectorIndex)))),(r=e.selection.group)!=null&&r.length&&n.set("selGroup",JSON.stringify(e.selection.group))),qde(t,n)}function CK(t){return!t.id&&!t.selector?null:{sourceFile:t.sourceFile||void 0,id:t.id||void 0,selector:t.selector||void 0,selectorIndex:t.selectorIndex??void 0}}function kK(t){return[t.sourceFile??"",t.id??"",t.selector??"",t.selectorIndex??""].join("|")}function kst(t,e=[]){if(!t)return null;const n=CK(t);if(!n)return null;const r=kK(n),i=new Map;for(const s of e){const a=CK(s);if(!a)continue;const o=kK(a);o!==r&&i.set(o,a)}return{...n,group:i.size>0?[...i.values()]:void 0}}function EK(t){typeof window>"u"||window.location.hash!==t&&window.history.replaceState(null,"",t)}function Est(t,e,n,r){return Is(t,{sourceFile:e.sourceFile??n,id:e.id,selector:e.selector,selectorIndex:e.selectorIndex},r)}async function Tst(t,e){return t?e(t,{preferClipAncestor:!1,skipSourceProbe:!0}):null}async function Pst({doc:t,primaryElement:e,selection:n,group:r,activeCompPath:i,isCurrent:s,buildDomSelection:a}){const o=await a(e,{preferClipAncestor:!1});if(!s())return null;if(!o)return[];const l=[o];for(const c of r){const u=Est(t,c,n.sourceFile??"",i),f=await Tst(u,a);if(!s())return null;f&&l.push(f)}return l}function Mst({projectId:t,activeCompPath:e,duration:n,isPlaying:r,compositionLoading:i,refreshKey:s,previewIframeRef:a,rightPanelTab:o,rightCollapsed:l,activeCompPathHydrated:c,domEditSelection:u,domEditGroupSelections:f,applyMarqueeSelection:h,buildDomSelectionFromTarget:p,applyDomSelection:y,setRightPanelTab:m,initialState:v}){const b=ue($=>$.currentTime),w=x.useRef(v.currentTime==null),O=x.useRef(v.currentTime==null),k=x.useRef(v.selection==null),[E,T]=x.useState(v.selection==null),N=x.useRef(v.selection),_=x.useRef(v.currentTime),I=x.useRef(0),j=x.useCallback(()=>({activeCompPath:e,currentTime:_.current,rightPanelTab:o,rightCollapsed:l,timelineVisible:null,selection:k.current?kst(u,f):N.current}),[e,f,u,l,o]),L=x.useCallback($=>{var ne;const z=++I.current;if(!$)return y(null,{revealPanel:!1}),!0;let Y=null;try{Y=((ne=a.current)==null?void 0:ne.contentDocument)??null}catch{return!1}if(!Y)return!1;const W=Is(Y,{sourceFile:$.sourceFile??"",id:$.id,selector:$.selector,selectorIndex:$.selectorIndex},e);if(!W)return y(null,{revealPanel:!1}),!0;const J=$.group??[];return Pst({doc:Y,primaryElement:W,selection:$,group:J,activeCompPath:e,isCurrent:()=>z===I.current,buildDomSelection:p}).then(le=>{if(!le)return;const ie=le[0];if(!ie)return y(null,{revealPanel:!1});if(J.length===0)return y(ie,{revealPanel:!1});h(le,!1)}),!0},[e,y,h,p,a]);x.useEffect(()=>{if(!t||w.current||i)return;const $=n>0?Tr(v.currentTime??0,0,n):Math.max(0,v.currentTime??0);ue.getState().requestSeek($),_.current=$,w.current=!0},[t,i,n,v.currentTime]);const B=E?0:b;x.useEffect(()=>{if(!t||k.current||i||!w.current||v.currentTime!=null&&Math.abs(B-_.current)>.05)return;const z=()=>{k.current=!0,T(!0)},Y=N.current;if(!Y){z();return}L(Y)&&(z(),N.current=null)},[L,i,B,v.currentTime,t,s]),x.useEffect(()=>{if(O.current)return;const $=_.current;if($==null){O.current=!0;return}Math.abs(b-$)>.05||(O.current=!0)},[b]),x.useEffect(()=>{if(!c||!w.current||!O.current||!t||r)return;const $=window.setTimeout(()=>{_.current=Tr(b,0,Math.max(0,n)),EK(OK(t,j()))},200);return()=>window.clearTimeout($)},[c,j,b,n,r,t]),x.useEffect(()=>{c&&t&&EK(OK(t,j()))},[c,j,t]),x.useEffect(()=>{if(!t)return;const $=()=>{if(fR(window.location.hash)!==t)return;const z=ige(window.location.hash);if(z.currentTime!=null){const Y=n>0?Tr(z.currentTime,0,n):Math.max(0,z.currentTime);Math.abs(ue.getState().currentTime-Y)>.05&&(ue.getState().requestSeek(Y),_.current=Y)}L(z.selection),z.rightPanelTab&&m(z.rightPanelTab)};return window.addEventListener("hashchange",$),()=>window.removeEventListener("hashchange",$)},[t,n,L,m])}function Nst(t,e){return x.useMemo(()=>hde(t,e),[t,e])}function Dst(t){return{projectId:t.projectId,activeCompPath:t.activeCompPath,setActiveCompPath:t.setActiveCompPath,showToast:t.showToast,previewIframeRef:t.previewIframeRef,captionEditMode:t.captionEditMode,compositionLoading:t.compositionLoading,refreshKey:t.refreshKey,setRefreshKey:t.setRefreshKey,timelineElements:t.timelineElements,isPlaying:t.isPlaying,editHistory:t.editHistory,writeBlockedReason:t.externalFileConflict?"an external change to this file is waiting to be resolved":t.domEditSaveQueuePaused,handleUndo:t.handleUndo,handleRedo:t.handleRedo,renderQueue:t.renderQueue,compositionDimensions:t.compositionDimensions,waitForPendingDomEditSaves:t.waitForPendingDomEditSaves,handlePreviewIframeRef:t.handlePreviewIframeRef,refreshPreviewDocumentVersion:t.refreshPreviewDocumentVersion}}function Ist(t,e,n,r,i,s){return x.useMemo(()=>{const a=t==="design"||t==="layers",o=a&&e.layers,l=a&&e.design,c=o||l;return{layersPanelActive:o,designPanelActive:l,inspectorPanelActive:c,inspectorButtonActive:!n&&c,shouldShowMotionPath:!!i&&!r&&!s,shouldShowSelectedDomBounds:(c||t==="variables")&&!r&&!s}},[t,e,n,r,s,i])}function _st(t){const[e,n]=x.useState(!1),r=x.useRef(0),i=x.useCallback(l=>{l.dataTransfer.types.includes("Files")&&l.preventDefault()},[]),s=x.useCallback(l=>{l.dataTransfer.types.includes("Files")&&(l.preventDefault(),r.current++,n(!0))},[]),a=x.useCallback(()=>{r.current--,r.current===0&&n(!1)},[]),o=x.useCallback(l=>{r.current=0,n(!1),!l.defaultPrevented&&(l.preventDefault(),l.dataTransfer.files.length&&t(l.dataTransfer.files))},[t]);return{active:e,onDragOver:i,onDragEnter:s,onDragLeave:a,onDrop:o}}function Rst(t){const e=x.useCallback(n=>{const r=ue.getState().currentTime;t(Array.from(n),{start:r,track:0})},[t]);return _st(e)}const sge=Rc("PanelLayoutContext",null);function fB(){const t=x.useContext(sge);if(!t)throw new Error("usePanelLayoutContext must be used within PanelLayoutProvider");return t}function jst({value:{leftWidth:t,rightWidth:e,adjustPanelWidth:n,leftCollapsed:r,rightCollapsed:i,setRightCollapsed:s,effectiveLeftCollapsed:a,effectiveRightCollapsed:o,rightPanelTab:l,setRightPanelTab:c,rightInspectorPanes:u,toggleRightInspectorPane:f,setExclusiveRightInspectorPane:h,toggleLeftSidebar:p,handlePanelResizeStart:y,handlePanelResizeMove:m,handlePanelResizeEnd:v},children:b}){const w=x.useMemo(()=>({leftWidth:t,rightWidth:e,adjustPanelWidth:n,leftCollapsed:r,rightCollapsed:i,setRightCollapsed:s,effectiveLeftCollapsed:a,effectiveRightCollapsed:o,rightPanelTab:l,setRightPanelTab:c,rightInspectorPanes:u,toggleRightInspectorPane:f,setExclusiveRightInspectorPane:h,toggleLeftSidebar:p,handlePanelResizeStart:y,handlePanelResizeMove:m,handlePanelResizeEnd:v}),[t,e,n,r,i,s,a,o,l,c,u,f,h,p,y,m,v]);return d.jsx(sge,{value:w,children:b})}const UR="view";function TK(){return typeof window>"u"?"timeline":new URLSearchParams(window.location.search).get(UR)==="storyboard"?"storyboard":"timeline"}function Lst(t){if(typeof window>"u")return;const e=new URL(window.location.href);t==="storyboard"?e.searchParams.set(UR,"storyboard"):e.searchParams.delete(UR),window.history.replaceState(window.history.state,"",e)}function RN(){return typeof window>"u"?null:{href:window.location.href,state:window.history.state}}function Fst(){const[t,e]=x.useState(()=>TK()),n=x.useRef(new Set),r=x.useRef(RN()),i=x.useCallback(o=>{for(const l of n.current)if(!l(o))return!1;return!0},[]);x.useEffect(()=>{const o=()=>{const l=TK();if(l!==t&&!i(l)){const c=r.current;c&&window.history.pushState(c.state,"",c.href);return}e(l),r.current=RN()};return window.addEventListener("popstate",o),()=>window.removeEventListener("popstate",o)},[i,t]);const s=x.useCallback(o=>i(o)?(e(o),Lst(o),r.current=RN(),!0):!1,[i]),a=x.useCallback(o=>(n.current.add(o),()=>{n.current.delete(o)}),[]);return x.useMemo(()=>({viewMode:t,setViewMode:s,registerViewModeGuard:a}),[t,s,a])}const age=Rc("ViewModeContext",null);function oge(){const t=x.useContext(age);if(!t)throw new Error("useViewMode must be used within ViewModeProvider");return t}function $st({value:t,children:e}){return d.jsx(age,{value:t,children:e})}function Bst(){const e=Math.round(93.21518987341773);return d.jsxs("svg",{width:e,height:28,viewBox:"0 0 263 79",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-label":"Hyperframes",children:[d.jsxs("defs",{children:[d.jsxs("linearGradient",{id:"hf-g0",x1:"225.869",y1:"0",x2:"222.845",y2:"37.482",gradientUnits:"userSpaceOnUse",children:[d.jsx("stop",{stopColor:"#06E3FA"}),d.jsx("stop",{offset:"1",stopColor:"#4FDB5E"})]}),d.jsxs("linearGradient",{id:"hf-g1",x1:"230.87",y1:"39",x2:"244.661",y2:"6.303",gradientUnits:"userSpaceOnUse",children:[d.jsx("stop",{stopColor:"#06E3FA"}),d.jsx("stop",{offset:"1",stopColor:"#4FDB5E"})]})]}),d.jsx("path",{d:"M0 16.6738H4.96V23.3838H11.53V16.6738H16.49V35.4538H11.53V27.6738H4.96V35.4538H0V16.6738Z",fill:"white"}),d.jsx("path",{d:"M17.8899 28.0137C17.8899 23.4237 21.2399 20.0237 25.7999 20.0237C30.0099 20.0237 32.9399 23.0837 32.9399 27.5637C32.9399 28.2037 32.8599 28.8237 32.8299 29.3337H22.6099C23.0399 31.1337 24.6199 32.1237 27.1399 32.1237C28.7199 32.1237 30.2199 31.7237 31.2999 31.0237V34.6737C30.1699 35.3937 28.2999 35.8537 26.3599 35.8537C21.2599 35.8537 17.8799 32.6037 17.8799 28.0237L17.8899 28.0137ZM28.5699 26.1937C28.4899 24.5337 27.3899 23.5637 25.7499 23.5637C24.1099 23.5637 22.9599 24.5337 22.6099 26.1937H28.5699Z",fill:"white"}),d.jsx("path",{d:"M37.85 33.8638L32 20.4238H37.29L40.46 28.1538L43.6 20.4238H48.48L40.33 39.5738H35.26L37.86 33.8638H37.85Z",fill:"white"}),d.jsx("path",{d:"M48.1797 26.1138C48.1797 20.4238 52.7097 16.2438 58.9397 16.2438C61.2997 16.2438 63.5297 16.8038 64.8197 17.7238V21.9338C63.5597 20.9138 61.6797 20.2938 59.7497 20.2938C55.7797 20.2938 53.2597 22.6238 53.2597 26.1438C53.2597 29.6638 55.5697 31.8838 58.8897 31.8838C59.6397 31.8838 60.4997 31.7538 61.1997 31.5038V27.8838H57.4697V24.2338H65.5197V33.7038C63.6697 35.0938 61.1997 35.8738 58.5997 35.8738C52.5397 35.8738 48.1897 31.7438 48.1897 26.1138H48.1797Z",fill:"white"}),d.jsx("path",{d:"M66.6604 28.0137C66.6604 23.4237 70.0104 20.0237 74.5704 20.0237C78.7804 20.0237 81.7104 23.0837 81.7104 27.5637C81.7104 28.2037 81.6304 28.8237 81.6004 29.3337H71.3804C71.8104 31.1337 73.3904 32.1237 75.9104 32.1237C77.4904 32.1237 78.9904 31.7237 80.0704 31.0237V34.6737C78.9404 35.3937 77.0704 35.8537 75.1304 35.8537C70.0304 35.8537 66.6504 32.6037 66.6504 28.0237L66.6604 28.0137ZM77.3404 26.1937C77.2604 24.5337 76.1604 23.5637 74.5204 23.5637C72.8804 23.5637 71.7304 24.5337 71.3804 26.1937H77.3404Z",fill:"white"}),d.jsx("path",{d:"M82.9688 20.4238H87.8488V22.4138C88.7588 20.9638 90.3488 20.1038 92.3288 20.1038C95.4988 20.1038 97.3988 22.3338 97.3988 25.8138V35.4438H92.5188V26.8638C92.5188 25.0438 91.8188 24.1838 90.4788 24.1838C88.9488 24.1838 87.8488 25.3638 87.8488 27.2638V35.4438H82.9688V20.4238Z",fill:"white"}),d.jsx("path",{d:"M195.219 26.1937L213.529 38.9937C216.009 40.7237 220.239 38.7637 221.009 35.5337L228.419 4.33374C229.189 1.10374 225.879 -0.856262 222.589 0.873738L198.199 13.6737C192.649 16.5837 191.059 23.2837 195.219 26.1937Z",fill:"url(#hf-g0)"}),d.jsx("path",{d:"M256.97 25.9638L232.58 38.7638C229.28 40.4938 225.98 38.5338 226.75 35.3038L234.16 4.10376C234.93 0.873757 239.16 -1.08624 241.64 0.643757L259.95 13.4438C264.12 16.3538 262.52 23.0538 256.97 25.9638Z",fill:"url(#hf-g1)"}),d.jsx("path",{d:"M0 71.9996V42.7256H7.7367V53.1806H17.9826V42.7256H25.7193V71.9996H17.9826V59.8718H7.7367V71.9996H0Z",fill:"white"}),d.jsx("path",{d:"M31.9606 78.4405L36.0171 69.5329L26.9004 48.5811H35.1389L40.0737 60.6252L44.9666 48.5811H52.5779L39.8646 78.4405H31.9606Z",fill:"white"}),d.jsx("path",{d:"M53.3711 78.4404V48.5809H60.9823V52.052C62.446 49.501 65.0807 48.0791 68.3008 48.0791C74.3647 48.0791 78.9649 53.3066 78.9649 60.2487C78.9649 67.2745 74.3229 72.4602 68.259 72.4602C65.0807 72.4602 62.446 71.1637 60.9823 68.78V78.4404H53.3711ZM66.1262 66.1872C69.2627 66.1872 71.3119 63.7616 71.3119 60.2905C71.3119 56.8195 69.2627 54.4357 66.1262 54.4357C62.7388 54.4357 60.9823 57.2795 60.9823 59.7051V60.9178C60.9823 63.3434 62.7388 66.1872 66.1262 66.1872Z",fill:"white"}),d.jsx("path",{d:"M93.4397 72.6269C85.4939 72.6269 80.2246 67.5667 80.2246 60.4155C80.2246 53.2643 85.4521 47.9531 92.5615 47.9531C99.1273 47.9531 103.686 52.7206 103.686 59.7045C103.686 60.7082 103.56 61.6701 103.518 62.4647H87.5849C88.2541 65.2666 90.7214 66.8139 94.6525 66.8139C97.1199 66.8139 99.4618 66.1866 101.135 65.0993V70.7868C99.3782 71.916 96.4508 72.6269 93.4397 72.6269ZM87.5849 57.5717H96.869C96.7435 54.9789 95.0289 53.4734 92.4779 53.4734C89.9687 53.4734 88.1286 54.9789 87.5849 57.5717Z",fill:"white"}),d.jsx("path",{d:"M105.645 72V48.5808H113.214V52.9719C114.218 50.0445 116.183 48.2881 118.692 48.2881C119.361 48.2881 119.989 48.4135 120.407 48.6645V55.8993C119.822 55.5648 119.111 55.4393 118.274 55.4393C115.138 55.4393 113.256 57.6558 113.256 61.2941V72H105.645Z",fill:"white"}),d.jsx("path",{d:"M122.643 71.9996V42.7256H139.371V49.124H130.379V54.477H138.911V60.5827H130.379V71.9996H122.643Z",fill:"white"}),d.jsx("path",{d:"M141.258 72V48.5808H148.827V52.9719C149.831 50.0445 151.796 48.2881 154.306 48.2881C154.975 48.2881 155.602 48.4135 156.02 48.6645V55.8993C155.435 55.5648 154.724 55.4393 153.887 55.4393C150.751 55.4393 148.869 57.6558 148.869 61.2941V72H141.258Z",fill:"white"}),d.jsx("path",{d:"M167.26 72.4602C161.154 72.4602 156.596 67.2745 156.596 60.3324C156.596 53.3066 161.196 48.0791 167.302 48.0791C170.438 48.0791 173.031 49.4173 174.536 51.8429V48.5809H182.148V72.0001H174.536V68.4873C173.031 71.0801 170.438 72.4602 167.26 72.4602ZM169.393 66.1872C172.78 66.1872 174.536 63.3434 174.536 60.876V59.6632C174.536 57.2377 172.78 54.4357 169.393 54.4357C166.298 54.4357 164.207 56.7777 164.207 60.2905C164.207 63.7616 166.298 66.1872 169.393 66.1872Z",fill:"white"}),d.jsx("path",{d:"M184.998 72.0001V48.5809H192.609V51.6756C193.989 49.4173 196.373 48.0791 199.426 48.0791C202.521 48.0791 204.779 49.5428 206.075 52.052C207.497 49.5846 210.132 48.0791 213.352 48.0791C218.245 48.0791 221.214 51.592 221.214 57.0286V72.0001H213.603V58.5341C213.603 55.774 212.557 54.4357 210.634 54.4357C208.459 54.4357 206.912 56.234 206.912 59.0778V72.0001H199.3V58.5341C199.3 55.774 198.255 54.4357 196.373 54.4357C194.157 54.4357 192.609 56.234 192.609 59.0778V72.0001H184.998Z",fill:"white"}),d.jsx("path",{d:"M236.338 72.6269C228.392 72.6269 223.123 67.5667 223.123 60.4155C223.123 53.2643 228.351 47.9531 235.46 47.9531C242.026 47.9531 246.584 52.7206 246.584 59.7045C246.584 60.7082 246.459 61.6701 246.417 62.4647H230.483C231.152 65.2666 233.62 66.8139 237.551 66.8139C240.018 66.8139 242.36 66.1866 244.033 65.0993V70.7868C242.277 71.916 239.349 72.6269 236.338 72.6269ZM230.483 57.5717H239.767C239.642 54.9789 237.927 53.4734 235.376 53.4734C232.867 53.4734 231.027 54.9789 230.483 57.5717Z",fill:"white"}),d.jsx("path",{d:"M252.115 72.502C250.192 72.502 248.268 72.0838 246.93 71.3728V65.6853C247.808 66.3126 248.937 66.689 250.066 66.689C251.739 66.689 252.784 65.8526 252.784 64.5562C252.784 63.8452 252.492 63.0925 251.655 62.0888L249.899 59.956C248.728 58.4923 248.226 56.9031 248.226 55.2721C248.226 51.0065 251.864 48.0791 256.883 48.0791C258.723 48.0791 260.438 48.4555 261.65 49.0828V54.7703C260.898 54.2266 259.768 53.8503 258.723 53.8503C257.092 53.8503 256.046 54.6867 256.046 55.8994C256.046 56.6522 256.423 57.405 257.259 58.4086L258.974 60.4996C260.187 62.047 260.73 63.5943 260.73 65.2671C260.73 69.5746 257.05 72.502 252.115 72.502Z",fill:"white"})]})}const O8=[{mode:"storyboard",label:"Storyboard"},{mode:"timeline",label:"Preview"}];function Vst(){const{viewMode:t,setViewMode:e}=oge(),n=x.useRef([]),r=s=>{s!==t&&e(s)&&Pt("view_mode_toggle",{mode:s})},i=(s,a)=>{var c;if(s.key!=="ArrowLeft"&&s.key!=="ArrowRight")return;s.preventDefault();const o=s.key==="ArrowLeft"?-1:1,l=(a+o+O8.length)%O8.length;(c=n.current[l])==null||c.focus(),r(O8[l].mode)};return d.jsx("div",{className:"flex items-center gap-0.5 rounded-md bg-neutral-800 p-0.5",role:"tablist","aria-label":"Studio view",children:O8.map(({mode:s,label:a},o)=>{const l=t===s;return d.jsx("button",{ref:c=>{n.current[o]=c},type:"button",role:"tab","aria-selected":l,tabIndex:l?0:-1,onClick:()=>r(s),onKeyDown:c=>i(c,o),className:`rounded px-3 py-1 text-[11px] font-medium transition-colors active:scale-[0.98] outline-none focus-visible:outline focus-visible:outline-2 focus-visible:outline-studio-accent ${l?"bg-neutral-200 text-neutral-900":"text-neutral-400 hover:text-neutral-200"}`,children:a},s)})})}function Hst(t,e){return t||!e}function Qst({captureFrameHref:t,captureFrameFilename:e,handleCaptureFrameClick:n,refreshCaptureFrameTime:r,capturing:i,inspectorButtonActive:s,inspectorPanelActive:a,onExport:o}){const{projectId:l,editHistory:c,handleUndo:u,handleRedo:f,renderQueue:h}=Gl(),{effectiveRightCollapsed:p,setRightCollapsed:y,setRightPanelTab:m}=fB(),v=h.isRendering,b=h.ffmpegMissing;return d.jsxs("div",{className:"flex items-center justify-between h-10 px-3 bg-neutral-900 border-b border-neutral-800 flex-shrink-0",children:[d.jsxs("div",{className:"flex items-center gap-3",children:[d.jsx(Bst,{}),d.jsx("span",{className:"text-neutral-700 select-none","aria-hidden":"true",children:"|"}),d.jsx("span",{className:"text-[11px] font-medium text-neutral-300",children:l})]}),d.jsx(Vst,{}),d.jsxs("div",{className:"flex items-center gap-1.5",children:[d.jsx(vr,{label:c.undoLabel?`Undo ${c.undoLabel} (${qO("undo")})`:`Undo (${qO("undo")})`,side:"bottom",children:d.jsx("button",{type:"button",onClick:()=>{Pt("toolbar_action",{action:"undo"}),u()},disabled:!c.canUndo,className:`h-7 w-7 flex items-center justify-center rounded-md transition-colors active:scale-[0.98] ${c.canUndo?"text-neutral-400 hover:text-neutral-200 hover:bg-neutral-800":"text-neutral-700 cursor-default"}`,"aria-label":"Undo",children:d.jsx(el,{size:14})})}),d.jsx(vr,{label:c.redoLabel?`Redo ${c.redoLabel} (${qO("redo")})`:`Redo (${qO("redo")})`,side:"bottom",children:d.jsx("button",{type:"button",onClick:()=>{Pt("toolbar_action",{action:"redo"}),f()},disabled:!c.canRedo,className:`h-7 w-7 flex items-center justify-center rounded-md transition-colors active:scale-[0.98] ${c.canRedo?"text-neutral-400 hover:text-neutral-200 hover:bg-neutral-800":"text-neutral-700 cursor-default"}`,"aria-label":"Redo",children:d.jsx(kfe,{size:14})})}),d.jsx(vr,{label:i?"Capturing frame…":"Capture current frame",side:"bottom",children:d.jsxs("a",{href:t,download:e,onClick:w=>{if(i){w.preventDefault();return}Pt("toolbar_action",{action:"capture_frame"}),n(w)},onFocus:r,onPointerDown:r,"aria-disabled":i||void 0,className:`h-7 flex items-center gap-1.5 px-2.5 rounded-md text-[11px] font-medium transition-colors ${i?"text-neutral-600 cursor-default":"text-neutral-400 hover:text-neutral-200 hover:bg-neutral-800 active:scale-[0.98]"}`,"aria-label":i?"Capturing frame":"Capture current frame",children:[i?d.jsxs("svg",{className:"animate-spin motion-reduce:animate-none h-3.5 w-3.5",viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",children:[d.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),d.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}):d.jsx(v9e,{size:14}),d.jsx("span",{children:i?"Capturing…":"Capture"})]})}),d.jsx(vr,{label:"Inspector",side:"bottom",children:d.jsxs("button",{type:"button",onClick:()=>{if(Hst(p,a)){Pt("panel_toggle",{panel:"inspector",collapsed:!1}),m("design"),y(!1);return}Pt("panel_toggle",{panel:"inspector",collapsed:!0}),y(!0)},"aria-pressed":s,className:`h-7 flex items-center gap-1.5 px-2.5 rounded-md text-[11px] font-medium border transition-colors active:scale-[0.98] ${s?"text-studio-accent bg-studio-accent/10 border-studio-accent/30":"text-neutral-500 hover:text-neutral-300 hover:bg-neutral-800 border-transparent"}`,"aria-label":"Inspector",children:[d.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[d.jsx("circle",{cx:"12",cy:"12",r:"10"}),d.jsx("polygon",{points:"10 8 16 12 10 16",fill:"currentColor",stroke:"none"})]}),"Inspector"]})}),d.jsx(vr,{label:b?"FFmpeg is not installed. Opens the Renders panel with the install command.":v?"A render is already in progress":"Render and export this composition",side:"bottom",children:d.jsx("button",{type:"button",disabled:v,onClick:()=>{v||(m("renders"),y(!1),!b&&(o==null||o()))},className:"h-7 flex items-center gap-1.5 px-3 rounded-md text-[11px] font-semibold bg-studio-accent text-[#09090B] enabled:hover:brightness-110 transition-[filter,transform] enabled:active:scale-[0.98] disabled:opacity-50 disabled:cursor-not-allowed",children:v?"Rendering…":"Export"})})]})]})}function zst(t,e){let n=1,r=1,i=0,s=0;try{const c=e.contentWindow.gsap;c!=null&&c.getProperty&&(n=Number(c.getProperty(t,"opacity"))||1,r=Number(c.getProperty(t,"scaleX"))||1,i=Number(c.getProperty(t,"x"))||0,s=Number(c.getProperty(t,"y"))||0)}catch{}const a=Number.parseFloat(t.style.getPropertyValue("--hf-studio-offset-x"))||0,o=Number.parseFloat(t.style.getPropertyValue("--hf-studio-offset-y"))||0;return(t.style.translate??"").includes("var(")&&(i+=a,s+=o),{baseX:i,baseY:s,baseOpacity:n,baseScale:r,cssOffX:a,cssOffY:o}}function Zst(t,e,n,r){var i,s,a;try{const o=e.contentWindow,l=o!=null&&o.__timelines?((i=Object.entries(o.__timelines).find(([c,u])=>c!=="__proxied"&&typeof(u==null?void 0:u.seek)=="function"))==null?void 0:i[1])??null:null;if((s=o==null?void 0:o.gsap)!=null&&s.set&&(l!=null&&l.seek)&&n){const c=l.duration();return{timeline:l,gsap:o.gsap,selector:n,element:t,startTime:((a=o.__player)==null?void 0:a.getTime())??0,maxSeekTime:r!=null&&r0?e.width/i:1}function Wst(t,e,n,r,i){const s={};let a=i.opacity,o=i.scale,l=i.z;return r.meta?(a=Math.max(0,Math.min(1,1-e*.005)),s.opacity=a,n!==0&&(o=Math.max(.01,i.scale+n*.01),s.scale=o)):r.shift?(s.rotationX=e*.5,s.rotationY=t*.5):r.alt?s.rotation=t*.5:(s.x=t,s.y=e),!r.meta&&n!==0&&(l=i.z+n,s.z=l),{properties:s,nextState:{opacity:a,scale:o,z:l}}}function qst(){return{pointer:{x:0,y:0},startPointer:{x:0,y:0},hasMoved:!1,scrollDelta:0,modifiers:{shift:!1,alt:!1,meta:!1},accumulated:{opacity:1,scale:1,z:0},basePosition:{x:0,y:0},cssVarOffset:{x:0,y:0},scale:1,runtime:null,rafId:0,samples:[],trail:[],cleanup:null}}function jN(t){const e=t.runtime;if(!e)return;const{element:n,savedVisibility:r,savedTranslate:i}=e;n.style.visibility=r,n.style.setProperty("translate",i||"");try{e.gsap.set(e.selector,{clearProps:"x,y,scale,scaleX,scaleY,rotation,rotationX,rotationY,opacity,z"})}catch{}(t.cssVarOffset.x||t.cssVarOffset.y)&&(n.style.setProperty("--hf-studio-offset-x",`${t.cssVarOffset.x}px`),n.style.setProperty("--hf-studio-offset-y",`${t.cssVarOffset.y}px`)),t.runtime=null}function Yst(){const[t,e]=x.useState(!1),[n,r]=x.useState(0),i=x.useRef(!1),s=x.useRef(qst()),a=x.useRef(s.current.samples),o=x.useRef(s.current.trail);x.useEffect(()=>{const f=s.current;return()=>{var h;i.current=!1,jN(f),(h=f.cleanup)==null||h.call(f),f.cleanup=null}},[]);const l=x.useCallback((f,h,p)=>{if(i.current)return;i.current=!0;const y=s.current;y.samples=[],y.trail=[],y.hasMoved=!1,y.scrollDelta=0,a.current=y.samples,o.current=y.trail,r(0);const m=zst(f,h);y.cssVarOffset={x:m.cssOffX,y:m.cssOffY},y.accumulated={opacity:m.baseOpacity,scale:m.baseScale,z:0},y.basePosition={x:m.baseX,y:m.baseY},y.scale=Xst(h);const v=f.id?`#${f.id}`:null;y.runtime=Zst(f,h,v,p),y.runtime&&(m.cssOffX||m.cssOffY)&&(f.style.setProperty("--hf-studio-offset-x","0px"),f.style.setProperty("--hf-studio-offset-y","0px"));const b=N=>{y.pointer={x:N.clientX,y:N.clientY},y.modifiers={shift:N.shiftKey,alt:N.altKey,meta:N.metaKey||N.ctrlKey}},w=N=>{y.hasMoved||(y.startPointer={x:y.pointer.x,y:y.pointer.y},y.hasMoved=!0),y.scrollDelta+=N.deltaY,y.modifiers={shift:N.shiftKey,alt:N.altKey,meta:N.metaKey||N.ctrlKey}},O=N=>{y.modifiers={shift:N.shiftKey,alt:N.altKey,meta:N.metaKey||N.ctrlKey}};document.addEventListener("pointermove",b,{passive:!0}),document.addEventListener("wheel",w,{passive:!0}),document.addEventListener("keydown",O,{passive:!0}),document.addEventListener("keyup",O,{passive:!0});const k=performance.now();y.startPointer={...y.pointer};const E=N=>{y.hasMoved||(y.startPointer={x:N.clientX,y:N.clientY},y.hasMoved=!0)};document.addEventListener("pointermove",E,{passive:!0,once:!0});const T=()=>{if(!i.current)return;const _=(performance.now()-k)/1e3,I=y.scale||1,j=(y.pointer.x-y.startPointer.x)/I,L=(y.pointer.y-y.startPointer.y)/I,B=y.scrollDelta;if(!y.hasMoved&&j===0&&L===0&&B===0){y.rafId=requestAnimationFrame(T);return}y.hasMoved=!0;const{properties:$,nextState:z}=Wst(j,L,B,y.modifiers,y.accumulated);if("x"in $&&($.x=Math.round(y.basePosition.x+$.x)),"y"in $&&($.y=Math.round(y.basePosition.y+$.y)),y.accumulated=z,y.scrollDelta=0,y.runtime)try{Gst(y.runtime,_,$)}catch{jN(y)}Ust(y,_,$),r(_),y.rafId=requestAnimationFrame(T)};e(!0),y.rafId=requestAnimationFrame(T),y.cleanup=()=>{cancelAnimationFrame(y.rafId),document.removeEventListener("pointermove",b),document.removeEventListener("wheel",w),document.removeEventListener("keydown",O),document.removeEventListener("keyup",O),document.removeEventListener("pointermove",E)}},[]),c=x.useCallback(()=>{var p,y;if(!i.current)return[];i.current=!1;const f=s.current;jN(f),(p=f.cleanup)==null||p.call(f),f.cleanup=null;const h=f.samples.slice();return r(h.length>0?((y=h[h.length-1])==null?void 0:y.time)??0:0),e(!1),h},[]),u=x.useCallback(()=>{const f=s.current;f.samples=[],f.trail=[],a.current=f.samples,o.current=f.trail,r(0),f.accumulated={opacity:1,scale:1,z:0},f.scrollDelta=0},[]);return{startRecording:l,stopRecording:c,isRecording:t,samplesRef:a,trailRef:o,recordingDuration:n,clearSamples:u}}function Kst(t,e,n,r,i,s){if(i===n)return Math.abs(e-r);const a=r+(s-r)*(t-n)/(i-n);return Math.abs(e-a)}function XR(t,e){if(t.length<=2||e<=0)return t;const n=t[0],r=t[t.length-1];let i=0,s=0;for(let a=1;ai&&(i=o,s=a)}if(i>e){const a=XR(t.slice(0,s+1),e),o=XR(t.slice(s),e);return a.slice(0,-1).concat(o)}return[n,r]}function Jst(t,e,n){if(t.length===0)return new Map;if(e<=0)return new Map;const r=new Set;for(const o of t)for(const l of Object.keys(o.properties))r.add(l);const i=new Set;for(const o of r){const l=[];for(const f of t)o in f.properties&&l.push({time:f.time,value:f.properties[o]});const c=typeof n=="function"?n(o):n,u=XR(l,c);for(const f of u)i.add(f.time)}const s=Array.from(i).sort((o,l)=>o-l),a=new Map;for(const o of s){const l=Math.round(o/e*1e3)/10,c={};for(const u of r)c[u]=eat(t,u,o);a.set(l,c)}return a}function eat(t,e,n){let r,i;for(const a of t){if(!(e in a.properties))continue;const o=a.properties[e];a.time<=n&&(r={time:a.time,value:o}),a.time>=n&&i===void 0&&(i={time:a.time,value:o})}if(r&&r.time===n)return r.value;if(i&&i.time===n||!r)return i.value;if(!i)return r.value;const s=(n-r.time)/(i.time-r.time);return r.value+(i.value-r.value)*s}const tat="custom(M0,0 C0.333,0 0.667,1 1,1)",nat="custom(M0,0 C0.333,0.333 0.667,1 1,1)",rat="custom(M0,0 C0.333,0 0.667,0.667 1,1)",PK=.3;function iat(t,e,n){const r=t.filter(s=>s.time>=e&&s.time<=n);if(r.length<2)return 0;let i=0;for(let s=1;s0&&(i+=Math.abs(r[s].value-r[s-1].value)/a)}return i/(r.length-1)}function MK(t,e,n,r){const i=t.filter(a=>r==="start"?a.time>=e&&a.time<=e+n:a.time>=e-n&&a.time<=e);if(i.length<2)return 0;let s=0;for(let a=1;a0&&(s+=Math.abs(i[a].value-i[a-1].value)/o)}return s/(i.length-1)}function sat(t,e,n){if(t.length<2||e.length<3)return t;const r=[...t.map(i=>({...i}))];for(let i=1;ih&&(h=N,f=k)}const p=e.filter(k=>k.time>=o&&k.time<=l).map(k=>({time:k.time,value:k.properties[f]??0}));if(p.length<3)continue;const y=c*.25,m=iat(p,o,l);if(m<1e-6)continue;const v=MK(p,o,y,"start"),b=MK(p,l,y,"end"),w=v/m{if(s===0||s===t.length-1)return i;const a={...i.properties};for(const o of r){let l=0,c=0;for(let u=Math.max(0,s-e);u<=Math.min(t.length-1,s+e);u++){const f=t[u].properties[o];if(typeof f!="number")continue;const h=aat(u-s,n);l+=h,c+=f*h}l>0&&(a[o]=Math.round(c/l*1e3)/1e3)}return{percentage:i.percentage,properties:a}})}function NK(t){const e=[],n=new Map;for(const r of t){const i=new Map;for(const[s,a]of Object.entries(r.properties)){const o=rl(s);let l=i.get(o);l||(l={},i.set(o,l)),l[s]=a}for(const[s,a]of i){let o=n.get(s);o||(o=[],n.set(s,o),e.push(s)),o.push({percentage:r.percentage,properties:a,...r.ease?{ease:r.ease}:{}})}}return e.map(r=>n.get(r))}function DK(t,e){return t===e-1?{softReload:!0}:{skipReload:!0}}let lat=0;function cat({domEditSessionRef:t,previewIframeRef:e,showToast:n,isGestureRecordingRef:r}){const i=Yst(),[s,a]=x.useState("idle"),o=x.useRef("idle"),l=x.useRef(void 0),c=x.useRef(0),u=x.useRef(!1),f=x.useRef(null);x.useEffect(()=>()=>clearInterval(l.current),[]);const h=x.useCallback(async()=>{var b,w;if(clearInterval(l.current),u.current)return;u.current=!0;const y={coalesceKey:`gesture-recording:${++lat}`,coalesceMs:Number.POSITIVE_INFINITY};o.current="idle",r.current=!1;const m=i.stopRecording(),v=ue.getState();v.setIsPlaying(!1);try{const O=t.current,k=f.current;if(!k){m.length>2&&n("Selection lost during recording","error");return}const E=m.length>0?((b=m[m.length-1])==null?void 0:b.time)??0:0;if(m.length<=2){n("No gesture detected — move the pointer while recording","error");return}if(E<=0){n("Recording too short — try again","error");return}const T=Jst(m,E,j=>j==="opacity"||j==="scale"||j==="scaleX"||j==="scaleY"?.01:5),N=Array.from(T.keys()).sort((j,L)=>j-L);!T.has(0)&&m.length>0&&(T.set(0,m[0].properties),N.includes(0)||N.unshift(0));const _=k.id?Mg(k.id):k.selector;if(!_){n("Cannot save — element has no selector","error");return}const I=Ec(k);if(!I){n("Cannot save: element has no unique selector","error");return}if(O.commitMutation){const j=c.current,L=N.map(J=>({percentage:J,properties:T.get(J)})),B=oat(L,3),$=sat(B,m,E),z=$.some(J=>Object.keys(J.properties).some(ne=>rl(ne)==="position")),Y=O.selectedGsapAnimations??[],W=z?Y.find(J=>J.propertyGroup==="position"&&vy(J.targetSelector,_,k.element)):void 0;if(W)if(Xo(W))await O.commitMutation({type:"replace-with-keyframes",animationId:W.id,targetSelector:_,position:Xt(j),duration:Xt(E),keyframes:$},{label:"Gesture recording (replace set)",softReload:!0});else{const J=W.resolvedStart??0,ne=W.duration??E,le=J+ne,ie=j+E;if(jJ-.05){const F=((w=W.keyframes)==null?void 0:w.keyframes)??[],U=ne>0?Math.max(0,(j-J)/ne*100):0,Z=ne>0?Math.min(100,(ie-J)/ne*100):100,K=F.filter(Q=>Q.percentageZ+.5).map(Q=>({percentage:Q.percentage,properties:Q.properties,...Q.ease?{ease:Q.ease}:{}})),ee=$.map(Q=>({percentage:U+Q.percentage/100*(Z-U),properties:Q.properties,...Q.ease?{ease:Q.ease}:{}})),re=[...K,...ee].sort((Q,H)=>Q.percentage-H.percentage);await O.commitMutation({type:"replace-with-keyframes",animationId:W.id,targetSelector:_,position:typeof W.position=="number"?W.position:J,duration:ne,keyframes:re},{label:"Gesture recording (merge)",softReload:!0})}else{const F=NK($);for(const[U,Z]of F.entries())await O.commitMutation({type:"add-with-keyframes",targetSelector:I,position:Xt(j),duration:Xt(E),keyframes:Z,easeEach:"none"},{label:"Gesture recording (new range)",...y,...DK(U,F.length)})}}else{const J=NK($);for(const[ne,le]of J.entries())await O.commitMutation({type:"add-with-keyframes",targetSelector:I,position:Xt(j),duration:Xt(E),keyframes:le,easeEach:"none"},{label:"Gesture recording",...y,...DK(ne,J.length)})}}n(`Recorded ${N.length} keyframes`,"info")}catch(O){console.error("[GR:error]",O),n(`Gesture commit failed: ${O}`,"error")}finally{v.requestSeek(c.current),i.clearSamples(),a("idle"),u.current=!1}},[i,n,r,t]),p=x.useCallback(()=>{var E,T;if(o.current==="recording"){h();return}const y=t.current.domEditSelection;if(!y){n("Select an element first","error");return}const m=e.current;if(!m){n("Preview not ready — try again","error");return}const v=ue.getState();c.current=v.currentTime;const b=Number.parseFloat(((E=y.dataAttributes)==null?void 0:E.start)??"0")||0,w=Number.parseFloat(((T=y.dataAttributes)==null?void 0:T.duration)??"0")||0,O=w>0?b+w:void 0;f.current=y,i.startRecording(y.element,m,O),o.current="recording",r.current=!0,a("recording"),clearInterval(l.current);const k=O??1/0;l.current=setInterval(()=>{const{currentTime:N,duration:_}=ue.getState(),I=Math.min(k,_);I>0&&N>=I-.05&&h()},100)},[i,n,h,e,t,r]);return{gestureState:s,gestureRecording:i,handleToggleRecording:p}}const uat=x.memo(function({samples:e,sampleCount:n,trail:r,simplifiedPoints:i,canvasRect:s,compositionSize:a,mode:o,accentColor:l="#3CE6AC"}){const c=x.useMemo(()=>s?r&&r.length>1?r.map(h=>`${h.x-s.left},${h.y-s.top}`).join(" "):e.length===0?"":e.filter(h=>h.properties.x!=null&&h.properties.y!=null).map(h=>`${h.properties.x},${h.properties.y}`).join(" "):"",[e,r,n,s==null?void 0:s.left,s==null?void 0:s.top]),u=x.useMemo(()=>{if(!i||i.size===0)return"";const h=[];for(const[p,y]of i)y.x!=null&&y.y!=null&&h.push({x:y.x,y:y.y,pct:p});return h.sort((p,y)=>p.pct-y.pct),h.length===0?"":h.map(p=>`${p.x},${p.y}`).join(" ")},[i]),f=x.useMemo(()=>{if(!i||i.size===0)return[];const h=[];for(const[p,y]of i)y.x!=null&&y.y!=null&&h.push({x:y.x,y:y.y,pct:p});return h.sort((p,y)=>p.pct-y.pct)},[i]);return!s||e.length<2&&!i?null:d.jsxs("svg",{className:"pointer-events-none fixed z-50",style:{left:s.left,top:s.top,width:s.width,height:s.height},viewBox:r&&r.length>1?`0 0 ${s.width} ${s.height}`:`0 0 ${(a==null?void 0:a.width)??s.width} ${(a==null?void 0:a.height)??s.height}`,children:[o==="recording"&&c&&d.jsx("polyline",{points:c,fill:"none",stroke:l,strokeWidth:"2",strokeOpacity:"0.6",strokeLinecap:"round",strokeLinejoin:"round"}),o==="preview"&&d.jsxs(d.Fragment,{children:[c&&d.jsx("polyline",{points:c,fill:"none",stroke:l,strokeWidth:"1",strokeOpacity:"0.2",strokeDasharray:"4 3",strokeLinecap:"round"}),u&&d.jsx("polyline",{points:u,fill:"none",stroke:l,strokeWidth:"2",strokeOpacity:"0.8",strokeLinecap:"round",strokeLinejoin:"round"}),f.map(h=>d.jsx("g",{transform:`translate(${h.x}, ${h.y})`,children:d.jsx("rect",{x:"-4",y:"-4",width:"8",height:"8",rx:"1",transform:"rotate(45)",fill:l,fillOpacity:"0.9"})},h.pct))]})]})});let WR=[],lge=[];(()=>{let t="lc,34,7n,7,7b,19,,,,2,,2,,,20,b,1c,l,g,,2t,7,2,6,2,2,,4,z,,u,r,2j,b,1m,9,9,,o,4,,9,,3,,5,17,3,3b,f,,w,1j,,,,4,8,4,,3,7,a,2,t,,1m,,,,2,4,8,,9,,a,2,q,,2,2,1l,,4,2,4,2,2,3,3,,u,2,3,,b,2,1l,,4,5,,2,4,,k,2,m,6,,,1m,,,2,,4,8,,7,3,a,2,u,,1n,,,,c,,9,,14,,3,,1l,3,5,3,,4,7,2,b,2,t,,1m,,2,,2,,3,,5,2,7,2,b,2,s,2,1l,2,,,2,4,8,,9,,a,2,t,,20,,4,,2,3,,,8,,29,,2,7,c,8,2q,,2,9,b,6,22,2,r,,,,,,1j,e,,5,,2,5,b,,10,9,,2u,4,,6,,2,2,2,p,2,4,3,g,4,d,,2,2,6,,f,,jj,3,qa,3,t,3,t,2,u,2,1s,2,,7,8,,2,b,9,,19,3,3b,2,y,,3a,3,4,2,9,,6,3,63,2,2,,1m,,,7,,,,,2,8,6,a,2,,1c,h,1r,4,1c,7,,,5,,14,9,c,2,w,4,2,2,,3,1k,,,2,3,,,3,1m,8,2,2,48,3,,d,,7,4,,6,,3,2,5i,1m,,5,ek,,5f,x,2da,3,3x,,2o,w,fe,6,2x,2,n9w,4,,a,w,2,28,2,7k,,3,,4,,p,2,5,,47,2,q,i,d,,12,8,p,b,1a,3,1c,,2,4,2,2,13,,1v,6,2,2,2,2,c,,8,,1b,,1f,,,3,2,2,5,2,,,16,2,8,,6m,,2,,4,,fn4,,kh,g,g,g,a6,2,gt,,6a,,45,5,1ae,3,,2,5,4,14,3,4,,4l,2,fx,4,ar,2,49,b,4w,,1i,f,1k,3,1d,4,2,2,1x,3,10,5,,8,1q,,c,2,1g,9,a,4,2,,2n,3,2,,,2,6,,4g,,3,8,l,2,1l,2,,,,,m,,e,7,3,5,5f,8,2,3,,,n,,29,,2,6,,,2,,,2,,2,6j,,2,4,6,2,,2,r,2,2d,8,2,,,2,2y,,,,2,6,,,2t,3,2,4,,5,77,9,,2,6t,,a,2,,,4,,40,4,2,2,4,,w,a,14,6,2,4,8,,9,6,2,3,1a,d,,2,ba,7,,6,,,2a,m,2,7,,2,,2,3e,6,3,,,2,,7,,,20,2,3,,,,9n,2,f0b,5,1n,7,t4,,1r,4,29,,f5k,2,43q,,,3,4,5,8,8,2,7,u,4,44,3,1iz,1j,4,1e,8,,e,,m,5,,f,11s,7,,h,2,7,,2,,5,79,7,c5,4,15s,7,31,7,240,5,gx7k,2o,3k,6o".split(",").map(e=>e?parseInt(e,36):1);for(let e=0,n=0;e>1;if(t=lge[r])e=r+1;else return!0;if(e==n)return!1}}function IK(t){return t>=127462&&t<=127487}const _K=8205;function hat(t,e,n=!0,r=!0){return(n?cge:dat)(t,e,r)}function cge(t,e,n){if(e==t.length)return e;e&&uge(t.charCodeAt(e))&&fge(t.charCodeAt(e-1))&&e--;let r=LN(t,e);for(e+=RK(r);e=0&&IK(LN(t,a));)s++,a-=2;if(s%2==0)break;e+=2}else break}return e}function dat(t,e,n){for(;e>0;){let r=cge(t,e-2,n);if(r=56320&&t<57344}function fge(t){return t>=55296&&t<56320}function RK(t){return t<65536?1:2}class yn{lineAt(e){if(e<0||e>this.length)throw new RangeError(`Invalid position ${e} in document of length ${this.length}`);return this.lineInner(e,!1,1,0)}line(e){if(e<1||e>this.lines)throw new RangeError(`Invalid line number ${e} in ${this.lines}-line document`);return this.lineInner(e,!0,1,0)}replace(e,n,r){[e,n]=qg(this,e,n);let i=[];return this.decompose(0,e,i,2),r.length&&r.decompose(0,r.length,i,3),this.decompose(n,this.length,i,1),du.from(i,this.length-(n-e)+r.length)}append(e){return this.replace(this.length,this.length,e)}slice(e,n=this.length){[e,n]=qg(this,e,n);let r=[];return this.decompose(e,n,r,0),du.from(r,n-e)}eq(e){if(e==this)return!0;if(e.length!=this.length||e.lines!=this.lines)return!1;let n=this.scanIdentical(e,1),r=this.length-this.scanIdentical(e,-1),i=new gv(this),s=new gv(e);for(let a=n,o=n;;){if(i.next(a),s.next(a),a=0,i.lineBreak!=s.lineBreak||i.done!=s.done||i.value!=s.value)return!1;if(o+=i.value.length,i.done||o>=r)return!0}}iter(e=1){return new gv(this,e)}iterRange(e,n=this.length){return new hge(this,e,n)}iterLines(e,n){let r;if(e==null)r=this.iter();else{n==null&&(n=this.lines+1);let i=this.line(e).from;r=this.iterRange(i,Math.max(i,n==this.lines+1?this.length:n<=1?0:this.line(n-1).to))}return new dge(r)}toString(){return this.sliceString(0)}toJSON(){let e=[];return this.flatten(e),e}constructor(){}static of(e){if(e.length==0)throw new RangeError("A document must have at least one line");return e.length==1&&!e[0]?yn.empty:e.length<=32?new zi(e):du.from(zi.split(e,[]))}}class zi extends yn{constructor(e,n=pat(e)){super(),this.text=e,this.length=n}get lines(){return this.text.length}get children(){return null}lineInner(e,n,r,i){for(let s=0;;s++){let a=this.text[s],o=i+a.length;if((n?r:o)>=e)return new mat(i,o,r,a);i=o+1,r++}}decompose(e,n,r,i){let s=e<=0&&n>=this.length?this:new zi(jK(this.text,e,n),Math.min(n,this.length)-Math.max(0,e));if(i&1){let a=r.pop(),o=X4(s.text,a.text.slice(),0,s.length);if(o.length<=32)r.push(new zi(o,a.length+s.length));else{let l=o.length>>1;r.push(new zi(o.slice(0,l)),new zi(o.slice(l)))}}else r.push(s)}replace(e,n,r){if(!(r instanceof zi))return super.replace(e,n,r);[e,n]=qg(this,e,n);let i=X4(this.text,X4(r.text,jK(this.text,0,e)),n),s=this.length+r.length-(n-e);return i.length<=32?new zi(i,s):du.from(zi.split(i,[]),s)}sliceString(e,n=this.length,r=` `){[e,n]=qg(this,e,n);let i="";for(let s=0,a=0;s<=n&&ae&&a&&(i+=r),es&&(i+=o.slice(Math.max(0,e-s),n-s)),s=l+1}return i}flatten(e){for(let n of this.text)e.push(n)}scanIdentical(){return 0}static split(e,n){let r=[],i=-1;for(let s of e)r.push(s),i+=s.length+1,r.length==32&&(n.push(new zi(r,i)),r=[],i=-1);return i>-1&&n.push(new zi(r,i)),n}}class du extends yn{constructor(e,n){super(),this.children=e,this.length=n,this.lines=0;for(let r of e)this.lines+=r.lines}lineInner(e,n,r,i){for(let s=0;;s++){let a=this.children[s],o=i+a.length,l=r+a.lines-1;if((n?l:o)>=e)return a.lineInner(e,n,r,i);i=o+1,r=l+1}}decompose(e,n,r,i){for(let s=0,a=0;a<=n&&s=a){let c=i&((a<=e?1:0)|(l>=n?2:0));a>=e&&l<=n&&!c?r.push(o):o.decompose(e-a,n-a,r,c)}a=l+1}}replace(e,n,r){if([e,n]=qg(this,e,n),r.lines=s&&n<=o){let l=a.replace(e-s,n-s,r),c=this.lines-a.lines+l.lines;if(l.lines>4&&l.lines>c>>6){let u=this.children.slice();return u[i]=l,new du(u,this.length-(n-e)+r.length)}return super.replace(s,o,l)}s=o+1}return super.replace(e,n,r)}sliceString(e,n=this.length,r=` @@ -428,4 +428,4 @@ audience: Add one \`## Frame N\` section per beat. Keep the arc tight. -Then run the review loop from the hyperframes-core skill (references/review-loop.md): present the plan as a proposal, offer wireframe sketches on this board, and build on the confirmed layouts.`}function c3t({path:t}){const[e,n]=x.useState(!1),r=l3t(t),i=async()=>{await Uf(r)&&(n(!0),window.setTimeout(()=>n(!1),2e3))};return d.jsxs("div",{children:[d.jsxs("div",{className:"rounded-lg border border-dashed border-neutral-800 px-6 py-10 text-center",children:[d.jsx("h2",{className:"text-base font-semibold text-neutral-300",children:"No storyboard yet"}),d.jsxs("p",{className:"mx-auto mt-2 max-w-md text-sm text-neutral-500",children:["Add a ",d.jsx("code",{className:"rounded bg-neutral-900 px-1 py-0.5 text-neutral-400",children:t})," ","at the project root to plan this video frame by frame. Hand this prompt to your coding agent to scaffold it."]}),d.jsxs("div",{className:"mx-auto mt-6 max-w-2xl overflow-hidden rounded-lg border border-neutral-800 bg-neutral-900 text-left",children:[d.jsxs("div",{className:"flex items-center justify-between border-b border-neutral-800 px-3 py-2",children:[d.jsx("span",{className:"font-mono text-xs text-neutral-500",children:"Prompt for your agent"}),d.jsx(zo,{size:"sm",variant:"secondary",onClick:i,icon:e?d.jsx(vue,{size:14}):d.jsx(Cue,{size:14}),children:e?"Copied":"Copy prompt"})]}),d.jsx("pre",{className:"max-h-64 overflow-auto px-4 py-3 font-mono text-xs leading-relaxed text-neutral-400 whitespace-pre-wrap",children:r})]})]}),d.jsx(u3t,{})]})}function u3t(){return d.jsxs("div",{"aria-hidden":"true",className:"mt-10 select-none opacity-40",children:[d.jsx("div",{className:"mb-4 text-center text-xs uppercase tracking-wide text-neutral-600",children:"Preview"}),d.jsx("div",{className:"grid gap-x-6 gap-y-8 [grid-template-columns:repeat(auto-fill,minmax(300px,1fr))]",children:[0,1,2].map(t=>d.jsxs("div",{className:"rounded-lg border border-neutral-800 bg-neutral-900/40 p-3",children:[d.jsx("div",{className:"aspect-video w-full rounded bg-neutral-800/60"}),d.jsx("div",{className:"mt-3 h-3 w-2/3 rounded bg-neutral-800/60"}),d.jsx("div",{className:"mt-2 h-2.5 w-full rounded bg-neutral-800/40"}),d.jsx("div",{className:"mt-1.5 h-2.5 w-4/5 rounded bg-neutral-800/40"})]},t))})]})}function f3t({waiting:t}){return d.jsx("div",{className:"h-full w-full bg-neutral-950 flex items-center justify-center",children:t?d.jsxs("div",{className:"flex flex-col items-center gap-3 text-center px-6",role:"status",children:[d.jsx("div",{className:"w-4 h-4 rounded-full border-2 border-neutral-700 border-t-neutral-500 animate-spin motion-reduce:animate-none"}),d.jsxs("p",{className:"text-xs text-neutral-600",children:["Waiting for preview server… run"," ",d.jsx("code",{className:"text-neutral-500 font-mono",children:"npm run dev"})]})]}):d.jsxs("div",{className:"flex flex-col items-center gap-3 text-center px-6",role:"status",children:[d.jsx("div",{className:"w-4 h-4 rounded-full bg-studio-accent animate-pulse motion-reduce:animate-none"}),d.jsx("p",{className:"text-xs text-neutral-600",children:"Connecting to project…"})]})})}function h3t(){const[t,e]=x.useState(null),[n,r]=x.useState(!0),[i,s]=x.useState(!1);return Or(()=>{const a=fR(window.location.hash);let o=!1,l=null;function c(){s(!0),l=window.setTimeout(u,2e3)}function u(){fetch("/api/projects").then(f=>f.json()).then(f=>{if(!o)if(a)e(a),s(!1);else{const h=(f.projects??[])[0];h?(e(h.id),s(!1),window.location.hash=qde(h.id)):c()}}).catch(()=>{o||c()}).finally(()=>{o||r(!1)})}return u(),()=>{o=!0,l!==null&&clearTimeout(l)}}),x.useEffect(()=>{const a=()=>{const o=fR(window.location.hash);o&&o!==t&&e(o)};return window.addEventListener("hashchange",a),()=>window.removeEventListener("hashchange",a)},[t]),{projectId:t,resolving:n,waitingForServer:i}}function d3t(t,e,n){x.useEffect(()=>{e||n||POe()||(MOe(),g8e({has_project:t!=null}))},[t,e,n])}function p3t(t,e){const n=()=>({start:ue.getState().currentTime,track:0});return{addAssetAtPlayhead:x.useCallback(r=>t(r,n()),[t]),addCompositionAtPlayhead:x.useCallback(r=>e(r,n()),[e])}}function m3t({hydrated:t,fileTreeLoaded:e,fileTree:n,initialUrlStateRef:r,setActiveCompPath:i,setHydrated:s}){x.useEffect(()=>{if(t||!e)return;const a=bst(r.current.activeCompPath,n);i(o=>o===a?o:a),s(!0)},[t,n,e,r,i,s])}const g3t=()=>ue.getState().selectedElementIds;function y3t(){const{projectId:t,resolving:e,waitingForServer:n}=h3t(),r=x.useRef(Cst()),i=Fst();d3t(t,e,n);const[s,a]=x.useState(null),[o,l]=x.useState(()=>r.current.activeCompPath==null),[c,u]=x.useState(new Map),[f,h]=x.useState(null),[p,y]=x.useState(!0),[m,v]=x.useState(0),[b,w]=YQe(),[O,k]=x.useState(null),E=x.useRef(null),T=x.useRef(s);T.current=s;const N=x.useRef(null),_=Q8e(t,T),I=An(gt=>gt.isEditMode),j=An(gt=>gt.selectedSegmentIds.size>0),L=CHe(t),B=ue(gt=>gt.elements),$=ue(gt=>gt.setSelectedElementId),z=ue(gt=>gt.setSelectedElementIds),Y=ue(gt=>gt.duration),W=ue(gt=>gt.isPlaying),J=Nst(Y,B),{toasts:ne,showToast:le,dismissToast:ie}=gst(),q=iQe({rightCollapsed:r.current.rightCollapsed,rightPanelTab:r.current.rightPanelTab}),F=HHe({projectId:t}),U=x.useRef(0),Z=x.useRef(null),K=x.useRef(new Set),ee=x.useRef(!1),re=x.useCallback(()=>v(gt=>gt+1),[]),Q=lQe({projectId:t,showToast:le,recordEdit:F.recordEdit,domEditSaveTimestampRef:U,setRefreshKey:v}),H=x.useMemo(()=>tge(Q.fileTree),[Q.fileTree]),{sdkHandle:se,editFlowSdkSession:fe}=oit(t,s,H);m3t({hydrated:o,fileTreeLoaded:Q.fileTreeLoaded,fileTree:Q.fileTree,initialUrlStateRef:r,setActiveCompPath:a,setHydrated:l});const be=qQe({showToast:le,readOptionalProjectFile:Q.readOptionalProjectFile,writeProjectFile:Q.writeProjectFile,recordEdit:F.recordEdit,previewIframeRef:E,activeCompPathRef:T,reloadPreview:()=>v(gt=>gt+1)}),me=bit({projectId:t,activeCompPath:s,masterCompPath:H,fileManager:Q,previewPersistence:be,pendingTimelineEditPathRef:K,reloadPreview:re}),pe=x.useRef(()=>{}),ge=x.useCallback(()=>pe.current(),[]),Pe=LJe({projectId:t,activeCompPath:s,timelineElements:B,showToast:le,writeProjectFile:Q.writeProjectFile,observeProjectFileVersion:Q.observeProjectFileVersion,recordEdit:F.recordEdit,domEditSaveTimestampRef:U,reloadPreview:re,previewIframeRef:E,pendingTimelineEditPathRef:K,uploadProjectFiles:Q.uploadProjectFiles,isRecordingRef:ee,sdkSession:fe,publishSdkSession:se.publish,forceReloadSdkSession:se.forceReload,invalidateGsapCache:ge,handleDomZIndexReorderCommitRef:Z}),ve=x.useCallback(async(gt,rr,Cn="timing",Rn)=>{const xt={handleTimelineGroupMove:Pe.handleTimelineGroupMove};await FJe(gt,rr,Cn,xt,Rn)},[Pe.handleTimelineGroupMove]),{addAssetAtPlayhead:xe,addCompositionAtPlayhead:we}=p3t(Pe.handleTimelineAssetDrop,Pe.handleTimelineCompositionDrop),{activeBlockParams:Ce,setActiveBlockParams:Me,handleAddBlock:Ve,handleTimelineBlockDrop:tt,handleAddMediaOverlay:Ze,handlePreviewBlockDrop:qe}=kit({projectId:t,blockCtxDeps:{activeCompPath:s,timelineElements:B,readProjectFile:Q.readProjectFile,writeProjectFile:Q.writeProjectFile,recordEdit:F.recordEdit,refreshFileTree:Q.refreshFileTree,reloadPreview:re,showToast:le},previewIframeRef:E,setRightCollapsed:q.setRightCollapsed,setRightPanelTab:q.setRightPanelTab}),pt=x.useRef(()=>{}),it=x.useRef(null),vt=x.useRef(async()=>{}),Ot=(gt,rr)=>vt.current(gt,rr),Kt=x.useRef(()=>!1),qt=x.useRef(()=>{}),{handleCopy:fn,handlePaste:Jt,handleCut:Je}=Vit({projectId:t,activeCompPath:s,domEditSelectionRef:it,showToast:le,writeProjectFile:Q.writeProjectFile,recordEdit:F.recordEdit,domEditSaveTimestampRef:U,reloadPreview:re,handleTimelineElementDelete:Pe.handleTimelineElementDelete,handleDomEditElementDelete:Ot,previewIframeRef:E}),St=jit({handleTimelineElementsDelete:Pe.handleTimelineElementsDelete,handleTimelineElementSplit:Pe.handleTimelineElementSplit,handleDomEditElementDelete:Ot,domEditSelectionRef:it,editHistory:F,readOptionalProjectFile:Q.readOptionalProjectFile,readProjectFile:Q.readProjectFile,writeProjectFile:Q.writeProjectFile,domEditSaveTimestampRef:U,showToast:le,syncHistoryPreviewAfterApply:be.syncHistoryPreviewAfterApply,waitForPendingDomEditSaves:be.waitForPendingDomEditSaves,leftSidebarRef:N,handleCopy:fn,handlePaste:Jt,handleCut:Je,onResetKeyframes:()=>Kt.current(),onDeleteSelectedKeyframes:()=>qt.current(),onAfterUndoRedo:()=>pe.current(),onGroupSelection:()=>mt.current.handleGroupSelection(),onUngroupSelection:()=>mt.current.handleUngroupSelection(),activeCompPath:s,forceReloadSdkSession:se.forceReload,onToggleRecording:()=>Mr.current()}),At=x.useRef({select:gt=>{var rr;return(rr=N.current)==null?void 0:rr.selectTab(gt)},get:()=>{var gt;return((gt=N.current)==null?void 0:gt.getTab())??"compositions"}}),Ke=Krt({projectId:t,activeCompPath:s,compIdToSrc:c,captionEditMode:I,compositionLoading:p,previewIframeRef:E,timelineElements:B,getTimelineSelectionSet:g3t,setSelectedTimelineElementId:$,setTimelineSelectionSet:z,setRightCollapsed:q.setRightCollapsed,setRightPanelTab:q.setRightPanelTab,showToast:le,isRecordingRef:ee,refreshPreviewDocumentVersion:w,queueDomEditSave:be.queueDomEditSave,readProjectFile:Q.readProjectFile,writeProjectFile:Q.writeProjectFile,updateEditingFileContent:Q.updateEditingFileContent,domEditSaveTimestampRef:U,editHistory:{recordEdit:F.recordEdit},fileTree:Q.fileTree,importedFontAssetsRef:Q.importedFontAssetsRef,projectDir:Q.projectDir,projectIdRef:Q.projectIdRef,previewIframe:f,refreshKey:m,previewDocumentVersion:b,rightPanelTab:q.rightPanelTab,applyStudioManualEditsToPreviewRef:be.applyStudioManualEditsToPreviewRef,syncPreviewHotkeys:St.syncPreviewHotkeys,reloadPreview:re,setRefreshKey:v,openSourceForSelection:Q.openSourceForSelection,selectSidebarTab:At.current.select,getSidebarTab:At.current.get,sdkSession:fe,publishSdkSession:se.publish,forceReloadSdkSession:se.forceReload});it.current=Ke.domEditSelection,Z.current=Ke.handleDomZIndexReorderCommit,pt.current=Ke.clearDomSelection,vt.current=Ke.handleDomEditElementDelete,Kt.current=Ke.handleResetSelectedElementKeyframes,pe.current=Ke.invalidateGsapCache,qt.current=()=>ZLe(Ke),eit(fe,Ke.domEditSelection,Ke.domEditGroupSelections),Uit({projectId:t,activeCompPath:s,compIdToSrc:c,captionEditMode:I,captionHasSelection:j,previewIframeRef:E,captionSync:L,setRightCollapsed:q.setRightCollapsed});const Be=ist({projectIdRef:Q.projectIdRef,compIdToSrc:c,activePreviewUrl:s?`/api/projects/${t}/preview/comp/${s}`:null,effectiveTimelineDuration:J}),We=J1e(),{lintModal:Ye,linting:Zt,handleLint:Te,closeLintModal:De,findingsByFile:ze}=lst(t,m),st=ast({projectId:t,activeCompPath:s,showToast:le,waitForPendingDomEditSaves:be.waitForPendingDomEditSaves}),{consoleErrors:Gt,setConsoleErrors:ln,resetErrors:Yt}=sst(f),Nn=Rst(Pe.handleTimelineFileDrop),Mr=x.useRef(()=>{}),mt=x.useRef(Ke);mt.current=Ke;const{gestureState:vn,gestureRecording:mn,handleToggleRecording:Tn}=cat({domEditSessionRef:mt,previewIframeRef:E,showToast:le,isGestureRecordingRef:ee});Mr.current=Tn;const Ln=x.useRef(null);x.useLayoutEffect(()=>{if(vn!=="recording"||!f){Ln.current=null;return}Ln.current=f.getBoundingClientRect()},[vn,f]);const et=x.useCallback(gt=>{E.current=gt,h(gt),St.syncPreviewHotkeys(gt),Yt(),w()},[St,Yt,w]),{setEditingFile:Yn}=Q,Mt=yst({projectId:t,setEditingFile:Yn,setActiveCompPath:a,showToast:le}),{designPanelActive:hn,inspectorPanelActive:Ht,inspectorButtonActive:dn,shouldShowMotionPath:tr,shouldShowSelectedDomBounds:_n}=Ist(q.rightPanelTab,q.rightInspectorPanes,q.effectiveRightCollapsed,W,Ke.domEditSelection,vn==="recording");Mst({projectId:t,activeCompPath:s,duration:J,isPlaying:W,compositionLoading:p,refreshKey:m,previewIframeRef:E,rightPanelTab:q.rightPanelTab,rightCollapsed:q.rightCollapsed,activeCompPathHydrated:o,domEditSelection:Ke.domEditSelection,domEditGroupSelections:Ke.domEditGroupSelections,applyMarqueeSelection:Ke.applyMarqueeSelection,buildDomSelectionFromTarget:Ke.buildDomSelectionFromTarget,applyDomSelection:Ke.applyDomSelection,setRightPanelTab:q.setRightPanelTab,initialState:r.current});const xr=Dst({projectId:t,activeCompPath:s,setActiveCompPath:a,showToast:le,previewIframeRef:E,captionEditMode:I,compositionLoading:p,refreshKey:m,setRefreshKey:v,timelineElements:B,isPlaying:W,editHistory:F,handleUndo:St.handleUndo,handleRedo:St.handleRedo,renderQueue:_,compositionDimensions:We,domEditSaveQueuePaused:be.domEditSaveQueuePaused,externalFileConflict:me.blocked!==null,waitForPendingDomEditSaves:be.waitForPendingDomEditSaves,handlePreviewIframeRef:et,refreshPreviewDocumentVersion:w}),nr=x.useMemo(()=>d.jsx(FCt,{domEditSession:Ke,onSplitElement:Pe.handleTimelineElementSplit}),[Ke,Pe.handleTimelineElementSplit]);return e||n||!t?d.jsx(f3t,{waiting:n}):d.jsx(x$e,{value:xr,children:d.jsx(b$e,{value:xr,children:d.jsx($st,{value:i,children:d.jsx(jst,{value:q,children:d.jsx(Tke,{value:Q,children:d.jsx(EIe,{value:Ke,children:d.jsxs("div",{className:"flex flex-col h-full w-full bg-neutral-950 relative",onDragOver:Nn.onDragOver,onDragEnter:Nn.onDragEnter,onDragLeave:Nn.onDragLeave,onDrop:Nn.onDrop,children:[d.jsx(Qst,{captureFrameHref:st.captureFrameHref,captureFrameFilename:st.captureFrameFilename,handleCaptureFrameClick:st.handleCaptureFrameClick,refreshCaptureFrameTime:st.refreshCaptureFrameTime,capturing:st.capturing,inspectorButtonActive:dn,inspectorPanelActive:Ht,onExport:()=>{(async()=>(await be.waitForPendingDomEditSaves(),await _.startRender(void 0)))()}}),be.domEditSaveQueuePaused&&!me.blocked&&d.jsx(bHe,{message:be.domEditSaveQueuePaused,onRetry:be.resetDomEditSaveQueueBreaker}),d.jsx(wHe,{coordinator:me}),i.viewMode==="storyboard"&&d.jsx(o3t,{projectId:t,onSelectComposition:Mt}),d.jsx(sAt,{hidden:i.viewMode==="storyboard",left:d.jsx(ygt,{leftSidebarRef:N,onSelectComposition:Mt,onAddBlock:Ve,onPreviewBlock:k,onLint:Te,linting:Zt,lintFindingCount:(Ye==null?void 0:Ye.length)??ze.size,lintFindingsByFile:ze,onAddAssetToTimeline:xe,onAddCompositionToTimeline:we}),right:q.effectiveRightCollapsed?null:d.jsx(SCt,{designPanelActive:hn,activeBlockParams:Ce,onCloseBlockParams:()=>{Me(null),q.setRightPanelTab("design")},recordingState:vn,recordingDuration:mn.recordingDuration,onToggleRecording:Tn,sdkSession:se.session,publishSdkSession:se.publish,forceReloadSdkSession:se.forceReload,reloadPreview:re,domEditSaveTimestampRef:U,recordEdit:F.recordEdit,onToggleElementHidden:Pe.handleToggleElementHidden,onAutoGroupCarveSources:Pe.handleAutoGroupCarveSources,onAddMediaOverlay:Ze}),timelineToolbar:nr,renderClipContent:Be,handleTimelineElementDelete:Pe.handleTimelineElementDelete,handleTimelineAssetDrop:Pe.handleTimelineAssetDrop,handleTimelineBlockDrop:tt,handleTimelineCompositionDrop:Pe.handleTimelineCompositionDrop,handlePreviewBlockDrop:qe,handleTimelineFileDrop:Pe.handleTimelineFileDrop,handleTimelineElementMove:Pe.handleTimelineElementMove,handleTimelineElementsMove:ve,handleTimelineElementResize:Pe.handleTimelineElementResize,handleTimelineGroupResize:Pe.handleTimelineGroupResize,handleToggleTrackHidden:Pe.handleToggleTrackHidden,setAudioGroupAttribute:Pe.setAudioGroupAttribute,handleGroupClips:Pe.handleAutoGroupCarveSources,setElementFxAttribute:Pe.setElementFxAttribute,handleBlockedTimelineEdit:Pe.handleBlockedTimelineEdit,handleTimelineElementSplit:Pe.handleTimelineElementSplit,handleRazorSplit:Pe.handleRazorSplit,handleRazorSplitAll:Pe.handleRazorSplitAll,setCompIdToSrc:u,setCompositionLoading:y,shouldShowMotionPath:tr,shouldShowSelectedDomBounds:_n,isGestureRecording:vn==="recording",recordingState:vn,onToggleRecording:Tn,blockPreview:O,gestureOverlay:vn==="recording"&&f?d.jsx(uat,{samples:mn.samplesRef.current,sampleCount:mn.samplesRef.current.length,trail:mn.trailRef.current,canvasRect:Ln.current,compositionSize:We??void 0,mode:"recording"}):void 0}),d.jsx(xHe,{projectId:t,projectDir:Q.projectDir,lintModal:Ye,closeLintModal:De,consoleErrors:Gt,clearConsoleErrors:()=>ln(null),domEditSession:Ke,activeCompPath:s,dragOverlayActive:Nn.active,toasts:ne,dismissToast:ie})]})})})})})})})}function x3t(){return x.useEffect(()=>{yie({reason:"crash"})},[]),d.jsx(Cde,{})}class b3t extends x.Component{constructor(){super(...arguments);Et(this,"state",{error:null})}static getDerivedStateFromError(n){return{error:n}}componentDidCatch(n,r){var i,s;console.error("[Studio] Uncaught error:",n,r.componentStack),Pt("crash",{error_message:n.message,error_name:n.name,stack_trace:((i=n.stack)==null?void 0:i.slice(0,4e3))??null,component_stack:((s=r.componentStack)==null?void 0:s.slice(0,2e3))??null})}render(){return this.state.error?d.jsxs("div",{className:"fixed inset-0 flex flex-col items-center justify-center gap-4 bg-neutral-950 font-sans text-neutral-200",children:[d.jsx("div",{className:"text-lg font-semibold",children:"Something went wrong"}),d.jsx("div",{className:"max-w-[480px] text-center text-[13px] text-neutral-500",children:this.state.error.message}),d.jsxs("div",{className:"mt-2 flex items-center gap-2",children:[d.jsx("button",{onClick:()=>this.setState({error:null}),className:"rounded-md bg-studio-accent px-5 py-2 text-sm font-medium text-neutral-950 transition-[filter] hover:brightness-110 active:scale-[0.98]",children:"Try again"}),d.jsx("button",{onClick:()=>window.location.reload(),className:"rounded-md border border-neutral-700 px-5 py-2 text-sm font-medium text-neutral-300 transition-colors hover:bg-neutral-800 active:scale-[0.98]",children:"Reload Studio"})]}),d.jsx("div",{className:"mt-6",children:d.jsx(x3t,{})})]}):this.props.children}}Pt("session_start");function ZSe(t){var e;return t instanceof Error?{error_message:t.message,error_name:t.name,stack_trace:((e=t.stack)==null?void 0:e.slice(0,4e3))??null}:{error_message:String(t),error_name:null,stack_trace:null}}function v3t(t,e){return!!(t.includes("Error fetching")&&(t.includes("404")||t.includes("Not Found"))||e==="EncodingError"||t.includes("unsupported or unrecognizable format")||t.includes("MEDIA_ERR_SRC_NOT_SUPPORTED"))}const GSe=50;let kI=0,EI=0,eie=!1,tie=!1;window.addEventListener("error",t=>{var e;if((e=t.message)!=null&&e.includes("ResizeObserver loop")){t.stopImmediatePropagation(),t.preventDefault();return}if(kI++,kI>GSe){eie||(eie=!0,Pt("error_cap_reached",{count:kI}));return}Pt("unhandled_error",{...ZSe(t.error),error_message:t.message,filename:t.filename,lineno:t.lineno,colno:t.colno})});let g4=0;window.addEventListener("unhandledrejection",t=>{const e=ZSe(t.reason);if(v3t(e.error_message,e.error_name)){g4++,(g4===1||g4%100===0)&&Pt("composition_asset_error_filtered",{error_message:e.error_message.slice(0,200),error_name:e.error_name,total_filtered:g4});return}if(EI++,EI>GSe){tie||(tie=!0,Pt("rejection_cap_reached",{count:EI}));return}Pt("unhandled_promise_rejection",e)});wOe.createRoot(document.getElementById("root")).render(d.jsx(x.StrictMode,{children:d.jsx(b3t,{children:d.jsx(y3t,{})})}));export{SEe as a,q7 as g,OEe as i,TPe as n,Td as r}; +Then run the review loop from the hyperframes-core skill (references/review-loop.md): present the plan as a proposal, offer wireframe sketches on this board, and build on the confirmed layouts.`}function c3t({path:t}){const[e,n]=x.useState(!1),r=l3t(t),i=async()=>{await Uf(r)&&(n(!0),window.setTimeout(()=>n(!1),2e3))};return d.jsxs("div",{children:[d.jsxs("div",{className:"rounded-lg border border-dashed border-neutral-800 px-6 py-10 text-center",children:[d.jsx("h2",{className:"text-base font-semibold text-neutral-300",children:"No storyboard yet"}),d.jsxs("p",{className:"mx-auto mt-2 max-w-md text-sm text-neutral-500",children:["Add a ",d.jsx("code",{className:"rounded bg-neutral-900 px-1 py-0.5 text-neutral-400",children:t})," ","at the project root to plan this video frame by frame. Hand this prompt to your coding agent to scaffold it."]}),d.jsxs("div",{className:"mx-auto mt-6 max-w-2xl overflow-hidden rounded-lg border border-neutral-800 bg-neutral-900 text-left",children:[d.jsxs("div",{className:"flex items-center justify-between border-b border-neutral-800 px-3 py-2",children:[d.jsx("span",{className:"font-mono text-xs text-neutral-500",children:"Prompt for your agent"}),d.jsx(zo,{size:"sm",variant:"secondary",onClick:i,icon:e?d.jsx(vue,{size:14}):d.jsx(Cue,{size:14}),children:e?"Copied":"Copy prompt"})]}),d.jsx("pre",{className:"max-h-64 overflow-auto px-4 py-3 font-mono text-xs leading-relaxed text-neutral-400 whitespace-pre-wrap",children:r})]})]}),d.jsx(u3t,{})]})}function u3t(){return d.jsxs("div",{"aria-hidden":"true",className:"mt-10 select-none opacity-40",children:[d.jsx("div",{className:"mb-4 text-center text-xs uppercase tracking-wide text-neutral-600",children:"Preview"}),d.jsx("div",{className:"grid gap-x-6 gap-y-8 [grid-template-columns:repeat(auto-fill,minmax(300px,1fr))]",children:[0,1,2].map(t=>d.jsxs("div",{className:"rounded-lg border border-neutral-800 bg-neutral-900/40 p-3",children:[d.jsx("div",{className:"aspect-video w-full rounded bg-neutral-800/60"}),d.jsx("div",{className:"mt-3 h-3 w-2/3 rounded bg-neutral-800/60"}),d.jsx("div",{className:"mt-2 h-2.5 w-full rounded bg-neutral-800/40"}),d.jsx("div",{className:"mt-1.5 h-2.5 w-4/5 rounded bg-neutral-800/40"})]},t))})]})}function f3t({waiting:t}){return d.jsx("div",{className:"h-full w-full bg-neutral-950 flex items-center justify-center",children:t?d.jsxs("div",{className:"flex flex-col items-center gap-3 text-center px-6",role:"status",children:[d.jsx("div",{className:"w-4 h-4 rounded-full border-2 border-neutral-700 border-t-neutral-500 animate-spin motion-reduce:animate-none"}),d.jsxs("p",{className:"text-xs text-neutral-600",children:["Waiting for preview server… run"," ",d.jsx("code",{className:"text-neutral-500 font-mono",children:"npm run dev"})]})]}):d.jsxs("div",{className:"flex flex-col items-center gap-3 text-center px-6",role:"status",children:[d.jsx("div",{className:"w-4 h-4 rounded-full bg-studio-accent animate-pulse motion-reduce:animate-none"}),d.jsx("p",{className:"text-xs text-neutral-600",children:"Connecting to project…"})]})})}function h3t(){const[t,e]=x.useState(null),[n,r]=x.useState(!0),[i,s]=x.useState(!1);return Or(()=>{const a=fR(window.location.hash);let o=!1,l=null;function c(){s(!0),l=window.setTimeout(u,2e3)}function u(){fetch("/api/projects").then(f=>f.json()).then(f=>{if(!o)if(a)e(a),s(!1);else{const h=(f.projects??[])[0];h?(e(h.id),s(!1),window.location.hash=qde(h.id)):c()}}).catch(()=>{o||c()}).finally(()=>{o||r(!1)})}return u(),()=>{o=!0,l!==null&&clearTimeout(l)}}),x.useEffect(()=>{const a=()=>{const o=fR(window.location.hash);o&&o!==t&&e(o)};return window.addEventListener("hashchange",a),()=>window.removeEventListener("hashchange",a)},[t]),{projectId:t,resolving:n,waitingForServer:i}}function d3t(t,e,n){x.useEffect(()=>{e||n||POe()||(MOe(),g8e({has_project:t!=null}))},[t,e,n])}function p3t(t,e){const n=()=>({start:ue.getState().currentTime,track:0});return{addAssetAtPlayhead:x.useCallback(r=>t(r,n()),[t]),addCompositionAtPlayhead:x.useCallback(r=>e(r,n()),[e])}}function m3t({hydrated:t,fileTreeLoaded:e,fileTree:n,initialUrlStateRef:r,setActiveCompPath:i,setHydrated:s}){x.useEffect(()=>{if(t||!e)return;const a=bst(r.current.activeCompPath,n);i(o=>o===a?o:a),s(!0)},[t,n,e,r,i,s])}const g3t=()=>ue.getState().selectedElementIds;function y3t(){const{projectId:t,resolving:e,waitingForServer:n}=h3t(),r=x.useRef(Cst()),i=Fst();d3t(t,e,n);const[s,a]=x.useState(null),[o,l]=x.useState(()=>r.current.activeCompPath==null),[c,u]=x.useState(new Map),[f,h]=x.useState(null),[p,y]=x.useState(!0),[m,v]=x.useState(0),[b,w]=YQe(),[O,k]=x.useState(null),E=x.useRef(null),T=x.useRef(s);T.current=s;const N=x.useRef(null),_=Q8e(t,T),I=An(gt=>gt.isEditMode),j=An(gt=>gt.selectedSegmentIds.size>0),L=CHe(t),B=ue(gt=>gt.elements),$=ue(gt=>gt.setSelectedElementId),z=ue(gt=>gt.setSelectedElementIds),Y=ue(gt=>gt.duration),W=ue(gt=>gt.isPlaying),J=Nst(Y,B),{toasts:ne,showToast:le,dismissToast:ie}=gst(),q=iQe({rightCollapsed:r.current.rightCollapsed,rightPanelTab:r.current.rightPanelTab}),F=HHe({projectId:t}),U=x.useRef(0),Z=x.useRef(null),K=x.useRef(new Set),ee=x.useRef(!1),re=x.useCallback(()=>v(gt=>gt+1),[]),Q=lQe({projectId:t,showToast:le,recordEdit:F.recordEdit,domEditSaveTimestampRef:U,setRefreshKey:v}),H=x.useMemo(()=>tge(Q.fileTree),[Q.fileTree]),{sdkHandle:se,editFlowSdkSession:fe}=oit(t,s,H);m3t({hydrated:o,fileTreeLoaded:Q.fileTreeLoaded,fileTree:Q.fileTree,initialUrlStateRef:r,setActiveCompPath:a,setHydrated:l});const be=qQe({showToast:le,readOptionalProjectFile:Q.readOptionalProjectFile,writeProjectFile:Q.writeProjectFile,recordEdit:F.recordEdit,previewIframeRef:E,activeCompPathRef:T,reloadPreview:()=>v(gt=>gt+1)}),me=bit({projectId:t,activeCompPath:s,masterCompPath:H,fileManager:Q,previewPersistence:be,pendingTimelineEditPathRef:K,reloadPreview:re}),pe=x.useRef(()=>{}),ge=x.useCallback(()=>pe.current(),[]),Pe=LJe({projectId:t,activeCompPath:s,timelineElements:B,showToast:le,writeProjectFile:Q.writeProjectFile,observeProjectFileVersion:Q.observeProjectFileVersion,recordEdit:F.recordEdit,domEditSaveTimestampRef:U,reloadPreview:re,previewIframeRef:E,pendingTimelineEditPathRef:K,uploadProjectFiles:Q.uploadProjectFiles,isRecordingRef:ee,sdkSession:fe,publishSdkSession:se.publish,forceReloadSdkSession:se.forceReload,invalidateGsapCache:ge,handleDomZIndexReorderCommitRef:Z}),ve=x.useCallback(async(gt,rr,Cn="timing",Rn)=>{const xt={handleTimelineGroupMove:Pe.handleTimelineGroupMove};await FJe(gt,rr,Cn,xt,Rn)},[Pe.handleTimelineGroupMove]),{addAssetAtPlayhead:xe,addCompositionAtPlayhead:we}=p3t(Pe.handleTimelineAssetDrop,Pe.handleTimelineCompositionDrop),{activeBlockParams:Ce,setActiveBlockParams:Me,handleAddBlock:Ve,handleTimelineBlockDrop:tt,handleAddMediaOverlay:Ze,handlePreviewBlockDrop:qe}=kit({projectId:t,blockCtxDeps:{activeCompPath:s,timelineElements:B,readProjectFile:Q.readProjectFile,writeProjectFile:Q.writeProjectFile,recordEdit:F.recordEdit,refreshFileTree:Q.refreshFileTree,reloadPreview:re,showToast:le},previewIframeRef:E,setRightCollapsed:q.setRightCollapsed,setRightPanelTab:q.setRightPanelTab}),pt=x.useRef(()=>{}),it=x.useRef(null),vt=x.useRef(async()=>{}),Ot=(gt,rr)=>vt.current(gt,rr),Kt=x.useRef(()=>!1),qt=x.useRef(()=>{}),{handleCopy:fn,handlePaste:Jt,handleCut:Je}=Vit({projectId:t,activeCompPath:s,domEditSelectionRef:it,showToast:le,writeProjectFile:Q.writeProjectFile,recordEdit:F.recordEdit,domEditSaveTimestampRef:U,reloadPreview:re,handleTimelineElementDelete:Pe.handleTimelineElementDelete,handleDomEditElementDelete:Ot,previewIframeRef:E}),St=jit({handleTimelineElementsDelete:Pe.handleTimelineElementsDelete,handleTimelineElementSplit:Pe.handleTimelineElementSplit,handleDomEditElementDelete:Ot,domEditSelectionRef:it,editHistory:F,readOptionalProjectFile:Q.readOptionalProjectFile,readProjectFile:Q.readProjectFile,writeProjectFile:Q.writeProjectFile,domEditSaveTimestampRef:U,showToast:le,syncHistoryPreviewAfterApply:be.syncHistoryPreviewAfterApply,waitForPendingDomEditSaves:be.waitForPendingDomEditSaves,leftSidebarRef:N,handleCopy:fn,handlePaste:Jt,handleCut:Je,onResetKeyframes:()=>Kt.current(),onDeleteSelectedKeyframes:()=>qt.current(),onAfterUndoRedo:()=>pe.current(),onGroupSelection:()=>mt.current.handleGroupSelection(),onUngroupSelection:()=>mt.current.handleUngroupSelection(),activeCompPath:s,forceReloadSdkSession:se.forceReload,onToggleRecording:()=>Mr.current()}),At=x.useRef({select:gt=>{var rr;return(rr=N.current)==null?void 0:rr.selectTab(gt)},get:()=>{var gt;return((gt=N.current)==null?void 0:gt.getTab())??"compositions"}}),Ke=Krt({projectId:t,activeCompPath:s,compIdToSrc:c,captionEditMode:I,compositionLoading:p,previewIframeRef:E,timelineElements:B,getTimelineSelectionSet:g3t,setSelectedTimelineElementId:$,setTimelineSelectionSet:z,setRightCollapsed:q.setRightCollapsed,setRightPanelTab:q.setRightPanelTab,showToast:le,isRecordingRef:ee,refreshPreviewDocumentVersion:w,queueDomEditSave:be.queueDomEditSave,readProjectFile:Q.readProjectFile,writeProjectFile:Q.writeProjectFile,updateEditingFileContent:Q.updateEditingFileContent,domEditSaveTimestampRef:U,editHistory:{recordEdit:F.recordEdit},fileTree:Q.fileTree,importedFontAssetsRef:Q.importedFontAssetsRef,projectDir:Q.projectDir,projectIdRef:Q.projectIdRef,previewIframe:f,refreshKey:m,previewDocumentVersion:b,rightPanelTab:q.rightPanelTab,applyStudioManualEditsToPreviewRef:be.applyStudioManualEditsToPreviewRef,syncPreviewHotkeys:St.syncPreviewHotkeys,reloadPreview:re,setRefreshKey:v,openSourceForSelection:Q.openSourceForSelection,selectSidebarTab:At.current.select,getSidebarTab:At.current.get,sdkSession:fe,publishSdkSession:se.publish,forceReloadSdkSession:se.forceReload});it.current=Ke.domEditSelection,Z.current=Ke.handleDomZIndexReorderCommit,pt.current=Ke.clearDomSelection,vt.current=Ke.handleDomEditElementDelete,Kt.current=Ke.handleResetSelectedElementKeyframes,pe.current=Ke.invalidateGsapCache,qt.current=()=>ZLe(Ke),eit(fe,Ke.domEditSelection,Ke.domEditGroupSelections),Uit({projectId:t,activeCompPath:s,compIdToSrc:c,captionEditMode:I,captionHasSelection:j,previewIframeRef:E,captionSync:L,setRightCollapsed:q.setRightCollapsed});const Be=ist({projectIdRef:Q.projectIdRef,compIdToSrc:c,activePreviewUrl:s?`/api/projects/${t}/preview/comp/${s}`:null,effectiveTimelineDuration:J}),We=J1e(),{lintModal:Ye,linting:Zt,handleLint:Te,closeLintModal:De,findingsByFile:ze}=lst(t,m),st=ast({projectId:t,activeCompPath:s,showToast:le,waitForPendingDomEditSaves:be.waitForPendingDomEditSaves}),{consoleErrors:Gt,setConsoleErrors:ln,resetErrors:Yt}=sst(f),Nn=Rst(Pe.handleTimelineFileDrop),Mr=x.useRef(()=>{}),mt=x.useRef(Ke);mt.current=Ke;const{gestureState:vn,gestureRecording:mn,handleToggleRecording:Tn}=cat({domEditSessionRef:mt,previewIframeRef:E,showToast:le,isGestureRecordingRef:ee});Mr.current=Tn;const Ln=x.useRef(null);x.useLayoutEffect(()=>{if(vn!=="recording"||!f){Ln.current=null;return}Ln.current=f.getBoundingClientRect()},[vn,f]);const et=x.useCallback(gt=>{E.current=gt,h(gt),St.syncPreviewHotkeys(gt),Yt(),w()},[St,Yt,w]),{setEditingFile:Yn}=Q,Mt=yst({projectId:t,setEditingFile:Yn,setActiveCompPath:a,showToast:le}),{designPanelActive:hn,inspectorPanelActive:Ht,inspectorButtonActive:dn,shouldShowMotionPath:tr,shouldShowSelectedDomBounds:_n}=Ist(q.rightPanelTab,q.rightInspectorPanes,q.effectiveRightCollapsed,W,Ke.domEditSelection,vn==="recording");Mst({projectId:t,activeCompPath:s,duration:J,isPlaying:W,compositionLoading:p,refreshKey:m,previewIframeRef:E,rightPanelTab:q.rightPanelTab,rightCollapsed:q.rightCollapsed,activeCompPathHydrated:o,domEditSelection:Ke.domEditSelection,domEditGroupSelections:Ke.domEditGroupSelections,applyMarqueeSelection:Ke.applyMarqueeSelection,buildDomSelectionFromTarget:Ke.buildDomSelectionFromTarget,applyDomSelection:Ke.applyDomSelection,setRightPanelTab:q.setRightPanelTab,initialState:r.current});const xr=Dst({projectId:t,activeCompPath:s,setActiveCompPath:a,showToast:le,previewIframeRef:E,captionEditMode:I,compositionLoading:p,refreshKey:m,setRefreshKey:v,timelineElements:B,isPlaying:W,editHistory:F,handleUndo:St.handleUndo,handleRedo:St.handleRedo,renderQueue:_,compositionDimensions:We,domEditSaveQueuePaused:be.domEditSaveQueuePaused,externalFileConflict:me.blocked!==null,waitForPendingDomEditSaves:be.waitForPendingDomEditSaves,handlePreviewIframeRef:et,refreshPreviewDocumentVersion:w}),nr=x.useMemo(()=>d.jsx(FCt,{domEditSession:Ke,onSplitElement:Pe.handleTimelineElementSplit}),[Ke,Pe.handleTimelineElementSplit]);return e||n||!t?d.jsx(f3t,{waiting:n}):d.jsx(x$e,{value:xr,children:d.jsx(b$e,{value:xr,children:d.jsx($st,{value:i,children:d.jsx(jst,{value:q,children:d.jsx(Tke,{value:Q,children:d.jsx(EIe,{value:Ke,children:d.jsxs("div",{className:"flex flex-col h-full w-full bg-neutral-950 relative",onDragOver:Nn.onDragOver,onDragEnter:Nn.onDragEnter,onDragLeave:Nn.onDragLeave,onDrop:Nn.onDrop,children:[d.jsx(Qst,{captureFrameHref:st.captureFrameHref,captureFrameFilename:st.captureFrameFilename,handleCaptureFrameClick:st.handleCaptureFrameClick,refreshCaptureFrameTime:st.refreshCaptureFrameTime,capturing:st.capturing,inspectorButtonActive:dn,inspectorPanelActive:Ht,onExport:(new URLSearchParams(window.location.search).get("crocoView")==="script"&&(window.__crocoExportAdapter=async(options={})=>{await be.waitForPendingDomEditSaves();await _.startRender(options)}),()=>{(async()=>(await be.waitForPendingDomEditSaves(),await _.startRender(void 0)))()})}),be.domEditSaveQueuePaused&&!me.blocked&&d.jsx(bHe,{message:be.domEditSaveQueuePaused,onRetry:be.resetDomEditSaveQueueBreaker}),d.jsx(wHe,{coordinator:me}),i.viewMode==="storyboard"&&d.jsx(o3t,{projectId:t,onSelectComposition:Mt}),d.jsx(sAt,{hidden:i.viewMode==="storyboard",left:d.jsx(ygt,{leftSidebarRef:N,onSelectComposition:Mt,onAddBlock:Ve,onPreviewBlock:k,onLint:Te,linting:Zt,lintFindingCount:(Ye==null?void 0:Ye.length)??ze.size,lintFindingsByFile:ze,onAddAssetToTimeline:xe,onAddCompositionToTimeline:we}),right:q.effectiveRightCollapsed?null:d.jsx(SCt,{designPanelActive:hn,activeBlockParams:Ce,onCloseBlockParams:()=>{Me(null),q.setRightPanelTab("design")},recordingState:vn,recordingDuration:mn.recordingDuration,onToggleRecording:Tn,sdkSession:se.session,publishSdkSession:se.publish,forceReloadSdkSession:se.forceReload,reloadPreview:re,domEditSaveTimestampRef:U,recordEdit:F.recordEdit,onToggleElementHidden:Pe.handleToggleElementHidden,onAutoGroupCarveSources:Pe.handleAutoGroupCarveSources,onAddMediaOverlay:Ze}),timelineToolbar:nr,renderClipContent:Be,handleTimelineElementDelete:Pe.handleTimelineElementDelete,handleTimelineAssetDrop:Pe.handleTimelineAssetDrop,handleTimelineBlockDrop:tt,handleTimelineCompositionDrop:Pe.handleTimelineCompositionDrop,handlePreviewBlockDrop:qe,handleTimelineFileDrop:Pe.handleTimelineFileDrop,handleTimelineElementMove:Pe.handleTimelineElementMove,handleTimelineElementsMove:ve,handleTimelineElementResize:Pe.handleTimelineElementResize,handleTimelineGroupResize:Pe.handleTimelineGroupResize,handleToggleTrackHidden:Pe.handleToggleTrackHidden,setAudioGroupAttribute:Pe.setAudioGroupAttribute,handleGroupClips:Pe.handleAutoGroupCarveSources,setElementFxAttribute:Pe.setElementFxAttribute,handleBlockedTimelineEdit:Pe.handleBlockedTimelineEdit,handleTimelineElementSplit:Pe.handleTimelineElementSplit,handleRazorSplit:Pe.handleRazorSplit,handleRazorSplitAll:Pe.handleRazorSplitAll,setCompIdToSrc:u,setCompositionLoading:y,shouldShowMotionPath:tr,shouldShowSelectedDomBounds:_n,isGestureRecording:vn==="recording",recordingState:vn,onToggleRecording:Tn,blockPreview:O,gestureOverlay:vn==="recording"&&f?d.jsx(uat,{samples:mn.samplesRef.current,sampleCount:mn.samplesRef.current.length,trail:mn.trailRef.current,canvasRect:Ln.current,compositionSize:We??void 0,mode:"recording"}):void 0}),d.jsx(xHe,{projectId:t,projectDir:Q.projectDir,lintModal:Ye,closeLintModal:De,consoleErrors:Gt,clearConsoleErrors:()=>ln(null),domEditSession:Ke,activeCompPath:s,dragOverlayActive:Nn.active,toasts:ne,dismissToast:ie})]})})})})})})})}function x3t(){return x.useEffect(()=>{yie({reason:"crash"})},[]),d.jsx(Cde,{})}class b3t extends x.Component{constructor(){super(...arguments);Et(this,"state",{error:null})}static getDerivedStateFromError(n){return{error:n}}componentDidCatch(n,r){var i,s;console.error("[Studio] Uncaught error:",n,r.componentStack),Pt("crash",{error_message:n.message,error_name:n.name,stack_trace:((i=n.stack)==null?void 0:i.slice(0,4e3))??null,component_stack:((s=r.componentStack)==null?void 0:s.slice(0,2e3))??null})}render(){return this.state.error?d.jsxs("div",{className:"fixed inset-0 flex flex-col items-center justify-center gap-4 bg-neutral-950 font-sans text-neutral-200",children:[d.jsx("div",{className:"text-lg font-semibold",children:"Something went wrong"}),d.jsx("div",{className:"max-w-[480px] text-center text-[13px] text-neutral-500",children:this.state.error.message}),d.jsxs("div",{className:"mt-2 flex items-center gap-2",children:[d.jsx("button",{onClick:()=>this.setState({error:null}),className:"rounded-md bg-studio-accent px-5 py-2 text-sm font-medium text-neutral-950 transition-[filter] hover:brightness-110 active:scale-[0.98]",children:"Try again"}),d.jsx("button",{onClick:()=>window.location.reload(),className:"rounded-md border border-neutral-700 px-5 py-2 text-sm font-medium text-neutral-300 transition-colors hover:bg-neutral-800 active:scale-[0.98]",children:"Reload Studio"})]}),d.jsx("div",{className:"mt-6",children:d.jsx(x3t,{})})]}):this.props.children}}Pt("session_start");function ZSe(t){var e;return t instanceof Error?{error_message:t.message,error_name:t.name,stack_trace:((e=t.stack)==null?void 0:e.slice(0,4e3))??null}:{error_message:String(t),error_name:null,stack_trace:null}}function v3t(t,e){return!!(t.includes("Error fetching")&&(t.includes("404")||t.includes("Not Found"))||e==="EncodingError"||t.includes("unsupported or unrecognizable format")||t.includes("MEDIA_ERR_SRC_NOT_SUPPORTED"))}const GSe=50;let kI=0,EI=0,eie=!1,tie=!1;window.addEventListener("error",t=>{var e;if((e=t.message)!=null&&e.includes("ResizeObserver loop")){t.stopImmediatePropagation(),t.preventDefault();return}if(kI++,kI>GSe){eie||(eie=!0,Pt("error_cap_reached",{count:kI}));return}Pt("unhandled_error",{...ZSe(t.error),error_message:t.message,filename:t.filename,lineno:t.lineno,colno:t.colno})});let g4=0;window.addEventListener("unhandledrejection",t=>{const e=ZSe(t.reason);if(v3t(e.error_message,e.error_name)){g4++,(g4===1||g4%100===0)&&Pt("composition_asset_error_filtered",{error_message:e.error_message.slice(0,200),error_name:e.error_name,total_filtered:g4});return}if(EI++,EI>GSe){tie||(tie=!0,Pt("rejection_cap_reached",{count:EI}));return}Pt("unhandled_promise_rejection",e)});wOe.createRoot(document.getElementById("root")).render(d.jsx(x.StrictMode,{children:d.jsx(b3t,{children:d.jsx(y3t,{})})}));export{SEe as a,q7 as g,OEe as i,TPe as n,Td as r}; diff --git a/dist/studio/index.html b/dist/studio/index.html index 9a89158da93266dfafaf453eee8abc3f1491f2ed..755cc89dac9106787af70b78c306c687cac9a997 100644 --- a/dist/studio/index.html +++ b/dist/studio/index.html @@ -5,6 +5,18 @@ HyperFrames Studio + diff --git a/dist/studio/index.js b/dist/studio/index.js index c9d701bdda21bfb0f250ef3aab71c3e681e41b4e..3e3b68baa9be068ab53e09853865d2b2056ccdfd 100644 --- a/dist/studio/index.js +++ b/dist/studio/index.js @@ -940,6 +940,9 @@ function resolveStaticSeekFallback(opts) { opts.clock, opts.getPlaybackRate ); + if (window.__crocoPlannedPreviewDuration?.() > 0 && cached4?.player === bestAdapter) { + adapter.seek(cached4.adapter.getTime()); + } cache2.current = { player: bestAdapter, duration: effectiveDuration, adapter }; return adapter; } @@ -7628,6 +7631,7 @@ var TimelineClip = memo7(function TimelineClip2({ "data-timeline-focus-id": isGestureActor ? void 0 : timelineClipFocusId(el.key ?? el.id), "data-clip-start": el.start, "data-clip-end": el.start + el.duration, + "data-clip-audio": isAudioTimelineElement(el) ? "true" : void 0, "data-clip-hidden": el.hidden ? "true" : void 0, "data-active": isActive ? "" : void 0, "aria-hidden": isGestureActor ? "true" : void 0, @@ -7680,6 +7684,7 @@ var TimelineClip = memo7(function TimelineClip2({ "div", { "aria-hidden": "true", + "data-croco-timeline-resize-edge": "end", onPointerDown: (e) => onResizeStart?.("end", e), style: { position: "absolute", @@ -16784,7 +16789,7 @@ function patchIframeRootDuration(iframe, contentEnd) { function syncPreviewContentDuration(iframe) { const end = furthestClipEndFromDocument(iframe?.contentDocument ?? null); if (end > 0) { - usePlayerStore.getState().setDuration(end); + usePlayerStore.getState().setDuration(Math.max(end, window.__crocoPlannedPreviewDuration?.() || 0)); patchIframeRootDuration(iframe, end); } } @@ -17138,6 +17143,9 @@ function extendRootDurationIfNeeded(newEnd) { return true; } function buildPatchTarget(element) { + if (!element.domId && /^#[A-Za-z_][\w-]*$/.test(element.selector || "")) { + return { id: element.selector.slice(1), hfId: element.hfId }; + } if (element.domId) { return { id: element.domId, @@ -19070,6 +19078,7 @@ var TimelineCanvas = memo13(function TimelineCanvas2(props) { "div", { ref: props.playheadRef, + "data-croco-timeline-playhead": "true", className: "absolute top-0 bottom-0 pointer-events-none", style: { left: `${getTimelinePlayheadLeft(0, 0, props.contentOrigin)}px`, @@ -24941,6 +24950,7 @@ function syncAdapterDuration(adapter, setDuration) { } } function syncFallbackTimelineFromDom(doc, iframe, rootDuration, syncTimelineElements) { + if (window.__crocoPlannedPreviewDuration?.() > 0) rootDuration = readTimelineDurationFromDocument(doc) || rootDuration; const els = parseTimelineFromDOM(doc, rootDuration); if (els.length > 0) { syncTimelineElements(els); @@ -25582,6 +25592,7 @@ function useTimelinePlayer() { // fallow-ignore-next-line complexity (elements, nextDuration) => { if (hasTimelinePerformanceFixtureLease()) return; + if (nextDuration != null) nextDuration = Math.max(nextDuration, window.__crocoPlannedPreviewDuration?.() || 0); const state = usePlayerStore.getState(); const resolvedDuration = nextDuration ?? state.duration; const mergedElements = normalizeToZones( @@ -25625,8 +25636,10 @@ function useTimelinePlayer() { const iframe = iframeRef.current; const win = iframe?.contentWindow; if (!iframe || !win) return null; + // Preview transport includes planned Units without changing authored clip geometry. + win.__crocoPlannedPreviewDuration = window.__crocoPlannedPreviewDuration; const playerAdapter = win.__player && typeof win.__player.play === "function" ? win.__player : null; - const docDuration = readTimelineDurationFromDocument(iframe.contentDocument); + const docDuration = Math.max(readTimelineDurationFromDocument(iframe.contentDocument), window.__crocoPlannedPreviewDuration?.() || 0); const adapterDur = getAdapterDuration(playerAdapter); if (adapterDur > 0 && docDuration <= adapterDur) { releaseStaticSeekCache(staticSeekAdapterRef, staticSeekWarnedRef); @@ -25658,7 +25671,7 @@ function useTimelinePlayer() { } const bestAdapter = playerAdapter ?? timelineAdapter; const effectiveDuration = Math.max( - usePlayerStore.getState().duration, + window.__crocoPlannedPreviewDuration?.() || usePlayerStore.getState().duration, docDuration, adapterDur ); @@ -61827,6 +61840,10 @@ function useRenderQueue(projectId, activeCompPathRef) { if (opts.variables && Object.keys(opts.variables).length > 0) { body.variables = opts.variables; } + if (new URLSearchParams(window.location.search).get("crocoView") === "script" && window.__crocoBeforeExport) { + await window.__crocoBeforeExport({ ...opts, projectId, composition: composition ?? "index.html", fps, quality, format, resolution }); + return; + } let res; try { res = await fetch(`/api/projects/${projectId}/render`, { @@ -66788,6 +66805,9 @@ function useTimelineEditing({ invalidateGsapCache ] ); + if (new URLSearchParams(window.location.search).get("crocoView") === "script") { + window.__crocoTimelineAdapter = { store: usePlayerStore, resize: groupEditing.handleTimelineGroupResize, isAudio: isAudioTimelineElement, projectId, compositionPath: activeCompPath }; + } const handleToggleTrackHidden = useTimelineTrackVisibilityEditing({ projectIdRef, activeCompPath, @@ -73828,8 +73848,10 @@ function useExternalFileChangeCoordinator({ reloadAcceptedGeneration ] ); + const processChangeRef = useRef132(processChange); + processChangeRef.current = processChange; useEffect104(() => { - const handler = (payload) => processChange(payload); + const handler = (payload) => processChangeRef.current(payload); const adapter = testHotAdapter(); if (adapter) { adapter.on("hf:file-change", handler); @@ -73840,9 +73862,13 @@ function useExternalFileChangeCoordinator({ return () => import.meta.hot?.off?.("hf:file-change", handler); } const eventSource = new EventSource("/api/events"); - eventSource.addEventListener("file-change", handler); + eventSource.addEventListener("file-change", (event) => { + let payload; + try { payload = JSON.parse(event.data); } catch { return; } + void handler(payload); + }); return () => eventSource.close(); - }, [processChange]); + }, []); const retry = useCallback125(async () => { const current = blockedRef.current; if (!current || current.status === "conflict" || current.recovered) return; @@ -88565,12 +88591,15 @@ function StudioApp() { capturing: frameCapture.capturing, inspectorButtonActive, inspectorPanelActive, - onExport: () => { + onExport: (new URLSearchParams(window.location.search).get("crocoView") === "script" && (window.__crocoExportAdapter = async (options = {}) => { + await previewPersistence.waitForPendingDomEditSaves(); + await renderQueue.startRender(options); + }), () => { void (async () => { await previewPersistence.waitForPendingDomEditSaves(); await renderQueue.startRender(void 0); })(); - } + }) } ), previewPersistence.domEditSaveQueuePaused && !externalFileChanges.blocked && /* @__PURE__ */ jsx217(