conformtools 0.6.12 → 0.6.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (66) hide show
  1. package/README.md +13 -0
  2. package/dist/{account-IUWNSDG5.js → account-F54SG45Q.js} +1 -1
  3. package/dist/agent-hook-setup-RTQT5JEN.js +3 -0
  4. package/dist/{analysis-engine-M7W32RRC.js → analysis-engine-UWIK7AYB.js} +1 -1
  5. package/dist/{bridge-6NCHJWE6.js → bridge-PWYOJ7E7.js} +1 -1
  6. package/dist/{chunk-UUXHJNQA.js → chunk-4BTTR6U3.js} +1 -1
  7. package/dist/{chunk-NXJZXXC2.js → chunk-4VFDGL4E.js} +1 -1
  8. package/dist/{chunk-THVX57I3.js → chunk-6WLSIH2N.js} +1 -1
  9. package/dist/{chunk-P3XI63Q2.js → chunk-7W5AFZYX.js} +1 -1
  10. package/dist/chunk-B54TEGMG.js +5 -0
  11. package/dist/chunk-BTS3DFPD.js +7 -0
  12. package/dist/chunk-BYMCZJBQ.js +3 -0
  13. package/dist/{chunk-64X5DLH5.js → chunk-EP4L2BWV.js} +1 -1
  14. package/dist/chunk-ERUN634Q.js +6 -0
  15. package/dist/{chunk-OMPYIH6F.js → chunk-G3HBKJ5L.js} +1 -1
  16. package/dist/{chunk-B77ADB26.js → chunk-H4BU5WA6.js} +1 -1
  17. package/dist/{chunk-SJ56EEFP.js → chunk-I2Y2P5NH.js} +2 -2
  18. package/dist/{chunk-2CY2OOOJ.js → chunk-J43UCJ6G.js} +1 -1
  19. package/dist/chunk-L3HRAIDR.js +8 -0
  20. package/dist/{chunk-LYM757KG.js → chunk-LKQTE6T5.js} +66 -66
  21. package/dist/{chunk-QTA36RVO.js → chunk-LRGA6QJQ.js} +232 -220
  22. package/dist/{chunk-F4PHKOAS.js → chunk-LZRCXSUJ.js} +1 -1
  23. package/dist/chunk-NZLL44HU.js +3 -0
  24. package/dist/chunk-OD445COC.js +7 -0
  25. package/dist/chunk-XI6XF7FQ.js +3 -0
  26. package/dist/{chunk-DFQWQ3EA.js → chunk-Y455Y6V4.js} +1 -1
  27. package/dist/{claude-setup-REU4AOKX.js → claude-setup-NGZ5NDYH.js} +1 -1
  28. package/dist/cli.js +9 -9
  29. package/dist/framing-P5RGN5V3.js +3 -0
  30. package/dist/gfx-worker.js +1 -1
  31. package/dist/{h264-5OGRVYUF.js → h264-JI62TU4W.js} +1 -1
  32. package/dist/{h264-mxf-FTHNCK4B.js → h264-mxf-J2QPZO4U.js} +1 -1
  33. package/dist/hook.js +3 -0
  34. package/dist/host-relink-76CFY32O.js +10 -0
  35. package/dist/hosted-L26AGRIY.js +3 -0
  36. package/dist/hosts-TBHEPV6A.js +3 -0
  37. package/dist/http.js +2 -2
  38. package/dist/{inspect-BJYIDVDN.js → inspect-U656APGR.js} +1 -1
  39. package/dist/{isobmff-DN6MCHEK.js → isobmff-UISATYUR.js} +1 -1
  40. package/dist/{mc-video-TF3MD7LN.js → mc-video-LSTKUKNL.js} +1 -1
  41. package/dist/mcp.js +8 -8
  42. package/dist/{media-MJKEKCPN.js → media-XBNKYKB7.js} +1 -1
  43. package/dist/mxf-ZL57VJ3C.js +3 -0
  44. package/dist/{ops-B2OA7VXN.js → ops-ZQEQXW2N.js} +1 -1
  45. package/dist/probe-ZDX6XNRF.js +3 -0
  46. package/dist/{r3d-7OOZMPWH.js → r3d-R4TLYJVE.js} +1 -1
  47. package/dist/resolve-bridge.py +31 -2
  48. package/dist/{sequence-patch-CN4VC5W3.js → sequence-patch-C2QRIT5V.js} +1 -1
  49. package/dist/{store-4WZQF6YD.js → store-JNWELX35.js} +1 -1
  50. package/dist/timeline-JONFBIA3.js +3 -0
  51. package/package.json +5 -5
  52. package/dist/chunk-3XQI5SIV.js +0 -3
  53. package/dist/chunk-6NLB5TZ2.js +0 -7
  54. package/dist/chunk-G3SZDPDS.js +0 -3
  55. package/dist/chunk-NMH62JSC.js +0 -5
  56. package/dist/chunk-VJN4UXFJ.js +0 -8
  57. package/dist/chunk-XF3YMBI7.js +0 -3
  58. package/dist/chunk-XVRTAKDK.js +0 -6
  59. package/dist/framing-CVJM5TT3.js +0 -3
  60. package/dist/host-relink-ZP33BK53.js +0 -10
  61. package/dist/hosted-BWAYLJXR.js +0 -3
  62. package/dist/hosts-H3IKRZF2.js +0 -3
  63. package/dist/mxf-Q5723GPD.js +0 -3
  64. package/dist/probe-72QZKMCC.js +0 -3
  65. package/dist/timeline-ZP5H4YDQ.js +0 -3
  66. /package/dist/{still-SX6RJ7O6.js → still-4UR35GZH.js} +0 -0
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
  import { createRequire as __conformRequire } from 'node:module'; const require = __conformRequire(import.meta.url);
3
- import{a as Js}from"./chunk-OMPYIH6F.js";import"./chunk-IN6XVTUS.js";import"./chunk-PFZVET7S.js";import"./chunk-6V4OEOOX.js";import"./chunk-RGMTLNMF.js";import"./chunk-F4PHKOAS.js";import{a as Br,b as zs,d as Gs}from"./chunk-LVGGCRDW.js";import"./chunk-C2ESM27Z.js";import{b as fu,c as $,d as Ks,e as k,f as ze,g as Se}from"./chunk-PSANHDZM.js";var _e={};Ks(_e,{__addDisposableResource:()=>Ei,__assign:()=>Ft,__asyncDelegator:()=>pi,__asyncGenerator:()=>fi,__asyncValues:()=>mi,__await:()=>Ge,__awaiter:()=>ai,__classPrivateFieldGet:()=>vi,__classPrivateFieldIn:()=>bi,__classPrivateFieldSet:()=>wi,__createBinding:()=>qt,__decorate:()=>ei,__disposeResources:()=>Si,__esDecorate:()=>ri,__exportStar:()=>li,__extends:()=>Qs,__generator:()=>ui,__importDefault:()=>yi,__importStar:()=>gi,__makeTemplateObject:()=>_i,__metadata:()=>oi,__param:()=>ti,__propKey:()=>si,__read:()=>Vr,__rest:()=>Zs,__rewriteRelativeImportExtension:()=>Ti,__runInitializers:()=>ni,__setFunctionName:()=>ii,__spread:()=>ci,__spreadArray:()=>di,__spreadArrays:()=>hi,__values:()=>Bt,default:()=>yu});function Qs(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");Mr(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}function Zs(t,e){var r={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,n=Object.getOwnPropertySymbols(t);s<n.length;s++)e.indexOf(n[s])<0&&Object.prototype.propertyIsEnumerable.call(t,n[s])&&(r[n[s]]=t[n[s]]);return r}function ei(t,e,r,n){var s=arguments.length,i=s<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(t,e,r,n);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(i=(s<3?o(i):s>3?o(e,r,i):o(e,r))||i);return s>3&&i&&Object.defineProperty(e,r,i),i}function ti(t,e){return function(r,n){e(r,n,t)}}function ri(t,e,r,n,s,i){function o(T){if(T!==void 0&&typeof T!="function")throw new TypeError("Function expected");return T}for(var a=n.kind,l=a==="getter"?"get":a==="setter"?"set":"value",c=!e&&t?n.static?t:t.prototype:null,d=e||(c?Object.getOwnPropertyDescriptor(c,n.name):{}),m,_=!1,f=r.length-1;f>=0;f--){var y={};for(var v in n)y[v]=v==="access"?{}:n[v];for(var v in n.access)y.access[v]=n.access[v];y.addInitializer=function(T){if(_)throw new TypeError("Cannot add initializers after decoration has completed");i.push(o(T||null))};var w=(0,r[f])(a==="accessor"?{get:d.get,set:d.set}:d[l],y);if(a==="accessor"){if(w===void 0)continue;if(w===null||typeof w!="object")throw new TypeError("Object expected");(m=o(w.get))&&(d.get=m),(m=o(w.set))&&(d.set=m),(m=o(w.init))&&s.unshift(m)}else(m=o(w))&&(a==="field"?s.unshift(m):d[l]=m)}c&&Object.defineProperty(c,n.name,d),_=!0}function ni(t,e,r){for(var n=arguments.length>2,s=0;s<e.length;s++)r=n?e[s].call(t,r):e[s].call(t);return n?r:void 0}function si(t){return typeof t=="symbol"?t:"".concat(t)}function ii(t,e,r){return typeof e=="symbol"&&(e=e.description?"[".concat(e.description,"]"):""),Object.defineProperty(t,"name",{configurable:!0,value:r?"".concat(r," ",e):e})}function oi(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)}function ai(t,e,r,n){function s(i){return i instanceof r?i:new r(function(o){o(i)})}return new(r||(r=Promise))(function(i,o){function a(d){try{c(n.next(d))}catch(m){o(m)}}function l(d){try{c(n.throw(d))}catch(m){o(m)}}function c(d){d.done?i(d.value):s(d.value).then(a,l)}c((n=n.apply(t,e||[])).next())})}function ui(t,e){var r={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},n,s,i,o=Object.create((typeof Iterator=="function"?Iterator:Object).prototype);return o.next=a(0),o.throw=a(1),o.return=a(2),typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function a(c){return function(d){return l([c,d])}}function l(c){if(n)throw new TypeError("Generator is already executing.");for(;o&&(o=0,c[0]&&(r=0)),r;)try{if(n=1,s&&(i=c[0]&2?s.return:c[0]?s.throw||((i=s.return)&&i.call(s),0):s.next)&&!(i=i.call(s,c[1])).done)return i;switch(s=0,i&&(c=[c[0]&2,i.value]),c[0]){case 0:case 1:i=c;break;case 4:return r.label++,{value:c[1],done:!1};case 5:r.label++,s=c[1],c=[0];continue;case 7:c=r.ops.pop(),r.trys.pop();continue;default:if(i=r.trys,!(i=i.length>0&&i[i.length-1])&&(c[0]===6||c[0]===2)){r=0;continue}if(c[0]===3&&(!i||c[1]>i[0]&&c[1]<i[3])){r.label=c[1];break}if(c[0]===6&&r.label<i[1]){r.label=i[1],i=c;break}if(i&&r.label<i[2]){r.label=i[2],r.ops.push(c);break}i[2]&&r.ops.pop(),r.trys.pop();continue}c=e.call(t,r)}catch(d){c=[6,d],s=0}finally{n=i=0}if(c[0]&5)throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}function li(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&qt(e,t,r)}function Bt(t){var e=typeof Symbol=="function"&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&typeof t.length=="number")return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function Vr(t,e){var r=typeof Symbol=="function"&&t[Symbol.iterator];if(!r)return t;var n=r.call(t),s,i=[],o;try{for(;(e===void 0||e-- >0)&&!(s=n.next()).done;)i.push(s.value)}catch(a){o={error:a}}finally{try{s&&!s.done&&(r=n.return)&&r.call(n)}finally{if(o)throw o.error}}return i}function ci(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(Vr(arguments[e]));return t}function hi(){for(var t=0,e=0,r=arguments.length;e<r;e++)t+=arguments[e].length;for(var n=Array(t),s=0,e=0;e<r;e++)for(var i=arguments[e],o=0,a=i.length;o<a;o++,s++)n[s]=i[o];return n}function di(t,e,r){if(r||arguments.length===2)for(var n=0,s=e.length,i;n<s;n++)(i||!(n in e))&&(i||(i=Array.prototype.slice.call(e,0,n)),i[n]=e[n]);return t.concat(i||Array.prototype.slice.call(e))}function Ge(t){return this instanceof Ge?(this.v=t,this):new Ge(t)}function fi(t,e,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=r.apply(t,e||[]),s,i=[];return s=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),a("next"),a("throw"),a("return",o),s[Symbol.asyncIterator]=function(){return this},s;function o(f){return function(y){return Promise.resolve(y).then(f,m)}}function a(f,y){n[f]&&(s[f]=function(v){return new Promise(function(w,T){i.push([f,v,w,T])>1||l(f,v)})},y&&(s[f]=y(s[f])))}function l(f,y){try{c(n[f](y))}catch(v){_(i[0][3],v)}}function c(f){f.value instanceof Ge?Promise.resolve(f.value.v).then(d,m):_(i[0][2],f)}function d(f){l("next",f)}function m(f){l("throw",f)}function _(f,y){f(y),i.shift(),i.length&&l(i[0][0],i[0][1])}}function pi(t){var e,r;return e={},n("next"),n("throw",function(s){throw s}),n("return"),e[Symbol.iterator]=function(){return this},e;function n(s,i){e[s]=t[s]?function(o){return(r=!r)?{value:Ge(t[s](o)),done:!1}:i?i(o):o}:i}}function mi(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=t[Symbol.asyncIterator],r;return e?e.call(t):(t=typeof Bt=="function"?Bt(t):t[Symbol.iterator](),r={},n("next"),n("throw"),n("return"),r[Symbol.asyncIterator]=function(){return this},r);function n(i){r[i]=t[i]&&function(o){return new Promise(function(a,l){o=t[i](o),s(a,l,o.done,o.value)})}}function s(i,o,a,l){Promise.resolve(l).then(function(c){i({value:c,done:a})},o)}}function _i(t,e){return Object.defineProperty?Object.defineProperty(t,"raw",{value:e}):t.raw=e,t}function gi(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r=Wr(t),n=0;n<r.length;n++)r[n]!=="default"&&qt(e,t,r[n]);return _u(e,t),e}function yi(t){return t&&t.__esModule?t:{default:t}}function vi(t,e,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(t):n?n.value:e.get(t)}function wi(t,e,r,n,s){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!s)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?t!==e||!s:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?s.call(t,r):s?s.value=r:e.set(t,r),r}function bi(t,e){if(e===null||typeof e!="object"&&typeof e!="function")throw new TypeError("Cannot use 'in' operator on non-object");return typeof t=="function"?e===t:t.has(e)}function Ei(t,e,r){if(e!=null){if(typeof e!="object"&&typeof e!="function")throw new TypeError("Object expected.");var n,s;if(r){if(!Symbol.asyncDispose)throw new TypeError("Symbol.asyncDispose is not defined.");n=e[Symbol.asyncDispose]}if(n===void 0){if(!Symbol.dispose)throw new TypeError("Symbol.dispose is not defined.");n=e[Symbol.dispose],r&&(s=n)}if(typeof n!="function")throw new TypeError("Object not disposable.");s&&(n=function(){try{s.call(this)}catch(i){return Promise.reject(i)}}),t.stack.push({value:e,dispose:n,async:r})}else r&&t.stack.push({async:!0});return e}function Si(t){function e(i){t.error=t.hasError?new gu(i,t.error,"An error was suppressed during disposal."):i,t.hasError=!0}var r,n=0;function s(){for(;r=t.stack.pop();)try{if(!r.async&&n===1)return n=0,t.stack.push(r),Promise.resolve().then(s);if(r.dispose){var i=r.dispose.call(r.value);if(r.async)return n|=2,Promise.resolve(i).then(s,function(o){return e(o),s()})}else n|=1}catch(o){e(o)}if(n===1)return t.hasError?Promise.reject(t.error):Promise.resolve();if(t.hasError)throw t.error}return s()}function Ti(t,e){return typeof t=="string"&&/^\.\.?\//.test(t)?t.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i,function(r,n,s,i,o){return n?e?".jsx":".js":s&&(!i||!o)?r:s+i+"."+o.toLowerCase()+"js"}):t}var Mr,Ft,qt,_u,Wr,gu,yu,ge=fu(()=>{Mr=function(t,e){return Mr=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,n){r.__proto__=n}||function(r,n){for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(r[s]=n[s])},Mr(t,e)};Ft=function(){return Ft=Object.assign||function(e){for(var r,n=1,s=arguments.length;n<s;n++){r=arguments[n];for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(e[i]=r[i])}return e},Ft.apply(this,arguments)};qt=Object.create?(function(t,e,r,n){n===void 0&&(n=r);var s=Object.getOwnPropertyDescriptor(e,r);(!s||("get"in s?!e.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,s)}):(function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]});_u=Object.create?(function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}):function(t,e){t.default=e},Wr=function(t){return Wr=Object.getOwnPropertyNames||function(e){var r=[];for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(r[r.length]=n);return r},Wr(t)};gu=typeof SuppressedError=="function"?SuppressedError:function(t,e,r){var n=new Error(r);return n.name="SuppressedError",n.error=t,n.suppressed=e,n};yu={__extends:Qs,__assign:Ft,__rest:Zs,__decorate:ei,__param:ti,__esDecorate:ri,__runInitializers:ni,__propKey:si,__setFunctionName:ii,__metadata:oi,__awaiter:ai,__generator:ui,__createBinding:qt,__exportStar:li,__values:Bt,__read:Vr,__spread:ci,__spreadArrays:hi,__spreadArray:di,__await:Ge,__asyncGenerator:fi,__asyncDelegator:pi,__asyncValues:mi,__makeTemplateObject:_i,__importStar:gi,__importDefault:yi,__classPrivateFieldGet:vi,__classPrivateFieldSet:wi,__classPrivateFieldIn:bi,__addDisposableResource:Ei,__disposeResources:Si,__rewriteRelativeImportExtension:Ti}});var Ai=$(Mt=>{"use strict";Object.defineProperty(Mt,"__esModule",{value:!0});Mt.resolveFetch=void 0;var vu=t=>t?(...e)=>t(...e):(...e)=>fetch(...e);Mt.resolveFetch=vu});var Gr=$(ye=>{"use strict";Object.defineProperty(ye,"__esModule",{value:!0});ye.FunctionRegion=ye.FunctionsHttpError=ye.FunctionsRelayError=ye.FunctionsFetchError=ye.FunctionsError=void 0;var Je=class extends Error{constructor(e,r="FunctionsError",n){super(e),this.name=r,this.context=n}};ye.FunctionsError=Je;var Hr=class extends Je{constructor(e){super("Failed to send a request to the Edge Function","FunctionsFetchError",e)}};ye.FunctionsFetchError=Hr;var Kr=class extends Je{constructor(e){super("Relay Error invoking the Edge Function","FunctionsRelayError",e)}};ye.FunctionsRelayError=Kr;var zr=class extends Je{constructor(e){super("Edge Function returned a non-2xx status code","FunctionsHttpError",e)}};ye.FunctionsHttpError=zr;var Ri;(function(t){t.Any="any",t.ApNortheast1="ap-northeast-1",t.ApNortheast2="ap-northeast-2",t.ApSouth1="ap-south-1",t.ApSoutheast1="ap-southeast-1",t.ApSoutheast2="ap-southeast-2",t.CaCentral1="ca-central-1",t.EuCentral1="eu-central-1",t.EuWest1="eu-west-1",t.EuWest2="eu-west-2",t.EuWest3="eu-west-3",t.SaEast1="sa-east-1",t.UsEast1="us-east-1",t.UsWest1="us-west-1",t.UsWest2="us-west-2"})(Ri||(ye.FunctionRegion=Ri={}))});var ki=$(Wt=>{"use strict";Object.defineProperty(Wt,"__esModule",{value:!0});Wt.FunctionsClient=void 0;var wu=(ge(),Se(_e)),bu=Ai(),Ye=Gr(),Jr=class{constructor(e,{headers:r={},customFetch:n,region:s=Ye.FunctionRegion.Any}={}){this.url=e,this.headers=r,this.region=s,this.fetch=(0,bu.resolveFetch)(n)}setAuth(e){this.headers.Authorization=`Bearer ${e}`}invoke(e){return wu.__awaiter(this,arguments,void 0,function*(r,n={}){var s;let i,o;try{let{headers:a,method:l,body:c,signal:d,timeout:m}=n,_={},{region:f}=n;f||(f=this.region);let y=new URL(`${this.url}/${r}`);f&&f!=="any"&&(_["x-region"]=f,y.searchParams.set("forceFunctionRegion",f));let v;c&&(a&&!Object.prototype.hasOwnProperty.call(a,"Content-Type")||!a)?typeof Blob<"u"&&c instanceof Blob||c instanceof ArrayBuffer?(_["Content-Type"]="application/octet-stream",v=c):typeof c=="string"?(_["Content-Type"]="text/plain",v=c):typeof FormData<"u"&&c instanceof FormData?v=c:(_["Content-Type"]="application/json",v=JSON.stringify(c)):c&&typeof c!="string"&&!(typeof Blob<"u"&&c instanceof Blob)&&!(c instanceof ArrayBuffer)&&!(typeof FormData<"u"&&c instanceof FormData)?v=JSON.stringify(c):v=c;let w=d;m&&(o=new AbortController,i=setTimeout(()=>o.abort(),m),d?(w=o.signal,d.addEventListener("abort",()=>o.abort())):w=o.signal);let T=yield this.fetch(y.toString(),{method:l||"POST",headers:Object.assign(Object.assign(Object.assign({},_),this.headers),a),body:v,signal:w}).catch(Z=>{throw new Ye.FunctionsFetchError(Z)}),O=T.headers.get("x-relay-error");if(O&&O==="true")throw new Ye.FunctionsRelayError(T);if(!T.ok)throw new Ye.FunctionsHttpError(T);let E=((s=T.headers.get("Content-Type"))!==null&&s!==void 0?s:"text/plain").split(";")[0].trim(),x;return E==="application/json"?x=yield T.json():E==="application/octet-stream"||E==="application/pdf"?x=yield T.blob():E==="text/event-stream"?x=T:E==="multipart/form-data"?x=yield T.formData():x=yield T.text(),{data:x,error:null,response:T}}catch(a){return{data:null,error:a,response:a instanceof Ye.FunctionsHttpError||a instanceof Ye.FunctionsRelayError?a.context:void 0}}finally{i&&clearTimeout(i)}})}};Wt.FunctionsClient=Jr});var Oi=$(fe=>{"use strict";Object.defineProperty(fe,"__esModule",{value:!0});fe.FunctionRegion=fe.FunctionsRelayError=fe.FunctionsHttpError=fe.FunctionsFetchError=fe.FunctionsError=fe.FunctionsClient=void 0;var Eu=ki();Object.defineProperty(fe,"FunctionsClient",{enumerable:!0,get:function(){return Eu.FunctionsClient}});var lt=Gr();Object.defineProperty(fe,"FunctionsError",{enumerable:!0,get:function(){return lt.FunctionsError}});Object.defineProperty(fe,"FunctionsFetchError",{enumerable:!0,get:function(){return lt.FunctionsFetchError}});Object.defineProperty(fe,"FunctionsHttpError",{enumerable:!0,get:function(){return lt.FunctionsHttpError}});Object.defineProperty(fe,"FunctionsRelayError",{enumerable:!0,get:function(){return lt.FunctionsRelayError}});Object.defineProperty(fe,"FunctionRegion",{enumerable:!0,get:function(){return lt.FunctionRegion}})});var Xr=$(ht=>{"use strict";Object.defineProperty(ht,"__esModule",{value:!0});ht.WebSocketFactory=void 0;var Ht=class{constructor(){}static detectEnvironment(){var e;if(typeof WebSocket<"u")return{type:"native",constructor:WebSocket};if(typeof globalThis<"u"&&typeof globalThis.WebSocket<"u")return{type:"native",constructor:globalThis.WebSocket};if(typeof global<"u"&&typeof global.WebSocket<"u")return{type:"native",constructor:global.WebSocket};if(typeof globalThis<"u"&&typeof globalThis.WebSocketPair<"u"&&typeof globalThis.WebSocket>"u")return{type:"cloudflare",error:"Cloudflare Workers detected. WebSocket clients are not supported in Cloudflare Workers.",workaround:"Use Cloudflare Workers WebSocket API for server-side WebSocket handling, or deploy to a different runtime."};if(typeof globalThis<"u"&&globalThis.EdgeRuntime||typeof navigator<"u"&&(!((e=navigator.userAgent)===null||e===void 0)&&e.includes("Vercel-Edge")))return{type:"unsupported",error:"Edge runtime detected (Vercel Edge/Netlify Edge). WebSockets are not supported in edge functions.",workaround:"Use serverless functions or a different deployment target for WebSocket functionality."};let r=globalThis.process;if(r){let n=r.versions;if(n&&n.node){let s=n.node,i=parseInt(s.replace(/^v/,"").split(".")[0]);return i>=22?typeof globalThis.WebSocket<"u"?{type:"native",constructor:globalThis.WebSocket}:{type:"unsupported",error:`Node.js ${i} detected but native WebSocket not found.`,workaround:"Provide a WebSocket implementation via the transport option."}:{type:"unsupported",error:`Node.js ${i} detected without native WebSocket support.`,workaround:`For Node.js < 22, install "ws" package and provide it via the transport option:
3
+ import{a as Js}from"./chunk-G3HBKJ5L.js";import"./chunk-IN6XVTUS.js";import"./chunk-PFZVET7S.js";import"./chunk-6V4OEOOX.js";import"./chunk-RGMTLNMF.js";import"./chunk-LZRCXSUJ.js";import{a as Br,b as zs,d as Gs}from"./chunk-LVGGCRDW.js";import"./chunk-C2ESM27Z.js";import{b as fu,c as $,d as Ks,e as k,f as ze,g as Se}from"./chunk-PSANHDZM.js";var _e={};Ks(_e,{__addDisposableResource:()=>Ei,__assign:()=>Ft,__asyncDelegator:()=>pi,__asyncGenerator:()=>fi,__asyncValues:()=>mi,__await:()=>Ge,__awaiter:()=>ai,__classPrivateFieldGet:()=>vi,__classPrivateFieldIn:()=>bi,__classPrivateFieldSet:()=>wi,__createBinding:()=>qt,__decorate:()=>ei,__disposeResources:()=>Si,__esDecorate:()=>ri,__exportStar:()=>li,__extends:()=>Qs,__generator:()=>ui,__importDefault:()=>yi,__importStar:()=>gi,__makeTemplateObject:()=>_i,__metadata:()=>oi,__param:()=>ti,__propKey:()=>si,__read:()=>Vr,__rest:()=>Zs,__rewriteRelativeImportExtension:()=>Ti,__runInitializers:()=>ni,__setFunctionName:()=>ii,__spread:()=>ci,__spreadArray:()=>di,__spreadArrays:()=>hi,__values:()=>Bt,default:()=>yu});function Qs(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");Mr(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}function Zs(t,e){var r={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,n=Object.getOwnPropertySymbols(t);s<n.length;s++)e.indexOf(n[s])<0&&Object.prototype.propertyIsEnumerable.call(t,n[s])&&(r[n[s]]=t[n[s]]);return r}function ei(t,e,r,n){var s=arguments.length,i=s<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(t,e,r,n);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(i=(s<3?o(i):s>3?o(e,r,i):o(e,r))||i);return s>3&&i&&Object.defineProperty(e,r,i),i}function ti(t,e){return function(r,n){e(r,n,t)}}function ri(t,e,r,n,s,i){function o(T){if(T!==void 0&&typeof T!="function")throw new TypeError("Function expected");return T}for(var a=n.kind,l=a==="getter"?"get":a==="setter"?"set":"value",c=!e&&t?n.static?t:t.prototype:null,d=e||(c?Object.getOwnPropertyDescriptor(c,n.name):{}),m,_=!1,f=r.length-1;f>=0;f--){var y={};for(var v in n)y[v]=v==="access"?{}:n[v];for(var v in n.access)y.access[v]=n.access[v];y.addInitializer=function(T){if(_)throw new TypeError("Cannot add initializers after decoration has completed");i.push(o(T||null))};var w=(0,r[f])(a==="accessor"?{get:d.get,set:d.set}:d[l],y);if(a==="accessor"){if(w===void 0)continue;if(w===null||typeof w!="object")throw new TypeError("Object expected");(m=o(w.get))&&(d.get=m),(m=o(w.set))&&(d.set=m),(m=o(w.init))&&s.unshift(m)}else(m=o(w))&&(a==="field"?s.unshift(m):d[l]=m)}c&&Object.defineProperty(c,n.name,d),_=!0}function ni(t,e,r){for(var n=arguments.length>2,s=0;s<e.length;s++)r=n?e[s].call(t,r):e[s].call(t);return n?r:void 0}function si(t){return typeof t=="symbol"?t:"".concat(t)}function ii(t,e,r){return typeof e=="symbol"&&(e=e.description?"[".concat(e.description,"]"):""),Object.defineProperty(t,"name",{configurable:!0,value:r?"".concat(r," ",e):e})}function oi(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)}function ai(t,e,r,n){function s(i){return i instanceof r?i:new r(function(o){o(i)})}return new(r||(r=Promise))(function(i,o){function a(d){try{c(n.next(d))}catch(m){o(m)}}function l(d){try{c(n.throw(d))}catch(m){o(m)}}function c(d){d.done?i(d.value):s(d.value).then(a,l)}c((n=n.apply(t,e||[])).next())})}function ui(t,e){var r={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},n,s,i,o=Object.create((typeof Iterator=="function"?Iterator:Object).prototype);return o.next=a(0),o.throw=a(1),o.return=a(2),typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function a(c){return function(d){return l([c,d])}}function l(c){if(n)throw new TypeError("Generator is already executing.");for(;o&&(o=0,c[0]&&(r=0)),r;)try{if(n=1,s&&(i=c[0]&2?s.return:c[0]?s.throw||((i=s.return)&&i.call(s),0):s.next)&&!(i=i.call(s,c[1])).done)return i;switch(s=0,i&&(c=[c[0]&2,i.value]),c[0]){case 0:case 1:i=c;break;case 4:return r.label++,{value:c[1],done:!1};case 5:r.label++,s=c[1],c=[0];continue;case 7:c=r.ops.pop(),r.trys.pop();continue;default:if(i=r.trys,!(i=i.length>0&&i[i.length-1])&&(c[0]===6||c[0]===2)){r=0;continue}if(c[0]===3&&(!i||c[1]>i[0]&&c[1]<i[3])){r.label=c[1];break}if(c[0]===6&&r.label<i[1]){r.label=i[1],i=c;break}if(i&&r.label<i[2]){r.label=i[2],r.ops.push(c);break}i[2]&&r.ops.pop(),r.trys.pop();continue}c=e.call(t,r)}catch(d){c=[6,d],s=0}finally{n=i=0}if(c[0]&5)throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}function li(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&qt(e,t,r)}function Bt(t){var e=typeof Symbol=="function"&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&typeof t.length=="number")return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function Vr(t,e){var r=typeof Symbol=="function"&&t[Symbol.iterator];if(!r)return t;var n=r.call(t),s,i=[],o;try{for(;(e===void 0||e-- >0)&&!(s=n.next()).done;)i.push(s.value)}catch(a){o={error:a}}finally{try{s&&!s.done&&(r=n.return)&&r.call(n)}finally{if(o)throw o.error}}return i}function ci(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(Vr(arguments[e]));return t}function hi(){for(var t=0,e=0,r=arguments.length;e<r;e++)t+=arguments[e].length;for(var n=Array(t),s=0,e=0;e<r;e++)for(var i=arguments[e],o=0,a=i.length;o<a;o++,s++)n[s]=i[o];return n}function di(t,e,r){if(r||arguments.length===2)for(var n=0,s=e.length,i;n<s;n++)(i||!(n in e))&&(i||(i=Array.prototype.slice.call(e,0,n)),i[n]=e[n]);return t.concat(i||Array.prototype.slice.call(e))}function Ge(t){return this instanceof Ge?(this.v=t,this):new Ge(t)}function fi(t,e,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=r.apply(t,e||[]),s,i=[];return s=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),a("next"),a("throw"),a("return",o),s[Symbol.asyncIterator]=function(){return this},s;function o(f){return function(y){return Promise.resolve(y).then(f,m)}}function a(f,y){n[f]&&(s[f]=function(v){return new Promise(function(w,T){i.push([f,v,w,T])>1||l(f,v)})},y&&(s[f]=y(s[f])))}function l(f,y){try{c(n[f](y))}catch(v){_(i[0][3],v)}}function c(f){f.value instanceof Ge?Promise.resolve(f.value.v).then(d,m):_(i[0][2],f)}function d(f){l("next",f)}function m(f){l("throw",f)}function _(f,y){f(y),i.shift(),i.length&&l(i[0][0],i[0][1])}}function pi(t){var e,r;return e={},n("next"),n("throw",function(s){throw s}),n("return"),e[Symbol.iterator]=function(){return this},e;function n(s,i){e[s]=t[s]?function(o){return(r=!r)?{value:Ge(t[s](o)),done:!1}:i?i(o):o}:i}}function mi(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=t[Symbol.asyncIterator],r;return e?e.call(t):(t=typeof Bt=="function"?Bt(t):t[Symbol.iterator](),r={},n("next"),n("throw"),n("return"),r[Symbol.asyncIterator]=function(){return this},r);function n(i){r[i]=t[i]&&function(o){return new Promise(function(a,l){o=t[i](o),s(a,l,o.done,o.value)})}}function s(i,o,a,l){Promise.resolve(l).then(function(c){i({value:c,done:a})},o)}}function _i(t,e){return Object.defineProperty?Object.defineProperty(t,"raw",{value:e}):t.raw=e,t}function gi(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r=Wr(t),n=0;n<r.length;n++)r[n]!=="default"&&qt(e,t,r[n]);return _u(e,t),e}function yi(t){return t&&t.__esModule?t:{default:t}}function vi(t,e,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(t):n?n.value:e.get(t)}function wi(t,e,r,n,s){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!s)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?t!==e||!s:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?s.call(t,r):s?s.value=r:e.set(t,r),r}function bi(t,e){if(e===null||typeof e!="object"&&typeof e!="function")throw new TypeError("Cannot use 'in' operator on non-object");return typeof t=="function"?e===t:t.has(e)}function Ei(t,e,r){if(e!=null){if(typeof e!="object"&&typeof e!="function")throw new TypeError("Object expected.");var n,s;if(r){if(!Symbol.asyncDispose)throw new TypeError("Symbol.asyncDispose is not defined.");n=e[Symbol.asyncDispose]}if(n===void 0){if(!Symbol.dispose)throw new TypeError("Symbol.dispose is not defined.");n=e[Symbol.dispose],r&&(s=n)}if(typeof n!="function")throw new TypeError("Object not disposable.");s&&(n=function(){try{s.call(this)}catch(i){return Promise.reject(i)}}),t.stack.push({value:e,dispose:n,async:r})}else r&&t.stack.push({async:!0});return e}function Si(t){function e(i){t.error=t.hasError?new gu(i,t.error,"An error was suppressed during disposal."):i,t.hasError=!0}var r,n=0;function s(){for(;r=t.stack.pop();)try{if(!r.async&&n===1)return n=0,t.stack.push(r),Promise.resolve().then(s);if(r.dispose){var i=r.dispose.call(r.value);if(r.async)return n|=2,Promise.resolve(i).then(s,function(o){return e(o),s()})}else n|=1}catch(o){e(o)}if(n===1)return t.hasError?Promise.reject(t.error):Promise.resolve();if(t.hasError)throw t.error}return s()}function Ti(t,e){return typeof t=="string"&&/^\.\.?\//.test(t)?t.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i,function(r,n,s,i,o){return n?e?".jsx":".js":s&&(!i||!o)?r:s+i+"."+o.toLowerCase()+"js"}):t}var Mr,Ft,qt,_u,Wr,gu,yu,ge=fu(()=>{Mr=function(t,e){return Mr=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,n){r.__proto__=n}||function(r,n){for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(r[s]=n[s])},Mr(t,e)};Ft=function(){return Ft=Object.assign||function(e){for(var r,n=1,s=arguments.length;n<s;n++){r=arguments[n];for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(e[i]=r[i])}return e},Ft.apply(this,arguments)};qt=Object.create?(function(t,e,r,n){n===void 0&&(n=r);var s=Object.getOwnPropertyDescriptor(e,r);(!s||("get"in s?!e.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,s)}):(function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]});_u=Object.create?(function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}):function(t,e){t.default=e},Wr=function(t){return Wr=Object.getOwnPropertyNames||function(e){var r=[];for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(r[r.length]=n);return r},Wr(t)};gu=typeof SuppressedError=="function"?SuppressedError:function(t,e,r){var n=new Error(r);return n.name="SuppressedError",n.error=t,n.suppressed=e,n};yu={__extends:Qs,__assign:Ft,__rest:Zs,__decorate:ei,__param:ti,__esDecorate:ri,__runInitializers:ni,__propKey:si,__setFunctionName:ii,__metadata:oi,__awaiter:ai,__generator:ui,__createBinding:qt,__exportStar:li,__values:Bt,__read:Vr,__spread:ci,__spreadArrays:hi,__spreadArray:di,__await:Ge,__asyncGenerator:fi,__asyncDelegator:pi,__asyncValues:mi,__makeTemplateObject:_i,__importStar:gi,__importDefault:yi,__classPrivateFieldGet:vi,__classPrivateFieldSet:wi,__classPrivateFieldIn:bi,__addDisposableResource:Ei,__disposeResources:Si,__rewriteRelativeImportExtension:Ti}});var Ai=$(Mt=>{"use strict";Object.defineProperty(Mt,"__esModule",{value:!0});Mt.resolveFetch=void 0;var vu=t=>t?(...e)=>t(...e):(...e)=>fetch(...e);Mt.resolveFetch=vu});var Gr=$(ye=>{"use strict";Object.defineProperty(ye,"__esModule",{value:!0});ye.FunctionRegion=ye.FunctionsHttpError=ye.FunctionsRelayError=ye.FunctionsFetchError=ye.FunctionsError=void 0;var Je=class extends Error{constructor(e,r="FunctionsError",n){super(e),this.name=r,this.context=n}};ye.FunctionsError=Je;var Hr=class extends Je{constructor(e){super("Failed to send a request to the Edge Function","FunctionsFetchError",e)}};ye.FunctionsFetchError=Hr;var Kr=class extends Je{constructor(e){super("Relay Error invoking the Edge Function","FunctionsRelayError",e)}};ye.FunctionsRelayError=Kr;var zr=class extends Je{constructor(e){super("Edge Function returned a non-2xx status code","FunctionsHttpError",e)}};ye.FunctionsHttpError=zr;var Ri;(function(t){t.Any="any",t.ApNortheast1="ap-northeast-1",t.ApNortheast2="ap-northeast-2",t.ApSouth1="ap-south-1",t.ApSoutheast1="ap-southeast-1",t.ApSoutheast2="ap-southeast-2",t.CaCentral1="ca-central-1",t.EuCentral1="eu-central-1",t.EuWest1="eu-west-1",t.EuWest2="eu-west-2",t.EuWest3="eu-west-3",t.SaEast1="sa-east-1",t.UsEast1="us-east-1",t.UsWest1="us-west-1",t.UsWest2="us-west-2"})(Ri||(ye.FunctionRegion=Ri={}))});var ki=$(Wt=>{"use strict";Object.defineProperty(Wt,"__esModule",{value:!0});Wt.FunctionsClient=void 0;var wu=(ge(),Se(_e)),bu=Ai(),Ye=Gr(),Jr=class{constructor(e,{headers:r={},customFetch:n,region:s=Ye.FunctionRegion.Any}={}){this.url=e,this.headers=r,this.region=s,this.fetch=(0,bu.resolveFetch)(n)}setAuth(e){this.headers.Authorization=`Bearer ${e}`}invoke(e){return wu.__awaiter(this,arguments,void 0,function*(r,n={}){var s;let i,o;try{let{headers:a,method:l,body:c,signal:d,timeout:m}=n,_={},{region:f}=n;f||(f=this.region);let y=new URL(`${this.url}/${r}`);f&&f!=="any"&&(_["x-region"]=f,y.searchParams.set("forceFunctionRegion",f));let v;c&&(a&&!Object.prototype.hasOwnProperty.call(a,"Content-Type")||!a)?typeof Blob<"u"&&c instanceof Blob||c instanceof ArrayBuffer?(_["Content-Type"]="application/octet-stream",v=c):typeof c=="string"?(_["Content-Type"]="text/plain",v=c):typeof FormData<"u"&&c instanceof FormData?v=c:(_["Content-Type"]="application/json",v=JSON.stringify(c)):c&&typeof c!="string"&&!(typeof Blob<"u"&&c instanceof Blob)&&!(c instanceof ArrayBuffer)&&!(typeof FormData<"u"&&c instanceof FormData)?v=JSON.stringify(c):v=c;let w=d;m&&(o=new AbortController,i=setTimeout(()=>o.abort(),m),d?(w=o.signal,d.addEventListener("abort",()=>o.abort())):w=o.signal);let T=yield this.fetch(y.toString(),{method:l||"POST",headers:Object.assign(Object.assign(Object.assign({},_),this.headers),a),body:v,signal:w}).catch(Z=>{throw new Ye.FunctionsFetchError(Z)}),O=T.headers.get("x-relay-error");if(O&&O==="true")throw new Ye.FunctionsRelayError(T);if(!T.ok)throw new Ye.FunctionsHttpError(T);let E=((s=T.headers.get("Content-Type"))!==null&&s!==void 0?s:"text/plain").split(";")[0].trim(),x;return E==="application/json"?x=yield T.json():E==="application/octet-stream"||E==="application/pdf"?x=yield T.blob():E==="text/event-stream"?x=T:E==="multipart/form-data"?x=yield T.formData():x=yield T.text(),{data:x,error:null,response:T}}catch(a){return{data:null,error:a,response:a instanceof Ye.FunctionsHttpError||a instanceof Ye.FunctionsRelayError?a.context:void 0}}finally{i&&clearTimeout(i)}})}};Wt.FunctionsClient=Jr});var Oi=$(fe=>{"use strict";Object.defineProperty(fe,"__esModule",{value:!0});fe.FunctionRegion=fe.FunctionsRelayError=fe.FunctionsHttpError=fe.FunctionsFetchError=fe.FunctionsError=fe.FunctionsClient=void 0;var Eu=ki();Object.defineProperty(fe,"FunctionsClient",{enumerable:!0,get:function(){return Eu.FunctionsClient}});var lt=Gr();Object.defineProperty(fe,"FunctionsError",{enumerable:!0,get:function(){return lt.FunctionsError}});Object.defineProperty(fe,"FunctionsFetchError",{enumerable:!0,get:function(){return lt.FunctionsFetchError}});Object.defineProperty(fe,"FunctionsHttpError",{enumerable:!0,get:function(){return lt.FunctionsHttpError}});Object.defineProperty(fe,"FunctionsRelayError",{enumerable:!0,get:function(){return lt.FunctionsRelayError}});Object.defineProperty(fe,"FunctionRegion",{enumerable:!0,get:function(){return lt.FunctionRegion}})});var Xr=$(ht=>{"use strict";Object.defineProperty(ht,"__esModule",{value:!0});ht.WebSocketFactory=void 0;var Ht=class{constructor(){}static detectEnvironment(){var e;if(typeof WebSocket<"u")return{type:"native",constructor:WebSocket};if(typeof globalThis<"u"&&typeof globalThis.WebSocket<"u")return{type:"native",constructor:globalThis.WebSocket};if(typeof global<"u"&&typeof global.WebSocket<"u")return{type:"native",constructor:global.WebSocket};if(typeof globalThis<"u"&&typeof globalThis.WebSocketPair<"u"&&typeof globalThis.WebSocket>"u")return{type:"cloudflare",error:"Cloudflare Workers detected. WebSocket clients are not supported in Cloudflare Workers.",workaround:"Use Cloudflare Workers WebSocket API for server-side WebSocket handling, or deploy to a different runtime."};if(typeof globalThis<"u"&&globalThis.EdgeRuntime||typeof navigator<"u"&&(!((e=navigator.userAgent)===null||e===void 0)&&e.includes("Vercel-Edge")))return{type:"unsupported",error:"Edge runtime detected (Vercel Edge/Netlify Edge). WebSockets are not supported in edge functions.",workaround:"Use serverless functions or a different deployment target for WebSocket functionality."};let r=globalThis.process;if(r){let n=r.versions;if(n&&n.node){let s=n.node,i=parseInt(s.replace(/^v/,"").split(".")[0]);return i>=22?typeof globalThis.WebSocket<"u"?{type:"native",constructor:globalThis.WebSocket}:{type:"unsupported",error:`Node.js ${i} detected but native WebSocket not found.`,workaround:"Provide a WebSocket implementation via the transport option."}:{type:"unsupported",error:`Node.js ${i} detected without native WebSocket support.`,workaround:`For Node.js < 22, install "ws" package and provide it via the transport option:
4
4
  import ws from "ws"
5
5
  new RealtimeClient(url, { transport: ws })`}}}return{type:"unsupported",error:"Unknown JavaScript runtime without WebSocket support.",workaround:"Ensure you're running in a supported environment (browser, Node.js, Deno) or provide a custom WebSocket implementation."}}static getWebSocketConstructor(){let e=this.detectEnvironment();if(e.constructor)return e.constructor;let r=e.error||"WebSocket not supported in this environment.";throw e.workaround&&(r+=`
6
6
 
@@ -1,3 +1,3 @@
1
1
  #!/usr/bin/env node
2
2
  import { createRequire as __conformRequire } from 'node:module'; const require = __conformRequire(import.meta.url);
3
- import{a as N}from"./chunk-TK55FA56.js";import{a as T,b as L}from"./chunk-AACY2V3L.js";import{b as p,c as O,g as J}from"./chunk-XDI6CPPV.js";import{b as V}from"./chunk-P3XI63Q2.js";import{b as $,c as _}from"./chunk-F4PHKOAS.js";import{$ as f,A as P,B as x,C as F,D as A,Da as k,Ga as C,Ha as U,Ia as d,N as D,O as z,ha as E,k as w,m as v,n as y,p as R,qa as H,ta as I,x as S,y as M}from"./chunk-DPA26AOI.js";import"./chunk-PSANHDZM.js";function u(e){return(t,n)=>e.read(t,n)}function B(e){let t=e.toLowerCase().trim();return t==="aprn"||t==="aprh"?"prores_raw":t==="apch"||t==="apcn"||t==="apcs"||t==="apco"||t==="ap4h"||t==="ap4x"?"prores":t==="avdn"?"dnxhd":t==="dnxh"?"dnxhr":t==="avc1"||t==="avc3"?"h264":t==="hev1"||t==="hvc1"?"h265":t==="braw"?"braw":e}var h={apco:"Proxy",apcs:"LT",apcn:"422",apch:"HQ",ap4h:"4444",ap4x:"4444 XQ"},Z={1:"bt709",2:"unknown",5:"bt470bg",6:"smpte170m",9:"bt2020",11:"smpte431",12:"smpte432"},ee={1:"bt709",2:"unknown",6:"smpte170m",8:"linear",13:"iec61966-2-1",14:"bt2020-10",15:"bt2020-12",16:"smpte2084",18:"arib-std-b67"},re={0:"gbr",1:"bt709",2:"unknown",5:"bt470bg",6:"smpte170m",9:"bt2020nc",10:"bt2020c"};function te(e,t){return e==="ap4h"||e==="ap4x"?t===32?"yuva444p12le":"yuv444p12le":e in h?"yuv422p10le":void 0}var Q={66:"Baseline",77:"Main",88:"Extended",100:"High",110:"High 10",122:"High 4:2:2",244:"High 4:4:4"},G={1:"Main",2:"Main 10",3:"Main Still",4:"Rext"},ne={1270:"DNxHR 444",1271:"DNxHR HQX",1272:"DNxHR HQ",1273:"DNxHR SQ",1274:"DNxHR LB"};function oe(e,t){if(h[e.codec_fourcc])return`ProRes ${h[e.codec_fourcc]}`;if(e.vc3_cid)return ne[e.vc3_cid]??`DNxHD ${e.vc3_cid}`;if(e.video_profile!=null){if(t==="h264"&&Q[e.video_profile])return`H.264 ${Q[e.video_profile]}`;if(t==="h265"&&G[e.video_profile])return`HEVC ${G[e.video_profile]}`}}function ie(e,t){let n=e.video_chroma,r=e.video_bit_depth;if(n==null&&t==="h264"&&[66,77,88].includes(e.video_profile??-1)&&([n,r]=[1,8]),n==null&&e.vc3_cid&&(n=e.vc3_cid===1270||e.vc3_cid===1256?3:2),n==null||r==null)return;let i=["gray","yuv420p","yuv422p","yuv444p"][n];return r>8?`${i}${r}le`:i}function W(e,t){let n=[];for(let r of e){if(r.kind!=="clip"||!r.source_range)continue;let i=r.source_range.start.value,o=r.source_range.duration.value,c=Math.max(0,Math.floor(i)-t),a=Math.floor(i+o-1)+t;a>=c&&n.push({first_frame:c,last_frame:a})}return n}var be={async inspect(e){await d();let t=e.parts[0],n=await f(u(t),t.fileSize,e.format),r=JSON.parse(n);if(!r)return null;let i=r.timecode&&r.timecode.fps_denominator>0?r.timecode.fps_numerator/r.timecode.fps_denominator:null,o=B(r.codec_fourcc),c=[{kind:"video",codec:o,width:r.width??void 0,height:r.height??void 0,rate:i??void 0,bit_depth:p(r.codec_fourcc)??p(o)??O(o,r.video_profile)??r.video_bit_depth??void 0,codec_specific:{fourcc:r.codec_fourcc,profile:oe(r,o),pixel_format:te(r.codec_fourcc,r.video_depth)??ie(r,o),colr:r.colr?{primaries:Z[r.colr.primaries]??r.colr.primaries,transfer:ee[r.colr.transfer]??r.colr.transfer,matrix:re[r.colr.matrix]??r.colr.matrix}:void 0}}];for(let a of r.audio_tracks??(r.audio?[r.audio]:[]))c.push({kind:"audio",codec:a.codec_fourcc,channels:a.channels??void 0,rate:a.sample_rate??void 0,bit_depth:a.bit_depth??void 0,codec_specific:{fourcc:a.codec_fourcc,channel_layout:a.channel_layout??void 0}});return{id:t.filename,kind:"external",target_url:t.filename,available_range:i&&r.duration_seconds?{start:{value:0,rate:i},duration:{value:Math.round(r.duration_seconds*i),rate:i}}:null,reel_name:null,source_timecode:r.timecode?.display??null,container:e.format==="mov"?"mov":e.format,codec:o,size_bytes:t.fileSize,source_fps:i,source_resolution_w:r.width??null,source_resolution_h:r.height??null,streams:c,decode_provenance:r.decode_provenance??null,vendor_metadata:r.timecode?{drop_frame:r.timecode.drop_frame}:{},binding_state:"unbound",raw_extraction:{mov_probe:r},metadata:{}}},async extract(e){await d();let t=e.parts[0],n=JSON.parse(await E(u(t),t.fileSize,e.format));if(n.length===0)return null;let r=JSON.parse(await f(u(t),t.fileSize,e.format)),i=r?B(r.codec_fourcc):e.format,o=r?.timecode&&r.timecode.fps_denominator>0?r.timecode.fps_numerator/r.timecode.fps_denominator:void 0;return{v:1,container:e.format==="mov"?"mov":e.format,codec:i,width:r?.width??void 0,height:r?.height??void 0,fps:o,frame_count:T(n),timecode:r?.timecode?.display??void 0,granularity:L(n),segments:n}},async sparsify(e,t){await d();let n=e.parts[0],r=W(t.items,t.handles),i=await I(u(n),n.fileSize,JSON.stringify(r),e.format),o=JSON.parse(i);return[{filename:n.filename,fileSize:o.fileSize,structuralRanges:o.structuralRanges,essenceRanges:o.essenceRanges,trimInputs:o.trimInputs}]},async trim(e,t){await d();let n=e.parts[0],r=W(t.items,0);if(r.length===0)throw new Error("isobmff trim: no usable trim ranges in items");let i=await V(r,t.handles,(o,c)=>H(u(n),n.fileSize,o,c,e.format));return i.map((o,c)=>{let a=JSON.parse(o);return i.length>1&&(a.output_clip_number=c+1,a.output_clip_count=i.length,a.output_part_number=1),a})},async decode(e,t,n){await d();let r=n.detail==="coarse",i=e.parts[0];if(e.format==="crm"){let l=await R(u(i),i.fileSize,t,r?"preview":"full");return s(l)}let o=await Y(e);if(t<0||t>=o.length)throw new _(t,o.length);let c=o[t],a=await i.read(c.offset,c.size);if(e.format==="braw")return s(r?v(a,0):y(a));if(b(a)){let l=await q(e);return s(l?m.decode_prores_raw_tier(a,r?"preview":"full",l):r?P(a,0):x(a))}if(j(a))return s(r?D(a,0):z(a));if(r)return s(S(a,0));let g=await ae(a);return g||s(A(a))},async decode16(e,t){await d();let n=e.parts[0];if(e.format==="crm")throw new Error("crm: no 16-bit decoder");let r=await Y(e);if(t<0||t>=r.length)throw new _(t,r.length);let i=r[t],o=await n.read(i.offset,i.size),c=b(o)?await q(e):null,a=e.format==="braw"?w(o):b(o)?c?m.decode_prores_raw_tier(o,"rgb16",c):M(o):j(o)?(()=>{throw new Error("vc3: no 16-bit decoder")})():F(o);return $(a)}};async function ae(e){if(!U)return null;try{let t=await import("./prores-RIG37OIH.js");if(!await t.proresGpuAvailable())return null;let n=await t.decodeProResRgbaGpu(e);return n?{width:n.width,height:n.height,rgba:n.rgba}:null}catch{return null}}function j(e){return e.length>=4&&e[0]===0&&e[1]===0&&e[2]===2&&e[3]===128}function b(e){return e.length>=8&&e[4]===112&&e[5]===114&&e[6]===114&&e[7]===102}function s(e){let t=new DataView(e.buffer,e.byteOffset,8);return{width:t.getUint32(0,!0),height:t.getUint32(4,!0),rgba:e.slice(8)}}var m=C,X=new WeakMap;function q(e){let t=X.get(e);if(!t){let n=e.parts[0];t=m.prores_raw_container_color&&m.decode_prores_raw_tier?N({fileSize:n.fileSize,read:n.read}).then(r=>{let i=m.prores_raw_container_color(r);return i.length?i:null}):Promise.resolve(null),X.set(e,t)}return t}var K=new WeakMap;async function Y(e){let t=K.get(e);if(!t){let n=e.parts[0],r=J(await k(u(n),n.fileSize,e.format));if(!r.w||!r.h)throw new Error("could not find a video sample table");t=r.offs,K.set(e,t)}return t}export{be as isobmffFormat};
3
+ import{a as N}from"./chunk-TK55FA56.js";import{a as T,b as L}from"./chunk-AACY2V3L.js";import{b as p,c as O,g as J}from"./chunk-XDI6CPPV.js";import{b as V}from"./chunk-7W5AFZYX.js";import{b as $,c as _}from"./chunk-LZRCXSUJ.js";import{$ as f,A as P,B as x,C as F,D as A,Da as k,Ga as C,Ha as U,Ia as d,N as D,O as z,ha as E,k as w,m as v,n as y,p as R,qa as H,ta as I,x as S,y as M}from"./chunk-DPA26AOI.js";import"./chunk-PSANHDZM.js";function u(e){return(t,n)=>e.read(t,n)}function B(e){let t=e.toLowerCase().trim();return t==="aprn"||t==="aprh"?"prores_raw":t==="apch"||t==="apcn"||t==="apcs"||t==="apco"||t==="ap4h"||t==="ap4x"?"prores":t==="avdn"?"dnxhd":t==="dnxh"?"dnxhr":t==="avc1"||t==="avc3"?"h264":t==="hev1"||t==="hvc1"?"h265":t==="braw"?"braw":e}var h={apco:"Proxy",apcs:"LT",apcn:"422",apch:"HQ",ap4h:"4444",ap4x:"4444 XQ"},Z={1:"bt709",2:"unknown",5:"bt470bg",6:"smpte170m",9:"bt2020",11:"smpte431",12:"smpte432"},ee={1:"bt709",2:"unknown",6:"smpte170m",8:"linear",13:"iec61966-2-1",14:"bt2020-10",15:"bt2020-12",16:"smpte2084",18:"arib-std-b67"},re={0:"gbr",1:"bt709",2:"unknown",5:"bt470bg",6:"smpte170m",9:"bt2020nc",10:"bt2020c"};function te(e,t){return e==="ap4h"||e==="ap4x"?t===32?"yuva444p12le":"yuv444p12le":e in h?"yuv422p10le":void 0}var Q={66:"Baseline",77:"Main",88:"Extended",100:"High",110:"High 10",122:"High 4:2:2",244:"High 4:4:4"},G={1:"Main",2:"Main 10",3:"Main Still",4:"Rext"},ne={1270:"DNxHR 444",1271:"DNxHR HQX",1272:"DNxHR HQ",1273:"DNxHR SQ",1274:"DNxHR LB"};function oe(e,t){if(h[e.codec_fourcc])return`ProRes ${h[e.codec_fourcc]}`;if(e.vc3_cid)return ne[e.vc3_cid]??`DNxHD ${e.vc3_cid}`;if(e.video_profile!=null){if(t==="h264"&&Q[e.video_profile])return`H.264 ${Q[e.video_profile]}`;if(t==="h265"&&G[e.video_profile])return`HEVC ${G[e.video_profile]}`}}function ie(e,t){let n=e.video_chroma,r=e.video_bit_depth;if(n==null&&t==="h264"&&[66,77,88].includes(e.video_profile??-1)&&([n,r]=[1,8]),n==null&&e.vc3_cid&&(n=e.vc3_cid===1270||e.vc3_cid===1256?3:2),n==null||r==null)return;let i=["gray","yuv420p","yuv422p","yuv444p"][n];return r>8?`${i}${r}le`:i}function W(e,t){let n=[];for(let r of e){if(r.kind!=="clip"||!r.source_range)continue;let i=r.source_range.start.value,o=r.source_range.duration.value,c=Math.max(0,Math.floor(i)-t),a=Math.floor(i+o-1)+t;a>=c&&n.push({first_frame:c,last_frame:a})}return n}var be={async inspect(e){await d();let t=e.parts[0],n=await f(u(t),t.fileSize,e.format),r=JSON.parse(n);if(!r)return null;let i=r.timecode&&r.timecode.fps_denominator>0?r.timecode.fps_numerator/r.timecode.fps_denominator:null,o=B(r.codec_fourcc),c=[{kind:"video",codec:o,width:r.width??void 0,height:r.height??void 0,rate:i??void 0,bit_depth:p(r.codec_fourcc)??p(o)??O(o,r.video_profile)??r.video_bit_depth??void 0,codec_specific:{fourcc:r.codec_fourcc,profile:oe(r,o),pixel_format:te(r.codec_fourcc,r.video_depth)??ie(r,o),colr:r.colr?{primaries:Z[r.colr.primaries]??r.colr.primaries,transfer:ee[r.colr.transfer]??r.colr.transfer,matrix:re[r.colr.matrix]??r.colr.matrix}:void 0}}];for(let a of r.audio_tracks??(r.audio?[r.audio]:[]))c.push({kind:"audio",codec:a.codec_fourcc,channels:a.channels??void 0,rate:a.sample_rate??void 0,bit_depth:a.bit_depth??void 0,codec_specific:{fourcc:a.codec_fourcc,channel_layout:a.channel_layout??void 0}});return{id:t.filename,kind:"external",target_url:t.filename,available_range:i&&r.duration_seconds?{start:{value:0,rate:i},duration:{value:Math.round(r.duration_seconds*i),rate:i}}:null,reel_name:null,source_timecode:r.timecode?.display??null,container:e.format==="mov"?"mov":e.format,codec:o,size_bytes:t.fileSize,source_fps:i,source_resolution_w:r.width??null,source_resolution_h:r.height??null,streams:c,decode_provenance:r.decode_provenance??null,vendor_metadata:r.timecode?{drop_frame:r.timecode.drop_frame}:{},binding_state:"unbound",raw_extraction:{mov_probe:r},metadata:{}}},async extract(e){await d();let t=e.parts[0],n=JSON.parse(await E(u(t),t.fileSize,e.format));if(n.length===0)return null;let r=JSON.parse(await f(u(t),t.fileSize,e.format)),i=r?B(r.codec_fourcc):e.format,o=r?.timecode&&r.timecode.fps_denominator>0?r.timecode.fps_numerator/r.timecode.fps_denominator:void 0;return{v:1,container:e.format==="mov"?"mov":e.format,codec:i,width:r?.width??void 0,height:r?.height??void 0,fps:o,frame_count:T(n),timecode:r?.timecode?.display??void 0,granularity:L(n),segments:n}},async sparsify(e,t){await d();let n=e.parts[0],r=W(t.items,t.handles),i=await I(u(n),n.fileSize,JSON.stringify(r),e.format),o=JSON.parse(i);return[{filename:n.filename,fileSize:o.fileSize,structuralRanges:o.structuralRanges,essenceRanges:o.essenceRanges,trimInputs:o.trimInputs}]},async trim(e,t){await d();let n=e.parts[0],r=W(t.items,0);if(r.length===0)throw new Error("isobmff trim: no usable trim ranges in items");let i=await V(r,t.handles,(o,c)=>H(u(n),n.fileSize,o,c,e.format));return i.map((o,c)=>{let a=JSON.parse(o);return i.length>1&&(a.output_clip_number=c+1,a.output_clip_count=i.length,a.output_part_number=1),a})},async decode(e,t,n){await d();let r=n.detail==="coarse",i=e.parts[0];if(e.format==="crm"){let l=await R(u(i),i.fileSize,t,r?"preview":"full");return s(l)}let o=await Y(e);if(t<0||t>=o.length)throw new _(t,o.length);let c=o[t],a=await i.read(c.offset,c.size);if(e.format==="braw")return s(r?v(a,0):y(a));if(b(a)){let l=await q(e);return s(l?m.decode_prores_raw_tier(a,r?"preview":"full",l):r?P(a,0):x(a))}if(j(a))return s(r?D(a,0):z(a));if(r)return s(S(a,0));let g=await ae(a);return g||s(A(a))},async decode16(e,t){await d();let n=e.parts[0];if(e.format==="crm")throw new Error("crm: no 16-bit decoder");let r=await Y(e);if(t<0||t>=r.length)throw new _(t,r.length);let i=r[t],o=await n.read(i.offset,i.size),c=b(o)?await q(e):null,a=e.format==="braw"?w(o):b(o)?c?m.decode_prores_raw_tier(o,"rgb16",c):M(o):j(o)?(()=>{throw new Error("vc3: no 16-bit decoder")})():F(o);return $(a)}};async function ae(e){if(!U)return null;try{let t=await import("./prores-RIG37OIH.js");if(!await t.proresGpuAvailable())return null;let n=await t.decodeProResRgbaGpu(e);return n?{width:n.width,height:n.height,rgba:n.rgba}:null}catch{return null}}function j(e){return e.length>=4&&e[0]===0&&e[1]===0&&e[2]===2&&e[3]===128}function b(e){return e.length>=8&&e[4]===112&&e[5]===114&&e[6]===114&&e[7]===102}function s(e){let t=new DataView(e.buffer,e.byteOffset,8);return{width:t.getUint32(0,!0),height:t.getUint32(4,!0),rgba:e.slice(8)}}var m=C,X=new WeakMap;function q(e){let t=X.get(e);if(!t){let n=e.parts[0];t=m.prores_raw_container_color&&m.decode_prores_raw_tier?N({fileSize:n.fileSize,read:n.read}).then(r=>{let i=m.prores_raw_container_color(r);return i.length?i:null}):Promise.resolve(null),X.set(e,t)}return t}var K=new WeakMap;async function Y(e){let t=K.get(e);if(!t){let n=e.parts[0],r=J(await k(u(n),n.fileSize,e.format));if(!r.w||!r.h)throw new Error("could not find a video sample table");t=r.offs,K.set(e,t)}return t}export{be as isobmffFormat};
@@ -1,3 +1,3 @@
1
1
  #!/usr/bin/env node
2
2
  import { createRequire as __conformRequire } from 'node:module'; const require = __conformRequire(import.meta.url);
3
- import{c as b}from"./chunk-6V4OEOOX.js";import"./chunk-RGMTLNMF.js";import{c as w,g as y}from"./chunk-F4PHKOAS.js";import{Ca as l,Ga as p,Ia as h}from"./chunk-DPA26AOI.js";import"./chunk-PSANHDZM.js";var F=72*1024*1024,S=16,m=p;function L(){return typeof m.video_open=="function"&&typeof m.video_decode=="function"}async function P(r,e){if(await h(),!L())return null;try{return JSON.parse(await m.video_open(r,e))}catch{return null}}function k(r){l?.(r)}var u=new WeakMap;function v(r){let e=u.get(r);if(!e){let t=r.parts[0];e=P((n,a)=>t.read(n,a),t.fileSize).then(n=>{if(!n)throw new Error(`mcvideo: media-core has no video decoder for ${t.filename}`);return{info:n,cache:new Map,cacheCoarse:!1,frameBytes:0,queue:Promise.resolve()}}),e.catch(()=>u.delete(r)),u.set(r,e)}return e}async function B(r){try{return(await v(r)).info.frames}catch{return 0}}function _(r){let e=new DataView(r.buffer,r.byteOffset,r.byteLength),t=new Map,n=4;for(let a=e.getUint32(0,!0);a>0&&n+12<=r.length;a--){let s=e.getUint32(n,!0),c=e.getUint32(n+4,!0),i=e.getUint32(n+8,!0),o=c*i*4;if(n+=12,n+o>r.length)break;t.set(s,{width:c,height:i,rgba:r.slice(n,n+o)}),n+=o}return t}async function C(r,e,t){let n=await v(r),{info:a}=n;if(e<0||e>=a.frames)throw new w(e,a.frames);let s=async()=>{let i=t&&a.codec==="dv";n.cacheCoarse!==i&&(n.cache.clear(),n.cacheCoarse=i);let o=n.cache.get(e);if(!o){let g=a.inter?Math.max(1,Math.min(S,n.frameBytes?Math.floor(F/n.frameBytes):4)):1,d=_(await m.video_decode(a.handle,e,Math.min(a.frames,e+g),i));n.cache=d,o=d.get(e),o&&(n.frameBytes=o.rgba.length)}if(!o)throw new Error(`mcvideo: ${a.codec} frame ${e} did not decode`);return n.cache.delete(e),o},c=n.queue.then(s,s);return n.queue=c.catch(()=>{}),c}async function f(r){let e=b(r.parts[0]?.filename??""),t=e?await y(e):null;return t&&e?[t,{...r,format:e}]:null}async function M(r){let e=await f(r);if(!e)throw new Error(`mcvideo: no container module for ${r.parts[0]?.filename} \u2014 ships whole`);return e}var I={async inspect(r){let e=await f(r);return e?e[0].inspect(e[1]):null},async extract(r){let e=await f(r);return e?e[0].extract(e[1]):null},async sparsify(r,e){let[t,n]=await M(r);return t.sparsify(n,e)},async trim(r,e){let[t,n]=await M(r);return t.trim(n,e)},async decode(r,e,{detail:t}){return C(r,e,t==="coarse")}};export{k as closeVideoLane,L as hasVideoLane,I as mcVideoFormat,P as openVideoLane,_ as unpackWindow,B as videoLaneFrames};
3
+ import{c as b}from"./chunk-6V4OEOOX.js";import"./chunk-RGMTLNMF.js";import{c as w,g as y}from"./chunk-LZRCXSUJ.js";import{Ca as l,Ga as p,Ia as h}from"./chunk-DPA26AOI.js";import"./chunk-PSANHDZM.js";var F=72*1024*1024,S=16,m=p;function L(){return typeof m.video_open=="function"&&typeof m.video_decode=="function"}async function P(r,e){if(await h(),!L())return null;try{return JSON.parse(await m.video_open(r,e))}catch{return null}}function k(r){l?.(r)}var u=new WeakMap;function v(r){let e=u.get(r);if(!e){let t=r.parts[0];e=P((n,a)=>t.read(n,a),t.fileSize).then(n=>{if(!n)throw new Error(`mcvideo: media-core has no video decoder for ${t.filename}`);return{info:n,cache:new Map,cacheCoarse:!1,frameBytes:0,queue:Promise.resolve()}}),e.catch(()=>u.delete(r)),u.set(r,e)}return e}async function B(r){try{return(await v(r)).info.frames}catch{return 0}}function _(r){let e=new DataView(r.buffer,r.byteOffset,r.byteLength),t=new Map,n=4;for(let a=e.getUint32(0,!0);a>0&&n+12<=r.length;a--){let s=e.getUint32(n,!0),c=e.getUint32(n+4,!0),i=e.getUint32(n+8,!0),o=c*i*4;if(n+=12,n+o>r.length)break;t.set(s,{width:c,height:i,rgba:r.slice(n,n+o)}),n+=o}return t}async function C(r,e,t){let n=await v(r),{info:a}=n;if(e<0||e>=a.frames)throw new w(e,a.frames);let s=async()=>{let i=t&&a.codec==="dv";n.cacheCoarse!==i&&(n.cache.clear(),n.cacheCoarse=i);let o=n.cache.get(e);if(!o){let g=a.inter?Math.max(1,Math.min(S,n.frameBytes?Math.floor(F/n.frameBytes):4)):1,d=_(await m.video_decode(a.handle,e,Math.min(a.frames,e+g),i));n.cache=d,o=d.get(e),o&&(n.frameBytes=o.rgba.length)}if(!o)throw new Error(`mcvideo: ${a.codec} frame ${e} did not decode`);return n.cache.delete(e),o},c=n.queue.then(s,s);return n.queue=c.catch(()=>{}),c}async function f(r){let e=b(r.parts[0]?.filename??""),t=e?await y(e):null;return t&&e?[t,{...r,format:e}]:null}async function M(r){let e=await f(r);if(!e)throw new Error(`mcvideo: no container module for ${r.parts[0]?.filename} \u2014 ships whole`);return e}var I={async inspect(r){let e=await f(r);return e?e[0].inspect(e[1]):null},async extract(r){let e=await f(r);return e?e[0].extract(e[1]):null},async sparsify(r,e){let[t,n]=await M(r);return t.sparsify(n,e)},async trim(r,e){let[t,n]=await M(r);return t.trim(n,e)},async decode(r,e,{detail:t}){return C(r,e,t==="coarse")}};export{k as closeVideoLane,L as hasVideoLane,I as mcVideoFormat,P as openVideoLane,_ as unpackWindow,B as videoLaneFrames};