1(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,828758,e=>{"use strict";let t=new Set(["open","focus","close","rename","bind"]);function r(e){return"string"==typeof e&&(e.startsWith("draft:")||e.startsWith("plan:"))}function n(e){return"string"==typeof e&&e.startsWith("draft:")}function i(e){if(!e||"object"!=typeof e||"string"!=typeof e.action||!t.has(e.action))return null;let i="string"==typeof e.doc_id&&e.doc_id?e.doc_id:"assets"===e.kind&&("open"===e.action||"focus"===e.action)?"assets":null;if(!i||r(i)&&(!n(i)||"bind"===e.action))return null;let o={action:e.action,doc_id:i};if("open"===e.action&&(n(i)||!0===e.draft)&&(o.draft=!0,"string"==typeof e.format&&e.format&&(o.format=e.format)),"bind"===e.action){let t="string"==typeof e.draft_id&&e.draft_id?e.draft_id:"string"==typeof e.draftId&&e.draftId?e.draftId:null;if(!t)return null;o.draft_id=t}return("preview"===e.kind||"timeline"===e.kind||"assets"===e.kind||"canvas"===e.kind||"draw"===e.kind||"stage3d"===e.kind)&&(o.kind=e.kind),"string"==typeof e.title&&(o.title=e.title),"boolean"==typeof e.focus&&(o.focus=e.focus),"string"==typeof e.roomName?o.roomName=e.roomName:"string"==typeof e.room_name&&(o.roomName=e.room_name),"string"==typeof e.projectId&&(o.projectId=e.projectId),"boolean"==typeof e.changed&&(o.changed=e.changed),o}let o="ponpon:workspace:document-command",a="ponpon:workspace:document-work-finished";async function s(e,t,r){let n="grid"===t.view?"assets":t.view,i=t.docId?r.find(e=>e.docId===t.docId&&e.kind===n):void 0;if(i&&("canvas"!==n||i.roomName))return i;if("canvas"===n&&t.docId===e)return{id:e,docId:e,kind:n,roomName:`project:${e}`};let o="canvas"===n?"canvases":"compositions",a=await fetch(`/api/projects/${encodeURIComponent(e)}/${o}`,{credentials:"same-origin"});if(!a.ok)throw Error("Could not load the document. Please try again.");let s=(await a.json())[o];if(!Array.isArray(s))return null;let u="preview"===n?"page":n,f=s.filter(e=>e&&"string"==typeof e.id&&("canvas"===n?"string"==typeof e.roomName:e.docKind===u)&&(!t.docId||e.id===t.docId));if(1!==f.length)return null;let d=f[0];return{id:d.id,docId:d.id,kind:n,..."canvas"===n?{roomName:d.roomName}:{}}}e.s(["DOCUMENT_COMMAND_EVENT",0,o,"DOCUMENT_WORK_FINISHED_EVENT",0,a,"TURN_SETTLE_EVENT",0,"ponpon:workspace:turn-settle","dispatchDocumentCommand",0,function(e){window.dispatchEvent(new CustomEvent(o,{detail:e}))},"dispatchDocumentWorkFinished",0,function(e){window.dispatchEvent(new CustomEvent(a,{detail:e}))},"isPlaceholderDocId",0,r,"pickDocumentCommands",0,function(e,t){if(Array.isArray(e))return e.map(e=>i(e)).filter(e=>null!==e);let r=i(t);return r?[r]:[]},"resolveWorkspaceCardTab",0,s])},467034,(e,t,r)=>{var n={675:function(e,t){"use strict";t.byteLength=function(e){var t=u(e),r=t[0],n=t[1];return(r+n)*3/4-n},t.toByteArray=function(e){var t,r,o=u(e),a=o[0],s=o[1],f=new i((a+s)*3/4-s),d=0,l=s>0?a-4:a;for(r=0;r<l;r+=4)t=n[e.charCodeAt(r)]<<18|n[e.charCodeAt(r+1)]<<12|n[e.charCodeAt(r+2)]<<6|n[e.charCodeAt(r+3)],f[d++]=t>>16&255,f[d++]=t>>8&255,f[d++]=255&t;return 2===s&&(t=n[e.charCodeAt(r)]<<2|n[e.charCodeAt(r+1)]>>4,f[d++]=255&t),1===s&&(t=n[e.charCodeAt(r)]<<10|n[e.charCodeAt(r+1)]<<4|n[e.charCodeAt(r+2)]>>2,f[d++]=t>>8&255,f[d++]=255&t),f},t.fromByteArray=function(e){for(var t,n=e.length,i=n%3,o=[],a=0,s=n-i;a<s;a+=16383)o.push(function(e,t,n){for(var i,o=[],a=t;a<n;a+=3)i=(e[a]<<16&0xff0000)+(e[a+1]<<8&65280)+(255&e[a+2]),o.push(r[i>>18&63]+r[i>>12&63]+r[i>>6&63]+r[63&i]);return o.join("")}(e,a,a+16383>s?s:a+16383));return 1===i?o.push(r[(t=e[n-1])>>2]+r[t<<4&63]+"=="):2===i&&o.push(r[(t=(e[n-2]<<8)+e[n-1])>>10]+r[t>>4&63]+r[t<<2&63]+"="),o.join("")};for(var r=[],n=[],i="u">typeof Uint8Array?Uint8Array:Array,o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",a=0,s=o.length;a<s;++a)r[a]=o[a],n[o.charCodeAt(a)]=a;function u(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 n=r===t?0:4-r%4;return[r,n]}n[45]=62,n[95]=63},72:function(e,t,r){"use strict";var n=r(675),i=r(783),o="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;function a(e){if(e>
vendor: 18,551 bytes, line 1
10x7fffffff)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 d(e)}return u(e,t,r)}function u(e,t,r){if("string"==typeof e){var n=e,i=t;if(("string"!=typeof i||""===i)&&(i="utf8"),!s.isEncoding(i))throw TypeError("Unknown encoding: "+i);var o=0|p(n,i),u=a(o),f=u.write(n,i);return f!==o&&(u=u.slice(0,f)),u}if(ArrayBuffer.isView(e))return l(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(M(e,ArrayBuffer)||e&&M(e.buffer,ArrayBuffer)||"u">typeof SharedArrayBuffer&&(M(e,SharedArrayBuffer)||e&&M(e.buffer,SharedArrayBuffer)))return function(e,t,r){var n;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(n=void 0===t&&void 0===r?new Uint8Array(e):void 0===r?new Uint8Array(e,t):new Uint8Array(e,t,r),s.prototype),n}(e,t,r);if("number"==typeof e)throw TypeError('The "value" argument must not be of type number. Received type number');var d=e.valueOf&&e.valueOf();if(null!=d&&d!==e)return s.from(d,t,r);var h=function(e){if(s.isBuffer(e)){var t=0|c(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):l(e):"Buffer"===e.type&&Array.isArray(e.data)?l(e.data):void 0}(e);if(h)return h;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 f(e){if("number"!=typeof e)throw TypeError('"size" argument must be of type number');if(e<0)throw RangeError('The value "'+e+'" is invalid for option "size"')}function d(e){return f(e),a(e<0?0:0|c(e))}function l(e){for(var t=e.length<0?0:0|c(e.length),r=a(t),n=0;n<t;n+=1)r[n]=255&e[n];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 u(e,t,r)},Object.setPrototypeOf(s.prototype,Uint8Array.prototype),Object.setPrototypeOf(s,Uint8Array),s.alloc=function(e,t,r){return(f(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 d(e)},s.allocUnsafeSlow=function(e){return d(e)};function c(e){if(e>=0x7fffffff)throw RangeError("Attempt to allocate Buffer larger than maximum size: 0x7fffffff bytes");return 0|e}function p(e,t){if(s.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||M(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,n=arguments.length>2&&!0===arguments[2];if(!n&&0===r)return 0;for(var i=!1;;)switch(t){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return T(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return x(e).length;default:if(i)return n?-1:T(e).length;t=(""+t).toLowerCase(),i=!0}}function h(e,t,r){var i,o,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 n=e.length;(!t||t<0)&&(t=0),(!r||r<0||r>n)&&(r=n);for(var i="",o=t;o<r;++o)i+=B[e[o]];return i}(this,t,r);case"utf8":case"utf-8":return v(this,t,r);case"ascii":return function(e,t,r){var n="";r=Math.min(e.length,r);for(var i=t;i<r;++i)n+=String.fromCharCode(127&e[i]);return n}(this,t,r);case"latin1":case"binary":return function(e,t,r){var n="";r=Math.min(e.length,r);for(var i=t;i<r;++i)n+=String.fromCharCode(e[i]);return n}(this,t,r);case"base64":return i=this,o=t,a=r,0===o&&a===i.length?n.fromByteArray(i):n.fromByteArray(i.slice(o,a));case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return function(e,t,r){for(var n=e.slice(t,r),i="",o=0;o<n.length;o+=2)i+=String.fromCharCode(n[o]+256*n[o+1]);return i}(this,t,r);default:if(s)throw TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),s=!0}}function g(e,t,r){var n=e[t];e[t]=e[r],e[r]=n}function m(e,t,r,n,i){var o;if(0===e.length)return -1;if("string"==typeof r?(n=r,r=0):r>0x7fffffff?r=0x7fffffff:r<-0x80000000&&(r=-0x80000000),(o=r*=1)!=o&&(r=i?0:e.length-1),r<0&&(r=e.length+r),r>=e.length)if(i)return -1;else r=e.length-1;else if(r<0)if(!i)return -1;else r=0;if("string"==typeof t&&(t=s.from(t,n)),s.isBuffer(t))return 0===t.length?-1:y(e,t,r,n,i);if("number"==typeof t){if(t&=255,"function"==typeof Uint8Array.prototype.indexOf)if(i)return Uint8Array.prototype.indexOf.call(e,t,r);else return Uint8Array.prototype.lastIndexOf.call(e,t,r);return y(e,[t],r,n,i)}throw TypeError("val must be string, number or Buffer")}function y(e,t,r,n,i){var o,a=1,s=e.length,u=t.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(e.length<2||t.length<2)return -1;a=2,s/=2,u/=2,r/=2}function f(e,t){return 1===a?e[t]:e.readUInt16BE(t*a)}if(i){var d=-1;for(o=r;o<s;o++)if(f(e,o)===f(t,-1===d?0:o-d)){if(-1===d&&(d=o),o-d+1===u)return d*a}else -1!==d&&(o-=o-d),d=-1}else for(r+u>s&&(r=s-u),o=r;o>=0;o--){for(var l=!0,c=0;c<u;c++)if(f(e,o+c)!==f(t,c)){l=!1;break}if(l)return o}return -1}s.isBuffer=function(e){return null!=e&&!0===e._isBuffer&&e!==s.prototype},s.compare=function(e,t){if(M(e,Uint8Array)&&(e=s.from(e,e.offset,e.byteLength)),M(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,n=t.length,i=0,o=Math.min(r,n);i<o;++i)if(e[i]!==t[i]){r=e[i],n=t[i];break}return r<n?-1:+(n<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,n=s.allocUnsafe(t),i=0;for(r=0;r<e.length;++r){var o=e[r];if(M(o,Uint8Array)&&(o=s.from(o)),!s.isBuffer(o))throw TypeError('"list" argument must be an Array of Buffers');o.copy(n,i),i+=o.length}return n},s.byteLength=p,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)g(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)g(this,t,t+3),g(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)g(this,t,t+7),g(this,t+1,t+6),g(this,t+2,t+5),g(this,t+3,t+4);return this},s.prototype.toString=function(){var e=this.length;return 0===e?"":0==arguments.length?v(this,0,e):h.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+">"},o&&(s.prototype[o]=s.prototype.inspect),s.prototype.compare=function(e,t,r,n,i){if(M(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===n&&(n=0),void 0===i&&(i=this.length),t<0||r>e.length||n<0||i>this.length)throw RangeError("out of range index");if(n>=i&&t>=r)return 0;if(n>=i)return -1;if(t>=r)return 1;if(t>>>=0,r>>>=0,n>>>=0,i>>>=0,this===e)return 0;for(var o=i-n,a=r-t,u=Math.min(o,a),f=this.slice(n,i),d=e.slice(t,r),l=0;l<u;++l)if(f[l]!==d[l]){o=f[l],a=d[l];break}return o<a?-1:+(a<o)},s.prototype.includes=function(e,t,r){return -1!==this.indexOf(e,t,r)},s.prototype.indexOf=function(e,t,r){return m(this,e,t,r,!0)},s.prototype.lastIndexOf=function(e,t,r){return m(this,e,t,r,!1)};function v(e,t,r){r=Math.min(e.length,r);for(var n=[],i=t;i<r;){var o,a,s,u,f=e[i],d=null,l=f>239?4:f>223?3:f>191?2:1;if(i+l<=r)switch(l){case 1:f<128&&(d=f);break;case 2:(192&(o=e[i+1]))==128&&(u=(31&f)<<6|63&o)>127&&(d=u);break;case 3:o=e[i+1],a=e[i+2],(192&o)==128&&(192&a)==128&&(u=(15&f)<<12|(63&o)<<6|63&a)>2047&&(u<55296||u>57343)&&(d=u);break;case 4:o=e[i+1],a=e[i+2],s=e[i+3],(192&o)==128&&(192&a)==128&&(192&s)==128&&(u=(15&f)<<18|(63&o)<<12|(63&a)<<6|63&s)>65535&&u<1114112&&(d=u)}null===d?(d=65533,l=1):d>65535&&(d-=65536,n.push(d>>>10&1023|55296),d=56320|1023&d),n.push(d),i+=l}var c=n,p=c.length;if(p<=4096)return String.fromCharCode.apply(String,c);for(var h="",g=0;g<p;)h+=String.fromCharCode.apply(String,c.slice(g,g+=4096));return h}function w(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 b(e,t,r,n,i,o){if(!s.isBuffer(e))throw TypeError('"buffer" argument must be a Buffer instance');if(t>i||t<o)throw RangeError('"value" argument is out of bounds');if(r+n>e.length)throw RangeError("Index out of range")}function I(e,t,r,n,i,o){if(r+n>e.length||r<0)throw RangeError("Index out of range")}function E(e,t,r,n,o){return t*=1,r>>>=0,o||I(e,t,r,4,34028234663852886e22,-34028234663852886e22),i.write(e,t,r,n,23,4),r+4}function A(e,t,r,n,o){return t*=1,r>>>=0,o||I(e,t,r,8,17976931348623157e292,-17976931348623157e292),i.write(e,t,r,n,52,8),r+8}s.prototype.write=function(e,t,r,n){if(void 0===t)n="utf8",r=this.length,t=0;else if(void 0===r&&"string"==typeof t)n=t,r=this.length,t=0;else if(isFinite(t))t>>>=0,isFinite(r)?(r>>>=0,void 0===n&&(n="utf8")):(n=r,r=void 0);else throw Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");var i,o,a,s,u,f,d,l,c=this.length-t;if((void 0===r||r>c)&&(r=c),e.length>0&&(r<0||t<0)||t>this.length)throw RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var p=!1;;)switch(n){case"hex":return function(e,t,r,n){r=Number(r)||0;var i=e.length-r;n?(n=Number(n))>i&&(n=i):n=i;var o=t.length;n>o/2&&(n=o/2);for(var a=0;a<n;++a){var s,u=parseInt(t.substr(2*a,2),16);if((s=u)!=s)break;e[r+a]=u}return a}(this,e,t,r);case"utf8":case"utf-8":return i=t,o=r,S(T(e,this.length-i),this,i,o);case"ascii":return a=t,s=r,S(k(e),this,a,s);case"latin1":case"binary":return function(e,t,r,n){return S(k(t),e,r,n)}(this,e,t,r);case"base64":return u=t,f=r,S(x(e),this,u,f);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return d=t,l=r,S(function(e,t){for(var r,n,i=[],o=0;o<e.length&&!((t-=2)<0);++o)n=(r=e.charCodeAt(o))>>8,i.push(r%256),i.push(n);return i}(e,this.length-d),this,d,l);default:if(p)throw TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),p=!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 n=this.subarray(e,t);return Object.setPrototypeOf(n,s.prototype),n},s.prototype.readUIntLE=function(e,t,r){e>>>=0,t>>>=0,r||w(e,t,this.length);for(var n=this[e],i=1,o=0;++o<t&&(i*=256);)n+=this[e+o]*i;return n},s.prototype.readUIntBE=function(e,t,r){e>>>=0,t>>>=0,r||w(e,t,this.length);for(var n=this[e+--t],i=1;t>0&&(i*=256);)n+=this[e+--t]*i;return n},s.prototype.readUInt8=function(e,t){return e>>>=0,t||w(e,1,this.length),this[e]},s.prototype.readUInt16LE=function(e,t){return e>>>=0,t||w(e,2,this.length),this[e]|this[e+1]<<8},s.prototype.readUInt16BE=function(e,t){return e>>>=0,t||w(e,2,this.length),this[e]<<8|this[e+1]},s.prototype.readUInt32LE=function(e,t){return e>>>=0,t||w(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||w(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||w(e,t,this.length);for(var n=this[e],i=1,o=0;++o<t&&(i*=256);)n+=this[e+o]*i;return n>=(i*=128)&&(n-=Math.pow(2,8*t)),n},s.prototype.readIntBE=function(e,t,r){e>>>=0,t>>>=0,r||w(e,t,this.length);for(var n=t,i=1,o=this[e+--n];n>0&&(i*=256);)o+=this[e+--n]*i;return o>=(i*=128)&&(o-=Math.pow(2,8*t)),o},s.prototype.readInt8=function(e,t){return(e>>>=0,t||w(e,1,this.length),128&this[e])?-((255-this[e]+1)*1):this[e]},s.prototype.readInt16LE=function(e,t){e>>>=0,t||w(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||w(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||w(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||w(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||w(e,4,this.length),i.read(this,e,!0,23,4)},s.prototype.readFloatBE=function(e,t){return e>>>=0,t||w(e,4,this.length),i.read(this,e,!1,23,4)},s.prototype.readDoubleLE=function(e,t){return e>>>=0,t||w(e,8,this.length),i.read(this,e,!0,52,8)},s.prototype.readDoubleBE=function(e,t){return e>>>=0,t||w(e,8,this.length),i.read(this,e,!1,52,8)},s.prototype.writeUIntLE=function(e,t,r,n){if(e*=1,t>>>=0,r>>>=0,!n){var i=Math.pow(2,8*r)-1;b(this,e,t,r,i,0)}var o=1,a=0;for(this[t]=255&e;++a<r&&(o*=256);)this[t+a]=e/o&255;return t+r},s.prototype.writeUIntBE=function(e,t,r,n){if(e*=1,t>>>=0,r>>>=0,!n){var i=Math.pow(2,8*r)-1;b(this,e,t,r,i,0)}var o=r-1,a=1;for(this[t+o]=255&e;--o>=0&&(a*=256);)this[t+o]=e/a&255;return t+r},s.prototype.writeUInt8=function(e,t,r){return e*=1,t>>>=0,r||b(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||b(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||b(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||b(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||b(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,n){if(e*=1,t>>>=0,!n){var i=Math.pow(2,8*r-1);b(this,e,t,r,i-1,-i)}var o=0,a=1,s=0;for(this[t]=255&e;++o<r&&(a*=256);)e<0&&0===s&&0!==this[t+o-1]&&(s=1),this[t+o]=(e/a|0)-s&255;return t+r},s.prototype.writeIntBE=function(e,t,r,n){if(e*=1,t>>>=0,!n){var i=Math.pow(2,8*r-1);b(this,e,t,r,i-1,-i)}var o=r-1,a=1,s=0;for(this[t+o]=255&e;--o>=0&&(a*=256);)e<0&&0===s&&0!==this[t+o+1]&&(s=1),this[t+o]=(e/a|0)-s&255;return t+r},s.prototype.writeInt8=function(e,t,r){return e*=1,t>>>=0,r||b(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||b(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||b(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||b(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||b(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 E(this,e,t,!0,r)},s.prototype.writeFloatBE=function(e,t,r){return E(this,e,t,!1,r)},s.prototype.writeDoubleLE=function(e,t,r){return A(this,e,t,!0,r)},s.prototype.writeDoubleBE=function(e,t,r){return A(this,e,t,!1,r)},s.prototype.copy=function(e,t,r,n){if(!s.isBuffer(e))throw TypeError("argument should be a Buffer");if(r||(r=0),n||0===n||(n=this.length),t>=e.length&&(t=e.length),t||(t=0),n>0&&n<r&&(n=r),n===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(n<0)throw RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),e.length-t<n-r&&(n=e.length-t+r);var i=n-r;if(this===e&&"function"==typeof Uint8Array.prototype.copyWithin)this.copyWithin(t,r,n);else if(this===e&&r<t&&t<n)for(var o=i-1;o>=0;--o)e[o+t]=this[o+r];else Uint8Array.prototype.set.call(e,this.subarray(r,n),t);return i},s.prototype.fill=function(e,t,r,n){if("string"==typeof e){if("string"==typeof t?(n=t,t=0,r=this.length):"string"==typeof r&&(n=r,r=this.length),void 0!==n&&"string"!=typeof n)throw TypeError("encoding must be a string");if("string"==typeof n&&!s.isEncoding(n))throw TypeError("Unknown encoding: "+n);if(1===e.length){var i,o=e.charCodeAt(0);("utf8"===n&&o<128||"latin1"===n)&&(e=o)}}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(i=t;i<r;++i)this[i]=e;else{var a=s.isBuffer(e)?e:s.from(e,n),u=a.length;
1if(0===u)throw TypeError('The value "'+e+'" is invalid for argument "value"');for(i=0;i<r-t;++i)this[i+t]=a[i%u]}return this};var _=/[^+/0-9A-Za-z-_]/g;function T(e,t){t=t||1/0;for(var r,n=e.length,i=null,o=[],a=0;a<n;++a){if((r=e.charCodeAt(a))>55295&&r<57344){if(!i){if(r>56319||a+1===n){(t-=3)>-1&&o.push(239,191,189);continue}i=r;continue}if(r<56320){(t-=3)>-1&&o.push(239,191,189),i=r;continue}r=(i-55296<<10|r-56320)+65536}else i&&(t-=3)>-1&&o.push(239,191,189);if(i=null,r<128){if((t-=1)<0)break;o.push(r)}else if(r<2048){if((t-=2)<0)break;o.push(r>>6|192,63&r|128)}else if(r<65536){if((t-=3)<0)break;o.push(r>>12|224,r>>6&63|128,63&r|128)}else if(r<1114112){if((t-=4)<0)break;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}else throw Error("Invalid code point")}return o}function k(e){for(var t=[],r=0;r<e.length;++r)t.push(255&e.charCodeAt(r));return t}function x(e){return n.toByteArray(function(e){if((e=(e=e.split("=")[0]).trim().replace(_,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function S(e,t,r,n){for(var i=0;i<n&&!(i+r>=t.length)&&!(i>=e.length);++i)t[i+r]=e[i];return i}function M(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}var B=function(){for(var e="0123456789abcdef",t=Array(256),r=0;r<16;++r)for(var n=16*r,i=0;i<16;++i)t[n+i]=e[r]+e[i];return t}()},783:function(e,t){t.read=function(e,t,r,n,i){var o,a,s=8*i-n-1,u=(1<<s)-1,f=u>>1,d=-7,l=r?i-1:0,c=r?-1:1,p=e[t+l];for(l+=c,o=p&(1<<-d)-1,p>>=-d,d+=s;d>0;o=256*o+e[t+l],l+=c,d-=8);for(a=o&(1<<-d)-1,o>>=-d,d+=n;d>0;a=256*a+e[t+l],l+=c,d-=8);if(0===o)o=1-f;else{if(o===u)return a?NaN:1/0*(p?-1:1);a+=Math.pow(2,n),o-=f}return(p?-1:1)*a*Math.pow(2,o-n)},t.write=function(e,t,r,n,i,o){var a,s,u,f=8*o-i-1,d=(1<<f)-1,l=d>>1,c=5960464477539062e-23*(23===i),p=n?0:o-1,h=n?1:-1,g=+(t<0||0===t&&1/t<0);for(isNaN(t=Math.abs(t))||t===1/0?(s=+!!isNaN(t),a=d):(a=Math.floor(Math.log(t)/Math.LN2),t*(u=Math.pow(2,-a))<1&&(a--,u*=2),a+l>=1?t+=c/u:t+=c*Math.pow(2,1-l),t*u>=2&&(a++,u/=2),a+l>=d?(s=0,a=d):a+l>=1?(s=(t*u-1)*Math.pow(2,i),a+=l):(s=t*Math.pow(2,l-1)*Math.pow(2,i),a=0));i>=8;e[r+p]=255&s,p+=h,s/=256,i-=8);for(a=a<<i|s,f+=i;f>0;e[r+p]=255&a,p+=h,a/=256,f-=8);e[r+p-h]|=128*g}}},i={};function o(e){var t=i[e];if(void 0!==t)return t.exports;var r=i[e]={exports:{}},a=!0;try{n[e](r,r.exports,o),a=!1}finally{a&&delete i[e]}return r.exports}o.ab="/ROOT/node_modules/next/dist/compiled/buffer/",t.exports=o(72)},263019,787506,e=>{"use strict";e.s(["DEFAULT_ASPECT_RATIO",0,"1:1","DEFAULT_IMAGE_MODEL",0,"nano-banana-2","DEFAULT_IMAGE_RESOLUTION",0,"2048","DEFAULT_VIDEO_DURATION",0,5,"DEFAULT_VIDEO_MODEL",0,"seedance-2.0","NODE_EXTEND_DX",0,400,"NODE_MIN_HEIGHT",0,160,"NODE_WIDTH",0,300],263019),e.s(["settledUploadMediaFields",0,function(e,t){let r={src:t};return/^https?:\/\//.test(t)&&(r[`out_${e}`]=t),r}],787506)},658383,216869,e=>{"use strict";function t(e){return e&&"object"==typeof e&&!Array.isArray(e)?e:null}function r(e){let r=t(e);return null!==r&&!0===r.carrier}function n(e){let n=t(e);if(!n)return!1;if(!0===n.carrier||r(n.in_landing))return!0;let i=t(n.director);return null!==i&&r(i.in_landing)}e.s(["isCarrierNode",0,function(e){return!!e&&n(e.data)},"isCarrierNodeData",0,n],216869);let i=new Set(["director","story_direction_preview","storyDirectionPreview","hyperframe_renderer","hyperframeRenderer","debug_hang","debugHang","video_editor","videoEditor","short_video_group","shortVideoGroup","node_group","nodeGroup"]);e.s(["HIDDEN_BACKEND_TYPES",0,i,"isHiddenCanvasNode",0,function(e){return!!e&&"object"==typeof e&&(!0===e.hidden||"string"==typeof e.type&&i.has(e.type)||n(e.data))}],658383)},177794,81878,e=>{"use strict";let t={imageGenerator:"image",characterDesigner:"image",locationDesigner:"image",objectDesigner:"image",storyboardDesigner:"image",image:"image",videoGenerator:"video",videoEditor:"video",video:"video",soundExpert:"audio",speechGenerator:"audio",audio:"audio",promptInput:"text",text:"text",scriptWriter:"text",screenplayWriter:"text",hyperframeRenderer:"video",webtoonPanelGenerator:"image",panelSource:"image",styleSelector:"image",directorStage:"image",model3dGenerator:"model3d",storyboardNoEnhanceDesigner:"image",generated_image:"image",generatedImage:"image",generated_video:"video",generatedVideo:"video",generated_audio:"audio",generatedAudio:"audio",generated_image_with_history:"image",generatedImageWithHistory:"image",generated_video_with_history:"video",generatedVideoWithHistory:"video",generated_audio_with_history:"audio",generatedAudioWith
1History:"audio",character_asset:"image",characterAsset:"image",location_asset:"image",locationAsset:"image",object_asset:"image",objectAsset:"image",image_generator:"image",character_designer:"image",location_designer:"image",object_designer:"image",storyboard_designer:"image",storyboard_no_enhance_designer:"image",video_generator:"video",video_editor:"video",sound_expert:"audio",speech_generator:"audio",prompt_input:"text",script_writer:"text",screenplay_writer:"text",hyperframe_renderer:"video",webtoon_panel_generator:"image",panel_source:"image",style_selector:"image",director_stage:"image",model3d_generator:"model3d"};e.s(["TYPE_TO_MODALITY",0,t,"modalityForDirectorType",0,function(e){return"string"!=typeof e?null:t[e]??null}],81878);let r=new Set(["image","video","audio"]),n=new Set(["directorStage","director_stage","model3dGenerator","model3d_generator"]);function i(e){return"string"==typeof e&&e.length>0?e:void 0}function o(e){let o=e.data,a=o.modality;if("string"==typeof a){if(r.has(a))return a;if("text"===a||"model3d"===a)return}for(let r of[o.directorType,e.type]){let e=i(r);if(!e)continue;if(n.has(e))return;let o=t[e];if("text"===o||"model3d"===o)return;if(o)return o}let s=o.director;for(let e of["video","image","audio"]){let t=`out_${e}`;if(i(o[t])||s&&i(s[t]))return e}}e.s(["nodeAssetUrl",0,function(e){let t=e.data,r=i(t.src);if(r)return r;let n=o(e);if(!n)return;let a=`out_${n}`,s=t.director;return i(t[a])??(s?i(s[a]):void 0)},"nodeMediaModality",0,o],177794)},196126,e=>{"use strict";let t="application/x-ponpon-file",r="application/x-ponpon-grid-tile";function n(e,t){return"number"==typeof e&&Number.isFinite(e)&&e>0&&"number"==typeof t&&Number.isFinite(t)&&t>0?{width:e,height:t}:void 0}function i(e){let t;if(!e)return null;try{t=JSON.parse(e)}catch{return null}if("object"!=typeof t||null===t)return null;let r=t,n="string"==typeof r.url&&r.url.length>0?r.url:null;if(!n)return null;let i="number"==typeof r.width&&Number.isFinite(r.width)?r.width:void 0,o="number"==typeof r.height&&Number.isFinite(r.height)?r.height:void 0,a="number"==typeof r.durationMs&&Number.isFinite(r.durationMs)&&r.durationMs>0?r.durationMs:void 0;return{url:n,mime:"string"==typeof r.mime?r.mime:"",kind:"string"==typeof r.kind?r.kind:"",filename:"string"==typeof r.filename?r.filename:"",...void 0!==i?{width:i}:{},...void 0!==o?{height:o}:{},...void 0!==a?{durationMs:a}:{},..."string"==typeof r.fileId&&r.fileId?{fileId:r.fileId}:{}}}function o(e){return e.startsWith("image/")?"image":e.startsWith("video/")?"video":e.startsWith("audio/")?"audio":null}function a(e){return"image"===e.kind||"video"===e.kind||"audio"===e.kind?e.kind:o(e.mime)}e.s(["FILE_DRAG_MIME",0,t,"dragHasFilePayload",0,function(e){if(!e)return!1;let r=e.types;return r.includes(t)||r.includes("Files")},"dragIsGridTile",0,function(e){if(!e)return!1;for(let t of Array.from(e))if(t===r)return!0;return!1},"fileModality",0,a,"imageDragDimensions",0,function(e,t){return n(e.width,e.height)??(t?.src===e.url?n(t.naturalWidth,t.naturalHeight):void 0)},"isImagePayload",0,function(e){return"image"===a(e)},"makePonponFilePayload",0,function(e){let t=e.mime??"";return{url:e.url,mime:t,kind:e.kind??o(t)??"",filename:e.filename??"",..."number"==typeof e.width?{width:e.width}:{},..."number"==typeof e.height?{height:e.height}:{},..."number"==typeof e.durationMs&&Number.isFinite(e.durationMs)?{durationMs:e.durationMs}:{},...e.fileId?{fileId:e.fileId}:{}}},"markGridTileDrag",0,function(e){e.setData(r,"")},"mediaDimensions",0,n,"parsePonponFilePayload",0,i,"readPonponFilePayload",0,function(e){return e?i(e.getData(t)):null}])},95078,766252,905279,e=>{"use strict";var t=e.i(271645),r=e.i(396241),n=e.i(470029);let i=[],o=new Map,a=new Set;window.addEventListener(r.PERSIST_GATE_EVENT,()=>{o.clear(),a.forEach(e=>{e()})}),window.addEventListener("storage",e=>{e.key?.startsWith("ponpon.model3d.assets.v1.")&&(o.clear(),a.forEach(e=>{e()}))});let s=e=>`ponpon.model3d.assets.v1.${e}`;function u(e){if(!e)return i;let t=o.get(e);if(t)return t;let a=[];try{let t=JSON.parse(r.gatedLocalStorage.getItem(s(e))??"[]");Array.isArray(t)&&(a=t.filter(t=>(0,n.validModel3dAsset)(t)&&t.projectId===e))}catch{}return o.set(e,a),a}e.s(["removeModel3dAsset",0,function(e,t){let n=u(e),i=n.filter(e=>e.id!==t);i.length!==n.length&&(o.set(e,i),r.gatedLocalStorage.setItem(s(e),JSON.stringify(i)),a.forEach(e
1=>{e()}))},"useModel3dAssets",0,function(e){return(0,t.useSyncExternalStore)(e=>(a.add(e),()=>a.delete(e)),()=>u(e),()=>i)}],95078),e.s(["modelAssetFromFile",0,function(e,t){let r=e.provenance?.model3d;return(0,n.validModel3dAsset)(r)&&r.projectId===t?{...r,id:e.id,url:e.url,projectId:t}:{id:e.id,projectId:t,name:e.filename,url:e.url,createdAt:e.createdAt,source:"generated"===e.source?"generated":"uploaded",model:e.model,thumbnailUrl:"string"==typeof e.provenance?.thumbnailUrl?e.provenance.thumbnailUrl:void 0}},"modelFileFromAsset",0,function(e){return{id:e.id,kind:"model3d",source:e.source,url:e.url,filename:e.name,mime:"model/gltf-binary",createdAt:e.createdAt,model:e.model,provenance:{model3d:e}}}],766252);let f=/^capture_(image|video)_\d+_[0-9a-f]+$/;e.s(["isStage3dCaptureNode",0,function(e){return e.data?.captureSource==="stage3d"||"string"==typeof e.id&&f.test(e.id)}],905279)},747634,326221,e=>{"use strict";function t(e){let t={kind:e.kind};return"canvas"===e.kind?(t.docId=e.docId,t.nodeId=e.nodeId):(!0===e.carrier&&(t.carrier=!0),"page"===e.kind)?(t.docId=e.docId,void 0!==e.frameId&&(t.frameId=e.frameId),void 0!==e.slot&&(t.slot=e.slot)):"timeline"===e.kind&&(t.docId=e.docId,void 0!==e.trackId&&(t.trackId=e.trackId),void 0!==e.clipId&&(t.clipId=e.clipId),void 0!==e.at&&(t.at=e.at)),t}function r(e){if(!e||0===e.length)return[];let t=[],r=new Set;for(let n of e)if(n&&"string"==typeof n.url&&n.url&&!r.has(n.url)&&(r.add(n.url),t.push({...n.fileId?{fileId:n.fileId}:{},...n.nodeId?{nodeId:n.nodeId}:{},url:n.url}),t.length>=32))break;return t}function n(e,t){return{kind:"canvas",docId:e,nodeId:t}}function i(e){let t=e.director??void 0;return e.in_landing??t?.in_landing??e.__landing??t?.__landing??void 0}function o(e,...t){for(let r of t){let t=e[r];if("string"==typeof t&&t)return t}}function a(e,t){if(!e||"object"!=typeof e||Array.isArray(e))return null;let r=e.kind,i=!0===e.carrier?{carrier:!0}:void 0;if("none"===r)return{kind:"none",...i};let a=o(e,"docId","doc_id");if("canvas"===r){let r=o(e,"nodeId","node_id")??t;return a&&r?n(a,r):null}if("page"===r){if(!a)return null;let t=o(e,"frameId","frame_id"),r=o(e,"slot");return{kind:"page",docId:a,...t?{frameId:t}:{},...r?{slot:r}:{},...i}}if("timeline"===r){if(!a)return null;let t=o(e,"trackId","track_id"),r=o(e,"clipId","clip_id"),n=function(e){let t=e.at;if("end"===t||"playhead"===t||"number"==typeof t&&Number.isFinite(t)&&!Number.isNaN(t))return t}(e);return{kind:"timeline",docId:a,...t?{trackId:t}:{},...r?{clipId:r}:{},...void 0!==n?{at:n}:{},...i}}return null}function s(e){return"string"==typeof e.directorType&&e.directorType.length>0||"string"==typeof e.originSessionId&&e.originSessionId.length>0}function u(e,t){if(!t)return!1;let r=e.manualRunId;return"string"==typeof r&&r.length>0&&r===t}e.s(["buildFileTrackBody",0,function(e){var n;let i=r(e.inputs);return{projectId:e.projectId,requestId:e.requestId,idempotencyKey:(n={projectId:e.projectId,requestId:e.requestId,kind:e.kind},`${n.projectId}:${n.requestId}:${n.kind}`),landing:t(e.landing),...i.length>0?{inputs:i}:{},requestedBy:e.requestedBy??"user",...e.payload}},"canvasLanding",0,n,"landingToWire",0,t,"newGenerationRequestId",0,function(){return`req_${crypto.randomUUID()}`},"normalizeGenerationInputs",0,r],326221),e.s(["didUserPressGenerate",0,u,"isAgentAuthoredNode",0,s,"manualCanvasDispatchFields",0,function(e,r){let i=e&&r?n(e,r):null;return{...i?{landing:t(i)}:{},requestedBy:"user"}},"parseDeclaredLanding",0,a,"readDeclaredRaw",0,i,"resolveNodeTrackLanding",0,function(e){let t=u(e.data,e.runToken),r=a(i(e.data),e.nodeId),o=t?"user":r||s(e.data)?"agent":"user";if(r)return{landing:r,requestedBy:o,source:"declared"};if(!t&&s(e.data))return{landing:null,requestedBy:o,source:"undeclared-agent"};let f=e.projectId;return f?{landing:n(f,e.nodeId),requestedBy:o,source:"canvas-node"}:{landing:null,requestedBy:o,source:"undeclared-agent"}}],747634)},662304,784975,e=>{"use strict";var t=e.i(95078),r=e.i(766252),n=e.i(271645),i=e.i(179137),o=e.i(905279),a=e.i(747634);let s="ponpon:project:asset-activity",u=new Map,f=new Set,d=e=>JSON.stringify([e.projectId,e.activityId]),l=e=>`task:${e}`;function c(e,t,r){if(!(t.projectId!==e||!t.activityId||f.has(d(t)))){let n=d({projectId:e,activityId:t.activityId});if(u.delete(n),f.add(n),f.size>4096){let e=f.values().next().value;void 0!==e&&f.delete(e)}r(t)}}function p(e){if(!e.projectId.trim()||!e.activityId.trim())return;let t={...e,focus:!1},r=d(t);if(!f.has(r)){if(u.set(r,t),u.size>1024){let e=u.keys().next().value;void 0!==e&&u.delete(e)}window.dispatchEvent(new CustomEvent(s,{detail:t}))}}function h(e){let t=e.data.modality??e.type;if("image"!==t&&"video"!==t&&"audio"!==t&&"model3d"!==t)return null;let r=e.data,n=!0===r.uploading||!0===r.generating||"pending"===r.directorStatus||"running"===r.directorStatus,i=("model3d"===t?[r.out_model]:[r.src,r[`out_${t}`]]).some(e=>"string"==typeof e&&/^(https?:|blob:|data:)/.test(e)),o=r.blitzTaskId??r.in_blitz_task_id,s=String(r.__topStatusAt??r.__statusAt??o??""),u=!0===r.uploading?"upload":n?"generation":"import";return{kind:t,busy:n,available:i,run:s,source:u,agentInitiated:(0,a.isAgentAuthoredNode)(e.data)&&!(0,a.didUserPressGenerate)(e.data,"string"==typeof r.generationRunId?r.generationRunId:void 0),taskId:"string"==typeof o&&o?o:void 0}}e.s(["dispatchProjectAssetActivity",0,p,"observeProjectAssetActivity",0,function(e,t,r){var n;let i,o,a,f=(n=e.getState(),i=new Map,o=n.hydrated,(a=e=>{for(let t of e.nodes){let e=h(t);e&&i.set(t.id,{announced:e.busy||e.available,busy:e.busy,run:e.run,serial:0})}})(n),e=>{if(!o||!e.hydrated)return a(e),o=e.hydrated,[];let r=[];for(let n of e.nodes){let e=h(n);if(!e)continue;let o=i.get(n.id),a=!o?.announced&&(e.busy||e.available),s=o?.announced&&e.busy&&!o.busy,u=(o?.serial??0)+ +!!s;(a||s)&&r.push({projectId:t,activityId:a?e.taskId&&"upload"!==e.source?l(e.taskId):`node:${n.id}:initial`:`node:${n.id}:run:${e.run||u}`,kind:e.kind,phase:e.busy?"started":"available",source:e.source,focus:!1,...e.agentInitiated?{requestedBy:"agent"}:{}}),i.set(n.id,{announced:o?.announced===!0||e.busy||e.available,busy:e.busy,run:e.run,serial:u})}return r}),d=e.subscribe((e,n)=>{if(e.nodes!==n.nodes||e.hydrated!==n.hydrated)for(let n of f(e))c(t,n,r)}),p=function(e,t,r=()=>!0){let n=n=>{r(n)&&c(e,n,t)},i=e=>{let t=e.detail;t&&!1===t.focus&&n(t)};for(let e of(window.addEventListener(s,i),[...u.values()]))n(e);return()=>{window.removeEventListener(s,i)}}(t,r);return()=>{d(),p()}}],784975);var g=e.i(828758),m=e.i(196126),y=e.i(22278),v=e.i(177794),w=e.i(156024);let b=m.FILE_DRAG_MIME,I={glb:"model/gltf-binary",png:"image/png",jpg:"image/jpeg",jpeg:"image/jpeg",webp:"image/webp",gif:"image/gif",svg:"image/svg+xml",mp4:"video/mp4",webm:"video/webm",mov:"video/quicktime",mp3:"audio/mpeg",wav:"audio/wav",m4a:"audio/mp4",ogg:"audio/ogg",pdf:"application/pdf",docx:"application/vnd.openxmlformats-officedocument.wordprocessingml.document",xlsx:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",pptx:"application/vnd.openxmlformats-officedocument.presentationml.presentation",txt:"text/plain",md:"text/markdown",markdown:"text/markdown",csv:"text/csv",tsv:"text/tab-separated-values",json:"application/json",rtf:"application/rtf"};function E(e){let t=e.split(/[?#]/)[0].match(/\.([a-z0-9]+)$/i);return t?t[1].toLowerCase():""}function A(e){return I[E(e)]??"application/octet-stream"}function _(e){return/(pdf|docx|xlsx|pptx|txt|md|markdown|csv|tsv|json|log|rtf)$/i.test(E(e))}function T(e){return(0,o.isStage3dCaptureNode)(e)?"exported":(0,y.isUploadedAsset)(e.data)?"uploaded":"generated"}function k(e){return(0,y.assetGenerationModelId)(e.data,e.id)}function x(e,t,r){return"model/gltf-binary"===r||"glb"===E(t)?"model3d":"image"===e||"video"===e||"audio"===e||"doc"===e||"model3d"===e?e:r.startsWith("image/")?"image":r.startsWith("video/")?"video":r.startsWith("audio/")?"audio":(_(t),"doc")}function S(e){var t;
1let r=e.url??"",n=e.filename??e.name??(r?r.split("/").pop()??"file":"file"),i=e.mime??A(n||r),o=x(e.kind,r,i);if(!r)return null;let a="number"==typeof e.createdAt?e.createdAt:"string"==typeof e.createdAt&&Date.parse(e.createdAt)||Date.now();return{id:e.id??r??n,kind:o,source:"generated"===(t=e.source)||"uploaded"===t||"exported"===t?t:"uploaded",url:r,filename:n,mime:i,sizeBytes:e.sizeBytes??e.size,width:e.width,height:e.height,durationMs:e.durationMs,pages:e.pages,model:e.model,...e.provenance?{provenance:e.provenance}:{},...e.effectTaskId?{provenance:{...e.provenance??{},effectTaskId:e.effectTaskId,...void 0!==e.outputIndex?{outputIndex:e.outputIndex}:{}}}:{},createdAt:a}}let M={files:[],hasMore:!1};async function B(e,t={}){let r=Math.min(500,Math.max(1,Math.floor(t.limit??100))),n=Math.max(0,Math.floor(t.offset??0));try{let i=new URLSearchParams({limit:String(r),offset:String(n)});t.folderId&&i.set("folderId",t.folderId),t.landing&&i.set("landing",t.landing),t.source&&i.set("source",t.source);let o=await fetch(`/api/projects/${encodeURIComponent(e)}/files?${i}`,{credentials:"same-origin",signal:t.signal});if(!o.ok)return M;let a=await o.json().catch(()=>null),s=(Array.isArray(a?.files)?a.files:[]).map(S).filter(e=>null!==e),u=a?.pagination??null;return{files:s,hasMore:u?.hasMore===!0,total:"number"==typeof u?.total?u.total:void 0,ok:!0}}catch{return M}}let L="ponpon:flow:files-local-add",U="ponpon:flow:files-local-remove",N="ponpon:file-created";function C(e,t,r){let n="string"==typeof e?e:null,i="string"==typeof e?t??[]:e;if(0!==i.length&&(window.dispatchEvent(new CustomEvent(N,{detail:{...n?{projectId:n}:{},files:[...i]}})),n))for(let e of i)"uploaded"===e.source&&p({projectId:n,activityId:r??`file:${e.id}`,kind:e.kind,phase:"available",source:"upload"})}function j(e){if(!e||"string"!=typeof e.url||!e.url)return null;let t=e.mime??A(e.filename??e.url);return{id:e.id??e.url,kind:e.kind??x(void 0,e.url,t),source:e.source??"exported",url:e.url,filename:e.filename??e.url.split("/").pop()??"file",mime:t,sizeBytes:e.sizeBytes,width:e.width,height:e.height,durationMs:e.durationMs,pages:e.pages,model:e.model,createdAt:e.createdAt??Date.now()}}function D(e){if(!e||"object"!=typeof e)return[];if(Array.isArray(e.files))return e.files.map(e=>j(e)).filter(e=>null!==e);let t=j(e);return t?[t]:[]}function F(e,t,r,n={}){let i=!1!==n.canvasDerivedFallback,o=new Map;for(let e of r)e.url&&!o.has(e.url)&&o.set(e.url,e.nodeId??e.id);let a=[...e.map(e=>{let t,r;if(e.nodeId)return e;let n=(t=e.provenance?.landedOn,("string"==typeof(r=t?.nodeId)&&r?r:void 0)??(e.url?o.get(e.url):void 0));return n?{...e,nodeId:n}:e}),...t,...i?r:r.filter(e=>"generated"!==e.source)],s=new Set,u=new Set,f=[];for(let e of a){if(e.url){if(s.has(e.url))continue;s.add(e.url)}else{if(u.has(e.id))continue;u.add(e.id)}f.push(e)}return f.sort((e,t)=>t.createdAt-e.createdAt)}let O=new Set,R={};function P(e,t){return JSON.stringify([e,t.folderId??"",t.landing??""])}let $={files:[],hasMore:!1,loading:!1,loadingMore:!1,answered:!1},z=new Map;function W(e,t=R){let r=P(e,t),n=z.get(r);return n||(n={projectId:e,scope:t,revision:0,snapshot:$,listeners:new Set,loadedCount:0,probed:!1,probe:null,nextInFlight:!1,onFileCreated:null,onTurnSettled:null,refreshTimer:null},z.set(r,n)),n}function G(e,t){for(let r of(e.snapshot={...e.snapshot,...t},e.listeners))r()}function q(e,t=R){let r=W(e,t);r.revision++,r.probed=!0,r.probe?.abort();let n=new AbortController;r.probe=n,G(r,{loading:!0});let i=Math.max(100,r.loadedCount);B(e,{...t,limit:i,offset:0,signal:n.signal}).then(e=>{!n.signal.aborted&&e.ok&&(r.loadedCount=e.files.length,G(r,{files:e.files,hasMore:e.hasMore,...!0===e.ok?{answered:!0}:{}}))}).catch(e=>{n.signal.aborted||console.warn("[files] project inventory refresh failed",e)}).finally(()=>{r.probe===n&&(r.probe=null),n.signal.aborted||G(r,{loading:!1})})}function V(e){e.refreshTimer||(e.refreshTimer=setTimeout(()=>{e.refreshTimer=null,e.listeners.size>0&&q(e.projectId,e.scope)},50))}function H(e,t){let r=(0,n.useCallback)(r=>e?function(e,t,r){let n=P(e,t),i=W(e,t);if(i.listeners.add(r),!i.onFileCreated){let t=()=>V(i);i.onFileCreated=t,window.addEventListener(N,t);let r=t=>{t.detail?.projectId===e&&V(i)};i.onTurnSettled=r,window.addEventListener(g.TURN_SETTLE_EVENT,r)}return i.probed||q(e,t),()=>{i.listeners.delete(r),i.listeners.size>0||setTimeout(()=>{i.listeners.size>0||(i.refreshTimer&&clearTimeout(i.refreshTimer),i.refreshTimer=null,i.probe?.abort(),i.probe=null,i.onFileCreated&&(window.removeEventListener(N,i.onFileCreated),i.onFileCreated=null),i.onTurnSettled&&(window.removeEventListener(g.TURN_SETTLE_EVENT,i.onTurnSettled),i.onTurnSettled=null),z.get(n)===i&&z.delete(n))},0)}}(e,t,r):()=>{},[e,t]),i=(0,n.useCallback)(()=>
1e?z.get(P(e,t))?.snapshot??$:$,[e,t]),o=(0,n.useSyncExternalStore)(r,i,()=>$),a=(0,n.useCallback)(()=>{e&&function(e,t){let r=W(e,t);if(r.nextInFlight||r.probe)return;let n=r.revision;r.nextInFlight=!0,G(r,{loadingMore:!0}),B(e,{...t,limit:100,offset:r.loadedCount}).then(e=>{if(n!==r.revision||!e.ok)return;let t=r.snapshot.files,i=new Set(t.map(e=>e.url||e.id)),o=e.files.filter(e=>!i.has(e.url||e.id)),a=o.length>0?[...t,...o]:t;r.loadedCount=a.length,G(r,{files:a,hasMore:e.hasMore&&e.files.length>0})}).finally(()=>{r.nextInFlight=!1,G(r,{loadingMore:!1})})}(e,t)},[e,t]);return{...o,loadMore:a}}let Y=[],J={projectId:null,files:Y};e.s(["FILE_CREATED_EVENT",0,N,"addLocalProjectFile",0,function(e,t=null,r){t&&C(t,[e],r),window.dispatchEvent(new CustomEvent(L,{detail:e}))},"assetNodeModel",0,k,"assetNodeSource",0,T,"claimUploadRegistration",0,function(e,t){if(!e||!t)return!1;let r=`${e}|${t}`;if(O.has(r))return!1;if(O.add(r),O.size>4096){let e=O.values().next().value;void 0!==e&&O.delete(e)}return!0},"dispatchProjectFilesCreated",0,C,"fetchBlitzProjectFilesPage",0,B,"fileExt",0,E,"fileIdsByUrl",0,function(e){let t=new Map;for(let r of e)r.url&&!t.has(r.url)&&t.set(r.url,r.id);return t},"fileTileRows",0,function(e,t,r){return e.filter(e=>!("doc"===e.kind||!e.url||r.has(e.url)||e.nodeId&&t.has(e.nodeId)))},"formatBytes",0,function(e){if("number"!=typeof e||!Number.isFinite(e)||e<=0)return;let t=["B","KB","MB","GB"],r=e,n=0;for(;r>=1024&&n<t.length-1;)r/=1024,n+=1;return`${r>=10||0===n?Math.round(r):r.toFixed(1)} ${t[n]}`},"isDocExt",0,_,"isPdfDoc",0,function(e){return!!e.url&&("application/pdf"===e.mime.split(";")[0].trim().toLowerCase()||"pdf"===E(e.filename||e.url))},"isUploadingFile",0,function(e){return e.provenance?.uploading===!0},"mergeProjectFiles",0,F,"mimeFromName",0,A,"refreshProjectFiles",0,function(e){for(let t of z.values())t.projectId===e&&t.listeners.size>0&&!t.probe&&q(e,t.scope)},"releaseUploadRegistration",0,function(e,t){O.delete(`${e}|${t}`)},"removeLocalProjectFile",0,function(e){e&&window.dispatchEvent(new CustomEvent(U,{detail:{id:e}}))},"setFileDragData",0,function(e,t){e.dataTransfer.setData(b,JSON.stringify((0,m.makePonponFilePayload)(t)))},"taskIdsWithFiles",0,function(e){let t=new Set;for(let r of e){let e=function(e){let t=e.provenance;for(let e of[t?.effectTaskId,t?.taskId])if("string"==typeof e&&e)return e}(r);e&&t.add(e)}return t},"useProjectFeedMedia",0,function(e){let{files:t}=H(e,R),[r,i]=(0,n.useState)(J);(0,n.useEffect)(()=>{if(!e)return;let t=t=>{let r=D(t.detail);0!==r.length&&i(t=>{let n=t.projectId===e?t.files:Y,i=new Set(n.map(e=>e.url).filter(Boolean)),o=r.filter(e=>e.url&&!i.has(e.url));return 0===o.length&&t.projectId===e?t:{projectId:e,files:[...o,...n]}})};return window.addEventListener(N,t),window.addEventListener(L,t),()=>{window.removeEventListener(N,t),window.removeEventListener(L,t)}},[e]);let o=r.projectId===e?r.files:Y;return(0,n.useMemo)(()=>{let e=F(t,o,Y).filter(e=>"image"===e.kind||"video"===e.kind);return e.length>0?e:Y},[t,o])},"useProjectFiles",0,function(e,o,a=R){let s=(0,n.useMemo)(()=>({folderId:a.folderId,landing:a.landing}),[a.folderId,a.landing]),u=!!(s.folderId||s.landing),f=(0,t.useModel3dAssets)(o),d=(0,n.useMemo)(()=>f.map(r.modelFileFromAsset),[f]),[l,c]=(0,n.useState)([]),{files:p,hasMore:h,loading:g,loadingMore:m,loadMore:y,answered:b}=H(o,s);(0,n.useEffect)(()=>{let e=e=>{let t=e.detail;t&&"string"==typeof t.id&&c(e=>e.some(e=>e.url&&e.url===t.url)?e:[t,...e])},t=e=>{let t=e.detail?.id;"string"==typeof t&&t&&c(e=>e.some(e=>e.id===t)?e.filter(e=>e.id!==t):e)};return window.addEventListener(L,e),window.addEventListener(U,t),()=>{window.removeEventListener(L,e),window.removeEventListener(U,t)}},[]),(0,n.useEffect)(()=>{let e=e=>{let t=D(e.detail);
10!==t.length&&c(e=>{let r=new Set(e.map(e=>e.url).filter(Boolean)),n=t.filter(e=>e.url&&!r.has(e.url));return n.length>0?[...n,...e]:e})};return window.addEventListener(N,e),()=>window.removeEventListener(N,e)},[]);let I=(0,n.useMemo)(()=>{let t=(0,i.fillStartTimes)(e.map(i.explicitStartTime));return e.map((e,r)=>(function(e,t){let r=e.data,n=(0,v.nodeMediaModality)(e);if(!n)return null;let o=("image"===n?(0,w.displayImageSrc)(r):void 0)??(0,v.nodeAssetUrl)(e);if(!o)return null;let a="string"==typeof r.in_file_name&&r.in_file_name||r.label||`${n}`,s="number"==typeof r.mediaDuration&&Number.isFinite(r.mediaDuration)?Math.round(1e3*r.mediaDuration):void 0;return{id:e.id,kind:n,source:T(e),url:o,filename:a,mime:"application/octet-stream"!==A(a)?A(a):`${n}/*`,width:"number"==typeof r.width?r.width:void 0,height:"number"==typeof r.height?r.height:void 0,durationMs:s,model:k(e),nodeId:e.id,provenance:{nodeId:e.id},createdAt:t??(0,i.nodeStartTimeOrZero)(e)}})(e,t[r])).filter(e=>null!==e)},[e]),E=(0,n.useMemo)(()=>u?p:F(p,[...d,...l],I),[I,l,p,d,u]),_=(0,n.useMemo)(()=>E.filter(e=>"doc"===e.kind),[E]),x=(0,n.useMemo)(()=>E.filter(e=>"doc"!==e.kind),[E]);return{files:E,docs:_,media:x,loading:g,answered:b,hasMore:h,loadingMore:m,loadMore:y}},"useProjectHasFiles",0,function(e){let{files:t}=H(e,R),[r,i]=(0,n.useState)(null);return(0,n.useEffect)(()=>{if(!e)return;let t=()=>i(e);return window.addEventListener(N,t),window.addEventListener(L,t),()=>{window.removeEventListener(N,t),window.removeEventListener(L,t)}},[e]),t.length>0||null!==e&&r===e},"useSettledAssetNodes",0,function(e,t){let r=(0,n.useRef)(e);return t&&(r.current=e),t?e:r.current}],662304)}]);
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.