PageSourceSearch

https://suno.com/_next/static/immutable/chunks/1v7ddrjk2w_gy.js

js suno.com collected 2026-09-24 08:04:29 UTC 104,282 bytes, 6 lines download raw bytes

1
2!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="18990076-e7e7-52e7-9ebc-87de24377f3b")}catch(e){}}();
3(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,871819,e=>{"use strict";var t=e.i(224568);e.s(["ThemeProvider",()=>t.a])},987119,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0});var o={callServer:function(){return i.callServer},createServerReference:function(){return s.createServerReference},findSourceMapURL:function(){return a.findSourceMapURL}};for(var n in o)Object.defineProperty(r,n,{enumerable:!0,get:o[n]});let i=e.r(979544),a=e.r(691143),s=e.r(263848)},48200,(e,t,r)=>{var o={872:function(e,t){"use strict";t.byteLength=function(e){var t=l(e),r=t[0],o=t[1];return(r+o)*3/4-o},t.toByteArray=function(e){var t,r,i=l(e),a=i[0],s=i[1],u=new n((a+s)*3/4-s),c=0,d=s>0?a-4:a;for(r=0;r<d;r+=4)t=o[e.charCodeAt(r)]<<18|o[e.charCodeAt(r+1)]<<12|o[e.charCodeAt(r+2)]<<6|o[e.charCodeAt(r+3)],u[c++]=t>>16&255,u[c++]=t>>8&255,u[c++]=255&t;return 2===s&&(t=o[e.charCodeAt(r)]<<2|o[e.charCodeAt(r+1)]>>4,u[c++]=255&t),1===s&&(t=o[e.charCodeAt(r)]<<10|o[e.charCodeAt(r+1)]<<4|o[e.charCodeAt(r+2)]>>2,u[c++]=t>>8&255,u[c++]=255&t),u},t.fromByteArray=function(e){for(var t,o=e.length,n=o%3,i=[],a=0,s=o-n;a<s;a+=16383)i.push(function(e,t,o){for(var n,i=[],a=t;a<o;a+=3)n=(e[a]<<16&0xff0000)+(e[a+1]<<8&65280)+(255&e[a+2]),i.push(r[n>>18&63]+r[n>>12&63]+r[n>>6&63]+r[63&n]);return i.join("")}(e,a,a+16383>s?s:a+16383));return 1===n?i.push(r[(t=e[o-1])>>2]+r[t<<4&63]+"=="):2===n&&i.push(r[(t=(e[o-2]<<8)+e[o-1])>>10]+r[t>>4&63]+r[t<<2&63]+"="),i.join("")};for(var r=[],o=[],n="u">typeof Uint8Array?Uint8Array:Array,i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",a=0,s=i.length;a<s;++a)r[a]=i[a],o[i.charCodeAt(a)]=a;function l(e){var t=e.length;if(t%4>0)throw Error("Invalid string. Length must be a multiple of 4");var r=e.indexOf("=");-1===r&&(r=t);var o=r===t?0:4-r%4;return[r,o]}o[45]=62,o[95]=63},230:function(e,t,r){"use strict";var o=r(872),n=r(321),i="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;function a(e){if(e>0x7fffffff)throw RangeError('The value "'+e+'" is invalid for option "size"');var t=new Uint8Array(e);return Object.setPrototypeOf(t,s.prototype),t}function s(e,t,r){if("number"==typeof e){if("string"==typeof t)throw TypeError('The "string" argument must be of type string. Received type number');return c(e)}return l(e,t,r)}function l(e,t,r){if("string"==typeof e){var o=e,n=t;if(("string"!=typeof n||""===n)&&(n="utf8"),!s.isEncoding(n))throw TypeError("Unknown encoding: "+n);var i=0|h(o,n),l=a(i),u=l.write(o,n);return u!==i&&(l=l.slice(0,u)),l}if(ArrayBuffer.isView(e))return d(e);if(null==e)throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);if(A(e,ArrayBuffer)||e&&A(e.buffer,ArrayBuffer)||"u">typeof SharedArrayBuffer&&(A(e,SharedArrayBuffer)||e&&A(e.buffer,SharedArrayBuffer)))return function(e,t,r){var o;if(t<0||e.byteLength<t)throw RangeError('"offset" is outside of buffer bounds');if(e.byteLength<t+(r||0))throw RangeError('"length" is outside of buffer bounds');return Object.setPrototypeOf(o=void 0===t&&void 0===r?new Uint8Array(e):void 0===r?new Uint8Array(e,t):new Uint8Array(e,t,r),s.prototype),o}(e,t,r);if("number"==typeof e)throw TypeError('The "value" argument must not be of type number. Received type number');var c=e.valueOf&&e.valueOf();if(null!=c&&c!==e)return s.from(c,t,r);var p=function(e){if(s.isBuffer(e)){var t=0|f(e.length),r=a(t);return 0===r.length||e.copy(r,0,0,t),r}return void 0!==e.length?"number"!=typeof e.length||function(e){return e!=e}(e.length)?a(0):d(e):"Buffer"===e.type&&Array.isArray(e.data)?d(e.data):void 0}(e);if(p)return p;if("u">typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof e[Symbol.toPrimitive])return s.from(e[Symbol.toPrimitive]("string"),t,r);throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e)}function u(e){if("number"!=typeof e)throw TypeError('"size" argument must be of type number');
vendor: 16,509 bytes, line 3
3if(e<0)throw RangeError('The value "'+e+'" is invalid for option "size"')}function c(e){return u(e),a(e<0?0:0|f(e))}function d(e){for(var t=e.length<0?0:0|f(e.length),r=a(t),o=0;o<t;o+=1)r[o]=255&e[o];return r}t.Buffer=s,t.SlowBuffer=function(e){return+e!=e&&(e=0),s.alloc(+e)},t.INSPECT_MAX_BYTES=50,t.kMaxLength=0x7fffffff,s.TYPED_ARRAY_SUPPORT=function(){try{var e=new Uint8Array(1),t={foo:function(){return 42}};return Object.setPrototypeOf(t,Uint8Array.prototype),Object.setPrototypeOf(e,t),42===e.foo()}catch(e){return!1}}(),!s.TYPED_ARRAY_SUPPORT&&"u">typeof console&&"function"==typeof console.error&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."),Object.defineProperty(s.prototype,"parent",{enumerable:!0,get:function(){if(s.isBuffer(this))return this.buffer}}),Object.defineProperty(s.prototype,"offset",{enumerable:!0,get:function(){if(s.isBuffer(this))return this.byteOffset}}),s.poolSize=8192,s.from=function(e,t,r){return l(e,t,r)},Object.setPrototypeOf(s.prototype,Uint8Array.prototype),Object.setPrototypeOf(s,Uint8Array),s.alloc=function(e,t,r){return(u(e),e<=0)?a(e):void 0!==t?"string"==typeof r?a(e).fill(t,r):a(e).fill(t):a(e)},s.allocUnsafe=function(e){return c(e)},s.allocUnsafeSlow=function(e){return c(e)};function f(e){if(e>=0x7fffffff)throw RangeError("Attempt to allocate Buffer larger than maximum size: 0x7fffffff bytes");return 0|e}function h(e,t){if(s.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||A(e,ArrayBuffer))return e.byteLength;if("string"!=typeof e)throw TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof e);var r=e.length,o=arguments.length>2&&!0===arguments[2];if(!o&&0===r)return 0;for(var n=!1;;)switch(t){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return E(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return C(e).length;default:if(n)return o?-1:E(e).length;t=(""+t).toLowerCase(),n=!0}}function p(e,t,r){var n,i,a,s=!1;if((void 0===t||t<0)&&(t=0),t>this.length||((void 0===r||r>this.length)&&(r=this.length),r<=0||(r>>>=0)<=(t>>>=0)))return"";for(e||(e="utf8");;)switch(e){case"hex":return function(e,t,r){var o=e.length;(!t||t<0)&&(t=0),(!r||r<0||r>o)&&(r=o);for(var n="",i=t;i<r;++i)n+=I[e[i]];return n}(this,t,r);case"utf8":case"utf-8":return y(this,t,r);case"ascii":return function(e,t,r){var o="";r=Math.min(e.length,r);for(var n=t;n<r;++n)o+=String.fromCharCode(127&e[n]);return o}(this,t,r);case"latin1":case"binary":return function(e,t,r){var o="";r=Math.min(e.length,r);for(var n=t;n<r;++n)o+=String.fromCharCode(e[n]);return o}(this,t,r);case"base64":return n=this,i=t,a=r,0===i&&a===n.length?o.fromByteArray(n):o.fromByteArray(n.slice(i,a));case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return function(e,t,r){for(var o=e.slice(t,r),n="",i=0;i<o.length;i+=2)n+=String.fromCharCode(o[i]+256*o[i+1]);return n}(this,t,r);default:if(s)throw TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),s=!0}}function m(e,t,r){var o=e[t];e[t]=e[r],e[r]=o}function g(e,t,r,o,n){var i;if(0===e.length)return -1;if("string"==typeof r?(o=r,r=0):r>0x7fffffff?r=0x7fffffff:r<-0x80000000&&(r=-0x80000000),(i=r*=1)!=i&&(r=n?0:e.length-1),r<0&&(r=e.length+r),r>=e.length)if(n)return -1;else r=e.length-1;else if(r<0)if(!n)return -1;else r=0;if("string"==typeof t&&(t=s.from(t,o)),s.isBuffer(t))return 0===t.length?-1:v(e,t,r,o,n);if("number"==typeof t){if(t&=255,"function"==typeof Uint8Array.prototype.indexOf)if(n)return Uint8Array.prototype.indexOf.call(e,t,r);else return Uint8Array.prototype.lastIndexOf.call(e,t,r);return v(e,[t],r,o,n)}throw TypeError("val must be string, number or Buffer")}function v(e,t,r,o,n){var i,a=1,s=e.length,l=t.length;if(void 0!==o&&("ucs2"===(o=String(o).toLowerCase())||"ucs-2"===o||"utf16le"===o||"utf-16le"===o)){if(e.length<2||t.length<2)return -1;a=2,s/=2,l/=2,r/=2}function u(e,t){return 1===a?e[t]:e.readUInt16BE(t*a)}if(n){var c=-1;for(i=r;i<s;i++)if(u(e,i)===u(t,-1===c?0:i-c)){if(-1===c&&(c=i),i-c+1===l)return c*a}else -1!==c&&(i-=i-c),c=-1}else for(r+l>s&&(r=s-l),i=r;i>=0;i--){for(var d=!0,f=0;f<l;f++)if(u(e,i+f)!==u(t,f)){d=!1;break}if(d)return i}return -1}s.isBuffer=function(e){return null!=e&&!0===e._isBuffer&&e!==s.prototype},s.compare=function(e,t){if(A(e,Uint8Array)&&(e=s.from(e,e.offset,e.byteLength)),A(t,Uint8Array)&&(t=s.from(t,t.offset,t.byteLength)),!s.isBuffer(e)||!s.isBuffer(t))throw TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(e===t)return 0;for(var r=e.length,o=t.length,n=0,i=Math.min(r,o);n<i;++n)if(e[n]!==t[n]){r=e[n],o=t[n];break}return r<o?-1:+(o<r)},s.isEncoding=function(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},s.concat=function(e,t){if(!Array.isArray(e))throw TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return s.alloc(0);if(void 0===t)for(r=0,t=0;r<e.length;++r)t+=e[r].length;var r,o=s.allocUnsafe(t),n=0;for(r=0;r<e.length;++r){var i=e[r];if(A(i,Uint8Array)&&(i=s.from(i)),!s.isBuffer(i))throw TypeError('"list" argument must be an Array of Buffers');i.copy(o,n),n+=i.length}return o},s.byteLength=h,s.prototype._isBuffer=!0,s.prototype.swap16=function(){var e=this.length;if(e%2!=0)throw RangeError("Buffer size must be a multiple of 16-bits");for(var t=0;t<e;t+=2)m(this,t,t+1);return this},s.prototype.swap32=function(){var e=this.length;if(e%4!=0)throw RangeError("Buffer size must be a multiple of 32-bits");for(var t=0;t<e;t+=4)m(this,t,t+3),m(this,t+1,t+2);return this},s.prototype.swap64=function(){var e=this.length;if(e%8!=0)throw RangeError("Buffer size must be a multiple of 64-bits");for(var t=0;t<e;t+=8)m(this,t,t+7),m(this,t+1,t+6),m(this,t+2,t+5),m(this,t+3,t+4);return this},s.prototype.toString=function(){var e=this.length;return 0===e?"":0==arguments.length?y(this,0,e):p.apply(this,arguments)},s.prototype.toLocaleString=s.prototype.toString,s.prototype.equals=function(e){if(!s.isBuffer(e))throw TypeError("Argument must be a Buffer");return this===e||0===s.compare(this,e)},s.prototype.inspect=function(){var e="",r=t.INSPECT_MAX_BYTES;return e=this.toString("hex",0,r).replace(/(.{2})/g,"$1 ").trim(),this.length>r&&(e+=" ... "),"<Buffer "+e+">"},i&&(s.prototype[i]=s.prototype.inspect),s.prototype.compare=function(e,t,r,o,n){if(A(e,Uint8Array)&&(e=s.from(e,e.offset,e.byteLength)),!s.isBuffer(e))throw TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(void 0===t&&(t=0),void 0===r&&(r=e?e.length:0),void 0===o&&(o=0),void 0===n&&(n=this.length),t<0||r>e.length||o<0||n>this.length)throw RangeError("out of range index");if(o>=n&&t>=r)return 0;if(o>=n)return -1;if(t>=r)return 1;if(t>>>=0,r>>>=0,o>>>=0,n>>>=0,this===e)return 0;for(var i=n-o,a=r-t,l=Math.min(i,a),u=this.slice(o,n),c=e.slice(t,r),d=0;d<l;++d)if(u[d]!==c[d]){i=u[d],a=c[d];break}return i<a?-1:+(a<i)},s.prototype.includes=function(e,t,r){return -1!==this.indexOf(e,t,r)},s.prototype.indexOf=function(e,t,r){return g(this,e,t,r,!0)},s.prototype.lastIndexOf=function(e,t,r){return g(this,e,t,r,!1)};function y(e,t,r){r=Math.min(e.length,r);for(var o=[],n=t;n<r;){var i,a,s,l,u=e[n],c=null,d=u>239?4:u>223?3:u>191?2:1;if(n+d<=r)switch(d){case 1:u<128&&(c=u);break;case 2:(192&(i=e[n+1]))==128&&(l=(31&u)<<6|63&i)>127&&(c=l);break;case 3:i=e[n+1],a=e[n+2],(192&i)==128&&(192&a)==128&&(l=(15&u)<<12|(63&i)<<6|63&a)>2047&&(l<55296||l>57343)&&(c=l);break;case 4:i=e[n+1],a=e[n+2],s=e[n+3],(192&i)==128&&(192&a)==128&&(192&s)==128&&(l=(15&u)<<18|(63&i)<<12|(63&a)<<6|63&s)>65535&&l<1114112&&(c=l)}null===c?(c=65533,d=1):c>65535&&(c-=65536,o.push(c>>>10&1023|55296),c=56320|1023&c),o.push(c),n+=d}var f=o,h=f.length;if(h<=4096)return String.fromCharCode.apply(String,f);for(var p="",m=0;m<h;)p+=String.fromCharCode.apply(String,f.slice(m,m+=4096));return p}function b(e,t,r){if(e%1!=0||e<0)throw RangeError("offset is not uint");if(e+t>r)throw RangeError("Trying to access beyond buffer length")}function w(e,t,r,o,n,i){if(!s.isBuffer(e))throw TypeError('"buffer" argument must be a Buffer instance');if(t>n||t<i)throw RangeError('"value" argument is out of bounds');if(r+o>e.length)throw RangeError("Index out of range")}function S(e,t,r,o,n,i){if(r+o>e.length||r<0)throw RangeError("Index out of range")}function x(e,t,r,o,i){return t*=1,r>>>=0,i||S(e,t,r,4,34028234663852886e22,-34028234663852886e22),n.write(e,t,r,o,23,4),r+4}function _(e,t,r,o,i){return t*=1,r>>>=0,i||S(e,t,r,8,17976931348623157e292,-17976931348623157e292),n.write(e,t,r,o,52,8),r+8}s.prototype.write=function(e,t,r,o){if(void 0===t)o="utf8",r=this.length,t=0;else if(void 0===r&&"string"==typeof t)o=t,r=this.length,t=0;else if(isFinite(t))t>>>=0,isFinite(r)?(r>>>=0,void 0===o&&(o="utf8")):(o=r,r=void 0);else throw Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");var n,i,a,s,l,u,c,d,f=this.length-t;if((void 0===r||r>f)&&(r=f),e.length>0&&(r<0||t<0)||t>this.length)throw RangeError("Attempt to write outside buffer bounds");o||(o="utf8");for(var h=!1;;)switch(o){case"hex":return function(e,t,r,o){r=Number(r)||0;var n=e.length-r;o?(o=Number(o))>n&&(o=n):o=n;var i=t.length;o>i/2&&(o=i/2);for(var a=0;a<o;++a){var s,l=parseInt(t.substr(2*a,2),16);if((s=l)!=s)break;e[r+a]=l}return a}(this,e,t,r);case"utf8":case"utf-8":return n=t,i=r,T(E(e,this.length-n),this,n,i);case"ascii":return a=t,s=r,T(k(e),this,a,s);case"latin1":case"binary":return function(e,t,r,o){return T(k(t),e,r,o)}(this,e,t,r);case"base64":return l=t,u=r,T(C(e),this,l,u);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return c=t,d=r,T(function(e,t){for(var r,o,n=[],i=0;i<e.length&&!((t-=2)<0);++i)o=(r=e.charCodeAt(i))>>8,n.push(r%256),n.push(o);return n}(e,this.length-c),this,c,d);default:if(h)throw TypeError("Unknown encoding: "+o);o=(""+o).toLowerCase(),h=!0}},s.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}},s.prototype.slice=function(e,t){var r=this.length;e=~~e,t=void 0===t?r:~~t,e<0?(e+=r)<0&&(e=0):e>r&&(e=r),t<0?(t+=r)<0&&(t=0):t>r&&(t=r),t<e&&(t=e);var o=this.subarray(e,t);return Object.setPrototypeOf(o,s.prototype),o},s.prototype.readUIntLE=function(e,t,r){e>>>=0,t>>>=0,r||b(e,t,this.length);for(var o=this[e],n=1,i=0;++i<t&&(n*=256);)o+=this[e+i]*n;return o},s.prototype.readUIntBE=function(e,t,r){e>>>=0,t>>>=0,r||b(e,t,this.length);for(var o=this[e+--t],n=1;t>0&&(n*=256);)o+=this[e+--t]*n;return o},s.prototype.readUInt8=function(e,t){return e>>>=0,t||b(e,1,this.length),this[e]},s.prototype.readUInt16LE=function(e,t){return e>>>=0,t||b(e,2,this.length),this[e]|this[e+1]<<8},s.prototype.readUInt16BE=function(e,t){return e>>>=0,t||b(e,2,this.length),this[e]<<8|this[e+1]},s.prototype.readUInt32LE=function(e,t){return e>>>=0,t||b(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+0x1000000*this[e+3]},s.prototype.readUInt32BE=function(e,t){return e>>>=0,t||b(e,4,this.length),0x1000000*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},s.prototype.readIntLE=function(e,t,r){e>>>=0,t>>>=0,r||b(e,t,this.length);for(var o=this[e],n=1,i=0;++i<t&&(n*=256);)o+=this[e+i]*n;return o>=(n*=128)&&(o-=Math.pow(2,8*t)),o},s.prototype.readIntBE=function(e,t,r){e>>>=0,t>>>=0,r||b(e,t,this.length);for(var o=t,n=1,i=this[e+--o];o>0&&(n*=256);)i+=this[e+--o]*n;return i>=(n*=128)&&(i-=Math.pow(2,8*t)),i},s.prototype.readInt8=function(e,t){return(e>>>=0,t||b(e,1,this.length),128&this[e])?-((255-this[e]+1)*1):this[e]},s.prototype.readInt16LE=function(e,t){e>>>=0,t||b(e,2,this.length);var r=this[e]|this[e+1]<<8;return 32768&r?0xffff0000|r:r},s.prototype.readInt16BE=function(e,t){e>>>=0,t||b(e,2,this.length);var r=this[e+1]|this[e]<<8;return 32768&r?0xffff0000|r:r},s.prototype.readInt32LE=function(e,t){return e>>>=0,t||b(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},s.prototype.readInt32BE=function(e,t){return e>>>=0,t||b(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},s.prototype.readFloatLE=function(e,t){return e>>>=0,t||b(e,4,this.length),n.read(this,e,!0,23,4)},s.prototype.readFloatBE=function(e,t){return e>>>=0,t||b(e,4,this.length),n.read(this,e,!1,23,4)},s.prototype.readDoubleLE=function(e,t){return e>>>=0,t||b(e,8,this.length),n.read(this,e,!0,52,8)},s.prototype.readDoubleBE=function(e,t){return e>>>=0,t||b(e,8,this.length),n.read(this,e,!1,52,8)},s.prototype.writeUIntLE=function(e,t,r,o){if(e*=1,t>>>=0,r>>>=0,!o){var n=Math.pow(2,8*r)-1;w(this,e,t,r,n,0)}var i=1,a=0;for(this[t]=255&e;++a<r&&(i*=256);)this[t+a]=e/i&255;return t+r},s.prototype.writeUIntBE=function(e,t,r,o){if(e*=1,t>>>=0,r>>>=0,!o){var n=Math.pow(2,8*r)-1;w(this,e,t,r,n,0)}var i=r-1,a=1;for(this[t+i]=255&e;--i>=0&&(a*=256);)this[t+i]=e/a&255;return t+r},s.prototype.writeUInt8=function(e,t,r){return e*=1,t>>>=0,r||w(this,e,t,1,255,0),this[t]=255&e,t+1},s.prototype.writeUInt16LE=function(e,t,r){return e*=1,t>>>=0,r||w(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},s.prototype.writeUInt16BE=function(e,t,r){return e*=1,t>>>=0,r||w(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},s.prototype.writeUInt32LE=function(e,t,r){return e*=1,t>>>=0,r||w(this,e,t,4,0xffffffff,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e,t+4},s.prototype.writeUInt32BE=function(e,t,r){return e*=1,t>>>=0,r||w(this,e,t,4,0xffffffff,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},s.prototype.writeIntLE=function(e,t,r,o){if(e*=1,t>>>=0,!o){var n=Math.pow(2,8*r-1);w(this,e,t,r,n-1,-n)}var i=0,a=1,s=0;for(this[t]=255&e;++i<r&&(a*=256);)e<0&&0===s&&0!==this[t+i-1]&&(s=1),this[t+i]=(e/a|0)-s&255;return t+r},s.prototype.writeIntBE=function(e,t,r,o){if(e*=1,t>>>=0,!o){var n=Math.pow(2,8*r-1);w(this,e,t,r,n-1,-n)}var i=r-1,a=1,s=0;for(this[t+i]=255&e;--i>=0&&(a*=256);)e<0&&0===s&&0!==this[t+i+1]&&(s=1),this[t+i]=(e/a|0)-s&255;return t+r},s.prototype.writeInt8=function(e,t,r){return e*=1,t>>>=0,r||w(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=255&e,t+1},s.prototype.writeInt16LE=function(e,t,r){return e*=1,t>>>=0,r||w(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},s.prototype.writeInt16BE=function(e,t,r){return e*=1,t>>>=0,r||w(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},s.prototype.writeInt32LE=function(e,t,r){return e*=1,t>>>=0,r||w(this,e,t,4,0x7fffffff,-0x80000000),this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},s.prototype.writeInt32BE=function(e,t,r){return e*=1,t>>>=0,r||w(this,e,t,4,0x7fffffff,-0x80000000),e<0&&(e=0xffffffff+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},s.prototype.writeFloatLE=function(e,t,r){return x(this,e,t,!0,r)},s.prototype.writeFloatBE=function(e,t,r){return x(this,e,t,!1,r)},s.prototype.writeDoubleLE=function(e,t,r){return _(this,e,t,!0,r)},s.prototype.writeDoubleBE=function(e,t,r){return _(this,e,t,!1,r)},s.prototype.copy=function(e,t,r,o){if(!s.isBuffer(e))throw TypeError("argument should be a Buffer");if(r||(r=0),o||0===o||(o=this.length),t>=e.length&&(t=e.length),t||(t=0),o>0&&o<r&&(o=r),o===r||0===e.length||0===this.length)return 0;if(t<0)throw RangeError("targetStart out of bounds");if(r<0||r>=this.length)throw RangeError("Index out of range");if(o<0)throw RangeError("sourceEnd out of bounds");o>this.length&&(o=this.length),e.length-t<o-r&&(o=e.length-t+r);var n=o-r;if(this===e&&"function"==typeof Uint8Array.prototype.copyWithin)this.copyWithin(t,r,o);else if(this===e&&r<t&&t<o)for(var i=n-1;i>=0;--i)e[i+t]=this[i+r];else Uint8Array.prototype.set.call(e,this.subarray(r,o),t);return n},s.prototype.fill=function(e,t,r,o){if("string"==typeof e){if("string"==typeof t?(o=t,t=0,r=this.length):"string"==typeof r&&(o=r,r=this.length),void 0!==o&&"string"!=typeof o)throw TypeError("encoding must be a string");if("string"==typeof o&&!s.isEncoding(o))throw TypeError("Unknown encoding: "+o);if(1===e.length){var n,i=e.charCodeAt(0);("utf8"===o&&i<128||"latin1"===o)&&(e=i)}}else"number"==typeof e?e&=255:"boolean"==typeof e&&(e=Number(e));if(t<0||this.length<t||this.length<r)throw RangeError("Out of range index");if(r<=t)return this;if(t>>>=0,r=void 0===r?this.length:r>>>0,e||(e=0),"number"==typeof e)for(n=t;n<r;++n)this[n]=e;else{var a=s.isBuffer(e)?e:s.from(e,o),l=a.length;
3if(0===l)throw TypeError('The value "'+e+'" is invalid for argument "value"');for(n=0;n<r-t;++n)this[n+t]=a[n%l]}return this};var M=/[^+/0-9A-Za-z-_]/g;function E(e,t){t=t||1/0;for(var r,o=e.length,n=null,i=[],a=0;a<o;++a){if((r=e.charCodeAt(a))>55295&&r<57344){if(!n){if(r>56319||a+1===o){(t-=3)>-1&&i.push(239,191,189);continue}n=r;continue}if(r<56320){(t-=3)>-1&&i.push(239,191,189),n=r;continue}r=(n-55296<<10|r-56320)+65536}else n&&(t-=3)>-1&&i.push(239,191,189);if(n=null,r<128){if((t-=1)<0)break;i.push(r)}else if(r<2048){if((t-=2)<0)break;i.push(r>>6|192,63&r|128)}else if(r<65536){if((t-=3)<0)break;i.push(r>>12|224,r>>6&63|128,63&r|128)}else if(r<1114112){if((t-=4)<0)break;i.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}else throw Error("Invalid code point")}return i}function k(e){for(var t=[],r=0;r<e.length;++r)t.push(255&e.charCodeAt(r));return t}function C(e){return o.toByteArray(function(e){if((e=(e=e.split("=")[0]).trim().replace(M,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function T(e,t,r,o){for(var n=0;n<o&&!(n+r>=t.length)&&!(n>=e.length);++n)t[n+r]=e[n];return n}function A(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}var I=function(){for(var e="0123456789abcdef",t=Array(256),r=0;r<16;++r)for(var o=16*r,n=0;n<16;++n)t[o+n]=e[r]+e[n];return t}()},321:function(e,t){t.read=function(e,t,r,o,n){var i,a,s=8*n-o-1,l=(1<<s)-1,u=l>>1,c=-7,d=r?n-1:0,f=r?-1:1,h=e[t+d];for(d+=f,i=h&(1<<-c)-1,h>>=-c,c+=s;c>0;i=256*i+e[t+d],d+=f,c-=8);for(a=i&(1<<-c)-1,i>>=-c,c+=o;c>0;a=256*a+e[t+d],d+=f,c-=8);if(0===i)i=1-u;else{if(i===l)return a?NaN:1/0*(h?-1:1);a+=Math.pow(2,o),i-=u}return(h?-1:1)*a*Math.pow(2,i-o)},t.write=function(e,t,r,o,n,i){var a,s,l,u=8*i-n-1,c=(1<<u)-1,d=c>>1,f=5960464477539062e-23*(23===n),h=o?0:i-1,p=o?1:-1,m=+(t<0||0===t&&1/t<0);for(isNaN(t=Math.abs(t))||t===1/0?(s=+!!isNaN(t),a=c):(a=Math.floor(Math.log(t)/Math.LN2),t*(l=Math.pow(2,-a))<1&&(a--,l*=2),a+d>=1?t+=f/l:t+=f*Math.pow(2,1-d),t*l>=2&&(a++,l/=2),a+d>=c?(s=0,a=c):a+d>=1?(s=(t*l-1)*Math.pow(2,n),a+=d):(s=t*Math.pow(2,d-1)*Math.pow(2,n),a=0));n>=8;e[r+h]=255&s,h+=p,s/=256,n-=8);for(a=a<<n|s,u+=n;u>0;e[r+h]=255&a,h+=p,a/=256,u-=8);e[r+h-p]|=128*m}}},n={};function i(e){var t=n[e];if(void 0!==t)return t.exports;var r=n[e]={exports:{}},a=!0;try{o[e](r,r.exports,i),a=!1}finally{a&&delete n[e]}return r.exports}i.ab="/ROOT/node_modules/.pnpm/[email protected]_@[email protected]_@[email protected]_@[email protected]_@types+_c72171ff0012b54b7e3ed79c75eba9a8/node_modules/next/dist/compiled/buffer/",t.exports=i(230)},953818,e=>{"use strict";let t=(0,e.i(554907).createContext)(null);e.s(["UnifiedPopupSurfaceContext",0,t])},671511,e=>{"use strict";var t=e.i(673157),r=e.i(877130);e.s(["Footer",0,e=>(0,t.jsx)("div",{...e,className:(0,r.twMerge)("flex h-4 items-center justify-between px-4",e.className)}),"MainContent",0,e=>(0,t.jsx)("div",{...e,className:(0,r.twMerge)("min-h-0 flex-1 px-4",e.className)}),"TitleLine",0,e=>(0,t.jsx)("h3",{...e,className:(0,r.twMerge)("px-4 font-serif text-2xl",e.className),children:e.children}),"Wrapper",0,e=>(0,t.jsx)("div",{...e,className:(0,r.twMerge)("flex min-h-0 flex-1 flex-col items-stretch gap-4",e.className)})])},584355,e=>{"use strict";var t=e.i(554907),r=e.i(719288);e.s(["useApplyPlaylistAsInspiration",0,function(){let e=(0,r.default)();return(0,t.useCallback)(t=>{e(t)},[e])}])},557573,e=>{"use strict";var t=e.i(463984);let r="/create";e.s(["useIsOnCreate",0,function(){let e=(0,t.usePathname)();return{isOnCreate:e===r,isOnCreatePath:e===r||(e?.startsWith(`${r}/`)??!1)}}])},714267,e=>{"use strict";e.s(["HookFormProvider",()=>I,"MAX_MEDIA_DESYNCED_MS",()=>C,"MAX_VIDEO_DURATION_SECONDS",()=>k,"MAX_VIDEO_UPLOAD_FILESIZE_MB",()=>M,"MIN_VIDEO_DURATION_SECONDS",()=>E,"default",()=>P]);var t=e.i(673157),r=e.i(810789),o=e.i(737382),n=e.i(374686);e.i(975824);var i=e.i(524986),a=e.i(463984),s=e.i(554907);e.i(179395);var l=e.i(73605),u=e.i(274918),c=e.i(248949),d=e.i(757855),f=e.i(334959),h=e.i(328062);e.i(948952);var p=e.i(350671),m=e.i(730502),g=e.i(964977),v=e.i(838038),y=e.i(974374),b=e.i(376151);e.i(696800);var w=e.i(3867),S=e.i(79076),x=e.i(277565),_=e.i(354804);let M=200,E=10,k=241,C=200;function T(e){let t=e.videoEnd-e.videoStart,r=.5*Math.max(0,e.audioViewportWidth-t);return{...e,duration:t,audioEnd:e.audioStart+t,audioViewportStart:e.audioStart-r,audioViewportEnd:e.audioStart+t+r,videoViewportStart:0,videoViewportEnd:e.videoDuration}}let A=(0,s.createContext)(void 0),I=(0,i.observer)(e=>{let i=(()=>{let e,i,C=(0,g.useAppI18n)(),{openModal:A,closeModal:I}
3=(0,v.useModalContext)(),[P,B]=(0,s.useState)("selectSongInFlow"),[O,R]=(0,s.useState)(null),[U,D]=(0,s.useState)(null),[L,N]=(0,s.useState)(0),[K,F]=(0,s.useState)([0,0]),[j,q]=(0,s.useState)(0),[H,V]=(0,s.useState)(null),[z,W]=(0,s.useState)(""),[Q,G]=(0,s.useState)(""),[$,X]=(0,s.useState)(!0),[Y,Z]=(0,s.useState)(!0),J=(0,a.useRouter)(),[ee,et]=(0,s.useState)(!1),{uploadId:er,uploadImageUrl:eo,uploadProgress:en,uploadStatus:ei,audioAlignmentTimestamp:ea,removeFiles:es,updateSelectedVideo:el}=(0,b.useVideoUpload)({requireVideoSprite:!0,requireModeration:!1,videoUploadType:"video_hook",maxFileSizeMb:M,minDuration:E,maxDuration:k,onVideoSelected:D,uploadTimeout:6e5,clipId:O?.id}),eu=(0,s.useMemo)(()=>U?URL.createObjectURL(U):"",[U]);(0,s.useEffect)(()=>{if(!eu)return void N(0);let e=document.createElement("video");e.preload="metadata";let t=()=>{e.remove()};return e.onloadedmetadata=()=>{N(Math.round(1e3*e.duration)),F([e.videoWidth,e.videoHeight]),t()},e.onerror=()=>{console.error("Error loading video metadata"),N(0),F([0,0]),t()},e.src=eu,t},[eu]);let ec=(0,s.useCallback)(e=>{B(e)},[]),ed=O?.audioMetadata?.audio_snippet?.start_timestamp&&Math.round(O?.audioMetadata?.audio_snippet?.start_timestamp*1e3),ef=function(e){let{videoDuration:t,audioDuration:r,minDuration:o=Math.min(t,1e4),maxDuration:i=Math.min(r,t,241e3),defaultVideoStart:a=0,defaultVideoEnd:l=Math.min(r,t),defaultAudioStart:u=0,defaultPlayheadTime:c=u,audioViewportWidth:d=Math.min(2*i,r)}=e,[f,h]=(0,s.useState)(()=>T({videoStart:a,videoEnd:l,audioStart:u,current:c,audioViewportWidth:d,minDuration:o,maxDuration:i,videoDuration:t,audioDuration:r})),p=(0,s.useCallback)(e=>{h(t=>T({...t,..."function"==typeof e?e(t):e}))},[]);(0,s.useEffect)(()=>{h(e=>{let{videoStart:a,videoEnd:s,audioStart:l,current:u}=e,c=(0,n.clamp)(s-a,o,i);return a=Math.max(0,(s=(0,n.clamp)(s,c,Math.min(r,t)))-c),c=s-a,l=(0,n.clamp)(l,0,r-c),u=(0,n.clamp)(u,l,l+c),{...e,videoStart:a,videoEnd:s,audioStart:l,current:u,audioViewportWidth:d,minDuration:o,maxDuration:i,videoDuration:t,audioDuration:r}})},[d,o,i,t,r]);let m=(0,s.useCallback)((e,t)=>{p(r=>{let o={...r,videoStart:(0,n.clamp)(e,0,r.videoDuration),videoEnd:(0,n.clamp)(t,0,r.videoDuration)};t===r.videoEnd?o.videoStart=(0,n.clamp)(o.videoStart,r.videoEnd-r.maxDuration,r.videoEnd-r.minDuration):e===r.videoStart&&(o.videoEnd=(0,n.clamp)(o.videoEnd,r.videoStart+r.minDuration,r.videoStart+r.maxDuration));let i=o.videoEnd-o.videoStart;o.audioStart+i>r.audioDuration&&(o.audioStart=Math.max(0,r.audioDuration-i));let a=r.current-r.audioStart,s=o.audioStart+i;return o.current=Math.min(o.audioStart+a,s),o})}
3,[p]),g=(0,s.useCallback)(e=>{p(t=>{let r={...t,audioStart:(0,n.clamp)(e,0,t.audioDuration-t.duration)};r.audioEnd=r.audioStart+t.duration;let o=t.current-t.audioStart;return r.current=(0,n.clamp)(r.audioStart+o,r.audioStart,r.audioEnd),r})},[p]),v=(0,s.useCallback)(e=>{p(t=>({...t,current:(0,n.clamp)(e,t.audioStart,t.audioEnd)}))},[p]);return{...f,onVideoRangeSet:m,onAudioRangeSet:g,onCurrentTimeSet:v}}({defaultAudioStart:ed,audioDuration:Math.round((O?.metadata?.duration??0)*1e3),videoDuration:L}),{onCurrentTimeSet:eh,onVideoRangeSet:ep,onAudioRangeSet:em}=ef;(0,s.useEffect)(()=>{L&&(ep(0,L),em(ed??0))},[L,ed,ep,em]),(0,s.useEffect)(()=>{O&&null!=ed&&eh(ed)},[O,ed,eh]);let eg=(0,s.useCallback)(()=>{R(null),D(null),N(0),F([0,0]),et(!1),W(""),G(""),X(!0),Z(!0),B("selectSongInFlow"),es()},[es]),ev=(0,s.useCallback)(()=>{I(f.ModalTypes.SELECT_HOOK_SONG)},[I]),ey=(0,s.useCallback)(()=>{A(f.ModalTypes.SELECT_HOOK_SONG)},[A]);(0,s.useEffect)(()=>{"error"===ei&&(D(null),ey(),ec("uploadVideoInFlow"))},[ei,ey,ec]);let eb=(e=(0,g.useAppI18n)(),i=(0,S.useApiClient)(),(0,o.useMutation)({mutationFn:async({videoUploadID:e,videoFile:t,clipId:o,title:n,caption:a,allowComments:s,showLyrics:l,clipStartTimeMs:u,clipEndTimeMs:c,clipDurationMs:d,videoStartTimeMs:f,videoEndTimeMs:h,clipVolume:p=100,videoVolume:m=0,customThumbnailS3Id:g})=>{let v=c-u,y=p||!m?100:0;if(!t||!e)throw Error("Please select a video file or wait for it to upload.");if(!o)throw Error("Please select a song.");if(y){if(u>=c)throw Error(`Audio start time (${u}) must be less than audio end time (${c}).`);if(u<0||c>d)throw Error(`Audio start time (${u}) and end time (${c}) must be within the song duration (0 - ${d}).`);if(v>241e3)throw Error(`Audio duration (${c-u}) must be less than 30 seconds.`);if(Math.abs(h-f-v)>100)throw Error(`Audio duration (${c-u}) must be equal to video duration (${h-f}).`)}let b={clip_id:o,hook_publish:{title:n,caption:a,allow_comments:s,show_lyrics:l,custom_thumbnail_s3_id:g},video_render:{song:{song_id:o,clip_start_time:u/1e3,clip_end_time:c/1e3,volume:y},videos:[{upload_id:e,source_start_time:f/1e3,source_end_time:h/1e3,volume:100-y}]}},{data:w,response:S}=await i.POST("/api/video/hooks/create",{body:b});if(423===S.status)throw Error("Your account requires support assistance");if(!w||!w.id)throw(0,r.captureException)({message:"Hooks creation failed",payload:b,response:w}),Error("Failed to create hook: Invalid response data from server.");return w},onSuccess:e=>{console.log("Hook creation successful:",e)},onError:t=>{(0,c.resolveTextOnDemand)({instance:e,namespace:"hooks",resolve:e=>t instanceof Error?e("hooks.creationError",{message:t.message}):e("hooks.creationUnexpectedError")}).then(e=>{p.toastManager.add({title:e,type:"error"})}),console.error("Exception during hook creation:",t)}})),ew=(0,s.useRef)(""),eS=(0,s.useRef)(""),ex=(0,s.useCallback)(()=>(0,t.jsx)(l.Button,{shape:u.ButtonShape.Pill,size:u.ButtonSize.Small,onClick:()=>{},children:ew.current}),[]),e_=(0,s.useCallback)(({hookId:e,label:r})=>{let o=()=>(0,t.jsx)(l.Button,{variant:u.ButtonVariant.Aura,size:u.ButtonSize.Small,shape:u.ButtonShape.Pill,onClick:()=>{if(!e)return void console.error("Could not find hook ID");let t=(0,_.generateLinkUrl)(e,"hook");navigator.clipboard&&window.isSecureContext?navigator.clipboard.writeText(t).then(()=>{(0,c.resolveTextOnDemand)({instance:C,namespace:"hooks",resolve:e=>e("hookEditor.hookLinkCopied")}).then(t=>{eC.current===e&&p.toastManager.add({title:t,type:"info",timeout:2e3,position:"top"})})}).catch(e=>{console.error("Failed to copy: ",e)}):(0,c.resolveTextOnDemand)({instance:C,namespace:"common",resolve:e=>e("runtimeFeedback.clipboardUnsupported")}).then(e=>alert(e))},children:r});return o.displayName="ShareButtonComponent",o},[C]),[eM,eE]=(0,s.useState)(void 0),ek=(0,s.useRef)(void 0),eC=(0,s.useRef)(void 0),eT=(0,s.useCallback)(()=>(0,t.jsxs)("div",{className:"relative px-3",children:[(0,t.jsx)(d.default,{src:eo,className:"relative h-16 w-12 rounded-lg object-cover opacity-50",alt:eS.current}),(0,t.jsx)("div",{className:"absolute inset-0 flex items-center justify-center",children:ek.current?(0,t.jsx)(h.default,{className:"h-6 w-6 text-accent-brand"}):(0,t.jsx)(w.CheckIcon,{className:"h-6 w-6"})})]}),[eo]),{data:eA}=(0,y.useHookById)({hookId:eM,shouldPoll:!!eM}),eI=(0,s.useCallback)(async()=>{let[e,t,r]=await Promise.all([(0,c.resolveTextOnDemand)({instance:C,namespace:"hooks",resolve:e=>e("hookEditor.hookImageAlt")}),(0,c.resolveTextOnDemand)({instance:C,namespace:"hooks",resolve:e=>e("hookEditor.uploadingHook")}),(0,c.resolveTextOnDemand)({instance:C,namespace:"common",resolve:e=>
3e("cta.cancel")})]);ew.current=r,eS.current=e,J.push("/hooks"),ek.current=p.toastManager.add({title:t,position:"top",timeout:0,data:{isClosable:!1,actionComponent:ex,imageComponent:eT}}).id,eg()},[ex,eT,C,J,eg]);(0,s.useEffect)(()=>{eM&&eA&&[y.HOOK_STATUS.rendered_failed_moderation,y.HOOK_STATUS.rendered_passed_moderation,y.HOOK_STATUS.error].includes(eA.status)&&(ek.current&&p.toastManager.close(ek.current),eA.status===y.HOOK_STATUS.rendered_failed_moderation?(0,m.reportHookUploadFailure)({data:{imageComponent:eT},failure:"moderation-failed",contentRatingTags:eA.content_rating_tags,instance:C,isCurrent:()=>eC.current===eM}):Promise.all([(0,c.resolveTextOnDemand)({instance:C,namespace:"hooks",resolve:e=>e(eA.status===y.HOOK_STATUS.rendered_passed_moderation?"hookEditor.postedToFeed":"hookEditor.processingFailed")}),(0,c.resolveTextOnDemand)({instance:C,namespace:"common",resolve:e=>e("actions.share")})]).then(([e,t])=>{eC.current===eM&&p.toastManager.add({title:e,type:eA.status===y.HOOK_STATUS.rendered_passed_moderation?"info":"error",position:"top",timeout:3e3,data:{actionComponent:eA.status===y.HOOK_STATUS.rendered_passed_moderation?e_({hookId:eM,label:t}):void 0,imageComponent:eT}})}),J.push(`/hook/${eM}`),ek.current=void 0,eE(void 0))},[eT,e_,eM,eA,C,J]);let eP=(0,s.useCallback)(()=>{let e=U?O?null:"song":"video";e?(0,c.resolveTextOnDemand)({instance:C,namespace:"hooks",resolve:t=>t("video"===e?"hookEditor.selectVideoRequired":"hookEditor.selectSongRequired")}).then(e=>{p.toastManager.add({title:e,type:"error"})}):((0,x.default)({actionName:"HookPostSubmitted",context:{uploadId:er||void 0,clipId:O?.id||void 0}}),eb.mutate({videoUploadID:er,videoFile:U,clipId:O?.id||"",title:z||"",caption:Q,allowComments:$,showLyrics:Y,clipStartTimeMs:ef.audioStart,clipEndTimeMs:ef.audioEnd,clipDurationMs:ef.audioDuration,videoStartTimeMs:ef.videoStart,videoEndTimeMs:ef.videoEnd,clipVolume:100*!ee,videoVolume:100*!!ee,customThumbnailS3Id:H},{onSuccess:e=>{(0,x.default)({actionName:"HookPostSucceeded",context:{uploadId:er||void 0,clipId:O?.id||void 0,hookId:e?.id||void 0}}),eC.current=e?.id||void 0;let t=eC.current;eI().then(()=>{eC.current===t&&eE(t)})},onError:e=>{(0,x.default)({actionName:"HookPostFailed",context:{uploadId:er||void 0,clipId:O?.id||void 0}})}}))},[$,z,er,Q,Y,eb,H,C,eI,O,U,ef,ee]);return(0,s.useMemo)(()=>({currentScreen:P,setCurrentScreen:B,navigateTo:ec,selectedSong:O,setSelectedSong:R,selectedVideo:U,updateSelectedVideo:el,uploadStatus:ei,videoUrl:eu,uploadId:er,videoSound:ee,setVideoSound:et,title:z,setTitle:W,caption:Q,setCaption:G,allowComments:$,setAllowComments:X,showLyrics:Y,setShowLyrics:Z,closeModal:ev,openModal:ey,handlePostHook:eP,isCreatingHook:eb.isPending,videoDimensions:K,videoDuration:L,thumbnailTimestamp:j,setThumbnailTimestamp:q,customThumbnailS3Id:H,setCustomThumbnailS3Id:V,mediaEditState:ef,createdHookId:eM,hookStatus:eA,resetFormState:eg,uploadProgress:en,audioAlignmentTimestamp:ea}),[P,ec,O,R,U,el,ei,eu,er,ee,et,z,W,Q,G,$,X,Y,Z,ev,ey,eP,eb.isPending,K,L,j,q,H,V,ef,eM,eA,eg,en,ea])})();return(0,t.jsx)(A.Provider,{value:i,children:e.children})}),P=A},7408,561809,e=>{"use strict";var t=e.i(673157),r=e.i(554907);let o=(0,r.createContext)({isLiveRadio:!1,setIsLiveRadio:()=>{},isPlaying:!1,setIsPlaying:()=>{},togglePlay:()=>{},isLoading:!1,sourceNode:{current:null},currentSong:null,volume:100,setVolume:()=>{},isAudioContextPostUserInteraction:!1,setAudioElement:void 0,setSourceNode:void 0});e.s(["LiveRadioContext",0,o,"LiveRadioProvider",0,({children:e})=>(0,t.jsx)(t.Fragment,{children:e})],7408);let n=(0,r.createContext)({feedId:void 0,hookId:void 0,userHandle:void 0,feedCurrentHookId:void 0,feedCurrentIndex:void 0,updateState:()=>({})});e.s(["HooksFeedProvider",0,({children:e})=>{let[o,i]=(0,r.useReducer)((e,t)=>({...e,...t}),{}),a=(0,r.useMemo)(()=>({...o,updateState:i}),[o,i]);return(0,t.jsx)(n.Provider,{value:a,children:e})},"useHooksFeedContext",0,function(e){let t=(0,r.useContext)(n),o=null!=e,{feedId:i,hookId:a,userHandle:s}=e||{},{updateState:l}=t;return(0,r.useEffect)(()=>{o&&l({feedId:i,hookId:a,userHandle:s})},[o,i,a,s,l]),(0,r.useMemo)(()=>o?{...t,feedId:i,hookId:a,userHandle:s}:t,[t,o,i,a,s])}],561809)},361791,e=>{"use strict";var t=e.i(673157),r=e.i(851052),o=e.i(554907),n=e.i(248949),i=e.i(334959);e.i(948952);var a=e.i(350671),s=e.i(964977),l=e.i(838038),u=e.i(213267);e.i(481045);var c=e.i(536952);e.i(179395);var d=e.i(73605),f=e.i(274918);e.i(696800);var h=e.i(162705);let p=()=>(0,t.jsx)("div",{className:"mr-3 flex shrink-0 items-center",children:(0,t.jsx)(h.SparklesIcon,{className:"h-[1.875rem] w-[1.875rem] animate-pulse2 text-white"})}),m=({thumbnailUrl:e,alt:r})=>(0,t.jsx)("div",{className:"mr-3 flex shrink-0 items-center",children:(0,t.jsx)("img",{src:e,alt:r,className:"h-10 w-10 rounded-lg object-cover"})}
3),g=({clipId:e,label:r,onClick:o})=>(0,t.jsx)(d.Button,{variant:f.ButtonVariant.Aura,size:f.ButtonSize.Small,shape:f.ButtonShape.Pill,onClick:()=>o(e),children:r}),v=({onClick:e})=>{let{t:r}=(0,c.useTranslation)("common");return(0,t.jsx)(d.Button,{variant:f.ButtonVariant.FrostedGlassBorderless,size:f.ButtonSize.Small,shape:f.ButtonShape.Pill,onClick:e,children:r("cta.dismiss")})};var y=e.i(983403),b=e.i(458376),w=e.i(79076),S=e.i(720869),x=e.i(22920);let _=(0,o.createContext)(null);e.s(["GenerationNotificationProvider",0,({children:e})=>{let c=(0,r.useQueryClient)(),d=(0,s.useAppI18n)(),{isModalOpen:f,openModalWithData:h}=(0,l.useModalContext)(),[M,E]=(0,o.useState)(!0),[k,C]=(0,o.useState)(0),T=(0,o.useRef)(new Set),A=(0,o.useRef)(new Map),I=(0,o.useRef)(void 0),P=(0,o.useRef)(0),B=(0,o.useRef)(void 0),O=(0,o.useRef)(void 0),R=(0,o.useCallback)(()=>{let e=++P.current;return B.current=void 0,O.current=void 0,e},[]),U=f(i.ModalTypes.UPDATE_CLIP_METADATA),D=f(i.ModalTypes.SONG_COVER_ART),L=U||D,{isSignedIn:N}=(0,u.useAuth)(),K=!L&&!!N,{finishedClipBatches:F,pendingBatchIds:j}=function(e=!0){let t=(0,w.useApiClient)(),n=(0,r.useQueryClient)(),i=(0,y.useQuery)({queryKey:x.generationQueryKeys.pendingBatchIds(),queryFn:async()=>{let{data:e,error:r}=await t.POST("/api/video_gen/pending_batches",{body:{}});if(r||!e)throw Error("Failed to get pending batch IDs");return e.batch_ids},enabled:e}),a=i?.data?.filter(e=>"video"===e.type)??[],s=(0,y.useQuery)({queryKey:x.generationQueryKeys.pollMultipleClips(a),queryFn:async()=>{if(!a.length)return{};let{data:e,error:r}=await t.POST("/api/video_gen/poll_batches",{body:{batch_ids:a}});if(r||!e)throw Error("Failed to poll batches");let o={};for(let[t,r]of Object.entries(e.batches)){if(0===r.length)continue;let e=r[0].clip_id;e&&(e in o||(o[e]={}),o[e][t]=(0,b.deepCamelKeys)(r))}return o},enabled:e&&a.length>0,refetchInterval:7e3,staleTime:0}),{finishedClipBatches:l={},someCompletedClipBatches:u={}}=(0,o.useMemo)(()=>{if(!s.data)return{};let e={},t={};for(let[r,o]of Object.entries(s.data)){let{someCompletedBatches:n,completedBatches:i}=(0,S.filterBatchesByCompletionStatus)(o);Object.keys(i).length>0&&(e[r]=i),Object.keys(n).length>0&&(t[r]=n)}return{finishedClipBatches:e,someCompletedClipBatches:t}},[s.data]);return(0,o.useEffect)(()=>{for(let[e]of Object.entries(l))(0,x.removeCompletedGenerations)(n,l[e]??{});for(let[e]of Object.entries(u))(0,x.updateGenerationHistoryCache)(n,e,u[e]??{})},[u,l,n]),{finishedClipBatches:l,pendingBatchIds:a,pollBatchesQuery:s,pendingBatchIdsQuery:i}}(K),q=(0,o.useCallback)(()=>{if(I.current){let e=I.current;I.current=void 0;try{a.toastManager.close(e)}catch(t){throw I.current=e,t}}},[I]),H=(0,o.useCallback)(()=>{I.current=void 0},[]),V=(0,o.useCallback)(()=>{E(!1),R(),q()},[q,R]),z=(0,o.useCallback)(e=>{h(i.ModalTypes.SONG_COVER_ART,{clipId:e})},[h]);(0,o.useEffect)(()=>{if(!K)return;let e=Object.keys(F).length>0,r=null,o=null;for(let[e,t]of Object.entries(F))for(let[n,i]of Object.entries(t)){let t=`${e}:${n}`,a={batchId:n,clipId:e,thumbnailUrl:i[0]?.thumbnailUrl};A.current.set(t,a),!T.current.has(t)&&O.current?.key!==t&&(r||(r=a),!o&&i.length>0&&i.every(e=>"complete"===e.status)&&(o=a))}let i=[...A.current.entries()].find(([e])=>!T.current.has(e)&&O.current?.key!==e)?.[1],s=O.current?null:o||r||i;if(e||s){if(s){let{batchId:e,clipId:r,thumbnailUrl:o}=s,i=`${r}:${e}`,l=R();O.current={key:i,requestId:l},(0,n.resolveTranslationsOnDemand)({instance:d,namespace:"musicVideo",resolve:e=>({title:e("videoGeneration.videoCoversComplete"),viewLabel:e("videoGeneration.view"),thumbnailAlt:e("videoGeneration.generatedCoverAlt")}),fallback:e=>({title:e("runtimeFeedback.errorTitle"),viewLabel:null,thumbnailAlt:null})}).then(({title:e,viewLabel:n,thumbnailAlt:s})=>{if(P.current!==l||O.current?.requestId!==l)return;q();let u=a.toastManager.add({title:e,description:void 0,type:"info",timeout:0,position:"top",onRemove:H,data:{className:"w-[41rem]",closeButtonClassName:"absolute top-1/2 -translate-y-1/2 right-4",actionComponent:n?()=>(0,t.jsx)(g,{clipId:r,label:n,onClick:z}):void 0,imageComponent:o&&s?()=>(0,t.jsx)(m,{thumbnailUrl:o,alt:s}):void 0}});if(T.current.add(i),A.current.delete(i),O.current=void 0,I.current=u.id,C(e
3=>e+1),T.current.size>10){let e=Array.from(T.current);T.current=new Set(e.slice(-10))}})}}else if(!(j.length>0)||I.current||B.current||O.current||!M)0===j.length&&void 0!==B.current&&R();else{let e=R();B.current=e,(0,n.resolveTranslationsOnDemand)({instance:d,namespace:"musicVideo",resolve:e=>({title:e("videoGeneration.generatingVideoCovers"),description:e("videoGeneration.notifyWhenDone")}),fallback:e=>({title:e("runtimeFeedback.errorTitle"),description:e("fallbacks.contentUnavailable")})}).then(({title:r,description:o})=>{P.current===e&&B.current===e&&(B.current=void 0,I.current=a.toastManager.add({title:r,description:o,type:"info",timeout:0,position:"top",data:{isClosable:!1,className:"w-[41rem]",imageComponent:p,actionComponent:()=>(0,t.jsx)(v,{onClick:V})}}).id)})}},[F,j,K,c,d,z,q,H,V,R,M,k]),(0,o.useEffect)(()=>{L&&(R(),q())},[L,q,R]);let W=(0,o.useCallback)(()=>{E(!0)},[]),Q=(0,o.useCallback)(()=>{E(!1),R()},[R]),G=(0,o.useMemo)(()=>({enablePendingToasts:W,disablePendingToasts:Q}),[W,Q]);return(0,t.jsx)(_.Provider,{value:G,children:e})},"useGenerationNotifications",0,function(){let e=(0,o.useContext)(_);if(!e)throw Error("useGenerationNotifications must be used within GenerationNotificationProvider");return e}],361791)},999032,e=>{"use strict";var t=e.i(673157);e.s(["default",0,e=>(0,t.jsx)("svg",{width:"100%",height:"100%",viewBox:"0 0 380 380",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:(0,t.jsx)("path",{d:"M370 190C370 213.145 342.654 230.677 334.305 250.784C325.956 270.891 332.258 303.253 316.539 319.039C300.82 334.825 269.205 328.253 248.361 336.894C227.517 345.535 210.711 372.5 187.5 372.5C164.289 372.5 146.744 345.227 126.639 336.894C106.534 328.561 74.1486 334.825 58.4609 319.039C42.7732 303.253 49.0439 270.891 40.6945 250.784C32.3452 230.677 5 213.145 5 190C5 166.855 32.3452 149.323 40.6945 129.216C49.0439 109.109 42.7732 76.7467 58.4609 60.9609C74.1486 45.1751 106.764 51.7467 126.639 43.1056C145.744 34.7731 164.289 7.5 187.5 7.5C210.711 7.5 227.517 34.4645 248.361 43.1056C269.205 51.7467 300.82 45.1751 316.539 60.9609C332.258 76.7467 325.956 109.109 334.305 129.216C342.654 149.323 370 166.855 370 190Z",stroke:"currentColor",strokeWidth:"2",fill:"none"})})])},32806,e=>{"use strict";var t=e.i(810789);let r=[/ChunkLoadError/i,/Loading chunk [\w-]+ failed/i,/Loading CSS chunk/i,/Failed to fetch dynamically imported module/i,/error loading dynamically imported module/i,/Importing a module script failed/i,/is not a valid JavaScript MIME type/i,/module factory is not available/i],o=[/is not a function/i,/is not a constructor/i,/undefined is not an object/i,/Cannot read properties of undefined \(reading /i,/Cannot read properties of null \(reading /i,/Invalid or unexpected token/i,/Unexpected token '<'/i,/expected expression, got '<'/i,/missing \) after argument list/i,/Unexpected token '\{'/i,/requires mobx at least version/i],n=[/requireAsyncModule/,/getOrInstantiateModuleFromParent/,/instantiateModule/,/moduleFactory/,/esmImport/,/__turbopack_require__/,/__turbopack_load__/,/\/chunks\/turbopack-/,/\[turbopack\]/];e.s(["reportClientBoundaryError",0,function({error:e,source:i,nonRecoverableLevel:a,extra:s}){let l=function(e,t){if(!function(e){let t,i=e instanceof Error?`${e.name}: ${e.message}`:String(e??"");return!!r.some(e=>e.test(i))||o.some(e=>e.test(i))&&"string"==typeof(t=e instanceof Error?e.stack:void 0)&&n.some(e=>e.test(t))}(e))return!1;let i=function(){try{let e=window.sessionStorage,t="suno.storageProbe";return e.setItem(t,"1"),e.removeItem(t),e}catch{return null}}();if(!i)return!1;let a=`suno.staleDeployReloaded:${t??"unknown"}`;return!i.getItem(a)&&(i.setItem(a,"1"),!0)}(e,function(){try{return"e47b582"}catch{return}}());t.captureException(e,{tags:{source:i,stale_deploy_recovery:l?"reloading":"none"},level:l?"warning":a,extra:s}),l&&t.flush(2e3).finally(()=>{window.location.reload()})}],32806)},406303,e=>{"use strict";var t=e.i(673157),r=e.i(554907),o=e.i(885696);e.s(["default",0,function({encryptedSrc:e,contentId:n,contentType:i,mediaContentType:a,duration:s,forceProgressiveDownload:l,swDrmMode:u,muffleAfterSeconds:c,downloadMode:d,onDrmProgress:f,onDrmError:h,onDrmStatusChange:p,useFallbackOnError:m,enabled:g,src:v,ref:y,...b}){let{audioRef:w,status:S,resolvedSrc:x}=(0,o.useDrmAudio)({encryptedSrc:e,fallbackSrc:v??null,contentId:n,contentType:i,mediaContentType:a,duration:s,forceProgressiveDownload:l,swDrmMode:u,muffleAfterSeconds:c,downloadMode:d,onProgress:f,onError:h,useFallbackOnError:m,enabled:g});(0,r.useEffect)(()=>{p?.({status:S,resolvedSrc:x})},[S,x,p]);let _=(0,r.useCallback)(e=>{w.current=e,"function"==typeof y?y(e):y&&(y.current=e)},[w,y]);return(0,t.jsx)("audio",{ref:_,crossOrigin:b.crossOrigin??"anonymous",...b})}])},463558,e=>{"use strict";var t=e.i(673157),r=e.i(554907);e.i(481045);var o=e.i(536952);e.i(179395);var n=e.i(73605),i=e.i(274918),a=e.i(157348);e.s(["CompactInstrumentsNamespaceFallback",0,function({appearance:e="themed",isRetrying:r,retry:a}){let{t:s}=(0,o.useTranslation)("common"),l="dark"===e;return(0,t.jsxs)("div",{role:"alert",className:"shrink-0",children:[(0,t.jsx)("span",{className:"sr-only",children:s("fallbacks.contentUnavailable")}),(0,t.jsx)(n.Button,{size:i.ButtonSize.Small,variant:l?i.ButtonVariant.Inherit:i.ButtonVariant.Standard,className:l?"bg-white/10 text-white/60 hover:bg-white/15 disabled:opacity-40":void 0,disabled:r,onClick:a,children:s(r?"actions.retrying":"actions.retry")})]})},"InstrumentsNamespaceBoundary",0,function({children:e,pendingFallback:o=null,renderFallback:n}
3){return(0,t.jsx)(a.NamespaceLoadErrorBoundary,{renderFallback:n,children:(0,t.jsx)(r.Suspense,{fallback:o,children:e})})}])},316805,e=>{"use strict";function t(e,t,r,o){for(let n of t)!function(e,t,r,o){if(0===t.points.length)return;let n=Math.max(2,t.size*Math.min(r,o));if(1===t.points.length){let i=t.points[0];e.beginPath(),e.fillStyle=t.color,e.arc(i.x*r,i.y*o,n/2,0,2*Math.PI),e.fill();return}e.beginPath(),e.strokeStyle=t.color,e.lineWidth=n,e.lineJoin="round",e.lineCap="round",t.points.forEach((t,n)=>{let i=t.x*r,a=t.y*o;0===n?e.moveTo(i,a):e.lineTo(i,a)}),e.stroke()}(e,n,r,o)}e.s(["MAX_PEN_SIZE",0,.03,"MIN_PEN_SIZE",0,.002,"PEN_SIZE",0,.005,"countStrokeVoices",0,function(e){let t=e.points;if(t.length<=2)return 1;let r=1,o=0;for(let e=1;e<t.length;e++){let n=t[e].x-t[e-1].x;if(0===n)continue;let i=n>0?1:-1;0===o?o=i:i!==o&&(r++,o=i)}return r},"drawSketch",0,t,"offsetStrokes",0,function(e,t,r){let o=1,n=0,i=1,a=0;for(let t of e)for(let e of t.points)o=Math.min(o,e.x),n=Math.max(n,e.x),i=Math.min(i,e.y),a=Math.max(a,e.y);let s=Math.max(-o,Math.min(1-n,t)),l=Math.max(-i,Math.min(1-a,r));return e.map(e=>({...e,timbre:{...e.timbre},points:e.points.map(e=>({x:e.x+s,y:e.y+l}))}))},"remapSelectionAfterRemoval",0,function(e,t){if(0===e.length||0===t.length)return e;let r=new Set(t),o=[...r].sort((e,t)=>e-t),n=[];for(let t of e){if(r.has(t))continue;let e=0;for(let r of o){if(r>=t)break;e++}n.push(t-e)}return n},"renderSketchPngDataUrl",0,function(e,r){let o=Number.isFinite(r)&&r>0?r:16/9,n=o>=1?1024:Math.round(1024*o),i=o>=1?Math.round(1024/o):1024,a=document.createElement("canvas");a.width=n,a.height=i;let s=a.getContext("2d");if(!s)throw Error("Could not create export canvas context");return s.fillStyle="#0d0d10",s.fillRect(0,0,n,i),t(s,e,n,i),a.toDataURL("image/png")},"strokeGesture",0,function(e){let t=e.points;if(t.length<2)return"dot";let r=t[0].x,o=t[0].x,n=t[0].y,i=t[0].y;for(let e=1;e<t.length;e++){let a=t[e];r=Math.min(r,a.x),o=Math.max(o,a.x),n=Math.min(n,a.y),i=Math.max(i,a.y)}return .012>Math.hypot(o-r,i-n)?"dot":"line"},"usedSketchColors",0,function(e){let t=new Set,r=[];for(let o of e)t.has(o.color)||(t.add(o.color),r.push({hex:o.color,timbre:o.timbre}));return r}])},544324,e=>{"use strict";let t=e=>Math.min(1,Math.max(0,e)),r=e=>1-t(e.x),o=e=>t(e.y);e.s(["brightnessOf",0,o,"strokeRegister",0,function(e){let t=e.points.reduce((e,t)=>e+(1-t.y),0)/e.points.length;return t<.33?"low":t>.67?"high":"mid"},"timbreAdjectives",0,function(e){var t,n;return[...(t=r(e))>.72?["warm","rounded"]:t>.5?["mellow","smooth"]:t>.28?["cool","clean"]:["glassy","crystalline"],...(n=o(e))>.72?["bright","shimmering"]:n>.5?["open","airy"]:n>.28?["soft","dusky"]:["dark","covered"]]},"timbreHex",0,function(e){return function(e,t){let r=(1-Math.abs(2*t-1))*.72,o=(e%360+360)%360/60%6,n=r*(1-Math.abs(o%2-1)),[i,a,s]=o<1?[r,n,0]:o<2?[n,r,0]:o<3?[0,r,n]:o<4?[0,n,r]:o<5?[n,0,r]:[r,0,n],l=t-r/2,u=e=>Math.round((e+l)*255).toString(16).padStart(2,"0");return`#${u(i)}${u(a)}${u(s)}`}(0+240*t(e.x),.2+.6000000000000001*t(e.y))},"timbreSynthParams",0,function(e){return{sawMix:r(e),cutoffHz:400*2**(4.3*o(e))}}])},603517,71684,780255,529715,671777,789684,453216,262545,e=>{"use strict";var t=e.i(316805),r=e.i(544324),o=e.i(894487);let n={C:0,"C#/Db":1,D:2,"D#/Eb":3,E:4,F:5,"F#/Gb":6,G:7,"G#/Ab":8,A:9,"A#/Bb":10,B:11}
3,i=[0,2,4,5,7,9,11],a=[0,2,3,5,7,8,10],s=e=>440*2**((e-69)/12),l=(e,t)=>(n[e.tonic]??0)+12*(t+1),u=(e,t,r)=>{let o=n[e.tonic]??0,s="minor"===e.mode?a:i,l=[];for(let e=t-12;e<=t+r+12;e++)s.includes((e-o+120)%12)&&l.push(e);return l},c=(e,t)=>{let r=t[0],o=1/0;for(let n of t){let t=Math.abs(n-e);t<o&&(o=t,r=n)}return r},d=2*Math.PI,f=(e,t,r,n)=>{let i=Math.floor(.03*t);for(let a=0;a<n;a++){let n=Math.floor(a*r*t),s=a%o.BEATS_PER_BAR==0?1600:1e3,l=a%o.BEATS_PER_BAR==0?.28:.16;for(let r=0;r<i&&n+r<e.length;r++){let o=1-r/i;e[n+r]+=Math.sin(d*s*r/t)*l*o*o}}},h=(e,t,r)=>{for(let o=0;o<r.length;o++)e.setUint8(t+o,r.charCodeAt(o))},p=(e,t)=>{let r=new ArrayBuffer(44+2*e.length),o=new DataView(r);h(o,0,"RIFF"),o.setUint32(4,36+2*e.length,!0),h(o,8,"WAVE"),h(o,12,"fmt "),o.setUint32(16,16,!0),o.setUint16(20,1,!0),o.setUint16(22,1,!0),o.setUint32(24,t,!0),o.setUint32(28,2*t,!0),o.setUint16(32,2,!0),o.setUint16(34,16,!0),h(o,36,"data"),o.setUint32(40,2*e.length,!0);let n=44;for(let t=0;t<e.length;t++){let r=Math.max(-1,Math.min(1,e[t]));o.setInt16(n,32767*r,!0),n+=2}return new Blob([r],{type:"audio/wav"})};e.s(["CLIP_SAMPLE_RATE",0,44100,"KEY_TONICS",0,["C","C#/Db","D","D#/Eb","E","F","F#/Gb","G","G#/Ab","A","A#/Bb","B"],"addMetronome",0,f,"buildScaleMidiSet",0,u,"encodeWav",0,p,"frequencyFromMidi",0,s,"keyLabel",0,e=>`${e.tonic} ${e.mode}`,"registerLowMidi",0,l,"snapToScale",0,c],71684);let m=2*Math.PI;function g(e){let{strokes:n,bpm:i,bars:a,key:d,sampleRate:h,withMetronome:p}=e,g=a*o.BEATS_PER_BAR,v=60/i,y=Math.max(1,Math.floor(g*v*h)),b=new Float32Array(y),w=.1/g;for(let e of n)0!==e.points.length&&function(e,o,n,i,a){var d;let f=l(n,2),h=u(n,f,48),{sawMix:p,cutoffHz:g}=(0,r.timbreSynthParams)(o.timbre),v={sawMix:p,cutoffHz:g,makeupGain:1+(1-(0,r.brightnessOf)(o.timbre))*.5};for(let r of"dot"===(0,t.strokeGesture)(o)?[function(e,t,r){let o=e.points.reduce((e,t)=>e+(1-t.y),0)/e.points.length,n=Math.min(...e.points.map(e=>e.x)),i=Array(t).fill(o),a=Array(t).fill(!1);for(let e=0;e<t;e++){let o=t<=1?0:e/(t-1);a[e]=o>=n&&o<=n+r}return{pitch:i,gate:a}}(o,e.length,a)]:(d=e.length,(function(e){if(e.length<=2)return[e];let t=[],r=0,o=0;for(let n=1;n<e.length;n++){let i=e[n].x-e[n-1].x;if(0===i)continue;let a=i>0?1:-1;0===o?o=a:a!==o&&(t.push(e.slice(r,n)),r=n-1,o=a)}return t.push(e.slice(r)),t})(o.points.map(e=>({x:e.x,y:1-e.y}))).map(e=>((e,t)=>{let r=Array(t).fill(.5),o=Array(t).fill(!1);if(0===e.length)return{pitch:r,gate:o};let n=[...e].sort((e,t)=>e.x-t.x),i=n[0].x,a=n[n.length-1].x,s=e=>t<=1?0:e/(t-1);if(a-i<1e-4){let e=n.reduce((e,t)=>e+t.y,0)/n.length;for(let n=0;n<t;n++)r[n]=e,o[n]=s(n)>=i;return{pitch:r,gate:o}}let l=0;for(let e=0;e<t;e++){let t=s(e);if(t<i){r[e]=n[0].y;continue}if(t>a){r[e]=n[n.length-1].y;continue}for(;l<n.length-2&&n[l+1].x<t;)l++;let u=n[l],c=n[l+1]??u,d=c.x-u.x,f=d<1e-6?0:(t-u.x)/d;r[e]=u.y+(c.y-u.y)*f,o[e]=!0}return{pitch:r,gate:o}})(e,d))))!function(e,t,r,o,n,i){let{pitch:a,gate:l}=t,{sawMix:u,cutoffHz:d,makeupGain:f}=r,h=1-Math.exp(-m*d/i),p=1/Math.max(1,.012*i),g=1/Math.max(1,.05*i),v=0,y=0,b=0;for(let t=0;t<e.length;t++){let r=+!!l[t];if((y+=Math.max(-g,Math.min(p,r-y)))<=1e-4&&!l[t])continue;v+=s(c(o+48*a[t],n))/i;let d=Math.sin(m*(v-=Math.floor(v)))*(1-u)+(2*v-1)*.65*u;b+=h*(d-b),e[t]+=b*y*.42*f}}(e,r,v,f,h,i)}(b,e,d,h,w);let S=Math.floor(.012*h);for(let e=0;e<y;e++){let t=.85*Math.tanh(1.2*b[e]);e>y-S&&(t*=(y-e)/S),b[e]=t}return p&&f(b,h,v,g),b}e.s(["frequencyForPitch",0,function(e,t){let r=l(t,2),o=u(t,r,48);return s(c(r+48*e,o))},"registerOctaveLabels",0,function(e){return Array.from({length:5},(t,r)=>`${e.tonic}${2+r}`)},"renderSketchMixSamples",0,g,"renderSketchMixWav",0,function(e,t,r,o){return p(g({strokes:e,bpm:t,bars:r,key:o,sampleRate:44100,withMetronome:!1}),44100)}],780255);let v=[{id:"quarter",grid:1,labelKey:null,notationLabel:"1/4"},{id:"eighth",grid:.5,labelKey:null,notationLabel:"1/8"},{id:"sixteenth",grid:.25,labelKey:null,notationLabel:"1/16"},{id:"off",grid:null,labelKey:"instrumentControls.quantizeOff"}],y=e=>
3e*o.BEATS_PER_BAR,b=(e,t)=>null==t?e:Math.round(e/t)*t;e.s(["DEFAULT_QUANTIZE_GRID",0,.25,"PASTE_OFFSET_FALLBACK_BEATS",0,.25,"QUANTIZE_OPTIONS",0,v,"getQuantizeOptionId",0,function(e){return v.find(t=>t.grid===e)?.id??"off"},"getQuantizeOptionLabel",0,function({option:e,t}){return null===e.labelKey?e.notationLabel:t("instrumentControls.quantizeOff")},"quantizeBeats",0,b,"shiftStartBeatsInLoop",0,function(e,t,r){return e.map(e=>({...e,startBeats:((e.startBeats+t)%r+r)%r}))},"totalLoopBeats",0,y],529715);let w=[{id:"bassDrum",labelKey:"drumKit.bassDrum",key:"1"},{id:"snare",labelKey:"drumKit.snare",key:"2"},{id:"lowTom",labelKey:"drumKit.lowTom",key:"3"},{id:"midTom",labelKey:"drumKit.midTom",key:"4"},{id:"hiTom",labelKey:"drumKit.highTom",key:"q"},{id:"lowConga",labelKey:"drumKit.lowConga",key:"w"},{id:"midConga",labelKey:"drumKit.midConga",key:"e"},{id:"hiConga",labelKey:"drumKit.highConga",key:"r"},{id:"rimShot",labelKey:"drumKit.rimShot",key:"a"},{id:"handClap",labelKey:"drumKit.handClap",key:"s"},{id:"cowbell",labelKey:"drumKit.cowbell",key:"d"},{id:"cymbal",labelKey:"drumKit.cymbal",key:"f"},{id:"openHat",labelKey:"drumKit.openHat",key:"z"},{id:"closedHat",labelKey:"drumKit.closedHat",key:"x"},{id:"maracas",labelKey:"drumKit.maracas",key:"c"},{id:"claves",labelKey:"drumKit.claves",key:"v"}],S=w.length,x=["closedHat","openHat","cymbal","maracas","claves","cowbell","rimShot","handClap","snare","hiConga","midConga","lowConga","hiTom","midTom","lowTom","bassDrum"].map(e=>w.findIndex(t=>t.id===e)),_=x.reduce((e,t,r)=>(e[t]=r,e),Array(S).fill(0)),M={openHat:"hat",closedHat:"hat"},E=e=>{let t=w[e]?.id;return void 0===t?null:M[t]??null};e.s(["DEFAULT_VELOCITY",0,.8,"DRUM_PADS",0,w,"PAD_COUNT",0,S,"PAD_TO_ROW",0,_,"ROW_TO_PAD",0,x,"chokeGroupForPad",0,E,"finalizeHit",0,function(e){let{pad:t,startBeats:r,velocity:o,loopBeats:n,grid:i}=e,a=b((r%n+n)%n,i);return{pad:t,startBeats:a>=n?0:a,velocity:o}},"getDrumPadLabel",0,function({pad:e,t}){switch(e.labelKey){case"drumKit.bassDrum":return t("drumKit.bassDrum");case"drumKit.snare":return t("drumKit.snare");case"drumKit.lowTom":return t("drumKit.lowTom");case"drumKit.midTom":return t("drumKit.midTom");case"drumKit.highTom":return t("drumKit.highTom");case"drumKit.lowConga":return t("drumKit.lowConga");case"drumKit.midConga":return t("drumKit.midConga");case"drumKit.highConga":return t("drumKit.highConga");case"drumKit.rimShot":return t("drumKit.rimShot");case"drumKit.handClap":return t("drumKit.handClap");case"drumKit.cowbell":return t("drumKit.cowbell");case"drumKit.cymbal":return t("drumKit.cymbal");case"drumKit.openHat":return t("drumKit.openHat");case"drumKit.closedHat":return t("drumKit.closedHat");case"drumKit.maracas":return t("drumKit.maracas");case"drumKit.claves":return t("drumKit.claves")}},"padForKey",0,e=>{let t=w.findIndex(t=>t.key===e);return -1===t?null:t}],671777);let k=2*Math.PI;function C(e,t,r){let{durationSec:o,startHz:n,endHz:i,pitchTauSec:a,ampTauSec:s}=r,l=Math.max(1,Math.floor(o*t)),u=new Float32Array(l),c=a*t,d=s*t,f=0;for(let r=0;r<l;r++){let o=i+(n-i)*Math.exp(-r/c),a=Math.exp(-r/d);u[r]=Math.sin(k*f)*a*e,f+=o/t,f-=Math.floor(f)}return u}function T(e,t,r){let{durationSec:o,ampTauSec:n,highpass:i,gain:a}=r,s=Math.max(1,Math.floor(o*t)),l=new Float32Array(s),u=n*t,c=0;for(let t=0;t<s;t++){let r=2*Math.random()-1,o=i?r-c:r;c=r,l[t]=o*Math.exp(-t/u)*a*e}return l}let A=[205.3,304.4,369.6,522.7,540,800];function I(e,t,r){let{durationSec:o,ampTauSec:n,gain:i}=r,a=Math.max(1,Math.floor(o*t)),s=new Float32Array(a),l=n*t,u=A.map(()=>0),c=A.map(e=>e/t),d=0;for(let t=0;t<a;t++){let r=0;for(let e=0;e<A.length;e++)r+=u[e]<.5?1:-1,u[e]+=c[e],u[e]-=Math.floor(u[e]);let o=(r/=A.length)-d;d=r;let n=.7*o+(2*Math.random()-1)*.3;s[t]=n*Math.exp(-t/l)*i*e}return s}function P(e,t,r){switch((w[e]??w[0]).id){case"bassDrum":return C(t,r,{durationSec:.5,startHz:150,endHz:52,pitchTauSec:.035,ampTauSec:.13});case"snare":return function(e,t){let r=Math.max(1,Math.floor(.22*t)),o=T(e,t,{durationSec:.22,ampTauSec:.07,highpass:!1,gain:.7}),n=.09*t;for(let i=0;i<r;i++){let r=Math.exp(-i/n);o[i]+=Math.sin(185*k*i/t)*r*.5*e}return o}(t,r);case"lowTom":return C(t,r,{durationSec:.42,startHz:165,endHz:90,pitchTauSec:.06,ampTauSec:.2});
3case"midTom":return C(t,r,{durationSec:.38,startHz:220,endHz:130,pitchTauSec:.05,ampTauSec:.17});case"hiTom":return C(t,r,{durationSec:.34,startHz:300,endHz:180,pitchTauSec:.045,ampTauSec:.15});case"lowConga":return C(t,r,{durationSec:.3,startHz:260,endHz:220,pitchTauSec:.04,ampTauSec:.13});case"midConga":return C(t,r,{durationSec:.26,startHz:380,endHz:340,pitchTauSec:.035,ampTauSec:.11});case"hiConga":return C(t,r,{durationSec:.22,startHz:520,endHz:470,pitchTauSec:.03,ampTauSec:.1});case"rimShot":return function(e,t){let r=Math.max(1,Math.floor(.06*t)),o=new Float32Array(r),n=.012*t;for(let i=0;i<r;i++){let r=Math.sin(1700*k*i/t),a=(2*Math.random()-1)*.3;o[i]=(r+a)*Math.exp(-i/n)*.6*e}return o}(t,r);case"handClap":return function(e,t){let r=Math.max(1,Math.floor(.3*t)),o=new Float32Array(r),n=[0,.009,.018].map(e=>Math.floor(e*t)),i=.007*t,a=.11*t,s=n[n.length-1];for(let t=0;t<r;t++){let r=0;for(let e of n)t>=e&&(r+=Math.exp(-(t-e)/i));t>=s&&(r+=.5*Math.exp(-(t-s)/a)),o[t]=(2*Math.random()-1)*r*.5*e}return o}(t,r);case"cowbell":return function(e,t){let r=Math.max(1,Math.floor(.4*t)),o=new Float32Array(r),n=.12*t,i=540/t,a=800/t,s=0,l=0;for(let t=0;t<r;t++){let r=((s<.5?1:-1)+(l<.5?1:-1))*.5;s+=i,s-=Math.floor(s),l+=a,l-=Math.floor(l),o[t]=r*Math.exp(-t/n)*.4*e}return o}(t,r);case"cymbal":return I(t,r,{durationSec:.8,ampTauSec:.28,gain:.4});case"openHat":return I(t,r,{durationSec:.4,ampTauSec:.12,gain:.45});case"closedHat":return I(t,r,{durationSec:.08,ampTauSec:.02,gain:.5});case"maracas":return T(t,r,{durationSec:.05,ampTauSec:.012,highpass:!0,gain:.5});case"claves":let o=Math.max(1,Math.floor(.06*r)),n=new Float32Array(o),i=.012*r;for(let e=0;e<o;e++)n[e]=Math.sin(2500*k*e/r)*Math.exp(-e/i)*.6*t;return n}}function B(e){let{hits:t,bpm:r,bars:n,sampleRate:i,withMetronome:a}=e,s=y(n),l=60/r,u=l*i,c=Math.max(1,Math.floor(s*l*i)),d=new Float32Array(c),h=function(e,t,r){let o=e.map(()=>null),n=new Map;for(let i of(e.forEach((e,t)=>{let r=E(e.pad);if(null==r)return;let o=n.get(r);o?o.push(t):n.set(r,[t])}),n.values())){if(i.length<2)continue;let n=[...i].sort((t,r)=>e[t].startBeats-e[r].startBeats);n.forEach((i,a)=>{let s=n[(a+1)%n.length],l=(a===n.length-1?e[s].startBeats+t:e[s].startBeats)-e[i].startBeats;o[i]=Math.max(0,Math.round(l*r))})}return o}(t,s,u);t.forEach((e,t)=>{!function(e,t,r,o,n){let i=P(t.pad,t.velocity,o),a=e.length,s=Math.round(t.startBeats*r),l=null!=n&&n<i.length,u=l?n:i.length,c=Math.max(1,Math.round(.005*o));if(l&&u<=c)return;let d=l?c:0,f=u-d;for(let t=0;t<u;t++){let r=t>=f?(u-t)/d:1;e[(s+t)%a]+=.9*i[t]*r}}(d,e,u,i,h[t])});for(let e=0;e<c;e++)d[e]=.9*Math.tanh(1.2*d[e]);return a&&f(d,i,l,n*o.BEATS_PER_BAR),d}e.s(["CHOKE_FADE_SEC",0,.005,"VOICE_GAIN",0,.9,"renderDrumMixSamples",0,B,"renderDrumMixWav",0,function(e,t,r){return p(B({hits:e,bpm:t,bars:r,sampleRate:44100,withMetronome:!1}),44100)},"renderPadVoice",0,P],789684),e.s(["MIN_NOTE_BEATS",0,.0625,"finalizeNote",0,function(e){let{pitch:t,startBeats:r,endBeats:o,velocity:n,loopBeats:i,grid:a}=e,s=Math.max(.0625,o-r),l=b((r%i+i)%i,a);return{pitch:t,startBeats:l>=i?0:l,durationBeats:Math.min(s,i),velocity:n}}],453216);let O=2*Math.PI;function R(e){return .22+2.78*e}function U(e){let{notes:t,bpm:r,bars:n,sampleRate:i,withMetronome:a}=e,l=y(n),u=60/r,c=u*i,d=Math.max(1,Math.floor(l*u*i)),h=new Float32Array(d);for(let e of t){let t=s(e.pitch);!function(e,t,r,o,n){let i=e.length,a=Math.round(t.startBeats*o),s=Math.max(1,Math.round(t.durationBeats*o)),l=Math.max(1,.004*n),u=2.2*n,c=.12*n,d=.35*n,f=.045*n,h=.3*t.velocity,p=R(t.velocity),m=.2*t.velocity,g=r/n,v=r/n,y=14*r,b=y<.45*n,w=y/n,S=0,x=0,_=0;for(let t=0;;t++){let r;if(r=t<l?t/l:Math.exp(-(t-l)/u),t>=s&&(r*=Math.exp(-(t-s)/c))<.001||t>i&&t>=s)break;let o=Math.sin(O*x)*(.22+(p-.22)*Math.exp(-t/d)),n=Math.sin(O*S+o);b&&(n+=Math.sin(O*_)*m*Math.exp(-t/f)),e[(a+t)%i]+=n*r*h,S+=g,S-=Math.floor(S),x+=v,x-=Math.floor(x),_+=w,_-=Math.floor(_)}}(h,e,t,c,i)}for(let e=0;e<d;e++)h[e]=.9*Math.tanh(1.2*h[e]);return a&&f(h,i,u,n*o.BEATS_PER_BAR),h}e.s(["EP_INDEX_SUSTAIN",0,.22,"EP_INDEX_TAU_SECONDS",0,.35,"EP_MOD_RATIO",0,1,"EP_TINE_LEVEL",0,.2,"
3EP_TINE_RATIO",0,14,"EP_TINE_TAU_SECONDS",0,.045,"PIANO_ATTACK_SECONDS",0,.004,"PIANO_DECAY_TAU_SECONDS",0,2.2,"PIANO_RELEASE_TAU_SECONDS",0,.12,"SOFT_CLIP_DRIVE",0,1.2,"SOFT_CLIP_LEVEL",0,.9,"epIndexPeak",0,R,"renderKeyboardMixSamples",0,U,"renderKeyboardMixWav",0,function(e,t,r){return p(U({notes:e,bpm:t,bars:r,sampleRate:44100,withMetronome:!1}),44100)}],262545),e.s(["renderSynthRequest",0,function(e,t){return"drawing"===e.kind?g({strokes:e.strokes,bpm:e.bpm,bars:e.bars,key:e.key,sampleRate:t,withMetronome:e.withMetronome}):"drums"===e.kind?B({hits:e.hits,bpm:e.bpm,bars:e.bars,sampleRate:t,withMetronome:e.withMetronome}):U({notes:e.notes,bpm:e.bpm,bars:e.bars,sampleRate:t,withMetronome:e.withMetronome})}],603517)},894487,e=>{"use strict";e.s(["BAR_OPTIONS",0,[2,4,8],"BEATS_PER_BAR",0,4,"DEFAULT_BARS",0,4,"DEFAULT_TEMPO_BPM",0,90,"MAX_TEMPO_BPM",0,180,"MIN_TEMPO_BPM",0,50,"loopDurationMs",0,(e,t)=>4*t*6e4/e])},323654,e=>{"use strict";var t=e.i(554907);let r=0,o=new Set;function n(){for(let e of o)e()}function i(e){return o.add(e),()=>{o.delete(e)}}let a=()=>r>0,s=()=>!1;e.s(["useGlobalHotkeysSuspended",0,function(){return(0,t.useSyncExternalStore)(i,a,s)},"useSuspendGlobalHotkeys",0,function(e=!0){(0,t.useEffect)(()=>{if(e)return r+=1,n(),()=>{r=Math.max(0,r-1),n()}},[e])}])},457002,e=>{"use strict";var t=e.i(673157),r=e.i(554907);let o=(0,r.createContext)({markNavigatedFromSearch:()=>{},consumeNavigatedFromSearch:()=>!1});e.s(["SearchArrivalProvider",0,({children:e})=>{let n=(0,r.useRef)(!1),i=(0,r.useCallback)(()=>{n.current=!0},[]),a=(0,r.useCallback)(()=>{let e=n.current;return n.current=!1,e},[]),s=(0,r.useMemo)(()=>({markNavigatedFromSearch:i,consumeNavigatedFromSearch:a}),[i,a]);return(0,t.jsx)(o.Provider,{value:s,children:e})},"useSearchArrival",0,()=>(0,r.useContext)(o)])},875732,e=>{"use strict";var t=e.i(673157),r=e.i(559992),o=e.i(744461),n=e.i(554907),i=e.i(54559),a=e.i(551283),s=e.i(548004),l=e.i(42305),u=e.i(256044);let c=!1,d=(0,r.keyframes)("from{opacity:1;}to{opacity:0;}"),f=(0,o.default)("div",{target:"e130o77r0"})("position:fixed;top:0;left:0;right:0;bottom:0;opacity:1;background-color:black;z-index:1000000000;display:flex;align-items:center;justify-content:center;&.fade-out{pointer-events:none;animation:1s ease-out 1s 1 both ",d,";}"),h=(0,n.createContext)({done:!1,setDone:()=>{}});e.s(["StudioLoadingCompleter",0,()=>{let{setDone:e}=(0,n.useContext)(h);return(0,n.useEffect)(()=>{e(!0)},[e]),null},"StudioLoadingOverlayProvider",0,({children:e})=>{let[r,o]=(0,n.useState)(!1),i=(0,n.useMemo)(()=>({done:r,setDone:o}),[r,o]);return(0,t.jsx)(h.Provider,{value:i,children:e})},"default",0,function(){let{done:e}=(0,n.useContext)(h),[r,o]=(0,n.useState)(c);c=r||c,(0,n.useEffect)(()=>{e&&setTimeout(()=>{o(!0)},8e3)},[e]);let d=(0,a.useIsClient)(),p=!(0,s.useBreakpointMd)()||(0,l.isMobileBrowser)();return r||!d||p?null:(0,i.createPortal)((0,t.jsx)(f,{className:e?"fade-out":"",children:(0,t.jsx)("video",{className:"w-[17.5rem]",autoPlay:!0,loop:!0,muted:!0,playsInline:!0,src:(0,u.staticAssetUrl)("studio/studio_loading_h264.mp4")},"studio-loading-video")},"studio-loading-overlay"),document.body)}])},926561,e=>{"use strict";var t=e.i(673157),r=e.i(877130);e.s(["TextInput",0,function({className:e,type:o,...n}){return(0,t.jsx)("input",{type:o,"data-slot":"input",className:(0,r.twMerge)("h-12 w-full rounded-2xl bg-background-primary px-4 outline-none",e),...n})}])},730502,e=>{"use strict";var t=e.i(248949);e.i(948952);var r=e.i(350671),o=e.i(200279),n=e.i(605960);function i(e){return e.t("runtimeFeedback.tryAgain",{ns:"common"})}async function a(e){let a,{data:s,instance:l,isCurrent:u}=e;if(u?.()===!1)return;let{timeout:c,position:d}=function(e){switch(e){case"moderation-failed":return{timeout:0,position:"top"};case"upload-timed-out":case"processing-timed-out":return{timeout:6e3};case"video-too-short":case"video-too-long":case"file-too-large":case"generic-upload-error":return{timeout:5e3,position:"top"};case"processing-failed":case"processing-mutation-failed":case"upload-failed":return{timeout:4e3}}}(e.failure),f=l.t("fallbacks.contentUnavailable",{ns:"common"});try{let r=await (0,t.loadTranslationsOnDemand)(l,"uploads");switch(e.failure){case"moderation-failed":({title:f,description:a}=(0,o.getHookModerationMessage)({contentRatingTags:e.contentRatingTags,t:r}));break;case"processing-failed":({title:f,description:a}=(0,n.getVideoUploadErrorMessage)({contentRatingTags:e.contentRatingTags,errorMessage:e.errorMessage,errorType:e.errorType,t:r}));break;case"processing-mutation-failed":f=r("videoUpload.processingFailedTitle"),a=e.errorMessage??i(l);break;case"upload-timed-out":f=r("videoUpload.uploadTimedOutTitle"),a=r("videoUpload.uploadTimedOutDescription");break;case"upload-failed":f=r("videoUpload.failed"),a=i(l);break;case"processing-timed-out":f=r("videoUpload.processingTimedOutTitle"),a=r("videoUpload.processingTimedOutDescription");break;case"video-too-short":f=r("videoUpload.tooShortTitle"),a="seconds"===e.unit?r("videoUpload.tooShortSeconds",{count:e.count}):r("videoUpload.tooShortMinutes",{count:e.count});break;case"video-too-long":f=r("videoUpload.tooLongTitle"),a="seconds"===e.unit?r("videoUpload.tooLongSeconds",{count:e.count}):r("videoUpload.tooLongMinutes",{count:e.count});break;case"file-too-large":f=r("videoUpload.fileTooLarge",{maxFileSizeMb:e.maxFileSizeMb});break;case"generic-upload-error":f=r("videoUpload.genericUploadError")}}catch{}u?.()!==!1&&r.toastManager.add({title:f,description:a,type:"error",timeout:c,data:s,...d?{position:d}:{}})}
3e.s(["reportHookUploadFailure",0,a])},941692,e=>{"use strict";var t=e.i(673157),r=e.i(554907);let o=(0,r.createContext)({isBannerVisible:!1,setIsBannerVisible:()=>{}});e.s(["MobileBannerProvider",0,({children:e})=>{let[n,i]=(0,r.useState)(!1);return(0,t.jsx)(o.Provider,{value:{isBannerVisible:n,setIsBannerVisible:i},children:e})},"useMobileBanner",0,()=>(0,r.useContext)(o)])},624219,e=>{"use strict";var t,r=e.i(673157),o=e.i(554907),n=e.i(863406),i=e.i(277565);let a="0.1.3";var s=((t={}).Disabled="disabled",t.Registering="registering",t.Installed="installed",t.Ready="ready",t.Error="error",t);let l=(0,o.createContext)(null);e.s(["ServiceWorkerProvider",0,function(e){let{children:t,enabled:s}=e,u=(0,o.useRef)(!1),c=s??!0,[d,f]=(0,o.useState)(()=>c&&(0,n.isServiceWorkerSupported)()?(0,n.isServiceWorkerReady)()?"ready":"registering":"disabled"),[h,p]=(0,o.useState)(null),[m,g]=(0,o.useState)(null),[v,y]=(0,o.useState)(!1),[b,w]=(0,o.useState)(!1),[S,x]=(0,o.useState)(null);"ready"!==d||u.current||(u.current=!0),(0,o.useEffect)(()=>{(0,n.isServiceWorkerSupported)()&&(navigator.serviceWorker.getRegistrations().then(e=>{e.length>0&&g(e[0])}),(0,n.isServiceWorkerReady)()&&(0,n.getServiceWorkerVersion)().then(e=>{e&&x(e)}))},[]),(0,o.useEffect)(()=>{if(!c||!(0,n.isServiceWorkerSupported)()||u.current)return;let e=!1;return async function(){let t=null;try{f("registering");let r=await (0,n.initializeServiceWorker)();if(e)return;g(r.registration),f("ready"===r.status?"ready":"installed"),p(null),"ready"===r.status&&(0,n.getServiceWorkerVersion)().then(t=>{!e&&t&&x(t)}),t={actionName:"ServiceWorkerRegistration",context:{status:r.status}}}catch(r){e||(n.logger.error("Initialization failed:",r),p(r instanceof Error?r:Error(String(r))),f("error"),t={actionName:"ServiceWorkerError",context:{error:r instanceof Error?r.message:String(r)}})}t&&(0,i.default)(t)}(),()=>{e=!0}},[c]),(0,o.useEffect)(()=>{if(!c||!(0,n.isServiceWorkerSupported)()||"installed"!==d)return;let e=()=>{navigator.serviceWorker.controller&&f("ready")};return navigator.serviceWorker.addEventListener("controllerchange",e),navigator.serviceWorker.controller&&f("ready"),()=>{navigator.serviceWorker.removeEventListener("controllerchange",e)}},[c,d]),(0,o.useEffect)(()=>{if(c&&m)return(0,n.enableServiceWorkerUpdates)({registration:m,onUpdateAvailable:e=>{y(!0),(0,i.default)({actionName:"ServiceWorkerUpdateAvailable"}),(0,n.getServiceWorkerVersion)().then(t=>{t&&((0,i.default)({actionName:"ServiceWorkerVersionMismatchAutoActivate",context:{runningVersion:t,expectedVersion:a}}),(0,n.activateWaitingServiceWorker)(e,{reload:!1}))})},onUpdateActivated:e=>{y(!!e.waiting),(0,i.default)({actionName:"ServiceWorkerUpdateActivated"}),(0,n.getServiceWorkerVersion)().then(e=>{e&&x(e),e&&e!==a&&(n.logger.log(`Page behind (sw=${e}, page=${a}), reload recommended`),(0,i.default)({actionName:"ServiceWorkerPageBehind",context:{swVersion:e,pageVersion:a}}),w(!0))})}})},[c,m]);let _={status:u.current?"ready":d,isReady:u.current||"ready"===d,isEnabled:c,hasWaitingWorker:v,needsPageReload:b,swVersion:S,error:h,registration:m};return(0,r.jsx)(l.Provider,{value:_,children:t})},"ServiceWorkerStatus",()=>s,"useServiceWorkerContextOptional",0,function(){return(0,o.useContext)(l)}],624219)},718502,e=>{"use strict";var t=e.i(673157),r=e.i(554907);let o={},n=(0,r.createContext)(o);e.s(["ServerLayoutProvider",0,function({ssrLayoutCookies:e,children:r}){return(0,t.jsx)(n.Provider,{value:e??o,children:r})},"useServerLayout",0,function(){return(0,r.useContext)(n)}])},323199,e=>{"use strict";var t=e.i(737382),r=e.i(851052);e.i(481045);var o=e.i(536952),n=e.i(248949);e.i(948952);var i=e.i(350671),a=e.i(690836),s=e.i(79076);function l(e,t,r){return e?{...e,pages:e.pages.map(e=>({...e,personas:e.personas.map(e=>e.id===t?{...e,is_loved:r}:e)}))}:e}e.s(["useToggleLovePersona",0,function(){let e=(0,s.useApiClient)(),u=(0,r.useQueryClient)(),{i18n:c,t:d}=(0,o.useTranslation)("common");return(0,t.useMutation)({mutationFn:async({personaId:t})=>{let{data:r,error:o,response:n}=await e.POST("/api/persona/{persona_id}/toggle_love/",{params:{path:{persona_id:t}}});if(!n.ok||o)throw Error("Failed to update persona love status");if(!r)throw Error("No data returned from toggle love endpoint");return r},onMutate:async e=>{await u.cancelQueries({queryKey:a.personaKeys.userPersonas({})}),await u.cancelQueries({queryKey:a.personaKeys.followedPersonas({})}),await u.cancelQueries({queryKey:a.personaKeys.lovedPersonas({})});let t=u.getQueryData(a.personaKeys.userPersonas({})),r=u.getQueryData(a.personaKeys.followedPersonas({})),o=u.getQueryData(a.personaKeys.lovedPersonas({})),n=!1;for(let i of[...t?.pages??[],...r?.pages??[],...o?.pages??[]]){let t=i.personas.find(t=>
3t.id===e.personaId);if(t){n=t.is_loved??!1;break}}let i=!n;return u.setQueryData(a.personaKeys.userPersonas({}),t=>l(t,e.personaId,i)),u.setQueryData(a.personaKeys.followedPersonas({}),t=>l(t,e.personaId,i)),u.setQueryData(a.personaKeys.lovedPersonas({}),t=>l(t,e.personaId,i)),{previousUserPersonas:t,previousFollowedPersonas:r,previousLovedPersonas:o}},onSuccess:async(e,t)=>{i.toastManager.add({title:await (0,n.resolveTextOnDemand)({instance:c,namespace:"voices",resolve:r=>{let o=t.personaName??r("voices.entityLabel");return r(e.loved?"voices.lovedToast":"voices.unlovedToast",{name:o})}}),type:"info",timeout:3e3})},onError:async(e,t,r)=>{r?.previousUserPersonas&&u.setQueryData(a.personaKeys.userPersonas({}),r.previousUserPersonas),r?.previousFollowedPersonas&&u.setQueryData(a.personaKeys.followedPersonas({}),r.previousFollowedPersonas),r?.previousLovedPersonas&&u.setQueryData(a.personaKeys.lovedPersonas({}),r.previousLovedPersonas),i.toastManager.add({title:d("runtimeFeedback.errorTitle"),description:e.message||await (0,n.resolveTextOnDemand)({instance:c,namespace:"voices",resolve:e=>e("voices.failedToUpdateLoveStatus")}),type:"error",timeout:3e3}),console.error("Error toggling persona love:",e)},onSettled:(e,t,r)=>{u.invalidateQueries({queryKey:a.personaKeys.personaById(r.personaId)}),u.invalidateQueries({queryKey:a.personaKeys.personaPaginated({personaId:r.personaId})}),u.invalidateQueries({queryKey:a.personaKeys.lovedPersonas({})}),u.invalidateQueries({queryKey:a.personaKeys.userPersonas({})}),u.invalidateQueries({queryKey:a.personaKeys.followedPersonas({})})}})}])},974374,e=>{"use strict";var t=e.i(983403),r=e.i(79076);let o={submitted:"submitted",rendering:"rendering",rendered_in_moderation:"rendered_in_moderation",rendered_failed_moderation:"rendered_failed_moderation",rendered_passed_moderation:"rendered_passed_moderation",error:"error"},n=[o.rendered_failed_moderation,o.rendered_passed_moderation,o.error];e.s(["HOOK_STATUS",0,o,"useHookById",0,({hookId:e,shouldPoll:i=!1})=>{let a=(0,r.useApiClient)();return(0,t.useQuery)({queryKey:["hookStatus",e],queryFn:async()=>{if(!e)return null;let{data:t}=await a.GET("/api/video/hooks/{hook_id}",{params:{path:{hook_id:e}}});if(t?.status===o.error)throw Error("Hook failed to render");return t},enabled:!!e,refetchInterval:t=>!(!i||!t.state.data||!e||t.state.data?.status&&n.includes(t.state.data.status))&&2e3,refetchOnWindowFocus:!1})}])},98638,e=>{"use strict";var t=e.i(463984),r=e.i(554907);let o=[];e.s(["default",0,()=>{let e=(0,t.usePathname)();(0,r.useEffect)(()=>{o.push({path:e,timestamp:new Date().toISOString()}),o.length>5&&(o=o.slice(-5))},[e])},"getNavigationHistory",0,function(){return o}])},536975,e=>{"use strict";var t,r=e.i(810789),o=e.i(554907),n=e.i(919306),i=e.i(922847),a=e.i(809582),s=e.i(609291),l=((t={}).Ready="Ready",t.Preparing="Preparing",t.Recording="Recording",t.Paused="Paused",t);e.s(["RecordingStage",()=>l,"default",0,(t=4*n.default.sampleRate)=>{let l=(0,o.useMemo)(()=>new Float32Array(t),[]),[u,c]=(0,o.useState)("Ready"),[d,f]=(0,o.useState)(null),h=(0,o.useRef)(1/0),p=(0,o.useRef)(0),m=(0,o.useRef)(null),g=(0,o.useRef)(null),v=(0,o.useRef)(async()=>null),y=(0,o.useCallback)(()=>null!==m.current?p.current:p.current+Math.max(0,Date.now()-h.current),[]),b=(0,o.useRef)(null),w="Ready"===u,S=(0,o.useCallback)(async(t="default",o={})=>{if(w){c("Preparing"),f(null),p.current=0,m.current=null;try{"suspended"===n.default.state&&await n.default.resume();let s=await new Promise((e,r)=>navigator.mediaDevices.getUserMedia({audio:{deviceId:t,echoCancellation:!0,noiseSuppression:!0,autoGainControl:!0,...o,latency:0,sampleRate:n.default.sampleRate},video:!1}).then(t=>{e(t)}).catch(e=>{r(e)})),u=n.default.createMediaStreamSource(s);b.current||(await n.default.audioWorklet.addModule(new e.U(e.r(905506))),b.current=new window.AudioWorkletNode(n.default,"waveformGetterWorklet",{outputChannelCount:[2],numberOfInputs:1}));let d=b.current,f={},p=(0,a.getSafariCompatibleMimeType)();p&&(f.mimeType=p);let m=new MediaRecorder(s,f);g.current=m;let y=!1,w=!1;u.connect(d),d.port.onmessage=e=>{y||w||(y=!0),"waveform"===e.data.type&&(w||"inactive"!==m.state||(m.start(),w=!0),l.set(l.subarray(e.data.waveform.length)),l.set(e.data.waveform,l.length-e.data.waveform.length))};let S=[],x=!1;m.ondataavailable=e=>{x||(x=!0),S.push(e.data)};let _=()=>{},M=new Promise(e=>{_=e}),E=(e,t)=>{r.captureException(t instanceof Error?t:Error(`Recording failed: ${e}`),{tags:{source:"recording-stop-failed",reason:e}}),_(null)};m.onstop=async()=>{try{let e=await (0,i.default)(await new Blob(S).arrayBuffer());_(e)}catch(e){console.error("Error processing recorded audio:",e),E("decode-failed",e)}},m.onerror=e=>{console.error("MediaRecorder error:",e),E("recorder-errored")},h.current=Date.now(),c("Recording"),v.current=()=>{try{u.disconnect()}catch(e){console.warn("Error disconnecting MediaStreamSource:",e)}try{d.disconnect()}catch(e){console.warn("Error disconnecting WaveformGetterWorklet:",e)}
3try{s.getAudioTracks().forEach(e=>{e.stop()})}catch(e){console.warn("Error stopping audio tracks:",e)}try{"inactive"!==m.state?m.stop():0===S.length&&E("no-data-recorded")}catch(e){console.warn("Error stopping MediaRecorder:",e),E("stop-threw",e)}return M}}catch(e){throw v.current=async()=>null,c("Ready"),e}}},[w,l]),x=(0,o.useCallback)(()=>{if("Recording"!==u)return;let e=Date.now();p.current+=Math.max(0,e-h.current),m.current=e,g.current&&"recording"===g.current.state&&g.current.pause(),c("Paused")},[u]),_=(0,o.useCallback)(()=>{"Paused"===u&&(m.current=null,h.current=Date.now(),g.current&&"paused"===g.current.state&&g.current.resume(),c("Recording"))},[u]),M=(0,o.useCallback)(async()=>{if("Recording"!==u&&"Paused"!==u)return d;c("Ready");let e=await v.current();return f(e),e},[u,d]);return(0,s.default)(M),{startRecording:S,stopRecording:M,pauseRecording:x,resumeRecording:_,recordedBuffer:d,visualizedWindow:l,stage:u,getCurrentDuration:y}}])},455249,e=>{"use strict";var t=e.i(672599),r=e.i(851052),o=e.i(554907),n=e.i(79076),i=e.i(335380);let a=new Set(["public_song","hybrid_search","tag_song","library_song"]),s={all:[{scope:"search"}],query:({term:e,searchType:t,rankBy:r,isPublic:o,isInstrumental:n,modelVersions:i,languages:a,creatorFilters:l,pageSize:u})=>[{...s.all[0],searchType:t,term:e.trim().substring(0,256),rankBy:r,isPublic:o,isInstrumental:n,modelVersions:i,languages:a,creatorFilters:l,pageSize:u}]};e.s(["useSearch",0,function({term:e,searchType:l,rankBy:u="most_relevant",isPublic:c=!0,isInstrumental:d,modelVersions:f,languages:h,creatorFilters:p,pageSize:m=20,enabled:g=!0,allowEmptyTerm:v=!1}){let y=(0,n.useApiClient)(),b=(0,r.useQueryClient)(),w=e.trim().substring(0,256),S=(0,t.useInfiniteQuery)({queryKey:s.query({term:e,searchType:l,rankBy:u,isPublic:c,isInstrumental:d,modelVersions:f,languages:h,creatorFilters:p,pageSize:m}),queryFn:async({pageParam:e})=>{let{data:t,error:r}=await y.POST("/api/search/",{body:{search_queries:[{name:l,search_type:l,term:w,from_index:e,size:m,rank_by:u,is_public:c,is_instrumental:d,model_versions:f,languages:h,creator_filters:p}]}});if(r)throw Error("Search request failed");let o=t?.result?.[l],n=o?.result??[];return a.has(l)&&(0,i.seedClipCaches)(n.filter(e=>e?.id),b),{results:n,totalHits:o?.total_hits??0,fromIndex:o?.from_index??0,pageSize:o?.page_size??m}},initialPageParam:0,getNextPageParam:e=>{let t=e.fromIndex+e.pageSize;return t>=e.totalHits?void 0:t},enabled:g&&(v||!!w),staleTime:3e5});return{results:(0,o.useMemo)(()=>{let e=new Set,t=[];for(let r of S.data?.pages??[])for(let o of r.results){let r=o?.id;if(r){if(e.has(r))continue;e.add(r)}t.push(o)}return t},[S.data]),totalHits:S.data?.pages[0]?.totalHits??0,isLoading:S.isLoading,isFetching:S.isFetching,isFetchingNextPage:S.isFetchingNextPage,hasNextPage:S.hasNextPage,fetchNextPage:S.fetchNextPage,refetch:S.refetch,error:S.error}}])},376151,e=>{"use strict";e.s(["getVideoDuration",()=>f,"useVideoUpload",()=>h]);var t=e.i(737382),r=e.i(983403),o=e.i(526222),n=e.i(199757),i=e.i(554907),a=e.i(714267),s=e.i(730502),l=e.i(964977),u=e.i(79076),c=e.i(277565);let d={all:[{scope:"videoUpload"}],uploadStatus:({uploadId:e})=>[{...d.all[0],entity:"uploadStatus",uploadId:e}]};function f(e){return new Promise((t,r)=>{let o=document.createElement("video"),n=URL.createObjectURL(e);o.preload="metadata",o.onloadedmetadata=()=>{URL.revokeObjectURL(n),t(o.duration)},o.onerror=()=>{URL.revokeObjectURL(n),r(Error("Failed to load video metadata"))},o.src=n})}let h=e=>{let h=(0,u.useApiClient)(),p=(0,l.useAppI18n)(),[m,g]=(0,i.useState)(null),[v,y]=(0,i.useState)(null),[b,w]=(0,i.useState)(null),[S,x]=(0,i.useState)(0),[_,M]=(0,i.useState)(null),[E,k]=(0,i.useState)(null),[C,T]=(0,i.useState)(null),A=(0,i.useRef)(null),I=(0,i.useRef)(null),P=(0,i.useRef)(null),B=(0,i.useRef)(0),O=(0,i.useCallback)(e=>B.current===e,[]),{isVideoCover:R=!1,requireVideoSprite:U=!1,requireModeration:D=!0,videoUploadType:L,maxFileSizeMb:N=100,maxFileSize:K=1024*N*1024,minDuration:F,maxDuration:j,pollingTimeout:q=18e4,onVideoSelected:H,uploadTimeout:V=6e5,clipId:z}=e,W=(0,i.useCallback)(async e=>{w("uploading"),x(0),y(null);let{data:t}=await h.POST("/api/uploads/video/",{body:{extension:e.extension}});if(!t)throw Error("Failed to fetch upload parameters");return P.current=t.id,g(t.id),{url:t?.url,fields:t.fields}},[h,g,x,y]),Q=(0,i.useMemo)(()=>new n.default({id:"video-upload",restrictions:{maxNumberOfFiles:1,maxFileSize:K}}).use(o.default,{getUploadParameters:W}),[K,W]),G=(0,i.useCallback)(()=>
3{Q.getFiles().forEach(e=>{Q.removeFile(e.id)})},[Q]),$=(0,i.useCallback)(()=>{Q.cancelAll();let e=B.current;(0,s.reportHookUploadFailure)({failure:"upload-timed-out",instance:p,isCurrent:()=>O(e)}),w("error"),x(0),G()},[Q,G,p,O]),X=(0,i.useCallback)(()=>{I.current&&(clearTimeout(I.current),I.current=null)},[]),Y=(0,i.useCallback)(()=>{X(),I.current=setTimeout($,V)},[X,$,V]);(0,i.useEffect)(()=>{let e=(e,t)=>{x(Math.round(t.bytesUploaded/t.bytesTotal*100))},t=()=>{X(),"video_hook"===L&&(0,c.default)({actionName:"HookUploadVideoFailed",context:{uploadId:m||void 0,clipId:z||void 0}});let e=B.current;(0,s.reportHookUploadFailure)({failure:"upload-failed",instance:p,isCurrent:()=>O(e)}),w("error"),x(0),G()},r=()=>{X(),y(Q.getFiles()?.[0]?.name||null),w("uploading-complete"),"video_hook"===L&&(0,c.default)({actionName:"HookUploadVideoSucceeded",context:{uploadId:m||void 0,clipId:z||void 0}})},o=()=>{X(),G()};return Q.on("upload-progress",e),Q.on("upload-success",r),Q.on("upload-error",t),Q.on("complete",o),()=>{Q.off("upload-progress",e),Q.off("upload-success",r),Q.off("upload-error",t),Q.off("complete",o),X()}},[Q,V,X,$,p,O]);let Z=(({isVideoCover:e,requireVideoSprite:r,requireModeration:o,videoUploadType:n,setUploadStatus:a,pollingStartTime:l,clipId:c,instance:d,isCurrentAttempt:f})=>{let h=(0,u.useApiClient)(),p=(0,i.useCallback)(()=>{a("processing"),l.current=Date.now()},[a,l]),m=(0,i.useCallback)((e,t)=>{a("error"),(0,s.reportHookUploadFailure)({failure:"processing-mutation-failed",errorMessage:e instanceof Error?e.message:null,instance:d,isCurrent:()=>f(t.attempt)})},[a,d,f]);return(0,t.useMutation)({mutationFn:async({uploadId:t,uploadedFilename:i})=>{let{error:a}=await h.POST("/api/uploads/video/{upload_id}/upload-finish/",{params:{path:{upload_id:t}},body:{upload_type:"file_upload",upload_filename:i||"unknown",is_video_cover:e,require_video_sprite:r,fail_task_on_moderation:o,video_upload_type:n,clip_id:c}});if(a)throw a},onSuccess:p,onError:m})})({isVideoCover:R,requireVideoSprite:U,requireModeration:D,videoUploadType:L,setUploadStatus:w,pollingStartTime:A,clipId:z,instance:p,isCurrentAttempt:O});(0,i.useEffect)(()=>{"uploading-complete"===b&&m&&v&&Z.mutate({uploadId:m,uploadedFilename:v,attempt:B.current})},[b,m,v]),(({uploadId:e,uploadStatus:t,pollingConfig:o,onSuccess:n,onError:a,onPollingTimedOut:s})=>{let l=(0,u.useApiClient)(),{pollingStartTime:c,pollingTimeout:f}=o,h=(0,i.useCallback)(()=>!!c.current&&Date.now()-c.current>f,[f]);return(0,r.useQuery)({queryKey:d.uploadStatus({uploadId:e||""}),queryFn:async()=>{if(!e)return;if(h())return void s();let{data:t}=await l.GET("/api/uploads/video/{upload_id}/",{params:{path:{upload_id:e}}});return t?.status==="error"&&a({failedUploadId:e,errorMessage:t?.error_message||"Unknown error",errorType:t?.error_type,contentRatingTags:t?.content_rating_tags}),t?.status==="complete"&&n(t),t},enabled:!!e&&"processing"===t&&!h(),refetchInterval:!("processing"!==t||h())&&2e3,staleTime:0})})({uploadId:m,uploadStatus:b,pollingConfig:{pollingTimeout:q,pollingStartTime:A},onSuccess:e=>{w("complete"),M(e?.s3_id||null),k(e?.image_url||null),T(e?.audio_alignment_timestamp||null)},onError:({failedUploadId:e,errorMessage:t,errorType:r,contentRatingTags:o})=>{let n=()=>P.current===e;n()&&(w("error"),(0,s.reportHookUploadFailure)({failure:"processing-failed",contentRatingTags:o,errorMessage:t,errorType:r,instance:p,isCurrent:n}))},onPollingTimedOut:()=>{w("error");let e=B.current;(0,s.reportHookUploadFailure)({failure:"processing-timed-out",instance:p,isCurrent:()=>O(e)})}});let J=(0,i.useCallback)(async(e,t)=>{let{onError:r}=t||{};B.current+=1;let o=B.current;if(e){if(null!=F||null!=j){let t=await f(e);if(null!=F&&t<F){let e=F<a.MAX_VIDEO_DURATION_SECONDS;(0,s.reportHookUploadFailure)({failure:"video-too-short",unit:e?"seconds":"minutes",count:e?F:Math.round(F/60),instance:p,isCurrent:()=>O(o)}),r?.();return}if(null!=j&&t>j){let e=j<a.MAX_VIDEO_DURATION_SECONDS;(0,s.reportHookUploadFailure)({failure:"video-too-long",unit:e?"seconds":"minutes",count:e?j:Math.round(j/60),instance:p,isCurrent:()=>O(o)}),r?.();return}}let t=null;try{t=Q.addFile({name:e.name,type:e.type,data:e}
3),P.current=null,Y(),"video_hook"===L&&(0,c.default)({actionName:"HookUploadVideoStarted",context:{uploadId:m||void 0,clipId:z||void 0}}),await Q.upload()}catch(n){X();let e=n instanceof Error&&n.message.includes("exceeds maximum");(0,s.reportHookUploadFailure)(e?{failure:"file-too-large",maxFileSizeMb:a.MAX_VIDEO_UPLOAD_FILESIZE_MB,instance:p,isCurrent:()=>O(o)}:{failure:"generic-upload-error",instance:p,isCurrent:()=>O(o)}),H?.(null),t&&Q.removeFile(t),r?.();return}}else P.current=null,X(),G();H?.(e)},[Q,H,G,p,O]);return(0,i.useMemo)(()=>({uploadId:m,uploadS3Id:_,uploadImageUrl:E,uploadStatus:b,uploadProgress:S,audioAlignmentTimestamp:C,updateSelectedVideo:J,removeFiles:G}),[m,_,E,b,S,C,J,G])}},325327,e=>{"use strict";var t=e.i(673157);e.s(["default",0,e=>(0,t.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"currentColor",...e,children:(0,t.jsx)("g",{children:(0,t.jsx)("path",{d:"M12 21a5.93 5.93 0 0 1-3.012-.8A5.84 5.84 0 0 1 6.8 18H4v-2h2.1a8 8 0 0 1-.087-1A40 40 0 0 1 6 14H4v-2h2q0-.5.013-1a8 8 0 0 1 .087-1H4V8h2.8a8 8 0 0 1 .788-1.075q.437-.5 1.012-.875L7 4.4 8.4 3l2.15 2.15a4.63 4.63 0 0 1 2.85 0L15.6 3 17 4.4l-1.65 1.65A5.8 5.8 0 0 1 17.2 8H20v2h-2.1q.075.5.088 1T18 12h2v2h-2q0 .5-.012 1a8 8 0 0 1-.088 1H20v2h-2.8a5.84 5.84 0 0 1-2.187 2.2Q13.625 21 12 21m-2-5h4v-2h-4zm0-4h4v-2h-4z"})})})])},382010,e=>{"use strict";var t=e.i(673157);e.s(["default",0,e=>(0,t.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"currentColor",...e,children:(0,t.jsx)("g",{children:(0,t.jsx)("path",{d:"M11 13v6H9v-4H5v-2zm4-8v4h4v2h-6V5z"})})})])},699666,e=>{"use strict";var t=e.i(673157);e.s(["default",0,e=>(0,t.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"currentColor",...e,children:(0,t.jsx)("g",{children:(0,t.jsxs)("g",{children:[(0,t.jsx)("path",{d:"M9.6 19q-.66 0-1.13-.477Q8 18.045 8 17.375t.47-1.148q.47-.477 1.13-.477t1.13.477.47 1.148-.47 1.148T9.6 19m4.8 0q-.66 0-1.13-.477-.47-.478-.47-1.148t.47-1.148q.47-.477 1.13-.477t1.13.477.47 1.148-.47 1.148T14.4 19m-4.8-4.875q-.66 0-1.13-.477Q8 13.17 8 12.5t.47-1.148 1.13-.477 1.13.477q.47.478.47 1.148t-.47 1.148-1.13.477m4.8 0q-.66 0-1.13-.477-.47-.478-.47-1.148t.47-1.148 1.13-.477 1.13.477q.47.478.47 1.148t-.47 1.148-1.13.477M9.6 9.25q-.66 0-1.13-.477Q8 8.295 8 7.625t.47-1.148T9.6 6t1.13.477q.47.478.47 1.148t-.47 1.148-1.13.477m4.8 0q-.66 0-1.13-.477-.47-.478-.47-1.148t.47-1.148T14.4 6t1.13.477q.47.478.47 1.148t-.47 1.148-1.13.477"}),(0,t.jsx)("path",{d:"M9.6 19q-.66 0-1.13-.477Q8 18.045 8 17.375t.47-1.148q.47-.477 1.13-.477t1.13.477.47 1.148-.47 1.148T9.6 19m4.8 0q-.66 0-1.13-.477-.47-.478-.47-1.148t.47-1.148q.47-.477 1.13-.477t1.13.477.47 1.148-.47 1.148T14.4 19m-4.8-4.875q-.66 0-1.13-.477Q8 13.17 8 12.5t.47-1.148 1.13-.477 1.13.477q.47.478.47 1.148t-.47 1.148-1.13.477m4.8 0q-.66 0-1.13-.477-.47-.478-.47-1.148t.47-1.148 1.13-.477 1.13.477q.47.478.47 1.148t-.47 1.148-1.13.477M9.6 9.25q-.66 0-1.13-.477Q8 8.295 8 7.625t.47-1.148T9.6 6t1.13.477q.47.478.47 1.148t-.47 1.148-1.13.477m4.8 0q-.66 0-1.13-.477-.47-.478-.47-1.148t.47-1.148T14.4 6t1.13.477q.47.478.47 1.148t-.47 1.148-1.13.477"})]})})})])},696889,e=>{"use strict";var t=e.i(673157);e.s(["default",0,e=>(0,t.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"currentColor",...e,children:(0,t.jsx)("g",{children:(0,t.jsx)("path",{d:"M9.9 19q-2.425 0-4.163-1.575Q4 15.85 4 13.5t1.737-3.925T9.9 8h6.3l-1.9-1.9a.99.99 0 1 1 1.4-1.4l3.593 3.593a1 1 0 0 1 0 1.414L15.7 13.3a.99.99 0 1 1-1.4-1.4l1.9-1.9H9.9q-1.575 0-2.738 1Q6 12 6 13.5T7.162 16q1.164 1 2.738 1H16a1 1 0 1 1 0 2z"})})})])},25283,e=>{"use strict";var t=e.i(673157);e.s(["default",0,e=>(0,t.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"currentColor",...e,children:(0,t.jsx)("g",{children:(0,t.jsx)("path",{d:"M2 11q0-2.925 2.037-4.962T9 4h6q2.925 0 4.962 2.037T22 11q0 2.575-1.65 4.525t-4.2 2.375a.98.98 0 0 1-.8-.2.85.85 0 0 1-.35-.7q0-.425.338-.725.337-.3.787-.4 1.725-.4 2.8-1.762A4.9 4.9 0 0 0 20 11q0-2.075-1.462-3.537Q17.074 6 15 6H9Q6.925 6 5.463 7.463 4 8.925 4 11t1.463 3.537T9 16h.175l-.9-.9A.93.93 0 0 1 8 14.413q0-.414.3-.713a.95.95 0 0 1 .7-.275q.425 0 .7.27
35l2.6 2.6q.3.3.3.7t-.3.7l-2.6 2.6a.93.93 0 0 1-.687.275q-.413 0-.713-.275-.3-.3-.3-.713 0-.412.3-.712L9.175 18H9q-2.925 0-4.962-2.037T2 11"})})})])},18150,e=>{"use strict";var t=e.i(673157);e.s(["default",0,e=>(0,t.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"currentColor",...e,children:(0,t.jsx)("g",{children:(0,t.jsx)("path",{d:"M5.723 6.81a.857.857 0 0 1 1.084-1.084L17.43 9.259c.765.255.787 1.33.033 1.615l-3.02 1.146 3.55 3.556q.156.172.242.38.087.205.086.435 0 .228-.085.443a1 1 0 0 1-.258.371l-.8.786a.93.93 0 0 1-.371.25 1.24 1.24 0 0 1-.865 0 1.1 1.1 0 0 1-.378-.25l-3.547-3.546-1.147 3.022c-.286.754-1.36.731-1.615-.034z"})})})])},430806,e=>{"use strict";var t=e.i(673157);e.s(["default",0,e=>(0,t.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"currentColor",...e,children:(0,t.jsx)("g",{children:(0,t.jsx)("path",{d:"M19.031 16.969q0 .617-.32.914a1.03 1.03 0 0 1-.742.305q-.39 0-.766-.22l-8.32-4.843q-.46-.265-.68-.516a.93.93 0 0 1-.21-.609q0-.351.21-.602.22-.257.68-.523l8.32-4.844q.375-.218.766-.218.43 0 .742.304.32.297.32.906zm-12.11 1.18H5.087q-.555 0-.836-.282t-.281-.844V6.97q0-.57.281-.844.281-.28.836-.281h1.836q.546 0 .828.289.29.28.29.836v10.054q0 .563-.282.844t-.836.281"})})})])},681575,e=>{"use strict";var t=e.i(673157);e.s(["default",0,e=>(0,t.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"currentColor",...e,children:(0,t.jsx)("g",{children:(0,t.jsx)("path",{d:"M12 21q-3.45 0-6.012-2.288Q3.424 16.426 3.05 13H5.1q.35 2.6 2.313 4.3Q9.375 19 12 19q2.925 0 4.962-2.038T19 12t-2.038-4.962T12 5a6.75 6.75 0 0 0-3.225.8A7.4 7.4 0 0 0 6.25 8H9v2H3V4h2v2.35a8.7 8.7 0 0 1 3.113-2.475A8.9 8.9 0 0 1 12 3q1.874 0 3.512.712a9.2 9.2 0 0 1 2.85 1.926 9.2 9.2 0 0 1 1.926 2.85A8.7 8.7 0 0 1 21 12q0 1.874-.712 3.512a9.2 9.2 0 0 1-1.925 2.85 9.2 9.2 0 0 1-2.85 1.926A8.7 8.7 0 0 1 12 21m2.8-4.8L11 12.4V7h2v4.6l3.2 3.2z"})})})])},69758,e=>{"use strict";var t=e.i(673157);e.s(["default",0,e=>(0,t.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"currentColor",...e,children:(0,t.jsx)("g",{children:(0,t.jsx)("path",{d:"M12 16H3.37C2.61 16 2 15.39 2 14.63V7c0-.55.45-1 1-1h15.63c.76 0 1.37.61 1.37 1.37V9h-1.63v-.7c0-.12 0-.3-.27-.3H4.52c-.29 0-.52.23-.52.52v4.95c0 .29.23.52.52.52H12c.55 0 1 .45 1 1s-.45 1-1 1zm3.7-.1 1.4-1.4-1.4-1.4a.984.984 0 0 1 0-1.4.984.984 0 0 1 1.4 0l1.4 1.4 1.4-1.4a.984.984 0 0 1 1.4 0c.38.39.39 1.01 0 1.4l-1.38 1.4 1.38 1.4c.38.39.38 1.01 0 1.4s-1.01.4-1.4.01l-1.4-1.38-1.4 1.38c-.39.38-1.01.38-1.4 0a.984.984 0 0 1 0-1.4z"})})})])},335239,e=>{"use strict";var t=e.i(673157),r=e.i(463984),o=e.i(554907),n=e.i(707089);e.i(481045);var i=e.i(536952),a=e.i(32806);e.i(248949);var s=e.i(180219),l=e.i(157348);class u extends n.ErrorBoundary{static getDerivedStateFromError(e){return(0,r.unstable_rethrow)(e),n.ErrorBoundary.getDerivedStateFromError(e)}}function c({resetErrorBoundary:e}){let t=(0,r.useSearchParams)().toString(),n=(0,o.useRef)(t);return(0,o.useEffect)(()=>{t!==n.current&&e()},[e,t]),null}function d({error:e,resetErrorBoundary:r}){return e instanceof s.NamespaceLoadError?(0,t.jsx)(f,{error:e,resetErrorBoundary:r}):(0,t.jsx)(h,{isRetrying:!1,resetErrorBoundary:r,retry:r})}function f({error:e,resetErrorBoundary:r}){let{i18n:o}=(0,i.useTranslation)("common"),n=(0,l.useNamespaceLoadRecovery)({error:e,instance:o,resetErrorBoundary:r});return(0,t.jsx)(h,{isRetrying:n.isRetrying,resetErrorBoundary:r,retry:n.retry})}function h({isRetrying:e,resetErrorBoundary:r,retry:n}){return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(o.Suspense,{fallback:null,children:(0,t.jsx)(c,{resetErrorBoundary:r})}),(0,t.jsx)(l.ContentUnavailableRetryView,{isRetrying:e,retry:n})]})}function p(e,t){e instanceof s.NamespaceLoadError||(0,a.reportClientBoundaryError)({error:e,source:"route-content-boundary",nonRecoverableLevel:"error",extra:{componentStack:t.componentStack}})}e.s(["RouteContentBoundary",0,function({children:e}){let o=(0,r.usePathname)();return(0,t.jsx)(u,{FallbackComponent:d,onError:p,resetKeys:[o],children:e})}])},349526,e=>{"use strict";var t=e.i(206274);let r="suno_session_recoverable";e.s(["clearSessionRecoveryCookie",0,function(){(0,t.writeDocumentCookie)(`${r}=; Path=/; Max-Age=0; SameSite=Lax`)},"setSessionRecoveryCookie",0,function(){let e="https:"===window.location.protocol?"; Secure":"";(0,t.writeDocumentCookie)(`${r}=1; Path=/; Max-Age=31536000; SameSite=Lax${e}`)}])},459381,e=>{"use strict";var t=e.i(810789),r=e.i(47529);let o=()=>{try{return(0,r.normalizeViewRoute)(window.location.pathname)}catch{return"unknown"}},n="challenges.cloudflare.com",i=()=>{let e={};try{let t=navigator.connection;t&&("string"==typeof t.effectiveType&&(e.effective_type=t.effectiveType),"number"==typeof t.downlink&&(e.downlink=t.downlink),"number"==typeof t.rtt&&(e.rtt=t.rtt),"boolean"==typeof t.saveData&&(e.save_data=t.saveData))}catch{}try{e.visibility=document.visibilityState}catch{}try{e.cross_origin_isolated=window.crossOriginIsolated}catch{}return e},a=()=>{try{let e=window.performance;if(!e?.getEntriesByType)return[];let t=e.getEntriesByType("resource"),r=e=>Math.max(0,Math.round(e));return t.filter(e=>(e=>{try{let{hostname:t}=new URL(e);return t===n||t.endsWith(`.${n}`)}catch{return!1}})(e.name)).slice(-10).map(e=>{let t=e.responseStart>0,o={name:e.name,initiator_type:e.initiatorType,start_time:r(e.startTime),duration:r(e.duration),transfer_size:e.transferSize??0,timing_allowed:t};return t?{...o,dns:r(e.domainLookupEnd-e.domainLookupStart),connect:r(e.connectEnd-e.connectStart),tls:e.secureConnectionStart>0?r(e.connectEnd-e.secureConnectionStart):0,ttfb:r(e.responseStart-e.requestStart),response:r(e.responseEnd-e.responseStart)}:o})}catch{return[]}},s=t=>{let r=i();(async()=>{try{let{datadogRum:o}=await e.A(374300);o.addAction("turnstile.generation.outcome",{...t,...r})}catch{}})()};e.s(["captchaFlow",0,o,"emitTurnstileMetric",0,s,"reportCaptchaMountFailure",0,e=>{let{reason:r,isTurnstile:n,isPaid:l,userId:u,clerkId:c}=e,d=o(),f=u||c||void 0,h=i(),p=a();try{t.captureMessage("Generation captcha required but no widget mounted before deadline",{level:"warning",tags:{component:n?"generation_turnstile":"generation_hcaptcha",provider:n?"turnstile":"hcaptcha",reason:r,flow:d,interactive:"false",...f?{turnstile_user_id:f}:{},...h.effective_type?{network_effective_type:h.effective_type}:{},...h.visibility?{tab_visibility:h.visibility}:{},...void 0!==h.cross_origin_isolated?{cross_origin_isolated:h.cross_origin_isolated?"true":"false"}:{}},user:u?{id:u}:void 0,extra:{reason:r,flow:d,clerkId:c,is_paid:l,is_turnstile:n,interactive:!1,network_downlink:h.downlink,network_rtt:h.rtt,save_data:h.save_data,cf_resource_timings:p,cf_resource_count:p.length}})}catch{}n&&s({outcome:"no_token",reason:r,is_paid:l,flow:d,interactive:!1})},"reportCaptchaProviderFallback",0,t=>{let r=i();(async()=>{try{let{datadogRum:n}=await e.A(374300);n.addAction("captcha.provider_fallback.client",{recovered:t.recovered,relatched:t.relatched,is_paid:t.isPaid,flow:o(),...r})}catch{}})()},"reportCaptchaVerificationHang",0,e=>{let{isTurnstile:r,userId:o,clerkId:n}=e,s=o||n||void 0,l=i(),u=a();try{t.captureMessage(`Captcha verification not complete after 30 seconds. window.crossOriginIsolated is ${window.crossOriginIsolated}.`,{level:"warning",tags:{component:"generation_captcha_diagnostic",provider:r?"turnstile":"hcaptcha",reason:"verification_hang",...s?{turnstile_user_id:s}:{},...l.effective_type?{network_effective_type:l.effective_type}:{},...l.visibility?{tab_visibility:l.visibility}:{},...void 0!==l.cross_origin_isolated?{cross_origin_isolated:l.cross_origin_isolated?"true":"false"}:{}},user:o?{id:o}:void 0,extra:{network_downlink:l.downlink,network_rtt:l.rtt,save_data:l.save_data,cf_resource_timings:u,cf_resource_count:u.length}})}catch{}},"reportStemCaptchaRetry",0,t=>{(async()=>{try{let{datadogRum:r}=await e.A(374300);r.addAction("stem_extraction.captcha_retry",{recovered:t.recovered,is_paid:t.isPaid,flow:o()})}catch{}})()},"reportTurnstileFailure",0,(e,r)=>{let{reason:o,blocked:n,isPaid:l,userId:u,clerkId:c,flow:d,interactive:f,extra:h}=r,p="string"==typeof h?.errorCode?h.errorCode:void 0,m=u||c||void 0,g=i(),v=a();try{t.captureMessage(e,{level:"warning",tags:{component:"generation_turnstile",reason:o,flow:d,interactive:f?"true":"false",...m?{turnstile_user_id:m}:{},...p?{turnstile_error_code:p}:{},...g.effective_type?{network_effective_type:g.effective_type}:{},...g.visibility?{tab_visibility:g.visibility}:{},...void 0!==g.cross_origin_isolated?{cross_origin_isolated:g.cross_origin_isolated?"true":"false"}:{}},user:u?{id:u}:void 0,extra:{...h,reason:o,blocked:n,is_paid:l,flow:d,interactive:f,clerkId:c,network_downlink:g.downlink,network_rtt:g.rtt,save_data:g.save_data,cf_resource_timings:v,cf_resource_count:v.length}})}catch{}n&&s({outcome:"no_token",reason:o,is_paid:l,flow:d,interactive:f})}])},104886,e=>{"use strict";e.s(["default",0,e=>{let t=new AudioBuffer({sampleRate:e.sampleRate,length:e.length,numberOfChannels:e.numberOfChannels}),r=0;for(let t=0;t<e.numberOfChannels;t++){let o=e.getChannelData(t);for(let e=0;e<o.length;e++)r=Math.max(r,Math.abs(o[e]))}for(let o=0;o<e.numberOfChannels;o++){let n=e.getChannelData(o),i=t.getChannelData(o);for(let e=0;e<n.length;e++)i[e]=n[e]/r}return t}])},756834,e=>{"use strict";var t=e.i(613335),r=e.i(725516),o=e.i(379694);let n="suno_poe",i="suno_poe";function a(e){try{let t,r,o=e.split(".");if(3!==o.length)return null;
3return JSON.parse(((r=(t=o[1].replace(/-/g,"+").replace(/_/g,"/")).length%4)&&(t+="=".repeat(4-r)),atob(t)))}catch{return null}}let s=null,l=null;function u(e){s=e;let r=a(e),l=r?.exp,u=new Date(l?1e3*l:Date.now()+36e5);o.safeLocalStorage.setItem(i,e),t.default.set(n,e,{path:"/",expires:u,sameSite:"lax"})}function c(){s=null,l=null,o.safeLocalStorage.removeItem(i),t.default.remove(n,{path:"/"}),window.location.href=r.PageRoutes.LoggedInHome}e.s(["IMPERSONATION_TOKEN_LOCALSTORAGE",0,i,"clearImpersonationToken",0,c,"decodeJwtPayload",0,a,"getImpersonationState",0,function(){return l},"getImpersonationToken",0,function(){return s},"initializeImpersonationFromStorage",0,function(){let e=[o.safeLocalStorage.getItem(i),t.default.get(n)??null];for(let t of e){if(!t)continue;let e=a(t);if(!e)continue;let r=e.exp;if(!(r&&Date.now()/1e3>=r))return u(t),!0}return e.some(e=>null!=e)&&c(),!1},"isImpersonating",0,function(){return l?.isImpersonating??!1},"setImpersonationState",0,function(e){l=e},"storeImpersonationToken",0,u])},976250,e=>{"use strict";let t=new Map;e.s(["default",0,({ctx:e,channelData:r,topPadding:o=0,inverse:n=!1,normalize:i=!0,enableCache:a=!0,useLineVariant:s=!1,pxPerPoint:l,overReadSamples:u=256})=>{let c=e.canvas,d=(c.height-o)/2,f=void 0!==l?l:s?10:2,h=[],p=[],m=t.get(r)?.get(c.width);if(!m||!a){let e=1;if(i){let t=0;for(let e=0;e<r.length;e++)t=Math.max(t,Math.abs(r[e]));e=t?1/t:0}let o=[],n=[];for(let t=0;t<c.width;t+=f){let i=Math.floor(Math.max(0,t/(c.width-1)*r.length-u/2)),a=Math.floor(Math.min((t+f)/(c.width-1)*r.length+u/2,r.length-1)),s=-1/0,l=1/0;for(let e=i;e<=a;e++)s=Math.max(s,r[e]),l=Math.min(l,r[e]);o.push(s*e),n.push(l*e)}if(h=o,p=n,a){let e=t.get(r);e||(e=new Map),e.set(c.width,{tops:o,bottoms:n}),t.set(r,e)}}m&&(h=m.tops,p=m.bottoms),s||(n?(e.moveTo(0,0),e.lineTo(0,-(h[0]*d)+d+o)):e.moveTo(0,-(h[0]*d)+d+o)),s&&(e.strokeStyle="#666",e.lineWidth=3,e.lineCap="round");let g=0;for(let t=f;t<c.width;t+=f){let r=(h[t/f]+h[Math.max(0,(t-f)/f)]+h[Math.min(h.length-1,(t+f)/f)])/3;if(s){let n=(p[t/f]+p[Math.max(0,(t-f)/f)]+p[Math.min(p.length-1,(t+f)/f)])/3;e.moveTo(t,-(r*d)+d+o-1),e.lineTo(t,-(n*d)+d+o+1)}else e.lineTo(t,-(r*d)+d+o-1);g=t}if(s)e.stroke();else if(e.lineTo(c.width,d+o),n){e.lineTo(c.width,0),e.lineTo(0,0),e.moveTo(0,c.height),e.lineTo(0,-(p[0]*d)+d+o);for(let t=f;t<c.width;t++){let r=(p[t/f]+p[Math.max(0,(t-f)/f)]+p[Math.min(p.length-1,(t+f)/f)])/3;e.lineTo(t,-(r*d)+d+o+1),g=t}e.lineTo(c.width,d+o),e.lineTo(c.width,c.height),e.lineTo(0,c.height)}else{e.lineTo(c.width,d+o);for(let t=g;t>=0;t--){let r=(p[t/f]+p[Math.max(0,(t-f)/f)]+p[Math.min(p.length-1,(t+f)/f)])/3;e.lineTo(t,-(r*d)+d+o+1)}e.lineTo(0,h[0]*d+d+o)}}])},274869,e=>{"use strict";let t=(0,e.i(174883).create)(e=>({verdict:null,setVerdict:t=>e({verdict:t})}));e.s(["setDataSharingVerdict",0,function(e){t.getState().setVerdict(e)},"useDataSharingVerdict",0,t])},844911,e=>{"use strict";e.s(["isValidEmail",0,function(e){return/^[^\s@]+@[^\s.@]+(?:\.[^\s.@]+)+$/.test(e)}])}]);
4
5//# sourceMappingURL=3c00o4ur_acp9.js.map
6//# debugId=18990076-e7e7-52e7-9ebc-87de24377f3b

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.