@mevdragon/vidfarm-devcli 0.20.5 → 0.20.8

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 (154) hide show
  1. package/.agents/skills/editor-capabilities/SKILL.md +15 -1
  2. package/.agents/skills/vidfarm-director/SKILL.md +106 -0
  3. package/.agents/skills/vidfarm-director/recipes/find-and-fork-template.md +16 -0
  4. package/.agents/skills/vidfarm-director/recipes/local-edit-render-approve.md +13 -0
  5. package/.agents/skills/vidfarm-director/recipes/onboard-a-new-director.md +13 -0
  6. package/.agents/skills/vidfarm-director/recipes/retheme-template.md +17 -0
  7. package/.agents/skills/vidfarm-director/references/assets-and-sourcing.md +111 -0
  8. package/.agents/skills/vidfarm-director/references/automation-and-local-dev.md +243 -0
  9. package/.agents/skills/vidfarm-director/references/core-workflows.md +273 -0
  10. package/.agents/skills/vidfarm-director/references/editor-workflows.md +365 -0
  11. package/.agents/skills/vidfarm-director/references/onboarding.md +28 -0
  12. package/.agents/skills/vidfarm-director/references/primitives.md +265 -0
  13. package/SKILL.director.md +521 -261
  14. package/dist/src/cli.js +404 -96
  15. package/dist/src/devcli/clips.js +15 -10
  16. package/dist/src/devcli/doctor.js +2 -2
  17. package/dist/src/devcli/local-backend.js +46 -2
  18. package/dist/src/services/clip-curation/cost.js +5 -1
  19. package/dist/src/services/clip-curation/gemini.js +10 -0
  20. package/package.json +30 -10
  21. package/SKILL.platform.md +0 -432
  22. package/demo/README.md +0 -28
  23. package/demo/dist/app.css +0 -1
  24. package/demo/dist/app.js +0 -1850
  25. package/demo/dist/chunks/chunk-DXB73IDG.js +0 -1
  26. package/demo/dist/chunks/chunk-S7OWAJDS.js +0 -36
  27. package/demo/dist/chunks/chunk-VTIBZ6AN.js +0 -1
  28. package/demo/dist/chunks/dist-ADSJKBVE.js +0 -332
  29. package/demo/dist/chunks/domEditingLayers-VZMLL4AP-SGHWPND4.js +0 -1
  30. package/demo/dist/chunks/hyperframes-player-XB65TCD6.js +0 -425
  31. package/demo/dist/chunks/lib-XAQ37YOE.js +0 -1
  32. package/demo/dist/chunks/src-TJ2QYA4U.js +0 -207
  33. package/demo/dist/favicon.ico +0 -0
  34. package/demo/dist/icons/timeline/audio.svg +0 -7
  35. package/demo/dist/icons/timeline/captions.svg +0 -5
  36. package/demo/dist/icons/timeline/composition.svg +0 -12
  37. package/demo/dist/icons/timeline/image.svg +0 -18
  38. package/demo/dist/icons/timeline/music.svg +0 -10
  39. package/demo/dist/icons/timeline/text.svg +0 -3
  40. package/demo/dist/index.html +0 -15
  41. package/dist/src/account-pages-legacy.js +0 -9396
  42. package/dist/src/account-pages.js +0 -61
  43. package/dist/src/app.js +0 -21602
  44. package/dist/src/composition-runtime.js +0 -1053
  45. package/dist/src/config.js +0 -217
  46. package/dist/src/context.js +0 -447
  47. package/dist/src/dev-app-legacy.js +0 -739
  48. package/dist/src/dev-app.js +0 -6
  49. package/dist/src/devcli/migrate-local.js +0 -140
  50. package/dist/src/devcli/sync.js +0 -368
  51. package/dist/src/domain.js +0 -5
  52. package/dist/src/editor-chat-history.js +0 -82
  53. package/dist/src/editor-chat.js +0 -756
  54. package/dist/src/editor-dark-theme.js +0 -1128
  55. package/dist/src/frontend/debug.js +0 -71
  56. package/dist/src/frontend/discover-client.js +0 -130
  57. package/dist/src/frontend/discover-store.js +0 -23
  58. package/dist/src/frontend/file-directory.js +0 -1018
  59. package/dist/src/frontend/flockposter-cache-store.js +0 -124
  60. package/dist/src/frontend/homepage-client.js +0 -446
  61. package/dist/src/frontend/homepage-shared.js +0 -201
  62. package/dist/src/frontend/homepage-store.js +0 -66
  63. package/dist/src/frontend/homepage-view.js +0 -705
  64. package/dist/src/frontend/page-runtime-client.js +0 -132
  65. package/dist/src/frontend/page-runtime-store.js +0 -9
  66. package/dist/src/frontend/sentry.js +0 -42
  67. package/dist/src/frontend/template-editor-chat.js +0 -4181
  68. package/dist/src/help-page.js +0 -346
  69. package/dist/src/homepage.js +0 -1458
  70. package/dist/src/index.js +0 -16
  71. package/dist/src/instrument.js +0 -30
  72. package/dist/src/landing-page.js +0 -384
  73. package/dist/src/page-runtime.js +0 -2
  74. package/dist/src/page-shell.js +0 -1452
  75. package/dist/src/primitive-context.js +0 -416
  76. package/dist/src/primitive-registry.js +0 -3940
  77. package/dist/src/primitive-sdk.js +0 -4
  78. package/dist/src/primitives/hyperframes-media.js +0 -108
  79. package/dist/src/react-page-shell.js +0 -35
  80. package/dist/src/ready-post-schedule-component.js +0 -1540
  81. package/dist/src/registry.js +0 -296
  82. package/dist/src/reskin/agency-page.js +0 -299
  83. package/dist/src/reskin/calendar-page.js +0 -568
  84. package/dist/src/reskin/chat-page.js +0 -942
  85. package/dist/src/reskin/discover-page.js +0 -1788
  86. package/dist/src/reskin/document.js +0 -1587
  87. package/dist/src/reskin/help-page.js +0 -357
  88. package/dist/src/reskin/index-page.js +0 -62
  89. package/dist/src/reskin/inpaint-clipper-page.js +0 -890
  90. package/dist/src/reskin/inpaint-page.js +0 -2554
  91. package/dist/src/reskin/inpaint-video-page.js +0 -1339
  92. package/dist/src/reskin/job-runs-page.js +0 -477
  93. package/dist/src/reskin/library-page.js +0 -1634
  94. package/dist/src/reskin/login-page.js +0 -262
  95. package/dist/src/reskin/portfolio-page.js +0 -687
  96. package/dist/src/reskin/pricing-page.js +0 -390
  97. package/dist/src/reskin/settings-page.js +0 -732
  98. package/dist/src/reskin/theme.js +0 -711
  99. package/dist/src/runtime.js +0 -35
  100. package/dist/src/services/api-call-history.js +0 -249
  101. package/dist/src/services/auth.js +0 -152
  102. package/dist/src/services/billing-pricing.js +0 -39
  103. package/dist/src/services/billing.js +0 -241
  104. package/dist/src/services/cast.js +0 -127
  105. package/dist/src/services/chat-threads.js +0 -92
  106. package/dist/src/services/clip-records.js +0 -250
  107. package/dist/src/services/clip-search.js +0 -77
  108. package/dist/src/services/clip-vectors.js +0 -125
  109. package/dist/src/services/composition-sanitize.js +0 -124
  110. package/dist/src/services/composition-watch.js +0 -79
  111. package/dist/src/services/elevenlabs.js +0 -222
  112. package/dist/src/services/file-directory.js +0 -117
  113. package/dist/src/services/fork-access.js +0 -93
  114. package/dist/src/services/fork-manifest.js +0 -42
  115. package/dist/src/services/ghostcut.js +0 -179
  116. package/dist/src/services/hyperframes.js +0 -3517
  117. package/dist/src/services/job-capacity.js +0 -14
  118. package/dist/src/services/job-logs.js +0 -197
  119. package/dist/src/services/jobs.js +0 -136
  120. package/dist/src/services/local-dynamo.js +0 -0
  121. package/dist/src/services/media-processing.js +0 -766
  122. package/dist/src/services/primitive-media-lambda.js +0 -280
  123. package/dist/src/services/providers.js +0 -2748
  124. package/dist/src/services/rate-limits.js +0 -262
  125. package/dist/src/services/scene-annotations.js +0 -32
  126. package/dist/src/services/serverless-auth.js +0 -382
  127. package/dist/src/services/serverless-jobs.js +0 -1084
  128. package/dist/src/services/serverless-provider-keys.js +0 -409
  129. package/dist/src/services/serverless-records.js +0 -1515
  130. package/dist/src/services/serverless-template-configs.js +0 -75
  131. package/dist/src/services/storage.js +0 -461
  132. package/dist/src/services/swipe-customize.js +0 -437
  133. package/dist/src/services/template-certification.js +0 -413
  134. package/dist/src/services/template-loader.js +0 -99
  135. package/dist/src/services/template-runtime-bundles.js +0 -217
  136. package/dist/src/services/template-sources.js +0 -1017
  137. package/dist/src/services/upstream.js +0 -248
  138. package/dist/src/services/video-normalization.js +0 -2
  139. package/dist/src/services/webhooks.js +0 -62
  140. package/dist/src/template-editor-pages.js +0 -2576
  141. package/dist/src/template-editor-shell.js +0 -2893
  142. package/dist/src/template-sdk.js +0 -4
  143. package/dist/src/worker.js +0 -17
  144. package/public/assets/discover-client-app.js +0 -1
  145. package/public/assets/file-directory-app.js +0 -3
  146. package/public/assets/homepage-app.js +0 -54
  147. package/public/assets/homepage-client-app.js +0 -80
  148. package/public/assets/page-runtime-client-app.js +0 -94
  149. package/public/assets/placeholders/scene-placeholder.png +0 -0
  150. package/src/assets/SELLING_AWARENESS_STAGES.md +0 -579
  151. package/src/assets/SELLING_WITH_HOOKS.md +0 -377
  152. package/src/assets/SELLING_WITH_VSLS.md +0 -606
  153. package/src/assets/favicon.ico +0 -0
  154. package/src/assets/logo-vidfarm.png +0 -0
package/demo/dist/app.js DELETED
@@ -1,1850 +0,0 @@
1
- import{a as za,b as kP,c as Cg}from"./chunks/chunk-S7OWAJDS.js";import{c as Rg,d as rv,e as so}from"./chunks/chunk-DXB73IDG.js";var nD=Rg(Vt=>{"use strict";function lw(e,t){var n=e.length;e.push(t);e:for(;0<n;){var r=n-1>>>1,o=e[r];if(0<Yy(o,t))e[r]=t,e[n]=o,n=r;else break e}}function Oi(e){return e.length===0?null:e[0]}function Xy(e){if(e.length===0)return null;var t=e[0],n=e.pop();if(n!==t){e[0]=n;e:for(var r=0,o=e.length,i=o>>>1;r<i;){var a=2*(r+1)-1,s=e[a],l=a+1,c=e[l];if(0>Yy(s,n))l<o&&0>Yy(c,s)?(e[r]=c,e[l]=n,r=l):(e[r]=s,e[a]=n,r=a);else if(l<o&&0>Yy(c,n))e[r]=c,e[l]=n,r=l;else break e}}return t}function Yy(e,t){var n=e.sortIndex-t.sortIndex;return n!==0?n:e.id-t.id}Vt.unstable_now=void 0;typeof performance=="object"&&typeof performance.now=="function"?(W5=performance,Vt.unstable_now=function(){return W5.now()}):(iw=Date,Y5=iw.now(),Vt.unstable_now=function(){return iw.now()-Y5});var W5,iw,Y5,ma=[],Ss=[],jY=1,ko=null,rr=3,cw=!1,Qp=!1,Zp=!1,uw=!1,J5=typeof setTimeout=="function"?setTimeout:null,Q5=typeof clearTimeout=="function"?clearTimeout:null,K5=typeof setImmediate<"u"?setImmediate:null;function Ky(e){for(var t=Oi(Ss);t!==null;){if(t.callback===null)Xy(Ss);else if(t.startTime<=e)Xy(Ss),t.sortIndex=t.expirationTime,lw(ma,t);else break;t=Oi(Ss)}}function dw(e){if(Zp=!1,Ky(e),!Qp)if(Oi(ma)!==null)Qp=!0,vd||(vd=!0,_d());else{var t=Oi(Ss);t!==null&&fw(dw,t.startTime-e)}}var vd=!1,em=-1,Z5=5,eD=-1;function tD(){return uw?!0:!(Vt.unstable_now()-eD<Z5)}function aw(){if(uw=!1,vd){var e=Vt.unstable_now();eD=e;var t=!0;try{e:{Qp=!1,Zp&&(Zp=!1,Q5(em),em=-1),cw=!0;var n=rr;try{t:{for(Ky(e),ko=Oi(ma);ko!==null&&!(ko.expirationTime>e&&tD());){var r=ko.callback;if(typeof r=="function"){ko.callback=null,rr=ko.priorityLevel;var o=r(ko.expirationTime<=e);if(e=Vt.unstable_now(),typeof o=="function"){ko.callback=o,Ky(e),t=!0;break t}ko===Oi(ma)&&Xy(ma),Ky(e)}else Xy(ma);ko=Oi(ma)}if(ko!==null)t=!0;else{var i=Oi(Ss);i!==null&&fw(dw,i.startTime-e),t=!1}}break e}finally{ko=null,rr=n,cw=!1}t=void 0}}finally{t?_d():vd=!1}}}var _d;typeof K5=="function"?_d=function(){K5(aw)}:typeof MessageChannel<"u"?(sw=new MessageChannel,X5=sw.port2,sw.port1.onmessage=aw,_d=function(){X5.postMessage(null)}):_d=function(){J5(aw,0)};var sw,X5;function fw(e,t){em=J5(function(){e(Vt.unstable_now())},t)}Vt.unstable_IdlePriority=5;Vt.unstable_ImmediatePriority=1;Vt.unstable_LowPriority=4;Vt.unstable_NormalPriority=3;Vt.unstable_Profiling=null;Vt.unstable_UserBlockingPriority=2;Vt.unstable_cancelCallback=function(e){e.callback=null};Vt.unstable_forceFrameRate=function(e){0>e||125<e?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):Z5=0<e?Math.floor(1e3/e):5};Vt.unstable_getCurrentPriorityLevel=function(){return rr};Vt.unstable_next=function(e){switch(rr){case 1:case 2:case 3:var t=3;break;default:t=rr}var n=rr;rr=t;try{return e()}finally{rr=n}};Vt.unstable_requestPaint=function(){uw=!0};Vt.unstable_runWithPriority=function(e,t){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var n=rr;rr=e;try{return t()}finally{rr=n}};Vt.unstable_scheduleCallback=function(e,t,n){var r=Vt.unstable_now();switch(typeof n=="object"&&n!==null?(n=n.delay,n=typeof n=="number"&&0<n?r+n:r):n=r,e){case 1:var o=-1;break;case 2:o=250;break;case 5:o=1073741823;break;case 4:o=1e4;break;default:o=5e3}return o=n+o,e={id:jY++,callback:t,priorityLevel:e,startTime:n,expirationTime:o,sortIndex:-1},n>r?(e.sortIndex=n,lw(Ss,e),Oi(ma)===null&&e===Oi(Ss)&&(Zp?(Q5(em),em=-1):Zp=!0,fw(dw,n-r))):(e.sortIndex=o,lw(ma,e),Qp||cw||(Qp=!0,vd||(vd=!0,_d()))),e};Vt.unstable_shouldYield=tD;Vt.unstable_wrapCallback=function(e){var t=rr;return function(){var n=rr;rr=t;try{return e.apply(this,arguments)}finally{rr=n}}}});var oD=Rg((CEe,rD)=>{"use strict";rD.exports=nD()});var h6=Rg(S_=>{"use strict";var kn=oD(),RL=za(),qY=kP();function Y(e){var t="https://react.dev/errors/"+e;if(1<arguments.length){t+="?args[]="+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+="&args[]="+encodeURIComponent(arguments[n])}return"Minified React error #"+e+"; visit "+t+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function CL(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function Fm(e){var t=e,n=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,(t.flags&4098)!==0&&(n=t.return),e=t.return;while(e)}return t.tag===3?n:null}function ML(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function OL(e){if(e.tag===31){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function iD(e){if(Fm(e)!==e)throw Error(Y(188))}function VY(e){var t=e.alternate;if(!t){if(t=Fm(e),t===null)throw Error(Y(188));return t!==e?null:e}for(var n=e,r=t;;){var o=n.return;if(o===null)break;var i=o.alternate;if(i===null){if(r=o.return,r!==null){n=r;continue}break}if(o.child===i.child){for(i=o.child;i;){if(i===n)return iD(o),e;if(i===r)return iD(o),t;i=i.sibling}throw Error(Y(188))}if(n.return!==r.return)n=o,r=i;else{for(var a=!1,s=o.child;s;){if(s===n){a=!0,n=o,r=i;break}if(s===r){a=!0,r=o,n=i;break}s=s.sibling}if(!a){for(s=i.child;s;){if(s===n){a=!0,n=i,r=o;break}if(s===r){a=!0,r=i,n=o;break}s=s.sibling}if(!a)throw Error(Y(189))}}if(n.alternate!==r)throw Error(Y(190))}if(n.tag!==3)throw Error(Y(188));return n.stateNode.current===n?e:t}function DL(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=DL(e),t!==null)return t;e=e.sibling}return null}var Bt=Object.assign,WY=Symbol.for("react.element"),Jy=Symbol.for("react.transitional.element"),lm=Symbol.for("react.portal"),kd=Symbol.for("react.fragment"),LL=Symbol.for("react.strict_mode"),Vw=Symbol.for("react.profiler"),UL=Symbol.for("react.consumer"),Ea=Symbol.for("react.context"),Hx=Symbol.for("react.forward_ref"),Ww=Symbol.for("react.suspense"),Yw=Symbol.for("react.suspense_list"),Gx=Symbol.for("react.memo"),Es=Symbol.for("react.lazy");Symbol.for("react.scope");var Kw=Symbol.for("react.activity");Symbol.for("react.legacy_hidden");Symbol.for("react.tracing_marker");var YY=Symbol.for("react.memo_cache_sentinel");Symbol.for("react.view_transition");var aD=Symbol.iterator;function tm(e){return e===null||typeof e!="object"?null:(e=aD&&e[aD]||e["@@iterator"],typeof e=="function"?e:null)}var KY=Symbol.for("react.client.reference");function Xw(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===KY?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case kd:return"Fragment";case Vw:return"Profiler";case LL:return"StrictMode";case Ww:return"Suspense";case Yw:return"SuspenseList";case Kw:return"Activity"}if(typeof e=="object")switch(e.$$typeof){case lm:return"Portal";case Ea:return e.displayName||"Context";case UL:return(e._context.displayName||"Context")+".Consumer";case Hx:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case Gx:return t=e.displayName||null,t!==null?t:Xw(e.type)||"Memo";case Es:t=e._payload,e=e._init;try{return Xw(e(t))}catch{}}return null}var cm=Array.isArray,Ne=RL.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,gt=qY.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,rc={pending:!1,data:null,method:null,action:null},Jw=[],Ad=-1;function Bi(e){return{current:e}}function Pn(e){0>Ad||(e.current=Jw[Ad],Jw[Ad]=null,Ad--)}function Ot(e,t){Ad++,Jw[Ad]=e.current,e.current=t}var Pi=Bi(null),km=Bi(null),Os=Bi(null),R0=Bi(null);function C0(e,t){switch(Ot(Os,t),Ot(km,e),Ot(Pi,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?pL(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=pL(t),e=n6(t,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}Pn(Pi),Ot(Pi,e)}function qd(){Pn(Pi),Pn(km),Pn(Os)}function Qw(e){e.memoizedState!==null&&Ot(R0,e);var t=Pi.current,n=n6(t,e.type);t!==n&&(Ot(km,e),Ot(Pi,n))}function M0(e){km.current===e&&(Pn(Pi),Pn(km)),R0.current===e&&(Pn(R0),Pm._currentValue=rc)}var pw,sD;function Zl(e){if(pw===void 0)try{throw Error()}catch(n){var t=n.stack.trim().match(/\n( *(at )?)/);pw=t&&t[1]||"",sD=-1<n.stack.indexOf(`
2
- at`)?" (<anonymous>)":-1<n.stack.indexOf("@")?"@unknown:0:0":""}return`
3
- `+pw+e+sD}var mw=!1;function gw(e,t){if(!e||mw)return"";mw=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var r={DetermineComponentFrameRoot:function(){try{if(t){var u=function(){throw Error()};if(Object.defineProperty(u.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(u,[])}catch(p){var m=p}Reflect.construct(e,[],u)}else{try{u.call()}catch(p){m=p}e.call(u.prototype)}}else{try{throw Error()}catch(p){m=p}(u=e())&&typeof u.catch=="function"&&u.catch(function(){})}}catch(p){if(p&&m&&typeof p.stack=="string")return[p.stack,m.stack]}return[null,null]}};r.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var o=Object.getOwnPropertyDescriptor(r.DetermineComponentFrameRoot,"name");o&&o.configurable&&Object.defineProperty(r.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var i=r.DetermineComponentFrameRoot(),a=i[0],s=i[1];if(a&&s){var l=a.split(`
4
- `),c=s.split(`
5
- `);for(o=r=0;r<l.length&&!l[r].includes("DetermineComponentFrameRoot");)r++;for(;o<c.length&&!c[o].includes("DetermineComponentFrameRoot");)o++;if(r===l.length||o===c.length)for(r=l.length-1,o=c.length-1;1<=r&&0<=o&&l[r]!==c[o];)o--;for(;1<=r&&0<=o;r--,o--)if(l[r]!==c[o]){if(r!==1||o!==1)do if(r--,o--,0>o||l[r]!==c[o]){var d=`
6
- `+l[r].replace(" at new "," at ");return e.displayName&&d.includes("<anonymous>")&&(d=d.replace("<anonymous>",e.displayName)),d}while(1<=r&&0<=o);break}}}finally{mw=!1,Error.prepareStackTrace=n}return(n=e?e.displayName||e.name:"")?Zl(n):""}function XY(e,t){switch(e.tag){case 26:case 27:case 5:return Zl(e.type);case 16:return Zl("Lazy");case 13:return e.child!==t&&t!==null?Zl("Suspense Fallback"):Zl("Suspense");case 19:return Zl("SuspenseList");case 0:case 15:return gw(e.type,!1);case 11:return gw(e.type.render,!1);case 1:return gw(e.type,!0);case 31:return Zl("Activity");default:return""}}function lD(e){try{var t="",n=null;do t+=XY(e,n),n=e,e=e.return;while(e);return t}catch(r){return`
7
- Error generating stack: `+r.message+`
8
- `+r.stack}}var Zw=Object.prototype.hasOwnProperty,$x=kn.unstable_scheduleCallback,hw=kn.unstable_cancelCallback,JY=kn.unstable_shouldYield,QY=kn.unstable_requestPaint,Jr=kn.unstable_now,ZY=kn.unstable_getCurrentPriorityLevel,PL=kn.unstable_ImmediatePriority,BL=kn.unstable_UserBlockingPriority,O0=kn.unstable_NormalPriority,eK=kn.unstable_LowPriority,zL=kn.unstable_IdlePriority,tK=kn.log,nK=kn.unstable_setDisableYieldValue,Hm=null,Qr=null;function Is(e){if(typeof tK=="function"&&nK(e),Qr&&typeof Qr.setStrictMode=="function")try{Qr.setStrictMode(Hm,e)}catch{}}var Zr=Math.clz32?Math.clz32:iK,rK=Math.log,oK=Math.LN2;function iK(e){return e>>>=0,e===0?32:31-(rK(e)/oK|0)|0}var Qy=256,Zy=262144,e0=4194304;function ec(e){var t=e&42;if(t!==0)return t;switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return e&261888;case 262144:case 524288:case 1048576:case 2097152:return e&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return e&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return e}}function i_(e,t,n){var r=e.pendingLanes;if(r===0)return 0;var o=0,i=e.suspendedLanes,a=e.pingedLanes;e=e.warmLanes;var s=r&134217727;return s!==0?(r=s&~i,r!==0?o=ec(r):(a&=s,a!==0?o=ec(a):n||(n=s&~e,n!==0&&(o=ec(n))))):(s=r&~i,s!==0?o=ec(s):a!==0?o=ec(a):n||(n=r&~e,n!==0&&(o=ec(n)))),o===0?0:t!==0&&t!==o&&(t&i)===0&&(i=o&-o,n=t&-t,i>=n||i===32&&(n&4194048)!==0)?t:o}function Gm(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function aK(e,t){switch(e){case 1:case 2:case 4:case 8:case 64:return t+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function FL(){var e=e0;return e0<<=1,(e0&62914560)===0&&(e0=4194304),e}function bw(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function $m(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function sK(e,t,n,r,o,i){var a=e.pendingLanes;e.pendingLanes=n,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=n,e.entangledLanes&=n,e.errorRecoveryDisabledLanes&=n,e.shellSuspendCounter=0;var s=e.entanglements,l=e.expirationTimes,c=e.hiddenUpdates;for(n=a&~n;0<n;){var d=31-Zr(n),u=1<<d;s[d]=0,l[d]=-1;var m=c[d];if(m!==null)for(c[d]=null,d=0;d<m.length;d++){var p=m[d];p!==null&&(p.lane&=-536870913)}n&=~u}r!==0&&HL(e,r,0),i!==0&&o===0&&e.tag!==0&&(e.suspendedLanes|=i&~(a&~t))}function HL(e,t,n){e.pendingLanes|=t,e.suspendedLanes&=~t;var r=31-Zr(t);e.entangledLanes|=t,e.entanglements[r]=e.entanglements[r]|1073741824|n&261930}function GL(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var r=31-Zr(n),o=1<<r;o&t|e[r]&t&&(e[r]|=t),n&=~o}}function $L(e,t){var n=t&-t;return n=(n&42)!==0?1:jx(n),(n&(e.suspendedLanes|t))!==0?0:n}function jx(e){switch(e){case 2:e=1;break;case 8:e=4;break;case 32:e=16;break;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:e=128;break;case 268435456:e=134217728;break;default:e=0}return e}function qx(e){return e&=-e,2<e?8<e?(e&134217727)!==0?32:268435456:8:2}function jL(){var e=gt.p;return e!==0?e:(e=window.event,e===void 0?32:p6(e.type))}function cD(e,t){var n=gt.p;try{return gt.p=e,t()}finally{gt.p=n}}var Vs=Math.random().toString(36).slice(2),Hn="__reactFiber$"+Vs,Or="__reactProps$"+Vs,nf="__reactContainer$"+Vs,ex="__reactEvents$"+Vs,lK="__reactListeners$"+Vs,cK="__reactHandles$"+Vs,uD="__reactResources$"+Vs,jm="__reactMarker$"+Vs;function Vx(e){delete e[Hn],delete e[Or],delete e[ex],delete e[lK],delete e[cK]}function Id(e){var t=e[Hn];if(t)return t;for(var n=e.parentNode;n;){if(t=n[nf]||n[Hn]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=yL(e);e!==null;){if(n=e[Hn])return n;e=yL(e)}return t}e=n,n=e.parentNode}return null}function rf(e){if(e=e[Hn]||e[nf]){var t=e.tag;if(t===5||t===6||t===13||t===31||t===26||t===27||t===3)return e}return null}function um(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e.stateNode;throw Error(Y(33))}function Bd(e){var t=e[uD];return t||(t=e[uD]={hoistableStyles:new Map,hoistableScripts:new Map}),t}function Un(e){e[jm]=!0}var qL=new Set,VL={};function pc(e,t){Vd(e,t),Vd(e+"Capture",t)}function Vd(e,t){for(VL[e]=t,e=0;e<t.length;e++)qL.add(t[e])}var uK=RegExp("^[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD][:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$"),dD={},fD={};function dK(e){return Zw.call(fD,e)?!0:Zw.call(dD,e)?!1:uK.test(e)?fD[e]=!0:(dD[e]=!0,!1)}function g0(e,t,n){if(dK(t))if(n===null)e.removeAttribute(t);else{switch(typeof n){case"undefined":case"function":case"symbol":e.removeAttribute(t);return;case"boolean":var r=t.toLowerCase().slice(0,5);if(r!=="data-"&&r!=="aria-"){e.removeAttribute(t);return}}e.setAttribute(t,""+n)}}function t0(e,t,n){if(n===null)e.removeAttribute(t);else{switch(typeof n){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(t);return}e.setAttribute(t,""+n)}}function ga(e,t,n,r){if(r===null)e.removeAttribute(n);else{switch(typeof r){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(n);return}e.setAttributeNS(t,n,""+r)}}function Io(e){switch(typeof e){case"bigint":case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function WL(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function fK(e,t,n){var r=Object.getOwnPropertyDescriptor(e.constructor.prototype,t);if(!e.hasOwnProperty(t)&&typeof r<"u"&&typeof r.get=="function"&&typeof r.set=="function"){var o=r.get,i=r.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return o.call(this)},set:function(a){n=""+a,i.call(this,a)}}),Object.defineProperty(e,t,{enumerable:r.enumerable}),{getValue:function(){return n},setValue:function(a){n=""+a},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function tx(e){if(!e._valueTracker){var t=WL(e)?"checked":"value";e._valueTracker=fK(e,t,""+e[t])}}function YL(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=WL(e)?e.checked?"true":"false":e.value),e=r,e!==n?(t.setValue(e),!0):!1}function D0(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}var pK=/[\n"\\]/g;function Co(e){return e.replace(pK,function(t){return"\\"+t.charCodeAt(0).toString(16)+" "})}function nx(e,t,n,r,o,i,a,s){e.name="",a!=null&&typeof a!="function"&&typeof a!="symbol"&&typeof a!="boolean"?e.type=a:e.removeAttribute("type"),t!=null?a==="number"?(t===0&&e.value===""||e.value!=t)&&(e.value=""+Io(t)):e.value!==""+Io(t)&&(e.value=""+Io(t)):a!=="submit"&&a!=="reset"||e.removeAttribute("value"),t!=null?rx(e,a,Io(t)):n!=null?rx(e,a,Io(n)):r!=null&&e.removeAttribute("value"),o==null&&i!=null&&(e.defaultChecked=!!i),o!=null&&(e.checked=o&&typeof o!="function"&&typeof o!="symbol"),s!=null&&typeof s!="function"&&typeof s!="symbol"&&typeof s!="boolean"?e.name=""+Io(s):e.removeAttribute("name")}function KL(e,t,n,r,o,i,a,s){if(i!=null&&typeof i!="function"&&typeof i!="symbol"&&typeof i!="boolean"&&(e.type=i),t!=null||n!=null){if(!(i!=="submit"&&i!=="reset"||t!=null)){tx(e);return}n=n!=null?""+Io(n):"",t=t!=null?""+Io(t):n,s||t===e.value||(e.value=t),e.defaultValue=t}r=r??o,r=typeof r!="function"&&typeof r!="symbol"&&!!r,e.checked=s?e.checked:!!r,e.defaultChecked=!!r,a!=null&&typeof a!="function"&&typeof a!="symbol"&&typeof a!="boolean"&&(e.name=a),tx(e)}function rx(e,t,n){t==="number"&&D0(e.ownerDocument)===e||e.defaultValue===""+n||(e.defaultValue=""+n)}function zd(e,t,n,r){if(e=e.options,t){t={};for(var o=0;o<n.length;o++)t["$"+n[o]]=!0;for(n=0;n<e.length;n++)o=t.hasOwnProperty("$"+e[n].value),e[n].selected!==o&&(e[n].selected=o),o&&r&&(e[n].defaultSelected=!0)}else{for(n=""+Io(n),t=null,o=0;o<e.length;o++){if(e[o].value===n){e[o].selected=!0,r&&(e[o].defaultSelected=!0);return}t!==null||e[o].disabled||(t=e[o])}t!==null&&(t.selected=!0)}}function XL(e,t,n){if(t!=null&&(t=""+Io(t),t!==e.value&&(e.value=t),n==null)){e.defaultValue!==t&&(e.defaultValue=t);return}e.defaultValue=n!=null?""+Io(n):""}function JL(e,t,n,r){if(t==null){if(r!=null){if(n!=null)throw Error(Y(92));if(cm(r)){if(1<r.length)throw Error(Y(93));r=r[0]}n=r}n==null&&(n=""),t=n}n=Io(t),e.defaultValue=n,r=e.textContent,r===n&&r!==""&&r!==null&&(e.value=r),tx(e)}function Wd(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var mK=new Set("animationIterationCount aspectRatio borderImageOutset borderImageSlice borderImageWidth boxFlex boxFlexGroup boxOrdinalGroup columnCount columns flex flexGrow flexPositive flexShrink flexNegative flexOrder gridArea gridRow gridRowEnd gridRowSpan gridRowStart gridColumn gridColumnEnd gridColumnSpan gridColumnStart fontWeight lineClamp lineHeight opacity order orphans scale tabSize widows zIndex zoom fillOpacity floodOpacity stopOpacity strokeDasharray strokeDashoffset strokeMiterlimit strokeOpacity strokeWidth MozAnimationIterationCount MozBoxFlex MozBoxFlexGroup MozLineClamp msAnimationIterationCount msFlex msZoom msFlexGrow msFlexNegative msFlexOrder msFlexPositive msFlexShrink msGridColumn msGridColumnSpan msGridRow msGridRowSpan WebkitAnimationIterationCount WebkitBoxFlex WebKitBoxFlexGroup WebkitBoxOrdinalGroup WebkitColumnCount WebkitColumns WebkitFlex WebkitFlexGrow WebkitFlexPositive WebkitFlexShrink WebkitLineClamp".split(" "));function pD(e,t,n){var r=t.indexOf("--")===0;n==null||typeof n=="boolean"||n===""?r?e.setProperty(t,""):t==="float"?e.cssFloat="":e[t]="":r?e.setProperty(t,n):typeof n!="number"||n===0||mK.has(t)?t==="float"?e.cssFloat=n:e[t]=(""+n).trim():e[t]=n+"px"}function QL(e,t,n){if(t!=null&&typeof t!="object")throw Error(Y(62));if(e=e.style,n!=null){for(var r in n)!n.hasOwnProperty(r)||t!=null&&t.hasOwnProperty(r)||(r.indexOf("--")===0?e.setProperty(r,""):r==="float"?e.cssFloat="":e[r]="");for(var o in t)r=t[o],t.hasOwnProperty(o)&&n[o]!==r&&pD(e,o,r)}else for(var i in t)t.hasOwnProperty(i)&&pD(e,i,t[i])}function Wx(e){if(e.indexOf("-")===-1)return!1;switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var gK=new Map([["acceptCharset","accept-charset"],["htmlFor","for"],["httpEquiv","http-equiv"],["crossOrigin","crossorigin"],["accentHeight","accent-height"],["alignmentBaseline","alignment-baseline"],["arabicForm","arabic-form"],["baselineShift","baseline-shift"],["capHeight","cap-height"],["clipPath","clip-path"],["clipRule","clip-rule"],["colorInterpolation","color-interpolation"],["colorInterpolationFilters","color-interpolation-filters"],["colorProfile","color-profile"],["colorRendering","color-rendering"],["dominantBaseline","dominant-baseline"],["enableBackground","enable-background"],["fillOpacity","fill-opacity"],["fillRule","fill-rule"],["floodColor","flood-color"],["floodOpacity","flood-opacity"],["fontFamily","font-family"],["fontSize","font-size"],["fontSizeAdjust","font-size-adjust"],["fontStretch","font-stretch"],["fontStyle","font-style"],["fontVariant","font-variant"],["fontWeight","font-weight"],["glyphName","glyph-name"],["glyphOrientationHorizontal","glyph-orientation-horizontal"],["glyphOrientationVertical","glyph-orientation-vertical"],["horizAdvX","horiz-adv-x"],["horizOriginX","horiz-origin-x"],["imageRendering","image-rendering"],["letterSpacing","letter-spacing"],["lightingColor","lighting-color"],["markerEnd","marker-end"],["markerMid","marker-mid"],["markerStart","marker-start"],["overlinePosition","overline-position"],["overlineThickness","overline-thickness"],["paintOrder","paint-order"],["panose-1","panose-1"],["pointerEvents","pointer-events"],["renderingIntent","rendering-intent"],["shapeRendering","shape-rendering"],["stopColor","stop-color"],["stopOpacity","stop-opacity"],["strikethroughPosition","strikethrough-position"],["strikethroughThickness","strikethrough-thickness"],["strokeDasharray","stroke-dasharray"],["strokeDashoffset","stroke-dashoffset"],["strokeLinecap","stroke-linecap"],["strokeLinejoin","stroke-linejoin"],["strokeMiterlimit","stroke-miterlimit"],["strokeOpacity","stroke-opacity"],["strokeWidth","stroke-width"],["textAnchor","text-anchor"],["textDecoration","text-decoration"],["textRendering","text-rendering"],["transformOrigin","transform-origin"],["underlinePosition","underline-position"],["underlineThickness","underline-thickness"],["unicodeBidi","unicode-bidi"],["unicodeRange","unicode-range"],["unitsPerEm","units-per-em"],["vAlphabetic","v-alphabetic"],["vHanging","v-hanging"],["vIdeographic","v-ideographic"],["vMathematical","v-mathematical"],["vectorEffect","vector-effect"],["vertAdvY","vert-adv-y"],["vertOriginX","vert-origin-x"],["vertOriginY","vert-origin-y"],["wordSpacing","word-spacing"],["writingMode","writing-mode"],["xmlnsXlink","xmlns:xlink"],["xHeight","x-height"]]),hK=/^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*:/i;function h0(e){return hK.test(""+e)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":e}function Ta(){}var ox=null;function Yx(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Nd=null,Fd=null;function mD(e){var t=rf(e);if(t&&(e=t.stateNode)){var n=e[Or]||null;e:switch(e=t.stateNode,t.type){case"input":if(nx(e,n.value,n.defaultValue,n.defaultValue,n.checked,n.defaultChecked,n.type,n.name),t=n.name,n.type==="radio"&&t!=null){for(n=e;n.parentNode;)n=n.parentNode;for(n=n.querySelectorAll('input[name="'+Co(""+t)+'"][type="radio"]'),t=0;t<n.length;t++){var r=n[t];if(r!==e&&r.form===e.form){var o=r[Or]||null;if(!o)throw Error(Y(90));nx(r,o.value,o.defaultValue,o.defaultValue,o.checked,o.defaultChecked,o.type,o.name)}}for(t=0;t<n.length;t++)r=n[t],r.form===e.form&&YL(r)}break e;case"textarea":XL(e,n.value,n.defaultValue);break e;case"select":t=n.value,t!=null&&zd(e,!!n.multiple,t,!1)}}}var yw=!1;function ZL(e,t,n){if(yw)return e(t,n);yw=!0;try{var r=e(t);return r}finally{if(yw=!1,(Nd!==null||Fd!==null)&&(b_(),Nd&&(t=Nd,e=Fd,Fd=Nd=null,mD(t),e)))for(t=0;t<e.length;t++)mD(e[t])}}function Am(e,t){var n=e.stateNode;if(n===null)return null;var r=n[Or]||null;if(r===null)return null;n=r[t];e:switch(t){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(r=!r.disabled)||(e=e.type,r=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!r;break e;default:e=!1}if(e)return null;if(n&&typeof n!="function")throw Error(Y(231,t,typeof n));return n}var Ia=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),ix=!1;if(Ia)try{Sd={},Object.defineProperty(Sd,"passive",{get:function(){ix=!0}}),window.addEventListener("test",Sd,Sd),window.removeEventListener("test",Sd,Sd)}catch{ix=!1}var Sd,Ns=null,Kx=null,b0=null;function e3(){if(b0)return b0;var e,t=Kx,n=t.length,r,o="value"in Ns?Ns.value:Ns.textContent,i=o.length;for(e=0;e<n&&t[e]===o[e];e++);var a=n-e;for(r=1;r<=a&&t[n-r]===o[i-r];r++);return b0=o.slice(e,1<r?1-r:void 0)}function y0(e){var t=e.keyCode;return"charCode"in e?(e=e.charCode,e===0&&t===13&&(e=13)):e=t,e===10&&(e=13),32<=e||e===13?e:0}function n0(){return!0}function gD(){return!1}function Dr(e){function t(n,r,o,i,a){this._reactName=n,this._targetInst=o,this.type=r,this.nativeEvent=i,this.target=a,this.currentTarget=null;for(var s in e)e.hasOwnProperty(s)&&(n=e[s],this[s]=n?n(i):i[s]);return this.isDefaultPrevented=(i.defaultPrevented!=null?i.defaultPrevented:i.returnValue===!1)?n0:gD,this.isPropagationStopped=gD,this}return Bt(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var n=this.nativeEvent;n&&(n.preventDefault?n.preventDefault():typeof n.returnValue!="unknown"&&(n.returnValue=!1),this.isDefaultPrevented=n0)},stopPropagation:function(){var n=this.nativeEvent;n&&(n.stopPropagation?n.stopPropagation():typeof n.cancelBubble!="unknown"&&(n.cancelBubble=!0),this.isPropagationStopped=n0)},persist:function(){},isPersistent:n0}),t}var mc={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},a_=Dr(mc),qm=Bt({},mc,{view:0,detail:0}),bK=Dr(qm),_w,vw,nm,s_=Bt({},qm,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Xx,button:0,buttons:0,relatedTarget:function(e){return e.relatedTarget===void 0?e.fromElement===e.srcElement?e.toElement:e.fromElement:e.relatedTarget},movementX:function(e){return"movementX"in e?e.movementX:(e!==nm&&(nm&&e.type==="mousemove"?(_w=e.screenX-nm.screenX,vw=e.screenY-nm.screenY):vw=_w=0,nm=e),_w)},movementY:function(e){return"movementY"in e?e.movementY:vw}}),hD=Dr(s_),yK=Bt({},s_,{dataTransfer:0}),_K=Dr(yK),vK=Bt({},qm,{relatedTarget:0}),Sw=Dr(vK),SK=Bt({},mc,{animationName:0,elapsedTime:0,pseudoElement:0}),EK=Dr(SK),TK=Bt({},mc,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),wK=Dr(TK),xK=Bt({},mc,{data:0}),bD=Dr(xK),kK={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},AK={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"},IK={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function NK(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=IK[e])?!!t[e]:!1}function Xx(){return NK}var RK=Bt({},qm,{key:function(e){if(e.key){var t=kK[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=y0(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?AK[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Xx,charCode:function(e){return e.type==="keypress"?y0(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?y0(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),CK=Dr(RK),MK=Bt({},s_,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),yD=Dr(MK),OK=Bt({},qm,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Xx}),DK=Dr(OK),LK=Bt({},mc,{propertyName:0,elapsedTime:0,pseudoElement:0}),UK=Dr(LK),PK=Bt({},s_,{deltaX:function(e){return"deltaX"in e?e.deltaX:"wheelDeltaX"in e?-e.wheelDeltaX:0},deltaY:function(e){return"deltaY"in e?e.deltaY:"wheelDeltaY"in e?-e.wheelDeltaY:"wheelDelta"in e?-e.wheelDelta:0},deltaZ:0,deltaMode:0}),BK=Dr(PK),zK=Bt({},mc,{newState:0,oldState:0}),FK=Dr(zK),HK=[9,13,27,32],Jx=Ia&&"CompositionEvent"in window,pm=null;Ia&&"documentMode"in document&&(pm=document.documentMode);var GK=Ia&&"TextEvent"in window&&!pm,t3=Ia&&(!Jx||pm&&8<pm&&11>=pm),_D=" ",vD=!1;function n3(e,t){switch(e){case"keyup":return HK.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function r3(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Rd=!1;function $K(e,t){switch(e){case"compositionend":return r3(t);case"keypress":return t.which!==32?null:(vD=!0,_D);case"textInput":return e=t.data,e===_D&&vD?null:e;default:return null}}function jK(e,t){if(Rd)return e==="compositionend"||!Jx&&n3(e,t)?(e=e3(),b0=Kx=Ns=null,Rd=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1<t.char.length)return t.char;if(t.which)return String.fromCharCode(t.which)}return null;case"compositionend":return t3&&t.locale!=="ko"?null:t.data;default:return null}}var qK={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function SD(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!qK[e.type]:t==="textarea"}function o3(e,t,n,r){Nd?Fd?Fd.push(r):Fd=[r]:Nd=r,t=Q0(t,"onChange"),0<t.length&&(n=new a_("onChange","change",null,n,r),e.push({event:n,listeners:t}))}var mm=null,Im=null;function VK(e){ZU(e,0)}function l_(e){var t=um(e);if(YL(t))return e}function ED(e,t){if(e==="change")return t}var i3=!1;Ia&&(Ia?(o0="oninput"in document,o0||(Ew=document.createElement("div"),Ew.setAttribute("oninput","return;"),o0=typeof Ew.oninput=="function"),r0=o0):r0=!1,i3=r0&&(!document.documentMode||9<document.documentMode));var r0,o0,Ew;function TD(){mm&&(mm.detachEvent("onpropertychange",a3),Im=mm=null)}function a3(e){if(e.propertyName==="value"&&l_(Im)){var t=[];o3(t,Im,e,Yx(e)),ZL(VK,t)}}function WK(e,t,n){e==="focusin"?(TD(),mm=t,Im=n,mm.attachEvent("onpropertychange",a3)):e==="focusout"&&TD()}function YK(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return l_(Im)}function KK(e,t){if(e==="click")return l_(t)}function XK(e,t){if(e==="input"||e==="change")return l_(t)}function JK(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var to=typeof Object.is=="function"?Object.is:JK;function Nm(e,t){if(to(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;var n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(r=0;r<n.length;r++){var o=n[r];if(!Zw.call(t,o)||!to(e[o],t[o]))return!1}return!0}function wD(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function xD(e,t){var n=wD(e);e=0;for(var r;n;){if(n.nodeType===3){if(r=e+n.textContent.length,e<=t&&r>=t)return{node:n,offset:t-e};e=r}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=wD(n)}}function s3(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?s3(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function l3(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=D0(e.document);t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=D0(e.document)}return t}function Qx(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}var QK=Ia&&"documentMode"in document&&11>=document.documentMode,Cd=null,ax=null,gm=null,sx=!1;function kD(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;sx||Cd==null||Cd!==D0(r)||(r=Cd,"selectionStart"in r&&Qx(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),gm&&Nm(gm,r)||(gm=r,r=Q0(ax,"onSelect"),0<r.length&&(t=new a_("onSelect","select",null,t,n),e.push({event:t,listeners:r}),t.target=Cd)))}function Ql(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n["Webkit"+e]="webkit"+t,n["Moz"+e]="moz"+t,n}var Md={animationend:Ql("Animation","AnimationEnd"),animationiteration:Ql("Animation","AnimationIteration"),animationstart:Ql("Animation","AnimationStart"),transitionrun:Ql("Transition","TransitionRun"),transitionstart:Ql("Transition","TransitionStart"),transitioncancel:Ql("Transition","TransitionCancel"),transitionend:Ql("Transition","TransitionEnd")},Tw={},c3={};Ia&&(c3=document.createElement("div").style,"AnimationEvent"in window||(delete Md.animationend.animation,delete Md.animationiteration.animation,delete Md.animationstart.animation),"TransitionEvent"in window||delete Md.transitionend.transition);function gc(e){if(Tw[e])return Tw[e];if(!Md[e])return e;var t=Md[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in c3)return Tw[e]=t[n];return e}var u3=gc("animationend"),d3=gc("animationiteration"),f3=gc("animationstart"),ZK=gc("transitionrun"),eX=gc("transitionstart"),tX=gc("transitioncancel"),p3=gc("transitionend"),m3=new Map,lx="abort auxClick beforeToggle cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");lx.push("scrollEnd");function si(e,t){m3.set(e,t),pc(t,[e])}var L0=typeof reportError=="function"?reportError:function(e){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var t=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof e=="object"&&e!==null&&typeof e.message=="string"?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",e);return}console.error(e)},Ao=[],Od=0,Zx=0;function c_(){for(var e=Od,t=Zx=Od=0;t<e;){var n=Ao[t];Ao[t++]=null;var r=Ao[t];Ao[t++]=null;var o=Ao[t];Ao[t++]=null;var i=Ao[t];if(Ao[t++]=null,r!==null&&o!==null){var a=r.pending;a===null?o.next=o:(o.next=a.next,a.next=o),r.pending=o}i!==0&&g3(n,o,i)}}function u_(e,t,n,r){Ao[Od++]=e,Ao[Od++]=t,Ao[Od++]=n,Ao[Od++]=r,Zx|=r,e.lanes|=r,e=e.alternate,e!==null&&(e.lanes|=r)}function e1(e,t,n,r){return u_(e,t,n,r),U0(e)}function hc(e,t){return u_(e,null,null,t),U0(e)}function g3(e,t,n){e.lanes|=n;var r=e.alternate;r!==null&&(r.lanes|=n);for(var o=!1,i=e.return;i!==null;)i.childLanes|=n,r=i.alternate,r!==null&&(r.childLanes|=n),i.tag===22&&(e=i.stateNode,e===null||e._visibility&1||(o=!0)),e=i,i=i.return;return e.tag===3?(i=e.stateNode,o&&t!==null&&(o=31-Zr(n),e=i.hiddenUpdates,r=e[o],r===null?e[o]=[t]:r.push(t),t.lane=n|536870912),i):null}function U0(e){if(50<wm)throw wm=0,Nx=null,Error(Y(185));for(var t=e.return;t!==null;)e=t,t=e.return;return e.tag===3?e.stateNode:null}var Dd={};function nX(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Kr(e,t,n,r){return new nX(e,t,n,r)}function t1(e){return e=e.prototype,!(!e||!e.isReactComponent)}function xa(e,t){var n=e.alternate;return n===null?(n=Kr(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&65011712,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n.refCleanup=e.refCleanup,n}function h3(e,t){e.flags&=65011714;var n=e.alternate;return n===null?(e.childLanes=0,e.lanes=t,e.child=null,e.subtreeFlags=0,e.memoizedProps=null,e.memoizedState=null,e.updateQueue=null,e.dependencies=null,e.stateNode=null):(e.childLanes=n.childLanes,e.lanes=n.lanes,e.child=n.child,e.subtreeFlags=0,e.deletions=null,e.memoizedProps=n.memoizedProps,e.memoizedState=n.memoizedState,e.updateQueue=n.updateQueue,e.type=n.type,t=n.dependencies,e.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext}),e}function _0(e,t,n,r,o,i){var a=0;if(r=e,typeof e=="function")t1(e)&&(a=1);else if(typeof e=="string")a=iJ(e,n,Pi.current)?26:e==="html"||e==="head"||e==="body"?27:5;else e:switch(e){case Kw:return e=Kr(31,n,t,o),e.elementType=Kw,e.lanes=i,e;case kd:return oc(n.children,o,i,t);case LL:a=8,o|=24;break;case Vw:return e=Kr(12,n,t,o|2),e.elementType=Vw,e.lanes=i,e;case Ww:return e=Kr(13,n,t,o),e.elementType=Ww,e.lanes=i,e;case Yw:return e=Kr(19,n,t,o),e.elementType=Yw,e.lanes=i,e;default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case Ea:a=10;break e;case UL:a=9;break e;case Hx:a=11;break e;case Gx:a=14;break e;case Es:a=16,r=null;break e}a=29,n=Error(Y(130,e===null?"null":typeof e,"")),r=null}return t=Kr(a,n,t,o),t.elementType=e,t.type=r,t.lanes=i,t}function oc(e,t,n,r){return e=Kr(7,e,r,t),e.lanes=n,e}function ww(e,t,n){return e=Kr(6,e,null,t),e.lanes=n,e}function b3(e){var t=Kr(18,null,null,0);return t.stateNode=e,t}function xw(e,t,n){return t=Kr(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}var AD=new WeakMap;function Mo(e,t){if(typeof e=="object"&&e!==null){var n=AD.get(e);return n!==void 0?n:(t={value:e,source:t,stack:lD(t)},AD.set(e,t),t)}return{value:e,source:t,stack:lD(t)}}var Ld=[],Ud=0,P0=null,Rm=0,No=[],Ro=0,Gs=null,Di=1,Li="";function va(e,t){Ld[Ud++]=Rm,Ld[Ud++]=P0,P0=e,Rm=t}function y3(e,t,n){No[Ro++]=Di,No[Ro++]=Li,No[Ro++]=Gs,Gs=e;var r=Di;e=Li;var o=32-Zr(r)-1;r&=~(1<<o),n+=1;var i=32-Zr(t)+o;if(30<i){var a=o-o%5;i=(r&(1<<a)-1).toString(32),r>>=a,o-=a,Di=1<<32-Zr(t)+o|n<<o|r,Li=i+e}else Di=1<<i|n<<o|r,Li=e}function n1(e){e.return!==null&&(va(e,1),y3(e,1,0))}function r1(e){for(;e===P0;)P0=Ld[--Ud],Ld[Ud]=null,Rm=Ld[--Ud],Ld[Ud]=null;for(;e===Gs;)Gs=No[--Ro],No[Ro]=null,Li=No[--Ro],No[Ro]=null,Di=No[--Ro],No[Ro]=null}function _3(e,t){No[Ro++]=Di,No[Ro++]=Li,No[Ro++]=Gs,Di=t.id,Li=t.overflow,Gs=e}var Gn=null,Pt=null,ot=!1,Ds=null,Oo=!1,cx=Error(Y(519));function $s(e){var t=Error(Y(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw Cm(Mo(t,e)),cx}function ID(e){var t=e.stateNode,n=e.type,r=e.memoizedProps;switch(t[Hn]=e,t[Or]=r,n){case"dialog":Qe("cancel",t),Qe("close",t);break;case"iframe":case"object":case"embed":Qe("load",t);break;case"video":case"audio":for(n=0;n<Lm.length;n++)Qe(Lm[n],t);break;case"source":Qe("error",t);break;case"img":case"image":case"link":Qe("error",t),Qe("load",t);break;case"details":Qe("toggle",t);break;case"input":Qe("invalid",t),KL(t,r.value,r.defaultValue,r.checked,r.defaultChecked,r.type,r.name,!0);break;case"select":Qe("invalid",t);break;case"textarea":Qe("invalid",t),JL(t,r.value,r.defaultValue,r.children)}n=r.children,typeof n!="string"&&typeof n!="number"&&typeof n!="bigint"||t.textContent===""+n||r.suppressHydrationWarning===!0||t6(t.textContent,n)?(r.popover!=null&&(Qe("beforetoggle",t),Qe("toggle",t)),r.onScroll!=null&&Qe("scroll",t),r.onScrollEnd!=null&&Qe("scrollend",t),r.onClick!=null&&(t.onclick=Ta),t=!0):t=!1,t||$s(e,!0)}function ND(e){for(Gn=e.return;Gn;)switch(Gn.tag){case 5:case 31:case 13:Oo=!1;return;case 27:case 3:Oo=!0;return;default:Gn=Gn.return}}function Ed(e){if(e!==Gn)return!1;if(!ot)return ND(e),ot=!0,!1;var t=e.tag,n;if((n=t!==3&&t!==27)&&((n=t===5)&&(n=e.type,n=!(n!=="form"&&n!=="button")||Dx(e.type,e.memoizedProps)),n=!n),n&&Pt&&$s(e),ND(e),t===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(Y(317));Pt=bL(e)}else if(t===31){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(Y(317));Pt=bL(e)}else t===27?(t=Pt,Ws(e.type)?(e=Bx,Bx=null,Pt=e):Pt=t):Pt=Gn?Lo(e.stateNode.nextSibling):null;return!0}function lc(){Pt=Gn=null,ot=!1}function kw(){var e=Ds;return e!==null&&(Cr===null?Cr=e:Cr.push.apply(Cr,e),Ds=null),e}function Cm(e){Ds===null?Ds=[e]:Ds.push(e)}var ux=Bi(null),bc=null,wa=null;function ws(e,t,n){Ot(ux,t._currentValue),t._currentValue=n}function ka(e){e._currentValue=ux.current,Pn(ux)}function dx(e,t,n){for(;e!==null;){var r=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,r!==null&&(r.childLanes|=t)):r!==null&&(r.childLanes&t)!==t&&(r.childLanes|=t),e===n)break;e=e.return}}function fx(e,t,n,r){var o=e.child;for(o!==null&&(o.return=e);o!==null;){var i=o.dependencies;if(i!==null){var a=o.child;i=i.firstContext;e:for(;i!==null;){var s=i;i=o;for(var l=0;l<t.length;l++)if(s.context===t[l]){i.lanes|=n,s=i.alternate,s!==null&&(s.lanes|=n),dx(i.return,n,e),r||(a=null);break e}i=s.next}}else if(o.tag===18){if(a=o.return,a===null)throw Error(Y(341));a.lanes|=n,i=a.alternate,i!==null&&(i.lanes|=n),dx(a,n,e),a=null}else a=o.child;if(a!==null)a.return=o;else for(a=o;a!==null;){if(a===e){a=null;break}if(o=a.sibling,o!==null){o.return=a.return,a=o;break}a=a.return}o=a}}function of(e,t,n,r){e=null;for(var o=t,i=!1;o!==null;){if(!i){if((o.flags&524288)!==0)i=!0;else if((o.flags&262144)!==0)break}if(o.tag===10){var a=o.alternate;if(a===null)throw Error(Y(387));if(a=a.memoizedProps,a!==null){var s=o.type;to(o.pendingProps.value,a.value)||(e!==null?e.push(s):e=[s])}}else if(o===R0.current){if(a=o.alternate,a===null)throw Error(Y(387));a.memoizedState.memoizedState!==o.memoizedState.memoizedState&&(e!==null?e.push(Pm):e=[Pm])}o=o.return}e!==null&&fx(t,e,n,r),t.flags|=262144}function B0(e){for(e=e.firstContext;e!==null;){if(!to(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function cc(e){bc=e,wa=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function $n(e){return v3(bc,e)}function i0(e,t){return bc===null&&cc(e),v3(e,t)}function v3(e,t){var n=t._currentValue;if(t={context:t,memoizedValue:n,next:null},wa===null){if(e===null)throw Error(Y(308));wa=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else wa=wa.next=t;return n}var rX=typeof AbortController<"u"?AbortController:function(){var e=[],t=this.signal={aborted:!1,addEventListener:function(n,r){e.push(r)}};this.abort=function(){t.aborted=!0,e.forEach(function(n){return n()})}},oX=kn.unstable_scheduleCallback,iX=kn.unstable_NormalPriority,yn={$$typeof:Ea,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function o1(){return{controller:new rX,data:new Map,refCount:0}}function Vm(e){e.refCount--,e.refCount===0&&oX(iX,function(){e.controller.abort()})}var hm=null,px=0,Yd=0,Hd=null;function aX(e,t){if(hm===null){var n=hm=[];px=0,Yd=N1(),Hd={status:"pending",value:void 0,then:function(r){n.push(r)}}}return px++,t.then(RD,RD),t}function RD(){if(--px===0&&hm!==null){Hd!==null&&(Hd.status="fulfilled");var e=hm;hm=null,Yd=0,Hd=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function sX(e,t){var n=[],r={status:"pending",value:null,reason:null,then:function(o){n.push(o)}};return e.then(function(){r.status="fulfilled",r.value=t;for(var o=0;o<n.length;o++)(0,n[o])(t)},function(o){for(r.status="rejected",r.reason=o,o=0;o<n.length;o++)(0,n[o])(void 0)}),r}var CD=Ne.S;Ne.S=function(e,t){DU=Jr(),typeof t=="object"&&t!==null&&typeof t.then=="function"&&aX(e,t),CD!==null&&CD(e,t)};var ic=Bi(null);function i1(){var e=ic.current;return e!==null?e:It.pooledCache}function v0(e,t){t===null?Ot(ic,ic.current):Ot(ic,t.pool)}function S3(){var e=i1();return e===null?null:{parent:yn._currentValue,pool:e}}var af=Error(Y(460)),a1=Error(Y(474)),d_=Error(Y(542)),z0={then:function(){}};function MD(e){return e=e.status,e==="fulfilled"||e==="rejected"}function E3(e,t,n){switch(n=e[n],n===void 0?e.push(t):n!==t&&(t.then(Ta,Ta),t=n),t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,DD(e),e;default:if(typeof t.status=="string")t.then(Ta,Ta);else{if(e=It,e!==null&&100<e.shellSuspendCounter)throw Error(Y(482));e=t,e.status="pending",e.then(function(r){if(t.status==="pending"){var o=t;o.status="fulfilled",o.value=r}},function(r){if(t.status==="pending"){var o=t;o.status="rejected",o.reason=r}})}switch(t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,DD(e),e}throw ac=t,af}}function tc(e){try{var t=e._init;return t(e._payload)}catch(n){throw n!==null&&typeof n=="object"&&typeof n.then=="function"?(ac=n,af):n}}var ac=null;function OD(){if(ac===null)throw Error(Y(459));var e=ac;return ac=null,e}function DD(e){if(e===af||e===d_)throw Error(Y(483))}var Gd=null,Mm=0;function a0(e){var t=Mm;return Mm+=1,Gd===null&&(Gd=[]),E3(Gd,e,t)}function rm(e,t){t=t.props.ref,e.ref=t!==void 0?t:null}function s0(e,t){throw t.$$typeof===WY?Error(Y(525)):(e=Object.prototype.toString.call(t),Error(Y(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e)))}function T3(e){function t(h,v){if(e){var T=h.deletions;T===null?(h.deletions=[v],h.flags|=16):T.push(v)}}function n(h,v){if(!e)return null;for(;v!==null;)t(h,v),v=v.sibling;return null}function r(h){for(var v=new Map;h!==null;)h.key!==null?v.set(h.key,h):v.set(h.index,h),h=h.sibling;return v}function o(h,v){return h=xa(h,v),h.index=0,h.sibling=null,h}function i(h,v,T){return h.index=T,e?(T=h.alternate,T!==null?(T=T.index,T<v?(h.flags|=67108866,v):T):(h.flags|=67108866,v)):(h.flags|=1048576,v)}function a(h){return e&&h.alternate===null&&(h.flags|=67108866),h}function s(h,v,T,x){return v===null||v.tag!==6?(v=ww(T,h.mode,x),v.return=h,v):(v=o(v,T),v.return=h,v)}function l(h,v,T,x){var N=T.type;return N===kd?d(h,v,T.props.children,x,T.key):v!==null&&(v.elementType===N||typeof N=="object"&&N!==null&&N.$$typeof===Es&&tc(N)===v.type)?(v=o(v,T.props),rm(v,T),v.return=h,v):(v=_0(T.type,T.key,T.props,null,h.mode,x),rm(v,T),v.return=h,v)}function c(h,v,T,x){return v===null||v.tag!==4||v.stateNode.containerInfo!==T.containerInfo||v.stateNode.implementation!==T.implementation?(v=xw(T,h.mode,x),v.return=h,v):(v=o(v,T.children||[]),v.return=h,v)}function d(h,v,T,x,N){return v===null||v.tag!==7?(v=oc(T,h.mode,x,N),v.return=h,v):(v=o(v,T),v.return=h,v)}function u(h,v,T){if(typeof v=="string"&&v!==""||typeof v=="number"||typeof v=="bigint")return v=ww(""+v,h.mode,T),v.return=h,v;if(typeof v=="object"&&v!==null){switch(v.$$typeof){case Jy:return T=_0(v.type,v.key,v.props,null,h.mode,T),rm(T,v),T.return=h,T;case lm:return v=xw(v,h.mode,T),v.return=h,v;case Es:return v=tc(v),u(h,v,T)}if(cm(v)||tm(v))return v=oc(v,h.mode,T,null),v.return=h,v;if(typeof v.then=="function")return u(h,a0(v),T);if(v.$$typeof===Ea)return u(h,i0(h,v),T);s0(h,v)}return null}function m(h,v,T,x){var N=v!==null?v.key:null;if(typeof T=="string"&&T!==""||typeof T=="number"||typeof T=="bigint")return N!==null?null:s(h,v,""+T,x);if(typeof T=="object"&&T!==null){switch(T.$$typeof){case Jy:return T.key===N?l(h,v,T,x):null;case lm:return T.key===N?c(h,v,T,x):null;case Es:return T=tc(T),m(h,v,T,x)}if(cm(T)||tm(T))return N!==null?null:d(h,v,T,x,null);if(typeof T.then=="function")return m(h,v,a0(T),x);if(T.$$typeof===Ea)return m(h,v,i0(h,T),x);s0(h,T)}return null}function p(h,v,T,x,N){if(typeof x=="string"&&x!==""||typeof x=="number"||typeof x=="bigint")return h=h.get(T)||null,s(v,h,""+x,N);if(typeof x=="object"&&x!==null){switch(x.$$typeof){case Jy:return h=h.get(x.key===null?T:x.key)||null,l(v,h,x,N);case lm:return h=h.get(x.key===null?T:x.key)||null,c(v,h,x,N);case Es:return x=tc(x),p(h,v,T,x,N)}if(cm(x)||tm(x))return h=h.get(T)||null,d(v,h,x,N,null);if(typeof x.then=="function")return p(h,v,T,a0(x),N);if(x.$$typeof===Ea)return p(h,v,T,i0(v,x),N);s0(v,x)}return null}function g(h,v,T,x){for(var N=null,M=null,k=v,P=v=0,F=null;k!==null&&P<T.length;P++){k.index>P?(F=k,k=null):F=k.sibling;var U=m(h,k,T[P],x);if(U===null){k===null&&(k=F);break}e&&k&&U.alternate===null&&t(h,k),v=i(U,v,P),M===null?N=U:M.sibling=U,M=U,k=F}if(P===T.length)return n(h,k),ot&&va(h,P),N;if(k===null){for(;P<T.length;P++)k=u(h,T[P],x),k!==null&&(v=i(k,v,P),M===null?N=k:M.sibling=k,M=k);return ot&&va(h,P),N}for(k=r(k);P<T.length;P++)F=p(k,h,P,T[P],x),F!==null&&(e&&F.alternate!==null&&k.delete(F.key===null?P:F.key),v=i(F,v,P),M===null?N=F:M.sibling=F,M=F);return e&&k.forEach(function(X){return t(h,X)}),ot&&va(h,P),N}function _(h,v,T,x){if(T==null)throw Error(Y(151));for(var N=null,M=null,k=v,P=v=0,F=null,U=T.next();k!==null&&!U.done;P++,U=T.next()){k.index>P?(F=k,k=null):F=k.sibling;var X=m(h,k,U.value,x);if(X===null){k===null&&(k=F);break}e&&k&&X.alternate===null&&t(h,k),v=i(X,v,P),M===null?N=X:M.sibling=X,M=X,k=F}if(U.done)return n(h,k),ot&&va(h,P),N;if(k===null){for(;!U.done;P++,U=T.next())U=u(h,U.value,x),U!==null&&(v=i(U,v,P),M===null?N=U:M.sibling=U,M=U);return ot&&va(h,P),N}for(k=r(k);!U.done;P++,U=T.next())U=p(k,h,P,U.value,x),U!==null&&(e&&U.alternate!==null&&k.delete(U.key===null?P:U.key),v=i(U,v,P),M===null?N=U:M.sibling=U,M=U);return e&&k.forEach(function(G){return t(h,G)}),ot&&va(h,P),N}function y(h,v,T,x){if(typeof T=="object"&&T!==null&&T.type===kd&&T.key===null&&(T=T.props.children),typeof T=="object"&&T!==null){switch(T.$$typeof){case Jy:e:{for(var N=T.key;v!==null;){if(v.key===N){if(N=T.type,N===kd){if(v.tag===7){n(h,v.sibling),x=o(v,T.props.children),x.return=h,h=x;break e}}else if(v.elementType===N||typeof N=="object"&&N!==null&&N.$$typeof===Es&&tc(N)===v.type){n(h,v.sibling),x=o(v,T.props),rm(x,T),x.return=h,h=x;break e}n(h,v);break}else t(h,v);v=v.sibling}T.type===kd?(x=oc(T.props.children,h.mode,x,T.key),x.return=h,h=x):(x=_0(T.type,T.key,T.props,null,h.mode,x),rm(x,T),x.return=h,h=x)}return a(h);case lm:e:{for(N=T.key;v!==null;){if(v.key===N)if(v.tag===4&&v.stateNode.containerInfo===T.containerInfo&&v.stateNode.implementation===T.implementation){n(h,v.sibling),x=o(v,T.children||[]),x.return=h,h=x;break e}else{n(h,v);break}else t(h,v);v=v.sibling}x=xw(T,h.mode,x),x.return=h,h=x}return a(h);case Es:return T=tc(T),y(h,v,T,x)}if(cm(T))return g(h,v,T,x);if(tm(T)){if(N=tm(T),typeof N!="function")throw Error(Y(150));return T=N.call(T),_(h,v,T,x)}if(typeof T.then=="function")return y(h,v,a0(T),x);if(T.$$typeof===Ea)return y(h,v,i0(h,T),x);s0(h,T)}return typeof T=="string"&&T!==""||typeof T=="number"||typeof T=="bigint"?(T=""+T,v!==null&&v.tag===6?(n(h,v.sibling),x=o(v,T),x.return=h,h=x):(n(h,v),x=ww(T,h.mode,x),x.return=h,h=x),a(h)):n(h,v)}return function(h,v,T,x){try{Mm=0;var N=y(h,v,T,x);return Gd=null,N}catch(k){if(k===af||k===d_)throw k;var M=Kr(29,k,null,h.mode);return M.lanes=x,M.return=h,M}finally{}}}var uc=T3(!0),w3=T3(!1),Ts=!1;function s1(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function mx(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,callbacks:null})}function Ls(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function Us(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,(mt&2)!==0){var o=r.pending;return o===null?t.next=t:(t.next=o.next,o.next=t),r.pending=t,t=U0(e),g3(e,null,n),t}return u_(e,r,t,n),U0(e)}function bm(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,(n&4194048)!==0)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,GL(e,n)}}function Aw(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var o=null,i=null;if(n=n.firstBaseUpdate,n!==null){do{var a={lane:n.lane,tag:n.tag,payload:n.payload,callback:null,next:null};i===null?o=i=a:i=i.next=a,n=n.next}while(n!==null);i===null?o=i=t:i=i.next=t}else o=i=t;n={baseState:r.baseState,firstBaseUpdate:o,lastBaseUpdate:i,shared:r.shared,callbacks:r.callbacks},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}var gx=!1;function ym(){if(gx){var e=Hd;if(e!==null)throw e}}function _m(e,t,n,r){gx=!1;var o=e.updateQueue;Ts=!1;var i=o.firstBaseUpdate,a=o.lastBaseUpdate,s=o.shared.pending;if(s!==null){o.shared.pending=null;var l=s,c=l.next;l.next=null,a===null?i=c:a.next=c,a=l;var d=e.alternate;d!==null&&(d=d.updateQueue,s=d.lastBaseUpdate,s!==a&&(s===null?d.firstBaseUpdate=c:s.next=c,d.lastBaseUpdate=l))}if(i!==null){var u=o.baseState;a=0,d=c=l=null,s=i;do{var m=s.lane&-536870913,p=m!==s.lane;if(p?(nt&m)===m:(r&m)===m){m!==0&&m===Yd&&(gx=!0),d!==null&&(d=d.next={lane:0,tag:s.tag,payload:s.payload,callback:null,next:null});e:{var g=e,_=s;m=t;var y=n;switch(_.tag){case 1:if(g=_.payload,typeof g=="function"){u=g.call(y,u,m);break e}u=g;break e;case 3:g.flags=g.flags&-65537|128;case 0:if(g=_.payload,m=typeof g=="function"?g.call(y,u,m):g,m==null)break e;u=Bt({},u,m);break e;case 2:Ts=!0}}m=s.callback,m!==null&&(e.flags|=64,p&&(e.flags|=8192),p=o.callbacks,p===null?o.callbacks=[m]:p.push(m))}else p={lane:m,tag:s.tag,payload:s.payload,callback:s.callback,next:null},d===null?(c=d=p,l=u):d=d.next=p,a|=m;if(s=s.next,s===null){if(s=o.shared.pending,s===null)break;p=s,s=p.next,p.next=null,o.lastBaseUpdate=p,o.shared.pending=null}}while(!0);d===null&&(l=u),o.baseState=l,o.firstBaseUpdate=c,o.lastBaseUpdate=d,i===null&&(o.shared.lanes=0),qs|=a,e.lanes=a,e.memoizedState=u}}function x3(e,t){if(typeof e!="function")throw Error(Y(191,e));e.call(t)}function k3(e,t){var n=e.callbacks;if(n!==null)for(e.callbacks=null,e=0;e<n.length;e++)x3(n[e],t)}var Kd=Bi(null),F0=Bi(0);function LD(e,t){e=Ma,Ot(F0,e),Ot(Kd,t),Ma=e|t.baseLanes}function hx(){Ot(F0,Ma),Ot(Kd,Kd.current)}function l1(){Ma=F0.current,Pn(Kd),Pn(F0)}var no=Bi(null),Do=null;function xs(e){var t=e.alternate;Ot(sn,sn.current&1),Ot(no,e),Do===null&&(t===null||Kd.current!==null||t.memoizedState!==null)&&(Do=e)}function bx(e){Ot(sn,sn.current),Ot(no,e),Do===null&&(Do=e)}function A3(e){e.tag===22?(Ot(sn,sn.current),Ot(no,e),Do===null&&(Do=e)):ks(e)}function ks(){Ot(sn,sn.current),Ot(no,no.current)}function Yr(e){Pn(no),Do===e&&(Do=null),Pn(sn)}var sn=Bi(0);function H0(e){for(var t=e;t!==null;){if(t.tag===13){var n=t.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||Ux(n)||Px(n)))return t}else if(t.tag===19&&(t.memoizedProps.revealOrder==="forwards"||t.memoizedProps.revealOrder==="backwards"||t.memoizedProps.revealOrder==="unstable_legacy-backwards"||t.memoizedProps.revealOrder==="together")){if((t.flags&128)!==0)return t}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var Na=0,qe=null,St=null,hn=null,G0=!1,$d=!1,dc=!1,$0=0,Om=0,jd=null,lX=0;function rn(){throw Error(Y(321))}function c1(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!to(e[n],t[n]))return!1;return!0}function u1(e,t,n,r,o,i){return Na=i,qe=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,Ne.H=e===null||e.memoizedState===null?oU:S1,dc=!1,i=n(r,o),dc=!1,$d&&(i=N3(t,n,r,o)),I3(e),i}function I3(e){Ne.H=Dm;var t=St!==null&&St.next!==null;if(Na=0,hn=St=qe=null,G0=!1,Om=0,jd=null,t)throw Error(Y(300));e===null||_n||(e=e.dependencies,e!==null&&B0(e)&&(_n=!0))}function N3(e,t,n,r){qe=e;var o=0;do{if($d&&(jd=null),Om=0,$d=!1,25<=o)throw Error(Y(301));if(o+=1,hn=St=null,e.updateQueue!=null){var i=e.updateQueue;i.lastEffect=null,i.events=null,i.stores=null,i.memoCache!=null&&(i.memoCache.index=0)}Ne.H=iU,i=t(n,r)}while($d);return i}function cX(){var e=Ne.H,t=e.useState()[0];return t=typeof t.then=="function"?Wm(t):t,e=e.useState()[0],(St!==null?St.memoizedState:null)!==e&&(qe.flags|=1024),t}function d1(){var e=$0!==0;return $0=0,e}function f1(e,t,n){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~n}function p1(e){if(G0){for(e=e.memoizedState;e!==null;){var t=e.queue;t!==null&&(t.pending=null),e=e.next}G0=!1}Na=0,hn=St=qe=null,$d=!1,Om=$0=0,jd=null}function ur(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return hn===null?qe.memoizedState=hn=e:hn=hn.next=e,hn}function ln(){if(St===null){var e=qe.alternate;e=e!==null?e.memoizedState:null}else e=St.next;var t=hn===null?qe.memoizedState:hn.next;if(t!==null)hn=t,St=e;else{if(e===null)throw qe.alternate===null?Error(Y(467)):Error(Y(310));St=e,e={memoizedState:St.memoizedState,baseState:St.baseState,baseQueue:St.baseQueue,queue:St.queue,next:null},hn===null?qe.memoizedState=hn=e:hn=hn.next=e}return hn}function f_(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Wm(e){var t=Om;return Om+=1,jd===null&&(jd=[]),e=E3(jd,e,t),t=qe,(hn===null?t.memoizedState:hn.next)===null&&(t=t.alternate,Ne.H=t===null||t.memoizedState===null?oU:S1),e}function p_(e){if(e!==null&&typeof e=="object"){if(typeof e.then=="function")return Wm(e);if(e.$$typeof===Ea)return $n(e)}throw Error(Y(438,String(e)))}function m1(e){var t=null,n=qe.updateQueue;if(n!==null&&(t=n.memoCache),t==null){var r=qe.alternate;r!==null&&(r=r.updateQueue,r!==null&&(r=r.memoCache,r!=null&&(t={data:r.data.map(function(o){return o.slice()}),index:0})))}if(t==null&&(t={data:[],index:0}),n===null&&(n=f_(),qe.updateQueue=n),n.memoCache=t,n=t.data[t.index],n===void 0)for(n=t.data[t.index]=Array(e),r=0;r<e;r++)n[r]=YY;return t.index++,n}function Ra(e,t){return typeof t=="function"?t(e):t}function S0(e){var t=ln();return g1(t,St,e)}function g1(e,t,n){var r=e.queue;if(r===null)throw Error(Y(311));r.lastRenderedReducer=n;var o=e.baseQueue,i=r.pending;if(i!==null){if(o!==null){var a=o.next;o.next=i.next,i.next=a}t.baseQueue=o=i,r.pending=null}if(i=e.baseState,o===null)e.memoizedState=i;else{t=o.next;var s=a=null,l=null,c=t,d=!1;do{var u=c.lane&-536870913;if(u!==c.lane?(nt&u)===u:(Na&u)===u){var m=c.revertLane;if(m===0)l!==null&&(l=l.next={lane:0,revertLane:0,gesture:null,action:c.action,hasEagerState:c.hasEagerState,eagerState:c.eagerState,next:null}),u===Yd&&(d=!0);else if((Na&m)===m){c=c.next,m===Yd&&(d=!0);continue}else u={lane:0,revertLane:c.revertLane,gesture:null,action:c.action,hasEagerState:c.hasEagerState,eagerState:c.eagerState,next:null},l===null?(s=l=u,a=i):l=l.next=u,qe.lanes|=m,qs|=m;u=c.action,dc&&n(i,u),i=c.hasEagerState?c.eagerState:n(i,u)}else m={lane:u,revertLane:c.revertLane,gesture:c.gesture,action:c.action,hasEagerState:c.hasEagerState,eagerState:c.eagerState,next:null},l===null?(s=l=m,a=i):l=l.next=m,qe.lanes|=u,qs|=u;c=c.next}while(c!==null&&c!==t);if(l===null?a=i:l.next=s,!to(i,e.memoizedState)&&(_n=!0,d&&(n=Hd,n!==null)))throw n;e.memoizedState=i,e.baseState=a,e.baseQueue=l,r.lastRenderedState=i}return o===null&&(r.lanes=0),[e.memoizedState,r.dispatch]}function Iw(e){var t=ln(),n=t.queue;if(n===null)throw Error(Y(311));n.lastRenderedReducer=e;var r=n.dispatch,o=n.pending,i=t.memoizedState;if(o!==null){n.pending=null;var a=o=o.next;do i=e(i,a.action),a=a.next;while(a!==o);to(i,t.memoizedState)||(_n=!0),t.memoizedState=i,t.baseQueue===null&&(t.baseState=i),n.lastRenderedState=i}return[i,r]}function R3(e,t,n){var r=qe,o=ln(),i=ot;if(i){if(n===void 0)throw Error(Y(407));n=n()}else n=t();var a=!to((St||o).memoizedState,n);if(a&&(o.memoizedState=n,_n=!0),o=o.queue,h1(O3.bind(null,r,o,e),[e]),o.getSnapshot!==t||a||hn!==null&&hn.memoizedState.tag&1){if(r.flags|=2048,Xd(9,{destroy:void 0},M3.bind(null,r,o,n,t),null),It===null)throw Error(Y(349));i||(Na&127)!==0||C3(r,t,n)}return n}function C3(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=qe.updateQueue,t===null?(t=f_(),qe.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function M3(e,t,n,r){t.value=n,t.getSnapshot=r,D3(t)&&L3(e)}function O3(e,t,n){return n(function(){D3(t)&&L3(e)})}function D3(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!to(e,n)}catch{return!0}}function L3(e){var t=hc(e,2);t!==null&&Mr(t,e,2)}function yx(e){var t=ur();if(typeof e=="function"){var n=e;if(e=n(),dc){Is(!0);try{n()}finally{Is(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ra,lastRenderedState:e},t}function U3(e,t,n,r){return e.baseState=n,g1(e,St,typeof r=="function"?r:Ra)}function uX(e,t,n,r,o){if(g_(e))throw Error(Y(485));if(e=t.action,e!==null){var i={payload:o,action:e,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(a){i.listeners.push(a)}};Ne.T!==null?n(!0):i.isTransition=!1,r(i),n=t.pending,n===null?(i.next=t.pending=i,P3(t,i)):(i.next=n.next,t.pending=n.next=i)}}function P3(e,t){var n=t.action,r=t.payload,o=e.state;if(t.isTransition){var i=Ne.T,a={};Ne.T=a;try{var s=n(o,r),l=Ne.S;l!==null&&l(a,s),UD(e,t,s)}catch(c){_x(e,t,c)}finally{i!==null&&a.types!==null&&(i.types=a.types),Ne.T=i}}else try{i=n(o,r),UD(e,t,i)}catch(c){_x(e,t,c)}}function UD(e,t,n){n!==null&&typeof n=="object"&&typeof n.then=="function"?n.then(function(r){PD(e,t,r)},function(r){return _x(e,t,r)}):PD(e,t,n)}function PD(e,t,n){t.status="fulfilled",t.value=n,B3(t),e.state=n,t=e.pending,t!==null&&(n=t.next,n===t?e.pending=null:(n=n.next,t.next=n,P3(e,n)))}function _x(e,t,n){var r=e.pending;if(e.pending=null,r!==null){r=r.next;do t.status="rejected",t.reason=n,B3(t),t=t.next;while(t!==r)}e.action=null}function B3(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function z3(e,t){return t}function BD(e,t){if(ot){var n=It.formState;if(n!==null){e:{var r=qe;if(ot){if(Pt){t:{for(var o=Pt,i=Oo;o.nodeType!==8;){if(!i){o=null;break t}if(o=Lo(o.nextSibling),o===null){o=null;break t}}i=o.data,o=i==="F!"||i==="F"?o:null}if(o){Pt=Lo(o.nextSibling),r=o.data==="F!";break e}}$s(r)}r=!1}r&&(t=n[0])}}return n=ur(),n.memoizedState=n.baseState=t,r={pending:null,lanes:0,dispatch:null,lastRenderedReducer:z3,lastRenderedState:t},n.queue=r,n=tU.bind(null,qe,r),r.dispatch=n,r=yx(!1),i=v1.bind(null,qe,!1,r.queue),r=ur(),o={state:t,dispatch:null,action:e,pending:null},r.queue=o,n=uX.bind(null,qe,o,i,n),o.dispatch=n,r.memoizedState=e,[t,n,!1]}function zD(e){var t=ln();return F3(t,St,e)}function F3(e,t,n){if(t=g1(e,t,z3)[0],e=S0(Ra)[0],typeof t=="object"&&t!==null&&typeof t.then=="function")try{var r=Wm(t)}catch(a){throw a===af?d_:a}else r=t;t=ln();var o=t.queue,i=o.dispatch;return n!==t.memoizedState&&(qe.flags|=2048,Xd(9,{destroy:void 0},dX.bind(null,o,n),null)),[r,i,e]}function dX(e,t){e.action=t}function FD(e){var t=ln(),n=St;if(n!==null)return F3(t,n,e);ln(),t=t.memoizedState,n=ln();var r=n.queue.dispatch;return n.memoizedState=e,[t,r,!1]}function Xd(e,t,n,r){return e={tag:e,create:n,deps:r,inst:t,next:null},t=qe.updateQueue,t===null&&(t=f_(),qe.updateQueue=t),n=t.lastEffect,n===null?t.lastEffect=e.next=e:(r=n.next,n.next=e,e.next=r,t.lastEffect=e),e}function H3(){return ln().memoizedState}function E0(e,t,n,r){var o=ur();qe.flags|=e,o.memoizedState=Xd(1|t,{destroy:void 0},n,r===void 0?null:r)}function m_(e,t,n,r){var o=ln();r=r===void 0?null:r;var i=o.memoizedState.inst;St!==null&&r!==null&&c1(r,St.memoizedState.deps)?o.memoizedState=Xd(t,i,n,r):(qe.flags|=e,o.memoizedState=Xd(1|t,i,n,r))}function HD(e,t){E0(8390656,8,e,t)}function h1(e,t){m_(2048,8,e,t)}function fX(e){qe.flags|=4;var t=qe.updateQueue;if(t===null)t=f_(),qe.updateQueue=t,t.events=[e];else{var n=t.events;n===null?t.events=[e]:n.push(e)}}function G3(e){var t=ln().memoizedState;return fX({ref:t,nextImpl:e}),function(){if((mt&2)!==0)throw Error(Y(440));return t.impl.apply(void 0,arguments)}}function $3(e,t){return m_(4,2,e,t)}function j3(e,t){return m_(4,4,e,t)}function q3(e,t){if(typeof t=="function"){e=e();var n=t(e);return function(){typeof n=="function"?n():t(null)}}if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function V3(e,t,n){n=n!=null?n.concat([e]):null,m_(4,4,q3.bind(null,t,e),n)}function b1(){}function W3(e,t){var n=ln();t=t===void 0?null:t;var r=n.memoizedState;return t!==null&&c1(t,r[1])?r[0]:(n.memoizedState=[e,t],e)}function Y3(e,t){var n=ln();t=t===void 0?null:t;var r=n.memoizedState;if(t!==null&&c1(t,r[1]))return r[0];if(r=e(),dc){Is(!0);try{e()}finally{Is(!1)}}return n.memoizedState=[r,t],r}function y1(e,t,n){return n===void 0||(Na&1073741824)!==0&&(nt&261930)===0?e.memoizedState=t:(e.memoizedState=n,e=UU(),qe.lanes|=e,qs|=e,n)}function K3(e,t,n,r){return to(n,t)?n:Kd.current!==null?(e=y1(e,n,r),to(e,t)||(_n=!0),e):(Na&42)===0||(Na&1073741824)!==0&&(nt&261930)===0?(_n=!0,e.memoizedState=n):(e=UU(),qe.lanes|=e,qs|=e,t)}function X3(e,t,n,r,o){var i=gt.p;gt.p=i!==0&&8>i?i:8;var a=Ne.T,s={};Ne.T=s,v1(e,!1,t,n);try{var l=o(),c=Ne.S;if(c!==null&&c(s,l),l!==null&&typeof l=="object"&&typeof l.then=="function"){var d=sX(l,r);vm(e,t,d,eo(e))}else vm(e,t,r,eo(e))}catch(u){vm(e,t,{then:function(){},status:"rejected",reason:u},eo())}finally{gt.p=i,a!==null&&s.types!==null&&(a.types=s.types),Ne.T=a}}function pX(){}function vx(e,t,n,r){if(e.tag!==5)throw Error(Y(476));var o=J3(e).queue;X3(e,o,t,rc,n===null?pX:function(){return Q3(e),n(r)})}function J3(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:rc,baseState:rc,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ra,lastRenderedState:rc},next:null};var n={};return t.next={memoizedState:n,baseState:n,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ra,lastRenderedState:n},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function Q3(e){var t=J3(e);t.next===null&&(t=e.alternate.memoizedState),vm(e,t.next.queue,{},eo())}function _1(){return $n(Pm)}function Z3(){return ln().memoizedState}function eU(){return ln().memoizedState}function mX(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var n=eo();e=Ls(n);var r=Us(t,e,n);r!==null&&(Mr(r,t,n),bm(r,t,n)),t={cache:o1()},e.payload=t;return}t=t.return}}function gX(e,t,n){var r=eo();n={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null},g_(e)?nU(t,n):(n=e1(e,t,n,r),n!==null&&(Mr(n,e,r),rU(n,t,r)))}function tU(e,t,n){var r=eo();vm(e,t,n,r)}function vm(e,t,n,r){var o={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null};if(g_(e))nU(t,o);else{var i=e.alternate;if(e.lanes===0&&(i===null||i.lanes===0)&&(i=t.lastRenderedReducer,i!==null))try{var a=t.lastRenderedState,s=i(a,n);if(o.hasEagerState=!0,o.eagerState=s,to(s,a))return u_(e,t,o,0),It===null&&c_(),!1}catch{}finally{}if(n=e1(e,t,o,r),n!==null)return Mr(n,e,r),rU(n,t,r),!0}return!1}function v1(e,t,n,r){if(r={lane:2,revertLane:N1(),gesture:null,action:r,hasEagerState:!1,eagerState:null,next:null},g_(e)){if(t)throw Error(Y(479))}else t=e1(e,n,r,2),t!==null&&Mr(t,e,2)}function g_(e){var t=e.alternate;return e===qe||t!==null&&t===qe}function nU(e,t){$d=G0=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function rU(e,t,n){if((n&4194048)!==0){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,GL(e,n)}}var Dm={readContext:$n,use:p_,useCallback:rn,useContext:rn,useEffect:rn,useImperativeHandle:rn,useLayoutEffect:rn,useInsertionEffect:rn,useMemo:rn,useReducer:rn,useRef:rn,useState:rn,useDebugValue:rn,useDeferredValue:rn,useTransition:rn,useSyncExternalStore:rn,useId:rn,useHostTransitionStatus:rn,useFormState:rn,useActionState:rn,useOptimistic:rn,useMemoCache:rn,useCacheRefresh:rn};Dm.useEffectEvent=rn;var oU={readContext:$n,use:p_,useCallback:function(e,t){return ur().memoizedState=[e,t===void 0?null:t],e},useContext:$n,useEffect:HD,useImperativeHandle:function(e,t,n){n=n!=null?n.concat([e]):null,E0(4194308,4,q3.bind(null,t,e),n)},useLayoutEffect:function(e,t){return E0(4194308,4,e,t)},useInsertionEffect:function(e,t){E0(4,2,e,t)},useMemo:function(e,t){var n=ur();t=t===void 0?null:t;var r=e();if(dc){Is(!0);try{e()}finally{Is(!1)}}return n.memoizedState=[r,t],r},useReducer:function(e,t,n){var r=ur();if(n!==void 0){var o=n(t);if(dc){Is(!0);try{n(t)}finally{Is(!1)}}}else o=t;return r.memoizedState=r.baseState=o,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:o},r.queue=e,e=e.dispatch=gX.bind(null,qe,e),[r.memoizedState,e]},useRef:function(e){var t=ur();return e={current:e},t.memoizedState=e},useState:function(e){e=yx(e);var t=e.queue,n=tU.bind(null,qe,t);return t.dispatch=n,[e.memoizedState,n]},useDebugValue:b1,useDeferredValue:function(e,t){var n=ur();return y1(n,e,t)},useTransition:function(){var e=yx(!1);return e=X3.bind(null,qe,e.queue,!0,!1),ur().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,n){var r=qe,o=ur();if(ot){if(n===void 0)throw Error(Y(407));n=n()}else{if(n=t(),It===null)throw Error(Y(349));(nt&127)!==0||C3(r,t,n)}o.memoizedState=n;var i={value:n,getSnapshot:t};return o.queue=i,HD(O3.bind(null,r,i,e),[e]),r.flags|=2048,Xd(9,{destroy:void 0},M3.bind(null,r,i,n,t),null),n},useId:function(){var e=ur(),t=It.identifierPrefix;if(ot){var n=Li,r=Di;n=(r&~(1<<32-Zr(r)-1)).toString(32)+n,t="_"+t+"R_"+n,n=$0++,0<n&&(t+="H"+n.toString(32)),t+="_"}else n=lX++,t="_"+t+"r_"+n.toString(32)+"_";return e.memoizedState=t},useHostTransitionStatus:_1,useFormState:BD,useActionState:BD,useOptimistic:function(e){var t=ur();t.memoizedState=t.baseState=e;var n={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=n,t=v1.bind(null,qe,!0,n),n.dispatch=t,[e,t]},useMemoCache:m1,useCacheRefresh:function(){return ur().memoizedState=mX.bind(null,qe)},useEffectEvent:function(e){var t=ur(),n={impl:e};return t.memoizedState=n,function(){if((mt&2)!==0)throw Error(Y(440));return n.impl.apply(void 0,arguments)}}},S1={readContext:$n,use:p_,useCallback:W3,useContext:$n,useEffect:h1,useImperativeHandle:V3,useInsertionEffect:$3,useLayoutEffect:j3,useMemo:Y3,useReducer:S0,useRef:H3,useState:function(){return S0(Ra)},useDebugValue:b1,useDeferredValue:function(e,t){var n=ln();return K3(n,St.memoizedState,e,t)},useTransition:function(){var e=S0(Ra)[0],t=ln().memoizedState;return[typeof e=="boolean"?e:Wm(e),t]},useSyncExternalStore:R3,useId:Z3,useHostTransitionStatus:_1,useFormState:zD,useActionState:zD,useOptimistic:function(e,t){var n=ln();return U3(n,St,e,t)},useMemoCache:m1,useCacheRefresh:eU};S1.useEffectEvent=G3;var iU={readContext:$n,use:p_,useCallback:W3,useContext:$n,useEffect:h1,useImperativeHandle:V3,useInsertionEffect:$3,useLayoutEffect:j3,useMemo:Y3,useReducer:Iw,useRef:H3,useState:function(){return Iw(Ra)},useDebugValue:b1,useDeferredValue:function(e,t){var n=ln();return St===null?y1(n,e,t):K3(n,St.memoizedState,e,t)},useTransition:function(){var e=Iw(Ra)[0],t=ln().memoizedState;return[typeof e=="boolean"?e:Wm(e),t]},useSyncExternalStore:R3,useId:Z3,useHostTransitionStatus:_1,useFormState:FD,useActionState:FD,useOptimistic:function(e,t){var n=ln();return St!==null?U3(n,St,e,t):(n.baseState=e,[e,n.queue.dispatch])},useMemoCache:m1,useCacheRefresh:eU};iU.useEffectEvent=G3;function Nw(e,t,n,r){t=e.memoizedState,n=n(r,t),n=n==null?t:Bt({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var Sx={enqueueSetState:function(e,t,n){e=e._reactInternals;var r=eo(),o=Ls(r);o.payload=t,n!=null&&(o.callback=n),t=Us(e,o,r),t!==null&&(Mr(t,e,r),bm(t,e,r))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var r=eo(),o=Ls(r);o.tag=1,o.payload=t,n!=null&&(o.callback=n),t=Us(e,o,r),t!==null&&(Mr(t,e,r),bm(t,e,r))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=eo(),r=Ls(n);r.tag=2,t!=null&&(r.callback=t),t=Us(e,r,n),t!==null&&(Mr(t,e,n),bm(t,e,n))}};function GD(e,t,n,r,o,i,a){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(r,i,a):t.prototype&&t.prototype.isPureReactComponent?!Nm(n,r)||!Nm(o,i):!0}function $D(e,t,n,r){e=t.state,typeof t.componentWillReceiveProps=="function"&&t.componentWillReceiveProps(n,r),typeof t.UNSAFE_componentWillReceiveProps=="function"&&t.UNSAFE_componentWillReceiveProps(n,r),t.state!==e&&Sx.enqueueReplaceState(t,t.state,null)}function fc(e,t){var n=t;if("ref"in t){n={};for(var r in t)r!=="ref"&&(n[r]=t[r])}if(e=e.defaultProps){n===t&&(n=Bt({},n));for(var o in e)n[o]===void 0&&(n[o]=e[o])}return n}function aU(e){L0(e)}function sU(e){console.error(e)}function lU(e){L0(e)}function j0(e,t){try{var n=e.onUncaughtError;n(t.value,{componentStack:t.stack})}catch(r){setTimeout(function(){throw r})}}function jD(e,t,n){try{var r=e.onCaughtError;r(n.value,{componentStack:n.stack,errorBoundary:t.tag===1?t.stateNode:null})}catch(o){setTimeout(function(){throw o})}}function Ex(e,t,n){return n=Ls(n),n.tag=3,n.payload={element:null},n.callback=function(){j0(e,t)},n}function cU(e){return e=Ls(e),e.tag=3,e}function uU(e,t,n,r){var o=n.type.getDerivedStateFromError;if(typeof o=="function"){var i=r.value;e.payload=function(){return o(i)},e.callback=function(){jD(t,n,r)}}var a=n.stateNode;a!==null&&typeof a.componentDidCatch=="function"&&(e.callback=function(){jD(t,n,r),typeof o!="function"&&(Ps===null?Ps=new Set([this]):Ps.add(this));var s=r.stack;this.componentDidCatch(r.value,{componentStack:s!==null?s:""})})}function hX(e,t,n,r,o){if(n.flags|=32768,r!==null&&typeof r=="object"&&typeof r.then=="function"){if(t=n.alternate,t!==null&&of(t,n,o,!0),n=no.current,n!==null){switch(n.tag){case 31:case 13:return Do===null?K0():n.alternate===null&&on===0&&(on=3),n.flags&=-257,n.flags|=65536,n.lanes=o,r===z0?n.flags|=16384:(t=n.updateQueue,t===null?n.updateQueue=new Set([r]):t.add(r),Fw(e,r,o)),!1;case 22:return n.flags|=65536,r===z0?n.flags|=16384:(t=n.updateQueue,t===null?(t={transitions:null,markerInstances:null,retryQueue:new Set([r])},n.updateQueue=t):(n=t.retryQueue,n===null?t.retryQueue=new Set([r]):n.add(r)),Fw(e,r,o)),!1}throw Error(Y(435,n.tag))}return Fw(e,r,o),K0(),!1}if(ot)return t=no.current,t!==null?((t.flags&65536)===0&&(t.flags|=256),t.flags|=65536,t.lanes=o,r!==cx&&(e=Error(Y(422),{cause:r}),Cm(Mo(e,n)))):(r!==cx&&(t=Error(Y(423),{cause:r}),Cm(Mo(t,n))),e=e.current.alternate,e.flags|=65536,o&=-o,e.lanes|=o,r=Mo(r,n),o=Ex(e.stateNode,r,o),Aw(e,o),on!==4&&(on=2)),!1;var i=Error(Y(520),{cause:r});if(i=Mo(i,n),Tm===null?Tm=[i]:Tm.push(i),on!==4&&(on=2),t===null)return!0;r=Mo(r,n),n=t;do{switch(n.tag){case 3:return n.flags|=65536,e=o&-o,n.lanes|=e,e=Ex(n.stateNode,r,e),Aw(n,e),!1;case 1:if(t=n.type,i=n.stateNode,(n.flags&128)===0&&(typeof t.getDerivedStateFromError=="function"||i!==null&&typeof i.componentDidCatch=="function"&&(Ps===null||!Ps.has(i))))return n.flags|=65536,o&=-o,n.lanes|=o,o=cU(o),uU(o,e,n,r),Aw(n,o),!1}n=n.return}while(n!==null);return!1}var E1=Error(Y(461)),_n=!1;function Fn(e,t,n,r){t.child=e===null?w3(t,null,n,r):uc(t,e.child,n,r)}function qD(e,t,n,r,o){n=n.render;var i=t.ref;if("ref"in r){var a={};for(var s in r)s!=="ref"&&(a[s]=r[s])}else a=r;return cc(t),r=u1(e,t,n,a,i,o),s=d1(),e!==null&&!_n?(f1(e,t,o),Ca(e,t,o)):(ot&&s&&n1(t),t.flags|=1,Fn(e,t,r,o),t.child)}function VD(e,t,n,r,o){if(e===null){var i=n.type;return typeof i=="function"&&!t1(i)&&i.defaultProps===void 0&&n.compare===null?(t.tag=15,t.type=i,dU(e,t,i,r,o)):(e=_0(n.type,null,r,t,t.mode,o),e.ref=t.ref,e.return=t,t.child=e)}if(i=e.child,!T1(e,o)){var a=i.memoizedProps;if(n=n.compare,n=n!==null?n:Nm,n(a,r)&&e.ref===t.ref)return Ca(e,t,o)}return t.flags|=1,e=xa(i,r),e.ref=t.ref,e.return=t,t.child=e}function dU(e,t,n,r,o){if(e!==null){var i=e.memoizedProps;if(Nm(i,r)&&e.ref===t.ref)if(_n=!1,t.pendingProps=r=i,T1(e,o))(e.flags&131072)!==0&&(_n=!0);else return t.lanes=e.lanes,Ca(e,t,o)}return Tx(e,t,n,r,o)}function fU(e,t,n,r){var o=r.children,i=e!==null?e.memoizedState:null;if(e===null&&t.stateNode===null&&(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),r.mode==="hidden"){if((t.flags&128)!==0){if(i=i!==null?i.baseLanes|n:n,e!==null){for(r=t.child=e.child,o=0;r!==null;)o=o|r.lanes|r.childLanes,r=r.sibling;r=o&~i}else r=0,t.child=null;return WD(e,t,i,n,r)}if((n&536870912)!==0)t.memoizedState={baseLanes:0,cachePool:null},e!==null&&v0(t,i!==null?i.cachePool:null),i!==null?LD(t,i):hx(),A3(t);else return r=t.lanes=536870912,WD(e,t,i!==null?i.baseLanes|n:n,n,r)}else i!==null?(v0(t,i.cachePool),LD(t,i),ks(t),t.memoizedState=null):(e!==null&&v0(t,null),hx(),ks(t));return Fn(e,t,o,n),t.child}function dm(e,t){return e!==null&&e.tag===22||t.stateNode!==null||(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),t.sibling}function WD(e,t,n,r,o){var i=i1();return i=i===null?null:{parent:yn._currentValue,pool:i},t.memoizedState={baseLanes:n,cachePool:i},e!==null&&v0(t,null),hx(),A3(t),e!==null&&of(e,t,r,!0),t.childLanes=o,null}function T0(e,t){return t=q0({mode:t.mode,children:t.children},e.mode),t.ref=e.ref,e.child=t,t.return=e,t}function YD(e,t,n){return uc(t,e.child,null,n),e=T0(t,t.pendingProps),e.flags|=2,Yr(t),t.memoizedState=null,e}function bX(e,t,n){var r=t.pendingProps,o=(t.flags&128)!==0;if(t.flags&=-129,e===null){if(ot){if(r.mode==="hidden")return e=T0(t,r),t.lanes=536870912,dm(null,e);if(bx(t),(e=Pt)?(e=o6(e,Oo),e=e!==null&&e.data==="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:Gs!==null?{id:Di,overflow:Li}:null,retryLane:536870912,hydrationErrors:null},n=b3(e),n.return=t,t.child=n,Gn=t,Pt=null)):e=null,e===null)throw $s(t);return t.lanes=536870912,null}return T0(t,r)}var i=e.memoizedState;if(i!==null){var a=i.dehydrated;if(bx(t),o)if(t.flags&256)t.flags&=-257,t=YD(e,t,n);else if(t.memoizedState!==null)t.child=e.child,t.flags|=128,t=null;else throw Error(Y(558));else if(_n||of(e,t,n,!1),o=(n&e.childLanes)!==0,_n||o){if(r=It,r!==null&&(a=$L(r,n),a!==0&&a!==i.retryLane))throw i.retryLane=a,hc(e,a),Mr(r,e,a),E1;K0(),t=YD(e,t,n)}else e=i.treeContext,Pt=Lo(a.nextSibling),Gn=t,ot=!0,Ds=null,Oo=!1,e!==null&&_3(t,e),t=T0(t,r),t.flags|=4096;return t}return e=xa(e.child,{mode:r.mode,children:r.children}),e.ref=t.ref,t.child=e,e.return=t,e}function w0(e,t){var n=t.ref;if(n===null)e!==null&&e.ref!==null&&(t.flags|=4194816);else{if(typeof n!="function"&&typeof n!="object")throw Error(Y(284));(e===null||e.ref!==n)&&(t.flags|=4194816)}}function Tx(e,t,n,r,o){return cc(t),n=u1(e,t,n,r,void 0,o),r=d1(),e!==null&&!_n?(f1(e,t,o),Ca(e,t,o)):(ot&&r&&n1(t),t.flags|=1,Fn(e,t,n,o),t.child)}function KD(e,t,n,r,o,i){return cc(t),t.updateQueue=null,n=N3(t,r,n,o),I3(e),r=d1(),e!==null&&!_n?(f1(e,t,i),Ca(e,t,i)):(ot&&r&&n1(t),t.flags|=1,Fn(e,t,n,i),t.child)}function XD(e,t,n,r,o){if(cc(t),t.stateNode===null){var i=Dd,a=n.contextType;typeof a=="object"&&a!==null&&(i=$n(a)),i=new n(r,i),t.memoizedState=i.state!==null&&i.state!==void 0?i.state:null,i.updater=Sx,t.stateNode=i,i._reactInternals=t,i=t.stateNode,i.props=r,i.state=t.memoizedState,i.refs={},s1(t),a=n.contextType,i.context=typeof a=="object"&&a!==null?$n(a):Dd,i.state=t.memoizedState,a=n.getDerivedStateFromProps,typeof a=="function"&&(Nw(t,n,a,r),i.state=t.memoizedState),typeof n.getDerivedStateFromProps=="function"||typeof i.getSnapshotBeforeUpdate=="function"||typeof i.UNSAFE_componentWillMount!="function"&&typeof i.componentWillMount!="function"||(a=i.state,typeof i.componentWillMount=="function"&&i.componentWillMount(),typeof i.UNSAFE_componentWillMount=="function"&&i.UNSAFE_componentWillMount(),a!==i.state&&Sx.enqueueReplaceState(i,i.state,null),_m(t,r,i,o),ym(),i.state=t.memoizedState),typeof i.componentDidMount=="function"&&(t.flags|=4194308),r=!0}else if(e===null){i=t.stateNode;var s=t.memoizedProps,l=fc(n,s);i.props=l;var c=i.context,d=n.contextType;a=Dd,typeof d=="object"&&d!==null&&(a=$n(d));var u=n.getDerivedStateFromProps;d=typeof u=="function"||typeof i.getSnapshotBeforeUpdate=="function",s=t.pendingProps!==s,d||typeof i.UNSAFE_componentWillReceiveProps!="function"&&typeof i.componentWillReceiveProps!="function"||(s||c!==a)&&$D(t,i,r,a),Ts=!1;var m=t.memoizedState;i.state=m,_m(t,r,i,o),ym(),c=t.memoizedState,s||m!==c||Ts?(typeof u=="function"&&(Nw(t,n,u,r),c=t.memoizedState),(l=Ts||GD(t,n,l,r,m,c,a))?(d||typeof i.UNSAFE_componentWillMount!="function"&&typeof i.componentWillMount!="function"||(typeof i.componentWillMount=="function"&&i.componentWillMount(),typeof i.UNSAFE_componentWillMount=="function"&&i.UNSAFE_componentWillMount()),typeof i.componentDidMount=="function"&&(t.flags|=4194308)):(typeof i.componentDidMount=="function"&&(t.flags|=4194308),t.memoizedProps=r,t.memoizedState=c),i.props=r,i.state=c,i.context=a,r=l):(typeof i.componentDidMount=="function"&&(t.flags|=4194308),r=!1)}else{i=t.stateNode,mx(e,t),a=t.memoizedProps,d=fc(n,a),i.props=d,u=t.pendingProps,m=i.context,c=n.contextType,l=Dd,typeof c=="object"&&c!==null&&(l=$n(c)),s=n.getDerivedStateFromProps,(c=typeof s=="function"||typeof i.getSnapshotBeforeUpdate=="function")||typeof i.UNSAFE_componentWillReceiveProps!="function"&&typeof i.componentWillReceiveProps!="function"||(a!==u||m!==l)&&$D(t,i,r,l),Ts=!1,m=t.memoizedState,i.state=m,_m(t,r,i,o),ym();var p=t.memoizedState;a!==u||m!==p||Ts||e!==null&&e.dependencies!==null&&B0(e.dependencies)?(typeof s=="function"&&(Nw(t,n,s,r),p=t.memoizedState),(d=Ts||GD(t,n,d,r,m,p,l)||e!==null&&e.dependencies!==null&&B0(e.dependencies))?(c||typeof i.UNSAFE_componentWillUpdate!="function"&&typeof i.componentWillUpdate!="function"||(typeof i.componentWillUpdate=="function"&&i.componentWillUpdate(r,p,l),typeof i.UNSAFE_componentWillUpdate=="function"&&i.UNSAFE_componentWillUpdate(r,p,l)),typeof i.componentDidUpdate=="function"&&(t.flags|=4),typeof i.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof i.componentDidUpdate!="function"||a===e.memoizedProps&&m===e.memoizedState||(t.flags|=4),typeof i.getSnapshotBeforeUpdate!="function"||a===e.memoizedProps&&m===e.memoizedState||(t.flags|=1024),t.memoizedProps=r,t.memoizedState=p),i.props=r,i.state=p,i.context=l,r=d):(typeof i.componentDidUpdate!="function"||a===e.memoizedProps&&m===e.memoizedState||(t.flags|=4),typeof i.getSnapshotBeforeUpdate!="function"||a===e.memoizedProps&&m===e.memoizedState||(t.flags|=1024),r=!1)}return i=r,w0(e,t),r=(t.flags&128)!==0,i||r?(i=t.stateNode,n=r&&typeof n.getDerivedStateFromError!="function"?null:i.render(),t.flags|=1,e!==null&&r?(t.child=uc(t,e.child,null,o),t.child=uc(t,null,n,o)):Fn(e,t,n,o),t.memoizedState=i.state,e=t.child):e=Ca(e,t,o),e}function JD(e,t,n,r){return lc(),t.flags|=256,Fn(e,t,n,r),t.child}var Rw={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Cw(e){return{baseLanes:e,cachePool:S3()}}function Mw(e,t,n){return e=e!==null?e.childLanes&~n:0,t&&(e|=Xr),e}function pU(e,t,n){var r=t.pendingProps,o=!1,i=(t.flags&128)!==0,a;if((a=i)||(a=e!==null&&e.memoizedState===null?!1:(sn.current&2)!==0),a&&(o=!0,t.flags&=-129),a=(t.flags&32)!==0,t.flags&=-33,e===null){if(ot){if(o?xs(t):ks(t),(e=Pt)?(e=o6(e,Oo),e=e!==null&&e.data!=="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:Gs!==null?{id:Di,overflow:Li}:null,retryLane:536870912,hydrationErrors:null},n=b3(e),n.return=t,t.child=n,Gn=t,Pt=null)):e=null,e===null)throw $s(t);return Px(e)?t.lanes=32:t.lanes=536870912,null}var s=r.children;return r=r.fallback,o?(ks(t),o=t.mode,s=q0({mode:"hidden",children:s},o),r=oc(r,o,n,null),s.return=t,r.return=t,s.sibling=r,t.child=s,r=t.child,r.memoizedState=Cw(n),r.childLanes=Mw(e,a,n),t.memoizedState=Rw,dm(null,r)):(xs(t),wx(t,s))}var l=e.memoizedState;if(l!==null&&(s=l.dehydrated,s!==null)){if(i)t.flags&256?(xs(t),t.flags&=-257,t=Ow(e,t,n)):t.memoizedState!==null?(ks(t),t.child=e.child,t.flags|=128,t=null):(ks(t),s=r.fallback,o=t.mode,r=q0({mode:"visible",children:r.children},o),s=oc(s,o,n,null),s.flags|=2,r.return=t,s.return=t,r.sibling=s,t.child=r,uc(t,e.child,null,n),r=t.child,r.memoizedState=Cw(n),r.childLanes=Mw(e,a,n),t.memoizedState=Rw,t=dm(null,r));else if(xs(t),Px(s)){if(a=s.nextSibling&&s.nextSibling.dataset,a)var c=a.dgst;a=c,r=Error(Y(419)),r.stack="",r.digest=a,Cm({value:r,source:null,stack:null}),t=Ow(e,t,n)}else if(_n||of(e,t,n,!1),a=(n&e.childLanes)!==0,_n||a){if(a=It,a!==null&&(r=$L(a,n),r!==0&&r!==l.retryLane))throw l.retryLane=r,hc(e,r),Mr(a,e,r),E1;Ux(s)||K0(),t=Ow(e,t,n)}else Ux(s)?(t.flags|=192,t.child=e.child,t=null):(e=l.treeContext,Pt=Lo(s.nextSibling),Gn=t,ot=!0,Ds=null,Oo=!1,e!==null&&_3(t,e),t=wx(t,r.children),t.flags|=4096);return t}return o?(ks(t),s=r.fallback,o=t.mode,l=e.child,c=l.sibling,r=xa(l,{mode:"hidden",children:r.children}),r.subtreeFlags=l.subtreeFlags&65011712,c!==null?s=xa(c,s):(s=oc(s,o,n,null),s.flags|=2),s.return=t,r.return=t,r.sibling=s,t.child=r,dm(null,r),r=t.child,s=e.child.memoizedState,s===null?s=Cw(n):(o=s.cachePool,o!==null?(l=yn._currentValue,o=o.parent!==l?{parent:l,pool:l}:o):o=S3(),s={baseLanes:s.baseLanes|n,cachePool:o}),r.memoizedState=s,r.childLanes=Mw(e,a,n),t.memoizedState=Rw,dm(e.child,r)):(xs(t),n=e.child,e=n.sibling,n=xa(n,{mode:"visible",children:r.children}),n.return=t,n.sibling=null,e!==null&&(a=t.deletions,a===null?(t.deletions=[e],t.flags|=16):a.push(e)),t.child=n,t.memoizedState=null,n)}function wx(e,t){return t=q0({mode:"visible",children:t},e.mode),t.return=e,e.child=t}function q0(e,t){return e=Kr(22,e,null,t),e.lanes=0,e}function Ow(e,t,n){return uc(t,e.child,null,n),e=wx(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function QD(e,t,n){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),dx(e.return,t,n)}function Dw(e,t,n,r,o,i){var a=e.memoizedState;a===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:r,tail:n,tailMode:o,treeForkCount:i}:(a.isBackwards=t,a.rendering=null,a.renderingStartTime=0,a.last=r,a.tail=n,a.tailMode=o,a.treeForkCount=i)}function mU(e,t,n){var r=t.pendingProps,o=r.revealOrder,i=r.tail;r=r.children;var a=sn.current,s=(a&2)!==0;if(s?(a=a&1|2,t.flags|=128):a&=1,Ot(sn,a),Fn(e,t,r,n),r=ot?Rm:0,!s&&e!==null&&(e.flags&128)!==0)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&QD(e,n,t);else if(e.tag===19)QD(e,n,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break e;for(;e.sibling===null;){if(e.return===null||e.return===t)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}switch(o){case"forwards":for(n=t.child,o=null;n!==null;)e=n.alternate,e!==null&&H0(e)===null&&(o=n),n=n.sibling;n=o,n===null?(o=t.child,t.child=null):(o=n.sibling,n.sibling=null),Dw(t,!1,o,n,i,r);break;case"backwards":case"unstable_legacy-backwards":for(n=null,o=t.child,t.child=null;o!==null;){if(e=o.alternate,e!==null&&H0(e)===null){t.child=o;break}e=o.sibling,o.sibling=n,n=o,o=e}Dw(t,!0,n,null,i,r);break;case"together":Dw(t,!1,null,null,void 0,r);break;default:t.memoizedState=null}return t.child}function Ca(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),qs|=t.lanes,(n&t.childLanes)===0)if(e!==null){if(of(e,t,n,!1),(n&t.childLanes)===0)return null}else return null;if(e!==null&&t.child!==e.child)throw Error(Y(153));if(t.child!==null){for(e=t.child,n=xa(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=xa(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function T1(e,t){return(e.lanes&t)!==0?!0:(e=e.dependencies,!!(e!==null&&B0(e)))}function yX(e,t,n){switch(t.tag){case 3:C0(t,t.stateNode.containerInfo),ws(t,yn,e.memoizedState.cache),lc();break;case 27:case 5:Qw(t);break;case 4:C0(t,t.stateNode.containerInfo);break;case 10:ws(t,t.type,t.memoizedProps.value);break;case 31:if(t.memoizedState!==null)return t.flags|=128,bx(t),null;break;case 13:var r=t.memoizedState;if(r!==null)return r.dehydrated!==null?(xs(t),t.flags|=128,null):(n&t.child.childLanes)!==0?pU(e,t,n):(xs(t),e=Ca(e,t,n),e!==null?e.sibling:null);xs(t);break;case 19:var o=(e.flags&128)!==0;if(r=(n&t.childLanes)!==0,r||(of(e,t,n,!1),r=(n&t.childLanes)!==0),o){if(r)return mU(e,t,n);t.flags|=128}if(o=t.memoizedState,o!==null&&(o.rendering=null,o.tail=null,o.lastEffect=null),Ot(sn,sn.current),r)break;return null;case 22:return t.lanes=0,fU(e,t,n,t.pendingProps);case 24:ws(t,yn,e.memoizedState.cache)}return Ca(e,t,n)}function gU(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps)_n=!0;else{if(!T1(e,n)&&(t.flags&128)===0)return _n=!1,yX(e,t,n);_n=(e.flags&131072)!==0}else _n=!1,ot&&(t.flags&1048576)!==0&&y3(t,Rm,t.index);switch(t.lanes=0,t.tag){case 16:e:{var r=t.pendingProps;if(e=tc(t.elementType),t.type=e,typeof e=="function")t1(e)?(r=fc(e,r),t.tag=1,t=XD(null,t,e,r,n)):(t.tag=0,t=Tx(null,t,e,r,n));else{if(e!=null){var o=e.$$typeof;if(o===Hx){t.tag=11,t=qD(null,t,e,r,n);break e}else if(o===Gx){t.tag=14,t=VD(null,t,e,r,n);break e}}throw t=Xw(e)||e,Error(Y(306,t,""))}}return t;case 0:return Tx(e,t,t.type,t.pendingProps,n);case 1:return r=t.type,o=fc(r,t.pendingProps),XD(e,t,r,o,n);case 3:e:{if(C0(t,t.stateNode.containerInfo),e===null)throw Error(Y(387));r=t.pendingProps;var i=t.memoizedState;o=i.element,mx(e,t),_m(t,r,null,n);var a=t.memoizedState;if(r=a.cache,ws(t,yn,r),r!==i.cache&&fx(t,[yn],n,!0),ym(),r=a.element,i.isDehydrated)if(i={element:r,isDehydrated:!1,cache:a.cache},t.updateQueue.baseState=i,t.memoizedState=i,t.flags&256){t=JD(e,t,r,n);break e}else if(r!==o){o=Mo(Error(Y(424)),t),Cm(o),t=JD(e,t,r,n);break e}else{switch(e=t.stateNode.containerInfo,e.nodeType){case 9:e=e.body;break;default:e=e.nodeName==="HTML"?e.ownerDocument.body:e}for(Pt=Lo(e.firstChild),Gn=t,ot=!0,Ds=null,Oo=!0,n=w3(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling}else{if(lc(),r===o){t=Ca(e,t,n);break e}Fn(e,t,r,n)}t=t.child}return t;case 26:return w0(e,t),e===null?(n=vL(t.type,null,t.pendingProps,null))?t.memoizedState=n:ot||(n=t.type,e=t.pendingProps,r=Z0(Os.current).createElement(n),r[Hn]=t,r[Or]=e,jn(r,n,e),Un(r),t.stateNode=r):t.memoizedState=vL(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return Qw(t),e===null&&ot&&(r=t.stateNode=i6(t.type,t.pendingProps,Os.current),Gn=t,Oo=!0,o=Pt,Ws(t.type)?(Bx=o,Pt=Lo(r.firstChild)):Pt=o),Fn(e,t,t.pendingProps.children,n),w0(e,t),e===null&&(t.flags|=4194304),t.child;case 5:return e===null&&ot&&((o=r=Pt)&&(r=VX(r,t.type,t.pendingProps,Oo),r!==null?(t.stateNode=r,Gn=t,Pt=Lo(r.firstChild),Oo=!1,o=!0):o=!1),o||$s(t)),Qw(t),o=t.type,i=t.pendingProps,a=e!==null?e.memoizedProps:null,r=i.children,Dx(o,i)?r=null:a!==null&&Dx(o,a)&&(t.flags|=32),t.memoizedState!==null&&(o=u1(e,t,cX,null,null,n),Pm._currentValue=o),w0(e,t),Fn(e,t,r,n),t.child;case 6:return e===null&&ot&&((e=n=Pt)&&(n=WX(n,t.pendingProps,Oo),n!==null?(t.stateNode=n,Gn=t,Pt=null,e=!0):e=!1),e||$s(t)),null;case 13:return pU(e,t,n);case 4:return C0(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=uc(t,null,r,n):Fn(e,t,r,n),t.child;case 11:return qD(e,t,t.type,t.pendingProps,n);case 7:return Fn(e,t,t.pendingProps,n),t.child;case 8:return Fn(e,t,t.pendingProps.children,n),t.child;case 12:return Fn(e,t,t.pendingProps.children,n),t.child;case 10:return r=t.pendingProps,ws(t,t.type,r.value),Fn(e,t,r.children,n),t.child;case 9:return o=t.type._context,r=t.pendingProps.children,cc(t),o=$n(o),r=r(o),t.flags|=1,Fn(e,t,r,n),t.child;case 14:return VD(e,t,t.type,t.pendingProps,n);case 15:return dU(e,t,t.type,t.pendingProps,n);case 19:return mU(e,t,n);case 31:return bX(e,t,n);case 22:return fU(e,t,n,t.pendingProps);case 24:return cc(t),r=$n(yn),e===null?(o=i1(),o===null&&(o=It,i=o1(),o.pooledCache=i,i.refCount++,i!==null&&(o.pooledCacheLanes|=n),o=i),t.memoizedState={parent:r,cache:o},s1(t),ws(t,yn,o)):((e.lanes&n)!==0&&(mx(e,t),_m(t,null,null,n),ym()),o=e.memoizedState,i=t.memoizedState,o.parent!==r?(o={parent:r,cache:r},t.memoizedState=o,t.lanes===0&&(t.memoizedState=t.updateQueue.baseState=o),ws(t,yn,r)):(r=i.cache,ws(t,yn,r),r!==o.cache&&fx(t,[yn],n,!0))),Fn(e,t,t.pendingProps.children,n),t.child;case 29:throw t.pendingProps}throw Error(Y(156,t.tag))}function ha(e){e.flags|=4}function Lw(e,t,n,r,o){if((t=(e.mode&32)!==0)&&(t=!1),t){if(e.flags|=16777216,(o&335544128)===o)if(e.stateNode.complete)e.flags|=8192;else if(zU())e.flags|=8192;else throw ac=z0,a1}else e.flags&=-16777217}function ZD(e,t){if(t.type!=="stylesheet"||(t.state.loading&4)!==0)e.flags&=-16777217;else if(e.flags|=16777216,!l6(t))if(zU())e.flags|=8192;else throw ac=z0,a1}function l0(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag!==22?FL():536870912,e.lanes|=t,Jd|=t)}function om(e,t){if(!ot)switch(e.tailMode){case"hidden":t=e.tail;for(var n=null;t!==null;)t.alternate!==null&&(n=t),t=t.sibling;n===null?e.tail=null:n.sibling=null;break;case"collapsed":n=e.tail;for(var r=null;n!==null;)n.alternate!==null&&(r=n),n=n.sibling;r===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:r.sibling=null}}function Ut(e){var t=e.alternate!==null&&e.alternate.child===e.child,n=0,r=0;if(t)for(var o=e.child;o!==null;)n|=o.lanes|o.childLanes,r|=o.subtreeFlags&65011712,r|=o.flags&65011712,o.return=e,o=o.sibling;else for(o=e.child;o!==null;)n|=o.lanes|o.childLanes,r|=o.subtreeFlags,r|=o.flags,o.return=e,o=o.sibling;return e.subtreeFlags|=r,e.childLanes=n,t}function _X(e,t,n){var r=t.pendingProps;switch(r1(t),t.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Ut(t),null;case 1:return Ut(t),null;case 3:return n=t.stateNode,r=null,e!==null&&(r=e.memoizedState.cache),t.memoizedState.cache!==r&&(t.flags|=2048),ka(yn),qd(),n.pendingContext&&(n.context=n.pendingContext,n.pendingContext=null),(e===null||e.child===null)&&(Ed(t)?ha(t):e===null||e.memoizedState.isDehydrated&&(t.flags&256)===0||(t.flags|=1024,kw())),Ut(t),null;case 26:var o=t.type,i=t.memoizedState;return e===null?(ha(t),i!==null?(Ut(t),ZD(t,i)):(Ut(t),Lw(t,o,null,r,n))):i?i!==e.memoizedState?(ha(t),Ut(t),ZD(t,i)):(Ut(t),t.flags&=-16777217):(e=e.memoizedProps,e!==r&&ha(t),Ut(t),Lw(t,o,e,r,n)),null;case 27:if(M0(t),n=Os.current,o=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==r&&ha(t);else{if(!r){if(t.stateNode===null)throw Error(Y(166));return Ut(t),null}e=Pi.current,Ed(t)?ID(t,e):(e=i6(o,r,n),t.stateNode=e,ha(t))}return Ut(t),null;case 5:if(M0(t),o=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==r&&ha(t);else{if(!r){if(t.stateNode===null)throw Error(Y(166));return Ut(t),null}if(i=Pi.current,Ed(t))ID(t,i);else{var a=Z0(Os.current);switch(i){case 1:i=a.createElementNS("http://www.w3.org/2000/svg",o);break;case 2:i=a.createElementNS("http://www.w3.org/1998/Math/MathML",o);break;default:switch(o){case"svg":i=a.createElementNS("http://www.w3.org/2000/svg",o);break;case"math":i=a.createElementNS("http://www.w3.org/1998/Math/MathML",o);break;case"script":i=a.createElement("div"),i.innerHTML="<script><\/script>",i=i.removeChild(i.firstChild);break;case"select":i=typeof r.is=="string"?a.createElement("select",{is:r.is}):a.createElement("select"),r.multiple?i.multiple=!0:r.size&&(i.size=r.size);break;default:i=typeof r.is=="string"?a.createElement(o,{is:r.is}):a.createElement(o)}}i[Hn]=t,i[Or]=r;e:for(a=t.child;a!==null;){if(a.tag===5||a.tag===6)i.appendChild(a.stateNode);else if(a.tag!==4&&a.tag!==27&&a.child!==null){a.child.return=a,a=a.child;continue}if(a===t)break e;for(;a.sibling===null;){if(a.return===null||a.return===t)break e;a=a.return}a.sibling.return=a.return,a=a.sibling}t.stateNode=i;e:switch(jn(i,o,r),o){case"button":case"input":case"select":case"textarea":r=!!r.autoFocus;break e;case"img":r=!0;break e;default:r=!1}r&&ha(t)}}return Ut(t),Lw(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,n),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==r&&ha(t);else{if(typeof r!="string"&&t.stateNode===null)throw Error(Y(166));if(e=Os.current,Ed(t)){if(e=t.stateNode,n=t.memoizedProps,r=null,o=Gn,o!==null)switch(o.tag){case 27:case 5:r=o.memoizedProps}e[Hn]=t,e=!!(e.nodeValue===n||r!==null&&r.suppressHydrationWarning===!0||t6(e.nodeValue,n)),e||$s(t,!0)}else e=Z0(e).createTextNode(r),e[Hn]=t,t.stateNode=e}return Ut(t),null;case 31:if(n=t.memoizedState,e===null||e.memoizedState!==null){if(r=Ed(t),n!==null){if(e===null){if(!r)throw Error(Y(318));if(e=t.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(Y(557));e[Hn]=t}else lc(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;Ut(t),e=!1}else n=kw(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=n),e=!0;if(!e)return t.flags&256?(Yr(t),t):(Yr(t),null);if((t.flags&128)!==0)throw Error(Y(558))}return Ut(t),null;case 13:if(r=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(o=Ed(t),r!==null&&r.dehydrated!==null){if(e===null){if(!o)throw Error(Y(318));if(o=t.memoizedState,o=o!==null?o.dehydrated:null,!o)throw Error(Y(317));o[Hn]=t}else lc(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;Ut(t),o=!1}else o=kw(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=o),o=!0;if(!o)return t.flags&256?(Yr(t),t):(Yr(t),null)}return Yr(t),(t.flags&128)!==0?(t.lanes=n,t):(n=r!==null,e=e!==null&&e.memoizedState!==null,n&&(r=t.child,o=null,r.alternate!==null&&r.alternate.memoizedState!==null&&r.alternate.memoizedState.cachePool!==null&&(o=r.alternate.memoizedState.cachePool.pool),i=null,r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(i=r.memoizedState.cachePool.pool),i!==o&&(r.flags|=2048)),n!==e&&n&&(t.child.flags|=8192),l0(t,t.updateQueue),Ut(t),null);case 4:return qd(),e===null&&R1(t.stateNode.containerInfo),Ut(t),null;case 10:return ka(t.type),Ut(t),null;case 19:if(Pn(sn),r=t.memoizedState,r===null)return Ut(t),null;if(o=(t.flags&128)!==0,i=r.rendering,i===null)if(o)om(r,!1);else{if(on!==0||e!==null&&(e.flags&128)!==0)for(e=t.child;e!==null;){if(i=H0(e),i!==null){for(t.flags|=128,om(r,!1),e=i.updateQueue,t.updateQueue=e,l0(t,e),t.subtreeFlags=0,e=n,n=t.child;n!==null;)h3(n,e),n=n.sibling;return Ot(sn,sn.current&1|2),ot&&va(t,r.treeForkCount),t.child}e=e.sibling}r.tail!==null&&Jr()>W0&&(t.flags|=128,o=!0,om(r,!1),t.lanes=4194304)}else{if(!o)if(e=H0(i),e!==null){if(t.flags|=128,o=!0,e=e.updateQueue,t.updateQueue=e,l0(t,e),om(r,!0),r.tail===null&&r.tailMode==="hidden"&&!i.alternate&&!ot)return Ut(t),null}else 2*Jr()-r.renderingStartTime>W0&&n!==536870912&&(t.flags|=128,o=!0,om(r,!1),t.lanes=4194304);r.isBackwards?(i.sibling=t.child,t.child=i):(e=r.last,e!==null?e.sibling=i:t.child=i,r.last=i)}return r.tail!==null?(e=r.tail,r.rendering=e,r.tail=e.sibling,r.renderingStartTime=Jr(),e.sibling=null,n=sn.current,Ot(sn,o?n&1|2:n&1),ot&&va(t,r.treeForkCount),e):(Ut(t),null);case 22:case 23:return Yr(t),l1(),r=t.memoizedState!==null,e!==null?e.memoizedState!==null!==r&&(t.flags|=8192):r&&(t.flags|=8192),r?(n&536870912)!==0&&(t.flags&128)===0&&(Ut(t),t.subtreeFlags&6&&(t.flags|=8192)):Ut(t),n=t.updateQueue,n!==null&&l0(t,n.retryQueue),n=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(n=e.memoizedState.cachePool.pool),r=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(r=t.memoizedState.cachePool.pool),r!==n&&(t.flags|=2048),e!==null&&Pn(ic),null;case 24:return n=null,e!==null&&(n=e.memoizedState.cache),t.memoizedState.cache!==n&&(t.flags|=2048),ka(yn),Ut(t),null;case 25:return null;case 30:return null}throw Error(Y(156,t.tag))}function vX(e,t){switch(r1(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return ka(yn),qd(),e=t.flags,(e&65536)!==0&&(e&128)===0?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return M0(t),null;case 31:if(t.memoizedState!==null){if(Yr(t),t.alternate===null)throw Error(Y(340));lc()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(Yr(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(Y(340));lc()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return Pn(sn),null;case 4:return qd(),null;case 10:return ka(t.type),null;case 22:case 23:return Yr(t),l1(),e!==null&&Pn(ic),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return ka(yn),null;case 25:return null;default:return null}}function hU(e,t){switch(r1(t),t.tag){case 3:ka(yn),qd();break;case 26:case 27:case 5:M0(t);break;case 4:qd();break;case 31:t.memoizedState!==null&&Yr(t);break;case 13:Yr(t);break;case 19:Pn(sn);break;case 10:ka(t.type);break;case 22:case 23:Yr(t),l1(),e!==null&&Pn(ic);break;case 24:ka(yn)}}function Ym(e,t){try{var n=t.updateQueue,r=n!==null?n.lastEffect:null;if(r!==null){var o=r.next;n=o;do{if((n.tag&e)===e){r=void 0;var i=n.create,a=n.inst;r=i(),a.destroy=r}n=n.next}while(n!==o)}}catch(s){yt(t,t.return,s)}}function js(e,t,n){try{var r=t.updateQueue,o=r!==null?r.lastEffect:null;if(o!==null){var i=o.next;r=i;do{if((r.tag&e)===e){var a=r.inst,s=a.destroy;if(s!==void 0){a.destroy=void 0,o=t;var l=n,c=s;try{c()}catch(d){yt(o,l,d)}}}r=r.next}while(r!==i)}}catch(d){yt(t,t.return,d)}}function bU(e){var t=e.updateQueue;if(t!==null){var n=e.stateNode;try{k3(t,n)}catch(r){yt(e,e.return,r)}}}function yU(e,t,n){n.props=fc(e.type,e.memoizedProps),n.state=e.memoizedState;try{n.componentWillUnmount()}catch(r){yt(e,t,r)}}function Sm(e,t){try{var n=e.ref;if(n!==null){switch(e.tag){case 26:case 27:case 5:var r=e.stateNode;break;case 30:r=e.stateNode;break;default:r=e.stateNode}typeof n=="function"?e.refCleanup=n(r):n.current=r}}catch(o){yt(e,t,o)}}function Ui(e,t){var n=e.ref,r=e.refCleanup;if(n!==null)if(typeof r=="function")try{r()}catch(o){yt(e,t,o)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof n=="function")try{n(null)}catch(o){yt(e,t,o)}else n.current=null}function _U(e){var t=e.type,n=e.memoizedProps,r=e.stateNode;try{e:switch(t){case"button":case"input":case"select":case"textarea":n.autoFocus&&r.focus();break e;case"img":n.src?r.src=n.src:n.srcSet&&(r.srcset=n.srcSet)}}catch(o){yt(e,e.return,o)}}function Uw(e,t,n){try{var r=e.stateNode;FX(r,e.type,n,t),r[Or]=t}catch(o){yt(e,e.return,o)}}function vU(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&Ws(e.type)||e.tag===4}function Pw(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||vU(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.tag===27&&Ws(e.type)||e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function xx(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?(n.nodeType===9?n.body:n.nodeName==="HTML"?n.ownerDocument.body:n).insertBefore(e,t):(t=n.nodeType===9?n.body:n.nodeName==="HTML"?n.ownerDocument.body:n,t.appendChild(e),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=Ta));else if(r!==4&&(r===27&&Ws(e.type)&&(n=e.stateNode,t=null),e=e.child,e!==null))for(xx(e,t,n),e=e.sibling;e!==null;)xx(e,t,n),e=e.sibling}function V0(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(r!==4&&(r===27&&Ws(e.type)&&(n=e.stateNode),e=e.child,e!==null))for(V0(e,t,n),e=e.sibling;e!==null;)V0(e,t,n),e=e.sibling}function SU(e){var t=e.stateNode,n=e.memoizedProps;try{for(var r=e.type,o=t.attributes;o.length;)t.removeAttributeNode(o[0]);jn(t,r,n),t[Hn]=e,t[Or]=n}catch(i){yt(e,e.return,i)}}var Sa=!1,bn=!1,Bw=!1,eL=typeof WeakSet=="function"?WeakSet:Set,Ln=null;function SX(e,t){if(e=e.containerInfo,Mx=r_,e=l3(e),Qx(e)){if("selectionStart"in e)var n={start:e.selectionStart,end:e.selectionEnd};else e:{n=(n=e.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var o=r.anchorOffset,i=r.focusNode;r=r.focusOffset;try{n.nodeType,i.nodeType}catch{n=null;break e}var a=0,s=-1,l=-1,c=0,d=0,u=e,m=null;t:for(;;){for(var p;u!==n||o!==0&&u.nodeType!==3||(s=a+o),u!==i||r!==0&&u.nodeType!==3||(l=a+r),u.nodeType===3&&(a+=u.nodeValue.length),(p=u.firstChild)!==null;)m=u,u=p;for(;;){if(u===e)break t;if(m===n&&++c===o&&(s=a),m===i&&++d===r&&(l=a),(p=u.nextSibling)!==null)break;u=m,m=u.parentNode}u=p}n=s===-1||l===-1?null:{start:s,end:l}}else n=null}n=n||{start:0,end:0}}else n=null;for(Ox={focusedElem:e,selectionRange:n},r_=!1,Ln=t;Ln!==null;)if(t=Ln,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,Ln=e;else for(;Ln!==null;){switch(t=Ln,i=t.alternate,e=t.flags,t.tag){case 0:if((e&4)!==0&&(e=t.updateQueue,e=e!==null?e.events:null,e!==null))for(n=0;n<e.length;n++)o=e[n],o.ref.impl=o.nextImpl;break;case 11:case 15:break;case 1:if((e&1024)!==0&&i!==null){e=void 0,n=t,o=i.memoizedProps,i=i.memoizedState,r=n.stateNode;try{var g=fc(n.type,o);e=r.getSnapshotBeforeUpdate(g,i),r.__reactInternalSnapshotBeforeUpdate=e}catch(_){yt(n,n.return,_)}}break;case 3:if((e&1024)!==0){if(e=t.stateNode.containerInfo,n=e.nodeType,n===9)Lx(e);else if(n===1)switch(e.nodeName){case"HEAD":case"HTML":case"BODY":Lx(e);break;default:e.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((e&1024)!==0)throw Error(Y(163))}if(e=t.sibling,e!==null){e.return=t.return,Ln=e;break}Ln=t.return}}function EU(e,t,n){var r=n.flags;switch(n.tag){case 0:case 11:case 15:ya(e,n),r&4&&Ym(5,n);break;case 1:if(ya(e,n),r&4)if(e=n.stateNode,t===null)try{e.componentDidMount()}catch(a){yt(n,n.return,a)}else{var o=fc(n.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(o,t,e.__reactInternalSnapshotBeforeUpdate)}catch(a){yt(n,n.return,a)}}r&64&&bU(n),r&512&&Sm(n,n.return);break;case 3:if(ya(e,n),r&64&&(e=n.updateQueue,e!==null)){if(t=null,n.child!==null)switch(n.child.tag){case 27:case 5:t=n.child.stateNode;break;case 1:t=n.child.stateNode}try{k3(e,t)}catch(a){yt(n,n.return,a)}}break;case 27:t===null&&r&4&&SU(n);case 26:case 5:ya(e,n),t===null&&r&4&&_U(n),r&512&&Sm(n,n.return);break;case 12:ya(e,n);break;case 31:ya(e,n),r&4&&xU(e,n);break;case 13:ya(e,n),r&4&&kU(e,n),r&64&&(e=n.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(n=RX.bind(null,n),YX(e,n))));break;case 22:if(r=n.memoizedState!==null||Sa,!r){t=t!==null&&t.memoizedState!==null||bn,o=Sa;var i=bn;Sa=r,(bn=t)&&!i?_a(e,n,(n.subtreeFlags&8772)!==0):ya(e,n),Sa=o,bn=i}break;case 30:break;default:ya(e,n)}}function TU(e){var t=e.alternate;t!==null&&(e.alternate=null,TU(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&Vx(t)),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}var Wt=null,Rr=!1;function ba(e,t,n){for(n=n.child;n!==null;)wU(e,t,n),n=n.sibling}function wU(e,t,n){if(Qr&&typeof Qr.onCommitFiberUnmount=="function")try{Qr.onCommitFiberUnmount(Hm,n)}catch{}switch(n.tag){case 26:bn||Ui(n,t),ba(e,t,n),n.memoizedState?n.memoizedState.count--:n.stateNode&&(n=n.stateNode,n.parentNode.removeChild(n));break;case 27:bn||Ui(n,t);var r=Wt,o=Rr;Ws(n.type)&&(Wt=n.stateNode,Rr=!1),ba(e,t,n),xm(n.stateNode),Wt=r,Rr=o;break;case 5:bn||Ui(n,t);case 6:if(r=Wt,o=Rr,Wt=null,ba(e,t,n),Wt=r,Rr=o,Wt!==null)if(Rr)try{(Wt.nodeType===9?Wt.body:Wt.nodeName==="HTML"?Wt.ownerDocument.body:Wt).removeChild(n.stateNode)}catch(i){yt(n,t,i)}else try{Wt.removeChild(n.stateNode)}catch(i){yt(n,t,i)}break;case 18:Wt!==null&&(Rr?(e=Wt,gL(e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,n.stateNode),tf(e)):gL(Wt,n.stateNode));break;case 4:r=Wt,o=Rr,Wt=n.stateNode.containerInfo,Rr=!0,ba(e,t,n),Wt=r,Rr=o;break;case 0:case 11:case 14:case 15:js(2,n,t),bn||js(4,n,t),ba(e,t,n);break;case 1:bn||(Ui(n,t),r=n.stateNode,typeof r.componentWillUnmount=="function"&&yU(n,t,r)),ba(e,t,n);break;case 21:ba(e,t,n);break;case 22:bn=(r=bn)||n.memoizedState!==null,ba(e,t,n),bn=r;break;default:ba(e,t,n)}}function xU(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{tf(e)}catch(n){yt(t,t.return,n)}}}function kU(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{tf(e)}catch(n){yt(t,t.return,n)}}function EX(e){switch(e.tag){case 31:case 13:case 19:var t=e.stateNode;return t===null&&(t=e.stateNode=new eL),t;case 22:return e=e.stateNode,t=e._retryCache,t===null&&(t=e._retryCache=new eL),t;default:throw Error(Y(435,e.tag))}}function c0(e,t){var n=EX(e);t.forEach(function(r){if(!n.has(r)){n.add(r);var o=CX.bind(null,e,r);r.then(o,o)}})}function Ir(e,t){var n=t.deletions;if(n!==null)for(var r=0;r<n.length;r++){var o=n[r],i=e,a=t,s=a;e:for(;s!==null;){switch(s.tag){case 27:if(Ws(s.type)){Wt=s.stateNode,Rr=!1;break e}break;case 5:Wt=s.stateNode,Rr=!1;break e;case 3:case 4:Wt=s.stateNode.containerInfo,Rr=!0;break e}s=s.return}if(Wt===null)throw Error(Y(160));wU(i,a,o),Wt=null,Rr=!1,i=o.alternate,i!==null&&(i.return=null),o.return=null}if(t.subtreeFlags&13886)for(t=t.child;t!==null;)AU(t,e),t=t.sibling}var ai=null;function AU(e,t){var n=e.alternate,r=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:Ir(t,e),Nr(e),r&4&&(js(3,e,e.return),Ym(3,e),js(5,e,e.return));break;case 1:Ir(t,e),Nr(e),r&512&&(bn||n===null||Ui(n,n.return)),r&64&&Sa&&(e=e.updateQueue,e!==null&&(r=e.callbacks,r!==null&&(n=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=n===null?r:n.concat(r))));break;case 26:var o=ai;if(Ir(t,e),Nr(e),r&512&&(bn||n===null||Ui(n,n.return)),r&4){var i=n!==null?n.memoizedState:null;if(r=e.memoizedState,n===null)if(r===null)if(e.stateNode===null){e:{r=e.type,n=e.memoizedProps,o=o.ownerDocument||o;t:switch(r){case"title":i=o.getElementsByTagName("title")[0],(!i||i[jm]||i[Hn]||i.namespaceURI==="http://www.w3.org/2000/svg"||i.hasAttribute("itemprop"))&&(i=o.createElement(r),o.head.insertBefore(i,o.querySelector("head > title"))),jn(i,r,n),i[Hn]=e,Un(i),r=i;break e;case"link":var a=EL("link","href",o).get(r+(n.href||""));if(a){for(var s=0;s<a.length;s++)if(i=a[s],i.getAttribute("href")===(n.href==null||n.href===""?null:n.href)&&i.getAttribute("rel")===(n.rel==null?null:n.rel)&&i.getAttribute("title")===(n.title==null?null:n.title)&&i.getAttribute("crossorigin")===(n.crossOrigin==null?null:n.crossOrigin)){a.splice(s,1);break t}}i=o.createElement(r),jn(i,r,n),o.head.appendChild(i);break;case"meta":if(a=EL("meta","content",o).get(r+(n.content||""))){for(s=0;s<a.length;s++)if(i=a[s],i.getAttribute("content")===(n.content==null?null:""+n.content)&&i.getAttribute("name")===(n.name==null?null:n.name)&&i.getAttribute("property")===(n.property==null?null:n.property)&&i.getAttribute("http-equiv")===(n.httpEquiv==null?null:n.httpEquiv)&&i.getAttribute("charset")===(n.charSet==null?null:n.charSet)){a.splice(s,1);break t}}i=o.createElement(r),jn(i,r,n),o.head.appendChild(i);break;default:throw Error(Y(468,r))}i[Hn]=e,Un(i),r=i}e.stateNode=r}else TL(o,e.type,e.stateNode);else e.stateNode=SL(o,r,e.memoizedProps);else i!==r?(i===null?n.stateNode!==null&&(n=n.stateNode,n.parentNode.removeChild(n)):i.count--,r===null?TL(o,e.type,e.stateNode):SL(o,r,e.memoizedProps)):r===null&&e.stateNode!==null&&Uw(e,e.memoizedProps,n.memoizedProps)}break;case 27:Ir(t,e),Nr(e),r&512&&(bn||n===null||Ui(n,n.return)),n!==null&&r&4&&Uw(e,e.memoizedProps,n.memoizedProps);break;case 5:if(Ir(t,e),Nr(e),r&512&&(bn||n===null||Ui(n,n.return)),e.flags&32){o=e.stateNode;try{Wd(o,"")}catch(g){yt(e,e.return,g)}}r&4&&e.stateNode!=null&&(o=e.memoizedProps,Uw(e,o,n!==null?n.memoizedProps:o)),r&1024&&(Bw=!0);break;case 6:if(Ir(t,e),Nr(e),r&4){if(e.stateNode===null)throw Error(Y(162));r=e.memoizedProps,n=e.stateNode;try{n.nodeValue=r}catch(g){yt(e,e.return,g)}}break;case 3:if(A0=null,o=ai,ai=e_(t.containerInfo),Ir(t,e),ai=o,Nr(e),r&4&&n!==null&&n.memoizedState.isDehydrated)try{tf(t.containerInfo)}catch(g){yt(e,e.return,g)}Bw&&(Bw=!1,IU(e));break;case 4:r=ai,ai=e_(e.stateNode.containerInfo),Ir(t,e),Nr(e),ai=r;break;case 12:Ir(t,e),Nr(e);break;case 31:Ir(t,e),Nr(e),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,c0(e,r)));break;case 13:Ir(t,e),Nr(e),e.child.flags&8192&&e.memoizedState!==null!=(n!==null&&n.memoizedState!==null)&&(h_=Jr()),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,c0(e,r)));break;case 22:o=e.memoizedState!==null;var l=n!==null&&n.memoizedState!==null,c=Sa,d=bn;if(Sa=c||o,bn=d||l,Ir(t,e),bn=d,Sa=c,Nr(e),r&8192)e:for(t=e.stateNode,t._visibility=o?t._visibility&-2:t._visibility|1,o&&(n===null||l||Sa||bn||nc(e)),n=null,t=e;;){if(t.tag===5||t.tag===26){if(n===null){l=n=t;try{if(i=l.stateNode,o)a=i.style,typeof a.setProperty=="function"?a.setProperty("display","none","important"):a.display="none";else{s=l.stateNode;var u=l.memoizedProps.style,m=u!=null&&u.hasOwnProperty("display")?u.display:null;s.style.display=m==null||typeof m=="boolean"?"":(""+m).trim()}}catch(g){yt(l,l.return,g)}}}else if(t.tag===6){if(n===null){l=t;try{l.stateNode.nodeValue=o?"":l.memoizedProps}catch(g){yt(l,l.return,g)}}}else if(t.tag===18){if(n===null){l=t;try{var p=l.stateNode;o?hL(p,!0):hL(l.stateNode,!1)}catch(g){yt(l,l.return,g)}}}else if((t.tag!==22&&t.tag!==23||t.memoizedState===null||t===e)&&t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break e;for(;t.sibling===null;){if(t.return===null||t.return===e)break e;n===t&&(n=null),t=t.return}n===t&&(n=null),t.sibling.return=t.return,t=t.sibling}r&4&&(r=e.updateQueue,r!==null&&(n=r.retryQueue,n!==null&&(r.retryQueue=null,c0(e,n))));break;case 19:Ir(t,e),Nr(e),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,c0(e,r)));break;case 30:break;case 21:break;default:Ir(t,e),Nr(e)}}function Nr(e){var t=e.flags;if(t&2){try{for(var n,r=e.return;r!==null;){if(vU(r)){n=r;break}r=r.return}if(n==null)throw Error(Y(160));switch(n.tag){case 27:var o=n.stateNode,i=Pw(e);V0(e,i,o);break;case 5:var a=n.stateNode;n.flags&32&&(Wd(a,""),n.flags&=-33);var s=Pw(e);V0(e,s,a);break;case 3:case 4:var l=n.stateNode.containerInfo,c=Pw(e);xx(e,c,l);break;default:throw Error(Y(161))}}catch(d){yt(e,e.return,d)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function IU(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var t=e;IU(t),t.tag===5&&t.flags&1024&&t.stateNode.reset(),e=e.sibling}}function ya(e,t){if(t.subtreeFlags&8772)for(t=t.child;t!==null;)EU(e,t.alternate,t),t=t.sibling}function nc(e){for(e=e.child;e!==null;){var t=e;switch(t.tag){case 0:case 11:case 14:case 15:js(4,t,t.return),nc(t);break;case 1:Ui(t,t.return);var n=t.stateNode;typeof n.componentWillUnmount=="function"&&yU(t,t.return,n),nc(t);break;case 27:xm(t.stateNode);case 26:case 5:Ui(t,t.return),nc(t);break;case 22:t.memoizedState===null&&nc(t);break;case 30:nc(t);break;default:nc(t)}e=e.sibling}}function _a(e,t,n){for(n=n&&(t.subtreeFlags&8772)!==0,t=t.child;t!==null;){var r=t.alternate,o=e,i=t,a=i.flags;switch(i.tag){case 0:case 11:case 15:_a(o,i,n),Ym(4,i);break;case 1:if(_a(o,i,n),r=i,o=r.stateNode,typeof o.componentDidMount=="function")try{o.componentDidMount()}catch(c){yt(r,r.return,c)}if(r=i,o=r.updateQueue,o!==null){var s=r.stateNode;try{var l=o.shared.hiddenCallbacks;if(l!==null)for(o.shared.hiddenCallbacks=null,o=0;o<l.length;o++)x3(l[o],s)}catch(c){yt(r,r.return,c)}}n&&a&64&&bU(i),Sm(i,i.return);break;case 27:SU(i);case 26:case 5:_a(o,i,n),n&&r===null&&a&4&&_U(i),Sm(i,i.return);break;case 12:_a(o,i,n);break;case 31:_a(o,i,n),n&&a&4&&xU(o,i);break;case 13:_a(o,i,n),n&&a&4&&kU(o,i);break;case 22:i.memoizedState===null&&_a(o,i,n),Sm(i,i.return);break;case 30:break;default:_a(o,i,n)}t=t.sibling}}function w1(e,t){var n=null;e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(n=e.memoizedState.cachePool.pool),e=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(e=t.memoizedState.cachePool.pool),e!==n&&(e!=null&&e.refCount++,n!=null&&Vm(n))}function x1(e,t){e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&Vm(e))}function ii(e,t,n,r){if(t.subtreeFlags&10256)for(t=t.child;t!==null;)NU(e,t,n,r),t=t.sibling}function NU(e,t,n,r){var o=t.flags;switch(t.tag){case 0:case 11:case 15:ii(e,t,n,r),o&2048&&Ym(9,t);break;case 1:ii(e,t,n,r);break;case 3:ii(e,t,n,r),o&2048&&(e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&Vm(e)));break;case 12:if(o&2048){ii(e,t,n,r),e=t.stateNode;try{var i=t.memoizedProps,a=i.id,s=i.onPostCommit;typeof s=="function"&&s(a,t.alternate===null?"mount":"update",e.passiveEffectDuration,-0)}catch(l){yt(t,t.return,l)}}else ii(e,t,n,r);break;case 31:ii(e,t,n,r);break;case 13:ii(e,t,n,r);break;case 23:break;case 22:i=t.stateNode,a=t.alternate,t.memoizedState!==null?i._visibility&2?ii(e,t,n,r):Em(e,t):i._visibility&2?ii(e,t,n,r):(i._visibility|=2,wd(e,t,n,r,(t.subtreeFlags&10256)!==0||!1)),o&2048&&w1(a,t);break;case 24:ii(e,t,n,r),o&2048&&x1(t.alternate,t);break;default:ii(e,t,n,r)}}function wd(e,t,n,r,o){for(o=o&&((t.subtreeFlags&10256)!==0||!1),t=t.child;t!==null;){var i=e,a=t,s=n,l=r,c=a.flags;switch(a.tag){case 0:case 11:case 15:wd(i,a,s,l,o),Ym(8,a);break;case 23:break;case 22:var d=a.stateNode;a.memoizedState!==null?d._visibility&2?wd(i,a,s,l,o):Em(i,a):(d._visibility|=2,wd(i,a,s,l,o)),o&&c&2048&&w1(a.alternate,a);break;case 24:wd(i,a,s,l,o),o&&c&2048&&x1(a.alternate,a);break;default:wd(i,a,s,l,o)}t=t.sibling}}function Em(e,t){if(t.subtreeFlags&10256)for(t=t.child;t!==null;){var n=e,r=t,o=r.flags;switch(r.tag){case 22:Em(n,r),o&2048&&w1(r.alternate,r);break;case 24:Em(n,r),o&2048&&x1(r.alternate,r);break;default:Em(n,r)}t=t.sibling}}var fm=8192;function Td(e,t,n){if(e.subtreeFlags&fm)for(e=e.child;e!==null;)RU(e,t,n),e=e.sibling}function RU(e,t,n){switch(e.tag){case 26:Td(e,t,n),e.flags&fm&&e.memoizedState!==null&&aJ(n,ai,e.memoizedState,e.memoizedProps);break;case 5:Td(e,t,n);break;case 3:case 4:var r=ai;ai=e_(e.stateNode.containerInfo),Td(e,t,n),ai=r;break;case 22:e.memoizedState===null&&(r=e.alternate,r!==null&&r.memoizedState!==null?(r=fm,fm=16777216,Td(e,t,n),fm=r):Td(e,t,n));break;default:Td(e,t,n)}}function CU(e){var t=e.alternate;if(t!==null&&(e=t.child,e!==null)){t.child=null;do t=e.sibling,e.sibling=null,e=t;while(e!==null)}}function im(e){var t=e.deletions;if((e.flags&16)!==0){if(t!==null)for(var n=0;n<t.length;n++){var r=t[n];Ln=r,OU(r,e)}CU(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)MU(e),e=e.sibling}function MU(e){switch(e.tag){case 0:case 11:case 15:im(e),e.flags&2048&&js(9,e,e.return);break;case 3:im(e);break;case 12:im(e);break;case 22:var t=e.stateNode;e.memoizedState!==null&&t._visibility&2&&(e.return===null||e.return.tag!==13)?(t._visibility&=-3,x0(e)):im(e);break;default:im(e)}}function x0(e){var t=e.deletions;if((e.flags&16)!==0){if(t!==null)for(var n=0;n<t.length;n++){var r=t[n];Ln=r,OU(r,e)}CU(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:js(8,t,t.return),x0(t);break;case 22:n=t.stateNode,n._visibility&2&&(n._visibility&=-3,x0(t));break;default:x0(t)}e=e.sibling}}function OU(e,t){for(;Ln!==null;){var n=Ln;switch(n.tag){case 0:case 11:case 15:js(8,n,t);break;case 23:case 22:if(n.memoizedState!==null&&n.memoizedState.cachePool!==null){var r=n.memoizedState.cachePool.pool;r!=null&&r.refCount++}break;case 24:Vm(n.memoizedState.cache)}if(r=n.child,r!==null)r.return=n,Ln=r;else e:for(n=e;Ln!==null;){r=Ln;var o=r.sibling,i=r.return;if(TU(r),r===n){Ln=null;break e}if(o!==null){o.return=i,Ln=o;break e}Ln=i}}}var TX={getCacheForType:function(e){var t=$n(yn),n=t.data.get(e);return n===void 0&&(n=e(),t.data.set(e,n)),n},cacheSignal:function(){return $n(yn).controller.signal}},wX=typeof WeakMap=="function"?WeakMap:Map,mt=0,It=null,Ze=null,nt=0,bt=0,Wr=null,Rs=!1,sf=!1,k1=!1,Ma=0,on=0,qs=0,sc=0,A1=0,Xr=0,Jd=0,Tm=null,Cr=null,kx=!1,h_=0,DU=0,W0=1/0,Y0=null,Ps=null,xn=0,Bs=null,Qd=null,Aa=0,Ax=0,Ix=null,LU=null,wm=0,Nx=null;function eo(){return(mt&2)!==0&&nt!==0?nt&-nt:Ne.T!==null?N1():jL()}function UU(){if(Xr===0)if((nt&536870912)===0||ot){var e=Zy;Zy<<=1,(Zy&3932160)===0&&(Zy=262144),Xr=e}else Xr=536870912;return e=no.current,e!==null&&(e.flags|=32),Xr}function Mr(e,t,n){(e===It&&(bt===2||bt===9)||e.cancelPendingCommit!==null)&&(Zd(e,0),Cs(e,nt,Xr,!1)),$m(e,n),((mt&2)===0||e!==It)&&(e===It&&((mt&2)===0&&(sc|=n),on===4&&Cs(e,nt,Xr,!1)),zi(e))}function PU(e,t,n){if((mt&6)!==0)throw Error(Y(327));var r=!n&&(t&127)===0&&(t&e.expiredLanes)===0||Gm(e,t),o=r?AX(e,t):zw(e,t,!0),i=r;do{if(o===0){sf&&!r&&Cs(e,t,0,!1);break}else{if(n=e.current.alternate,i&&!xX(n)){o=zw(e,t,!1),i=!1;continue}if(o===2){if(i=t,e.errorRecoveryDisabledLanes&i)var a=0;else a=e.pendingLanes&-536870913,a=a!==0?a:a&536870912?536870912:0;if(a!==0){t=a;e:{var s=e;o=Tm;var l=s.current.memoizedState.isDehydrated;if(l&&(Zd(s,a).flags|=256),a=zw(s,a,!1),a!==2){if(k1&&!l){s.errorRecoveryDisabledLanes|=i,sc|=i,o=4;break e}i=Cr,Cr=o,i!==null&&(Cr===null?Cr=i:Cr.push.apply(Cr,i))}o=a}if(i=!1,o!==2)continue}}if(o===1){Zd(e,0),Cs(e,t,0,!0);break}e:{switch(r=e,i=o,i){case 0:case 1:throw Error(Y(345));case 4:if((t&4194048)!==t)break;case 6:Cs(r,t,Xr,!Rs);break e;case 2:Cr=null;break;case 3:case 5:break;default:throw Error(Y(329))}if((t&62914560)===t&&(o=h_+300-Jr(),10<o)){if(Cs(r,t,Xr,!Rs),i_(r,0,!0)!==0)break e;Aa=t,r.timeoutHandle=r6(tL.bind(null,r,n,Cr,Y0,kx,t,Xr,sc,Jd,Rs,i,"Throttled",-0,0),o);break e}tL(r,n,Cr,Y0,kx,t,Xr,sc,Jd,Rs,i,null,-0,0)}}break}while(!0);zi(e)}function tL(e,t,n,r,o,i,a,s,l,c,d,u,m,p){if(e.timeoutHandle=-1,u=t.subtreeFlags,u&8192||(u&16785408)===16785408){u={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Ta},RU(t,i,u);var g=(i&62914560)===i?h_-Jr():(i&4194048)===i?DU-Jr():0;if(g=sJ(u,g),g!==null){Aa=i,e.cancelPendingCommit=g(rL.bind(null,e,t,i,n,r,o,a,s,l,d,u,null,m,p)),Cs(e,i,a,!c);return}}rL(e,t,i,n,r,o,a,s,l)}function xX(e){for(var t=e;;){var n=t.tag;if((n===0||n===11||n===15)&&t.flags&16384&&(n=t.updateQueue,n!==null&&(n=n.stores,n!==null)))for(var r=0;r<n.length;r++){var o=n[r],i=o.getSnapshot;o=o.value;try{if(!to(i(),o))return!1}catch{return!1}}if(n=t.child,t.subtreeFlags&16384&&n!==null)n.return=t,t=n;else{if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}function Cs(e,t,n,r){t&=~A1,t&=~sc,e.suspendedLanes|=t,e.pingedLanes&=~t,r&&(e.warmLanes|=t),r=e.expirationTimes;for(var o=t;0<o;){var i=31-Zr(o),a=1<<i;r[i]=-1,o&=~a}n!==0&&HL(e,n,t)}function b_(){return(mt&6)===0?(Km(0,!1),!1):!0}function I1(){if(Ze!==null){if(bt===0)var e=Ze.return;else e=Ze,wa=bc=null,p1(e),Gd=null,Mm=0,e=Ze;for(;e!==null;)hU(e.alternate,e),e=e.return;Ze=null}}function Zd(e,t){var n=e.timeoutHandle;n!==-1&&(e.timeoutHandle=-1,$X(n)),n=e.cancelPendingCommit,n!==null&&(e.cancelPendingCommit=null,n()),Aa=0,I1(),It=e,Ze=n=xa(e.current,null),nt=t,bt=0,Wr=null,Rs=!1,sf=Gm(e,t),k1=!1,Jd=Xr=A1=sc=qs=on=0,Cr=Tm=null,kx=!1,(t&8)!==0&&(t|=t&32);var r=e.entangledLanes;if(r!==0)for(e=e.entanglements,r&=t;0<r;){var o=31-Zr(r),i=1<<o;t|=e[o],r&=~i}return Ma=t,c_(),n}function BU(e,t){qe=null,Ne.H=Dm,t===af||t===d_?(t=OD(),bt=3):t===a1?(t=OD(),bt=4):bt=t===E1?8:t!==null&&typeof t=="object"&&typeof t.then=="function"?6:1,Wr=t,Ze===null&&(on=1,j0(e,Mo(t,e.current)))}function zU(){var e=no.current;return e===null?!0:(nt&4194048)===nt?Do===null:(nt&62914560)===nt||(nt&536870912)!==0?e===Do:!1}function FU(){var e=Ne.H;return Ne.H=Dm,e===null?Dm:e}function HU(){var e=Ne.A;return Ne.A=TX,e}function K0(){on=4,Rs||(nt&4194048)!==nt&&no.current!==null||(sf=!0),(qs&134217727)===0&&(sc&134217727)===0||It===null||Cs(It,nt,Xr,!1)}function zw(e,t,n){var r=mt;mt|=2;var o=FU(),i=HU();(It!==e||nt!==t)&&(Y0=null,Zd(e,t)),t=!1;var a=on;e:do try{if(bt!==0&&Ze!==null){var s=Ze,l=Wr;switch(bt){case 8:I1(),a=6;break e;case 3:case 2:case 9:case 6:no.current===null&&(t=!0);var c=bt;if(bt=0,Wr=null,Pd(e,s,l,c),n&&sf){a=0;break e}break;default:c=bt,bt=0,Wr=null,Pd(e,s,l,c)}}kX(),a=on;break}catch(d){BU(e,d)}while(!0);return t&&e.shellSuspendCounter++,wa=bc=null,mt=r,Ne.H=o,Ne.A=i,Ze===null&&(It=null,nt=0,c_()),a}function kX(){for(;Ze!==null;)GU(Ze)}function AX(e,t){var n=mt;mt|=2;var r=FU(),o=HU();It!==e||nt!==t?(Y0=null,W0=Jr()+500,Zd(e,t)):sf=Gm(e,t);e:do try{if(bt!==0&&Ze!==null){t=Ze;var i=Wr;t:switch(bt){case 1:bt=0,Wr=null,Pd(e,t,i,1);break;case 2:case 9:if(MD(i)){bt=0,Wr=null,nL(t);break}t=function(){bt!==2&&bt!==9||It!==e||(bt=7),zi(e)},i.then(t,t);break e;case 3:bt=7;break e;case 4:bt=5;break e;case 7:MD(i)?(bt=0,Wr=null,nL(t)):(bt=0,Wr=null,Pd(e,t,i,7));break;case 5:var a=null;switch(Ze.tag){case 26:a=Ze.memoizedState;case 5:case 27:var s=Ze;if(a?l6(a):s.stateNode.complete){bt=0,Wr=null;var l=s.sibling;if(l!==null)Ze=l;else{var c=s.return;c!==null?(Ze=c,y_(c)):Ze=null}break t}}bt=0,Wr=null,Pd(e,t,i,5);break;case 6:bt=0,Wr=null,Pd(e,t,i,6);break;case 8:I1(),on=6;break e;default:throw Error(Y(462))}}IX();break}catch(d){BU(e,d)}while(!0);return wa=bc=null,Ne.H=r,Ne.A=o,mt=n,Ze!==null?0:(It=null,nt=0,c_(),on)}function IX(){for(;Ze!==null&&!JY();)GU(Ze)}function GU(e){var t=gU(e.alternate,e,Ma);e.memoizedProps=e.pendingProps,t===null?y_(e):Ze=t}function nL(e){var t=e,n=t.alternate;switch(t.tag){case 15:case 0:t=KD(n,t,t.pendingProps,t.type,void 0,nt);break;case 11:t=KD(n,t,t.pendingProps,t.type.render,t.ref,nt);break;case 5:p1(t);default:hU(n,t),t=Ze=h3(t,Ma),t=gU(n,t,Ma)}e.memoizedProps=e.pendingProps,t===null?y_(e):Ze=t}function Pd(e,t,n,r){wa=bc=null,p1(t),Gd=null,Mm=0;var o=t.return;try{if(hX(e,o,t,n,nt)){on=1,j0(e,Mo(n,e.current)),Ze=null;return}}catch(i){if(o!==null)throw Ze=o,i;on=1,j0(e,Mo(n,e.current)),Ze=null;return}t.flags&32768?(ot||r===1?e=!0:sf||(nt&536870912)!==0?e=!1:(Rs=e=!0,(r===2||r===9||r===3||r===6)&&(r=no.current,r!==null&&r.tag===13&&(r.flags|=16384))),$U(t,e)):y_(t)}function y_(e){var t=e;do{if((t.flags&32768)!==0){$U(t,Rs);return}e=t.return;var n=_X(t.alternate,t,Ma);if(n!==null){Ze=n;return}if(t=t.sibling,t!==null){Ze=t;return}Ze=t=e}while(t!==null);on===0&&(on=5)}function $U(e,t){do{var n=vX(e.alternate,e);if(n!==null){n.flags&=32767,Ze=n;return}if(n=e.return,n!==null&&(n.flags|=32768,n.subtreeFlags=0,n.deletions=null),!t&&(e=e.sibling,e!==null)){Ze=e;return}Ze=e=n}while(e!==null);on=6,Ze=null}function rL(e,t,n,r,o,i,a,s,l){e.cancelPendingCommit=null;do __();while(xn!==0);if((mt&6)!==0)throw Error(Y(327));if(t!==null){if(t===e.current)throw Error(Y(177));if(i=t.lanes|t.childLanes,i|=Zx,sK(e,n,i,a,s,l),e===It&&(Ze=It=null,nt=0),Qd=t,Bs=e,Aa=n,Ax=i,Ix=o,LU=r,(t.subtreeFlags&10256)!==0||(t.flags&10256)!==0?(e.callbackNode=null,e.callbackPriority=0,MX(O0,function(){return YU(),null})):(e.callbackNode=null,e.callbackPriority=0),r=(t.flags&13878)!==0,(t.subtreeFlags&13878)!==0||r){r=Ne.T,Ne.T=null,o=gt.p,gt.p=2,a=mt,mt|=4;try{SX(e,t,n)}finally{mt=a,gt.p=o,Ne.T=r}}xn=1,jU(),qU(),VU()}}function jU(){if(xn===1){xn=0;var e=Bs,t=Qd,n=(t.flags&13878)!==0;if((t.subtreeFlags&13878)!==0||n){n=Ne.T,Ne.T=null;var r=gt.p;gt.p=2;var o=mt;mt|=4;try{AU(t,e);var i=Ox,a=l3(e.containerInfo),s=i.focusedElem,l=i.selectionRange;if(a!==s&&s&&s.ownerDocument&&s3(s.ownerDocument.documentElement,s)){if(l!==null&&Qx(s)){var c=l.start,d=l.end;if(d===void 0&&(d=c),"selectionStart"in s)s.selectionStart=c,s.selectionEnd=Math.min(d,s.value.length);else{var u=s.ownerDocument||document,m=u&&u.defaultView||window;if(m.getSelection){var p=m.getSelection(),g=s.textContent.length,_=Math.min(l.start,g),y=l.end===void 0?_:Math.min(l.end,g);!p.extend&&_>y&&(a=y,y=_,_=a);var h=xD(s,_),v=xD(s,y);if(h&&v&&(p.rangeCount!==1||p.anchorNode!==h.node||p.anchorOffset!==h.offset||p.focusNode!==v.node||p.focusOffset!==v.offset)){var T=u.createRange();T.setStart(h.node,h.offset),p.removeAllRanges(),_>y?(p.addRange(T),p.extend(v.node,v.offset)):(T.setEnd(v.node,v.offset),p.addRange(T))}}}}for(u=[],p=s;p=p.parentNode;)p.nodeType===1&&u.push({element:p,left:p.scrollLeft,top:p.scrollTop});for(typeof s.focus=="function"&&s.focus(),s=0;s<u.length;s++){var x=u[s];x.element.scrollLeft=x.left,x.element.scrollTop=x.top}}r_=!!Mx,Ox=Mx=null}finally{mt=o,gt.p=r,Ne.T=n}}e.current=t,xn=2}}function qU(){if(xn===2){xn=0;var e=Bs,t=Qd,n=(t.flags&8772)!==0;if((t.subtreeFlags&8772)!==0||n){n=Ne.T,Ne.T=null;var r=gt.p;gt.p=2;var o=mt;mt|=4;try{EU(e,t.alternate,t)}finally{mt=o,gt.p=r,Ne.T=n}}xn=3}}function VU(){if(xn===4||xn===3){xn=0,QY();var e=Bs,t=Qd,n=Aa,r=LU;(t.subtreeFlags&10256)!==0||(t.flags&10256)!==0?xn=5:(xn=0,Qd=Bs=null,WU(e,e.pendingLanes));var o=e.pendingLanes;if(o===0&&(Ps=null),qx(n),t=t.stateNode,Qr&&typeof Qr.onCommitFiberRoot=="function")try{Qr.onCommitFiberRoot(Hm,t,void 0,(t.current.flags&128)===128)}catch{}if(r!==null){t=Ne.T,o=gt.p,gt.p=2,Ne.T=null;try{for(var i=e.onRecoverableError,a=0;a<r.length;a++){var s=r[a];i(s.value,{componentStack:s.stack})}}finally{Ne.T=t,gt.p=o}}(Aa&3)!==0&&__(),zi(e),o=e.pendingLanes,(n&261930)!==0&&(o&42)!==0?e===Nx?wm++:(wm=0,Nx=e):wm=0,Km(0,!1)}}function WU(e,t){(e.pooledCacheLanes&=t)===0&&(t=e.pooledCache,t!=null&&(e.pooledCache=null,Vm(t)))}function __(){return jU(),qU(),VU(),YU()}function YU(){if(xn!==5)return!1;var e=Bs,t=Ax;Ax=0;var n=qx(Aa),r=Ne.T,o=gt.p;try{gt.p=32>n?32:n,Ne.T=null,n=Ix,Ix=null;var i=Bs,a=Aa;if(xn=0,Qd=Bs=null,Aa=0,(mt&6)!==0)throw Error(Y(331));var s=mt;if(mt|=4,MU(i.current),NU(i,i.current,a,n),mt=s,Km(0,!1),Qr&&typeof Qr.onPostCommitFiberRoot=="function")try{Qr.onPostCommitFiberRoot(Hm,i)}catch{}return!0}finally{gt.p=o,Ne.T=r,WU(e,t)}}function oL(e,t,n){t=Mo(n,t),t=Ex(e.stateNode,t,2),e=Us(e,t,2),e!==null&&($m(e,2),zi(e))}function yt(e,t,n){if(e.tag===3)oL(e,e,n);else for(;t!==null;){if(t.tag===3){oL(t,e,n);break}else if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof r.componentDidCatch=="function"&&(Ps===null||!Ps.has(r))){e=Mo(n,e),n=cU(2),r=Us(t,n,2),r!==null&&(uU(n,r,t,e),$m(r,2),zi(r));break}}t=t.return}}function Fw(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new wX;var o=new Set;r.set(t,o)}else o=r.get(t),o===void 0&&(o=new Set,r.set(t,o));o.has(n)||(k1=!0,o.add(n),e=NX.bind(null,e,t,n),t.then(e,e))}function NX(e,t,n){var r=e.pingCache;r!==null&&r.delete(t),e.pingedLanes|=e.suspendedLanes&n,e.warmLanes&=~n,It===e&&(nt&n)===n&&(on===4||on===3&&(nt&62914560)===nt&&300>Jr()-h_?(mt&2)===0&&Zd(e,0):A1|=n,Jd===nt&&(Jd=0)),zi(e)}function KU(e,t){t===0&&(t=FL()),e=hc(e,t),e!==null&&($m(e,t),zi(e))}function RX(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),KU(e,n)}function CX(e,t){var n=0;switch(e.tag){case 31:case 13:var r=e.stateNode,o=e.memoizedState;o!==null&&(n=o.retryLane);break;case 19:r=e.stateNode;break;case 22:r=e.stateNode._retryCache;break;default:throw Error(Y(314))}r!==null&&r.delete(t),KU(e,n)}function MX(e,t){return $x(e,t)}var X0=null,xd=null,Rx=!1,J0=!1,Hw=!1,Ms=0;function zi(e){e!==xd&&e.next===null&&(xd===null?X0=xd=e:xd=xd.next=e),J0=!0,Rx||(Rx=!0,DX())}function Km(e,t){if(!Hw&&J0){Hw=!0;do for(var n=!1,r=X0;r!==null;){if(!t)if(e!==0){var o=r.pendingLanes;if(o===0)var i=0;else{var a=r.suspendedLanes,s=r.pingedLanes;i=(1<<31-Zr(42|e)+1)-1,i&=o&~(a&~s),i=i&201326741?i&201326741|1:i?i|2:0}i!==0&&(n=!0,iL(r,i))}else i=nt,i=i_(r,r===It?i:0,r.cancelPendingCommit!==null||r.timeoutHandle!==-1),(i&3)===0||Gm(r,i)||(n=!0,iL(r,i));r=r.next}while(n);Hw=!1}}function OX(){XU()}function XU(){J0=Rx=!1;var e=0;Ms!==0&&GX()&&(e=Ms);for(var t=Jr(),n=null,r=X0;r!==null;){var o=r.next,i=JU(r,t);i===0?(r.next=null,n===null?X0=o:n.next=o,o===null&&(xd=n)):(n=r,(e!==0||(i&3)!==0)&&(J0=!0)),r=o}xn!==0&&xn!==5||Km(e,!1),Ms!==0&&(Ms=0)}function JU(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,o=e.expirationTimes,i=e.pendingLanes&-62914561;0<i;){var a=31-Zr(i),s=1<<a,l=o[a];l===-1?((s&n)===0||(s&r)!==0)&&(o[a]=aK(s,t)):l<=t&&(e.expiredLanes|=s),i&=~s}if(t=It,n=nt,n=i_(e,e===t?n:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),r=e.callbackNode,n===0||e===t&&(bt===2||bt===9)||e.cancelPendingCommit!==null)return r!==null&&r!==null&&hw(r),e.callbackNode=null,e.callbackPriority=0;if((n&3)===0||Gm(e,n)){if(t=n&-n,t===e.callbackPriority)return t;switch(r!==null&&hw(r),qx(n)){case 2:case 8:n=BL;break;case 32:n=O0;break;case 268435456:n=zL;break;default:n=O0}return r=QU.bind(null,e),n=$x(n,r),e.callbackPriority=t,e.callbackNode=n,t}return r!==null&&r!==null&&hw(r),e.callbackPriority=2,e.callbackNode=null,2}function QU(e,t){if(xn!==0&&xn!==5)return e.callbackNode=null,e.callbackPriority=0,null;var n=e.callbackNode;if(__()&&e.callbackNode!==n)return null;var r=nt;return r=i_(e,e===It?r:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),r===0?null:(PU(e,r,t),JU(e,Jr()),e.callbackNode!=null&&e.callbackNode===n?QU.bind(null,e):null)}function iL(e,t){if(__())return null;PU(e,t,!0)}function DX(){jX(function(){(mt&6)!==0?$x(PL,OX):XU()})}function N1(){if(Ms===0){var e=Yd;e===0&&(e=Qy,Qy<<=1,(Qy&261888)===0&&(Qy=256)),Ms=e}return Ms}function aL(e){return e==null||typeof e=="symbol"||typeof e=="boolean"?null:typeof e=="function"?e:h0(""+e)}function sL(e,t){var n=t.ownerDocument.createElement("input");return n.name=t.name,n.value=t.value,e.id&&n.setAttribute("form",e.id),t.parentNode.insertBefore(n,t),e=new FormData(e),n.parentNode.removeChild(n),e}function LX(e,t,n,r,o){if(t==="submit"&&n&&n.stateNode===o){var i=aL((o[Or]||null).action),a=r.submitter;a&&(t=(t=a[Or]||null)?aL(t.formAction):a.getAttribute("formAction"),t!==null&&(i=t,a=null));var s=new a_("action","action",null,r,o);e.push({event:s,listeners:[{instance:null,listener:function(){if(r.defaultPrevented){if(Ms!==0){var l=a?sL(o,a):new FormData(o);vx(n,{pending:!0,data:l,method:o.method,action:i},null,l)}}else typeof i=="function"&&(s.preventDefault(),l=a?sL(o,a):new FormData(o),vx(n,{pending:!0,data:l,method:o.method,action:i},i,l))},currentTarget:o}]})}}for(u0=0;u0<lx.length;u0++)d0=lx[u0],lL=d0.toLowerCase(),cL=d0[0].toUpperCase()+d0.slice(1),si(lL,"on"+cL);var d0,lL,cL,u0;si(u3,"onAnimationEnd");si(d3,"onAnimationIteration");si(f3,"onAnimationStart");si("dblclick","onDoubleClick");si("focusin","onFocus");si("focusout","onBlur");si(ZK,"onTransitionRun");si(eX,"onTransitionStart");si(tX,"onTransitionCancel");si(p3,"onTransitionEnd");Vd("onMouseEnter",["mouseout","mouseover"]);Vd("onMouseLeave",["mouseout","mouseover"]);Vd("onPointerEnter",["pointerout","pointerover"]);Vd("onPointerLeave",["pointerout","pointerover"]);pc("onChange","change click focusin focusout input keydown keyup selectionchange".split(" "));pc("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" "));pc("onBeforeInput",["compositionend","keypress","textInput","paste"]);pc("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" "));pc("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" "));pc("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Lm="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),UX=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Lm));function ZU(e,t){t=(t&4)!==0;for(var n=0;n<e.length;n++){var r=e[n],o=r.event;r=r.listeners;e:{var i=void 0;if(t)for(var a=r.length-1;0<=a;a--){var s=r[a],l=s.instance,c=s.currentTarget;if(s=s.listener,l!==i&&o.isPropagationStopped())break e;i=s,o.currentTarget=c;try{i(o)}catch(d){L0(d)}o.currentTarget=null,i=l}else for(a=0;a<r.length;a++){if(s=r[a],l=s.instance,c=s.currentTarget,s=s.listener,l!==i&&o.isPropagationStopped())break e;i=s,o.currentTarget=c;try{i(o)}catch(d){L0(d)}o.currentTarget=null,i=l}}}}function Qe(e,t){var n=t[ex];n===void 0&&(n=t[ex]=new Set);var r=e+"__bubble";n.has(r)||(e6(t,e,2,!1),n.add(r))}function Gw(e,t,n){var r=0;t&&(r|=4),e6(n,e,r,t)}var f0="_reactListening"+Math.random().toString(36).slice(2);function R1(e){if(!e[f0]){e[f0]=!0,qL.forEach(function(n){n!=="selectionchange"&&(UX.has(n)||Gw(n,!1,e),Gw(n,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[f0]||(t[f0]=!0,Gw("selectionchange",!1,t))}}function e6(e,t,n,r){switch(p6(t)){case 2:var o=uJ;break;case 8:o=dJ;break;default:o=D1}n=o.bind(null,t,n,e),o=void 0,!ix||t!=="touchstart"&&t!=="touchmove"&&t!=="wheel"||(o=!0),r?o!==void 0?e.addEventListener(t,n,{capture:!0,passive:o}):e.addEventListener(t,n,!0):o!==void 0?e.addEventListener(t,n,{passive:o}):e.addEventListener(t,n,!1)}function $w(e,t,n,r,o){var i=r;if((t&1)===0&&(t&2)===0&&r!==null)e:for(;;){if(r===null)return;var a=r.tag;if(a===3||a===4){var s=r.stateNode.containerInfo;if(s===o)break;if(a===4)for(a=r.return;a!==null;){var l=a.tag;if((l===3||l===4)&&a.stateNode.containerInfo===o)return;a=a.return}for(;s!==null;){if(a=Id(s),a===null)return;if(l=a.tag,l===5||l===6||l===26||l===27){r=i=a;continue e}s=s.parentNode}}r=r.return}ZL(function(){var c=i,d=Yx(n),u=[];e:{var m=m3.get(e);if(m!==void 0){var p=a_,g=e;switch(e){case"keypress":if(y0(n)===0)break e;case"keydown":case"keyup":p=CK;break;case"focusin":g="focus",p=Sw;break;case"focusout":g="blur",p=Sw;break;case"beforeblur":case"afterblur":p=Sw;break;case"click":if(n.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":p=hD;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":p=_K;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":p=DK;break;case u3:case d3:case f3:p=EK;break;case p3:p=UK;break;case"scroll":case"scrollend":p=bK;break;case"wheel":p=BK;break;case"copy":case"cut":case"paste":p=wK;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":p=yD;break;case"toggle":case"beforetoggle":p=FK}var _=(t&4)!==0,y=!_&&(e==="scroll"||e==="scrollend"),h=_?m!==null?m+"Capture":null:m;_=[];for(var v=c,T;v!==null;){var x=v;if(T=x.stateNode,x=x.tag,x!==5&&x!==26&&x!==27||T===null||h===null||(x=Am(v,h),x!=null&&_.push(Um(v,x,T))),y)break;v=v.return}0<_.length&&(m=new p(m,g,null,n,d),u.push({event:m,listeners:_}))}}if((t&7)===0){e:{if(m=e==="mouseover"||e==="pointerover",p=e==="mouseout"||e==="pointerout",m&&n!==ox&&(g=n.relatedTarget||n.fromElement)&&(Id(g)||g[nf]))break e;if((p||m)&&(m=d.window===d?d:(m=d.ownerDocument)?m.defaultView||m.parentWindow:window,p?(g=n.relatedTarget||n.toElement,p=c,g=g?Id(g):null,g!==null&&(y=Fm(g),_=g.tag,g!==y||_!==5&&_!==27&&_!==6)&&(g=null)):(p=null,g=c),p!==g)){if(_=hD,x="onMouseLeave",h="onMouseEnter",v="mouse",(e==="pointerout"||e==="pointerover")&&(_=yD,x="onPointerLeave",h="onPointerEnter",v="pointer"),y=p==null?m:um(p),T=g==null?m:um(g),m=new _(x,v+"leave",p,n,d),m.target=y,m.relatedTarget=T,x=null,Id(d)===c&&(_=new _(h,v+"enter",g,n,d),_.target=T,_.relatedTarget=y,x=_),y=x,p&&g)t:{for(_=PX,h=p,v=g,T=0,x=h;x;x=_(x))T++;x=0;for(var N=v;N;N=_(N))x++;for(;0<T-x;)h=_(h),T--;for(;0<x-T;)v=_(v),x--;for(;T--;){if(h===v||v!==null&&h===v.alternate){_=h;break t}h=_(h),v=_(v)}_=null}else _=null;p!==null&&uL(u,m,p,_,!1),g!==null&&y!==null&&uL(u,y,g,_,!0)}}e:{if(m=c?um(c):window,p=m.nodeName&&m.nodeName.toLowerCase(),p==="select"||p==="input"&&m.type==="file")var M=ED;else if(SD(m))if(i3)M=XK;else{M=YK;var k=WK}else p=m.nodeName,!p||p.toLowerCase()!=="input"||m.type!=="checkbox"&&m.type!=="radio"?c&&Wx(c.elementType)&&(M=ED):M=KK;if(M&&(M=M(e,c))){o3(u,M,n,d);break e}k&&k(e,m,c),e==="focusout"&&c&&m.type==="number"&&c.memoizedProps.value!=null&&rx(m,"number",m.value)}switch(k=c?um(c):window,e){case"focusin":(SD(k)||k.contentEditable==="true")&&(Cd=k,ax=c,gm=null);break;case"focusout":gm=ax=Cd=null;break;case"mousedown":sx=!0;break;case"contextmenu":case"mouseup":case"dragend":sx=!1,kD(u,n,d);break;case"selectionchange":if(QK)break;case"keydown":case"keyup":kD(u,n,d)}var P;if(Jx)e:{switch(e){case"compositionstart":var F="onCompositionStart";break e;case"compositionend":F="onCompositionEnd";break e;case"compositionupdate":F="onCompositionUpdate";break e}F=void 0}else Rd?n3(e,n)&&(F="onCompositionEnd"):e==="keydown"&&n.keyCode===229&&(F="onCompositionStart");F&&(t3&&n.locale!=="ko"&&(Rd||F!=="onCompositionStart"?F==="onCompositionEnd"&&Rd&&(P=e3()):(Ns=d,Kx="value"in Ns?Ns.value:Ns.textContent,Rd=!0)),k=Q0(c,F),0<k.length&&(F=new bD(F,e,null,n,d),u.push({event:F,listeners:k}),P?F.data=P:(P=r3(n),P!==null&&(F.data=P)))),(P=GK?$K(e,n):jK(e,n))&&(F=Q0(c,"onBeforeInput"),0<F.length&&(k=new bD("onBeforeInput","beforeinput",null,n,d),u.push({event:k,listeners:F}),k.data=P)),LX(u,e,c,n,d)}ZU(u,t)})}function Um(e,t,n){return{instance:e,listener:t,currentTarget:n}}function Q0(e,t){for(var n=t+"Capture",r=[];e!==null;){var o=e,i=o.stateNode;if(o=o.tag,o!==5&&o!==26&&o!==27||i===null||(o=Am(e,n),o!=null&&r.unshift(Um(e,o,i)),o=Am(e,t),o!=null&&r.push(Um(e,o,i))),e.tag===3)return r;e=e.return}return[]}function PX(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function uL(e,t,n,r,o){for(var i=t._reactName,a=[];n!==null&&n!==r;){var s=n,l=s.alternate,c=s.stateNode;if(s=s.tag,l!==null&&l===r)break;s!==5&&s!==26&&s!==27||c===null||(l=c,o?(c=Am(n,i),c!=null&&a.unshift(Um(n,c,l))):o||(c=Am(n,i),c!=null&&a.push(Um(n,c,l)))),n=n.return}a.length!==0&&e.push({event:t,listeners:a})}var BX=/\r\n?/g,zX=/\u0000|\uFFFD/g;function dL(e){return(typeof e=="string"?e:""+e).replace(BX,`
9
- `).replace(zX,"")}function t6(e,t){return t=dL(t),dL(e)===t}function vt(e,t,n,r,o,i){switch(n){case"children":typeof r=="string"?t==="body"||t==="textarea"&&r===""||Wd(e,r):(typeof r=="number"||typeof r=="bigint")&&t!=="body"&&Wd(e,""+r);break;case"className":t0(e,"class",r);break;case"tabIndex":t0(e,"tabindex",r);break;case"dir":case"role":case"viewBox":case"width":case"height":t0(e,n,r);break;case"style":QL(e,r,i);break;case"data":if(t!=="object"){t0(e,"data",r);break}case"src":case"href":if(r===""&&(t!=="a"||n!=="href")){e.removeAttribute(n);break}if(r==null||typeof r=="function"||typeof r=="symbol"||typeof r=="boolean"){e.removeAttribute(n);break}r=h0(""+r),e.setAttribute(n,r);break;case"action":case"formAction":if(typeof r=="function"){e.setAttribute(n,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof i=="function"&&(n==="formAction"?(t!=="input"&&vt(e,t,"name",o.name,o,null),vt(e,t,"formEncType",o.formEncType,o,null),vt(e,t,"formMethod",o.formMethod,o,null),vt(e,t,"formTarget",o.formTarget,o,null)):(vt(e,t,"encType",o.encType,o,null),vt(e,t,"method",o.method,o,null),vt(e,t,"target",o.target,o,null)));if(r==null||typeof r=="symbol"||typeof r=="boolean"){e.removeAttribute(n);break}r=h0(""+r),e.setAttribute(n,r);break;case"onClick":r!=null&&(e.onclick=Ta);break;case"onScroll":r!=null&&Qe("scroll",e);break;case"onScrollEnd":r!=null&&Qe("scrollend",e);break;case"dangerouslySetInnerHTML":if(r!=null){if(typeof r!="object"||!("__html"in r))throw Error(Y(61));if(n=r.__html,n!=null){if(o.children!=null)throw Error(Y(60));e.innerHTML=n}}break;case"multiple":e.multiple=r&&typeof r!="function"&&typeof r!="symbol";break;case"muted":e.muted=r&&typeof r!="function"&&typeof r!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(r==null||typeof r=="function"||typeof r=="boolean"||typeof r=="symbol"){e.removeAttribute("xlink:href");break}n=h0(""+r),e.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",n);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":r!=null&&typeof r!="function"&&typeof r!="symbol"?e.setAttribute(n,""+r):e.removeAttribute(n);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":r&&typeof r!="function"&&typeof r!="symbol"?e.setAttribute(n,""):e.removeAttribute(n);break;case"capture":case"download":r===!0?e.setAttribute(n,""):r!==!1&&r!=null&&typeof r!="function"&&typeof r!="symbol"?e.setAttribute(n,r):e.removeAttribute(n);break;case"cols":case"rows":case"size":case"span":r!=null&&typeof r!="function"&&typeof r!="symbol"&&!isNaN(r)&&1<=r?e.setAttribute(n,r):e.removeAttribute(n);break;case"rowSpan":case"start":r==null||typeof r=="function"||typeof r=="symbol"||isNaN(r)?e.removeAttribute(n):e.setAttribute(n,r);break;case"popover":Qe("beforetoggle",e),Qe("toggle",e),g0(e,"popover",r);break;case"xlinkActuate":ga(e,"http://www.w3.org/1999/xlink","xlink:actuate",r);break;case"xlinkArcrole":ga(e,"http://www.w3.org/1999/xlink","xlink:arcrole",r);break;case"xlinkRole":ga(e,"http://www.w3.org/1999/xlink","xlink:role",r);break;case"xlinkShow":ga(e,"http://www.w3.org/1999/xlink","xlink:show",r);break;case"xlinkTitle":ga(e,"http://www.w3.org/1999/xlink","xlink:title",r);break;case"xlinkType":ga(e,"http://www.w3.org/1999/xlink","xlink:type",r);break;case"xmlBase":ga(e,"http://www.w3.org/XML/1998/namespace","xml:base",r);break;case"xmlLang":ga(e,"http://www.w3.org/XML/1998/namespace","xml:lang",r);break;case"xmlSpace":ga(e,"http://www.w3.org/XML/1998/namespace","xml:space",r);break;case"is":g0(e,"is",r);break;case"innerText":case"textContent":break;default:(!(2<n.length)||n[0]!=="o"&&n[0]!=="O"||n[1]!=="n"&&n[1]!=="N")&&(n=gK.get(n)||n,g0(e,n,r))}}function Cx(e,t,n,r,o,i){switch(n){case"style":QL(e,r,i);break;case"dangerouslySetInnerHTML":if(r!=null){if(typeof r!="object"||!("__html"in r))throw Error(Y(61));if(n=r.__html,n!=null){if(o.children!=null)throw Error(Y(60));e.innerHTML=n}}break;case"children":typeof r=="string"?Wd(e,r):(typeof r=="number"||typeof r=="bigint")&&Wd(e,""+r);break;case"onScroll":r!=null&&Qe("scroll",e);break;case"onScrollEnd":r!=null&&Qe("scrollend",e);break;case"onClick":r!=null&&(e.onclick=Ta);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!VL.hasOwnProperty(n))e:{if(n[0]==="o"&&n[1]==="n"&&(o=n.endsWith("Capture"),t=n.slice(2,o?n.length-7:void 0),i=e[Or]||null,i=i!=null?i[n]:null,typeof i=="function"&&e.removeEventListener(t,i,o),typeof r=="function")){typeof i!="function"&&i!==null&&(n in e?e[n]=null:e.hasAttribute(n)&&e.removeAttribute(n)),e.addEventListener(t,r,o);break e}n in e?e[n]=r:r===!0?e.setAttribute(n,""):g0(e,n,r)}}}function jn(e,t,n){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":Qe("error",e),Qe("load",e);var r=!1,o=!1,i;for(i in n)if(n.hasOwnProperty(i)){var a=n[i];if(a!=null)switch(i){case"src":r=!0;break;case"srcSet":o=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(Y(137,t));default:vt(e,t,i,a,n,null)}}o&&vt(e,t,"srcSet",n.srcSet,n,null),r&&vt(e,t,"src",n.src,n,null);return;case"input":Qe("invalid",e);var s=i=a=o=null,l=null,c=null;for(r in n)if(n.hasOwnProperty(r)){var d=n[r];if(d!=null)switch(r){case"name":o=d;break;case"type":a=d;break;case"checked":l=d;break;case"defaultChecked":c=d;break;case"value":i=d;break;case"defaultValue":s=d;break;case"children":case"dangerouslySetInnerHTML":if(d!=null)throw Error(Y(137,t));break;default:vt(e,t,r,d,n,null)}}KL(e,i,s,l,c,a,o,!1);return;case"select":Qe("invalid",e),r=a=i=null;for(o in n)if(n.hasOwnProperty(o)&&(s=n[o],s!=null))switch(o){case"value":i=s;break;case"defaultValue":a=s;break;case"multiple":r=s;default:vt(e,t,o,s,n,null)}t=i,n=a,e.multiple=!!r,t!=null?zd(e,!!r,t,!1):n!=null&&zd(e,!!r,n,!0);return;case"textarea":Qe("invalid",e),i=o=r=null;for(a in n)if(n.hasOwnProperty(a)&&(s=n[a],s!=null))switch(a){case"value":r=s;break;case"defaultValue":o=s;break;case"children":i=s;break;case"dangerouslySetInnerHTML":if(s!=null)throw Error(Y(91));break;default:vt(e,t,a,s,n,null)}JL(e,r,o,i);return;case"option":for(l in n)if(n.hasOwnProperty(l)&&(r=n[l],r!=null))switch(l){case"selected":e.selected=r&&typeof r!="function"&&typeof r!="symbol";break;default:vt(e,t,l,r,n,null)}return;case"dialog":Qe("beforetoggle",e),Qe("toggle",e),Qe("cancel",e),Qe("close",e);break;case"iframe":case"object":Qe("load",e);break;case"video":case"audio":for(r=0;r<Lm.length;r++)Qe(Lm[r],e);break;case"image":Qe("error",e),Qe("load",e);break;case"details":Qe("toggle",e);break;case"embed":case"source":case"link":Qe("error",e),Qe("load",e);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(c in n)if(n.hasOwnProperty(c)&&(r=n[c],r!=null))switch(c){case"children":case"dangerouslySetInnerHTML":throw Error(Y(137,t));default:vt(e,t,c,r,n,null)}return;default:if(Wx(t)){for(d in n)n.hasOwnProperty(d)&&(r=n[d],r!==void 0&&Cx(e,t,d,r,n,void 0));return}}for(s in n)n.hasOwnProperty(s)&&(r=n[s],r!=null&&vt(e,t,s,r,n,null))}function FX(e,t,n,r){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var o=null,i=null,a=null,s=null,l=null,c=null,d=null;for(p in n){var u=n[p];if(n.hasOwnProperty(p)&&u!=null)switch(p){case"checked":break;case"value":break;case"defaultValue":l=u;default:r.hasOwnProperty(p)||vt(e,t,p,null,r,u)}}for(var m in r){var p=r[m];if(u=n[m],r.hasOwnProperty(m)&&(p!=null||u!=null))switch(m){case"type":i=p;break;case"name":o=p;break;case"checked":c=p;break;case"defaultChecked":d=p;break;case"value":a=p;break;case"defaultValue":s=p;break;case"children":case"dangerouslySetInnerHTML":if(p!=null)throw Error(Y(137,t));break;default:p!==u&&vt(e,t,m,p,r,u)}}nx(e,a,s,l,c,d,i,o);return;case"select":p=a=s=m=null;for(i in n)if(l=n[i],n.hasOwnProperty(i)&&l!=null)switch(i){case"value":break;case"multiple":p=l;default:r.hasOwnProperty(i)||vt(e,t,i,null,r,l)}for(o in r)if(i=r[o],l=n[o],r.hasOwnProperty(o)&&(i!=null||l!=null))switch(o){case"value":m=i;break;case"defaultValue":s=i;break;case"multiple":a=i;default:i!==l&&vt(e,t,o,i,r,l)}t=s,n=a,r=p,m!=null?zd(e,!!n,m,!1):!!r!=!!n&&(t!=null?zd(e,!!n,t,!0):zd(e,!!n,n?[]:"",!1));return;case"textarea":p=m=null;for(s in n)if(o=n[s],n.hasOwnProperty(s)&&o!=null&&!r.hasOwnProperty(s))switch(s){case"value":break;case"children":break;default:vt(e,t,s,null,r,o)}for(a in r)if(o=r[a],i=n[a],r.hasOwnProperty(a)&&(o!=null||i!=null))switch(a){case"value":m=o;break;case"defaultValue":p=o;break;case"children":break;case"dangerouslySetInnerHTML":if(o!=null)throw Error(Y(91));break;default:o!==i&&vt(e,t,a,o,r,i)}XL(e,m,p);return;case"option":for(var g in n)if(m=n[g],n.hasOwnProperty(g)&&m!=null&&!r.hasOwnProperty(g))switch(g){case"selected":e.selected=!1;break;default:vt(e,t,g,null,r,m)}for(l in r)if(m=r[l],p=n[l],r.hasOwnProperty(l)&&m!==p&&(m!=null||p!=null))switch(l){case"selected":e.selected=m&&typeof m!="function"&&typeof m!="symbol";break;default:vt(e,t,l,m,r,p)}return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var _ in n)m=n[_],n.hasOwnProperty(_)&&m!=null&&!r.hasOwnProperty(_)&&vt(e,t,_,null,r,m);for(c in r)if(m=r[c],p=n[c],r.hasOwnProperty(c)&&m!==p&&(m!=null||p!=null))switch(c){case"children":case"dangerouslySetInnerHTML":if(m!=null)throw Error(Y(137,t));break;default:vt(e,t,c,m,r,p)}return;default:if(Wx(t)){for(var y in n)m=n[y],n.hasOwnProperty(y)&&m!==void 0&&!r.hasOwnProperty(y)&&Cx(e,t,y,void 0,r,m);for(d in r)m=r[d],p=n[d],!r.hasOwnProperty(d)||m===p||m===void 0&&p===void 0||Cx(e,t,d,m,r,p);return}}for(var h in n)m=n[h],n.hasOwnProperty(h)&&m!=null&&!r.hasOwnProperty(h)&&vt(e,t,h,null,r,m);for(u in r)m=r[u],p=n[u],!r.hasOwnProperty(u)||m===p||m==null&&p==null||vt(e,t,u,m,r,p)}function fL(e){switch(e){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function HX(){if(typeof performance.getEntriesByType=="function"){for(var e=0,t=0,n=performance.getEntriesByType("resource"),r=0;r<n.length;r++){var o=n[r],i=o.transferSize,a=o.initiatorType,s=o.duration;if(i&&s&&fL(a)){for(a=0,s=o.responseEnd,r+=1;r<n.length;r++){var l=n[r],c=l.startTime;if(c>s)break;var d=l.transferSize,u=l.initiatorType;d&&fL(u)&&(l=l.responseEnd,a+=d*(l<s?1:(s-c)/(l-c)))}if(--r,t+=8*(i+a)/(o.duration/1e3),e++,10<e)break}}if(0<e)return t/e/1e6}return navigator.connection&&(e=navigator.connection.downlink,typeof e=="number")?e:5}var Mx=null,Ox=null;function Z0(e){return e.nodeType===9?e:e.ownerDocument}function pL(e){switch(e){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function n6(e,t){if(e===0)switch(t){case"svg":return 1;case"math":return 2;default:return 0}return e===1&&t==="foreignObject"?0:e}function Dx(e,t){return e==="textarea"||e==="noscript"||typeof t.children=="string"||typeof t.children=="number"||typeof t.children=="bigint"||typeof t.dangerouslySetInnerHTML=="object"&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var jw=null;function GX(){var e=window.event;return e&&e.type==="popstate"?e===jw?!1:(jw=e,!0):(jw=null,!1)}var r6=typeof setTimeout=="function"?setTimeout:void 0,$X=typeof clearTimeout=="function"?clearTimeout:void 0,mL=typeof Promise=="function"?Promise:void 0,jX=typeof queueMicrotask=="function"?queueMicrotask:typeof mL<"u"?function(e){return mL.resolve(null).then(e).catch(qX)}:r6;function qX(e){setTimeout(function(){throw e})}function Ws(e){return e==="head"}function gL(e,t){var n=t,r=0;do{var o=n.nextSibling;if(e.removeChild(n),o&&o.nodeType===8)if(n=o.data,n==="/$"||n==="/&"){if(r===0){e.removeChild(o),tf(t);return}r--}else if(n==="$"||n==="$?"||n==="$~"||n==="$!"||n==="&")r++;else if(n==="html")xm(e.ownerDocument.documentElement);else if(n==="head"){n=e.ownerDocument.head,xm(n);for(var i=n.firstChild;i;){var a=i.nextSibling,s=i.nodeName;i[jm]||s==="SCRIPT"||s==="STYLE"||s==="LINK"&&i.rel.toLowerCase()==="stylesheet"||n.removeChild(i),i=a}}else n==="body"&&xm(e.ownerDocument.body);n=o}while(n);tf(t)}function hL(e,t){var n=e;e=0;do{var r=n.nextSibling;if(n.nodeType===1?t?(n._stashedDisplay=n.style.display,n.style.display="none"):(n.style.display=n._stashedDisplay||"",n.getAttribute("style")===""&&n.removeAttribute("style")):n.nodeType===3&&(t?(n._stashedText=n.nodeValue,n.nodeValue=""):n.nodeValue=n._stashedText||""),r&&r.nodeType===8)if(n=r.data,n==="/$"){if(e===0)break;e--}else n!=="$"&&n!=="$?"&&n!=="$~"&&n!=="$!"||e++;n=r}while(n)}function Lx(e){var t=e.firstChild;for(t&&t.nodeType===10&&(t=t.nextSibling);t;){var n=t;switch(t=t.nextSibling,n.nodeName){case"HTML":case"HEAD":case"BODY":Lx(n),Vx(n);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(n.rel.toLowerCase()==="stylesheet")continue}e.removeChild(n)}}function VX(e,t,n,r){for(;e.nodeType===1;){var o=n;if(e.nodeName.toLowerCase()!==t.toLowerCase()){if(!r&&(e.nodeName!=="INPUT"||e.type!=="hidden"))break}else if(r){if(!e[jm])switch(t){case"meta":if(!e.hasAttribute("itemprop"))break;return e;case"link":if(i=e.getAttribute("rel"),i==="stylesheet"&&e.hasAttribute("data-precedence"))break;if(i!==o.rel||e.getAttribute("href")!==(o.href==null||o.href===""?null:o.href)||e.getAttribute("crossorigin")!==(o.crossOrigin==null?null:o.crossOrigin)||e.getAttribute("title")!==(o.title==null?null:o.title))break;return e;case"style":if(e.hasAttribute("data-precedence"))break;return e;case"script":if(i=e.getAttribute("src"),(i!==(o.src==null?null:o.src)||e.getAttribute("type")!==(o.type==null?null:o.type)||e.getAttribute("crossorigin")!==(o.crossOrigin==null?null:o.crossOrigin))&&i&&e.hasAttribute("async")&&!e.hasAttribute("itemprop"))break;return e;default:return e}}else if(t==="input"&&e.type==="hidden"){var i=o.name==null?null:""+o.name;if(o.type==="hidden"&&e.getAttribute("name")===i)return e}else return e;if(e=Lo(e.nextSibling),e===null)break}return null}function WX(e,t,n){if(t==="")return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!n||(e=Lo(e.nextSibling),e===null))return null;return e}function o6(e,t){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!t||(e=Lo(e.nextSibling),e===null))return null;return e}function Ux(e){return e.data==="$?"||e.data==="$~"}function Px(e){return e.data==="$!"||e.data==="$?"&&e.ownerDocument.readyState!=="loading"}function YX(e,t){var n=e.ownerDocument;if(e.data==="$~")e._reactRetry=t;else if(e.data!=="$?"||n.readyState!=="loading")t();else{var r=function(){t(),n.removeEventListener("DOMContentLoaded",r)};n.addEventListener("DOMContentLoaded",r),e._reactRetry=r}}function Lo(e){for(;e!=null;e=e.nextSibling){var t=e.nodeType;if(t===1||t===3)break;if(t===8){if(t=e.data,t==="$"||t==="$!"||t==="$?"||t==="$~"||t==="&"||t==="F!"||t==="F")break;if(t==="/$"||t==="/&")return null}}return e}var Bx=null;function bL(e){e=e.nextSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n==="/$"||n==="/&"){if(t===0)return Lo(e.nextSibling);t--}else n!=="$"&&n!=="$!"&&n!=="$?"&&n!=="$~"&&n!=="&"||t++}e=e.nextSibling}return null}function yL(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n==="$"||n==="$!"||n==="$?"||n==="$~"||n==="&"){if(t===0)return e;t--}else n!=="/$"&&n!=="/&"||t++}e=e.previousSibling}return null}function i6(e,t,n){switch(t=Z0(n),e){case"html":if(e=t.documentElement,!e)throw Error(Y(452));return e;case"head":if(e=t.head,!e)throw Error(Y(453));return e;case"body":if(e=t.body,!e)throw Error(Y(454));return e;default:throw Error(Y(451))}}function xm(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);Vx(e)}var Uo=new Map,_L=new Set;function e_(e){return typeof e.getRootNode=="function"?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var Oa=gt.d;gt.d={f:KX,r:XX,D:JX,C:QX,L:ZX,m:eJ,X:nJ,S:tJ,M:rJ};function KX(){var e=Oa.f(),t=b_();return e||t}function XX(e){var t=rf(e);t!==null&&t.tag===5&&t.type==="form"?Q3(t):Oa.r(e)}var lf=typeof document>"u"?null:document;function a6(e,t,n){var r=lf;if(r&&typeof t=="string"&&t){var o=Co(t);o='link[rel="'+e+'"][href="'+o+'"]',typeof n=="string"&&(o+='[crossorigin="'+n+'"]'),_L.has(o)||(_L.add(o),e={rel:e,crossOrigin:n,href:t},r.querySelector(o)===null&&(t=r.createElement("link"),jn(t,"link",e),Un(t),r.head.appendChild(t)))}}function JX(e){Oa.D(e),a6("dns-prefetch",e,null)}function QX(e,t){Oa.C(e,t),a6("preconnect",e,t)}function ZX(e,t,n){Oa.L(e,t,n);var r=lf;if(r&&e&&t){var o='link[rel="preload"][as="'+Co(t)+'"]';t==="image"&&n&&n.imageSrcSet?(o+='[imagesrcset="'+Co(n.imageSrcSet)+'"]',typeof n.imageSizes=="string"&&(o+='[imagesizes="'+Co(n.imageSizes)+'"]')):o+='[href="'+Co(e)+'"]';var i=o;switch(t){case"style":i=ef(e);break;case"script":i=cf(e)}Uo.has(i)||(e=Bt({rel:"preload",href:t==="image"&&n&&n.imageSrcSet?void 0:e,as:t},n),Uo.set(i,e),r.querySelector(o)!==null||t==="style"&&r.querySelector(Xm(i))||t==="script"&&r.querySelector(Jm(i))||(t=r.createElement("link"),jn(t,"link",e),Un(t),r.head.appendChild(t)))}}function eJ(e,t){Oa.m(e,t);var n=lf;if(n&&e){var r=t&&typeof t.as=="string"?t.as:"script",o='link[rel="modulepreload"][as="'+Co(r)+'"][href="'+Co(e)+'"]',i=o;switch(r){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":i=cf(e)}if(!Uo.has(i)&&(e=Bt({rel:"modulepreload",href:e},t),Uo.set(i,e),n.querySelector(o)===null)){switch(r){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(n.querySelector(Jm(i)))return}r=n.createElement("link"),jn(r,"link",e),Un(r),n.head.appendChild(r)}}}function tJ(e,t,n){Oa.S(e,t,n);var r=lf;if(r&&e){var o=Bd(r).hoistableStyles,i=ef(e);t=t||"default";var a=o.get(i);if(!a){var s={loading:0,preload:null};if(a=r.querySelector(Xm(i)))s.loading=5;else{e=Bt({rel:"stylesheet",href:e,"data-precedence":t},n),(n=Uo.get(i))&&C1(e,n);var l=a=r.createElement("link");Un(l),jn(l,"link",e),l._p=new Promise(function(c,d){l.onload=c,l.onerror=d}),l.addEventListener("load",function(){s.loading|=1}),l.addEventListener("error",function(){s.loading|=2}),s.loading|=4,k0(a,t,r)}a={type:"stylesheet",instance:a,count:1,state:s},o.set(i,a)}}}function nJ(e,t){Oa.X(e,t);var n=lf;if(n&&e){var r=Bd(n).hoistableScripts,o=cf(e),i=r.get(o);i||(i=n.querySelector(Jm(o)),i||(e=Bt({src:e,async:!0},t),(t=Uo.get(o))&&M1(e,t),i=n.createElement("script"),Un(i),jn(i,"link",e),n.head.appendChild(i)),i={type:"script",instance:i,count:1,state:null},r.set(o,i))}}function rJ(e,t){Oa.M(e,t);var n=lf;if(n&&e){var r=Bd(n).hoistableScripts,o=cf(e),i=r.get(o);i||(i=n.querySelector(Jm(o)),i||(e=Bt({src:e,async:!0,type:"module"},t),(t=Uo.get(o))&&M1(e,t),i=n.createElement("script"),Un(i),jn(i,"link",e),n.head.appendChild(i)),i={type:"script",instance:i,count:1,state:null},r.set(o,i))}}function vL(e,t,n,r){var o=(o=Os.current)?e_(o):null;if(!o)throw Error(Y(446));switch(e){case"meta":case"title":return null;case"style":return typeof n.precedence=="string"&&typeof n.href=="string"?(t=ef(n.href),n=Bd(o).hoistableStyles,r=n.get(t),r||(r={type:"style",instance:null,count:0,state:null},n.set(t,r)),r):{type:"void",instance:null,count:0,state:null};case"link":if(n.rel==="stylesheet"&&typeof n.href=="string"&&typeof n.precedence=="string"){e=ef(n.href);var i=Bd(o).hoistableStyles,a=i.get(e);if(a||(o=o.ownerDocument||o,a={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},i.set(e,a),(i=o.querySelector(Xm(e)))&&!i._p&&(a.instance=i,a.state.loading=5),Uo.has(e)||(n={rel:"preload",as:"style",href:n.href,crossOrigin:n.crossOrigin,integrity:n.integrity,media:n.media,hrefLang:n.hrefLang,referrerPolicy:n.referrerPolicy},Uo.set(e,n),i||oJ(o,e,n,a.state))),t&&r===null)throw Error(Y(528,""));return a}if(t&&r!==null)throw Error(Y(529,""));return null;case"script":return t=n.async,n=n.src,typeof n=="string"&&t&&typeof t!="function"&&typeof t!="symbol"?(t=cf(n),n=Bd(o).hoistableScripts,r=n.get(t),r||(r={type:"script",instance:null,count:0,state:null},n.set(t,r)),r):{type:"void",instance:null,count:0,state:null};default:throw Error(Y(444,e))}}function ef(e){return'href="'+Co(e)+'"'}function Xm(e){return'link[rel="stylesheet"]['+e+"]"}function s6(e){return Bt({},e,{"data-precedence":e.precedence,precedence:null})}function oJ(e,t,n,r){e.querySelector('link[rel="preload"][as="style"]['+t+"]")?r.loading=1:(t=e.createElement("link"),r.preload=t,t.addEventListener("load",function(){return r.loading|=1}),t.addEventListener("error",function(){return r.loading|=2}),jn(t,"link",n),Un(t),e.head.appendChild(t))}function cf(e){return'[src="'+Co(e)+'"]'}function Jm(e){return"script[async]"+e}function SL(e,t,n){if(t.count++,t.instance===null)switch(t.type){case"style":var r=e.querySelector('style[data-href~="'+Co(n.href)+'"]');if(r)return t.instance=r,Un(r),r;var o=Bt({},n,{"data-href":n.href,"data-precedence":n.precedence,href:null,precedence:null});return r=(e.ownerDocument||e).createElement("style"),Un(r),jn(r,"style",o),k0(r,n.precedence,e),t.instance=r;case"stylesheet":o=ef(n.href);var i=e.querySelector(Xm(o));if(i)return t.state.loading|=4,t.instance=i,Un(i),i;r=s6(n),(o=Uo.get(o))&&C1(r,o),i=(e.ownerDocument||e).createElement("link"),Un(i);var a=i;return a._p=new Promise(function(s,l){a.onload=s,a.onerror=l}),jn(i,"link",r),t.state.loading|=4,k0(i,n.precedence,e),t.instance=i;case"script":return i=cf(n.src),(o=e.querySelector(Jm(i)))?(t.instance=o,Un(o),o):(r=n,(o=Uo.get(i))&&(r=Bt({},n),M1(r,o)),e=e.ownerDocument||e,o=e.createElement("script"),Un(o),jn(o,"link",r),e.head.appendChild(o),t.instance=o);case"void":return null;default:throw Error(Y(443,t.type))}else t.type==="stylesheet"&&(t.state.loading&4)===0&&(r=t.instance,t.state.loading|=4,k0(r,n.precedence,e));return t.instance}function k0(e,t,n){for(var r=n.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),o=r.length?r[r.length-1]:null,i=o,a=0;a<r.length;a++){var s=r[a];if(s.dataset.precedence===t)i=s;else if(i!==o)break}i?i.parentNode.insertBefore(e,i.nextSibling):(t=n.nodeType===9?n.head:n,t.insertBefore(e,t.firstChild))}function C1(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.title==null&&(e.title=t.title)}function M1(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.integrity==null&&(e.integrity=t.integrity)}var A0=null;function EL(e,t,n){if(A0===null){var r=new Map,o=A0=new Map;o.set(n,r)}else o=A0,r=o.get(n),r||(r=new Map,o.set(n,r));if(r.has(e))return r;for(r.set(e,null),n=n.getElementsByTagName(e),o=0;o<n.length;o++){var i=n[o];if(!(i[jm]||i[Hn]||e==="link"&&i.getAttribute("rel")==="stylesheet")&&i.namespaceURI!=="http://www.w3.org/2000/svg"){var a=i.getAttribute(t)||"";a=e+a;var s=r.get(a);s?s.push(i):r.set(a,[i])}}return r}function TL(e,t,n){e=e.ownerDocument||e,e.head.insertBefore(n,t==="title"?e.querySelector("head > title"):null)}function iJ(e,t,n){if(n===1||t.itemProp!=null)return!1;switch(e){case"meta":case"title":return!0;case"style":if(typeof t.precedence!="string"||typeof t.href!="string"||t.href==="")break;return!0;case"link":if(typeof t.rel!="string"||typeof t.href!="string"||t.href===""||t.onLoad||t.onError)break;switch(t.rel){case"stylesheet":return e=t.disabled,typeof t.precedence=="string"&&e==null;default:return!0}case"script":if(t.async&&typeof t.async!="function"&&typeof t.async!="symbol"&&!t.onLoad&&!t.onError&&t.src&&typeof t.src=="string")return!0}return!1}function l6(e){return!(e.type==="stylesheet"&&(e.state.loading&3)===0)}function aJ(e,t,n,r){if(n.type==="stylesheet"&&(typeof r.media!="string"||matchMedia(r.media).matches!==!1)&&(n.state.loading&4)===0){if(n.instance===null){var o=ef(r.href),i=t.querySelector(Xm(o));if(i){t=i._p,t!==null&&typeof t=="object"&&typeof t.then=="function"&&(e.count++,e=t_.bind(e),t.then(e,e)),n.state.loading|=4,n.instance=i,Un(i);return}i=t.ownerDocument||t,r=s6(r),(o=Uo.get(o))&&C1(r,o),i=i.createElement("link"),Un(i);var a=i;a._p=new Promise(function(s,l){a.onload=s,a.onerror=l}),jn(i,"link",r),n.instance=i}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(n,t),(t=n.state.preload)&&(n.state.loading&3)===0&&(e.count++,n=t_.bind(e),t.addEventListener("load",n),t.addEventListener("error",n))}}var qw=0;function sJ(e,t){return e.stylesheets&&e.count===0&&I0(e,e.stylesheets),0<e.count||0<e.imgCount?function(n){var r=setTimeout(function(){if(e.stylesheets&&I0(e,e.stylesheets),e.unsuspend){var i=e.unsuspend;e.unsuspend=null,i()}},6e4+t);0<e.imgBytes&&qw===0&&(qw=62500*HX());var o=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&I0(e,e.stylesheets),e.unsuspend)){var i=e.unsuspend;e.unsuspend=null,i()}},(e.imgBytes>qw?50:800)+t);return e.unsuspend=n,function(){e.unsuspend=null,clearTimeout(r),clearTimeout(o)}}:null}function t_(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)I0(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var n_=null;function I0(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,n_=new Map,t.forEach(lJ,e),n_=null,t_.call(e))}function lJ(e,t){if(!(t.state.loading&4)){var n=n_.get(e);if(n)var r=n.get(null);else{n=new Map,n_.set(e,n);for(var o=e.querySelectorAll("link[data-precedence],style[data-precedence]"),i=0;i<o.length;i++){var a=o[i];(a.nodeName==="LINK"||a.getAttribute("media")!=="not all")&&(n.set(a.dataset.precedence,a),r=a)}r&&n.set(null,r)}o=t.instance,a=o.getAttribute("data-precedence"),i=n.get(a)||r,i===r&&n.set(null,o),n.set(a,o),this.count++,r=t_.bind(this),o.addEventListener("load",r),o.addEventListener("error",r),i?i.parentNode.insertBefore(o,i.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(o,e.firstChild)),t.state.loading|=4}}var Pm={$$typeof:Ea,Provider:null,Consumer:null,_currentValue:rc,_currentValue2:rc,_threadCount:0};function cJ(e,t,n,r,o,i,a,s,l){this.tag=1,this.containerInfo=e,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=bw(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=bw(0),this.hiddenUpdates=bw(null),this.identifierPrefix=r,this.onUncaughtError=o,this.onCaughtError=i,this.onRecoverableError=a,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=l,this.incompleteTransitions=new Map}function c6(e,t,n,r,o,i,a,s,l,c,d,u){return e=new cJ(e,t,n,a,l,c,d,u,s),t=1,i===!0&&(t|=24),i=Kr(3,null,null,t),e.current=i,i.stateNode=e,t=o1(),t.refCount++,e.pooledCache=t,t.refCount++,i.memoizedState={element:r,isDehydrated:n,cache:t},s1(i),e}function u6(e){return e?(e=Dd,e):Dd}function d6(e,t,n,r,o,i){o=u6(o),r.context===null?r.context=o:r.pendingContext=o,r=Ls(t),r.payload={element:n},i=i===void 0?null:i,i!==null&&(r.callback=i),n=Us(e,r,t),n!==null&&(Mr(n,e,t),bm(n,e,t))}function wL(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function O1(e,t){wL(e,t),(e=e.alternate)&&wL(e,t)}function f6(e){if(e.tag===13||e.tag===31){var t=hc(e,67108864);t!==null&&Mr(t,e,67108864),O1(e,67108864)}}function xL(e){if(e.tag===13||e.tag===31){var t=eo();t=jx(t);var n=hc(e,t);n!==null&&Mr(n,e,t),O1(e,t)}}var r_=!0;function uJ(e,t,n,r){var o=Ne.T;Ne.T=null;var i=gt.p;try{gt.p=2,D1(e,t,n,r)}finally{gt.p=i,Ne.T=o}}function dJ(e,t,n,r){var o=Ne.T;Ne.T=null;var i=gt.p;try{gt.p=8,D1(e,t,n,r)}finally{gt.p=i,Ne.T=o}}function D1(e,t,n,r){if(r_){var o=zx(r);if(o===null)$w(e,t,r,o_,n),kL(e,r);else if(pJ(o,e,t,n,r))r.stopPropagation();else if(kL(e,r),t&4&&-1<fJ.indexOf(e)){for(;o!==null;){var i=rf(o);if(i!==null)switch(i.tag){case 3:if(i=i.stateNode,i.current.memoizedState.isDehydrated){var a=ec(i.pendingLanes);if(a!==0){var s=i;for(s.pendingLanes|=2,s.entangledLanes|=2;a;){var l=1<<31-Zr(a);s.entanglements[1]|=l,a&=~l}zi(i),(mt&6)===0&&(W0=Jr()+500,Km(0,!1))}}break;case 31:case 13:s=hc(i,2),s!==null&&Mr(s,i,2),b_(),O1(i,2)}if(i=zx(r),i===null&&$w(e,t,r,o_,n),i===o)break;o=i}o!==null&&r.stopPropagation()}else $w(e,t,r,null,n)}}function zx(e){return e=Yx(e),L1(e)}var o_=null;function L1(e){if(o_=null,e=Id(e),e!==null){var t=Fm(e);if(t===null)e=null;else{var n=t.tag;if(n===13){if(e=ML(t),e!==null)return e;e=null}else if(n===31){if(e=OL(t),e!==null)return e;e=null}else if(n===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null)}}return o_=e,null}function p6(e){switch(e){case"beforetoggle":case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"toggle":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 2;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 8;case"message":switch(ZY()){case PL:return 2;case BL:return 8;case O0:case eK:return 32;case zL:return 268435456;default:return 32}default:return 32}}var Fx=!1,zs=null,Fs=null,Hs=null,Bm=new Map,zm=new Map,As=[],fJ="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset".split(" ");function kL(e,t){switch(e){case"focusin":case"focusout":zs=null;break;case"dragenter":case"dragleave":Fs=null;break;case"mouseover":case"mouseout":Hs=null;break;case"pointerover":case"pointerout":Bm.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":zm.delete(t.pointerId)}}function am(e,t,n,r,o,i){return e===null||e.nativeEvent!==i?(e={blockedOn:t,domEventName:n,eventSystemFlags:r,nativeEvent:i,targetContainers:[o]},t!==null&&(t=rf(t),t!==null&&f6(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,o!==null&&t.indexOf(o)===-1&&t.push(o),e)}function pJ(e,t,n,r,o){switch(t){case"focusin":return zs=am(zs,e,t,n,r,o),!0;case"dragenter":return Fs=am(Fs,e,t,n,r,o),!0;case"mouseover":return Hs=am(Hs,e,t,n,r,o),!0;case"pointerover":var i=o.pointerId;return Bm.set(i,am(Bm.get(i)||null,e,t,n,r,o)),!0;case"gotpointercapture":return i=o.pointerId,zm.set(i,am(zm.get(i)||null,e,t,n,r,o)),!0}return!1}function m6(e){var t=Id(e.target);if(t!==null){var n=Fm(t);if(n!==null){if(t=n.tag,t===13){if(t=ML(n),t!==null){e.blockedOn=t,cD(e.priority,function(){xL(n)});return}}else if(t===31){if(t=OL(n),t!==null){e.blockedOn=t,cD(e.priority,function(){xL(n)});return}}else if(t===3&&n.stateNode.current.memoizedState.isDehydrated){e.blockedOn=n.tag===3?n.stateNode.containerInfo:null;return}}}e.blockedOn=null}function N0(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=zx(e.nativeEvent);if(n===null){n=e.nativeEvent;var r=new n.constructor(n.type,n);ox=r,n.target.dispatchEvent(r),ox=null}else return t=rf(n),t!==null&&f6(t),e.blockedOn=n,!1;t.shift()}return!0}function AL(e,t,n){N0(e)&&n.delete(t)}function mJ(){Fx=!1,zs!==null&&N0(zs)&&(zs=null),Fs!==null&&N0(Fs)&&(Fs=null),Hs!==null&&N0(Hs)&&(Hs=null),Bm.forEach(AL),zm.forEach(AL)}function p0(e,t){e.blockedOn===t&&(e.blockedOn=null,Fx||(Fx=!0,kn.unstable_scheduleCallback(kn.unstable_NormalPriority,mJ)))}var m0=null;function IL(e){m0!==e&&(m0=e,kn.unstable_scheduleCallback(kn.unstable_NormalPriority,function(){m0===e&&(m0=null);for(var t=0;t<e.length;t+=3){var n=e[t],r=e[t+1],o=e[t+2];if(typeof r!="function"){if(L1(r||n)===null)continue;break}var i=rf(n);i!==null&&(e.splice(t,3),t-=3,vx(i,{pending:!0,data:o,method:n.method,action:r},r,o))}}))}function tf(e){function t(l){return p0(l,e)}zs!==null&&p0(zs,e),Fs!==null&&p0(Fs,e),Hs!==null&&p0(Hs,e),Bm.forEach(t),zm.forEach(t);for(var n=0;n<As.length;n++){var r=As[n];r.blockedOn===e&&(r.blockedOn=null)}for(;0<As.length&&(n=As[0],n.blockedOn===null);)m6(n),n.blockedOn===null&&As.shift();if(n=(e.ownerDocument||e).$$reactFormReplay,n!=null)for(r=0;r<n.length;r+=3){var o=n[r],i=n[r+1],a=o[Or]||null;if(typeof i=="function")a||IL(n);else if(a){var s=null;if(i&&i.hasAttribute("formAction")){if(o=i,a=i[Or]||null)s=a.formAction;else if(L1(o)!==null)continue}else s=a.action;typeof s=="function"?n[r+1]=s:(n.splice(r,3),r-=3),IL(n)}}}function g6(){function e(i){i.canIntercept&&i.info==="react-transition"&&i.intercept({handler:function(){return new Promise(function(a){return o=a})},focusReset:"manual",scroll:"manual"})}function t(){o!==null&&(o(),o=null),r||setTimeout(n,20)}function n(){if(!r&&!navigation.transition){var i=navigation.currentEntry;i&&i.url!=null&&navigation.navigate(i.url,{state:i.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var r=!1,o=null;return navigation.addEventListener("navigate",e),navigation.addEventListener("navigatesuccess",t),navigation.addEventListener("navigateerror",t),setTimeout(n,100),function(){r=!0,navigation.removeEventListener("navigate",e),navigation.removeEventListener("navigatesuccess",t),navigation.removeEventListener("navigateerror",t),o!==null&&(o(),o=null)}}}function U1(e){this._internalRoot=e}v_.prototype.render=U1.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(Y(409));var n=t.current,r=eo();d6(n,r,e,t,null,null)};v_.prototype.unmount=U1.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;d6(e.current,2,null,e,null,null),b_(),t[nf]=null}};function v_(e){this._internalRoot=e}v_.prototype.unstable_scheduleHydration=function(e){if(e){var t=jL();e={blockedOn:null,target:e,priority:t};for(var n=0;n<As.length&&t!==0&&t<As[n].priority;n++);As.splice(n,0,e),n===0&&m6(e)}};var NL=RL.version;if(NL!=="19.2.7")throw Error(Y(527,NL,"19.2.7"));gt.findDOMNode=function(e){var t=e._reactInternals;if(t===void 0)throw typeof e.render=="function"?Error(Y(188)):(e=Object.keys(e).join(","),Error(Y(268,e)));return e=VY(t),e=e!==null?DL(e):null,e=e===null?null:e.stateNode,e};var gJ={bundleType:0,version:"19.2.7",rendererPackageName:"react-dom",currentDispatcherRef:Ne,reconcilerVersion:"19.2.7"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&(sm=__REACT_DEVTOOLS_GLOBAL_HOOK__,!sm.isDisabled&&sm.supportsFiber))try{Hm=sm.inject(gJ),Qr=sm}catch{}var sm;S_.createRoot=function(e,t){if(!CL(e))throw Error(Y(299));var n=!1,r="",o=aU,i=sU,a=lU;return t!=null&&(t.unstable_strictMode===!0&&(n=!0),t.identifierPrefix!==void 0&&(r=t.identifierPrefix),t.onUncaughtError!==void 0&&(o=t.onUncaughtError),t.onCaughtError!==void 0&&(i=t.onCaughtError),t.onRecoverableError!==void 0&&(a=t.onRecoverableError)),t=c6(e,1,!1,null,null,n,r,null,o,i,a,g6),e[nf]=t.current,R1(e),new U1(t)};S_.hydrateRoot=function(e,t,n){if(!CL(e))throw Error(Y(299));var r=!1,o="",i=aU,a=sU,s=lU,l=null;return n!=null&&(n.unstable_strictMode===!0&&(r=!0),n.identifierPrefix!==void 0&&(o=n.identifierPrefix),n.onUncaughtError!==void 0&&(i=n.onUncaughtError),n.onCaughtError!==void 0&&(a=n.onCaughtError),n.onRecoverableError!==void 0&&(s=n.onRecoverableError),n.formState!==void 0&&(l=n.formState)),t=c6(e,1,!0,t,n??null,r,o,l,i,a,s,g6),t.context=u6(null),n=t.current,r=eo(),r=jx(r),o=Ls(r),o.callback=null,Us(n,o,r),n=r,t.current.lanes=n,$m(t,n),zi(t),e[nf]=t.current,R1(e),new v_(t)};S_.version="19.2.7"});var _6=Rg((OEe,y6)=>{"use strict";function b6(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(b6)}catch(e){console.error(e)}}b6(),y6.exports=h6()});var yd={};rv(yd,{BrowserClient:()=>Pu,ErrorBoundary:()=>Vp,MULTIPLEXED_TRANSPORT_EXTRA_KEY:()=>du,OpenFeatureIntegrationHook:()=>$y,Profiler:()=>cd,SDK_VERSION:()=>mr,SEMANTIC_ATTRIBUTE_SENTRY_OP:()=>_e,SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN:()=>le,SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE:()=>fi,SEMANTIC_ATTRIBUTE_SENTRY_SOURCE:()=>Pe,Scope:()=>Xn,WINDOW:()=>J,addBreadcrumb:()=>Mn,addEventProcessor:()=>su,addIntegration:()=>_l,bindScopeToEmitter:()=>Mv,breadcrumbsIntegration:()=>Wb,browserApiErrorsIntegration:()=>Yb,browserProfilingIntegration:()=>EO,browserSessionIntegration:()=>Kb,browserTracingIntegration:()=>Vr,buildLaunchDarklyFlagUsedHandler:()=>xO,captureConsoleIntegration:()=>uS,captureEvent:()=>uo,captureException:()=>xe,captureFeedback:()=>gu,captureMessage:()=>Ja,captureReactException:()=>qp,captureSession:()=>Za,chromeStackLineParser:()=>RE,close:()=>Ch,consoleLoggingIntegration:()=>vS,contextLinesIntegration:()=>d2,continueTrace:()=>yh,createConsolaReporter:()=>ES,createLangChainCallbackHandler:()=>ku,createReduxEnhancer:()=>YO,createTransport:()=>tp,createUserFeedbackEnvelope:()=>XC,cultureContextIntegration:()=>Xb,dedupeIntegration:()=>lp,defaultRequestInstrumentationOptions:()=>Gp,defaultStackLineParsers:()=>ME,defaultStackParser:()=>qb,diagnoseSdkConnectivity:()=>RO,elementTimingIntegration:()=>bE,endSession:()=>lu,eventFiltersIntegration:()=>$h,eventFromException:()=>Rb,eventFromMessage:()=>Cb,exceptionFromError:()=>Lu,extraErrorDataIntegration:()=>dS,featureFlagsIntegration:()=>hS,feedbackAsyncIntegration:()=>bC,feedbackIntegration:()=>tE,feedbackSyncIntegration:()=>tE,fetchStreamPerformanceIntegration:()=>Uy,flush:()=>Rh,forceLoad:()=>n2,functionToStringIntegration:()=>ap,geckoStackLineParser:()=>CE,getActiveSpan:()=>Be,getClient:()=>q,getCurrentScope:()=>ae,getDefaultIntegrations:()=>LE,getFeedback:()=>rC,getGlobalScope:()=>br,getIsolationScope:()=>je,getReplay:()=>kM,getRootSpan:()=>Fe,getSpanDescendants:()=>gi,getSpanStatusFromHttpCode:()=>rh,getTraceData:()=>wl,globalHandlersIntegration:()=>Jb,graphqlClientIntegration:()=>g2,growthbookIntegration:()=>IO,httpClientIntegration:()=>s2,httpContextIntegration:()=>Qb,inboundFiltersIntegration:()=>sp,init:()=>jy,instrumentAnthropicAiClient:()=>RS,instrumentCreateReactAgent:()=>LS,instrumentGoogleGenAIClient:()=>MS,instrumentLangChainEmbeddings:()=>PS,instrumentLangGraph:()=>US,instrumentOpenAiClient:()=>AS,instrumentOutgoingRequests:()=>Ly,instrumentSupabaseClient:()=>Kh,isBotUserAgent:()=>UT,isEnabled:()=>au,isInitialized:()=>Mh,lastEventId:()=>iu,launchDarklyIntegration:()=>wO,lazyLoadIntegration:()=>Ib,linkedErrorsIntegration:()=>Zb,logger:()=>Qh,makeBrowserOfflineTransport:()=>oO,makeFetchTransport:()=>Vu,makeMultiplexedTransport:()=>nS,metrics:()=>rs,moduleMetadataIntegration:()=>cS,normalizeStringifyValue:()=>Yu,onLoad:()=>r2,openFeatureIntegration:()=>kO,opera10StackLineParser:()=>WC,opera11StackLineParser:()=>YC,parameterize:()=>Hh,reactErrorHandler:()=>PO,reactRouterBrowserTracingIntegration:()=>F5,reactRouterV3BrowserTracingIntegration:()=>XO,reactRouterV4BrowserTracingIntegration:()=>e5,reactRouterV5BrowserTracingIntegration:()=>t5,reactRouterV6BrowserTracingIntegration:()=>R5,reactRouterV7BrowserTracingIntegration:()=>L5,registerSpanErrorInstrumentation:()=>Hf,registerWebWorker:()=>OO,replayCanvasIntegration:()=>HM,replayIntegration:()=>Ry,reportPageLoaded:()=>tO,reportingObserverIntegration:()=>i2,rewriteFramesIntegration:()=>fS,sendFeedback:()=>WS,setActiveSpanInBrowser:()=>nO,setAttribute:()=>Ah,setAttributes:()=>kh,setContext:()=>Qa,setConversationId:()=>Nh,setCurrentClient:()=>Fh,setExtra:()=>wh,setExtras:()=>Th,setHttpStatus:()=>pi,setMeasurement:()=>ml,setTag:()=>ou,setTags:()=>xh,setUser:()=>Ih,showReportDialog:()=>xp,spanStreamingIntegration:()=>rO,spanToBaggageHeader:()=>ph,spanToJSON:()=>ie,spanToTraceHeader:()=>Qc,spotlightBrowserIntegration:()=>TO,startBrowserTracingNavigationSpan:()=>oi,startBrowserTracingPageLoadSpan:()=>ri,startInactiveSpan:()=>Dt,startNewTrace:()=>Yf,startSession:()=>yl,startSpan:()=>mn,startSpanManual:()=>Qn,statsigIntegration:()=>NO,supabaseIntegration:()=>pS,suppressTracing:()=>tu,tanstackRouterBrowserTracingIntegration:()=>QO,thirdPartyErrorFilterIntegration:()=>gS,uiProfiler:()=>qC,unleashIntegration:()=>AO,updateSpanName:()=>dh,useProfiler:()=>VO,viewHierarchyIntegration:()=>h2,webVitalsIntegration:()=>Py,webWorkerIntegration:()=>MO,winjsStackLineParser:()=>VC,withActiveSpan:()=>co,withErrorBoundary:()=>WO,withIsolationScope:()=>Cf,withProfiler:()=>qO,withScope:()=>Ht,withSentryReactRouterV6Routing:()=>D5,withSentryReactRouterV7Routing:()=>U5,withSentryRouting:()=>o5,withStreamedSpan:()=>Av,wrapCreateBrowserRouter:()=>G5,wrapCreateBrowserRouterV6:()=>M5,wrapCreateBrowserRouterV7:()=>P5,wrapCreateMemoryRouter:()=>$5,wrapCreateMemoryRouterV6:()=>O5,wrapCreateMemoryRouterV7:()=>B5,wrapReactRouterRouting:()=>H5,wrapUseRoutes:()=>j5,wrapUseRoutesV6:()=>C5,wrapUseRoutesV7:()=>z5,zodErrorsIntegration:()=>mS});var W=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__;var ne=globalThis;var mr="10.63.0";function or(){return Fa(ne),ne}function Fa(e){let t=e.__SENTRY__=e.__SENTRY__||{};return t.version=t.version||mr,t[mr]=t[mr]||{}}function Go(e,t,n=ne){let r=n.__SENTRY__=n.__SENTRY__||{},o=r[mr]=r[mr]||{};return o[e]||(o[e]=t())}var Ha=["debug","info","warn","error","log","assert","trace"],AP="Sentry Logger ",ol={};function Sn(e){if(!("console"in ne))return e();let t=ne.console,n={},r=Object.keys(ol);r.forEach(o=>{let i=ol[o];n[o]=t[o],t[o]=i});try{return e()}finally{r.forEach(o=>{t[o]=n[o]})}}function IP(){iv().enabled=!0}function NP(){iv().enabled=!1}function Xk(){return iv().enabled}function RP(...e){ov("log",...e)}function CP(...e){ov("warn",...e)}function MP(...e){ov("error",...e)}function ov(e,...t){W&&Xk()&&Sn(()=>{ne.console[e](`${AP}[${e}]:`,...t)})}function iv(){return W?Go("loggerSettings",()=>({enabled:!1})):{enabled:!1}}var A={enable:IP,disable:NP,isEnabled:Xk,log:RP,warn:CP,error:MP};var Jk=/\(error: (.*)\)/,Qk=/captureMessage|captureException/;function Sf(...e){let t=e.sort((n,r)=>n[0]-r[0]).map(n=>n[1]);return(n,r=0,o=0)=>{let i=[],a=n.split(`
10
- `);for(let s=r;s<a.length;s++){let l=a[s];l.length>1024&&(l=l.slice(0,1024));let c=Jk.test(l)?l.replace(Jk,"$1"):l;if(!c.includes("Error: ")){for(let d of t){let u=d(c);if(u){i.push(u);break}}if(i.length>=50+o)break}}return sv(i.slice(o))}}function Og(e){return Array.isArray(e)?Sf(...e):e}function sv(e){if(!e.length)return[];let t=Array.from(e);return/sentryWrapped/.test(Mg(t).function||"")&&t.pop(),t.reverse(),Qk.test(Mg(t).function||"")&&(t.pop(),Qk.test(Mg(t).function||"")&&t.pop()),t.slice(0,50).map(n=>({...n,filename:n.filename||Mg(t).filename,function:n.function||"?"}))}function Mg(e){return e[e.length-1]||{}}var av="<anonymous>";function ir(e){try{return!e||typeof e!="function"?av:e.name||av}catch{return av}}function il(e){let t=e.exception;if(t){let n=[];try{return t.values.forEach(r=>{r.stacktrace.frames&&n.push(...r.stacktrace.frames)}),n}catch{return}}}function Zk(e){let t=e?.startsWith("file://")?e.slice(7):e;return t?.match(/\/[A-Z]:/)&&(t=t.slice(1)),t}var Ef={},eA={};function Vn(e,t){return Ef[e]=Ef[e]||[],Ef[e].push(t),()=>{let n=Ef[e];if(n){let r=n.indexOf(t);r!==-1&&n.splice(r,1)}}}function Wn(e,t){if(!eA[e]){eA[e]=!0;try{t()}catch(n){W&&A.error(`Error while instrumenting ${e}`,n)}}}function un(e,t){let n=e&&Ef[e];if(n)for(let r of n)try{r(t)}catch(o){W&&A.error(`Error while triggering instrumentation handler.
11
- Type: ${e}
12
- Name: ${ir(r)}
13
- Error:`,o)}}var lv=null;function Tf(e){let t="error";Vn(t,e),Wn(t,OP)}function OP(){lv=ne.onerror,ne.onerror=function(e,t,n,r,o){return un("error",{column:r,error:o,line:n,msg:e,url:t}),lv?lv.apply(this,arguments):!1},ne.onerror.__SENTRY_INSTRUMENTED__=!0}var cv=null;function wf(e){let t="unhandledrejection";Vn(t,e),Wn(t,DP)}function DP(){cv=ne.onunhandledrejection,ne.onunhandledrejection=function(e){return un("unhandledrejection",e),cv?cv.apply(this,arguments):!0},ne.onunhandledrejection.__SENTRY_INSTRUMENTED__=!0}var tA=Object.prototype.toString;function En(e){switch(tA.call(e)){case"[object Error]":case"[object Exception]":case"[object DOMException]":case"[object WebAssembly.Exception]":return!0;default:return $o(e,Error)}}function Hc(e,t){return tA.call(e)===`[object ${t}]`}function Gc(e){return Hc(e,"ErrorEvent")}function xf(e){return Hc(e,"DOMError")}function Dg(e){return Hc(e,"DOMException")}function Tn(e){return Hc(e,"String")}function di(e){return typeof e=="object"&&e!==null&&"__sentry_template_string__"in e&&"__sentry_template_values__"in e}function dn(e){return e===null||di(e)||typeof e!="object"&&typeof e!="function"}function Tt(e){return Hc(e,"Object")}function Ga(e){return typeof Event<"u"&&$o(e,Event)}function Lg(e){return Hc(e,"RegExp")}function Bn(e){return!!(e?.then&&typeof e.then=="function")}function $o(e,t){try{return e instanceof t}catch{return!1}}function kf(e){return typeof Request<"u"&&$o(e,Request)}function wt(e,t,n){if(!(t in e))return;let r=e[t];if(typeof r!="function")return;let o=n(r);typeof o=="function"&&Af(o,r);try{e[t]=o}catch{W&&A.log(`Failed to replace method "${t}" in object`,e)}}function Ye(e,t,n){try{Object.defineProperty(e,t,{value:n,writable:!0,configurable:!0})}catch{W&&A.log(`Failed to add non-enumerable property "${String(t)}" to object`,e)}}function Af(e,t){try{let n=t.prototype||{};e.prototype=t.prototype=n,Ye(e,"__sentry_original__",t)}catch{}}function $a(e){return e.__sentry_original__}function If(e){if(En(e))return{message:e.message,name:e.name,stack:e.stack,...nA(e)};if(Ga(e)){let{type:t,target:n,currentTarget:r,detail:o}=e;return{type:t,target:n,currentTarget:r,...o?{detail:o}:{},...nA(e)}}return e}function nA(e){return typeof e=="object"&&e!==null?Object.fromEntries(Object.entries(e)):{}}function Ug(e){let t=Object.keys(If(e));return t.sort(),t[0]?t.join(", "):"[object has no keys]"}var $c;function al(e){if($c!==void 0)return $c?$c(e):e();let t=Symbol.for("__SENTRY_SAFE_RANDOM_ID_WRAPPER__"),n=ne;return t in n&&typeof n[t]=="function"?($c=n[t],$c(e)):($c=null,e())}function gr(){return al(()=>Math.random())}function Yn(){return al(()=>Date.now())}var rA=Symbol.for("sentry.skipNormalization"),oA=Symbol.for("sentry.overrideNormalizationDepth");function uv(e){Ye(e,rA,!0)}function dv(e,t){Ye(e,oA,t)}function iA(e){return!!e[rA]}function aA(e){let t=e[oA];return typeof t=="number"?t:void 0}var fv;function jc(e){fv=e}function ht(e,t=100,n=1/0){try{return pv("",e,t,n)}catch(r){return{ERROR:`**non-serializable** (${r})`}}}function Nf(e,t=3,n=100*1024){let r=ht(e,t);return PP(r)>n?Nf(e,t-1,n):r}function pv(e,t,n=1/0,r=1/0,o=BP()){let[i,a]=o;if(t==null||["boolean","string"].includes(typeof t)||typeof t=="number"&&Number.isFinite(t))return t;let s=mv(e,t);if(!s.startsWith("[object "))return s;if(iA(t))return t;let l=aA(t),c=l!==void 0?l:n;if(c===0)return s.replace("object ","");if(i(t))return"[Circular ~]";let d=t;if(d&&typeof d.toJSON=="function")try{let g=d.toJSON();return pv("",g,c-1,r,o)}catch{}let u=Array.isArray(t)?[]:{},m=0,p=If(t);for(let g in p){if(!Object.prototype.hasOwnProperty.call(p,g))continue;if(m>=r){u[g]="[MaxProperties ~]";break}let _=p[g];u[g]=pv(g,_,c-1,r,o),m++}return a(t),u}function mv(e,t){try{if(fv){let r=fv(t);if(r)return r}return typeof global<"u"&&t===global?"[Global]":typeof t=="number"&&!Number.isFinite(t)?`[${t}]`:typeof t=="function"?`[Function: ${ir(t)}]`:typeof t=="symbol"?`[${String(t)}]`:typeof t=="bigint"?`[BigInt: ${String(t)}]`:`[object ${LP(t)}]`}catch(n){return`**non-serializable** (${n})`}}function LP(e){let t=Object.getPrototypeOf(e);return t?.constructor?t.constructor.name:"null prototype"}function UP(e){return~-encodeURI(e).split(/%..|./).length}function PP(e){return UP(JSON.stringify(e))}function BP(){let e=new WeakSet;function t(r){return e.has(r)?!0:(e.add(r),!1)}function n(r){e.delete(r)}return[t,n]}function jo(e,t=0){return typeof e!="string"||t===0||e.length<=t?e:`${e.slice(0,t)}...`}function qc(e,t){let n=e,r=n.length;if(r<=150)return n;t>r&&(t=r);let o=Math.max(t-60,0);o<5&&(o=0);let i=Math.min(o+140,r);return i>r-5&&(i=r),i===r&&(o=Math.max(i-140,0)),n=n.slice(o,i),o>0&&(n=`'{snip} ${n}`),i<r&&(n+=" {snip}"),n}function ja(e,t){if(!Array.isArray(e))return"";let n=[];for(let r=0;r<e.length;r++){let o=e[r];dn(o)?n.push(String(o)):o instanceof Error?n.push(o.message?`${o.name}: ${o.message}`:o.name):n.push(mv(void 0,o))}return n.join(t)}function qa(e,t,n=!1){return Tn(e)?Lg(t)?t.test(e):Tn(t)?n?e===t:e.includes(t):typeof t=="function"?t(e):!1:!1}function fn(e,t=[],n=!1){for(let r of t)if(qa(e,r,n))return!0;return!1}function zP(){let e=ne;return e.crypto||e.msCrypto}var gv;function FP(){return gr()*16}function ft(e=zP()){try{if(e?.randomUUID)return al(()=>e.randomUUID()).replace(/-/g,"")}catch{}return gv||(gv="10000000100040008000"+1e11),gv.replace(/[018]/g,t=>(t^(FP()&15)>>t/4).toString(16))}function sA(e){return e.exception?.values?.[0]}function qo(e){let{message:t,event_id:n}=e;if(t)return t;let r=sA(e);return r?r.type&&r.value?`${r.type}: ${r.value}`:r.type||r.value||n||"<unknown>":n||"<unknown>"}function sl(e,t,n){let r=e.exception=e.exception||{},o=r.values=r.values||[],i=o[0]=o[0]||{};i.value||(i.value=t||""),i.type||(i.type=n||"Error")}function Rn(e,t){let n=sA(e);if(!n)return;let r={type:"generic",handled:!0},o=n.mechanism;if(n.mechanism={...r,...o,...t},t&&"data"in t){let i={...o?.data,...t.data};n.mechanism.data=i}}function Pg(e,t,n=5){if(t.lineno===void 0)return;let r=e.length,o=Math.max(Math.min(r-1,t.lineno-1),0);t.pre_context=e.slice(Math.max(0,o-n),o).map(a=>qc(a,0));let i=Math.min(r-1,o);t.context_line=qc(e[i],t.colno||0),t.post_context=e.slice(Math.min(o+1,r),o+1+n).map(a=>qc(a,0))}function Rf(e){if(hv(e))return!0;try{Ye(e,"__sentry_captured__",!0)}catch{}return!1}function hv(e){try{return e.__sentry_captured__}catch{}}var cA=1e3;function hr(){return Yn()/cA}function HP(){let{performance:e}=ne;if(!e?.now||!e.timeOrigin)return hr;let t=e.timeOrigin;return()=>(t+al(()=>e.now()))/cA}var lA;function Ue(){return(lA??(lA=HP()))()}var bv=null;function GP(){let{performance:e}=ne;if(!e?.now)return;let t=3e5,n=al(()=>e.now()),r=Yn(),o=e.timeOrigin;if(typeof o=="number"&&Math.abs(o+n-r)<t)return o;let i=e.timing?.navigationStart;return typeof i=="number"&&Math.abs(i+n-r)<t?i:r-n}function ut(){return bv===null&&(bv=GP()),bv}function uA(e){let t=Ue(),n={sid:ft(),init:!0,timestamp:t,started:t,duration:0,status:"ok",errors:0,ignoreDuration:!1,toJSON:()=>$P(n)};return e&&Vi(n,e),n}function Vi(e,t={}){if(t.user&&(!e.ipAddress&&t.user.ip_address&&(e.ipAddress=t.user.ip_address),!e.did&&!t.did&&(e.did=t.user.id||t.user.email||t.user.username)),e.timestamp=t.timestamp||Ue(),t.abnormal_mechanism&&(e.abnormal_mechanism=t.abnormal_mechanism),t.ignoreDuration&&(e.ignoreDuration=t.ignoreDuration),t.sid&&(e.sid=t.sid.length===32?t.sid:ft()),t.init!==void 0&&(e.init=t.init),!e.did&&t.did&&(e.did=`${t.did}`),typeof t.started=="number"&&(e.started=t.started),e.ignoreDuration)e.duration=void 0;else if(typeof t.duration=="number")e.duration=t.duration;else{let n=e.timestamp-e.started;e.duration=n>=0?n:0}t.release&&(e.release=t.release),t.environment&&(e.environment=t.environment),!e.ipAddress&&t.ipAddress&&(e.ipAddress=t.ipAddress),!e.userAgent&&t.userAgent&&(e.userAgent=t.userAgent),typeof t.errors=="number"&&(e.errors=t.errors),t.status&&(e.status=t.status)}function dA(e,t){let n={};t?n={status:t}:e.status==="ok"&&(n={status:"exited"}),Vi(e,n)}function $P(e){return{sid:`${e.sid}`,init:e.init,started:new Date(e.started*1e3).toISOString(),timestamp:new Date(e.timestamp*1e3).toISOString(),status:e.status,errors:e.errors,did:typeof e.did=="number"||typeof e.did=="string"?`${e.did}`:void 0,duration:e.duration,abnormal_mechanism:e.abnormal_mechanism,attrs:{release:e.release,environment:e.environment,ip_address:e.ipAddress,user_agent:e.userAgent}}}function Va(e,t,n=2){if(!t||typeof t!="object"||n<=0)return t;if(e&&Object.keys(t).length===0)return e;let r={...e};for(let o in t)Object.prototype.hasOwnProperty.call(t,o)&&(r[o]=Va(r[o],t[o],n-1));return r}function zn(){return ft()}function Kn(){return ft().substring(16)}function Bg(e){try{let t=ne.WeakRef;if(typeof t=="function")return new t(e)}catch{}return e}function zg(e){if(e){if(typeof e=="object"&&"deref"in e&&typeof e.deref=="function")try{return e.deref()}catch{return}return e}}var yv="_sentrySpan";function ar(e,t){t?Ye(e,yv,Bg(t)):delete e[yv]}function Vo(e){return zg(e[yv])}var jP=100,Xn=class e{constructor(){this._notifyingListeners=!1,this._scopeListeners=[],this._eventProcessors=[],this._breadcrumbs=[],this._attachments=[],this._user={},this._tags={},this._attributes={},this._extra={},this._contexts={},this._sdkProcessingMetadata={},this._propagationContext={traceId:zn(),sampleRand:gr()}}clone(){let t=new e;return t._breadcrumbs=[...this._breadcrumbs],t._tags={...this._tags},t._attributes={...this._attributes},t._extra={...this._extra},t._contexts={...this._contexts},this._contexts.flags&&(t._contexts.flags={values:[...this._contexts.flags.values]}),t._user=this._user,t._level=this._level,t._session=this._session,t._transactionName=this._transactionName,t._fingerprint=this._fingerprint,t._eventProcessors=[...this._eventProcessors],t._attachments=[...this._attachments],t._sdkProcessingMetadata={...this._sdkProcessingMetadata},t._propagationContext={...this._propagationContext},t._client=this._client,t._lastEventId=this._lastEventId,t._conversationId=this._conversationId,ar(t,Vo(this)),t}setClient(t){this._client=t}setLastEventId(t){this._lastEventId=t}getClient(){return this._client}lastEventId(){return this._lastEventId}addScopeListener(t){this._scopeListeners.push(t)}addEventProcessor(t){return this._eventProcessors.push(t),this}setUser(t){return this._user=t||{email:void 0,id:void 0,ip_address:void 0,username:void 0},this._session&&Vi(this._session,{user:t}),this._notifyScopeListeners(),this}getUser(){return this._user}setConversationId(t){return this._conversationId=t||void 0,this._notifyScopeListeners(),this}setTags(t){return this._tags={...this._tags,...t},this._notifyScopeListeners(),this}setTag(t,n){return this.setTags({[t]:n})}setAttributes(t){return this._attributes={...this._attributes,...t},this._notifyScopeListeners(),this}setAttribute(t,n){return this.setAttributes({[t]:n})}removeAttribute(t){return t in this._attributes&&(delete this._attributes[t],this._notifyScopeListeners()),this}setExtras(t){return this._extra={...this._extra,...t},this._notifyScopeListeners(),this}setExtra(t,n){return this._extra={...this._extra,[t]:n},this._notifyScopeListeners(),this}setFingerprint(t){return this._fingerprint=t,this._notifyScopeListeners(),this}setLevel(t){return this._level=t,this._notifyScopeListeners(),this}setTransactionName(t){return this._transactionName=t,this._notifyScopeListeners(),this}setContext(t,n){return n===null?delete this._contexts[t]:this._contexts[t]=n,this._notifyScopeListeners(),this}setSession(t){return t?this._session=t:delete this._session,this._notifyScopeListeners(),this}getSession(){return this._session}update(t){if(!t)return this;let n=typeof t=="function"?t(this):t,r=n instanceof e?n.getScopeData():Tt(n)?t:void 0,{tags:o,attributes:i,extra:a,user:s,contexts:l,level:c,fingerprint:d=[],propagationContext:u,conversationId:m}=r||{};return this._tags={...this._tags,...o},this._attributes={...this._attributes,...i},this._extra={...this._extra,...a},this._contexts={...this._contexts,...l},s&&Object.keys(s).length&&(this._user=s),c&&(this._level=c),d.length&&(this._fingerprint=d),u&&(this._propagationContext=u),m&&(this._conversationId=m),this}clear(){return this._breadcrumbs=[],this._tags={},this._attributes={},this._extra={},this._user={},this._contexts={},this._level=void 0,this._transactionName=void 0,this._fingerprint=void 0,this._session=void 0,this._conversationId=void 0,ar(this,void 0),this._attachments=[],this.setPropagationContext({traceId:zn(),sampleRand:gr()}),this._notifyScopeListeners(),this}addBreadcrumb(t,n){let r=typeof n=="number"?n:jP;if(r<=0)return this;let o={timestamp:hr(),...t,message:t.message?jo(t.message,2048):t.message};return this._breadcrumbs.push(o),this._breadcrumbs.length>r&&(this._breadcrumbs=this._breadcrumbs.slice(-r),this._client?.recordDroppedEvent("buffer_overflow","log_item")),this._notifyScopeListeners(),this}getLastBreadcrumb(){return this._breadcrumbs[this._breadcrumbs.length-1]}clearBreadcrumbs(){return this._breadcrumbs=[],this._notifyScopeListeners(),this}addAttachment(t){return this._attachments.push(t),this}clearAttachments(){return this._attachments=[],this}getScopeData(){return{breadcrumbs:this._breadcrumbs,attachments:this._attachments,contexts:this._contexts,tags:this._tags,attributes:this._attributes,extra:this._extra,user:this._user,level:this._level,fingerprint:this._fingerprint||[],eventProcessors:this._eventProcessors,propagationContext:this._propagationContext,sdkProcessingMetadata:this._sdkProcessingMetadata,transactionName:this._transactionName,span:Vo(this),conversationId:this._conversationId}}setSDKProcessingMetadata(t){return this._sdkProcessingMetadata=Va(this._sdkProcessingMetadata,t,2),this}setPropagationContext(t){return this._propagationContext=t,this}getPropagationContext(){return this._propagationContext}captureException(t,n){let r=n?.event_id||ft();if(!this._client)return W&&A.warn("No client configured on scope - will not capture exception!"),r;let o=new Error("Sentry syntheticException");return this._client.captureException(t,{originalException:t,syntheticException:o,...n,event_id:r},this),r}captureMessage(t,n,r){let o=r?.event_id||ft();if(!this._client)return W&&A.warn("No client configured on scope - will not capture message!"),o;let i=r?.syntheticException??new Error(t);return this._client.captureMessage(t,n,{originalException:t,syntheticException:i,...r,event_id:o},this),o}captureEvent(t,n){let r=t.event_id||n?.event_id||ft();return this._client?(this._client.captureEvent(t,{...n,event_id:r},this),r):(W&&A.warn("No client configured on scope - will not capture event!"),r)}_notifyScopeListeners(){this._notifyingListeners||(this._notifyingListeners=!0,this._scopeListeners.forEach(t=>{t(this)}),this._notifyingListeners=!1)}};function fA(){return Go("defaultCurrentScope",()=>new Xn)}function pA(){return Go("defaultIsolationScope",()=>new Xn)}var mA=e=>e instanceof Promise&&!e[gA],gA=Symbol("chained PromiseLike"),Fg=(e,t,n)=>{let r=e.then(o=>(t(o),o),o=>{throw n(o),o});return mA(r)&&mA(e)?r:qP(e,r)},qP=(e,t)=>{if(!t)return e;let n=!1;for(let r in e){if(r in t)continue;n=!0;let o=e[r];typeof o=="function"?Object.defineProperty(t,r,{value:(...i)=>o.apply(e,i),enumerable:!0,configurable:!0,writable:!0}):t[r]=o}return n&&Object.assign(t,{[gA]:!0}),t};var _v=class{constructor(t,n){let r;t?r=t:r=new Xn;let o;n?o=n:o=new Xn,this._stack=[{scope:r}],this._isolationScope=o}withScope(t){let n=this._pushScope(),r;try{r=t(n)}catch(o){throw this._popScope(),o}return Bn(r)?Fg(r,()=>this._popScope(),()=>this._popScope()):(this._popScope(),r)}getClient(){return this.getStackTop().client}getScope(){return this.getStackTop().scope}getIsolationScope(){return this._isolationScope}getStackTop(){return this._stack[this._stack.length-1]}_pushScope(){let t=this.getScope().clone();return this._stack.push({client:this.getClient(),scope:t}),t}_popScope(){return this._stack.length<=1?!1:!!this._stack.pop()}};function Vc(){let e=or(),t=Fa(e);return t.stack=t.stack||new _v(fA(),pA())}function VP(e){return Vc().withScope(e)}function WP(e,t){let n=Vc();return n.withScope(()=>(n.getStackTop().scope=e,t(e)))}function hA(e){return Vc().withScope(()=>e(Vc().getIsolationScope()))}function bA(){return{withIsolationScope:hA,withScope:VP,withSetScope:WP,withSetIsolationScope:(e,t)=>hA(t),getCurrentScope:()=>Vc().getScope(),getIsolationScope:()=>Vc().getIsolationScope()}}function lo(e){let t=Fa(e);return t.acs?t.acs:bA()}function YP(e){return typeof e=="object"&&e!=null&&!Array.isArray(e)&&Object.keys(e).includes("value")}function KP(e,t){let{value:n,unit:r}=YP(e)?e:{value:e,unit:void 0},o=XP(n),i=r&&typeof r=="string"?{unit:r}:{};if(o)return{...o,...i};if(!t||t==="skip-undefined"&&n===void 0)return;let a="";try{a=JSON.stringify(n)??""}catch{}return{value:a,type:"string",...i}}function Wi(e,t=!1){let n={};for(let[r,o]of Object.entries(e??{})){let i=KP(o,t);i&&(n[r]=i)}return n}function vv(e){if(!e)return 0;let t=0;for(let[n,r]of Object.entries(e)){t+=n.length*2,t+=r.type.length*2,t+=(r.unit?.length??0)*2;let o=r.value;Array.isArray(o)?t+=yA(o[0])*o.length:dn(o)?t+=yA(o):t+=100}return t}function yA(e){return typeof e=="string"?e.length*2:typeof e=="boolean"?4:typeof e=="number"?8:0}function XP(e){if(Array.isArray(e))return{value:e,type:"array"};let t=typeof e=="string"?"string":typeof e=="boolean"?"boolean":typeof e=="number"&&!Number.isNaN(e)?Number.isInteger(e)?"integer":"double":null;if(t)return{value:e,type:t}}var _A;function Sv(){return _A?.()}function Hg(){return _A!==void 0}function ae(){let e=or();return lo(e).getCurrentScope()}function je(){let e=or();return lo(e).getIsolationScope()}function br(){return Go("globalScope",()=>new Xn)}function Ht(...e){let t=or(),n=lo(t);if(e.length===2){let[r,o]=e;return r?n.withSetScope(r,o):n.withScope(o)}return n.withScope(e[0])}function Cf(...e){let t=or(),n=lo(t);if(e.length===2){let[r,o]=e;return r?n.withSetIsolationScope(r,o):n.withIsolationScope(o)}return n.withIsolationScope(e[0])}function q(){return ae().getClient()}function Wc(e){let t=Sv();if(t)return{trace_id:t.traceId,span_id:t.spanId};let n=e.getPropagationContext(),{traceId:r,parentSpanId:o,propagationSpanId:i}=n,a={trace_id:r,span_id:i||Kn()};return o&&(a.parent_span_id=o),a}var Pe="sentry.source",fi="sentry.sample_rate",Yc="sentry.previous_trace_sample_rate",_e="sentry.op",le="sentry.origin",Gg="sentry.status.message",Yi="sentry.idle_span_finish_reason",Wo="sentry.measurement_unit",Yo="sentry.measurement_value",$g="sentry.release",jg="sentry.environment",qg="sentry.segment.name",Vg="sentry.segment.id",Wg="sentry.sdk.name",Yg="sentry.sdk.version",Kg="sentry.sdk.integrations",Xg="user.id",Jg="user.email",Qg="user.ip_address",Zg="user.name",ll="sentry.custom_span_name",cl="sentry.profile_id",Jn="sentry.exclusive_time";var eh="http.request.method",Kc="url.full",th="sentry.link.type",nh="gen_ai.conversation.id";function rh(e){if(e<400&&e>=100)return{code:1};if(e>=400&&e<500)switch(e){case 401:return{code:2,message:"unauthenticated"};case 403:return{code:2,message:"permission_denied"};case 404:return{code:2,message:"not_found"};case 409:return{code:2,message:"already_exists"};case 413:return{code:2,message:"failed_precondition"};case 429:return{code:2,message:"resource_exhausted"};case 499:return{code:2,message:"cancelled"};default:return{code:2,message:"invalid_argument"}}if(e>=500&&e<600)switch(e){case 501:return{code:2,message:"unimplemented"};case 503:return{code:2,message:"unavailable"};case 504:return{code:2,message:"deadline_exceeded"};default:return{code:2,message:"internal_error"}}return{code:2,message:"internal_error"}}function pi(e,t){e.setAttribute("http.response.status_code",t);let n=rh(t);n.message!=="unknown_error"&&e.setStatus(n)}var vA="_sentryScope",SA="_sentryIsolationScope",JP=Symbol.for("sentry.otelSourceInference");function Wa(e,t,n){e&&(Ye(e,SA,Bg(n)),Ye(e,vA,t))}function mi(e){let t=e;return{scope:t[vA],isolationScope:zg(t[SA])}}function EA(e){return e[JP]===!0}var Mf="sentry-";var QP=8192;function Xc(e){let t=ZP(e);if(!t)return;let n=Object.entries(t).reduce((r,[o,i])=>{if(o.startsWith(Mf)){let a=o.slice(Mf.length);r[a]=i}return r},{});if(Object.keys(n).length>0)return n}function oh(e){if(!e)return;let t=Object.entries(e).reduce((n,[r,o])=>(o&&(n[`${Mf}${r}`]=o),n),{});return eB(t)}function ZP(e){if(!(!e||!Tn(e)&&!Array.isArray(e)))return Array.isArray(e)?e.reduce((t,n)=>{let r=TA(n);return Object.entries(r).forEach(([o,i])=>{t[o]=i}),t},{}):TA(e)}function TA(e){return e.split(",").map(t=>{let n=t.indexOf("=");if(n===-1)return[];let r=t.slice(0,n),o=t.slice(n+1);return[r,o].map(i=>{try{return decodeURIComponent(i.trim())}catch{return}})}).reduce((t,[n,r])=>(n&&r&&(t[n]=r),t),{})}function eB(e){if(Object.keys(e).length!==0)return Object.entries(e).reduce((t,[n,r],o)=>{let i=`${encodeURIComponent(n)}=${encodeURIComponent(r)}`,a=o===0?i:`${t},${i}`;return a.length>QP?(W&&A.warn(`Not adding key: ${n} with val: ${r} to baggage header due to exceeding baggage size limits.`),t):a},"")}var tB=/^o(\d+)\./,nB=/^(?:(\w+):)\/\/(?:(\w+)(?::(\w+)?)?@)((?:\[[:.%\w]+\]|[\w.-]+))(?::(\d+))?\/(.+)/;function rB(e){return e==="http"||e==="https"}function pn(e,t=!1){let{host:n,path:r,pass:o,port:i,projectId:a,protocol:s,publicKey:l}=e;return`${s}://${l}${t&&o?`:${o}`:""}@${n}${i?`:${i}`:""}/${r&&`${r}/`}${a}`}function ih(e){let t=nB.exec(e);if(!t){Sn(()=>{console.error(`Invalid Sentry Dsn: ${e}`)});return}let[n,r,o="",i="",a="",s=""]=t.slice(1),l="",c=s,d=c.split("/");if(d.length>1&&(l=d.slice(0,-1).join("/"),c=d.pop()),c){let u=c.match(/^\d+/);u&&(c=u[0])}return wA({host:i,pass:o,path:l,projectId:c,port:a,protocol:n,publicKey:r})}function wA(e){return{protocol:e.protocol,publicKey:e.publicKey||"",pass:e.pass||"",host:e.host,port:e.port||"",path:e.path||"",projectId:e.projectId}}function oB(e){if(!W)return!0;let{port:t,projectId:n,protocol:r}=e;return["protocol","publicKey","host","projectId"].find(a=>e[a]?!1:(A.error(`Invalid Sentry Dsn: ${a} missing`),!0))?!1:n.match(/^\d+$/)?rB(r)?t&&isNaN(parseInt(t,10))?(A.error(`Invalid Sentry Dsn: Invalid port ${t}`),!1):!0:(A.error(`Invalid Sentry Dsn: Invalid protocol ${r}`),!1):(A.error(`Invalid Sentry Dsn: Invalid projectId ${n}`),!1)}function iB(e){return e.match(tB)?.[1]}function ah(e){let t=e.getOptions(),{host:n}=e.getDsn()||{},r;return t.orgId?r=String(t.orgId):n&&(r=iB(n)),r}function Of(e){let t=typeof e=="string"?ih(e):wA(e);if(!(!t||!oB(t)))return t}function Br(e){if(typeof e=="boolean")return Number(e);let t=typeof e=="string"?parseFloat(e):e;if(!(typeof t!="number"||isNaN(t)||t<0||t>1))return t}var sh=new RegExp("^[ \\t]*([0-9a-f]{32})?-?([0-9a-f]{16})?-?([01])?[ \\t]*$");function xA(e){if(!e)return;let t=e.match(sh);if(!t)return;let n;return t[3]==="1"?n=!0:t[3]==="0"&&(n=!1),{traceId:t[1],parentSampled:n,parentSpanId:t[2]}}function Df(e,t){let n=xA(e),r=Xc(t);if(!n?.traceId)return{traceId:zn(),sampleRand:gr()};let o=aB(n,r);r&&(r.sample_rand=o.toString());let{traceId:i,parentSpanId:a,parentSampled:s}=n;return{traceId:i,parentSpanId:a,sampled:s,dsc:r||{},sampleRand:o}}function Lf(e=zn(),t=Kn(),n){let r="";return n!==void 0&&(r=n?"-1":"-0"),`${e}-${t}${r}`}function Uf(e=zn(),t=Kn(),n){return`00-${e}-${t}-${n?"01":"00"}`}function aB(e,t){let n=Br(t?.sample_rand);if(n!==void 0)return n;let r=Br(t?.sample_rate);return r&&e?.parentSampled!==void 0?e.parentSampled?gr()*r:r+gr()*(1-r):gr()}function Ev(e,t){let n=ah(e);return t&&n&&t!==n?(A.log(`Won't continue trace because org IDs don't match (incoming baggage: ${t}, SDK options: ${n})`),!1):(e.getOptions().strictTraceContinuation||!1)&&(t&&!n||!t&&n)?(A.log(`Starting a new trace because strict trace continuation is enabled but one org ID is missing (incoming baggage: ${t}, Sentry client: ${n})`),!1):!0}var lh=0,Bf=1,kA=!1;function NA(e){let{spanId:t,traceId:n}=e.spanContext(),{data:r,op:o,parent_span_id:i,status:a,origin:s,links:l}=ie(e);return{parent_span_id:i,span_id:t,trace_id:n,data:r,op:o,status:a,origin:s,links:l}}function Jc(e){let{spanId:t,traceId:n,isRemote:r}=e.spanContext(),o=r?t:ie(e).parent_span_id,i=mi(e).scope,a=r?i?.getPropagationContext().propagationSpanId||Kn():t;return{parent_span_id:o,span_id:a,trace_id:n}}function Qc(e){let{traceId:t,spanId:n}=e.spanContext(),r=Cn(e);return Lf(t,n,r)}function RA(e){let{traceId:t,spanId:n}=e.spanContext(),r=Cn(e);return Uf(t,n,r)}function zf(e){if(e&&e.length>0)return e.map(({context:{spanId:t,traceId:n,traceFlags:r,...o},attributes:i})=>({span_id:t,trace_id:n,sampled:r===Bf,attributes:i,...o}))}function wv(e){if(e?.length)return e.map(({context:{spanId:t,traceId:n,traceFlags:r},attributes:o})=>({span_id:t,trace_id:n,sampled:r===Bf,attributes:o}))}function yr(e){return typeof e=="number"?AA(e):Array.isArray(e)?e[0]+e[1]/1e9:e instanceof Date?AA(e.getTime()):Ue()}function AA(e){return e>9999999999?e/1e3:e}function ie(e){if(OA(e))return e.getSpanJSON();let{spanId:t,traceId:n}=e.spanContext();if(MA(e)){let{attributes:r,startTime:o,name:i,endTime:a,status:s,links:l}=e;return{span_id:t,trace_id:n,data:r,description:i,parent_span_id:CA(e),start_timestamp:yr(o),timestamp:yr(a)||void 0,status:Ff(s),op:r[_e],origin:r[le],links:zf(l)}}return{span_id:t,trace_id:n,start_timestamp:0,data:{}}}function Ya(e){if(OA(e))return e.getStreamedSpanJSON();let{spanId:t,traceId:n}=e.spanContext();if(MA(e)){let{attributes:r,startTime:o,name:i,endTime:a,status:s,links:l}=e;return{name:i,span_id:t,trace_id:n,parent_span_id:CA(e),start_timestamp:yr(o),end_timestamp:yr(a),is_segment:e===dl(e),status:uh(s),attributes:xv(r,s),links:wv(l)}}return{span_id:t,trace_id:n,start_timestamp:0,name:"",end_timestamp:0,status:"ok",is_segment:e===dl(e)}}function CA(e){return"parentSpanId"in e?e.parentSpanId:"parentSpanContext"in e?e.parentSpanContext?.spanId:void 0}function ch(e){return{...e,attributes:Wi(e.attributes),links:e.links?.map(t=>({...t,attributes:Wi(t.attributes)}))}}function MA(e){let t=e;return!!t.attributes&&!!t.startTime&&!!t.name&&!!t.endTime&&!!t.status}function OA(e){return typeof e.getSpanJSON=="function"}function Cn(e){let{traceFlags:t}=e.spanContext();return t===Bf}function Ff(e){if(!(!e||e.code===0))return e.code===1?"ok":e.message||"internal_error"}function uh(e){return!e||e.code===1||e.code===0||e.message==="cancelled"?"ok":"error"}function xv(e,t){let n=uh(t)==="error"?t?.message:void 0;return{...n&&{[Gg]:n},...e}}var ul="_sentryChildSpans",Tv="_sentryRootSpan";function Zc(e,t){let n=e[Tv]||e;Ye(t,Tv,n),e[ul]?e[ul].add(t):Ye(e,ul,new Set([t]))}function DA(e,t){e[ul]&&e[ul].delete(t)}function gi(e){let t=new Set;function n(r){if(!t.has(r)&&Cn(r)){t.add(r);let o=r[ul]?Array.from(r[ul]):[];for(let i of o)n(i)}}return n(e),Array.from(t)}var Fe=dl;function dl(e){return e[Tv]||e}function Be(){let e=or(),t=lo(e);return t.getActiveSpan?t.getActiveSpan():Vo(ae())}function fl(){kA||(Sn(()=>{console.warn("[Sentry] Returning null from `beforeSendSpan` is disallowed. To drop certain spans, configure the respective integrations directly or use `ignoreSpans`.")}),kA=!0)}function dh(e,t){e.updateName(t),e.setAttributes({[Pe]:"custom",[ll]:t})}var LA=!1;function Hf(){if(LA)return;function e(){let t=Be(),n=t&&Fe(t);if(n){let r="internal_error";W&&A.log(`[Tracing] Root span: ${r} -> Global error occurred`),n.setStatus({code:2,message:r})}}LA=!0,Tf(e),wf(e)}function Gt(e){if(typeof __SENTRY_TRACING__=="boolean"&&!__SENTRY_TRACING__)return!1;let t=e||q()?.getOptions();return!!t&&(t.tracesSampleRate!=null||!!t.tracesSampler)}function UA(e){A.log(`Ignoring span ${e.op} - ${e.description} because it matches \`ignoreSpans\`.`)}function Ki(e,t){if(!t?.length)return!1;for(let n of t){if(lB(n)){if(e.description&&qa(e.description,n))return W&&UA(e),!0;continue}let r=!!n.attributes&&Object.keys(n.attributes).length>0;if(!n.name&&!n.op&&!r)continue;let o=n.name?e.description&&qa(e.description,n.name):!0,i=n.op?e.op&&qa(e.op,n.op):!0,a=n.attributes?Object.entries(n.attributes).every(([s,l])=>sB(e.attributes?.[s],l)):!0;if(o&&i&&a)return W&&UA(e),!0}return!1}function sB(e,t){return typeof e=="string"&&(typeof t=="string"||t instanceof RegExp)?qa(e,t):Array.isArray(e)&&Array.isArray(t)?e.length===t.length&&e.every((n,r)=>n===t[r]):e===t}function PA(e,t){let n=t.parent_span_id,r=t.span_id;if(n)for(let o of e)o.parent_span_id===r&&(o.parent_span_id=n)}function lB(e){return typeof e=="string"||e instanceof RegExp}var BA=Symbol.for("sentry.nonRecordingSpan"),_r=class{constructor(t={}){this._traceId=t.traceId||zn(),this._spanId=t.spanId||Kn(),this.dropReason=t.dropReason,Ye(this,BA,!0)}spanContext(){return{spanId:this._spanId,traceId:this._traceId,traceFlags:lh}}end(t){}setAttribute(t,n){return this}setAttributes(t){return this}setStatus(t){return this}updateName(t){return this}isRecording(){return!1}addEvent(t,n,r){return this}addLink(t){return this}addLinks(t){return this}recordException(t,n){}};function hi(e){return!!e&&e[BA]===!0}var Ko="production";var zA="_frozenDsc";function kv(e,t){Ye(e,zA,t)}function fh(e,t){let n=t.getOptions(),{publicKey:r}=t.getDsn()||{},o={environment:n.environment||Ko,release:n.release,public_key:r,trace_id:e,org_id:ah(t)};return t.emit("createDsc",o),o}function Xi(e,t){let n=t.getPropagationContext();return n.dsc||fh(n.traceId,e)}function en(e){let t=q();if(!t)return{};let n=Fe(e),r=ie(n),o=r.data,i=n.spanContext().traceState,a=i?.get("sentry.sample_rate")??o[fi]??o[Yc];function s(g){return(typeof a=="number"||typeof a=="string")&&(g.sample_rate=`${a}`),g}let l=n[zA];if(l)return s(l);if(hi(n)&&!Gt(t.getOptions())){let g=mi(n).scope;if(g)return s({...Xi(t,g)})}let c=i?.get("sentry.dsc"),d=c&&Xc(c);if(d)return s(d);let u=fh(e.spanContext().traceId,t),m=o[Pe]??o["sentry.span.source"],p=r.description;return m!=="url"&&p&&(u.transaction=p),Gt()&&(u.sampled=String(Cn(n)),u.sample_rand=i?.get("sentry.sample_rand")??mi(n).scope?.getPropagationContext().sampleRand.toString()),s(u),t.emit("createDsc",u,n),u}function ph(e){let t=en(e);return oh(t)}function Av(e){return Ye(e,"_streamed",!0),e}function Ji(e){return!!e&&typeof e=="function"&&"_streamed"in e&&!!e._streamed}function $t(e,t=[]){return[e,t]}function Gf(e,t){let[n,r]=e;return[n,[...r,t]]}function vr(e,t){let n=e[1];for(let r of n){let o=r[0].type;if(t(r,o))return!0}return!1}function pl(e,t){return vr(e,(n,r)=>t.includes(r))}function mh(e){let t=Fa(ne);return t.encodePolyfill?t.encodePolyfill(e):new TextEncoder().encode(e)}function cB(e){let t=Fa(ne);return t.decodePolyfill?t.decodePolyfill(e):new TextDecoder().decode(e)}function Qi(e){let[t,n]=e,r=JSON.stringify(t);function o(i){typeof r=="string"?r=typeof i=="string"?r+i:[mh(r),i]:r.push(typeof i=="string"?mh(i):i)}for(let i of n){let[a,s]=i;if(o(`
14
- ${JSON.stringify(a)}
15
- `),typeof s=="string"||s instanceof Uint8Array)o(s);else{let l;try{l=JSON.stringify(s)}catch{l=JSON.stringify(ht(s))}o(l)}}return typeof r=="string"?r:uB(r)}function uB(e){let t=e.reduce((o,i)=>o+i.length,0),n=new Uint8Array(t),r=0;for(let o of e)n.set(o,r),r+=o.length;return n}function gh(e){let t=typeof e=="string"?mh(e):e;function n(a){let s=t.subarray(0,a);return t=t.subarray(a+1),s}function r(){let a=t.indexOf(10);return a<0&&(a=t.length),JSON.parse(cB(n(a)))}let o=r(),i=[];for(;t.length;){let a=r(),s=typeof a.length=="number"?a.length:void 0;i.push([a,s?n(s):r()])}return[o,i]}function hh(e){return[{type:"span"},e]}function bh(e){let t=typeof e.data=="string"?mh(e.data):e.data;return[{type:"attachment",length:t.length,filename:e.filename,content_type:e.contentType,attachment_type:e.attachmentType},t]}var FA={sessions:"session",event:"error",client_report:"internal",user_report:"default",profile_chunk:"profile",replay_event:"replay",replay_recording:"replay",check_in:"monitor",raw_security:"security",log:"log_item",trace_metric:"metric"};function dB(e){return e in FA}function $f(e){return dB(e)?FA[e]:e}function Xo(e){if(!e?.sdk)return;let{name:t,version:n}=e.sdk;return{name:t,version:n}}function eu(e,t,n,r){let o=e.sdkProcessingMetadata?.dynamicSamplingContext;return{event_id:e.event_id,sent_at:new Date(Yn()).toISOString(),...t&&{sdk:t},...!!n&&r&&{dsn:pn(r)},...o&&{trace:o}}}function fB(e,t){if(!t)return e;let n=e.sdk||{};return e.sdk={...n,name:n.name||t.name,version:n.version||t.version,integrations:[...e.sdk?.integrations||[],...t.integrations||[]],packages:[...e.sdk?.packages||[],...t.packages||[]],settings:e.sdk?.settings||t.settings?{...e.sdk?.settings,...t.settings}:void 0},e}function HA(e,t,n,r){let o=Xo(n),i={sent_at:new Date(Yn()).toISOString(),...o&&{sdk:o},...!!r&&t&&{dsn:pn(t)}},a="aggregates"in e?[{type:"sessions"},e]:[{type:"session"},e.toJSON()];return $t(i,[a])}function GA(e,t,n,r){let o=Xo(n),i=e.type&&e.type!=="replay_event"?e.type:"event";fB(e,n?.sdk);let a=eu(e,o,r,t);return delete e.sdkProcessingMetadata,$t(a,[[{type:i},e]])}function $A(e,t){function n(p){return!!p.trace_id&&!!p.public_key}let r=en(e[0]),o=t?.getDsn(),i=t?.getOptions().tunnel,a={sent_at:new Date(Yn()).toISOString(),...n(r)&&{trace:r},...!!i&&o&&{dsn:pn(o)}},{beforeSendSpan:s,ignoreSpans:l}=t?.getOptions()||{},c=l?.length?e.filter(p=>{let g=ie(p);return!Ki({description:g.description,op:g.op,attributes:g.data},l)}):e,d=e.length-c.length;d&&t?.recordDroppedEvent("before_send","span",d);let u=s?p=>{let g=ie(p),_=Ji(s)?g:s(g);return _||(fl(),g)}:ie,m=[];for(let p of c){let g=u(p);g&&m.push(hh(g))}return $t(a,m)}function jA(e){if(!W)return;let{description:t="< unknown name >",op:n="< unknown op >",parent_span_id:r}=ie(e),{spanId:o}=e.spanContext(),i=Cn(e),a=Fe(e),s=a===e,l=`[Tracing] Starting ${i?"sampled":"unsampled"} ${s?"root ":""}span`,c=[`op: ${n}`,`name: ${t}`,`ID: ${o}`];if(r&&c.push(`parent ID: ${r}`),!s){let{op:d,description:u}=ie(a);c.push(`root ID: ${a.spanContext().spanId}`),d&&c.push(`root op: ${d}`),u&&c.push(`root description: ${u}`)}A.log(`${l}
16
- ${c.join(`
17
- `)}`)}function qA(e){if(!W)return;let{description:t="< unknown name >",op:n="< unknown op >"}=ie(e),{spanId:r}=e.spanContext(),i=Fe(e)===e,a=`[Tracing] Finishing "${n}" ${i?"root ":""}span "${t}" with ID ${r}`;A.log(a)}function ml(e,t,n,r=Be()){let o=r&&Fe(r);o&&(W&&A.log(`[Measurement] Setting measurement on root span: ${e} = ${t} ${n}`),o.addEvent(e,{[Yo]:t,[Wo]:n}))}function jf(e){if(!e||e.length===0)return;let t={};return e.forEach(n=>{let r=n.attributes||{},o=r[Wo],i=r[Yo];typeof o=="string"&&typeof i=="number"&&(t[n.name]={value:i,unit:o})}),t}function tn(e){return e.getOptions().traceLifecycle==="stream"}var VA=1e3,Ka=class{constructor(t={}){this._traceId=t.traceId||zn(),this._spanId=t.spanId||Kn(),this._startTime=t.startTimestamp||Ue(),this._links=t.links,this._attributes={},this.setAttributes({[le]:"manual",[_e]:t.op,...t.attributes}),this._name=t.name,t.parentSpanId&&(this._parentSpanId=t.parentSpanId),"sampled"in t&&(this._sampled=t.sampled),t.endTimestamp&&(this._endTime=t.endTimestamp),this._events=[],this._isStandaloneSpan=t.isStandalone,this._endTime&&this._onSpanEnded()}addLink(t){return this._links?this._links.push(t):this._links=[t],this}addLinks(t){return this._links?this._links.push(...t):this._links=t,this}recordException(t,n){}spanContext(){let{_spanId:t,_traceId:n,_sampled:r}=this;return{spanId:t,traceId:n,traceFlags:r?Bf:lh}}setAttribute(t,n){return n===void 0?delete this._attributes[t]:this._attributes[t]=n,this}setAttributes(t){return Object.keys(t).forEach(n=>this.setAttribute(n,t[n])),this}updateStartTime(t){this._startTime=yr(t)}setStatus(t){return this._status=t,this}updateName(t){return this._name=t,EA(this)||this.setAttribute(Pe,"custom"),this}end(t){this._endTime||(this._endTime=yr(t),qA(this),this._onSpanEnded())}getSpanJSON(){return{data:this._attributes,description:this._name,op:this._attributes[_e],parent_span_id:this._parentSpanId,span_id:this._spanId,start_timestamp:this._startTime,status:Ff(this._status),timestamp:this._endTime,trace_id:this._traceId,origin:this._attributes[le],profile_id:this._attributes[cl],exclusive_time:this._attributes[Jn],measurements:jf(this._events),is_segment:this._isStandaloneSpan&&Fe(this)===this||void 0,segment_id:this._isStandaloneSpan?Fe(this).spanContext().spanId:void 0,links:zf(this._links)}}getStreamedSpanJSON(){return{name:this._name??"",span_id:this._spanId,trace_id:this._traceId,parent_span_id:this._parentSpanId,start_timestamp:this._startTime,end_timestamp:this._endTime??this._startTime,is_segment:this._isStandaloneSpan||this===Fe(this),status:uh(this._status),attributes:xv(this._attributes,this._status),links:wv(this._links)}}isRecording(){return!this._endTime&&!!this._sampled}addEvent(t,n,r){W&&A.log("[Tracing] Adding an event to span:",t);let o=WA(n)?n:r||Ue(),i=WA(n)?{}:n||{},a={name:t,time:yr(o),attributes:i};return this._events.push(a),this}isStandaloneSpan(){return!!this._isStandaloneSpan}_onSpanEnded(){let t=q();if(t&&(t.emit("spanEnd",this),this._isStandaloneSpan||t.emit("afterSpanEnd",this)),!(this._isStandaloneSpan||this===Fe(this)))return;if(this._isStandaloneSpan){this._sampled?mB($A([this],t)):(W&&A.log("[Tracing] Discarding standalone span because its trace was not chosen to be sampled."),t&&t.recordDroppedEvent("sample_rate","span"));return}else if(t&&tn(t)){t.emit("afterSegmentSpanEnd",this);return}let r=this._convertSpanToTransaction();r&&(mi(this).scope||ae()).captureEvent(r)}_convertSpanToTransaction(){if(!YA(ie(this)))return;this._name||(W&&A.warn("Transaction has no name, falling back to `<unlabeled transaction>`."),this._name="<unlabeled transaction>");let{scope:t,isolationScope:n}=mi(this),r=t?.getScopeData().sdkProcessingMetadata?.normalizedRequest;if(this._sampled!==!0)return;let i=gi(this).filter(u=>u!==this&&!pB(u)).map(u=>ie(u)).filter(YA),a=this._attributes[Pe];delete this._attributes[ll];let s=!1;i.forEach(u=>{delete u.data[ll],u.op?.startsWith("gen_ai.")&&(s=!0)});let l={contexts:{trace:NA(this)},spans:i.length>VA?i.sort((u,m)=>u.start_timestamp-m.start_timestamp).slice(0,VA):i,start_timestamp:this._startTime,timestamp:this._endTime,transaction:this._name,type:"transaction",sdkProcessingMetadata:{capturedSpanScope:t,capturedSpanIsolationScope:n,dynamicSamplingContext:en(this),hasGenAiSpans:s},request:r,...a&&{transaction_info:{source:a}}},c=jf(this._events);return c&&Object.keys(c).length&&(W&&A.log("[Measurements] Adding measurements to transaction event",JSON.stringify(c,void 0,2)),l.measurements=c),l}};function WA(e){return e&&typeof e=="number"||e instanceof Date||Array.isArray(e)}function YA(e){return!!e.start_timestamp&&!!e.timestamp&&!!e.span_id&&!!e.trace_id}function pB(e){return e instanceof Ka&&e.isStandaloneSpan()}function mB(e){let t=q();if(!t)return;let n=e[1];if(!n||n.length===0){t.recordDroppedEvent("before_send","span");return}t.sendEnvelope(e)}function qf(e,t,n=()=>{},r=()=>{}){let o;try{o=e()}catch(i){throw t(i),n(),i}return gB(o,t,n,r)}function gB(e,t,n,r){return Bn(e)?Fg(e,o=>{n(),r(o)},o=>{t(o),n()}):(n(),r(e),e)}function KA(e,t,n){if(!Gt(e))return[!1];let r,o;typeof e.tracesSampler=="function"?(o=e.tracesSampler({...t,inheritOrSampleWith:s=>typeof t.parentSampleRate=="number"?t.parentSampleRate:typeof t.parentSampled=="boolean"?Number(t.parentSampled):s}),r=!0):t.parentSampled!==void 0?o=t.parentSampled:typeof e.tracesSampleRate<"u"&&(o=e.tracesSampleRate,r=!0);let i=Br(o);if(i===void 0)return W&&A.warn(`[Tracing] Discarding root span because of invalid sample rate. Sample rate must be a boolean or a number between 0 and 1. Got ${JSON.stringify(o)} of type ${JSON.stringify(typeof o)}.`),[!1];if(!i)return W&&A.log(`[Tracing] Discarding transaction because ${typeof e.tracesSampler=="function"?"tracesSampler returned 0 or false":"a negative sampling decision was inherited or tracesSampleRate is set to 0"}`),[!1,i,r];let a=n<i;return a||W&&A.log(`[Tracing] Discarding transaction because it's not included in the random sample (sampling rate = ${Number(o)})`),[a,i,r]}var Vf="__SENTRY_SUPPRESS_TRACING__";function mn(e,t){let n=gl();if(n.startSpan)return n.startSpan(e,t);let r=Rv(e),{forceTransaction:o,parentSpan:i,scope:a}=e,s=a?.clone();return Ht(s,()=>JA(i)(()=>{let c=ae(),d=Cv(c,i),u=q(),p=e.onlyIfParent&&!d?Iv(c,u):Nv({parentSpan:d,spanArguments:r,forceTransaction:o,scope:c});return(!QA(p)||!d)&&ar(c,p),qf(()=>t(p),()=>{let{status:g}=ie(p);p.isRecording()&&(!g||g==="ok")&&p.setStatus({code:2,message:"internal_error"})},()=>{p.end()})}))}function Qn(e,t){let n=gl();if(n.startSpanManual)return n.startSpanManual(e,t);let r=Rv(e),{forceTransaction:o,parentSpan:i,scope:a}=e,s=a?.clone();return Ht(s,()=>JA(i)(()=>{let c=ae(),d=Cv(c,i),m=e.onlyIfParent&&!d?Iv(c,q()):Nv({parentSpan:d,spanArguments:r,forceTransaction:o,scope:c});return(!QA(m)||!d)&&ar(c,m),qf(()=>t(m,()=>m.end()),()=>{let{status:p}=ie(m);m.isRecording()&&(!p||p==="ok")&&m.setStatus({code:2,message:"internal_error"})})}))}function Dt(e){let t=gl();if(t.startInactiveSpan)return t.startInactiveSpan(e);let n=Rv(e),{forceTransaction:r,parentSpan:o}=e;return(e.scope?a=>Ht(e.scope,a):o!==void 0?a=>co(o,a):a=>a())(()=>{let a=ae(),s=Cv(a,o),l=q();return e.onlyIfParent&&!s?Iv(a,l):Nv({parentSpan:s,spanArguments:n,forceTransaction:r,scope:a})})}var yh=(e,t)=>{let n=or(),r=lo(n);if(r.continueTrace)return r.continueTrace(e,t);let{sentryTrace:o,baggage:i}=e,a=q(),s=Xc(i);return a&&!Ev(a,s?.org_id)?Yf(t):Ht(l=>{let c=Df(o,i);return l.setPropagationContext(c),ar(l,void 0),t()})};function co(e,t){let n=gl();return n.withActiveSpan?n.withActiveSpan(e,t):Ht(r=>(ar(r,e||void 0),t(r)))}function tu(e){let t=gl();return t.suppressTracing?t.suppressTracing(e):Ht(n=>{n.setSDKProcessingMetadata({[Vf]:!0});let r=e();return n.setSDKProcessingMetadata({[Vf]:void 0}),r})}function Wf(e=ae()){let t=gl();return t.isTracingSuppressed?t.isTracingSuppressed(e):e.getScopeData().sdkProcessingMetadata[Vf]===!0}function Yf(e){let t=gl();return t.startNewTrace?t.startNewTrace(e):Ht(n=>(n.setPropagationContext({traceId:zn(),sampleRand:gr()}),W&&A.log(`Starting a new trace with id ${n.getPropagationContext().traceId}`),co(null,e)))}function Iv(e,t){t?.recordDroppedEvent("no_parent_span","span");let n=new _r({traceId:e.getPropagationContext().traceId});return Wa(n,e,je()),n}function Nv({parentSpan:e,spanArguments:t,forceTransaction:n,scope:r}){let o=je();if(!Gt()){let s={...o.getPropagationContext(),...r.getPropagationContext()},l=e?e.spanContext().traceId:s.traceId,c=new _r({traceId:l});return e&&!n&&Zc(e,c),Wa(c,r,o),c}let i=q();if(bB(i,t)){Wf(r)||i?.recordDroppedEvent("ignored","span");let s=new _r({dropReason:"ignored",traceId:e?.spanContext().traceId??r.getPropagationContext().traceId});return Wa(s,r,o),s}let a;if(e&&!n)a=hB(e,r,t,o),Zc(e,a);else if(e){let s=en(e),{traceId:l,spanId:c}=e.spanContext(),d=Cn(e);a=XA({traceId:l,parentSpanId:c,...t},r,o,d),kv(a,s)}else{let{traceId:s,dsc:l,parentSpanId:c,sampled:d}={...o.getPropagationContext(),...r.getPropagationContext()};a=XA({traceId:s,parentSpanId:c,...t},r,o,d),l&&kv(a,l)}return jA(a),a}function Rv(e){let n={isStandalone:(e.experimental||{}).standalone,...e};if(e.startTime){let r={...n};return r.startTimestamp=yr(e.startTime),delete r.startTime,r}return n}function gl(){let e=or();return lo(e)}function XA(e,t,n,r){let o=q(),i=o?.getOptions()||{},{name:a=""}=e,s={spanAttributes:{...e.attributes},spanName:a,parentSampled:r};o?.emit("beforeSampling",s,{decision:!1});let l=s.parentSampled??r,c=s.spanAttributes,d=t.getPropagationContext(),u=Wf(t),[m,p,g]=u?[!1]:KA(i,{name:a,parentSampled:l,attributes:c,normalizedRequest:n.getScopeData().sdkProcessingMetadata.normalizedRequest,parentSampleRate:Br(d.dsc?.sample_rate)},d.sampleRand),_=new Ka({...e,attributes:{[Pe]:"custom",[fi]:p!==void 0&&g?p:void 0,...c},sampled:m});return!m&&o&&!u&&(W&&A.log("[Tracing] Discarding root span because its trace was not chosen to be sampled."),o.recordDroppedEvent("sample_rate",tn(o)?"span":"transaction")),Wa(_,t,n),o&&o.emit("spanStart",_),_}function hB(e,t,n,r){let{spanId:o,traceId:i}=e.spanContext(),a=Wf(t),s=a?!1:Cn(e),l=s?new Ka({...n,parentSpanId:o,traceId:i,sampled:s}):new _r({traceId:i});Zc(e,l),Wa(l,t,r);let c=q();return c&&(tn(c)&&hi(l)&&(hi(e)&&e.dropReason?(l.dropReason=e.dropReason,c.recordDroppedEvent(e.dropReason,"span")):a||(l.dropReason="sample_rate",c.recordDroppedEvent("sample_rate","span"))),c.emit("spanStart",l),n.endTimestamp&&(c.emit("spanEnd",l),c.emit("afterSpanEnd",l))),l}function Cv(e,t){if(t)return t;if(t===null)return;let n=Vo(e);if(!n)return;let r=q();return(r?r.getOptions():{}).parentSpanIsAlwaysRootSpan?Fe(n):n}function JA(e){return e!==void 0?t=>co(e,t):t=>t()}function bB(e,t){let n=e?.getOptions().ignoreSpans;return!e||!tn(e)||!n?.length?!1:Ki({description:t.name||"",op:t.attributes?.[_e]||t.op,attributes:t.attributes},n)}function QA(e){return hi(e)&&e.dropReason==="ignored"}var nu={idleTimeout:1e3,finalTimeout:3e4,childSpanTimeout:15e3},yB="heartbeatFailed",_B="idleTimeout",vB="finalTimeout",SB="externalFinish";function _h(e,t={}){let n=new Map,r=!1,o,i=SB,a=!t.disableAutoFinish,s=[],{idleTimeout:l=nu.idleTimeout,finalTimeout:c=nu.finalTimeout,childSpanTimeout:d=nu.childSpanTimeout,beforeSpanEnd:u,trimIdleSpanEndTimestamp:m=!0}=t,p=q(),g=ae();if(!p||!Gt()){let k=new _r({traceId:g.getPropagationContext().traceId});return Wa(k,g,je()),k}let _=Be(),y=EB(e);y.end=new Proxy(y.end,{apply(k,P,F){if(u&&u(y),hi(P))return;let[U,...X]=F,G=U||Ue(),R=yr(G),C=gi(y).filter(te=>te!==y),$=ie(y);if(!C.length||!m)return M(R),Reflect.apply(k,P,[R,...X]);let ee=p.getOptions().ignoreSpans,B=C?.reduce((te,ve)=>{let pe=ie(ve);return!pe.timestamp||ee&&Ki({description:pe.description,op:pe.op,attributes:pe.data},ee)?te:te?Math.max(te,pe.timestamp):pe.timestamp},void 0),H=$.start_timestamp,se=Math.min(H?H+c/1e3:1/0,Math.max(H||-1/0,Math.min(R,B||1/0)));return M(se),Reflect.apply(k,P,[se,...X])}});function h(){o&&(clearTimeout(o),o=void 0)}function v(k){h(),o=setTimeout(()=>{!r&&n.size===0&&a&&(i=_B,y.end(k))},l)}function T(k){o=setTimeout(()=>{!r&&a&&(i=yB,y.end(k))},d)}function x(k){h(),n.set(k,!0);let P=Ue();T(P+d/1e3)}function N(k){if(n.has(k)&&n.delete(k),n.size===0){let P=Ue();v(P+l/1e3)}}function M(k){r=!0,n.clear(),s.forEach(C=>C()),ar(g,_);let P=ie(y),{start_timestamp:F}=P;if(!F)return;P.data[Yi]||y.setAttribute(Yi,i);let X=P.status;(!X||X==="unknown")&&y.setStatus({code:1}),A.log(`[Tracing] Idle span "${P.op}" finished`);let G=gi(y).filter(C=>C!==y),R=0;G.forEach(C=>{C.isRecording()&&(C.setStatus({code:2,message:"cancelled"}),C.end(k),W&&A.log("[Tracing] Cancelling span since span ended early",JSON.stringify(C,void 0,2)));let $=ie(C),{timestamp:ee=0,start_timestamp:B=0}=$,H=B<=k,se=(c+l)/1e3,te=ee-B<=se;if(W){let ve=JSON.stringify(C,void 0,2);H?te||A.log("[Tracing] Discarding span since it finished after idle span final timeout",ve):A.log("[Tracing] Discarding span since it happened after idle span was finished",ve)}(!te||!H)&&(DA(y,C),R++)}),R>0&&y.setAttribute("sentry.idle_span_discarded_spans",R)}return s.push(p.on("spanStart",k=>{if(r||k===y||ie(k).timestamp||k instanceof Ka&&k.isStandaloneSpan())return;gi(y).includes(k)&&x(k.spanContext().spanId)})),s.push(p.on("spanEnd",k=>{r||N(k.spanContext().spanId)})),s.push(p.on("idleSpanEnableAutoFinish",k=>{k===y&&(a=!0,v(),n.size&&T())})),t.disableAutoFinish||v(),setTimeout(()=>{r||(y.setStatus({code:2,message:"deadline_exceeded"}),i=vB,y.end())},c),y}function EB(e){let t=Dt(e);return ar(ae(),t),W&&A.log("[Tracing] Started span is an idle span"),t}var TB=["addListener","on","once","prependListener","prependOnceListener","addEventListener"],wB=["removeListener","off","removeEventListener"],ZA=Symbol("SentryScopeBoundListeners"),ru;function xB(e){return ru!==void 0&&(e===ru||e.listener===ru)}function Mv(e,t=ae()){let n=e;if(vh(n))return e;Ov(n);for(let r of TB)typeof n[r]=="function"&&(n[r]=AB(n,n[r],t));for(let r of wB)typeof n[r]=="function"&&(n[r]=IB(n,n[r]));return typeof n.removeAllListeners=="function"&&(n.removeAllListeners=NB(n,n.removeAllListeners)),e}function kB(e,t){return function(...n){return Ht(t,()=>e.apply(this,n))}}function eI(e){return typeof e=="function"}function AB(e,t,n){return function(...r){let o=r[0],i=r[1],a=r.slice(2);if(!eI(i)||xB(i))return t.apply(this,r);let s=vh(e)||Ov(e),l=s.get(o);l||(l=new WeakMap,s.set(o,l));let c=l.get(i);c||(c=kB(i,n),l.set(i,c));let d=ru;ru=c;try{return t.call(this,o,c,...a)}finally{ru=d}}}function IB(e,t){return function(...n){let r=n[0],o=n[1],i=n.slice(2),a=eI(o)?vh(e)?.get(r)?.get(o):void 0;return a?t.call(this,r,a,...i):t.apply(this,n)}}function NB(e,t){return function(...n){let r=vh(e);if(r)if(n.length===0)Ov(e);else{let o=n[0];r.delete(o)}return t.apply(this,n)}}function Ov(e){let t=new Map;return e[ZA]=t,t}function vh(e){return e[ZA]}function nI(e,t){let{fingerprint:n,span:r,breadcrumbs:o,sdkProcessingMetadata:i}=t;RB(e,t),r&&OB(e,r),DB(e,n),CB(e,o),MB(e,i)}function tI(e,t){let{extra:n,tags:r,attributes:o,user:i,contexts:a,level:s,sdkProcessingMetadata:l,breadcrumbs:c,fingerprint:d,eventProcessors:u,attachments:m,propagationContext:p,transactionName:g,span:_}=t;Kf(e,"extra",n),Kf(e,"tags",r),Kf(e,"attributes",o),Kf(e,"user",i),Kf(e,"contexts",a),e.sdkProcessingMetadata=Va(e.sdkProcessingMetadata,l,2),s&&(e.level=s),g&&(e.transactionName=g),_&&(e.span=_),c.length&&(e.breadcrumbs=[...e.breadcrumbs,...c]),d.length&&(e.fingerprint=[...e.fingerprint,...d]),u.length&&(e.eventProcessors=[...e.eventProcessors,...u]),m.length&&(e.attachments=[...e.attachments,...m]),e.propagationContext={...e.propagationContext,...p}}function Kf(e,t,n){e[t]=Va(e[t],n,1)}function bi(e,t){let n=br().getScopeData();return e&&tI(n,e.getScopeData()),t&&tI(n,t.getScopeData()),n}function RB(e,t){let{extra:n,tags:r,user:o,contexts:i,level:a,transactionName:s}=t;Object.keys(n).length&&(e.extra={...n,...e.extra}),Object.keys(r).length&&(e.tags={...r,...e.tags}),Object.keys(o).length&&(e.user={...o,...e.user}),Object.keys(i).length&&(e.contexts={...i,...e.contexts}),a&&(e.level=a),s&&e.type!=="transaction"&&(e.transaction=s)}function CB(e,t){let n=[...e.breadcrumbs||[],...t];e.breadcrumbs=n.length?n:void 0}function MB(e,t){e.sdkProcessingMetadata={...e.sdkProcessingMetadata,...t}}function OB(e,t){e.contexts={trace:Jc(t),...e.contexts},e.sdkProcessingMetadata={dynamicSamplingContext:en(t),...e.sdkProcessingMetadata};let n=Fe(t),r=ie(n).description;r&&!e.transaction&&e.type==="transaction"&&(e.transaction=r)}function DB(e,t){e.fingerprint=e.fingerprint?Array.isArray(e.fingerprint)?e.fingerprint:[e.fingerprint]:[],t&&(e.fingerprint=e.fingerprint.concat(t)),e.fingerprint.length||delete e.fingerprint}function rI(e){let t={},{response:n,profile:r,cloud_resource:o,culture:i,state:a}=e;if(n&&(n.status_code!=null&&(t["http.response.status_code"]=n.status_code),n.body_size!=null&&(t["http.response.body.size"]=n.body_size)),r&&(r.profile_id&&(t["sentry.profile_id"]=r.profile_id),r.profiler_id&&(t["sentry.profiler_id"]=r.profiler_id)),o)for(let[c,d]of Object.entries(o))d!=null&&(t[c]=d);i&&(i.locale&&(t["culture.locale"]=i.locale),i.timezone&&(t["culture.timezone"]=i.timezone)),a?.state&&typeof a.state.type=="string"&&(t["state.type"]=a.state.type);let s=e.angular;if(s){let c=s.version;(typeof c=="string"||typeof c=="number")&&(t["angular.version"]=c)}let l=e.react;if(l){let c=l.version;(typeof c=="string"||typeof c=="number")&&(t["react.version"]=c)}return t}function Sh(e,t){let n=Ya(e),r=dl(e),o=Ya(r),{isolationScope:i,scope:a}=mi(e),s=bi(i,a);PB(n,o,t,s);let l=e.kind;t.emit("preprocessSpan",n,{spanKind:l}),n.is_segment&&(LB(n,s),UB(n,t),t.emit("processSegmentSpan",n)),t.emit("processSpan",n);let{beforeSendSpan:c}=t.getOptions(),d=c&&Ji(c)?BB(n,c):n,u=d.attributes?.[Pe];return u&&zr(d,{"sentry.span.source":u}),{...ch(d),_segmentSpan:r}}function LB(e,t){let n=rI(t.contexts);zr(e,n)}function zr(e,t){let n=e.attributes??(e.attributes={});Object.entries(t).forEach(([r,o])=>{o!=null&&!(r in n)&&(n[r]=o)})}function UB(e,t){let n=t.getIntegrationNames();n.length&&zr(e,{[Kg]:n})}function PB(e,t,n,r){let o=n.getSdkMetadata(),{release:i,environment:a}=n.getOptions();zr(e,{[$g]:i,[jg]:a||Ko,[qg]:t.name,[Vg]:t.span_id,[Wg]:o?.sdk?.name,[Yg]:o?.sdk?.version,[Xg]:r.user?.id,[Jg]:r.user?.email,[Qg]:r.user?.ip_address,[Zg]:r.user?.username,...r.attributes})}function BB(e,t){let n=t(e);return n||(fl(),e)}var Dv=0,oI=1,iI=2;function yi(e){return new Xf(t=>{t(e)})}function hl(e){return new Xf((t,n)=>{n(e)})}var Xf=class e{constructor(t){this._state=Dv,this._handlers=[],this._runExecutor(t)}then(t,n){return new e((r,o)=>{this._handlers.push([!1,i=>{if(!t)r(i);else try{r(t(i))}catch(a){o(a)}},i=>{if(!n)o(i);else try{r(n(i))}catch(a){o(a)}}]),this._executeHandlers()})}catch(t){return this.then(n=>n,t)}finally(t){return new e((n,r)=>{let o,i;return this.then(a=>{i=!1,o=a,t&&t()},a=>{i=!0,o=a,t&&t()}).then(()=>{if(i){r(o);return}n(o)})})}_executeHandlers(){if(this._state===Dv)return;let t=this._handlers.slice();this._handlers=[],t.forEach(n=>{n[0]||(this._state===oI&&n[1](this._value),this._state===iI&&n[2](this._value),n[0]=!0)})}_runExecutor(t){let n=(i,a)=>{if(this._state===Dv){if(Bn(a)){a.then(r,o);return}this._state=i,this._value=a,this._executeHandlers()}},r=i=>{n(oI,i)},o=i=>{n(iI,i)};try{t(r,o)}catch(i){o(i)}}};function aI(e,t,n,r=0){try{let o=Lv(t,n,e,r);return Bn(o)?o:yi(o)}catch(o){return hl(o)}}function Lv(e,t,n,r){let o=n[r];if(!e||!o)return e;let i=o({...e},t);return W&&i===null&&A.log(`Event processor "${o.id||"?"}" dropped event`),Bn(i)?i.then(a=>Lv(a,t,n,r+1)):Lv(i,t,n,r+1)}var bl,sI,lI,Xa;function Eh(e){let t=ne._sentryDebugIds,n=ne._debugIds;if(!t&&!n)return{};let r=t?Object.keys(t):[],o=n?Object.keys(n):[];if(Xa&&r.length===sI&&o.length===lI)return Xa;sI=r.length,lI=o.length,Xa={},bl||(bl={});let i=(a,s)=>{for(let l of a){let c=s[l],d=bl?.[l];if(d&&Xa&&c)Xa[d[0]]=c,bl&&(bl[l]=[d[0],c]);else if(c){let u=e(l);for(let m=u.length-1;m>=0;m--){let g=u[m]?.filename;if(g&&Xa&&bl){Xa[g]=c,bl[l]=[g,c];break}}}}};return t&&i(r,t),n&&i(o,n),Xa}function Uv(e,t){let n=Eh(e);if(!n)return[];let r=[];for(let o of t){let i=Zk(o);i&&n[i]&&r.push({type:"sourcemap",code_file:o,debug_id:n[i]})}return r}function Jf(e,t,n,r,o,i){let{normalizeDepth:a=3,normalizeMaxBreadth:s=1e3}=e,l={...t,event_id:t.event_id||n.event_id||ft(),timestamp:t.timestamp||hr()},c=n.integrations||e.integrations.map(h=>h.name);zB(l,e),GB(l,c),o&&o.emit("applyFrameMetadata",t),t.type===void 0&&FB(l,e.stackParser);let d=jB(r,n.captureContext);n.mechanism&&Rn(l,n.mechanism);let u=o?o.getEventProcessors():[],m=bi(i,d),p=[...n.attachments||[],...m.attachments];p.length&&(n.attachments=p),nI(l,m);let g=[...u,...m.eventProcessors];return(n.data&&n.data.__sentry__===!0?yi(l):aI(g,l,n)).then(h=>(h&&HB(h),typeof a=="number"&&a>0?$B(h,a,s):h))}function zB(e,t){let{environment:n,release:r,dist:o,maxValueLength:i}=t;e.environment=e.environment||n||Ko,!e.release&&r&&(e.release=r),!e.dist&&o&&(e.dist=o);let a=e.request;a?.url&&i&&(a.url=jo(a.url,i)),i&&e.exception?.values?.forEach(s=>{s.value&&(s.value=jo(s.value,i))})}function FB(e,t){let n=Eh(t);e.exception?.values?.forEach(r=>{r.stacktrace?.frames?.forEach(o=>{o.filename&&(o.debug_id=n[o.filename])})})}function HB(e){let t={};if(e.exception?.values?.forEach(r=>{r.stacktrace?.frames?.forEach(o=>{o.debug_id&&(o.abs_path?t[o.abs_path]=o.debug_id:o.filename&&(t[o.filename]=o.debug_id),delete o.debug_id)})}),Object.keys(t).length===0)return;e.debug_meta=e.debug_meta||{},e.debug_meta.images=e.debug_meta.images||[];let n=e.debug_meta.images;Object.entries(t).forEach(([r,o])=>{n.push({type:"sourcemap",code_file:r,debug_id:o})})}function GB(e,t){t.length>0&&(e.sdk=e.sdk||{},e.sdk.integrations=[...e.sdk.integrations||[],...t])}function $B(e,t,n){if(!e)return null;let r={...e,...e.breadcrumbs&&{breadcrumbs:e.breadcrumbs.map(o=>({...o,...o.data&&{data:ht(o.data,t,n)}}))},...e.user&&{user:ht(e.user,t,n)},...e.contexts&&{contexts:ht(e.contexts,t,n)},...e.extra&&{extra:ht(e.extra,t,n)}};return e.contexts?.trace&&r.contexts&&(r.contexts.trace=e.contexts.trace,e.contexts.trace.data&&(r.contexts.trace.data=ht(e.contexts.trace.data,t,n))),e.spans&&(r.spans=e.spans.map(o=>({...o,...o.data&&{data:ht(o.data,t,n)}}))),e.contexts?.flags&&r.contexts&&(r.contexts.flags=ht(e.contexts.flags,3,n)),r}function jB(e,t){if(!t)return e;let n=e?e.clone():new Xn;return n.update(t),n}function cI(e){if(e)return qB(e)?{captureContext:e}:WB(e)?{captureContext:e}:e}function qB(e){return e instanceof Xn||typeof e=="function"}var VB=["user","level","extra","contexts","tags","fingerprint","propagationContext"];function WB(e){return Object.keys(e).some(t=>VB.includes(t))}function xe(e,t){return ae().captureException(e,cI(t))}function Ja(e,t){let n=typeof t=="string"?t:void 0,r=typeof t!="string"?{captureContext:t}:void 0;return ae().captureMessage(e,n,r)}function uo(e,t){return ae().captureEvent(e,t)}function Qa(e,t){je().setContext(e,t)}function Th(e){je().setExtras(e)}function wh(e,t){je().setExtra(e,t)}function xh(e){je().setTags(e)}function ou(e,t){je().setTag(e,t)}function kh(e){je().setAttributes(e)}function Ah(e,t){je().setAttribute(e,t)}function Ih(e){je().setUser(e)}function Nh(e){je().setConversationId(e)}function iu(){return je().lastEventId()}async function Rh(e){let t=q();return t?t.flush(e):(W&&A.warn("Cannot flush events. No client defined."),Promise.resolve(!1))}async function Ch(e){let t=q();return t?t.close(e):(W&&A.warn("Cannot flush events and disable SDK. No client defined."),Promise.resolve(!1))}function Mh(){return!!q()}function au(){let e=q();return e?.getOptions().enabled!==!1&&!!e?.getTransport()}function su(e){je().addEventProcessor(e)}function yl(e){let t=je(),{user:n}=bi(t,ae()),{userAgent:r}=ne.navigator||{},o=uA({user:n,...r&&{userAgent:r},...e}),i=t.getSession();return i?.status==="ok"&&Vi(i,{status:"exited"}),lu(),t.setSession(o),o}function lu(){let e=je(),n=ae().getSession()||e.getSession();n&&dA(n),uI(),e.setSession()}function uI(){let e=je(),t=q(),n=e.getSession();n&&t&&t.captureSession(n)}function Za(e=!1){if(e){lu();return}uI()}function es(e){return typeof e=="object"&&typeof e.unref=="function"&&e.unref(),e}var dI="7";function fI(e){let t=e.protocol?`${e.protocol}:`:"",n=e.port?`:${e.port}`:"";return`${t}//${e.host}${n}${e.path?`/${e.path}`:""}/api/`}function YB(e){return`${fI(e)}${e.projectId}/envelope/`}function KB(e,t){let n={sentry_version:dI};return e.publicKey&&(n.sentry_key=e.publicKey),t&&(n.sentry_client=`${t.name}/${t.version}`),new URLSearchParams(n).toString()}function Qf(e,t,n){return t||`${YB(e)}?${KB(e,n)}`}function Pv(e,t){let n=Of(e);if(!n)return"";let r=`${fI(n)}embed/error-page/`,o=`dsn=${pn(n)}`;for(let i in t)if(i!=="dsn"&&i!=="onClose")if(i==="user"){let a=t.user;if(!a)continue;a.name&&(o+=`&name=${encodeURIComponent(a.name)}`),a.email&&(o+=`&email=${encodeURIComponent(a.email)}`)}else o+=`&${encodeURIComponent(i)}=${encodeURIComponent(t[i])}`;return`${r}?${o}`}var Oh=[];function XB(e){let t={};return e.forEach(n=>{let{name:r}=n,o=t[r];o&&!o.isDefaultInstance&&n.isDefaultInstance||(t[r]=n)}),Object.values(t)}function Dh(e){let t=e.defaultIntegrations||[],n=e.integrations;t.forEach(o=>{o.isDefaultInstance=!0});let r;if(Array.isArray(n))r=[...t,...n];else if(typeof n=="function"){let o=n(t);r=Array.isArray(o)?o:[o]}else r=t;return XB(r)}function pI(e,t){let n={};return t.forEach(r=>{r?.beforeSetup&&r.beforeSetup(e)}),t.forEach(r=>{r&&zv(e,r,n)}),n}function Bv(e,t){for(let n of t)n?.afterAllSetup&&n.afterAllSetup(e)}function zv(e,t,n){if(n[t.name]){W&&A.log(`Integration skipped because it was already installed: ${t.name}`);return}if(n[t.name]=t,!Oh.includes(t.name)&&typeof t.setupOnce=="function"&&(t.setupOnce(),Oh.push(t.name)),t.setup&&typeof t.setup=="function"&&t.setup(e),typeof t.preprocessEvent=="function"){let r=t.preprocessEvent.bind(t);e.on("preprocessEvent",(o,i)=>r(o,i,e))}if(typeof t.processEvent=="function"){let r=t.processEvent.bind(t),o=Object.assign((i,a)=>r(i,a,e),{id:t.name});e.addEventProcessor(o)}["processSpan","processSegmentSpan"].forEach(r=>{let o=t[r];typeof o=="function"&&e.on(r,i=>o.call(t,i,e))}),W&&A.log(`Integration installed: ${t.name}`)}function _l(e){let t=q();if(!t){W&&A.warn(`Cannot add integration "${e.name}" because no SDK Client is available.`);return}t.addIntegration(e)}var JB="sentry.timestamp.sequence",Fv=0,Hv;function Lh(e){let t=Math.floor(e*1e3);Hv!==void 0&&t!==Hv&&(Fv=0);let n=Fv;return Fv++,Hv=t,{key:JB,value:{value:n,type:"integer"}}}function Uh(e,t){return t?Ht(t,()=>{let n=Be(),r=n?Jc(n):Wc(t);return[n?en(n):Xi(e,t),r]}):[void 0,void 0]}var mI={trace:1,debug:5,info:9,warn:13,error:17,fatal:21};function Gv(){return typeof __SENTRY_BROWSER_BUNDLE__<"u"&&!!__SENTRY_BROWSER_BUNDLE__}function $v(){return"npm"}function gI(){return!Gv()&&Object.prototype.toString.call(typeof process<"u"?process:0)==="[object process]"}function Zn(){return typeof window<"u"&&(!gI()||QB())}function QB(){return ne.process?.type==="renderer"}function ZB(e,t){let n=t?"auto":"never";return[{type:"log",item_count:e.length,content_type:"application/vnd.sentry.items.log+json"},{version:2,...Zn()&&{ingest_settings:{infer_ip:n,infer_user_agent:n}},items:e}]}function hI(e,t,n,r,o){let i={};return t?.sdk&&(i.sdk={name:t.sdk.name,version:t.sdk.version}),n&&r&&(i.dsn=pn(r)),$t(i,[ZB(e,o)])}var e8=100;function _i(e,t,n,r=!0){n&&(!e[t]||r)&&(e[t]=n)}function bI(e,t){let n=qv(),r=yI(e);r===void 0?n.set(e,[t]):r.length>=e8?(vl(e,r),n.set(e,[t])):n.set(e,[...r,t])}function ts(e,t=ae(),n=bI){let r=t?.getClient()??q();if(!r){W&&A.warn("No client available to capture log.");return}let{release:o,environment:i,enableLogs:a=!1,beforeSendLog:s}=r.getOptions();if(!a){W&&A.warn("logging option not enabled, log will not be captured.");return}let[,l]=Uh(r,t),c={...e.attributes},{user:{id:d,email:u,username:m},attributes:p={}}=bi(je(),t);_i(c,"user.id",d,!1),_i(c,"user.email",u,!1),_i(c,"user.name",m,!1),_i(c,"sentry.release",o),_i(c,"sentry.environment",i);let{name:g,version:_}=r.getSdkMetadata()?.sdk??{};_i(c,"sentry.sdk.name",g),_i(c,"sentry.sdk.version",_);let y=r.getIntegrationByName("Replay"),h=y?.getReplayId(!0);_i(c,"sentry.replay_id",h),h&&y?.getRecordingMode()==="buffer"&&_i(c,"sentry._internal.replay_is_buffering",!0);let v=e.message;if(di(v)){let{__sentry_template_string__:R,__sentry_template_values__:C=[]}=v;C?.length&&(c["sentry.message.template"]=R),C.forEach(($,ee)=>{c[`sentry.message.parameter.${ee}`]=$})}let T=Vo(t);_i(c,"sentry.trace.parent_span_id",T?.spanContext().spanId);let x={...e,attributes:c};r.emit("beforeCaptureLog",x);let N=s?Sn(()=>s(x)):x;if(!N){r.recordDroppedEvent("before_send","log_item",1),W&&A.warn("beforeSendLog returned null, log will not be captured.");return}let{level:M,message:k,attributes:P={},severityNumber:F}=N,U=Ue(),X=Lh(U),G={timestamp:U,level:M,body:jv(String(k)),trace_id:l?.trace_id,severity_number:F??mI[M],attributes:t8({...Wi(p),...Wi(P,!0),[X.key]:X.value})};n(r,G),r.emit("afterCaptureLog",N)}function vl(e,t){let n=t??yI(e)??[];if(n.length===0)return;let r=e.getOptions(),o=hI(n,r._metadata,r.tunnel,e.getDsn(),e.getDataCollectionOptions().userInfo);qv().set(e,[]),e.emit("flushLogs"),e.sendEnvelope(o)}function yI(e){return qv().get(e)}function qv(){return Go("clientToLogBufferMap",()=>new WeakMap)}function t8(e){let t={};for(let[n,r]of Object.entries(e)){let o=jv(n);r.type==="string"?t[o]={...r,value:jv(r.value)}:t[o]=r}return t}function jv(e){let t=Object(e),n=t.isWellFormed,r=t.toWellFormed;return typeof n=="function"&&typeof r=="function"?n.call(e)?e:r.call(e):e}function n8(e,t){let n=t?"auto":"never";return[{type:"trace_metric",item_count:e.length,content_type:"application/vnd.sentry.items.trace-metric+json"},{version:2,...Zn()&&{ingest_settings:{infer_ip:n,infer_user_agent:n}},items:e}]}function _I(e,t,n,r,o){let i={};return t?.sdk&&(i.sdk={name:t.sdk.name,version:t.sdk.version}),n&&r&&(i.dsn=pn(r)),$t(i,[n8(e,o)])}var r8=1e3;function Zi(e,t,n,r=!0){n&&(r||!(t in e))&&(e[t]=n)}function vI(e,t){let n=Wv(),r=SI(e);r===void 0?n.set(e,[t]):r.length>=r8?(cu(e,r),n.set(e,[t])):n.set(e,[...r,t])}function o8(e,t,n){let{release:r,environment:o}=t.getOptions(),i={...e.attributes};Zi(i,"user.id",n.id,!1),Zi(i,"user.email",n.email,!1),Zi(i,"user.name",n.username,!1),Zi(i,"sentry.release",r),Zi(i,"sentry.environment",o);let{name:a,version:s}=t.getSdkMetadata()?.sdk??{};Zi(i,"sentry.sdk.name",a),Zi(i,"sentry.sdk.version",s);let l=t.getIntegrationByName("Replay"),c=l?.getReplayId(!0);return Zi(i,"sentry.replay_id",c),c&&l?.getRecordingMode()==="buffer"&&Zi(i,"sentry._internal.replay_is_buffering",!0),{...e,attributes:i}}function i8(e,t,n,r){let[,o]=Uh(t,n),i=Vo(n),a=i?i.spanContext().traceId:o?.trace_id,s=i?i.spanContext().spanId:void 0,l=Ue(),c=Lh(l);return{timestamp:l,trace_id:a??"",span_id:s,name:e.name,type:e.type,unit:e.unit,value:e.value,attributes:{...Wi(r),...Wi(e.attributes,"skip-undefined"),[c.key]:c.value}}}function Vv(e,t){let n=t?.scope??ae(),r=t?.captureSerializedMetric??vI,o=n?.getClient()??q();if(!o){W&&A.warn("No client available to capture metric.");return}let{_experiments:i,enableMetrics:a,beforeSendMetric:s}=o.getOptions();if(!(a??i?.enableMetrics??!0)){W&&A.warn("metrics option not enabled, metric will not be captured.");return}let{user:c,attributes:d}=bi(je(),n),u=o8(e,o,c);o.emit("processMetric",u);let m=s||i?.beforeSendMetric,p=m?m(u):u;if(!p){W&&A.log("`beforeSendMetric` returned `null`, will not send metric.");return}let g=i8(p,o,n,d);W&&A.log("[Metric]",g),r(o,g),o.emit("afterCaptureMetric",p)}function cu(e,t){let n=t??SI(e)??[];if(n.length===0)return;let r=e.getOptions(),o=_I(n,r._metadata,r.tunnel,e.getDsn(),e.getDataCollectionOptions().userInfo);Wv().set(e,[]),e.emit("flushMetrics"),e.sendEnvelope(o)}function SI(e){return Wv().get(e)}function Wv(){return Go("clientToMetricBufferMap",()=>new WeakMap)}function EI(e){let t={trace_id:e.trace_id,span_id:e.span_id,parent_span_id:e.parent_span_id,name:e.description||"",start_timestamp:e.start_timestamp,end_timestamp:e.timestamp||e.start_timestamp,status:!e.status||e.status==="ok"||e.status==="cancelled"?"ok":"error",is_segment:!1,attributes:{...e.data},links:e.links};return ch(t)}function TI(e,t){if(e.type!=="transaction"||!e.spans?.length||!e.sdkProcessingMetadata?.hasGenAiSpans||t.getOptions().streamGenAiSpans===!1||tn(t))return;let n=[],r=[];for(let i of e.spans)i.op?.startsWith("gen_ai.")?n.push(EI(i)):r.push(i);if(n.length===0)return;e.spans=r;let o=t.getDataCollectionOptions().userInfo?"auto":"never";return[{type:"span",item_count:n.length,content_type:"application/vnd.sentry.items.span.v2+json"},{version:2,...Zn()&&{ingest_settings:{infer_ip:o,infer_user_agent:o}},items:n}]}var uu=Symbol.for("SentryBufferFullError");function Sl(e=100){let t=new Set;function n(){return t.size<e}function r(a){t.delete(a)}function o(a){if(!n())return hl(uu);let s=a();return t.add(s),s.then(()=>r(s),()=>r(s)),s}function i(a){if(!t.size)return yi(!0);let s=Promise.allSettled(Array.from(t)).then(()=>!0);if(!a)return s;let l=[s,new Promise(c=>es(setTimeout(()=>c(!1),a)))];return Promise.race(l)}return{get $(){return Array.from(t)},add:o,drain:i}}var wI=60*1e3;function Ph(e,t=Yn()){let n=parseInt(`${e}`,10);if(!isNaN(n))return n*1e3;let r=Date.parse(`${e}`);return isNaN(r)?wI:r-t}function xI(e,t){return e[t]||e.all||0}function Zf(e,t,n=Yn()){return xI(e,t)>n}function ep(e,{statusCode:t,headers:n},r=Yn()){let o={...e},i=n?.["x-sentry-rate-limits"],a=n?.["retry-after"];if(i)for(let s of i.trim().split(",")){let[l,c,,,d]=s.split(":",5),u=parseInt(l,10),m=(isNaN(u)?60:u)*1e3;if(!c)o.all=r+m;else for(let p of c.split(";"))p==="metric_bucket"?(!d||d.split(";").includes("custom"))&&(o[p]=r+m):o[p]=r+m}else a?o.all=r+Ph(a,r):t===429&&(o.all=r+60*1e3);return o}var Yv=64;function tp(e,t,n=Sl(e.bufferSize||Yv)){let r={},o=a=>n.drain(a);function i(a){let s=[];if(vr(a,(u,m)=>{let p=$f(m);Zf(r,p)?e.recordDroppedEvent("ratelimit_backoff",p):s.push(u)}),s.length===0)return Promise.resolve({});let l=$t(a[0],s),c=u=>{if(pl(l,["client_report"])){W&&A.warn(`Dropping client report. Will not send outcomes (reason: ${u}).`);return}vr(l,(m,p)=>{e.recordDroppedEvent(u,$f(p))})},d=()=>t({body:Qi(l)}).then(u=>u.statusCode===413?(W&&A.error("Sentry responded with status code 413. Envelope was discarded due to exceeding size limits."),c("send_error"),u):(W&&u.statusCode!==void 0&&(u.statusCode<200||u.statusCode>=300)&&A.warn(`Sentry responded with status code ${u.statusCode} to sent event.`),r=ep(r,u),u),u=>{throw c("network_error"),W&&A.error("Encountered error running transport request:",u),u});return n.add(d).then(u=>u,u=>{if(u===uu)return W&&A.error("Skipped sending event because buffer is full."),c("queue_overflow"),Promise.resolve({});throw u})}return{send:i,flush:o}}function kI(e,t,n){let r=[{type:"client_report"},{timestamp:n||hr(),discarded_events:e}];return $t(t?{dsn:t}:{},[r])}function Bh(e){let t=[];e.message&&t.push(e.message);try{let n=e.exception.values[e.exception.values.length-1];n?.value&&(t.push(n.value),n.type&&t.push(`${n.type}: ${n.value}`))}catch{}return t}function AI(e){let{trace_id:t,parent_span_id:n,span_id:r,status:o,origin:i,data:a,op:s}=e.contexts?.trace??{};return{data:a??{},description:e.transaction,op:s,parent_span_id:n,span_id:r??"",start_timestamp:e.start_timestamp??0,status:o,timestamp:e.timestamp,trace_id:t??"",origin:i,profile_id:a?.[cl],exclusive_time:a?.[Jn],measurements:e.measurements,is_segment:!0}}function II(e){return{type:"transaction",timestamp:e.timestamp,start_timestamp:e.start_timestamp,transaction:e.description,contexts:{trace:{trace_id:e.trace_id,span_id:e.span_id,parent_span_id:e.parent_span_id,op:e.op,status:e.status,origin:e.origin,data:{...e.data,...e.profile_id&&{[cl]:e.profile_id},...e.exclusive_time&&{[Jn]:e.exclusive_time}}}},measurements:e.measurements}}var El="[Filtered]",np=["forwarded","-ip","remote-","via","-user"],Kv=["auth","token","secret","session","password","passwd","pwd","key","jwt","bearer","sso","saml","csrf","xsrf","credentials","sid","identity","set-cookie","cookie"],NI=[".sid","sessid","remember","oidc","pkce","nonce","__secure-","__host-","awsalb","awselb","akamai","__stripe","cognito","firebase","supabase","sb-","mfa","2fa"];function RI(e){return e===!0?{userInfo:!0,cookies:!0,httpHeaders:{request:!0,response:!0},httpBodies:["incomingRequest","outgoingRequest","incomingResponse","outgoingResponse"],queryParams:!0,genAI:{inputs:!0,outputs:!0},stackFrameVariables:!0,frameContextLines:7}:{userInfo:!1,cookies:{deny:np},httpHeaders:{request:{deny:np},response:{deny:np}},httpBodies:[],queryParams:{deny:np},genAI:{inputs:!1,outputs:!1},stackFrameVariables:!0,frameContextLines:7}}var a8={userInfo:!0,cookies:!0,httpHeaders:{request:!0,response:!0},httpBodies:["incomingRequest","outgoingRequest","incomingResponse","outgoingResponse"],queryParams:!0,genAI:{inputs:!0,outputs:!0},stackFrameVariables:!0,frameContextLines:5};function CI(e){let t=e.dataCollection!=null?a8:RI(e.sendDefaultPii),n=e.dataCollection??{};return{userInfo:n.userInfo??t.userInfo,cookies:n.cookies??t.cookies,httpHeaders:{request:n.httpHeaders?.request??t.httpHeaders.request,response:n.httpHeaders?.response??t.httpHeaders.response},httpBodies:n.httpBodies??t.httpBodies,queryParams:n.queryParams??t.queryParams,genAI:{inputs:n.genAI?.inputs??t.genAI.inputs,outputs:n.genAI?.outputs??t.genAI.outputs},stackFrameVariables:n.stackFrameVariables??t.stackFrameVariables,frameContextLines:n.frameContextLines??t.frameContextLines}}var MI="Not capturing exception because it's already been captured.",OI="Discarded session because of missing or non-string release",zI=Symbol.for("SentryInternalError"),FI=Symbol.for("SentryDoNotSendEventError"),s8=5e3;function zh(e){return{message:e,[zI]:!0}}function Xv(e){return{message:e,[FI]:!0}}function DI(e){return!!e&&typeof e=="object"&&zI in e}function LI(e){return!!e&&typeof e=="object"&&FI in e}function UI(e,t,n,r,o){let i=0,a,s=!1;e.on(n,()=>{i=0,clearTimeout(a),s=!1}),e.on(t,l=>{if(i+=r(l),i>=8e5)o(e);else if(!s){let c=e.getOptions()._flushInterval??s8;c>0&&(s=!0,a=es(setTimeout(()=>{o(e)},c)))}}),e.on("flush",()=>{o(e)})}var rp=class{constructor(t){if(this._options=t,this._integrations={},this._numProcessing=0,this._outcomes={},this._hooks={},this._eventProcessors=[],this._promiseBuffer=Sl(t.transportOptions?.bufferSize??Yv),this._dataCollection=CI(t),t.dsn?this._dsn=Of(t.dsn):W&&A.warn("No DSN provided, client will not send events."),this._dsn){let r=Qf(this._dsn,t.tunnel,t._metadata?t._metadata.sdk:void 0);this._transport=t.transport({tunnel:this._options.tunnel,recordDroppedEvent:this.recordDroppedEvent.bind(this),...t.transportOptions,url:r})}this._options.enableLogs=this._options.enableLogs??this._options._experiments?.enableLogs,this._options.enableLogs&&UI(this,"afterCaptureLog","flushLogs",d8,vl),(this._options.enableMetrics??this._options._experiments?.enableMetrics??!0)&&UI(this,"afterCaptureMetric","flushMetrics",u8,cu)}captureException(t,n,r){let o=ft();if(Rf(t))return W&&A.log(MI),o;let i={event_id:o,...n};return this._process(()=>this.eventFromException(t,i).then(a=>this._captureEvent(a,i,r)).then(a=>a),"error"),i.event_id}captureMessage(t,n,r,o){let i={event_id:ft(),...r},a=di(t)?t:String(t),s=dn(t),l=s?this.eventFromMessage(a,n,i):this.eventFromException(t,i);return this._process(()=>l.then(c=>this._captureEvent(c,i,o)),s?"unknown":"error"),i.event_id}captureEvent(t,n,r){let o=ft();if(n?.originalException&&Rf(n.originalException))return W&&A.log(MI),o;let i={event_id:o,...n},a=t.sdkProcessingMetadata||{},s=a.capturedSpanScope,l=a.capturedSpanIsolationScope,c=PI(t.type);return this._process(()=>this._captureEvent(t,i,s||r,l),c),i.event_id}captureSession(t){this.sendSession(t),Vi(t,{init:!1})}getDsn(){return this._dsn}getOptions(){return this._options}getDataCollectionOptions(){return this._dataCollection}getSdkMetadata(){return this._options._metadata}getTransport(){return this._transport}async flush(t){let n=this._transport;if(this.emit("flush"),!n)return!0;let r=await this._isClientDoneProcessing(t),o=await n.flush(t);return r&&o}async close(t){vl(this);let n=await this.flush(t);return this.getOptions().enabled=!1,this.emit("close"),n}getEventProcessors(){return this._eventProcessors}addEventProcessor(t){this._eventProcessors.push(t)}init(){(this._isEnabled()||this._options.integrations.some(({name:t})=>t.startsWith("Spotlight")))&&this._setupIntegrations()}getIntegrationByName(t){return this._integrations[t]}getIntegrationNames(){return Object.keys(this._integrations)}addIntegration(t){let n=this._integrations[t.name];!n&&t.beforeSetup&&t.beforeSetup(this),zv(this,t,this._integrations),n||Bv(this,[t])}sendEvent(t,n={}){this.emit("beforeSendEvent",t,n);let r=TI(t,this),o=GA(t,this._dsn,this._options._metadata,this._options.tunnel);for(let i of n.attachments||[])o=Gf(o,bh(i));r&&(o=Gf(o,r)),this.sendEnvelope(o).then(i=>this.emit("afterSendEvent",t,i))}sendSession(t){let{release:n,environment:r=Ko}=this._options;if("aggregates"in t){let i=t.attrs||{};if(!i.release&&!n){W&&A.warn(OI);return}i.release=i.release||n,i.environment=i.environment||r,t.attrs=i}else{if(!t.release&&!n){W&&A.warn(OI);return}t.release=t.release||n,t.environment=t.environment||r}this.emit("beforeSendSession",t);let o=HA(t,this._dsn,this._options._metadata,this._options.tunnel);this.sendEnvelope(o)}recordDroppedEvent(t,n,r=1){if(this._options.sendClientReports){let o=`${t}:${n}`;W&&A.log(`Recording outcome: "${o}"${r>1?` (${r} times)`:""}`),this._outcomes[o]=(this._outcomes[o]||0)+r}}on(t,n){let r=this._hooks[t]=this._hooks[t]||new Set,o=(...i)=>n(...i);return r.add(o),()=>{r.delete(o)}}emit(t,...n){let r=this._hooks[t];r&&r.forEach(o=>o(...n))}async sendEnvelope(t){if(this.emit("beforeEnvelope",t),this._isEnabled()&&this._transport)try{return await this._transport.send(t)}catch(n){return W&&A.error("Error while sending envelope:",n),{}}return W&&A.error("Transport disabled"),{}}registerCleanup(t){}dispose(){}_setupIntegrations(){let{integrations:t}=this._options;this._integrations=pI(this,t),Bv(this,t)}_updateSessionFromEvent(t,n){let r=n.level==="fatal",o=!1,i=n.exception?.values;if(i){o=!0,r=!1;for(let l of i)if(l.mechanism?.handled===!1){r=!0;break}}let a=t.status==="ok";(a&&t.errors===0||a&&r)&&(Vi(t,{...r&&{status:"crashed"},errors:t.errors||Number(o||r)}),this.captureSession(t))}async _isClientDoneProcessing(t){let n=0;for(;!t||n<t;){if(await new Promise(r=>setTimeout(r,1)),!this._numProcessing)return!0;n++}return!1}_isEnabled(){return this.getOptions().enabled!==!1&&this._transport!==void 0}_prepareEvent(t,n,r,o){let i=this.getOptions(),a=this.getIntegrationNames();return!n.integrations&&a.length&&(n.integrations=a),this.emit("preprocessEvent",t,n),t.type||o.setLastEventId(t.event_id||n.event_id),Jf(i,t,n,r,this,o).then(s=>{if(s===null)return s;this.emit("postprocessEvent",s,n),s.contexts={trace:{...s.contexts?.trace,...Wc(r)},...s.contexts};let l=Xi(this,r);return s.sdkProcessingMetadata={dynamicSamplingContext:l,...s.sdkProcessingMetadata},s})}_captureEvent(t,n={},r=ae(),o=je()){return W&&Jv(t)&&A.log(`Captured error event \`${Bh(t)[0]||"<unknown>"}\``),this._processEvent(t,n,r,o).then(i=>i.event_id,i=>{W&&(LI(i)?A.log(i.message):DI(i)?A.warn(i.message):A.warn(i))})}_processEvent(t,n,r,o){let i=this.getOptions(),{sampleRate:a}=i,s=HI(t),l=Jv(t),d=`before send for type \`${t.type||"error"}\``,u=typeof a>"u"?void 0:Br(a);if(l&&typeof u=="number"&&gr()>u)return this.recordDroppedEvent("sample_rate","error"),hl(Xv(`Discarding event because it's not included in the random sample (sampling rate = ${a})`));let m=PI(t.type);return this._prepareEvent(t,n,r,o).then(p=>{if(p===null)throw this.recordDroppedEvent("event_processor",m),Xv("An event processor returned `null`, will not send event.");if(n.data?.__sentry__===!0)return p;let _=c8(this,i,p,n);return l8(_,d)}).then(p=>{if(p===null){if(this.recordDroppedEvent("before_send",m),s){let h=1+(t.spans||[]).length;this.recordDroppedEvent("before_send","span",h)}throw Xv(`${d} returned \`null\`, will not send event.`)}let g=r.getSession()||o.getSession();if(l&&g&&this._updateSessionFromEvent(g,p),s){let y=p.sdkProcessingMetadata?.spanCountBeforeProcessing||0,h=p.spans?p.spans.length:0,v=y-h;v>0&&this.recordDroppedEvent("before_send","span",v)}let _=p.transaction_info;if(s&&_&&p.transaction!==t.transaction){let y="custom";p.transaction_info={..._,source:y}}return this.sendEvent(p,n),p}).then(null,p=>{throw LI(p)||DI(p)?p:(this.captureException(p,{mechanism:{handled:!1,type:"internal"},data:{__sentry__:!0},originalException:p}),zh(`Event processing pipeline threw an error, original event will not be sent. Details have been sent as a new event.
18
- Reason: ${p}`))})}_process(t,n){this._numProcessing++,this._promiseBuffer.add(t).then(r=>(this._numProcessing--,r),r=>(this._numProcessing--,r===uu&&this.recordDroppedEvent("queue_overflow",n),r))}_clearOutcomes(){let t=this._outcomes;return this._outcomes={},Object.entries(t).map(([n,r])=>{let[o,i]=n.split(":");return{reason:o,category:i,quantity:r}})}_flushOutcomes(){W&&A.log("Flushing outcomes...");let t=this._clearOutcomes();if(t.length===0){W&&A.log("No outcomes to send");return}if(!this._dsn){W&&A.log("No dsn provided, will not send outcomes");return}W&&A.log("Sending outcomes:",t);let n=kI(t,this._options.tunnel&&pn(this._dsn));this.sendEnvelope(n)}};function PI(e){return e==="replay_event"?"replay":e||"error"}function l8(e,t){let n=`${t} must return \`null\` or a valid event.`;if(Bn(e))return e.then(r=>{if(!Tt(r)&&r!==null)throw zh(n);return r},r=>{throw zh(`${t} rejected with ${r}`)});if(!Tt(e)&&e!==null)throw zh(n);return e}function c8(e,t,n,r){let{beforeSend:o,beforeSendTransaction:i,ignoreSpans:a}=t,s=!Ji(t.beforeSendSpan)&&t.beforeSendSpan,l=n;if(Jv(l)&&o)return o(l,r);if(HI(l)){if(s||a){let c=AI(l);if(a?.length&&Ki({description:c.description,op:c.op,attributes:c.data},a))return null;if(s){let d=s(c);d?l=Va(n,II(d)):fl()}if(l.spans){let d=[],u=l.spans;for(let p of u){if(a?.length&&Ki({description:p.description,op:p.op,attributes:p.data},a)){PA(u,p);continue}if(s){let g=s(p);g?d.push(g):(fl(),d.push(p))}else d.push(p)}let m=l.spans.length-d.length;m&&e.recordDroppedEvent("before_send","span",m),l.spans=d}}if(i){if(l.spans){let c=l.spans.length;l.sdkProcessingMetadata={...n.sdkProcessingMetadata,spanCountBeforeProcessing:c}}return i(l,r)}}return l}function Jv(e){return e.type===void 0}function HI(e){return e.type==="transaction"}function u8(e){let t=0;return e.name&&(t+=e.name.length*2),t+=8,t+GI(e.attributes)}function d8(e){let t=0;return e.message&&(t+=e.message.length*2),t+GI(e.attributes)}function GI(e){if(!e)return 0;let t=0;return Object.values(e).forEach(n=>{Array.isArray(n)?t+=n.length*BI(n[0]):dn(n)?t+=BI(n):t+=100}),t}function BI(e){return typeof e=="string"?e.length*2:typeof e=="number"?8:typeof e=="boolean"?4:0}function Qv(e,t){t.debug===!0&&(W?A.enable():Sn(()=>{console.warn("[Sentry] Cannot initialize SDK with `debug` option using a non-debug bundle.")})),ae().update(t.initialScope);let r=new e(t);return Fh(r),r.init(),r}function Fh(e){ae().setClient(e)}var Zv=100,eS=5e3,f8=36e5;function tS(e){function t(...n){W&&A.log("[Offline]:",...n)}return n=>{let r=e(n);if(!n.createStore)throw new Error("No `createStore` function was provided");let o=n.createStore(n),i=eS,a;function s(u,m,p){return pl(u,["client_report"])?!1:n.shouldStore?n.shouldStore(u,m,p):!0}function l(u){a&&clearTimeout(a),a=es(setTimeout(async()=>{a=void 0;let m=await o.shift();m&&(t("Attempting to send previously queued event"),m[0].sent_at=new Date(Yn()).toISOString(),d(m,!0).catch(p=>{t("Failed to retry sending",p)}))},u))}function c(){a||(l(i),i=Math.min(i*2,f8))}async function d(u,m=!1){if(!m&&pl(u,["replay_event","replay_recording"]))return await o.push(u),l(Zv),{};try{if(n.shouldSend&&await n.shouldSend(u)===!1)throw new Error("Envelope not sent because `shouldSend` callback returned false");let p=await r.send(u),g=Zv;if(p){if(p.headers?.["retry-after"])g=Ph(p.headers["retry-after"]);else if(p.headers?.["x-sentry-rate-limits"])g=6e4;else if((p.statusCode||0)>=400)return p}return l(g),i=eS,p}catch(p){if(await s(u,p,i))return m?await o.unshift(u):await o.push(u),c(),t("Error sending. Event queued.",p),{};throw p}}return n.flushAtStartup&&c(),{send:d,flush:u=>(u===void 0&&(i=eS,l(Zv)),r.flush(u))}}}var du="MULTIPLEXED_TRANSPORT_EXTRA_KEY";function $I(e,t){let n;return vr(e,(r,o)=>(t.includes(o)&&(n=Array.isArray(r)?r[1]:void 0),!!n)),n}function p8(e,t){return n=>{let r=e(n);return{...r,send:async o=>{let i=$I(o,["event","transaction","profile","replay_event"]);return i&&(i.release=t),r.send(o)}}}}function m8(e,t){return $t(t?{...e[0],dsn:t}:e[0],e[1])}function nS(e,t){return n=>{let r=e(n),o=new Map,i=t||(c=>{let d=c.getEvent();return d?.extra?.[du]&&Array.isArray(d.extra[du])?d.extra[du]:[]});function a(c,d){let u=d?`${c}:${d}`:c,m=o.get(u);if(!m){let p=ih(c);if(!p)return;let g=Qf(p,n.tunnel);m=d?p8(e,d)({...n,url:g}):e({...n,url:g}),o.set(u,m)}return[c,m]}async function s(c){function d(g){let _=g?.length?g:["event"];return $I(c,_)}let u=i({envelope:c,getEvent:d}).map(g=>typeof g=="string"?a(g,void 0):a(g.dsn,g.release)).filter(g=>!!g),m=u.length?u:[["",r]];return(await Promise.all(m.map(([g,_])=>_.send(m8(c,g)))))[0]}async function l(c){let d=[...o.values(),r];return(await Promise.all(d.map(m=>m.flush(c)))).every(m=>m)}return{send:s,flush:l}}}function rS(e,t){return t.some(n=>e.includes(n))}function ns(e,t,n){if(t===!1)return{};let r=n!=null?[...Kv,...n]:Kv,o={};if(t===!0){for(let a of Object.keys(e))o[a]=rS(a.toLowerCase(),r)?El:e[a];return o}if("deny"in t){let a=t.deny.map(s=>s.toLowerCase());for(let s of Object.keys(e)){let l=s.toLowerCase(),c=rS(l,r)||a.some(d=>l.includes(d));o[s]=c?El:e[s]}return o}let i=t.allow.map(a=>a.toLowerCase());for(let a of Object.keys(e)){let s=a.toLowerCase();if(rS(s,r))o[a]=El;else{let l=i.some(c=>s.includes(c));o[a]=l?e[a]:El}}return o}function jI(e){let t={},n=0;for(;n<e.length;){let r=e.indexOf("=",n);if(r===-1)break;let o=e.indexOf(";",n);if(o===-1)o=e.length;else if(o<r){n=e.lastIndexOf(";",r-1)+1;continue}let i=e.slice(n,r).trim();if(t[i]===void 0){let a=e.slice(r+1,o).trim();a.charCodeAt(0)===34&&(a=a.slice(1,-1));try{t[i]=a.indexOf("%")!==-1?decodeURIComponent(a):a}catch{t[i]=a}}n=o+1}return t}function op(e,t){if(t===!1)return{};try{let n=jI(e);return Object.keys(n).length===0?{}:ns(n,t,NI)}catch{return El}}var g8="thismessage:/";function Tl(e){return"isRelative"in e}function vi(e,t){let n=e.indexOf("://")<=0&&e.indexOf("//")!==0,r=t??(n?g8:void 0);try{if("canParse"in URL&&!URL.canParse(e,r))return;let o=new URL(e,r);return n?{isRelative:n,pathname:o.pathname,search:o.search,hash:o.hash}:o}catch{}}function fu(e){if(Tl(e))return e.pathname;let t=new URL(e);return t.search="",t.hash="",["80","443"].includes(t.port)&&(t.port=""),t.password&&(t.password="%filtered%"),t.username&&(t.username="%filtered%"),t.toString()}function fo(e){if(!e)return{};let t=e.match(/^(([^:/?#]+):)?(\/\/([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?$/);if(!t)return{};let n=t[6]||"",r=t[8]||"";return{host:t[4],path:t[5],protocol:t[2],search:n,hash:r,relative:t[5]+n+r}}function pu(e){return e.split(/[?#]/,1)[0]}function er(e,t=!0){if(e.startsWith("data:")){let n=e.match(/^data:([^;,]+)/),r=n?n[1]:"text/plain",o=e.includes(";base64,"),i=e.indexOf(","),a="";if(t&&i!==-1){let s=e.slice(i+1);a=s.length>10?`${s.slice(0,10)}... [truncated]`:s}return`data:${r}${o?",base64":""}${a?`,${a}`:""}`}return e}function mu(e,t){let n=t?.getDsn(),r=t?.getOptions().tunnel;return b8(e,n)||h8(e,r)}function h8(e,t){return t?qI(e)===qI(t):!1}function b8(e,t){let n=vi(e);return!n||Tl(n)||!t?!1:y8(n.hostname,t.host)&&/(^|&|\?)sentry_key=/.test(n.search)}function y8(e,t){return e===t||t.length>0&&e.endsWith(`.${t}`)}function qI(e){return e[e.length-1]==="/"?e.slice(0,-1):e}function Hh(e,...t){let n=new String(String.raw(e,...t));return n.__sentry_template_string__=e.join("\0").replace(/%/g,"%%").replace(/\0/g,"%s"),n.__sentry_template_values__=t,n}var oS=Hh;function iS(e){"aggregates"in e?e.attrs?.ip_address===void 0&&(e.attrs={...e.attrs,ip_address:"{{auto}}"}):e.ipAddress===void 0&&(e.ipAddress="{{auto}}")}function ip(e,t,n=[t],r="npm"){let o=(e._metadata=e._metadata||{}).sdk=e._metadata.sdk||{};o.name||(o.name=`sentry.javascript.${t}`,o.packages=n.map(i=>({name:`${r}:@sentry/${i}`,version:mr})),o.version=mr)}function wl(e={}){let t=e.client||q();if(!au()||!t)return{};let n=or(),r=lo(n);if(r.getTraceData)return r.getTraceData(e);let o=e.scope||ae(),i=e.span||Be(),a=hi(i)&&!Gt(t.getOptions());if(!i&&Hg())return{};let s=i&&!a?Qc(i):_8(o),l=i?en(i):Xi(t,o),c=oh(l);if(!sh.test(s))return A.warn("Invalid sentry-trace data. Cannot generate trace data"),{};let u={"sentry-trace":s,baggage:c};return e.propagateTraceparent&&(u.traceparent=i&&!a?RA(i):v8(o)),u}function _8(e){let{traceId:t,sampled:n,propagationSpanId:r}=e.getPropagationContext();return Lf(t,r,n)}function v8(e){let{traceId:t,sampled:n,propagationSpanId:r}=e.getPropagationContext();return Uf(t,r,n)}function aS(e,t,n){let r,o,i,a=n?.maxWait?Math.max(n.maxWait,t):0,s=n?.setTimeoutImpl||setTimeout;function l(){return c(),r=e(),r}function c(){o!==void 0&&clearTimeout(o),i!==void 0&&clearTimeout(i),o=i=void 0}function d(){return o!==void 0||i!==void 0?l():r}function u(){return o&&clearTimeout(o),o=s(l,t),a&&i===void 0&&(i=s(l,a)),r}return u.cancel=c,u.flush=d,u}var S8=100;function Mn(e,t){let n=q(),r=je();if(!n)return;let{beforeBreadcrumb:o=null,maxBreadcrumbs:i=S8}=n.getOptions();if(i<=0)return;let s={timestamp:hr(),...e},l=o?Sn(()=>o(s,t)):s;l!==null&&(n.emit&&n.emit("beforeAddBreadcrumb",l,t),r.addBreadcrumb(l,i))}var VI,E8="FunctionToString",WI=new WeakMap,T8=(()=>({name:E8,setupOnce(){VI=Function.prototype.toString;try{Function.prototype.toString=function(...e){let t=$a(this),n=WI.has(q())&&t!==void 0?t:this;return VI.apply(n,e)}}catch{}},setup(e){WI.set(e,!0)}})),ap=T8;var w8=[/^Script error\.?$/,/^Javascript error: Script error\.? on line 0$/,/^ResizeObserver loop completed with undelivered notifications.$/,/^Cannot redefine property: googletag$/,/^Can't find variable: gmo$/,/^undefined is not an object \(evaluating 'a\.[A-Z]'\)$/,/can't redefine non-configurable property "solana"/,/vv\(\)\.getRestrictions is not a function/,/Can't find variable: _AutofillCallbackHandler/,/Object Not Found Matching Id:\d+, MethodName:simulateEvent/,/^Java exception was raised during method invocation$/],x8="EventFilters",$h=(e={})=>{let t;return{name:x8,setup(n){let r=n.getOptions();t=YI(e,r)},processEvent(n,r,o){if(!t){let i=o.getOptions();t=YI(e,i)}return k8(n,t)?null:n}}},sp=((e={})=>({...$h(e),name:"InboundFilters"}));function YI(e={},t={}){return{allowUrls:[...e.allowUrls||[],...t.allowUrls||[]],denyUrls:[...e.denyUrls||[],...t.denyUrls||[]],ignoreErrors:[...e.ignoreErrors||[],...t.ignoreErrors||[],...e.disableErrorDefaults?[]:w8],ignoreTransactions:[...e.ignoreTransactions||[],...t.ignoreTransactions||[]]}}function k8(e,t){if(e.type){if(e.type==="transaction"&&I8(e,t.ignoreTransactions))return W&&A.warn(`Event dropped due to being matched by \`ignoreTransactions\` option.
19
- Event: ${qo(e)}`),!0}else{if(A8(e,t.ignoreErrors))return W&&A.warn(`Event dropped due to being matched by \`ignoreErrors\` option.
20
- Event: ${qo(e)}`),!0;if(M8(e))return W&&A.warn(`Event dropped due to not having an error message, error type or stacktrace.
21
- Event: ${qo(e)}`),!0;if(N8(e,t.denyUrls))return W&&A.warn(`Event dropped due to being matched by \`denyUrls\` option.
22
- Event: ${qo(e)}.
23
- Url: ${Gh(e)}`),!0;if(!R8(e,t.allowUrls))return W&&A.warn(`Event dropped due to not being matched by \`allowUrls\` option.
24
- Event: ${qo(e)}.
25
- Url: ${Gh(e)}`),!0}return!1}function A8(e,t){return t?.length?Bh(e).some(n=>fn(n,t)):!1}function I8(e,t){if(!t?.length)return!1;let n=e.transaction;return n?fn(n,t):!1}function N8(e,t){if(!t?.length)return!1;let n=Gh(e);return n?fn(n,t):!1}function R8(e,t){if(!t?.length)return!0;let n=Gh(e);return n?fn(n,t):!0}function C8(e=[]){for(let t=e.length-1;t>=0;t--){let n=e[t];if(n&&n.filename!=="<anonymous>"&&n.filename!=="[native code]")return n.filename||null}return null}function Gh(e){try{let n=[...e.exception?.values??[]].reverse().find(r=>r.mechanism?.parent_id===void 0&&r.stacktrace?.frames?.length)?.stacktrace?.frames;return n?C8(n):null}catch{return W&&A.error(`Cannot extract url for event ${qo(e)}`),null}}function M8(e){return e.exception?.values?.length?!e.message&&!e.exception.values.some(t=>t.stacktrace||t.type&&t.type!=="Error"||t.value):!1}function lS(e,t,n,r,o,i){if(!o.exception?.values||!i||!$o(i.originalException,Error))return;let a=o.exception.values.length>0?o.exception.values[o.exception.values.length-1]:void 0;a&&(o.exception.values=sS(e,t,r,i.originalException,n,o.exception.values,a,0))}function sS(e,t,n,r,o,i,a,s){if(i.length>=n+1)return i;let l=[...i];if($o(r[o],Error)){KI(a,s,r);let c=e(t,r[o]),d=l.length;XI(c,o,d,s),l=sS(e,t,n,r[o],o,[c,...l],c,d)}return JI(r)&&r.errors.forEach((c,d)=>{if($o(c,Error)){KI(a,s,r);let u=e(t,c),m=l.length;XI(u,`errors[${d}]`,m,s),l=sS(e,t,n,c,o,[u,...l],u,m)}}),l}function JI(e){return Array.isArray(e.errors)}function KI(e,t,n){e.mechanism={handled:!0,type:"auto.core.linked_errors",...JI(n)&&{is_exception_group:!0},...e.mechanism,exception_id:t}}function XI(e,t,n,r){e.mechanism={handled:!0,...e.mechanism,type:"chained",source:t,exception_id:n,parent_id:r}}function O8(e){return En(e)&&"__sentry_fetch_url_host__"in e&&typeof e.__sentry_fetch_url_host__=="string"}function jh(e){return O8(e)?`${e.message} (${e.__sentry_fetch_url_host__})`:e.message}var ZI=new Map,QI=new Set;function D8(e){if(ne._sentryModuleMetadata)for(let t of Object.keys(ne._sentryModuleMetadata)){let n=ne._sentryModuleMetadata[t];if(QI.has(t))continue;QI.add(t);let r=e(t);for(let o of r.reverse())if(o.filename){ZI.set(o.filename,n);break}}}function L8(e,t){return D8(e),ZI.get(t)}function qh(e,t){t.exception?.values?.forEach(n=>{n.stacktrace?.frames?.forEach(r=>{if(!r.filename||r.module_metadata)return;let o=L8(e,r.filename);o&&(r.module_metadata=o)})})}function Vh(e){e.exception?.values?.forEach(t=>{t.stacktrace?.frames?.forEach(n=>{delete n.module_metadata})})}var cS=()=>({name:"ModuleMetadata",setup(e){e.on("beforeEnvelope",t=>{vr(t,(n,r)=>{if(r==="event"){let o=Array.isArray(n)?n[1]:void 0;o&&(Vh(o),n[1]=o)}})}),e.on("applyFrameMetadata",t=>{if(t.type)return;let n=e.getOptions().stackParser;qh(n,t)})}});var eN=new Set([]);function xl(e){let t="console",n=Vn(t,e);return Wn(t,U8),n}function U8(){"console"in ne&&Ha.forEach(function(e){e in ne.console&&wt(ne.console,e,function(t){return ol[e]=t,function(...n){let r=n[0],o=ol[e],i=eN.size&&typeof r=="string"&&fn(r,eN);i||un("console",{args:n,level:e}),(!i||W&&A.isEnabled())&&o?.apply(ne.console,n)}})})}function ea(e){return e==="warn"?"warning":["fatal","error","warning","log","info","debug"].includes(e)?e:"log"}var P8="CaptureConsole",B8=((e={})=>{let t=e.levels||Ha,n=e.handled??!0;return{name:P8,setup(r){"console"in ne&&xl(({args:o,level:i})=>{q()!==r||!t.includes(i)||z8(o,i,n)})}}}),uS=B8;function z8(e,t,n){let r=ea(t),o=new Error,i={level:ea(t),extra:{arguments:e}};Ht(a=>{if(a.addEventProcessor(c=>(c.logger="console",Rn(c,{handled:n,type:"auto.core.capture_console"}),c)),t==="assert"){if(!e[0]){let c=`Assertion failed: ${ja(e.slice(1)," ")||"console.assert"}`;a.setExtra("arguments",e.slice(1)),a.captureMessage(c,r,{captureContext:i,syntheticException:o})}return}let s=e.find(c=>c instanceof Error);if(s){xe(s,i);return}let l=ja(e," ");a.captureMessage(l,r,{captureContext:i,syntheticException:o})})}var F8="Dedupe",H8=(()=>{let e;return{name:F8,processEvent(t){if(t.type)return t;try{if(G8(t,e))return W&&A.warn("Event dropped due to being a duplicate of previously captured event."),null}catch{}return e=t}}}),lp=H8;function G8(e,t){return t?!!($8(e,t)||j8(e,t)):!1}function $8(e,t){let n=e.message,r=t.message;return!(!n&&!r||n&&!r||!n&&r||n!==r||!rN(e,t)||!nN(e,t))}function j8(e,t){let n=tN(t),r=tN(e);return!(!n||!r||n.type!==r.type||n.value!==r.value||!rN(e,t)||!nN(e,t))}function nN(e,t){let n=il(e),r=il(t);if(!n&&!r)return!0;if(n&&!r||!n&&r||(n=n,r=r,r.length!==n.length))return!1;for(let o=0;o<r.length;o++){let i=r[o],a=n[o];if(i.filename!==a.filename||i.lineno!==a.lineno||i.colno!==a.colno||i.function!==a.function)return!1}return!0}function rN(e,t){let n=e.fingerprint,r=t.fingerprint;if(!n&&!r)return!0;if(n&&!r||!n&&r)return!1;n=n,r=r;try{return n.join("")===r.join("")}catch{return!1}}function tN(e){return e.exception?.values?.[0]}var q8="ExtraErrorData",V8=((e={})=>{let{depth:t=3,captureErrorCause:n=!0}=e;return{name:q8,processEvent(r,o,i){let{maxValueLength:a}=i.getOptions();return W8(r,o,t,n,a)}}}),dS=V8;function W8(e,t={},n,r,o){if(!t.originalException||!En(t.originalException))return e;let i=t.originalException.name||t.originalException.constructor.name,a=oN(t.originalException,r,o);if(a){let s={...e.contexts},l=ht(a,n);return Tt(l)&&(uv(l),s[i]=l),{...e,contexts:s}}return e}function oN(e,t,n){try{let r=["name","message","stack","line","column","fileName","lineNumber","columnNumber","toJSON"],o={};for(let i of Object.keys(e)){if(r.indexOf(i)!==-1)continue;let a=e[i];o[i]=En(a)||typeof a=="string"?n?jo(`${a}`,n):`${a}`:a}if(t&&e.cause!==void 0)if(En(e.cause)){let i=e.cause.name||e.cause.constructor.name;o.cause={[i]:oN(e.cause,!1,n)}}else o.cause=e.cause;if(typeof e.toJSON=="function"){let i=e.toJSON();for(let a of Object.keys(i)){let s=i[a];o[a]=En(s)?s.toString():s}}return o}catch(r){W&&A.error("Unable to extract extra data from the Error object:",r)}return null}function Y8(e,t){let n=0;for(let r=e.length-1;r>=0;r--){let o=e[r];o==="."?e.splice(r,1):o===".."?(e.splice(r,1),n++):n&&(e.splice(r,1),n--)}if(t)for(;n--;n)e.unshift("..");return e}var K8=/^(\S+:\\|\/?)([\s\S]*?)((?:\.{1,2}|[^/\\]+?|)(\.[^./\\]*|))(?:[/\\]*)$/;function X8(e){let t=e.length>1024?`<truncated>${e.slice(-1024)}`:e,n=K8.exec(t);return n?n.slice(1):[]}function iN(...e){let t="",n=!1;for(let r=e.length-1;r>=-1&&!n;r--){let o=r>=0?e[r]:"/";o&&(t=`${o}/${t}`,n=o.charAt(0)==="/")}return t=Y8(t.split("/").filter(r=>!!r),!n).join("/"),(n?"/":"")+t||"."}function aN(e){let t=0;for(;t<e.length&&e[t]==="";t++);let n=e.length-1;for(;n>=0&&e[n]==="";n--);return t>n?[]:e.slice(t,n-t+1)}function sN(e,t){e=iN(e).slice(1),t=iN(t).slice(1);let n=aN(e.split("/")),r=aN(t.split("/")),o=Math.min(n.length,r.length),i=o;for(let s=0;s<o;s++)if(n[s]!==r[s]){i=s;break}let a=[];for(let s=i;s<n.length;s++)a.push("..");return a=a.concat(r.slice(i)),a.join("/")}function lN(e,t){let n=X8(e)[2]||"";return t&&n.slice(t.length*-1)===t&&(n=n.slice(0,n.length-t.length)),n}var J8="RewriteFrames",fS=(e={})=>{let t=e.root,n=e.prefix||"app:///",r="window"in ne&&!!ne.window,o=e.iteratee||Q8({isBrowser:r,root:t,prefix:n});function i(s){try{return{...s,exception:{...s.exception,values:s.exception.values.map(l=>({...l,...l.stacktrace&&{stacktrace:a(l.stacktrace)}}))}}}catch{return s}}function a(s){return{...s,frames:s?.frames?.map(l=>o(l))}}return{name:J8,processEvent(s){let l=s;return s.exception&&Array.isArray(s.exception.values)&&(l=i(l)),l}}};function Q8({isBrowser:e,root:t,prefix:n}){return r=>{if(!r.filename)return r;let o=/^[a-zA-Z]:\\/.test(r.filename)||r.filename.includes("\\")&&!r.filename.includes("/"),i=/^\//.test(r.filename);if(e){if(t){let a=r.filename;a.indexOf(t)===0&&(r.filename=a.replace(t,n))}}else if(o||i){let a=o?r.filename.replace(/^[a-zA-Z]:/,"").replace(/\\/g,"/"):r.filename,s=t?sN(t,a):lN(a);r.filename=`${n}${s}`}return r}}var Z8=["reauthenticate","signInAnonymously","signInWithOAuth","signInWithIdToken","signInWithOtp","signInWithPassword","signInWithSSO","signOut","signUp","verifyOtp"],ez=["createUser","deleteUser","listUsers","getUserById","updateUserById","inviteUserByEmail"],tz={eq:"eq",neq:"neq",gt:"gt",gte:"gte",lt:"lt",lte:"lte",like:"like","like(all)":"likeAllOf","like(any)":"likeAnyOf",ilike:"ilike","ilike(all)":"ilikeAllOf","ilike(any)":"ilikeAnyOf",is:"is",in:"in",cs:"contains",cd:"containedBy",sr:"rangeGt",nxl:"rangeGte",sl:"rangeLt",nxr:"rangeLte",adj:"rangeAdjacent",ov:"overlaps",fts:"",plfts:"plain",phfts:"phrase",wfts:"websearch",not:"not"},uN=["select","insert","upsert","update","delete"];function Wh(e){try{e.__SENTRY_INSTRUMENTED__=!0}catch{}}function Yh(e){try{return e.__SENTRY_INSTRUMENTED__}catch{return!1}}function dN(e,t){if(Object.keys(t).length>0)return t;if(Array.isArray(e)&&e.length>0)return e}function nz(e,t){return dN(e,t)!==void 0}function rz(e,t={}){switch(e){case"GET":return"select";case"POST":return t.Prefer?.includes("resolution=")?"upsert":"insert";case"PATCH":return"update";case"DELETE":return"delete";default:return"<unknown-op>"}}function oz(e,t){if(t===""||t==="*")return"select(*)";if(e==="select")return`select(${t})`;if(e==="or"||e.endsWith(".or"))return`${e}${t}`;let[n,...r]=t.split("."),o;return n?.startsWith("fts")?o="textSearch":n?.startsWith("plfts")?o="textSearch[plain]":n?.startsWith("phfts")?o="textSearch[phrase]":n?.startsWith("wfts")?o="textSearch[websearch]":o=n&&tz[n]||"filter",`${o}(${e}, ${r.join(".")})`}function cN(e,t=!1){return new Proxy(e,{apply(n,r,o){return mn({name:`auth ${t?"(admin) ":""}${e.name}`,attributes:{[le]:"auto.db.supabase",[_e]:"db","db.system":"postgresql","db.operation":`auth.${t?"admin.":""}${e.name}`}},i=>Reflect.apply(n,r,o).then(a=>(a&&typeof a=="object"&&"error"in a&&a.error?(i.setStatus({code:2}),xe(a.error,{mechanism:{handled:!1,type:"auto.db.supabase.auth"}})):i.setStatus({code:1}),i.end(),a)).catch(a=>{throw i.setStatus({code:2}),i.end(),xe(a,{mechanism:{handled:!1,type:"auto.db.supabase.auth"}}),a}).then(...o))}})}function iz(e){let t=e.auth;if(!(!t||Yh(e.auth))){for(let n of Z8){let r=t[n];r&&typeof e.auth[n]=="function"&&(e.auth[n]=cN(r))}for(let n of ez){let r=t.admin[n];r&&typeof e.auth.admin[n]=="function"&&(e.auth.admin[n]=cN(r,!0))}Wh(e.auth)}}function az(e,t){Yh(e.prototype.from)||(e.prototype.from=new Proxy(e.prototype.from,{apply(n,r,o){let i=Reflect.apply(n,r,o),a=i.constructor;return lz(a,t),i}}),Wh(e.prototype.from))}function sz(e,t){Yh(e.prototype.then)||(e.prototype.then=new Proxy(e.prototype.then,{apply(n,r,o){let i=uN,a=r,s=rz(a.method,a.headers);if(!i.includes(s)||!a?.url?.pathname||typeof a.url.pathname!="string")return Reflect.apply(n,r,o);let l=a.url.pathname.split("/"),c=l.length>0?l[l.length-1]:"",d=[];for(let[x,N]of a.url.searchParams.entries())d.push(oz(x,N));let u=Object.create(null);if(Tt(a.body))for(let[x,N]of Object.entries(a.body))u[x]=N;let m=q(),p=t.sendOperationData??m?.getDataCollectionOptions().userInfo===!0,g=dN(a.body,u),_=s==="select"?"":`${s}${nz(a.body,u)?"(...) ":""}`,y=p?d.join(" "):d.length>0?"[redacted]":"",h=[_.trimEnd(),y].filter(Boolean).join(" "),v=h?`${h} from(${c})`:`from(${c})`,T={"db.table":c,"db.schema":a.schema,"db.url":a.url.origin,"db.sdk":a.headers["X-Client-Info"],"db.system":"postgresql","db.operation":s,[le]:"auto.db.supabase",[_e]:"db"};return d.length&&p&&(T["db.query"]=d),g!==void 0&&p&&(T["db.body"]=g),mn({name:v,attributes:T},x=>Reflect.apply(n,r,[]).then(N=>{if(x&&(N&&typeof N=="object"&&"status"in N&&pi(x,N.status||500),x.end()),N?.error){let P=new Error(N.error.message);N.error.code&&(P.code=N.error.code),N.error.details&&(P.details=N.error.details);let F={};d.length&&p&&(F.query=d),g!==void 0&&p&&(F.body=g),xe(P,U=>(U.addEventProcessor(X=>(Rn(X,{handled:!1,type:"auto.db.supabase.postgres"}),X)),U.setContext("supabase",F),U))}let M={type:"supabase",category:`db.${s}`,message:v},k={};return d.length&&p&&(k.query=d),g!==void 0&&p&&(k.body=g),Object.keys(k).length&&(M.data=k),Mn(M),N},N=>{throw x&&(pi(x,500),x.end()),N}).then(...o))}}),Wh(e.prototype.then))}function lz(e,t){for(let n of uN)Yh(e.prototype[n])||(e.prototype[n]=new Proxy(e.prototype[n],{apply(r,o,i){let a=Reflect.apply(r,o,i),s=a.constructor;return W&&A.log(`Instrumenting ${n} operation's PostgRESTFilterBuilder`),sz(s,t),a}}),Wh(e.prototype[n]))}var Kh=(e,t={})=>{if(!e){W&&A.warn("Supabase integration was not installed because no Supabase client was provided.");return}let n=e.constructor===Function?e:e.constructor;az(n,t),iz(e)},cz="Supabase",uz=((e,t)=>({setupOnce(){Kh(e,t)},name:cz})),pS=e=>uz(e.supabaseClient,{sendOperationData:e.sendOperationData});var dz=10,fz="ZodErrors";function pz(e){return En(e)&&e.name==="ZodError"&&Array.isArray(e.issues)}function mz(e){return{...e,path:"path"in e&&Array.isArray(e.path)?e.path.join("."):void 0,keys:"keys"in e?JSON.stringify(e.keys):void 0,unionErrors:"unionErrors"in e?JSON.stringify(e.unionErrors):void 0}}function gz(e){return e.map(t=>typeof t=="number"?"<array>":t).join(".")}function hz(e){let t=new Set;for(let r of e.issues){let o=gz(r.path);o.length>0&&t.add(o)}let n=Array.from(t);if(n.length===0){let r="variable";if(e.issues.length>0){let o=e.issues[0];o!==void 0&&"expected"in o&&typeof o.expected=="string"&&(r=o.expected)}return`Failed to validate ${r}`}return`Failed to validate keys: ${jo(n.join(", "),100)}`}function bz(e,t=!1,n,r){if(!n.exception?.values||!r.originalException||!pz(r.originalException)||r.originalException.issues.length===0)return n;try{let i=(t?r.originalException.issues:r.originalException.issues.slice(0,e)).map(mz);return t&&(Array.isArray(r.attachments)||(r.attachments=[]),r.attachments.push({filename:"zod_issues.json",data:JSON.stringify({issues:i})})),{...n,exception:{...n.exception,values:[{...n.exception.values[0],value:hz(r.originalException)},...n.exception.values.slice(1)]},extra:{...n.extra,"zoderror.issues":i.slice(0,e)}}}catch(o){return{...n,extra:{...n.extra,"zoderrors sentry integration parse error":{message:"an exception was thrown while processing ZodError within applyZodErrorsToEvent()",error:o instanceof Error?`${o.name}: ${o.message}
26
- ${o.stack}`:"unknown"}}}}}var yz=((e={})=>{let t=e.limit??dz;return{name:fz,processEvent(n,r){return bz(t,e.saveZodIssuesAsAttachment,n,r)}}}),mS=yz;var gS=e=>({name:"ThirdPartyErrorsFilter",setup(t){t.on("beforeEnvelope",n=>{vr(n,(r,o)=>{if(o==="event"){let i=Array.isArray(r)?r[1]:void 0;i&&(Vh(i),r[1]=i)}})}),t.on("applyFrameMetadata",n=>{if(n.type)return;let r=t.getOptions().stackParser;qh(r,n)})},preprocessEvent(t){e.ignoreSentryInternalFrames&&(ne._sentryWrappedDepth??0)>0&&(t.sdkProcessingMetadata={...t.sdkProcessingMetadata,insideSentryWrapped:!0})},processEvent(t){let n=e.ignoreSentryInternalFrames?t.sdkProcessingMetadata?.insideSentryWrapped===!0&&t.exception?.values?.length===1:!1,r=vz(t,e.ignoreSentryInternalFrames,n);if(r){let o=e.behaviour==="drop-error-if-contains-third-party-frames"||e.behaviour==="apply-tag-if-contains-third-party-frames"?"some":"every";if(r[o](a=>!a.some(s=>e.filterKeys.includes(s)))){if(e.behaviour==="drop-error-if-contains-third-party-frames"||e.behaviour==="drop-error-if-exclusively-contains-third-party-frames")return null;t.tags={...t.tags,third_party_code:!0}}}return t}});function _z(e,t,n){if(t!==0)return!1;if(n&&Sz(e)||e.function==="sentryWrapped")return!0;if(!e.context_line||!e.filename||!e.filename.includes("sentry")||!e.filename.includes("helpers")||!e.context_line.includes(Tz))return!1;if(e.pre_context){let r=e.pre_context.length;for(let o=0;o<r;o++)if(e.pre_context[o]?.includes(Ez))return!0}return!1}function vz(e,t,n){let r=il(e);if(r)return r.filter((o,i)=>!o.filename||o.lineno==null&&o.colno==null&&o.instruction_addr==null?!1:!t||!_z(o,i,!!n)).map(o=>o.module_metadata?Object.keys(o.module_metadata).filter(i=>i.startsWith(fN)).map(i=>i.slice(fN.length)):[])}function Sz(e){return!e.context_line&&!e.pre_context&&!!e.function&&e.function.length<=2}var fN="_sentryBundlerPluginAppKey:",Ez="Attempt to invoke user-land function",Tz="fn.apply(this, wrappedArguments)";var pN=100,mN=10,Xh="flag.evaluation.";function Fr(e){if(e.type)return e;let n=ae().getScopeData().contexts.flags,r=n?n.values:[];return r.length&&(e.contexts===void 0&&(e.contexts={}),e.contexts.flags={values:[...r]}),e}function Sr(e,t,n=pN){let r=ae().getScopeData().contexts;r.flags||(r.flags={values:[]});let o=r.flags.values;wz(o,e,t,n)}function wz(e,t,n,r){if(typeof n!="boolean")return;if(e.length>r){W&&A.error(`[Feature Flags] insertToFlagBuffer called on a buffer larger than maxSize=${r}`);return}let o=e.findIndex(i=>i.flag===t);o!==-1&&e.splice(o,1),e.length===r&&e.shift(),e.push({flag:t,result:n})}function Er(e,t,n=mN){if(typeof t!="boolean")return;let r=Be();if(!r)return;let o=ie(r).data;if(`${Xh}${e}`in o){r.setAttribute(`${Xh}${e}`,t);return}Object.keys(o).filter(a=>a.startsWith(Xh)).length<n&&r.setAttribute(`${Xh}${e}`,t)}var hS=()=>({name:"FeatureFlags",processEvent(e,t,n){return Fr(e)},addFeatureFlag(e,t){Sr(e,t),Er(e,t)}});var bS=({growthbookClass:e})=>({name:"GrowthBook",setupOnce(){let t=e.prototype;typeof t.isOn=="function"&&wt(t,"isOn",gN),typeof t.getFeatureValue=="function"&&wt(t,"getFeatureValue",gN)},processEvent(t,n,r){return Fr(t)}});function gN(e){return function(...t){let n=t[0],r=e.apply(this,t);return typeof n=="string"&&typeof r=="boolean"&&(Sr(n,r),Er(n,r)),r}}var xz="ConversationId",kz=(()=>({name:xz,setup(e){e.on("spanStart",t=>{let n=ae().getScopeData(),r=je().getScopeData(),o=n.conversationId||r.conversationId;if(o){let{op:i,data:a,description:s}=ie(t);if(!i?.startsWith("gen_ai.")&&!a["ai.operationId"]&&!s?.startsWith("ai."))return;t.setAttribute(nh,o)}})}})),yS=kz;function _S(e,t,n,r,o){if(!e.fetchData)return;let{method:i,url:a}=e.fetchData,s=Gt()&&t(a);if(e.endTimestamp){let g=e.fetchData.__span;if(!g)return;let _=r[g];_&&(s&&(Iz(_,e),Az(_,e,o)),delete r[g]);return}let{spanOrigin:l="auto.http.browser",propagateTraceparent:c=!1}=typeof o=="object"?o:{spanOrigin:o},d=q(),m=!!Be()||!!d&&tn(d),p=s&&m?Dt(Cz(a,i,l)):new _r;if(s&&!m&&d?.recordDroppedEvent("no_parent_span","span"),e.fetchData.__span=p.spanContext().spanId,r[p.spanContext().spanId]=p,n(e.fetchData.url)){let g=e.args[0],_={...e.args[1]||{}},y=bN(g,_,Gt()&&m?p:void 0,c);y&&(e.args[1]=_,_.headers=y)}if(d){let g={input:e.args,response:e.response,startTimestamp:e.startTimestamp,endTimestamp:e.endTimestamp};d.emit("beforeOutgoingRequestSpan",p,g)}return p}function Az(e,t,n){(typeof n=="object"&&n!==null?n.onRequestSpanEnd:void 0)?.(e,{headers:t.response?.headers,error:t.error})}function bN(e,t,n,r){let o=wl({span:n,propagateTraceparent:r}),i=o["sentry-trace"],a=o.baggage,s=o.traceparent;if(!i)return;let l=t.headers||(kf(e)?e.headers:void 0);if(l)if(Nz(l)){let c=new Headers(l);if(c.get("sentry-trace")||c.set("sentry-trace",i),r&&s&&!c.get("traceparent")&&c.set("traceparent",s),a){let d=c.get("baggage");d?Jh(d)||c.set("baggage",`${d},${a}`):c.set("baggage",a)}return c}else if(Rz(l)){let c=[...l];c.find(u=>u[0]==="sentry-trace")||c.push(["sentry-trace",i]),r&&s&&!c.find(u=>u[0]==="traceparent")&&c.push(["traceparent",s]);let d=l.find(u=>u[0]==="baggage"&&typeof u[1]=="string"&&Jh(u[1]));return a&&!d&&c.push(["baggage",a]),c}else{let c="sentry-trace"in l?l["sentry-trace"]:void 0,d="traceparent"in l?l.traceparent:void 0,u="baggage"in l?l.baggage:void 0,m=u?Array.isArray(u)?[...u]:[u]:[],p=u&&(Array.isArray(u)?u.find(_=>Jh(_)):Jh(u));a&&!p&&m.push(a);let g=Object.assign({},l,{"sentry-trace":c??i,baggage:m.length>0?m.join(","):void 0});return r&&s&&!d&&(g.traceparent=s),g}else return{...o}}function Iz(e,t){if(t.response){pi(e,t.response.status);let n=t.response?.headers?.get("content-length");if(n){let r=parseInt(n);r>0&&e.setAttribute("http.response_content_length",r)}}else t.error&&e.setStatus({code:2,message:"internal_error"});e.end()}function Jh(e){return typeof e!="string"?!1:e.split(",").some(t=>t.trim().startsWith(Mf))}function Nz(e){return typeof Headers<"u"&&$o(e,Headers)}function Rz(e){return Array.isArray(e)?e.every(t=>Array.isArray(t)&&t.length===2&&typeof t[0]=="string"):!1}function Cz(e,t,n){if(e.startsWith("data:")){let i=er(e);return{name:`${t} ${i}`,attributes:hN(e,void 0,t,n)}}let r=vi(e),o=r?fu(r):e;return{name:`${t} ${o}`,attributes:hN(e,r,t,n)}}function hN(e,t,n,r){let o={url:er(e),type:"fetch","http.method":n,[le]:r,[_e]:"http.client"};return t&&(Tl(t)||(o["http.url"]=er(t.href),o["server.address"]=t.host),t.search&&(o["http.query"]=t.search),t.hash&&(o["http.fragment"]=t.hash)),o}function gu(e,t={},n=ae()){let{message:r,name:o,email:i,url:a,source:s,associatedEventId:l,tags:c}=e,d={contexts:{feedback:{contact_email:i,name:o,message:r,url:a,source:s,associated_event_id:l}},type:"feedback",level:"info",tags:c},u=n?.getClient()||q();return u&&u.emit("beforeSendFeedback",d,t),n.captureEvent(d,t)}var Qh={};rv(Qh,{debug:()=>Oz,error:()=>Uz,fatal:()=>Pz,fmt:()=>oS,info:()=>Dz,trace:()=>Mz,warn:()=>Lz});function hu(e,t,n,r,o){ts({level:e,message:t,attributes:n,severityNumber:o},r)}function Mz(e,t,{scope:n}={}){hu("trace",e,t,n)}function Oz(e,t,{scope:n}={}){hu("debug",e,t,n)}function Dz(e,t,{scope:n}={}){hu("info",e,t,n)}function Lz(e,t,{scope:n}={}){hu("warn",e,t,n)}function Uz(e,t,{scope:n}={}){hu("error",e,t,n)}function Pz(e,t,{scope:n}={}){hu("fatal",e,t,n)}function bu(e,t,n){return"util"in ne&&typeof ne.util.format=="function"?ne.util.format(...e):Bz(e,t,n)}function Bz(e,t,n){return e.map(r=>dn(r)?String(r):JSON.stringify(ht(r,t,n))).join(" ")}function Zh(e){return/%[sdifocO]/.test(e)}function eb(e,t){let n={},r=new Array(t.length).fill("{}").join(" ");return n["sentry.message.template"]=`${e} ${r}`,t.forEach((o,i)=>{n[`sentry.message.parameter.${i}`]=o}),n}var zz="ConsoleLogs",yN={[le]:"auto.log.console"},Fz=((e={})=>{let t=e.levels||Ha;return{name:zz,setup(n){let{enableLogs:r,normalizeDepth:o=3,normalizeMaxBreadth:i=1e3}=n.getOptions();if(!r){W&&A.warn("`enableLogs` is not enabled, ConsoleLogs integration disabled");return}let a=xl(({args:s,level:l})=>{if(q()!==n||!t.includes(l))return;let c=s[0],d=s.slice(1);if(l==="assert"){if(!c){let p=d.length>0?`Assertion failed: ${bu(d,o,i)}`:"Assertion failed";ts({level:"error",message:p,attributes:yN})}return}let u=l==="log",m={...yN};if(Tt(c)){Object.assign(m,ht(c,o,i));let p=typeof s[1]=="string"?2:1;s.slice(p).forEach((_,y)=>{m[`sentry.message.parameter.${y}`]=ht(_,o,i)})}else if(d.length>0&&typeof c=="string"&&!Zh(c)){let g=eb(c,d);for(let[_,y]of Object.entries(g))m[_]=_.startsWith("sentry.message.parameter.")?ht(y,o,i):y}ts({level:u?"info":l,message:bu(s,o,i),severityNumber:u?10:void 0,attributes:m})});n.registerCleanup(a)}}}),vS=Fz;var rs={};rv(rs,{count:()=>Hz,distribution:()=>$z,gauge:()=>Gz});function SS(e,t,n,r){Vv({type:e,name:t,value:n,unit:r?.unit,attributes:r?.attributes},{scope:r?.scope})}function Hz(e,t=1,n){SS("counter",e,t,n)}function Gz(e,t,n){SS("gauge",e,t,n)}function $z(e,t,n){SS("distribution",e,t,n)}var jz=["trace","debug","info","warn","error","fatal"];function ES(e={}){let t=new Set(e.levels??jz),n=e.client;return{log(r){let{type:o,level:i,message:a,args:s,tag:l,date:c,...d}=r,u=n||q();if(!u)return;let m=Wz(o,i);if(!t.has(m))return;let{normalizeDepth:p=3,normalizeMaxBreadth:g=1e3}=u.getOptions(),_={};for(let[h,v]of Object.entries(d))_[h]=ht(v,p,g);_["sentry.origin"]="auto.log.consola",l&&(_["consola.tag"]=l),o&&(_["consola.type"]=o),i!=null&&typeof i=="number"&&(_["consola.level"]=i);let y=Kz(Yz(s,p,g),p,g);y?.attributes&&Object.assign(_,y.attributes),ts({level:m,message:y?.message||a||s&&bu(s,p,g)||"",attributes:_})}}}var qz={silent:"trace",fatal:"fatal",error:"error",warn:"warn",log:"info",info:"info",success:"info",fail:"error",ready:"info",start:"info",box:"info",debug:"debug",trace:"trace",verbose:"debug",critical:"fatal",notice:"info"},Vz={0:"fatal",1:"warn",2:"info",3:"info",4:"debug",5:"trace"};function Wz(e,t){if(e==="verbose")return"debug";if(e==="silent")return"trace";if(e){let n=qz[e];if(n)return n}if(typeof t=="number"){let n=Vz[t];if(n)return n}return"info"}function Yz(e,t,n){if(!e?.length)return{message:""};let r=bu(e,t,n),o=e[0];if(Tt(o)){let i=typeof e[1]=="string"?2:1,a=e.slice(i);return{message:r,attributes:o,messageParameters:a}}else{let i=e.slice(1),a=i.length>0&&typeof o=="string"&&!Zh(o);return{message:r,messageTemplate:a?o:void 0,messageParameters:a?i:void 0}}}function Kz(e,t,n){let{message:r,attributes:o,messageTemplate:i,messageParameters:a}=e,s={};if(i&&a){let l=eb(i,a);for(let[c,d]of Object.entries(l))s[c]=c.startsWith("sentry.message.parameter.")?ht(d,t,n):d}else a&&a.length>0&&a.forEach((l,c)=>{s[`sentry.message.parameter.${c}`]=ht(l,t,n)});return{message:r,attributes:{...ht(o,t,n),...s}}}var _N="gen_ai.prompt",Si="gen_ai.system",Lt="gen_ai.request.model",yu="gen_ai.request.stream",os="gen_ai.request.temperature",_u="gen_ai.request.max_tokens",is="gen_ai.request.frequency_penalty",vu="gen_ai.request.presence_penalty",as="gen_ai.request.top_p",tb="gen_ai.request.top_k",nb="gen_ai.request.encoding_format",rb="gen_ai.request.dimensions",Ei="gen_ai.response.finish_reasons",po="gen_ai.response.model",ss="gen_ai.response.id",vN="gen_ai.response.stop_reason",mo="gen_ai.usage.input_tokens",go="gen_ai.usage.output_tokens",Hr="gen_ai.usage.total_tokens",wn="gen_ai.operation.name",ho="sentry.sdk_meta.gen_ai.input.messages.original_length",Jo="gen_ai.input.messages";var Ti="gen_ai.system_instructions",tr="gen_ai.response.text",wi="gen_ai.request.available_tools",SN="gen_ai.response.streaming",Tr="gen_ai.response.tool_calls",kl="gen_ai.agent.name",EN="gen_ai.pipeline.name",cp="gen_ai.conversation.id",TN="gen_ai.usage.cache_creation_input_tokens",wN="gen_ai.usage.cache_read_input_tokens";var xN="gen_ai.invoke_agent",Su="gen_ai.embeddings.input",TS="gen_ai.embeddings",wS="gen_ai.execute_tool",ob="gen_ai.tool.name",kN="gen_ai.tool.call.id",AN="gen_ai.tool.type",ib="gen_ai.tool.input",ab="gen_ai.tool.output",IN="gen_ai.tool.description";function ls(e){return!e||typeof e!="object"?!1:Jz(e)||RN(e)||Xz(e)||CN(e)||MN(e)||Qz(e)||Zz(e)||eF(e)||tF(e)||nF(e)||rF(e)||oF(e)}function Xz(e){return"image_url"in e?typeof e.image_url=="string"?e.image_url.startsWith("data:"):NN(e):!1}function NN(e){return"image_url"in e&&!!e.image_url&&typeof e.image_url=="object"&&"url"in e.image_url&&typeof e.image_url.url=="string"&&e.image_url.url.startsWith("data:")}function Jz(e){return"type"in e&&typeof e.type=="string"&&"source"in e&&ls(e.source)}function RN(e){return"inlineData"in e&&!!e.inlineData&&typeof e.inlineData=="object"&&"data"in e.inlineData&&typeof e.inlineData.data=="string"}function CN(e){return"type"in e&&e.type==="input_audio"&&"input_audio"in e&&!!e.input_audio&&typeof e.input_audio=="object"&&"data"in e.input_audio&&typeof e.input_audio.data=="string"}function MN(e){return"type"in e&&e.type==="file"&&"file"in e&&!!e.file&&typeof e.file=="object"&&"file_data"in e.file&&typeof e.file.file_data=="string"}function Qz(e){return"media_type"in e&&typeof e.media_type=="string"&&"data"in e}function Zz(e){return"type"in e&&e.type==="file"&&"mediaType"in e&&typeof e.mediaType=="string"&&"data"in e&&typeof e.data=="string"&&!e.data.startsWith("http://")&&!e.data.startsWith("https://")}function eF(e){return"type"in e&&e.type==="image"&&"image"in e&&typeof e.image=="string"&&!e.image.startsWith("http://")&&!e.image.startsWith("https://")}function tF(e){return"type"in e&&(e.type==="blob"||e.type==="base64")}function nF(e){return"b64_json"in e}function rF(e){return"type"in e&&"result"in e&&e.type==="image_generation"}function oF(e){return"uri"in e&&typeof e.uri=="string"&&e.uri.startsWith("data:")}var up="[Blob substitute]",iF=["image_url","data","content","b64_json","result","uri","image"];function Al(e){let t={...e};ls(t.source)&&(t.source=Al(t.source)),RN(e)&&(t.inlineData={...e.inlineData,data:up}),NN(e)&&(t.image_url={...e.image_url,url:up}),CN(e)&&(t.input_audio={...e.input_audio,data:up}),MN(e)&&(t.file={...e.file,file_data:up});for(let n of iF)typeof t[n]=="string"&&(t[n]=up);return t}var DN=2e4,sb=e=>new TextEncoder().encode(e).length,kS=e=>sb(JSON.stringify(e));function lb(e,t){if(sb(e)<=t)return e;let n=0,r=e.length,o="";for(;n<=r;){let i=Math.floor((n+r)/2),a=e.slice(0,i);sb(a)<=t?(o=a,n=i+1):r=i-1}return o}function aF(e){return typeof e=="string"?e:"text"in e&&typeof e.text=="string"?e.text:""}function ON(e,t){return typeof e=="string"?t:{...e,text:t}}function sF(e){return e!==null&&typeof e=="object"&&"content"in e&&typeof e.content=="string"}function LN(e){return e!==null&&typeof e=="object"&&"content"in e&&Array.isArray(e.content)}function UN(e){return e!==null&&typeof e=="object"&&"parts"in e&&Array.isArray(e.parts)&&e.parts.length>0}function lF(e,t){let n={...e,content:""},r=kS(n),o=t-r;if(o<=0)return[];let i=lb(e.content,o);return[{...e,content:i}]}function cF(e){return"parts"in e&&Array.isArray(e.parts)?{key:"parts",items:e.parts}:"content"in e&&Array.isArray(e.content)?{key:"content",items:e.content}:{key:null,items:[]}}function uF(e,t){let{key:n,items:r}=cF(e);if(n===null||r.length===0)return[];let o=r.map(l=>ON(l,"")),i=kS({...e,[n]:o}),a=t-i;if(a<=0)return[];let s=[];for(let l of r){let c=aF(l),d=sb(c);if(d<=a)s.push(l),a-=d;else if(s.length===0){let u=lb(c,a);u&&s.push(ON(l,u));break}else break}return s.length<=0?[]:[{...e,[n]:s}]}function dF(e,t){if(!e)return[];if(typeof e=="string"){let n=lb(e,t);return n?[n]:[]}return typeof e!="object"?[]:sF(e)?lF(e,t):LN(e)||UN(e)?uF(e,t):[]}function xS(e){return e.map(n=>{let r;return n&&typeof n=="object"&&(LN(n)?r={...n,content:xS(n.content)}:"content"in n&&ls(n.content)&&(r={...n,content:Al(n.content)}),UN(n)&&(r={...r??n,parts:xS(n.parts)}),ls(r)?r=Al(r):ls(n)&&(r=Al(n))),r??n})}function fF(e,t){if(!Array.isArray(e)||e.length===0)return e;let n=t-2,r=e[e.length-1],o=xS([r]),i=o[0];return kS(i)<=n?o:dF(i,n)}function PN(e){return fF(e,DN)}function BN(e){return lb(e,DN)}function Gr(e){let t=q()?.getDataCollectionOptions().genAI;return{...e,recordInputs:e?.recordInputs??t?.inputs??!1,recordOutputs:e?.recordOutputs??t?.outputs??!1}}function wr(e){if(e!==void 0)return e;let t=q();return t?!tn(t)&&t.getOptions().streamGenAiSpans===!1:!0}function Eu(e,t){return e?`${e}.${t}`:t}function zN(e,t,n,r,o){if(t!==void 0&&e.setAttributes({[mo]:t}),n!==void 0&&e.setAttributes({[go]:n}),t!==void 0||n!==void 0||r!==void 0||o!==void 0){let i=(t??0)+(n??0)+(r??0)+(o??0);e.setAttributes({[Hr]:i})}}function Il(e,t,n){if(!e.isRecording())return;let r={[SN]:!0};t.responseId&&(r[ss]=t.responseId),t.responseModel&&(r[po]=t.responseModel),t.promptTokens!==void 0&&(r[mo]=t.promptTokens),t.completionTokens!==void 0&&(r[go]=t.completionTokens),t.totalTokens!==void 0?r[Hr]=t.totalTokens:(t.promptTokens!==void 0||t.completionTokens!==void 0||t.cacheCreationInputTokens!==void 0||t.cacheReadInputTokens!==void 0)&&(r[Hr]=(t.promptTokens??0)+(t.completionTokens??0)+(t.cacheCreationInputTokens??0)+(t.cacheReadInputTokens??0)),t.finishReasons.length&&(r[Ei]=JSON.stringify(t.finishReasons)),n&&t.responseTexts.length&&(r[tr]=t.responseTexts.join("")),n&&t.toolCalls.length&&(r[Tr]=JSON.stringify(t.toolCalls)),e.setAttributes(r),e.end()}function Qo(e){return typeof e=="string"?e:JSON.stringify(e)}function Zo(e){if(typeof e=="string")return BN(e);if(Array.isArray(e)){let t=PN(e);return JSON.stringify(t)}return JSON.stringify(e)}function xi(e){if(!Array.isArray(e))return{systemInstructions:void 0,filteredMessages:e};let t=e.findIndex(a=>a&&typeof a=="object"&&"role"in a&&a.role==="system");if(t===-1)return{systemInstructions:void 0,filteredMessages:e};let n=e[t],r=typeof n.content=="string"?n.content:n.content!==void 0?JSON.stringify(n.content):void 0;if(!r)return{systemInstructions:void 0,filteredMessages:e};let o=JSON.stringify([{type:"text",content:r}]),i=[...e.slice(0,t),...e.slice(t+1)];return{systemInstructions:o,filteredMessages:i}}async function pF(e,t,n){let r=e.catch(a=>{throw xe(a,{mechanism:{handled:!1,type:n}}),a}),o=await t,i=await r;return i&&typeof i=="object"&&"data"in i?{...i,data:o}:o}function Tu(e,t,n){return Bn(e)?new Proxy(e,{get(r,o){let a=o in Promise.prototype||o===Symbol.toStringTag?t:r,s=Reflect.get(a,o);return o==="withResponse"&&typeof s=="function"?function(){let c=s.call(r);return pF(c,t,n)}:typeof s=="function"?s.bind(a):s}}):t}var FN={"responses.create":{operation:"chat"},"chat.completions.create":{operation:"chat"},"embeddings.create":{operation:"embeddings"},"conversations.create":{operation:"chat"}},mF=["response.output_item.added","response.function_call_arguments.delta","response.function_call_arguments.done","response.output_item.done"],HN=["response.created","response.in_progress","response.failed","response.completed","response.incomplete","response.queued","response.output_text.delta",...mF];function GN(e){return e!==null&&typeof e=="object"&&"type"in e&&typeof e.type=="string"&&e.type.startsWith("response.")}function $N(e){return e!==null&&typeof e=="object"&&"object"in e&&e.object==="chat.completion.chunk"}function jN(e,t,n){if(!t||typeof t!="object")return;let r=t,o={};if(typeof r.id=="string"&&(o[ss]=r.id),typeof r.model=="string"&&(o[po]=r.model),r.object==="conversation"&&typeof r.id=="string"&&(o[cp]=r.id),r.usage&&typeof r.usage=="object"){let i=r.usage,a=i.prompt_tokens??i.input_tokens;typeof a=="number"&&(o[mo]=a);let s=i.completion_tokens??i.output_tokens;typeof s=="number"&&(o[go]=s),typeof i.total_tokens=="number"&&(o[Hr]=i.total_tokens)}if(Array.isArray(r.choices)){let i=r.choices,a=i.map(s=>s.finish_reason).filter(s=>typeof s=="string");if(a.length>0&&(o[Ei]=JSON.stringify(a)),n){let s=i.map(c=>c.message?.content||"");o[tr]=JSON.stringify(s);let l=i.map(c=>c.message?.tool_calls).filter(c=>Array.isArray(c)&&c.length>0).flat();l.length>0&&(o[Tr]=JSON.stringify(l))}}if(typeof r.status=="string"&&(o[Ei]||(o[Ei]=JSON.stringify([r.status]))),n&&(typeof r.output_text=="string"&&!o[tr]&&(o[tr]=r.output_text),Array.isArray(r.output)&&r.output.length>0&&!o[Tr])){let i=r.output.filter(a=>a?.type==="function_call");i.length>0&&(o[Tr]=JSON.stringify(i))}e.setAttributes(o)}function gF(e){if("conversation"in e&&typeof e.conversation=="string")return e.conversation;if("previous_response_id"in e&&typeof e.previous_response_id=="string")return e.previous_response_id}function qN(e){let t={[Lt]:e.model??"unknown"};"temperature"in e&&(t[os]=e.temperature),"top_p"in e&&(t[as]=e.top_p),"frequency_penalty"in e&&(t[is]=e.frequency_penalty),"presence_penalty"in e&&(t[vu]=e.presence_penalty),"stream"in e&&(t[yu]=e.stream),"encoding_format"in e&&(t[nb]=e.encoding_format),"dimensions"in e&&(t[rb]=e.dimensions);let n=gF(e);return n&&(t[cp]=n),t}function hF(e,t){for(let n of e){let r=n.index;if(!(r===void 0||!n.function))if(!(r in t.chatCompletionToolCalls))t.chatCompletionToolCalls[r]={...n,function:{name:n.function.name,arguments:n.function.arguments||""}};else{let o=t.chatCompletionToolCalls[r];n.function.arguments&&o?.function&&(o.function.arguments+=n.function.arguments)}}}function bF(e,t,n){t.responseId=e.id??t.responseId,t.responseModel=e.model??t.responseModel,e.usage&&(t.promptTokens=e.usage.prompt_tokens,t.completionTokens=e.usage.completion_tokens,t.totalTokens=e.usage.total_tokens);for(let r of e.choices??[])n&&(r.delta?.content&&t.responseTexts.push(r.delta.content),r.delta?.tool_calls&&hF(r.delta.tool_calls,t)),r.finish_reason&&t.finishReasons.push(r.finish_reason)}function yF(e,t,n,r){if(!(e&&typeof e=="object")){t.eventTypes.push("unknown:non-object");return}if(e instanceof Error){r.setStatus({code:2,message:"internal_error"}),xe(e,{mechanism:{handled:!1,type:"auto.ai.openai.stream-response"}});return}if(!("type"in e))return;let o=e;if(!HN.includes(o.type)){t.eventTypes.push(o.type);return}if(n&&(o.type==="response.output_item.done"&&"item"in o&&t.responsesApiToolCalls.push(o.item),o.type==="response.output_text.delta"&&"delta"in o&&o.delta)){t.responseTexts.push(o.delta);return}if("response"in o){let{response:i}=o;t.responseId=i.id??t.responseId,t.responseModel=i.model??t.responseModel,i.usage&&(t.promptTokens=i.usage.input_tokens,t.completionTokens=i.usage.output_tokens,t.totalTokens=i.usage.total_tokens),i.status&&t.finishReasons.push(i.status),n&&i.output_text&&t.responseTexts.push(i.output_text)}}async function*VN(e,t,n){let r={eventTypes:[],responseTexts:[],finishReasons:[],responseId:"",responseModel:"",promptTokens:void 0,completionTokens:void 0,totalTokens:void 0,chatCompletionToolCalls:{},responsesApiToolCalls:[]};try{for await(let o of e)$N(o)?bF(o,r,n):GN(o)&&yF(o,r,n,t),yield o}finally{let o=[...Object.values(r.chatCompletionToolCalls),...r.responsesApiToolCalls];Il(t,{...r,toolCalls:o},n)}}function _F(e){let t=Array.isArray(e.tools)?e.tools:[],r=e.web_search_options&&typeof e.web_search_options=="object"?[{type:"web_search_options",...e.web_search_options}]:[],o=[...t,...r];if(o.length!==0)try{return JSON.stringify(o)}catch(i){W&&A.error("Failed to serialize OpenAI tools:",i);return}}function vF(e,t){let n={[Si]:"openai",[wn]:t,[le]:"auto.ai.openai"};if(e.length>0&&typeof e[0]=="object"&&e[0]!==null){let r=e[0],o=_F(r);o&&(n[wi]=o),Object.assign(n,qN(r))}else n[Lt]="unknown";return n}function WN(e,t,n,r){if(n==="embeddings"&&"input"in t){let s=t.input;if(s==null||typeof s=="string"&&s.length===0||Array.isArray(s)&&s.length===0)return;e.setAttribute(Su,typeof s=="string"?s:JSON.stringify(s));return}let o="input"in t?t.input:"messages"in t?t.messages:void 0;if(!o||Array.isArray(o)&&o.length===0)return;let{systemInstructions:i,filteredMessages:a}=xi(o);i&&e.setAttribute(Ti,i),e.setAttribute(Jo,r?Zo(a):Qo(a)),Array.isArray(a)?e.setAttribute(ho,a.length):e.setAttribute(ho,1)}function SF(e,t,n,r,o){return function(...a){let s=n.operation||"unknown",l=vF(a,s),c=l[Lt]||"unknown",d=a[0],u=d&&typeof d=="object"&&d.stream===!0,m={name:`${s} ${c}`,op:`gen_ai.${s}`,attributes:l};if(u){let _,y=Qn(m,h=>(_=e.apply(r,a),o.recordInputs&&d&&WN(h,d,s,wr(o.enableTruncation)),(async()=>{try{let v=await _;return VN(v,h,o.recordOutputs??!1)}catch(v){throw h.setStatus({code:2,message:"internal_error"}),xe(v,{mechanism:{handled:!1,type:"auto.ai.openai.stream",data:{function:t}}}),h.end(),v}})()));return Tu(_,y,"auto.ai.openai")}let p,g=mn(m,_=>(p=e.apply(r,a),o.recordInputs&&d&&WN(_,d,s,wr(o.enableTruncation)),p.then(y=>(jN(_,y,o.recordOutputs),y),y=>{throw xe(y,{mechanism:{handled:!1,type:"auto.ai.openai",data:{function:t}}}),y})));return Tu(p,g,"auto.ai.openai")}}function YN(e,t="",n){return new Proxy(e,{get(r,o){let i=r[o],a=Eu(t,String(o)),s=FN[a];return typeof i=="function"&&s?SF(i,a,s,r,n):typeof i=="function"?i.bind(r):i&&typeof i=="object"?YN(i,a,n):i}})}function AS(e,t){return YN(e,"",Gr(t))}var KN={"messages.create":{operation:"chat"},"messages.stream":{operation:"chat",streaming:!0},"messages.countTokens":{operation:"chat"},"models.get":{operation:"models"},"completions.create":{operation:"chat"},"models.retrieve":{operation:"models"},"beta.messages.create":{operation:"chat"}};function XN(e,t,n){if(Array.isArray(t)&&t.length===0)return;let{systemInstructions:r,filteredMessages:o}=xi(t);r&&e.setAttributes({[Ti]:r});let i=Array.isArray(o)?o.length:1;e.setAttributes({[Jo]:n?Zo(o):Qo(o),[ho]:i})}var EF={invalid_request_error:"invalid_argument",authentication_error:"unauthenticated",permission_error:"permission_denied",not_found_error:"not_found",request_too_large:"failed_precondition",rate_limit_error:"resource_exhausted",api_error:"internal_error",overloaded_error:"unavailable"};function IS(e){return e&&EF[e]||"internal_error"}function JN(e,t){t.error&&(e.setStatus({code:2,message:IS(t.error.type)}),xe(t.error,{mechanism:{handled:!1,type:"auto.ai.anthropic.anthropic_error"}}))}function QN(e){let{system:t,messages:n,input:r}=e,o=typeof t=="string"?[{role:"system",content:e.system}]:[],i=Array.isArray(r)?r:r!=null?[r]:void 0,a=Array.isArray(n)?n:n!=null?[n]:[],s=i??a;return[...o,...s]}function TF(e,t){return"type"in e&&typeof e.type=="string"&&e.type==="error"?(t.setStatus({code:2,message:IS(e.error?.type)}),xe(e.error,{mechanism:{handled:!1,type:"auto.ai.anthropic.anthropic_error"}}),!0):!1}function wF(e,t){if(e.type==="message_delta"&&e.usage&&"output_tokens"in e.usage&&typeof e.usage.output_tokens=="number"&&(t.completionTokens=e.usage.output_tokens),e.message){let n=e.message;n.id&&(t.responseId=n.id),n.model&&(t.responseModel=n.model),n.stop_reason&&t.finishReasons.push(n.stop_reason),n.usage&&(typeof n.usage.input_tokens=="number"&&(t.promptTokens=n.usage.input_tokens),typeof n.usage.cache_creation_input_tokens=="number"&&(t.cacheCreationInputTokens=n.usage.cache_creation_input_tokens),typeof n.usage.cache_read_input_tokens=="number"&&(t.cacheReadInputTokens=n.usage.cache_read_input_tokens))}}function xF(e,t){e.type!=="content_block_start"||typeof e.index!="number"||!e.content_block||(e.content_block.type==="tool_use"||e.content_block.type==="server_tool_use")&&(t.activeToolBlocks[e.index]={id:e.content_block.id,name:e.content_block.name,inputJsonParts:[]})}function kF(e,t,n){if(!(e.type!=="content_block_delta"||!e.delta)){if(typeof e.index=="number"&&"partial_json"in e.delta&&typeof e.delta.partial_json=="string"){let r=t.activeToolBlocks[e.index];r&&r.inputJsonParts.push(e.delta.partial_json)}n&&typeof e.delta.text=="string"&&t.responseTexts.push(e.delta.text)}}function AF(e,t){if(e.type!=="content_block_stop"||typeof e.index!="number")return;let n=t.activeToolBlocks[e.index];if(!n)return;let r=n.inputJsonParts.join(""),o;try{o=r?JSON.parse(r):{}}catch{o={__unparsed:r}}t.toolCalls.push({type:"tool_use",id:n.id,name:n.name,input:o}),delete t.activeToolBlocks[e.index]}function ZN(e,t,n,r){!(e&&typeof e=="object")||TF(e,r)||(wF(e,t),xF(e,t),kF(e,t,n),AF(e,t))}async function*eR(e,t,n){let r={responseTexts:[],finishReasons:[],responseId:"",responseModel:"",promptTokens:void 0,completionTokens:void 0,cacheCreationInputTokens:void 0,cacheReadInputTokens:void 0,toolCalls:[],activeToolBlocks:{}};try{for await(let o of e)ZN(o,r,n,t),yield o}finally{Il(t,r,n)}}function tR(e,t,n){let r={responseTexts:[],finishReasons:[],responseId:"",responseModel:"",promptTokens:void 0,completionTokens:void 0,cacheCreationInputTokens:void 0,cacheReadInputTokens:void 0,toolCalls:[],activeToolBlocks:{}};return e.on("streamEvent",o=>{ZN(o,r,n,t)}),e.on("message",()=>{Il(t,r,n)}),e.on("error",o=>{xe(o,{mechanism:{handled:!1,type:"auto.ai.anthropic.stream_error"}}),t.isRecording()&&(t.setStatus({code:2,message:"internal_error"}),t.end())}),e}function IF(e,t,n){let r={[Si]:"anthropic",[wn]:n,[le]:"auto.ai.anthropic"};if(e.length>0&&typeof e[0]=="object"&&e[0]!==null){let o=e[0];o.tools&&Array.isArray(o.tools)&&(r[wi]=JSON.stringify(o.tools)),r[Lt]=o.model??"unknown","temperature"in o&&(r[os]=o.temperature),"top_p"in o&&(r[as]=o.top_p),"stream"in o&&(r[yu]=o.stream),"top_k"in o&&(r[tb]=o.top_k),"frequency_penalty"in o&&(r[is]=o.frequency_penalty),"max_tokens"in o&&(r[_u]=o.max_tokens)}else t==="models.retrieve"||t==="models.get"?r[Lt]=e[0]:r[Lt]="unknown";return r}function NS(e,t,n){let r=QN(t);XN(e,r,n),"prompt"in t&&e.setAttributes({[_N]:JSON.stringify(t.prompt)})}function NF(e,t){if("content"in t&&Array.isArray(t.content)){e.setAttributes({[tr]:t.content.map(r=>r.text).filter(r=>!!r).join("")});let n=[];for(let r of t.content)(r.type==="tool_use"||r.type==="server_tool_use")&&n.push(r);n.length>0&&e.setAttributes({[Tr]:JSON.stringify(n)})}"completion"in t&&e.setAttributes({[tr]:t.completion}),"input_tokens"in t&&e.setAttributes({[tr]:JSON.stringify(t.input_tokens)})}function RF(e,t){"id"in t&&"model"in t&&(e.setAttributes({[ss]:t.id,[po]:t.model}),"usage"in t&&t.usage&&zN(e,t.usage.input_tokens,t.usage.output_tokens,t.usage.cache_creation_input_tokens,t.usage.cache_read_input_tokens))}function CF(e,t,n){if(!(!t||typeof t!="object")){if("type"in t&&t.type==="error"){JN(e,t);return}n&&NF(e,t),RF(e,t)}}function nR(e,t,n){throw xe(e,{mechanism:{handled:!1,type:"auto.ai.anthropic",data:{function:n}}}),t.isRecording()&&(t.setStatus({code:2,message:"internal_error"}),t.end()),e}function MF(e,t,n,r,o,i,a,s,l,c,d){let u=o[Lt]??"unknown",m={name:`${i} ${u}`,op:`gen_ai.${i}`,attributes:o};if(c&&!d){let p,g=Qn(m,_=>(p=e.apply(n,r),l.recordInputs&&s&&NS(_,s,wr(l.enableTruncation)),(async()=>{try{let y=await p;return eR(y,_,l.recordOutputs??!1)}catch(y){return nR(y,_,a)}})()));return Tu(p,g,"auto.ai.anthropic")}else return Qn(m,p=>{try{l.recordInputs&&s&&NS(p,s,wr(l.enableTruncation));let g=t.apply(n,r);return tR(g,p,l.recordOutputs??!1)}catch(g){return nR(g,p,a)}})}function OF(e,t,n,r,o){return new Proxy(e,{apply(i,a,s){let l=n.operation||"unknown",c=IF(s,t,l),d=c[Lt]??"unknown",u=typeof s[0]=="object"?s[0]:void 0,m=!!u?.stream,p=n.streaming===!0;if(m||p)return MF(e,i,r,s,c,l,t,u,o,m,p);let g,_=mn({name:`${l} ${d}`,op:`gen_ai.${l}`,attributes:c},y=>(g=i.apply(r,s),o.recordInputs&&u&&NS(y,u,wr(o.enableTruncation)),g.then(h=>(CF(y,h,o.recordOutputs),h),h=>{throw xe(h,{mechanism:{handled:!1,type:"auto.ai.anthropic",data:{function:t}}}),h})));return Tu(g,_,"auto.ai.anthropic")}})}function rR(e,t="",n){return new Proxy(e,{get(r,o){let i=r[o],a=Eu(t,String(o)),s=KN[a];return typeof i=="function"&&s?OF(i,a,s,r,n):typeof i=="function"?i.bind(r):i&&typeof i=="object"?rR(i,a,n):i}})}function RS(e,t){return rR(e,"",Gr(t))}var oR={"models.generateContent":{operation:"generate_content"},"models.generateContentStream":{operation:"generate_content",streaming:!0},"models.embedContent":{operation:"embeddings"},"chats.create":{proxyResultPath:"chat"},"chat.sendMessage":{operation:"chat"},"chat.sendMessageStream":{operation:"chat",streaming:!0}},iR="google_genai";function DF(e,t){let n=e?.promptFeedback;if(n?.blockReason){let r=n.blockReasonMessage??n.blockReason;return t.setStatus({code:2,message:"internal_error"}),xe(`Content blocked: ${r}`,{mechanism:{handled:!1,type:"auto.ai.google_genai"}}),!0}return!1}function LF(e,t){typeof e.responseId=="string"&&(t.responseId=e.responseId),typeof e.modelVersion=="string"&&(t.responseModel=e.modelVersion);let n=e.usageMetadata;n&&(typeof n.promptTokenCount=="number"&&(t.promptTokens=n.promptTokenCount),typeof n.candidatesTokenCount=="number"&&(t.completionTokens=n.candidatesTokenCount),typeof n.totalTokenCount=="number"&&(t.totalTokens=n.totalTokenCount))}function UF(e,t,n){Array.isArray(e.functionCalls)&&t.toolCalls.push(...e.functionCalls);for(let r of e.candidates??[]){r?.finishReason&&!t.finishReasons.includes(r.finishReason)&&t.finishReasons.push(r.finishReason);for(let o of r?.content?.parts??[])n&&o.text&&t.responseTexts.push(o.text),o.functionCall&&t.toolCalls.push({type:"function",id:o.functionCall.id,name:o.functionCall.name,arguments:o.functionCall.args})}}function PF(e,t,n,r){!e||DF(e,r)||(LF(e,t),UF(e,t,n))}async function*aR(e,t,n){let r={responseTexts:[],finishReasons:[],toolCalls:[]};try{for await(let o of e)PF(o,r,n,t),yield o}finally{Il(t,r,n)}}function wu(e,t="user"){return typeof e=="string"?[{role:t,content:e}]:Array.isArray(e)?e.flatMap(n=>wu(n,t)):typeof e!="object"||!e?[]:"role"in e&&typeof e.role=="string"?[e]:"parts"in e?[{...e,role:t}]:[{role:t,content:e}]}function sR(e,t){if("model"in e&&typeof e.model=="string")return e.model;if(t&&typeof t=="object"){let n=t;if("model"in n&&typeof n.model=="string")return n.model;if("modelVersion"in n&&typeof n.modelVersion=="string")return n.modelVersion}return"unknown"}function BF(e){let t={};return"temperature"in e&&typeof e.temperature=="number"&&(t[os]=e.temperature),"topP"in e&&typeof e.topP=="number"&&(t[as]=e.topP),"topK"in e&&typeof e.topK=="number"&&(t[tb]=e.topK),"maxOutputTokens"in e&&typeof e.maxOutputTokens=="number"&&(t[_u]=e.maxOutputTokens),"frequencyPenalty"in e&&typeof e.frequencyPenalty=="number"&&(t[is]=e.frequencyPenalty),"presencePenalty"in e&&typeof e.presencePenalty=="number"&&(t[vu]=e.presencePenalty),t}function zF(e,t,n){let r={[Si]:iR,[wn]:e,[le]:"auto.ai.google_genai"};if(t){if(r[Lt]=sR(t,n),"config"in t&&typeof t.config=="object"&&t.config){let o=t.config;if(Object.assign(r,BF(o)),"tools"in o&&Array.isArray(o.tools)){let i=o.tools.flatMap(a=>a.functionDeclarations);r[wi]=JSON.stringify(i)}}}else r[Lt]=sR({},n);return r}function lR(e,t,n,r){if(n){let i=t.contents;i!=null&&e.setAttribute(Su,typeof i=="string"?i:JSON.stringify(i));return}let o=[];if("config"in t&&t.config&&typeof t.config=="object"&&"systemInstruction"in t.config&&t.config.systemInstruction&&o.push(...wu(t.config.systemInstruction,"system")),"history"in t&&o.push(...wu(t.history,"user")),"contents"in t&&o.push(...wu(t.contents,"user")),"message"in t&&o.push(...wu(t.message,"user")),Array.isArray(o)&&o.length){let{systemInstructions:i,filteredMessages:a}=xi(o);i&&e.setAttribute(Ti,i);let s=Array.isArray(a)?a.length:0;e.setAttributes({[ho]:s,[Jo]:r?Zo(a):Qo(a)})}}function FF(e,t,n){if(!(!t||typeof t!="object")){if(t.modelVersion&&e.setAttribute(po,t.modelVersion),t.usageMetadata&&typeof t.usageMetadata=="object"){let r=t.usageMetadata;typeof r.promptTokenCount=="number"&&e.setAttributes({[mo]:r.promptTokenCount}),typeof r.candidatesTokenCount=="number"&&e.setAttributes({[go]:r.candidatesTokenCount}),typeof r.totalTokenCount=="number"&&e.setAttributes({[Hr]:r.totalTokenCount})}if(n&&Array.isArray(t.candidates)&&t.candidates.length>0){let r=t.candidates.map(o=>o.content?.parts&&Array.isArray(o.content.parts)?o.content.parts.map(i=>typeof i.text=="string"?i.text:"").filter(i=>i.length>0).join(""):"").filter(o=>o.length>0);r.length>0&&e.setAttributes({[tr]:r.join("")})}if(n&&t.functionCalls){let r=t.functionCalls;Array.isArray(r)&&r.length>0&&e.setAttributes({[Tr]:JSON.stringify(r)})}}}function HF(e,t,n,r,o){let i=n.operation==="embeddings";return new Proxy(e,{apply(a,s,l){let c=n.operation||"unknown",d=l[0],u=zF(c,d,r),m=u[Lt]??"unknown";return n.streaming?Qn({name:`${c} ${m}`,op:`gen_ai.${c}`,attributes:u},async p=>{try{o.recordInputs&&d&&lR(p,d,i,wr(o.enableTruncation));let g=await a.apply(r,l);return aR(g,p,!!o.recordOutputs)}catch(g){throw p.setStatus({code:2,message:"internal_error"}),xe(g,{mechanism:{handled:!1,type:"auto.ai.google_genai",data:{function:t}}}),p.end(),g}}):mn({name:`${c} ${m}`,op:`gen_ai.${c}`,attributes:u},p=>(o.recordInputs&&d&&lR(p,d,i,wr(o.enableTruncation)),qf(()=>a.apply(r,l),g=>{xe(g,{mechanism:{handled:!1,type:"auto.ai.google_genai",data:{function:t}}})},()=>{},g=>{i||FF(p,g,o.recordOutputs)})))}})}function CS(e,t="",n){return new Proxy(e,{get:(r,o,i)=>{let a=Reflect.get(r,o,i),s=Eu(t,String(o)),l=oR[s];if(typeof a=="function"&&l){let c=l.operation?HF(a,s,l,r,n):a.bind(r);return l.proxyResultPath?function(...d){let u=c(...d);return u&&typeof u=="object"?CS(u,l.proxyResultPath,n):u}:c}return typeof a=="function"?a.bind(r):a&&typeof a=="object"?CS(a,s,n):a}})}function MS(e,t){return CS(e,"",Gr(t))}var ta="auto.ai.langchain",cR={human:"user",ai:"assistant",assistant:"assistant",system:"system",function:"function",tool:"tool"};var bo=(e,t,n)=>{n!=null&&(e[t]=n)},$r=(e,t,n)=>{let r=Number(n);Number.isNaN(r)||(e[t]=r)};function Nl(e){if(typeof e=="string")return e;try{return JSON.stringify(e)}catch{return String(e)}}function xu(e){if(Array.isArray(e))try{let t=e.map(n=>n&&typeof n=="object"&&ls(n)?Al(n):n);return JSON.stringify(t)}catch{return String(e)}return Nl(e)}function dp(e){let t=e.toLowerCase();return cR[t]??t}function uR(e){return e.includes("System")?"system":e.includes("Human")?"user":e.includes("AI")||e.includes("Assistant")?"assistant":e.includes("Function")?"function":e.includes("Tool")?"tool":"user"}function OS(e){if(!(!e||Array.isArray(e)))return e.invocation_params}function fp(e){return e.map(t=>{let n=t._getType;if(typeof n=="function"){let o=n.call(t);return{role:dp(o),content:xu(t.content)}}if(t.lc===1&&t.kwargs){let o=t.id,i=Array.isArray(o)&&o.length>0?o[o.length-1]:"",a=typeof i=="string"?uR(i):"user";return{role:dp(a),content:xu(t.kwargs?.content)}}if(t.type){let o=String(t.type).toLowerCase();return{role:dp(o),content:xu(t.content)}}if(t.role)return{role:dp(String(t.role)),content:xu(t.content)};let r=t.constructor?.name;return r&&r!=="Object"?{role:dp(uR(r)),content:xu(t.content)}:{role:"user",content:xu(t.content)}})}function GF(e,t,n){let r={},o="kwargs"in e?e.kwargs:void 0,i=t?.temperature??n?.ls_temperature??o?.temperature;$r(r,os,i);let a=t?.max_tokens??n?.ls_max_tokens??o?.max_tokens;$r(r,_u,a);let s=t?.top_p??o?.top_p;$r(r,as,s);let l=t?.frequency_penalty;$r(r,is,l);let c=t?.presence_penalty;return $r(r,vu,c),t&&"stream"in t&&bo(r,yu,!!t.stream),r}function fR(e,t,n,r,o){return{[Si]:Nl(e??"langchain"),[wn]:"chat",[Lt]:Nl(t),[le]:ta,...GF(n,r,o)}}function pR(e,t,n,r,o,i){let a=i?.ls_provider,s=o?.model??i?.ls_model_name??"unknown",l=fR(a,s,e,o,i);if(n&&Array.isArray(t)&&t.length>0){bo(l,ho,t.length);let c=t.map(d=>({role:"user",content:d}));bo(l,Jo,r?Zo(c):Qo(c))}return l}function mR(e,t,n,r,o,i){let a=i?.ls_provider??e.id?.[2],s=o?.model??i?.ls_model_name??"unknown",l=fR(a,s,e,o,i);if(n&&Array.isArray(t)&&t.length>0){let c=fp(t.flat()),{systemInstructions:d,filteredMessages:u}=xi(c);d&&bo(l,Ti,d);let m=Array.isArray(u)?u.length:0;bo(l,ho,m),bo(l,Jo,r?Zo(u):Qo(u))}return l}function $F(e,t){let n=[],r=e.flat();for(let o of r){let a=o.message?.tool_calls;if(Array.isArray(a)&&a.length>0)n.push(...a);else{let s=o.message?.content;if(Array.isArray(s))for(let l of s){let c=l;c.type==="tool_use"&&n.push(c)}}}n.length>0&&bo(t,Tr,Nl(n))}function jF(e,t){if(!e)return;let n=e.tokenUsage,r=e.usage;if(n)$r(t,mo,n.promptTokens),$r(t,go,n.completionTokens),$r(t,Hr,n.totalTokens);else if(r){$r(t,mo,r.input_tokens),$r(t,go,r.output_tokens);let o=Number(r.input_tokens),i=Number(r.output_tokens),a=(Number.isNaN(o)?0:o)+(Number.isNaN(i)?0:i);a>0&&$r(t,Hr,a),r.cache_creation_input_tokens!==void 0&&$r(t,TN,r.cache_creation_input_tokens),r.cache_read_input_tokens!==void 0&&$r(t,wN,r.cache_read_input_tokens)}}function gR(e,t){if(!e)return;let n={};if(Array.isArray(e.generations)){let c=e.generations.flat().map(d=>d.generationInfo?.finish_reason?d.generationInfo.finish_reason:d.generation_info?.finish_reason?d.generation_info.finish_reason:null).filter(d=>typeof d=="string");if(c.length>0&&bo(n,Ei,Nl(c)),$F(e.generations,n),t){let d=e.generations.flat().map(u=>u.text??u.message?.content).filter(u=>typeof u=="string");d.length>0&&bo(n,tr,Nl(d))}}jF(e.llmOutput,n);let r=e.llmOutput,i=e.generations?.[0]?.[0]?.message,a=r?.model_name??r?.model??i?.response_metadata?.model_name;a&&bo(n,po,a);let s=r?.id??i?.id;s&&bo(n,ss,s);let l=r?.stop_reason??i?.response_metadata?.finish_reason;return l&&bo(n,vN,Nl(l)),n}function cb(e){let t={},n=e?.lc_agent_name;return typeof n=="string"&&(t[kl]=n),t}function hR(e){let t=e?.invocation_params?.tools??e?.options?.tools;if(!Array.isArray(t)||t.length===0)return;let n=t.map(r=>{let o=r.function;return{type:"function",name:r.name??o?.name??"",description:r.description??o?.description}});return JSON.stringify(n)}function qF(e){if(!e||typeof e!="object")return!1;let t=e;return typeof t.addHandler=="function"&&typeof t.copy=="function"}function VF(e){return typeof e=="object"&&e?.name==="SentryCallbackHandler"}function dR(e){return e.some(VF)}function bR(e,t){if(!e)return[t];if(qF(e)){if(dR(e.handlers??[]))return e;let r=e.copy();return r.addHandler(t,!0),r}let n=Array.isArray(e)?e:[e];return dR(n)?e:[...n,t]}function ku(e={}){let{recordInputs:t,recordOutputs:n}=Gr(e),r=wr(e.enableTruncation),o=new Map,i=s=>{let l=o.get(s);l?.isRecording()&&(l.end(),o.delete(s))},a={lc_serializable:!1,lc_namespace:["langchain_core","callbacks","sentry"],lc_secrets:void 0,lc_attributes:void 0,lc_aliases:void 0,lc_serializable_keys:void 0,lc_id:["langchain_core","callbacks","sentry"],lc_kwargs:{},name:"SentryCallbackHandler",ignoreLLM:!1,ignoreChain:!1,ignoreAgent:!1,ignoreRetriever:!1,ignoreCustomEvent:!1,raiseError:!1,awaitHandlers:!0,handleLLMStart(s,l,c,d,u,m,p,g){let _=OS(m),y=pR(s,l,t,r,_,p),h=y[Lt],v=y[wn];Qn({name:`${v} ${h}`,op:"gen_ai.chat",attributes:{...cb(p),...y,[_e]:"gen_ai.chat"}},T=>(o.set(c,T),T))},handleChatModelStart(s,l,c,d,u,m,p,g){let _=OS(m),y=mR(s,l,t,r,_,p),h=hR(u);h&&(y[wi]=h);let v=y[Lt],T=y[wn];Qn({name:`${T} ${v}`,op:"gen_ai.chat",attributes:{...cb(p),...y,[_e]:"gen_ai.chat"}},x=>(o.set(c,x),x))},handleLLMEnd(s,l,c,d,u){let m=o.get(l);if(m?.isRecording()){let p=gR(s,n);p&&m.setAttributes(p),i(l)}},handleLLMError(s,l){let c=o.get(l);c?.isRecording()&&(c.setStatus({code:2,message:"internal_error"}),i(l)),xe(s,{mechanism:{handled:!1,type:`${ta}.llm_error_handler`}})},handleChainStart(s,l,c,d,u,m,p,g){if(m?.__sentry_langgraph__)return;let _=g||s.name||"unknown_chain",y={[le]:"auto.ai.langchain","langchain.chain.name":_};t&&(y["langchain.chain.inputs"]=JSON.stringify(l)),Qn({name:`chain ${_}`,op:"gen_ai.invoke_agent",attributes:{...y,[_e]:"gen_ai.invoke_agent"}},h=>(o.set(c,h),h))},handleChainEnd(s,l){let c=o.get(l);c?.isRecording()&&(n&&c.setAttributes({"langchain.chain.outputs":JSON.stringify(s)}),i(l))},handleChainError(s,l){let c=o.get(l);c?.isRecording()&&(c.setStatus({code:2,message:"internal_error"}),i(l)),xe(s,{mechanism:{handled:!1,type:`${ta}.chain_error_handler`}})},handleToolStart(s,l,c,d,u,m,p){if(m?.__sentry_langgraph__)return;let g=p||s.name||"unknown_tool",_={...cb(m),[le]:ta,[wn]:"execute_tool",[ob]:g};t&&(_[ib]=l),Qn({name:`execute_tool ${g}`,op:"gen_ai.execute_tool",attributes:{..._,[_e]:"gen_ai.execute_tool"}},y=>(o.set(c,y),y))},handleToolEnd(s,l){let c=o.get(l);if(c?.isRecording()){if(n){let d=s,u=d&&typeof d=="object"&&"content"in d?d.content:s;c.setAttributes({[ab]:typeof u=="string"?u:JSON.stringify(u)})}i(l)}},handleToolError(s,l){let c=o.get(l);c?.isRecording()&&(c.setStatus({code:2,message:"internal_error"}),i(l)),xe(s,{mechanism:{handled:!1,type:`${ta}.tool_error_handler`}})},copy(){return a},toJSON(){return{lc:1,type:"not_implemented",id:a.lc_id}},toJSONNotImplemented(){return{lc:1,type:"not_implemented",id:a.lc_id}}};return a}var pp="auto.ai.langgraph";function yR(e){let t=e[0];if(typeof t!="object"||!t||!("llm"in t)||!t.llm||typeof t.llm!="object")return null;let n=t.llm;return typeof n.modelName!="string"&&typeof n.model!="string"?null:n}function _R(e){let t=e[0];return typeof t=="object"&&t&&"name"in t&&typeof t.name=="string"?t.name:null}function vR(e,t,n){let r="__sentry_tool_wrapped__";for(let o of e){if(!o||typeof o!="object")continue;let i=o,a=i.invoke;if(typeof a!="function"||Object.prototype.hasOwnProperty.call(i,r))continue;let s=typeof i.name=="string"?i.name:"unknown_tool",l=typeof i.description=="string"?i.description:void 0,c=new Proxy(a,{apply(d,u,m){let p={[le]:pp,[_e]:wS,[wn]:"execute_tool",[ob]:s,[AN]:"function"},_=m[1]?.metadata?.lc_agent_name??n;typeof _=="string"&&(p[kl]=_),l&&(p[IN]=l);let y=m[0];if(typeof y=="object"&&y&&("id"in y&&typeof y.id=="string"&&(p[kN]=y.id),t.recordInputs)){let h="args"in y&&typeof y.args=="object"?y.args:y;try{p[ib]=JSON.stringify(h)}catch{}}return mn({op:wS,name:`execute_tool ${s}`,attributes:p},async h=>{try{let v=await Reflect.apply(d,u,m);if(t.recordOutputs)try{let T=v,x=T&&typeof T=="object"&&"content"in T?T.content:v;h.setAttribute(ab,typeof x=="string"?x:JSON.stringify(x))}catch{}return v}catch(v){throw h.setStatus({code:2,message:"internal_error"}),xe(v,{mechanism:{handled:!1,type:"auto.ai.langgraph.error"}}),v}})}});i.invoke=c,Object.defineProperty(i,r,{value:!0,enumerable:!1})}return e}function WF(e){if(!e||e.length===0)return null;let t=[];for(let n of e)if(n&&typeof n=="object"){let r=n.tool_calls;r&&Array.isArray(r)&&t.push(...r)}return t.length>0?t:null}function YF(e){let t=e,n=0,r=0,o=0;if(t.usage_metadata&&typeof t.usage_metadata=="object"){let i=t.usage_metadata;return typeof i.input_tokens=="number"&&(n=i.input_tokens),typeof i.output_tokens=="number"&&(r=i.output_tokens),typeof i.total_tokens=="number"&&(o=i.total_tokens),{inputTokens:n,outputTokens:r,totalTokens:o}}if(t.response_metadata&&typeof t.response_metadata=="object"){let i=t.response_metadata;if(i.tokenUsage&&typeof i.tokenUsage=="object"){let a=i.tokenUsage;typeof a.promptTokens=="number"&&(n=a.promptTokens),typeof a.completionTokens=="number"&&(r=a.completionTokens),typeof a.totalTokens=="number"&&(o=a.totalTokens)}}return{inputTokens:n,outputTokens:r,totalTokens:o}}function KF(e,t){let n=t;if(n.response_metadata&&typeof n.response_metadata=="object"){let r=n.response_metadata;r.model_name&&typeof r.model_name=="string"&&e.setAttribute(po,r.model_name),r.finish_reason&&typeof r.finish_reason=="string"&&e.setAttribute(Ei,[r.finish_reason])}}function SR(e){if(!e.builder?.nodes?.tools?.runnable?.tools)return null;let t=e.builder?.nodes?.tools?.runnable?.tools;return!t||!Array.isArray(t)||t.length===0?null:t.map(n=>({name:n.lc_kwargs?.name,description:n.lc_kwargs?.description,schema:n.lc_kwargs?.schema}))}function ER(e,t,n){let o=n?.messages;if(!o||!Array.isArray(o))return;let i=t?.length??0,a=o.length>i?o.slice(i):[];if(a.length===0)return;let s=WF(a);s&&e.setAttribute(Tr,JSON.stringify(s));let l=fp(a);e.setAttribute(tr,JSON.stringify(l));let c=0,d=0,u=0;for(let m of a){let p=YF(m);c+=p.inputTokens,d+=p.outputTokens,u+=p.totalTokens,KF(e,m)}c>0&&e.setAttribute(mo,c),d>0&&e.setAttribute(go,d),u>0&&e.setAttribute(Hr,u)}var DS=!1,ub="__sentry_patched__";function TR(e,t){if(Object.prototype.hasOwnProperty.call(e,ub))return e;let n=ku(t),r=new Proxy(e,{apply(o,i,a){return DS?Reflect.apply(o,i,a):mn({op:"gen_ai.create_agent",name:"create_agent",attributes:{[le]:pp,[_e]:"gen_ai.create_agent",[wn]:"create_agent"}},s=>{try{let l=Reflect.apply(o,i,a),c=a.length>0?a[0]:{};c?.name&&typeof c.name=="string"&&(s.setAttribute(kl,c.name),s.updateName(`create_agent ${c.name}`));let d=l.invoke;return d&&typeof d=="function"&&(l.invoke=wR(d.bind(l),l,c,t,void 0,n)),l}catch(l){throw s.setStatus({code:2,message:"internal_error"}),xe(l,{mechanism:{handled:!1,type:"auto.ai.langgraph.error"}}),l}})}});return Object.defineProperty(r,ub,{value:!0,enumerable:!1}),r}function wR(e,t,n,r,o,i){return new Proxy(e,{apply(a,s,l){let c=o?.modelName??o?.model;return mn({op:"gen_ai.invoke_agent",name:"invoke_agent",attributes:{[le]:pp,[_e]:xN,[wn]:"invoke_agent"}},async d=>{try{let u=n?.name;u&&typeof u=="string"&&(d.setAttribute(EN,u),d.setAttribute(kl,u),d.updateName(`invoke_agent ${u}`)),c&&d.setAttribute(Lt,c);let g=(l.length>1?l[1]:void 0)?.configurable?.thread_id;if(g&&typeof g=="string"&&d.setAttribute(cp,g),i){let x=l[1]??{};l[1]=x;let N=x.metadata??{};x.metadata={...N,__sentry_langgraph__:!0,...typeof u=="string"?{lc_agent_name:u}:{}},x.callbacks=bR(x.callbacks,i)}let _=SR(t);_&&d.setAttribute(wi,JSON.stringify(_));let y=r.recordInputs,h=r.recordOutputs,v=l.length>0?l[0]?.messages??[]:[];if(v&&y){let x=fp(v),{systemInstructions:N,filteredMessages:M}=xi(x);N&&d.setAttribute(Ti,N);let k=wr(r.enableTruncation),P=Array.isArray(M)?M.length:0;d.setAttributes({[Jo]:k?Zo(M):Qo(M),[ho]:P})}let T=await Reflect.apply(a,s,l);return h&&ER(d,v??null,T),T}catch(u){throw d.setStatus({code:2,message:"internal_error"}),xe(u,{mechanism:{handled:!1,type:"auto.ai.langgraph.error"}}),u}})}})}function LS(e,t){if(Object.prototype.hasOwnProperty.call(e,ub))return e;let n=Gr(t),r=ku(n),o=new Proxy(e,{apply(i,a,s){let l=yR(s),c=_R(s),d=s[0];d&&Array.isArray(d.tools)&&d.tools.length>0&&vR(d.tools,n,c??void 0),DS=!0;let u;try{u=Reflect.apply(i,a,s)}finally{DS=!1}let m=u.invoke;if(m&&typeof m=="function"){let p={};c&&(p.name=c),u.invoke=wR(m.bind(u),u,p,n,l,r)}return u}});return Object.defineProperty(o,ub,{value:!0,enumerable:!1}),o}function US(e,t){return e.compile=TR(e.compile,Gr(t)),e}function xR(e,t,n){let r=n.getOptions(),o=n.getDsn(),i=r.tunnel,a=Xo(r._metadata),s={sent_at:new Date(Yn()).toISOString(),...XF(t)&&{trace:t},...a&&{sdk:a},...!!i&&o&&{dsn:pn(o)}},l=n.getDataCollectionOptions().userInfo?"auto":"never",c=[{type:"span",item_count:e.length,content_type:"application/vnd.sentry.items.span.v2+json"},{version:2,...Zn()&&{ingest_settings:{infer_ip:l,infer_user_agent:l}},items:e}];return $t(s,[c])}function XF(e){return!!e.trace_id&&!!e.public_key}function kR(e){let t=156;if(t+=e.name.length*2,t+=vv(e.attributes),e.links&&e.links.length>0){let r=e.links[0]?.attributes,o=100+(r?vv(r):0);t+=o*e.links.length}return t}var AR=1e3,JF=5e6,mp=class{constructor(t,n){this._traceBuckets=new Map,this._client=t;let{maxSpanLimit:r,flushInterval:o,maxTraceWeightInBytes:i}=n??{};this._maxSpanLimit=r&&r>0&&r<=AR?r:AR,this._flushInterval=o&&o>0?o:5e3,this._maxTraceWeight=i&&i>0?i:JF,this._client.on("flush",()=>{this.drain()}),this._client.on("close",()=>{this._traceBuckets.forEach(a=>{clearTimeout(a.timeout)}),this._traceBuckets.clear()})}add(t){let n=t.trace_id,r=this._traceBuckets.get(n);r||(r={spans:new Set,size:0,timeout:es(setTimeout(()=>{this.flush(n)},this._flushInterval))},this._traceBuckets.set(n,r)),r.spans.add(t),r.size+=kR(t),(r.spans.size>=this._maxSpanLimit||r.size>=this._maxTraceWeight)&&this.flush(n)}drain(){this._traceBuckets.size&&(W&&A.log(`Flushing span tree map with ${this._traceBuckets.size} traces`),this._traceBuckets.forEach((t,n)=>{this.flush(n)}))}flush(t){let n=this._traceBuckets.get(t);if(!n)return;if(!n.spans.size){this._removeTrace(t);return}let r=Array.from(n.spans),o=r[0]?._segmentSpan;if(!o){W&&A.warn("No segment span reference found on span JSON, cannot compute DSC"),this._removeTrace(t);return}let i=en(o),a=r.map(l=>{let{_segmentSpan:c,...d}=l;return d}),s=xR(a,i,this._client);W&&A.log(`Sending span envelope for trace ${t} with ${a.length} spans`),this._client.sendEnvelope(s).then(null,l=>{W&&A.error("Error while sending streamed span envelope:",l)}),this._removeTrace(t)}_removeTrace(t){let n=this._traceBuckets.get(t);n&&clearTimeout(n.timeout),this._traceBuckets.delete(t)}};function db(e){if(e!==void 0)return e>=400&&e<500?"warning":e>=500?"error":void 0}var Au=ne;function fb(){return"history"in Au&&!!Au.history}function QF(){if(!("fetch"in Au))return!1;try{return new Headers,new Request("data:,"),new Response,!0}catch{return!1}}function Iu(e){return e&&/^function\s+\w+\(\)\s+\{\s+\[native code\]\s+\}$/.test(e.toString())}function Nu(){if(typeof EdgeRuntime=="string")return!0;if(!QF())return!1;if(Iu(Au.fetch))return!0;let e=!1,t=Au.document;if(t&&typeof t.createElement=="function")try{let n=t.createElement("iframe");n.hidden=!0,t.head.appendChild(n),n.contentWindow?.fetch&&(e=Iu(n.contentWindow.fetch)),t.head.removeChild(n)}catch(n){W&&A.warn("Could not create sandbox iframe for pure fetch check, bailing to window.fetch: ",n)}return e}function pb(){return"ReportingObserver"in Au}function ki(e,t){let n="fetch",r=Vn(n,e);return Wn(n,()=>NR(void 0,t)),r}function gb(e){let t="fetch-body-resolved",n=Vn(t,e);return Wn(t,()=>NR(eH)),n}function NR(e,t=!1){t&&!Nu()||wt(ne,"fetch",function(n){return function(...r){let o=new Error,{method:i,url:a}=tH(r),s={args:r,fetchData:{method:i,url:a},startTimestamp:Ue()*1e3,virtualError:o,headers:nH(r)};return e||un("fetch",{...s}),n.apply(ne,r).then(async l=>(e?e(l):un("fetch",{...s,endTimestamp:Ue()*1e3,response:l}),l),l=>{un("fetch",{...s,endTimestamp:Ue()*1e3,error:l}),En(l)&&l.stack===void 0&&(l.stack=o.stack,Ye(l,"framesToPop",1));let d=q()?.getOptions().enhanceFetchErrorMessages??"always";if(d!==!1&&l instanceof TypeError&&(l.message==="Failed to fetch"||l.message==="Load failed"||l.message==="NetworkError when attempting to fetch resource."))try{let p=new URL(s.fetchData.url).host;d==="always"?l.message=`${l.message} (${p})`:Ye(l,"__sentry_fetch_url_host__",p)}catch{}throw l})}})}async function ZF(e,t){if(e?.body){let n=e.body,r=n.getReader(),o=setTimeout(()=>{n.cancel().then(null,()=>{})},90*1e3),i=!0;for(;i;){let a;try{a=setTimeout(()=>{n.cancel().then(null,()=>{})},5e3);let{done:s}=await r.read();clearTimeout(a),s&&(t(),i=!1)}catch{i=!1}finally{clearTimeout(a)}}clearTimeout(o),r.releaseLock(),n.cancel().then(null,()=>{})}}function eH(e){let t;try{t=e.clone()}catch{return}ZF(t,()=>{un("fetch-body-resolved",{endTimestamp:Ue()*1e3,response:e})})}function mb(e,t){return!!e&&typeof e=="object"&&!!e[t]}function IR(e){return typeof e=="string"?e:e?mb(e,"url")?e.url:e.toString?e.toString():"":""}function tH(e){if(e.length===0)return{method:"GET",url:""};if(e.length===2){let[n,r]=e;return{url:IR(n),method:mb(r,"method")?String(r.method).toUpperCase():kf(n)&&mb(n,"method")?String(n.method).toUpperCase():"GET"}}let t=e[0];return{url:IR(t),method:mb(t,"method")?String(t.method).toUpperCase():"GET"}}function nH(e){let[t,n]=e;try{if(typeof n=="object"&&n!==null&&"headers"in n&&n.headers)return new Headers(n.headers);if(kf(t))return new Headers(t.headers)}catch{}}var RR=ne;function nr(){try{return RR.document.location.href}catch{return""}}function cs(e,t=5){if(!RR.HTMLElement)return null;let n=e;for(let r=0;r<t;r++){if(!n)return null;if(n instanceof HTMLElement){if(n.dataset.sentryComponent)return n.dataset.sentryComponent;if(n.dataset.sentryElement)return n.dataset.sentryElement}n=n.parentNode}return null}function rH(e){let t=e.constructor?.name??"";return t.includes("OpenAI")?"openai":t.includes("Google")?"google_genai":t.includes("Mistral")?"mistralai":t.includes("Vertex")?"google_vertexai":t.includes("Bedrock")?"aws_bedrock":t.includes("Ollama")?"ollama":t.includes("Cloudflare")?"cloudflare":t.includes("Cohere")?"cohere":"langchain"}function oH(e){let t=e??{},n={[le]:ta,[_e]:TS,[wn]:"embeddings",[Lt]:t.model??"unknown"};return n[Si]=rH(t),"dimensions"in t&&(n[rb]=t.dimensions),"encodingFormat"in t&&(n[nb]=t.encodingFormat),n}function CR(e,t={}){let{recordInputs:n}=Gr(t);return new Proxy(e,{apply(r,o,i){let a=oH(o),s=a[Lt]||"unknown";if(n){let l=i[0];l!=null&&(a[Su]=typeof l=="string"?l:JSON.stringify(l))}return mn({name:`embeddings ${s}`,op:TS,attributes:a},()=>Reflect.apply(r,o,i).then(void 0,l=>{throw xe(l,{mechanism:{handled:!1,type:"auto.ai.langchain"}}),l}))}})}function PS(e,t){let n=e;return typeof n.embedQuery=="function"&&(n.embedQuery=CR(n.embedQuery,t)),typeof n.embedDocuments=="function"&&(n.embedDocuments=CR(n.embedDocuments,t)),e}var ei=ne,xt=ei.document,gp=ei.navigator,XR="Report a Bug",AH="Cancel",IH="Send Bug Report",NH="Confirm",RH="Report a Bug",CH="your.email@example.org",MH="Email",OH="What's the bug? What did you expect?",DH="Description",LH="Your Name",UH="Name",PH="Thank you for your report!",BH="(required)",zH="Add a screenshot",FH="Remove screenshot",HH="Highlight",GH="Hide",$H="Remove",JR="Unable to submit feedback with empty message",QR="No client setup, cannot send feedback.",ZR="Unable to determine if Feedback was correctly sent.",eC="Unable to send feedback. This could be because this domain is not in your list of allowed domains.",tC="Unable to send feedback. This could be because of network issues, or because you are using an ad-blocker.",jH="widget",qH="api",VH=5e3,WH={ERROR_EMPTY_MESSAGE:JR,ERROR_NO_CLIENT:QR,ERROR_TIMEOUT:ZR,ERROR_FORBIDDEN:eC,ERROR_GENERIC:tC};function _b(e,t){return t?.[e]??WH[e]}function MR(e,t){return new Error(_b(e,t))}var WS=(e,t={includeReplay:!0})=>{let n=t.errorMessages;if(!e.message)throw MR("ERROR_EMPTY_MESSAGE",n);let r=q();if(!r)throw MR("ERROR_NO_CLIENT",n);e.tags&&Object.keys(e.tags).length&&ae().setTags(e.tags);let o=gu({source:qH,url:nr(),...e},t);return new Promise((i,a)=>{let s=setTimeout(()=>{l(),a(_b("ERROR_TIMEOUT",n))},3e4),l=r.on("afterSendEvent",(c,d)=>{if(c.event_id===o)return clearTimeout(s),l(),d?.statusCode&&d.statusCode>=200&&d.statusCode<300?i(o):d?.statusCode===403?a(_b("ERROR_FORBIDDEN",n)):a(_b("ERROR_GENERIC",n))})})},vb=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__;function YH(){return!(/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(gp.userAgent)||/Macintosh/i.test(gp.userAgent)&&gp.maxTouchPoints&&gp.maxTouchPoints>1||!isSecureContext)}function hb(e,t){return{...e,...t,tags:{...e.tags,...t.tags},onFormOpen:()=>{t.onFormOpen?.(),e.onFormOpen?.()},onFormClose:()=>{t.onFormClose?.(),e.onFormClose?.()},onSubmitSuccess:(n,r)=>{t.onSubmitSuccess?.(n,r),e.onSubmitSuccess?.(n,r)},onSubmitError:n=>{t.onSubmitError?.(n),e.onSubmitError?.(n)},onFormSubmitted:()=>{t.onFormSubmitted?.(),e.onFormSubmitted?.()},themeDark:{...e.themeDark,...t.themeDark},themeLight:{...e.themeLight,...t.themeLight}}}function KH(e){let t=xt.createElement("style");return t.textContent=`
27
- .widget__actor {
28
- position: fixed;
29
- z-index: var(--z-index);
30
- margin: var(--page-margin);
31
- inset: var(--actor-inset);
32
-
33
- display: flex;
34
- align-items: center;
35
- gap: 8px;
36
- padding: 16px;
37
-
38
- font-family: inherit;
39
- font-size: var(--font-size);
40
- font-weight: 600;
41
- line-height: 1.14em;
42
- text-decoration: none;
43
-
44
- background: var(--actor-background, var(--background));
45
- border-radius: var(--actor-border-radius, 1.7em/50%);
46
- border: var(--actor-border, var(--border));
47
- box-shadow: var(--actor-box-shadow, var(--box-shadow));
48
- color: var(--actor-color, var(--foreground));
49
- fill: var(--actor-color, var(--foreground));
50
- cursor: pointer;
51
- opacity: 1;
52
- transition: transform 0.2s ease-in-out;
53
- transform: translate(0, 0) scale(1);
54
- }
55
- .widget__actor[aria-hidden="true"] {
56
- opacity: 0;
57
- pointer-events: none;
58
- visibility: hidden;
59
- transform: translate(0, 16px) scale(0.98);
60
- }
61
-
62
- .widget__actor:hover {
63
- background: var(--actor-hover-background, var(--background));
64
- filter: var(--interactive-filter);
65
- }
66
-
67
- .widget__actor svg {
68
- width: 1.14em;
69
- height: 1.14em;
70
- }
71
-
72
- @media (max-width: 600px) {
73
- .widget__actor span {
74
- display: none;
75
- }
76
- }
77
- `,e&&t.setAttribute("nonce",e),t}function jr(e,t){return Object.entries(t).forEach(([n,r])=>{e.setAttributeNS(null,n,r)}),e}var Ru=20,XH="http://www.w3.org/2000/svg";function JH(){let e=s=>ei.document.createElementNS(XH,s),t=jr(e("svg"),{width:`${Ru}`,height:`${Ru}`,viewBox:`0 0 ${Ru} ${Ru}`,fill:"var(--actor-color, var(--foreground))"}),n=jr(e("g"),{clipPath:"url(#clip0_57_80)"}),r=jr(e("path"),{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M15.6622 15H12.3997C12.2129 14.9959 12.031 14.9396 11.8747 14.8375L8.04965 12.2H7.49956V19.1C7.4875 19.3348 7.3888 19.5568 7.22256 19.723C7.05632 19.8892 6.83435 19.9879 6.59956 20H2.04956C1.80193 19.9968 1.56535 19.8969 1.39023 19.7218C1.21511 19.5467 1.1153 19.3101 1.11206 19.0625V12.2H0.949652C0.824431 12.2017 0.700142 12.1783 0.584123 12.1311C0.468104 12.084 0.362708 12.014 0.274155 11.9255C0.185602 11.8369 0.115689 11.7315 0.0685419 11.6155C0.0213952 11.4995 -0.00202913 11.3752 -0.00034808 11.25V3.75C-0.00900498 3.62067 0.0092504 3.49095 0.0532651 3.36904C0.0972798 3.24712 0.166097 3.13566 0.255372 3.04168C0.344646 2.94771 0.452437 2.87327 0.571937 2.82307C0.691437 2.77286 0.82005 2.74798 0.949652 2.75H8.04965L11.8747 0.1625C12.031 0.0603649 12.2129 0.00407221 12.3997 0H15.6622C15.9098 0.00323746 16.1464 0.103049 16.3215 0.278167C16.4966 0.453286 16.5964 0.689866 16.5997 0.9375V3.25269C17.3969 3.42959 18.1345 3.83026 18.7211 4.41679C19.5322 5.22788 19.9878 6.32796 19.9878 7.47502C19.9878 8.62209 19.5322 9.72217 18.7211 10.5333C18.1345 11.1198 17.3969 11.5205 16.5997 11.6974V14.0125C16.6047 14.1393 16.5842 14.2659 16.5395 14.3847C16.4948 14.5035 16.4268 14.6121 16.3394 14.7042C16.252 14.7962 16.147 14.8698 16.0307 14.9206C15.9144 14.9714 15.7891 14.9984 15.6622 15ZM1.89695 10.325H1.88715V4.625H8.33715C8.52423 4.62301 8.70666 4.56654 8.86215 4.4625L12.6872 1.875H14.7247V13.125H12.6872L8.86215 10.4875C8.70666 10.3835 8.52423 10.327 8.33715 10.325H2.20217C2.15205 10.3167 2.10102 10.3125 2.04956 10.3125C1.9981 10.3125 1.94708 10.3167 1.89695 10.325ZM2.98706 12.2V18.1625H5.66206V12.2H2.98706ZM16.5997 9.93612V5.01393C16.6536 5.02355 16.7072 5.03495 16.7605 5.04814C17.1202 5.13709 17.4556 5.30487 17.7425 5.53934C18.0293 5.77381 18.2605 6.06912 18.4192 6.40389C18.578 6.73866 18.6603 7.10452 18.6603 7.47502C18.6603 7.84552 18.578 8.21139 18.4192 8.54616C18.2605 8.88093 18.0293 9.17624 17.7425 9.41071C17.4556 9.64518 17.1202 9.81296 16.7605 9.90191C16.7072 9.91509 16.6536 9.9265 16.5997 9.93612Z"});t.appendChild(n).appendChild(r);let o=e("defs"),i=jr(e("clipPath"),{id:"clip0_57_80"}),a=jr(e("rect"),{width:`${Ru}`,height:`${Ru}`,fill:"white"});return i.appendChild(a),o.appendChild(i),t.appendChild(o).appendChild(i).appendChild(a),t}function QH({triggerLabel:e,triggerAriaLabel:t,shadow:n,styleNonce:r}){let o=xt.createElement("button");if(o.type="button",o.className="widget__actor",o.ariaHidden="false",o.ariaLabel=t||e||XR,o.appendChild(JH()),e){let a=xt.createElement("span");a.appendChild(xt.createTextNode(e)),o.appendChild(a)}let i=KH(r);return{el:o,appendToDom(){n.appendChild(i),n.appendChild(o)},removeFromDom(){o.remove(),i.remove()},show(){o.ariaHidden="false"},hide(){o.ariaHidden="true"}}}var nC="rgba(88, 74, 192, 1)",ZH={foreground:"#2b2233",background:"#ffffff",accentForeground:"white",accentBackground:nC,successColor:"#268d75",errorColor:"#df3338",border:"1.5px solid rgba(41, 35, 47, 0.13)",boxShadow:"0px 4px 24px 0px rgba(43, 34, 51, 0.12)",outline:"1px auto var(--accent-background)",interactiveFilter:"brightness(95%)"},OR={foreground:"#ebe6ef",background:"#29232f",accentForeground:"white",accentBackground:nC,successColor:"#2da98c",errorColor:"#f55459",border:"1.5px solid rgba(235, 230, 239, 0.15)",boxShadow:"0px 4px 24px 0px rgba(43, 34, 51, 0.12)",outline:"1px auto var(--accent-background)",interactiveFilter:"brightness(150%)"};function DR(e){return`
78
- --foreground: ${e.foreground};
79
- --background: ${e.background};
80
- --accent-foreground: ${e.accentForeground};
81
- --accent-background: ${e.accentBackground};
82
- --success-color: ${e.successColor};
83
- --error-color: ${e.errorColor};
84
- --border: ${e.border};
85
- --box-shadow: ${e.boxShadow};
86
- --outline: ${e.outline};
87
- --interactive-filter: ${e.interactiveFilter};
88
- `}function LR({colorScheme:e,themeDark:t,themeLight:n,styleNonce:r}){let o=xt.createElement("style");return o.textContent=`
89
- :host {
90
- --font-family: system-ui, 'Helvetica Neue', Arial, sans-serif;
91
- --font-size: 14px;
92
- --z-index: 100000;
93
-
94
- --page-margin: 16px;
95
- --inset: auto 0 0 auto;
96
- --actor-inset: var(--inset);
97
-
98
- font-family: var(--font-family);
99
- font-size: var(--font-size);
100
-
101
- ${e!=="system"?`color-scheme: only ${e};`:""}
102
-
103
- ${DR(e==="dark"?{...OR,...t}:{...ZH,...n})}
104
- }
105
-
106
- ${e==="system"?`
107
- @media (prefers-color-scheme: dark) {
108
- :host {
109
- color-scheme: only dark;
110
-
111
- ${DR({...OR,...t})}
112
- }
113
- }`:""}
114
- `,r&&o.setAttribute("nonce",r),o}var kb=({lazyLoadIntegration:e,getModalIntegration:t,getScreenshotIntegration:n})=>(({id:o="sentry-feedback",autoInject:i=!0,showBranding:a=!0,isEmailRequired:s=!1,isNameRequired:l=!1,showEmail:c=!0,showName:d=!0,enableScreenshot:u=!0,useSentryUser:m={email:"email",name:"username"},tags:p,styleNonce:g,scriptNonce:_,colorScheme:y="system",themeLight:h={},themeDark:v={},addScreenshotButtonLabel:T=zH,cancelButtonLabel:x=AH,confirmButtonLabel:N=NH,emailLabel:M=MH,emailPlaceholder:k=CH,formTitle:P=RH,isRequiredLabel:F=BH,messageLabel:U=DH,messagePlaceholder:X=OH,nameLabel:G=UH,namePlaceholder:R=LH,removeScreenshotButtonLabel:C=FH,submitButtonLabel:$=IH,successMessageText:ee=PH,triggerLabel:B=XR,triggerAriaLabel:H="",highlightToolText:se=HH,hideToolText:te=GH,removeHighlightText:ve=$H,errorEmptyMessageText:pe=JR,errorNoClientText:Ge=QR,errorTimeoutText:re=ZR,errorForbiddenText:Je=eC,errorGenericText:Kt=tC,onFormOpen:it,onFormClose:Z,onSubmitSuccess:Le,onSubmitError:De,onFormSubmitted:et}={})=>{let dt={id:o,autoInject:i,showBranding:a,isEmailRequired:s,isNameRequired:l,showEmail:c,showName:d,enableScreenshot:u,useSentryUser:m,tags:p,styleNonce:g,scriptNonce:_,colorScheme:y,themeDark:v,themeLight:h,triggerLabel:B,triggerAriaLabel:H,cancelButtonLabel:x,submitButtonLabel:$,confirmButtonLabel:N,formTitle:P,emailLabel:M,emailPlaceholder:k,messageLabel:U,messagePlaceholder:X,nameLabel:G,namePlaceholder:R,successMessageText:ee,isRequiredLabel:F,addScreenshotButtonLabel:T,removeScreenshotButtonLabel:C,highlightToolText:se,hideToolText:te,removeHighlightText:ve,errorEmptyMessageText:pe,errorNoClientText:Ge,errorTimeoutText:re,errorForbiddenText:Je,errorGenericText:Kt,onFormClose:Z,onFormOpen:it,onSubmitError:De,onSubmitSuccess:Le,onFormSubmitted:et},me=null,lt=null,we=[],tt=ue=>{if(!me){let Ve=xt.createElement("div");Ve.id=String(ue.id),xt.body.appendChild(Ve),me=Ve.attachShadow({mode:"open"}),lt=LR(ue),me.appendChild(lt)}return me},vn=async ue=>{let Ve=ue.enableScreenshot&&YH(),Te,We;try{Te=(t?t():await e("feedbackModalIntegration",_))(),_l(Te)}catch{throw vb&&A.error("[Feedback] Error when trying to load feedback integrations. Try using `feedbackSyncIntegration` in your `Sentry.init`."),new Error("[Feedback] Missing feedback modal integration!")}try{let $e=Ve?n?n():await e("feedbackScreenshotIntegration",_):void 0;$e&&(We=$e(),_l(We))}catch{vb&&A.error("[Feedback] Missing feedback screenshot integration. Proceeding without screenshots.")}let oe={ERROR_EMPTY_MESSAGE:ue.errorEmptyMessageText,ERROR_NO_CLIENT:ue.errorNoClientText,ERROR_TIMEOUT:ue.errorTimeoutText,ERROR_FORBIDDEN:ue.errorForbiddenText,ERROR_GENERIC:ue.errorGenericText},ge=($e,at)=>WS($e,{includeReplay:!0,...at,errorMessages:oe}),Ce=Te.createDialog({options:{...ue,onFormClose:()=>{Ce?.close(),ue.onFormClose?.()},onFormSubmitted:()=>{Ce?.close(),ue.onFormSubmitted?.()}},screenshotIntegration:We,sendFeedback:ge,shadow:tt(ue)});return Ce},An=(ue,Ve={})=>{let Te=hb(dt,Ve),We=typeof ue=="string"?xt.querySelector(ue):typeof ue.addEventListener=="function"?ue:null;if(!We)throw vb&&A.error("[Feedback] Unable to attach to target element"),new Error("Unable to attach to target element");let oe=null,ge=async()=>{oe||(oe=await vn({...Te,onFormSubmitted:()=>{oe?.removeFromDom(),Te.onFormSubmitted?.()}})),oe.appendToDom(),oe.open()};We.addEventListener("click",ge);let Ce=()=>{we=we.filter($e=>$e!==Ce),oe?.removeFromDom(),oe=null,We.removeEventListener("click",ge)};return we.push(Ce),Ce},an=(ue={})=>{let Ve=hb(dt,ue),Te=tt(Ve),We=QH({triggerLabel:Ve.triggerLabel,triggerAriaLabel:Ve.triggerAriaLabel,shadow:Te,styleNonce:g});return An(We.el,{...Ve,onFormOpen(){We.hide()},onFormClose(){We.show()},onFormSubmitted(){We.show()}}),We};return{name:"Feedback",setupOnce(){!Zn()||!dt.autoInject||(xt.readyState==="loading"?xt.addEventListener("DOMContentLoaded",()=>an().appendToDom()):an().appendToDom())},attachTo:An,createWidget(ue={}){let Ve=an(hb(dt,ue));return Ve.appendToDom(),Ve},async createForm(ue={}){return vn(hb(dt,ue))},setTheme(ue){if(dt.colorScheme=ue,me){let Ve=LR(dt);lt?me.replaceChild(Ve,lt):me.prepend(Ve),lt=Ve}},remove(){me&&(me.parentElement?.remove(),me=null,lt=null),we.forEach(ue=>ue()),we=[]}}});function rC(){return q()?.getIntegrationByName("Feedback")}var Ab,At,oC,Rl,UR,iC,$S,hp={},YS=[],e7=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,KS=Array.isArray;function ds(e,t){for(var n in t)e[n]=t[n];return e}function aC(e){var t=e.parentNode;t&&t.removeChild(e)}function Xe(e,t,n){var r,o,i,a={};for(i in t)i=="key"?r=t[i]:i=="ref"?o=t[i]:a[i]=t[i];if(arguments.length>2&&(a.children=arguments.length>3?Ab.call(arguments,2):n),typeof e=="function"&&e.defaultProps!=null)for(i in e.defaultProps)a[i]===void 0&&(a[i]=e.defaultProps[i]);return Sb(e,a,r,o,null)}function Sb(e,t,n,r,o){var i={type:e,props:t,key:n,ref:r,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,constructor:void 0,__v:o??++oC,__i:-1,__u:0};return o==null&&At.vnode!=null&&At.vnode(i),i}function bp(e){return e.children}function Eb(e,t){this.props=e,this.context=t}function Mu(e,t){if(t==null)return e.__?Mu(e.__,e.__i+1):null;for(var n;t<e.__k.length;t++)if((n=e.__k[t])!=null&&n.__e!=null)return n.__e;return typeof e.type=="function"?Mu(e):null}function t7(e,t,n){var r,o=e.__v,i=o.__e,a=e.__P;if(a)return(r=ds({},o)).__v=o.__v+1,At.vnode&&At.vnode(r),XS(a,r,o,e.__n,a.ownerSVGElement!==void 0,32&o.__u?[i]:null,t,i??Mu(o),!!(32&o.__u),n),r.__.__k[r.__i]=r,r.__d=void 0,r.__e!=i&&sC(r),r}function sC(e){var t,n;if((e=e.__)!=null&&e.__c!=null){for(e.__e=e.__c.base=null,t=0;t<e.__k.length;t++)if((n=e.__k[t])!=null&&n.__e!=null){e.__e=e.__c.base=n.__e;break}return sC(e)}}function PR(e){(!e.__d&&(e.__d=!0)&&Rl.push(e)&&!xb.__r++||UR!==At.debounceRendering)&&((UR=At.debounceRendering)||iC)(xb)}function xb(){var e,t,n,r=[],o=[];for(Rl.sort($S);e=Rl.shift();)e.__d&&(n=Rl.length,t=t7(e,r,o)||t,n===0||Rl.length>n?(jS(r,t,o),o.length=r.length=0,t=void 0,Rl.sort($S)):t&&At.__c&&At.__c(t,YS));t&&jS(r,t,o),xb.__r=0}function lC(e,t,n,r,o,i,a,s,l,c,d){var u,m,p,g,_,y=r&&r.__k||YS,h=t.length;for(n.__d=l,n7(n,t,y),l=n.__d,u=0;u<h;u++)(p=n.__k[u])!=null&&typeof p!="boolean"&&typeof p!="function"&&(m=p.__i===-1?hp:y[p.__i]||hp,p.__i=u,XS(e,p,m,o,i,a,s,l,c,d),g=p.__e,p.ref&&m.ref!=p.ref&&(m.ref&&JS(m.ref,null,p),d.push(p.ref,p.__c||g,p)),_==null&&g!=null&&(_=g),65536&p.__u||m.__k===p.__k?l=cC(p,l,e):typeof p.type=="function"&&p.__d!==void 0?l=p.__d:g&&(l=g.nextSibling),p.__d=void 0,p.__u&=-196609);n.__d=l,n.__e=_}function n7(e,t,n){var r,o,i,a,s,l=t.length,c=n.length,d=c,u=0;for(e.__k=[],r=0;r<l;r++)(o=e.__k[r]=(o=t[r])==null||typeof o=="boolean"||typeof o=="function"?null:typeof o=="string"||typeof o=="number"||typeof o=="bigint"||o.constructor==String?Sb(null,o,null,null,o):KS(o)?Sb(bp,{children:o},null,null,null):o.constructor===void 0&&o.__b>0?Sb(o.type,o.props,o.key,o.ref?o.ref:null,o.__v):o)!=null?(o.__=e,o.__b=e.__b+1,s=r7(o,n,a=r+u,d),o.__i=s,i=null,s!==-1&&(d--,(i=n[s])&&(i.__u|=131072)),i==null||i.__v===null?(s==-1&&u--,typeof o.type!="function"&&(o.__u|=65536)):s!==a&&(s===a+1?u++:s>a?d>l-a?u+=s-a:u--:u=s<a&&s==a-1?s-a:0,s!==r+u&&(o.__u|=65536))):(i=n[r])&&i.key==null&&i.__e&&(i.__e==e.__d&&(e.__d=Mu(i)),qS(i,i,!1),n[r]=null,d--);if(d)for(r=0;r<c;r++)(i=n[r])!=null&&(131072&i.__u)==0&&(i.__e==e.__d&&(e.__d=Mu(i)),qS(i,i))}function cC(e,t,n){var r,o;if(typeof e.type=="function"){for(r=e.__k,o=0;r&&o<r.length;o++)r[o]&&(r[o].__=e,t=cC(r[o],t,n));return t}e.__e!=t&&(n.insertBefore(e.__e,t||null),t=e.__e);do t=t&&t.nextSibling;while(t!=null&&t.nodeType===8);return t}function r7(e,t,n,r){var o=e.key,i=e.type,a=n-1,s=n+1,l=t[n];if(l===null||l&&o==l.key&&i===l.type)return n;if(r>(l!=null&&(131072&l.__u)==0?1:0))for(;a>=0||s<t.length;){if(a>=0){if((l=t[a])&&(131072&l.__u)==0&&o==l.key&&i===l.type)return a;a--}if(s<t.length){if((l=t[s])&&(131072&l.__u)==0&&o==l.key&&i===l.type)return s;s++}}return-1}function BR(e,t,n){t[0]==="-"?e.setProperty(t,n??""):e[t]=n==null?"":typeof n!="number"||e7.test(t)?n:n+"px"}function bb(e,t,n,r,o){var i;e:if(t==="style")if(typeof n=="string")e.style.cssText=n;else{if(typeof r=="string"&&(e.style.cssText=r=""),r)for(t in r)n&&t in n||BR(e.style,t,"");if(n)for(t in n)r&&n[t]===r[t]||BR(e.style,t,n[t])}else if(t[0]==="o"&&t[1]==="n")i=t!==(t=t.replace(/(PointerCapture)$|Capture$/i,"$1")),t=t.toLowerCase()in e?t.toLowerCase().slice(2):t.slice(2),e.l||(e.l={}),e.l[t+i]=n,n?r?n.u=r.u:(n.u=Date.now(),e.addEventListener(t,i?FR:zR,i)):e.removeEventListener(t,i?FR:zR,i);else{if(o)t=t.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(t!=="width"&&t!=="height"&&t!=="href"&&t!=="list"&&t!=="form"&&t!=="tabIndex"&&t!=="download"&&t!=="rowSpan"&&t!=="colSpan"&&t!=="role"&&t in e)try{e[t]=n??"";break e}catch{}typeof n=="function"||(n==null||n===!1&&t[4]!=="-"?e.removeAttribute(t):e.setAttribute(t,n))}}function zR(e){if(this.l){var t=this.l[e.type+!1];if(e.t){if(e.t<=t.u)return}else e.t=Date.now();return t(At.event?At.event(e):e)}}function FR(e){if(this.l)return this.l[e.type+!0](At.event?At.event(e):e)}function XS(e,t,n,r,o,i,a,s,l,c){var d,u,m,p,g,_,y,h,v,T,x,N,M,k,P,F=t.type;if(t.constructor!==void 0)return null;128&n.__u&&(l=!!(32&n.__u),i=[s=t.__e=n.__e]),(d=At.__b)&&d(t);e:if(typeof F=="function")try{if(h=t.props,v=(d=F.contextType)&&r[d.__c],T=d?v?v.props.value:d.__:r,n.__c?y=(u=t.__c=n.__c).__=u.__E:("prototype"in F&&F.prototype.render?t.__c=u=new F(h,T):(t.__c=u=new Eb(h,T),u.constructor=F,u.render=i7),v&&v.sub(u),u.props=h,u.state||(u.state={}),u.context=T,u.__n=r,m=u.__d=!0,u.__h=[],u._sb=[]),u.__s==null&&(u.__s=u.state),F.getDerivedStateFromProps!=null&&(u.__s==u.state&&(u.__s=ds({},u.__s)),ds(u.__s,F.getDerivedStateFromProps(h,u.__s))),p=u.props,g=u.state,u.__v=t,m)F.getDerivedStateFromProps==null&&u.componentWillMount!=null&&u.componentWillMount(),u.componentDidMount!=null&&u.__h.push(u.componentDidMount);else{if(F.getDerivedStateFromProps==null&&h!==p&&u.componentWillReceiveProps!=null&&u.componentWillReceiveProps(h,T),!u.__e&&(u.shouldComponentUpdate!=null&&u.shouldComponentUpdate(h,u.__s,T)===!1||t.__v===n.__v)){for(t.__v!==n.__v&&(u.props=h,u.state=u.__s,u.__d=!1),t.__e=n.__e,t.__k=n.__k,t.__k.forEach(function(U){U&&(U.__=t)}),x=0;x<u._sb.length;x++)u.__h.push(u._sb[x]);u._sb=[],u.__h.length&&a.push(u);break e}u.componentWillUpdate!=null&&u.componentWillUpdate(h,u.__s,T),u.componentDidUpdate!=null&&u.__h.push(function(){u.componentDidUpdate(p,g,_)})}if(u.context=T,u.props=h,u.__P=e,u.__e=!1,N=At.__r,M=0,"prototype"in F&&F.prototype.render){for(u.state=u.__s,u.__d=!1,N&&N(t),d=u.render(u.props,u.state,u.context),k=0;k<u._sb.length;k++)u.__h.push(u._sb[k]);u._sb=[]}else do u.__d=!1,N&&N(t),d=u.render(u.props,u.state,u.context),u.state=u.__s;while(u.__d&&++M<25);u.state=u.__s,u.getChildContext!=null&&(r=ds(ds({},r),u.getChildContext())),m||u.getSnapshotBeforeUpdate==null||(_=u.getSnapshotBeforeUpdate(p,g)),lC(e,KS(P=d!=null&&d.type===bp&&d.key==null?d.props.children:d)?P:[P],t,n,r,o,i,a,s,l,c),u.base=t.__e,t.__u&=-161,u.__h.length&&a.push(u),y&&(u.__E=u.__=null)}catch(U){t.__v=null,l||i!=null?(t.__e=s,t.__u|=l?160:32,i[i.indexOf(s)]=null):(t.__e=n.__e,t.__k=n.__k),At.__e(U,t,n)}else i==null&&t.__v===n.__v?(t.__k=n.__k,t.__e=n.__e):t.__e=o7(n.__e,t,n,r,o,i,a,l,c);(d=At.diffed)&&d(t)}function jS(e,t,n){for(var r=0;r<n.length;r++)JS(n[r],n[++r],n[++r]);At.__c&&At.__c(t,e),e.some(function(o){try{e=o.__h,o.__h=[],e.some(function(i){i.call(o)})}catch(i){At.__e(i,o.__v)}})}function o7(e,t,n,r,o,i,a,s,l){var c,d,u,m,p,g,_,y=n.props,h=t.props,v=t.type;if(v==="svg"&&(o=!0),i!=null){for(c=0;c<i.length;c++)if((p=i[c])&&"setAttribute"in p==!!v&&(v?p.localName===v:p.nodeType===3)){e=p,i[c]=null;break}}if(e==null){if(v===null)return document.createTextNode(h);e=o?document.createElementNS("http://www.w3.org/2000/svg",v):document.createElement(v,h.is&&h),i=null,s=!1}if(v===null)y===h||s&&e.data===h||(e.data=h);else{if(i=i&&Ab.call(e.childNodes),y=n.props||hp,!s&&i!=null)for(y={},c=0;c<e.attributes.length;c++)y[(p=e.attributes[c]).name]=p.value;for(c in y)p=y[c],c=="children"||(c=="dangerouslySetInnerHTML"?u=p:c==="key"||c in h||bb(e,c,null,p,o));for(c in h)p=h[c],c=="children"?m=p:c=="dangerouslySetInnerHTML"?d=p:c=="value"?g=p:c=="checked"?_=p:c==="key"||s&&typeof p!="function"||y[c]===p||bb(e,c,p,y[c],o);if(d)s||u&&(d.__html===u.__html||d.__html===e.innerHTML)||(e.innerHTML=d.__html),t.__k=[];else if(u&&(e.innerHTML=""),lC(e,KS(m)?m:[m],t,n,r,o&&v!=="foreignObject",i,a,i?i[0]:n.__k&&Mu(n,0),s,l),i!=null)for(c=i.length;c--;)i[c]!=null&&aC(i[c]);s||(c="value",g!==void 0&&(g!==e[c]||v==="progress"&&!g||v==="option"&&g!==y[c])&&bb(e,c,g,y[c],!1),c="checked",_!==void 0&&_!==e[c]&&bb(e,c,_,y[c],!1))}return e}function JS(e,t,n){try{typeof e=="function"?e(t):e.current=t}catch(r){At.__e(r,n)}}function qS(e,t,n){var r,o;if(At.unmount&&At.unmount(e),(r=e.ref)&&(r.current&&r.current!==e.__e||JS(r,null,t)),(r=e.__c)!=null){if(r.componentWillUnmount)try{r.componentWillUnmount()}catch(i){At.__e(i,t)}r.base=r.__P=null,e.__c=void 0}if(r=e.__k)for(o=0;o<r.length;o++)r[o]&&qS(r[o],t,n||typeof e.type!="function");n||e.__e==null||aC(e.__e),e.__=e.__e=e.__d=void 0}function i7(e,t,n){return this.constructor(e,n)}function a7(e,t,n){var r,o,i,a;At.__&&At.__(e,t),o=(r=!1)?null:t.__k,i=[],a=[],XS(t,e=t.__k=Xe(bp,null,[e]),o||hp,hp,t.ownerSVGElement!==void 0,o?null:t.firstChild?Ab.call(t.childNodes):null,i,o?o.__e:t.firstChild,r,a),e.__d=void 0,jS(i,e,a)}Ab=YS.slice,At={__e:function(e,t,n,r){for(var o,i,a;t=t.__;)if((o=t.__c)&&!o.__)try{if((i=o.constructor)&&i.getDerivedStateFromError!=null&&(o.setState(i.getDerivedStateFromError(e)),a=o.__d),o.componentDidCatch!=null&&(o.componentDidCatch(e,r||{}),a=o.__d),a)return o.__E=o}catch(s){e=s}throw e}},oC=0,Eb.prototype.setState=function(e,t){var n;n=this.__s!=null&&this.__s!==this.state?this.__s:this.__s=ds({},this.state),typeof e=="function"&&(e=e(ds({},n),this.props)),e&&ds(n,e),e!=null&&this.__v&&(t&&this._sb.push(t),PR(this))},Eb.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),PR(this))},Eb.prototype.render=bp,Rl=[],iC=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,$S=function(e,t){return e.__v.__b-t.__v.__b},xb.__r=0;var na,kt,BS,HR,Ou=0,uC=[],Tb=[],Zt=At,GR=Zt.__b,$R=Zt.__r,jR=Zt.diffed,qR=Zt.__c,VR=Zt.unmount,WR=Zt.__;function Ml(e,t){Zt.__h&&Zt.__h(kt,e,Ou||t),Ou=0;var n=kt.__H||(kt.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({__V:Tb}),n.__[e]}function Cl(e){return Ou=1,dC(pC,e)}function dC(e,t,n){var r=Ml(na++,2);if(r.t=e,!r.__c&&(r.__=[n?n(t):pC(void 0,t),function(s){var l=r.__N?r.__N[0]:r.__[0],c=r.t(l,s);l!==c&&(r.__N=[c,r.__[1]],r.__c.setState({}))}],r.__c=kt,!kt.u)){var o=function(s,l,c){if(!r.__c.__H)return!0;var d=r.__c.__H.__.filter(function(m){return!!m.__c});if(d.every(function(m){return!m.__N}))return!i||i.call(this,s,l,c);var u=!1;return d.forEach(function(m){if(m.__N){var p=m.__[0];m.__=m.__N,m.__N=void 0,p!==m.__[0]&&(u=!0)}}),!(!u&&r.__c.props===s)&&(!i||i.call(this,s,l,c))};kt.u=!0;var i=kt.shouldComponentUpdate,a=kt.componentWillUpdate;kt.componentWillUpdate=function(s,l,c){if(this.__e){var d=i;i=void 0,o(s,l,c),i=d}a&&a.call(this,s,l,c)},kt.shouldComponentUpdate=o}return r.__N||r.__}function s7(e,t){var n=Ml(na++,3);!Zt.__s&&QS(n.__H,t)&&(n.__=e,n.i=t,kt.__H.__h.push(n))}function fC(e,t){var n=Ml(na++,4);!Zt.__s&&QS(n.__H,t)&&(n.__=e,n.i=t,kt.__h.push(n))}function l7(e){return Ou=5,yp(function(){return{current:e}},[])}function c7(e,t,n){Ou=6,fC(function(){return typeof e=="function"?(e(t()),function(){return e(null)}):e?(e.current=t(),function(){return e.current=null}):void 0},n==null?n:n.concat(e))}function yp(e,t){var n=Ml(na++,7);return QS(n.__H,t)?(n.__V=e(),n.i=t,n.__h=e,n.__V):n.__}function Cu(e,t){return Ou=8,yp(function(){return e},t)}function u7(e){var t=kt.context[e.__c],n=Ml(na++,9);return n.c=e,t?(n.__==null&&(n.__=!0,t.sub(kt)),t.props.value):e.__}function d7(e,t){Zt.useDebugValue&&Zt.useDebugValue(t?t(e):e)}function f7(e){var t=Ml(na++,10),n=Cl();return t.__=e,kt.componentDidCatch||(kt.componentDidCatch=function(r,o){t.__&&t.__(r,o),n[1](r)}),[n[0],function(){n[1](void 0)}]}function p7(){var e=Ml(na++,11);if(!e.__){for(var t=kt.__v;t!==null&&!t.__m&&t.__!==null;)t=t.__;var n=t.__m||(t.__m=[0,0]);e.__="P"+n[0]+"-"+n[1]++}return e.__}function m7(){for(var e;e=uC.shift();)if(e.__P&&e.__H)try{e.__H.__h.forEach(wb),e.__H.__h.forEach(VS),e.__H.__h=[]}catch(t){e.__H.__h=[],Zt.__e(t,e.__v)}}Zt.__b=function(e){kt=null,GR&&GR(e)},Zt.__=function(e,t){t.__k&&t.__k.__m&&(e.__m=t.__k.__m),WR&&WR(e,t)},Zt.__r=function(e){$R&&$R(e),na=0;var t=(kt=e.__c).__H;t&&(BS===kt?(t.__h=[],kt.__h=[],t.__.forEach(function(n){n.__N&&(n.__=n.__N),n.__V=Tb,n.__N=n.i=void 0})):(t.__h.forEach(wb),t.__h.forEach(VS),t.__h=[],na=0)),BS=kt},Zt.diffed=function(e){jR&&jR(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(uC.push(t)!==1&&HR===Zt.requestAnimationFrame||((HR=Zt.requestAnimationFrame)||g7)(m7)),t.__H.__.forEach(function(n){n.i&&(n.__H=n.i),n.__V!==Tb&&(n.__=n.__V),n.i=void 0,n.__V=Tb})),BS=kt=null},Zt.__c=function(e,t){t.some(function(n){try{n.__h.forEach(wb),n.__h=n.__h.filter(function(r){return!r.__||VS(r)})}catch(r){t.some(function(o){o.__h&&(o.__h=[])}),t=[],Zt.__e(r,n.__v)}}),qR&&qR(e,t)},Zt.unmount=function(e){VR&&VR(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.forEach(function(r){try{wb(r)}catch(o){t=o}}),n.__H=void 0,t&&Zt.__e(t,n.__v))};var YR=typeof requestAnimationFrame=="function";function g7(e){var t,n=function(){clearTimeout(r),YR&&cancelAnimationFrame(t),setTimeout(e)},r=setTimeout(n,100);YR&&(t=requestAnimationFrame(n))}function wb(e){var t=kt,n=e.__c;typeof n=="function"&&(e.__c=void 0,n()),kt=t}function VS(e){var t=kt;e.__c=e.__(),kt=t}function QS(e,t){return!e||e.length!==t.length||t.some(function(n,r){return n!==e[r]})}function pC(e,t){return typeof t=="function"?t(e):t}var h7=Object.defineProperty({__proto__:null,useCallback:Cu,useContext:u7,useDebugValue:d7,useEffect:s7,useErrorBoundary:f7,useId:p7,useImperativeHandle:c7,useLayoutEffect:fC,useMemo:yp,useReducer:dC,useRef:l7,useState:Cl},Symbol.toStringTag,{value:"Module"}),b7="http://www.w3.org/2000/svg";function y7(){let e=r=>xt.createElementNS(b7,r),t=jr(e("svg"),{width:"32",height:"30",viewBox:"0 0 72 66",fill:"inherit"}),n=jr(e("path"),{transform:"translate(11, 11)",d:"M29,2.26a4.67,4.67,0,0,0-8,0L14.42,13.53A32.21,32.21,0,0,1,32.17,40.19H27.55A27.68,27.68,0,0,0,12.09,17.47L6,28a15.92,15.92,0,0,1,9.23,12.17H4.62A.76.76,0,0,1,4,39.06l2.94-5a10.74,10.74,0,0,0-3.36-1.9l-2.91,5a4.54,4.54,0,0,0,1.69,6.24A4.66,4.66,0,0,0,4.62,44H19.15a19.4,19.4,0,0,0-8-17.31l2.31-4A23.87,23.87,0,0,1,23.76,44H36.07a35.88,35.88,0,0,0-16.41-31.8l4.67-8a.77.77,0,0,1,1.05-.27c.53.29,20.29,34.77,20.66,35.17a.76.76,0,0,1-.68,1.13H40.6q.09,1.91,0,3.81h4.78A4.59,4.59,0,0,0,50,39.43a4.49,4.49,0,0,0-.62-2.28Z"});return t.appendChild(n),t}function _7({options:e}){let t=yp(()=>({__html:y7().outerHTML}),[]);return Xe("h2",{class:"dialog__header"},Xe("span",{class:"dialog__title"},e.formTitle),e.showBranding?Xe("a",{class:"brand-link",target:"_blank",href:"https://sentry.io/welcome/",title:"Powered by Sentry",rel:"noopener noreferrer",dangerouslySetInnerHTML:t}):null)}function v7(e,t){let n=[];return t.isNameRequired&&!e.name&&n.push(t.nameLabel),t.isEmailRequired&&!e.email&&n.push(t.emailLabel),e.message||n.push(t.messageLabel),n}function zS(e,t){let n=e.get(t);return typeof n=="string"?n.trim():""}function S7({options:e,defaultEmail:t,defaultName:n,onFormClose:r,onSubmit:o,onSubmitSuccess:i,onSubmitError:a,showEmail:s,showName:l,screenshotInput:c}){let{tags:d,addScreenshotButtonLabel:u,removeScreenshotButtonLabel:m,cancelButtonLabel:p,emailLabel:g,emailPlaceholder:_,isEmailRequired:y,isNameRequired:h,messageLabel:v,messagePlaceholder:T,nameLabel:x,namePlaceholder:N,submitButtonLabel:M,isRequiredLabel:k}=e,[P,F]=Cl(!1),[U,X]=Cl(null),[G,R]=Cl(!1),C=c?.input,[$,ee]=Cl(null),B=Cu(te=>{ee(te),R(!1)},[]),H=Cu(te=>{let ve=v7(te,{emailLabel:g,isEmailRequired:y,isNameRequired:h,messageLabel:v,nameLabel:x});return ve.length>0?X(`Please enter in the following required fields: ${ve.join(", ")}`):X(null),ve.length===0},[g,y,h,v,x]),se=Cu(async te=>{F(!0);try{if(te.preventDefault(),!(te.target instanceof HTMLFormElement))return;let ve=new FormData(te.target),pe=await(c&&G?c.value():void 0),Ge={name:zS(ve,"name"),email:zS(ve,"email"),message:zS(ve,"message"),attachments:pe?[pe]:void 0};if(!H(Ge))return;try{let re=await o({name:Ge.name,email:Ge.email,message:Ge.message,source:jH,tags:d},{attachments:Ge.attachments});i(Ge,re)}catch(re){vb&&A.error(re);let Je=re instanceof Error?re:new Error(String(re));X(Je.message),a(Je)}}finally{F(!1)}},[c&&G,i,a]);return Xe("form",{class:"form",onSubmit:se},C&&G?Xe(C,{onError:B}):null,Xe("fieldset",{class:"form__right","data-sentry-feedback":!0,disabled:P},Xe("div",{class:"form__top"},U?Xe("div",{class:"form__error-container"},U):null,l?Xe("label",{for:"name",class:"form__label"},Xe(FS,{label:x,isRequiredLabel:k,isRequired:h}),Xe("input",{class:"form__input",defaultValue:n,id:"name",name:"name",placeholder:N,required:h,type:"text"})):Xe("input",{"aria-hidden":!0,value:n,name:"name",type:"hidden"}),s?Xe("label",{for:"email",class:"form__label"},Xe(FS,{label:g,isRequiredLabel:k,isRequired:y}),Xe("input",{class:"form__input",defaultValue:t,id:"email",name:"email",placeholder:_,required:y,type:"email"})):Xe("input",{"aria-hidden":!0,value:t,name:"email",type:"hidden"}),Xe("label",{for:"message",class:"form__label"},Xe(FS,{label:v,isRequiredLabel:k,isRequired:!0}),Xe("textarea",{autoFocus:!0,class:"form__input form__input--textarea",id:"message",name:"message",placeholder:T,required:!0,rows:5})),C?Xe("label",{for:"screenshot",class:"form__label"},Xe("button",{class:"btn btn--default",disabled:P,type:"button",onClick:()=>{ee(null),R(te=>!te)}},G?m:u),$?Xe("div",{class:"form__error-container"},$.message):null):null),Xe("div",{class:"btn-group"},Xe("button",{class:"btn btn--primary",disabled:P,type:"submit"},M),Xe("button",{class:"btn btn--default",disabled:P,type:"button",onClick:r},p))))}function FS({label:e,isRequired:t,isRequiredLabel:n}){return Xe("span",{class:"form__label__text"},e,t&&Xe("span",{class:"form__label__text--required"},n))}var yb=16,KR=17,E7="http://www.w3.org/2000/svg";function T7(){let e=l=>ei.document.createElementNS(E7,l),t=jr(e("svg"),{width:`${yb}`,height:`${KR}`,viewBox:`0 0 ${yb} ${KR}`,fill:"inherit"}),n=jr(e("g"),{clipPath:"url(#clip0_57_156)"}),r=jr(e("path"),{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M3.55544 15.1518C4.87103 16.0308 6.41775 16.5 8 16.5C10.1217 16.5 12.1566 15.6571 13.6569 14.1569C15.1571 12.6566 16 10.6217 16 8.5C16 6.91775 15.5308 5.37103 14.6518 4.05544C13.7727 2.73985 12.5233 1.71447 11.0615 1.10897C9.59966 0.503466 7.99113 0.34504 6.43928 0.653721C4.88743 0.962403 3.46197 1.72433 2.34315 2.84315C1.22433 3.96197 0.462403 5.38743 0.153721 6.93928C-0.15496 8.49113 0.00346625 10.0997 0.608967 11.5615C1.21447 13.0233 2.23985 14.2727 3.55544 15.1518ZM4.40546 3.1204C5.46945 2.40946 6.72036 2.03 8 2.03C9.71595 2.03 11.3616 2.71166 12.575 3.92502C13.7883 5.13838 14.47 6.78405 14.47 8.5C14.47 9.77965 14.0905 11.0306 13.3796 12.0945C12.6687 13.1585 11.6582 13.9878 10.476 14.4775C9.29373 14.9672 7.99283 15.0953 6.73777 14.8457C5.48271 14.596 4.32987 13.9798 3.42502 13.075C2.52018 12.1701 1.90397 11.0173 1.65432 9.76224C1.40468 8.50718 1.5328 7.20628 2.0225 6.02404C2.5122 4.8418 3.34148 3.83133 4.40546 3.1204Z"}),o=jr(e("path"),{d:"M6.68775 12.4297C6.78586 12.4745 6.89218 12.4984 7 12.5C7.11275 12.4955 7.22315 12.4664 7.32337 12.4145C7.4236 12.3627 7.51121 12.2894 7.58 12.2L12 5.63999C12.0848 5.47724 12.1071 5.28902 12.0625 5.11098C12.0178 4.93294 11.9095 4.77744 11.7579 4.67392C11.6064 4.57041 11.4221 4.52608 11.24 4.54931C11.0579 4.57254 10.8907 4.66173 10.77 4.79999L6.88 10.57L5.13 8.56999C5.06508 8.49566 4.98613 8.43488 4.89768 8.39111C4.80922 8.34735 4.713 8.32148 4.61453 8.31498C4.51605 8.30847 4.41727 8.32147 4.32382 8.35322C4.23038 8.38497 4.14413 8.43484 4.07 8.49999C3.92511 8.63217 3.83692 8.81523 3.82387 9.01092C3.81083 9.2066 3.87393 9.39976 4 9.54999L6.43 12.24C6.50187 12.3204 6.58964 12.385 6.68775 12.4297Z"});t.appendChild(n).append(o,r);let i=e("defs"),a=jr(e("clipPath"),{id:"clip0_57_156"}),s=jr(e("rect"),{width:`${yb}`,height:`${yb}`,fill:"white",transform:"translate(0 0.5)"});return a.appendChild(s),i.appendChild(a),t.appendChild(i).appendChild(a).appendChild(s),t}function w7({open:e,onFormSubmitted:t,...n}){let r=n.options,o=yp(()=>({__html:T7().outerHTML}),[]),[i,a]=Cl(null),s=Cu(()=>{i&&(clearTimeout(i),a(null)),t()},[i]),l=Cu((c,d)=>{n.onSubmitSuccess(c,d),a(setTimeout(()=>{t(),a(null)},VH))},[t]);return Xe(bp,null,i?Xe("div",{class:"success__position",onClick:s},Xe("div",{class:"success__content"},r.successMessageText,Xe("span",{class:"success__icon",dangerouslySetInnerHTML:o}))):Xe("dialog",{class:"dialog",onClick:r.onFormClose,open:e},Xe("div",{class:"dialog__position"},Xe("div",{class:"dialog__content",onClick:c=>{c.stopPropagation()}},Xe(_7,{options:r}),Xe(S7,{...n,onSubmitSuccess:l})))))}var x7=`
115
- .dialog {
116
- position: fixed;
117
- z-index: var(--z-index);
118
- margin: 0;
119
- inset: 0;
120
-
121
- display: flex;
122
- align-items: center;
123
- justify-content: center;
124
- padding: 0;
125
- height: 100vh;
126
- width: 100vw;
127
-
128
- color: var(--dialog-color, var(--foreground));
129
- fill: var(--dialog-color, var(--foreground));
130
- line-height: 1.75em;
131
-
132
- background-color: rgba(0, 0, 0, 0.05);
133
- border: none;
134
- inset: 0;
135
- opacity: 1;
136
- transition: opacity 0.2s ease-in-out;
137
- }
138
-
139
- .dialog__position {
140
- position: fixed;
141
- z-index: var(--z-index);
142
- inset: var(--dialog-inset);
143
- padding: var(--page-margin);
144
- display: flex;
145
- max-height: calc(100vh - (2 * var(--page-margin)));
146
- }
147
- @media (max-width: 600px) {
148
- .dialog__position {
149
- inset: var(--page-margin);
150
- padding: 0;
151
- }
152
- }
153
-
154
- .dialog__position:has(.editor) {
155
- inset: var(--page-margin);
156
- padding: 0;
157
- }
158
-
159
- .dialog:not([open]) {
160
- opacity: 0;
161
- pointer-events: none;
162
- visibility: hidden;
163
- }
164
- .dialog:not([open]) .dialog__content {
165
- transform: translate(0, -16px) scale(0.98);
166
- }
167
-
168
- .dialog__content {
169
- display: flex;
170
- flex-direction: column;
171
- gap: 16px;
172
- padding: var(--dialog-padding, 24px);
173
- max-width: 100%;
174
- width: 100%;
175
- max-height: 100%;
176
- overflow: auto;
177
-
178
- background: var(--dialog-background, var(--background));
179
- border-radius: var(--dialog-border-radius, 20px);
180
- border: var(--dialog-border, var(--border));
181
- box-shadow: var(--dialog-box-shadow, var(--box-shadow));
182
- transform: translate(0, 0) scale(1);
183
- transition: transform 0.2s ease-in-out;
184
- }
185
-
186
- `,k7=`
187
- .dialog__header {
188
- display: flex;
189
- gap: 4px;
190
- justify-content: space-between;
191
- font-weight: var(--dialog-header-weight, 600);
192
- margin: 0;
193
- }
194
- .dialog__title {
195
- align-self: center;
196
- width: var(--form-width, 272px);
197
- }
198
-
199
- @media (max-width: 600px) {
200
- .dialog__title {
201
- width: auto;
202
- }
203
- }
204
-
205
- .dialog__position:has(.editor) .dialog__title {
206
- width: auto;
207
- }
208
-
209
-
210
- .brand-link {
211
- display: inline-flex;
212
- }
213
- .brand-link:focus-visible {
214
- outline: var(--outline);
215
- }
216
- `,A7=`
217
- .form {
218
- display: flex;
219
- overflow: auto;
220
- flex-direction: row;
221
- gap: 16px;
222
- flex: 1 0;
223
- }
224
-
225
- .form fieldset {
226
- border: none;
227
- margin: 0;
228
- padding: 0;
229
- }
230
-
231
- .form__right {
232
- flex: 0 0 auto;
233
- display: flex;
234
- overflow: auto;
235
- flex-direction: column;
236
- justify-content: space-between;
237
- gap: 20px;
238
- width: var(--form-width, 100%);
239
- }
240
-
241
- .dialog__position:has(.editor) .form__right {
242
- width: var(--form-width, 272px);
243
- }
244
-
245
- .form__top {
246
- display: flex;
247
- flex-direction: column;
248
- gap: 8px;
249
- }
250
-
251
- .form__error-container {
252
- color: var(--error-color);
253
- fill: var(--error-color);
254
- }
255
-
256
- .form__label {
257
- display: flex;
258
- flex-direction: column;
259
- gap: 4px;
260
- margin: 0px;
261
- }
262
-
263
- .form__label__text {
264
- display: flex;
265
- gap: 4px;
266
- align-items: center;
267
- }
268
-
269
- .form__label__text--required {
270
- font-size: 0.85em;
271
- }
272
-
273
- .form__input {
274
- font-family: inherit;
275
- line-height: inherit;
276
- background: transparent;
277
- box-sizing: border-box;
278
- border: var(--input-border, var(--border));
279
- border-radius: var(--input-border-radius, 6px);
280
- color: var(--input-color, inherit);
281
- fill: var(--input-color, inherit);
282
- font-size: var(--input-font-size, inherit);
283
- font-weight: var(--input-font-weight, 500);
284
- padding: 6px 12px;
285
- }
286
-
287
- .form__input::placeholder {
288
- opacity: 0.65;
289
- color: var(--input-placeholder-color, inherit);
290
- filter: var(--interactive-filter);
291
- }
292
-
293
- .form__input:focus-visible {
294
- outline: var(--input-focus-outline, var(--outline));
295
- }
296
-
297
- .form__input--textarea {
298
- font-family: inherit;
299
- resize: vertical;
300
- }
301
-
302
- .error {
303
- color: var(--error-color);
304
- fill: var(--error-color);
305
- }
306
- `,I7=`
307
- .btn-group {
308
- display: grid;
309
- gap: 8px;
310
- }
311
-
312
- .btn {
313
- line-height: inherit;
314
- border: var(--button-border, var(--border));
315
- border-radius: var(--button-border-radius, 6px);
316
- cursor: pointer;
317
- font-family: inherit;
318
- font-size: var(--button-font-size, inherit);
319
- font-weight: var(--button-font-weight, 600);
320
- padding: var(--button-padding, 6px 16px);
321
- }
322
- .btn[disabled] {
323
- opacity: 0.6;
324
- pointer-events: none;
325
- }
326
-
327
- .btn--primary {
328
- color: var(--button-primary-color, var(--accent-foreground));
329
- fill: var(--button-primary-color, var(--accent-foreground));
330
- background: var(--button-primary-background, var(--accent-background));
331
- border: var(--button-primary-border, var(--border));
332
- border-radius: var(--button-primary-border-radius, 6px);
333
- font-weight: var(--button-primary-font-weight, 500);
334
- }
335
- .btn--primary:hover {
336
- color: var(--button-primary-hover-color, var(--accent-foreground));
337
- fill: var(--button-primary-hover-color, var(--accent-foreground));
338
- background: var(--button-primary-hover-background, var(--accent-background));
339
- filter: var(--interactive-filter);
340
- }
341
- .btn--primary:focus-visible {
342
- background: var(--button-primary-hover-background, var(--accent-background));
343
- filter: var(--interactive-filter);
344
- outline: var(--button-primary-focus-outline, var(--outline));
345
- }
346
-
347
- .btn--default {
348
- color: var(--button-color, var(--foreground));
349
- fill: var(--button-color, var(--foreground));
350
- background: var(--button-background, var(--background));
351
- border: var(--button-border, var(--border));
352
- border-radius: var(--button-border-radius, 6px);
353
- font-weight: var(--button-font-weight, 500);
354
- }
355
- .btn--default:hover {
356
- color: var(--button-color, var(--foreground));
357
- fill: var(--button-color, var(--foreground));
358
- background: var(--button-hover-background, var(--background));
359
- filter: var(--interactive-filter);
360
- }
361
- .btn--default:focus-visible {
362
- background: var(--button-hover-background, var(--background));
363
- filter: var(--interactive-filter);
364
- outline: var(--button-focus-outline, var(--outline));
365
- }
366
- `,N7=`
367
- .success__position {
368
- position: fixed;
369
- inset: var(--dialog-inset);
370
- padding: var(--page-margin);
371
- z-index: var(--z-index);
372
- }
373
- .success__content {
374
- background: var(--success-background, var(--background));
375
- border: var(--success-border, var(--border));
376
- border-radius: var(--success-border-radius, 1.7em/50%);
377
- box-shadow: var(--success-box-shadow, var(--box-shadow));
378
- font-weight: var(--success-font-weight, 600);
379
- color: var(--success-color);
380
- fill: var(--success-color);
381
- padding: 12px 24px;
382
- line-height: 1.75em;
383
-
384
- display: grid;
385
- align-items: center;
386
- grid-auto-flow: column;
387
- gap: 6px;
388
- cursor: default;
389
- }
390
-
391
- .success__icon {
392
- display: flex;
393
- }
394
- `;function R7(e){let t=xt.createElement("style");return t.textContent=`
395
- :host {
396
- --dialog-inset: var(--inset);
397
- }
398
-
399
- ${x7}
400
- ${k7}
401
- ${A7}
402
- ${I7}
403
- ${N7}
404
- `,e&&t.setAttribute("nonce",e),t}function C7(){let e=ae().getUser(),t=je().getUser(),n=br().getUser();return e&&Object.keys(e).length?e:t&&Object.keys(t).length?t:n}var mC=(()=>({name:"FeedbackModal",setupOnce(){},createDialog:({options:e,screenshotIntegration:t,sendFeedback:n,shadow:r})=>{let o=r,i=e.useSentryUser,a=C7(),s=xt.createElement("div"),l=R7(e.styleNonce),c="",d={get el(){return s},appendToDom(){!o.contains(l)&&!o.contains(s)&&(o.appendChild(l),o.appendChild(s))},removeFromDom(){s.remove(),l.remove(),xt.body.style.overflow=c},open(){m(!0),e.onFormOpen?.(),q()?.emit("openFeedbackWidget"),c=xt.body.style.overflow,xt.body.style.overflow="hidden"},close(){m(!1),xt.body.style.overflow=c}},u=t?.createInput({h:Xe,hooks:h7,dialog:d,options:e}),m=p=>{a7(Xe(w7,{options:e,screenshotInput:u,showName:e.showName||e.isNameRequired,showEmail:e.showEmail||e.isEmailRequired,defaultName:String(i&&a?.[i.name]||""),defaultEmail:String(i&&a?.[i.email]||""),onFormClose:()=>{m(!1),e.onFormClose?.()},onSubmit:n,onSubmitSuccess:(g,_)=>{m(!1),e.onSubmitSuccess?.(g,_)},onSubmitError:g=>{e.onSubmitError?.(g)},onFormSubmitted:()=>{e.onFormSubmitted?.()},open:p}),s)};return d}}));function M7({h:e}){return function(){return e("svg",{"data-test-id":"icon-close",viewBox:"0 0 16 16",fill:"#2B2233",height:"25px",width:"25px"},e("circle",{r:"7",cx:"8",cy:"8",fill:"white"}),e("path",{strokeWidth:"1.5",d:"M8,16a8,8,0,1,1,8-8A8,8,0,0,1,8,16ZM8,1.53A6.47,6.47,0,1,0,14.47,8,6.47,6.47,0,0,0,8,1.53Z"}),e("path",{strokeWidth:"1.5",d:"M5.34,11.41a.71.71,0,0,1-.53-.22.74.74,0,0,1,0-1.06l5.32-5.32a.75.75,0,0,1,1.06,1.06L5.87,11.19A.74.74,0,0,1,5.34,11.41Z"}),e("path",{strokeWidth:"1.5",d:"M10.66,11.41a.74.74,0,0,1-.53-.22L4.81,5.87A.75.75,0,0,1,5.87,4.81l5.32,5.32a.74.74,0,0,1,0,1.06A.71.71,0,0,1,10.66,11.41Z"}))}}function O7(e){let t=xt.createElement("style"),n="#1A141F",r="#302735";return t.textContent=`
405
- .editor {
406
- display: flex;
407
- flex-grow: 1;
408
- flex-direction: column;
409
- }
410
-
411
- .editor__image-container {
412
- justify-items: center;
413
- padding: 15px;
414
- position: relative;
415
- height: 100%;
416
- border-radius: var(--menu-border-radius, 6px);
417
-
418
- background-color: ${n};
419
- background-image: repeating-linear-gradient(
420
- -145deg,
421
- transparent,
422
- transparent 8px,
423
- ${n} 8px,
424
- ${n} 11px
425
- ),
426
- repeating-linear-gradient(
427
- -45deg,
428
- transparent,
429
- transparent 15px,
430
- ${r} 15px,
431
- ${r} 16px
432
- );
433
- }
434
-
435
- .editor__canvas-container {
436
- width: 100%;
437
- height: 100%;
438
- position: relative;
439
- display: flex;
440
- align-items: center;
441
- justify-content: center;
442
- }
443
-
444
- .editor__canvas-container > * {
445
- object-fit: contain;
446
- position: absolute;
447
- }
448
-
449
- .editor__tool-container {
450
- padding-top: 8px;
451
- display: flex;
452
- justify-content: center;
453
- }
454
-
455
- .editor__tool-bar {
456
- display: flex;
457
- gap: 8px;
458
- }
459
-
460
- .editor__tool {
461
- display: flex;
462
- padding: 8px 12px;
463
- justify-content: center;
464
- align-items: center;
465
- border: var(--button-border, var(--border));
466
- border-radius: var(--button-border-radius, 6px);
467
- background: var(--button-background, var(--background));
468
- color: var(--button-color, var(--foreground));
469
- }
470
-
471
- .editor__tool--active {
472
- background: var(--button-primary-background, var(--accent-background));
473
- color: var(--button-primary-color, var(--accent-foreground));
474
- }
475
-
476
- .editor__rect {
477
- position: absolute;
478
- z-index: 2;
479
- }
480
-
481
- .editor__rect button {
482
- opacity: 0;
483
- position: absolute;
484
- top: -12px;
485
- right: -12px;
486
- cursor: pointer;
487
- padding: 0;
488
- z-index: 3;
489
- border: none;
490
- background: none;
491
- }
492
-
493
- .editor__rect:hover button {
494
- opacity: 1;
495
- }
496
- `,e&&t.setAttribute("nonce",e),t}function D7({h:e}){return function({action:n,setAction:r,options:o}){return e("div",{class:"editor__tool-container"},e("div",{class:"editor__tool-bar"},e("button",{type:"button",class:`editor__tool ${n==="highlight"?"editor__tool--active":""}`,onClick:()=>{r(n==="highlight"?"":"highlight")}},o.highlightToolText),e("button",{type:"button",class:`editor__tool ${n==="hide"?"editor__tool--active":""}`,onClick:()=>{r(n==="hide"?"":"hide")}},o.hideToolText)))}}function L7({hooks:e}){function t(){let[n,r]=e.useState(ei.devicePixelRatio??1);return e.useEffect(()=>{let o=()=>{r(ei.devicePixelRatio)},i=matchMedia(`(resolution: ${ei.devicePixelRatio}dppx)`);return i.addEventListener("change",o),()=>{i.removeEventListener("change",o)}},[]),n}return function({onBeforeScreenshot:r,onScreenshot:o,onAfterScreenshot:i,onError:a}){let s=t();e.useEffect(()=>{(async()=>{r();let c=await gp.mediaDevices.getDisplayMedia({video:{width:ei.innerWidth*s,height:ei.innerHeight*s},audio:!1,monitorTypeSurfaces:"exclude",preferCurrentTab:!0,selfBrowserSurface:"include",surfaceSwitching:"exclude"}),d=xt.createElement("video");await new Promise((u,m)=>{d.srcObject=c,d.onloadedmetadata=()=>{o(d,s),c.getTracks().forEach(p=>p.stop()),u()},d.play().catch(m)}),i()})().catch(a)},[])}}function U7(e,t,n){switch(e.type){case"highlight":{t.shadowColor="rgba(0, 0, 0, 0.7)",t.shadowBlur=50,t.fillStyle=n,t.fillRect(e.x-1,e.y-1,e.w+2,e.h+2),t.clearRect(e.x,e.y,e.w,e.h);break}case"hide":t.fillStyle="rgb(0, 0, 0)",t.fillRect(e.x,e.y,e.w,e.h);break}}function us(e,t,n){if(!e)return;let r=e.getContext("2d",t);r&&n(e,r)}function HS(e,t){us(e,{alpha:!0},(n,r)=>{r.drawImage(t,0,0,t.width,t.height,0,0,n.width,n.height)})}function GS(e,t,n){us(e,{alpha:!0},(r,o)=>{n.length&&(o.fillStyle="rgba(0, 0, 0, 0.25)",o.fillRect(0,0,r.width,r.height)),n.forEach(i=>{U7(i,o,t)})})}function P7({h:e,hooks:t,outputBuffer:n,dialog:r,options:o}){let i=L7({hooks:t}),a=D7({h:e}),s=M7({h:e}),l={__html:O7(o.styleNonce).innerText},c=r.el.style,d=({screenshot:u})=>{let[m,p]=t.useState("highlight"),[g,_]=t.useState([]),y=t.useRef(null),h=t.useRef(null),v=t.useRef(null),T=t.useRef(null),[x,N]=t.useState(1),M=t.useMemo(()=>{let G=xt.getElementById(o.id);if(!G)return"white";let R=getComputedStyle(G);return R.getPropertyValue("--button-primary-background")||R.getPropertyValue("--accent-background")},[o.id]);t.useLayoutEffect(()=>{let G=()=>{let R=y.current;R&&(us(u.canvas,{alpha:!1},C=>{let $=Math.min(R.clientWidth/C.width,R.clientHeight/C.height);N($)}),(R.clientHeight===0||R.clientWidth===0)&&setTimeout(G,0))};return G(),ei.addEventListener("resize",G),()=>{ei.removeEventListener("resize",G)}},[u]);let k=t.useCallback((G,R)=>{us(G,{alpha:!0},(C,$)=>{$.scale(R,R),C.width=u.canvas.width,C.height=u.canvas.height})},[u]);t.useEffect(()=>{k(h.current,u.dpi),HS(h.current,u.canvas)},[u]),t.useEffect(()=>{k(v.current,u.dpi),us(v.current,{alpha:!0},(G,R)=>{R.clearRect(0,0,G.width,G.height)}),GS(v.current,M,g)},[g,M]),t.useEffect(()=>{k(n,u.dpi),HS(n,u.canvas),us(xt.createElement("canvas"),{alpha:!0},(G,R)=>{R.scale(u.dpi,u.dpi),G.width=u.canvas.width,G.height=u.canvas.height,GS(G,M,g),HS(n,G)})},[g,u,M]);let P=G=>{if(!m||!T.current)return;let R=T.current.getBoundingClientRect(),C={type:m,x:G.offsetX/x,y:G.offsetY/x},$=(H,se)=>{let te=(se.clientX-R.x)/x,ve=(se.clientY-R.y)/x;return{type:H.type,x:Math.min(H.x,te),y:Math.min(H.y,ve),w:Math.abs(te-H.x),h:Math.abs(ve-H.y)}},ee=H=>{us(v.current,{alpha:!0},(se,te)=>{te.clearRect(0,0,se.width,se.height)}),GS(v.current,M,[...g,$(C,H)])},B=H=>{let se=$(C,H);se.w*x>=1&&se.h*x>=1&&_(te=>[...te,se]),xt.removeEventListener("mousemove",ee),xt.removeEventListener("mouseup",B)};xt.addEventListener("mousemove",ee),xt.addEventListener("mouseup",B)},F=t.useCallback(G=>R=>{R.preventDefault(),R.stopPropagation(),_(C=>{let $=[...C];return $.splice(G,1),$})},[]),U={width:`${u.canvas.width*x}px`,height:`${u.canvas.height*x}px`},X=G=>{G.stopPropagation()};return e("div",{class:"editor"},e("style",{nonce:o.styleNonce,dangerouslySetInnerHTML:l}),e("div",{class:"editor__image-container"},e("div",{class:"editor__canvas-container",ref:y},e("canvas",{ref:h,id:"background",style:U}),e("canvas",{ref:v,id:"foreground",style:U}),e("div",{ref:T,onMouseDown:P,style:U},g.map((G,R)=>e("div",{key:R,class:"editor__rect",style:{top:`${G.y*x}px`,left:`${G.x*x}px`,width:`${G.w*x}px`,height:`${G.h*x}px`}},e("button",{"aria-label":o.removeHighlightText,onClick:F(R),onMouseDown:X,onMouseUp:X,type:"button"},e(s,null))))))),e(a,{options:o,action:m,setAction:p}))};return function({onError:m}){let[p,g]=t.useState();return i({onBeforeScreenshot:t.useCallback(()=>{c.display="none"},[]),onScreenshot:t.useCallback((_,y)=>{us(xt.createElement("canvas"),{alpha:!1},(h,v)=>{v.scale(y,y),h.width=_.videoWidth,h.height=_.videoHeight,v.drawImage(_,0,0,h.width,h.height),g({canvas:h,dpi:y})}),n.width=_.videoWidth,n.height=_.videoHeight},[]),onAfterScreenshot:t.useCallback(()=>{c.display="block"},[]),onError:t.useCallback(_=>{c.display="block",m(_)},[])}),p?e(d,{screenshot:p}):e("div",null)}}var gC=(()=>({name:"FeedbackScreenshot",setupOnce(){},createInput:({h:e,hooks:t,dialog:n,options:r})=>{let o=xt.createElement("canvas");return{input:P7({h:e,hooks:t,outputBuffer:o,dialog:n,options:r}),value:async()=>{let i=await new Promise(a=>{o.toBlob(a,"image/png")});if(i)return{data:new Uint8Array(await i.arrayBuffer()),filename:"screenshot.png",contentType:"application/png"}}}}}));var J=ne,ZS=0;function eE(){return ZS>0}function B7(){ZS++,setTimeout(()=>{ZS--})}function Ol(e,t={}){function n(o){return typeof o=="function"}if(!n(e))return e;try{if(Object.prototype.hasOwnProperty.call(e,"__sentry_wrapped__")){let i=e.__sentry_wrapped__;return typeof i=="function"?i:e}if($a(e))return e}catch{return e}let r=function(...o){ne._sentryWrappedDepth=(ne._sentryWrappedDepth||0)+1;try{let i=o.map(a=>Ol(a,t));return e.apply(this,i)}catch(i){throw B7(),Ht(a=>{a.addEventProcessor(s=>(t.mechanism&&(sl(s,void 0,void 0),Rn(s,t.mechanism)),s.extra={...s.extra,arguments:o},s)),xe(i)}),i}finally{ne._sentryWrappedDepth=(ne._sentryWrappedDepth||0)-1}};try{for(let o in e)Object.prototype.hasOwnProperty.call(e,o)&&(r[o]=e[o])}catch{}Af(r,e),Ye(e,"__sentry_wrapped__",r);try{Object.getOwnPropertyDescriptor(r,"name").configurable&&Object.defineProperty(r,"name",{get(){return e.name}})}catch{}return r}function Du(){let e=nr(),{referrer:t}=J.document||{},{userAgent:n}=J.navigator||{},r={...t&&{Referer:t},...n&&{"User-Agent":n}};return{url:e,headers:r}}var z7=["replayIntegration","replayCanvasIntegration","feedbackIntegration","feedbackModalIntegration","feedbackScreenshotIntegration","captureConsoleIntegration","contextLinesIntegration","linkedErrorsIntegration","dedupeIntegration","extraErrorDataIntegration","graphqlClientIntegration","httpClientIntegration","reportingObserverIntegration","rewriteFramesIntegration","browserProfilingIntegration","moduleMetadataIntegration","instrumentAnthropicAiClient","instrumentOpenAiClient","instrumentGoogleGenAIClient","instrumentLangGraph","createLangChainCallbackHandler","instrumentLangChainEmbeddings"],F7={replayCanvasIntegration:"replay-canvas",feedbackModalIntegration:"feedback-modal",feedbackScreenshotIntegration:"feedback-screenshot"};function H7(e){return F7[e]||e.replace("Integration","").toLowerCase()}var hC=J;async function Ib(e,t){let n=z7.includes(e)?H7(e):void 0,r=hC.Sentry=hC.Sentry||{};if(!n)throw new Error(`Cannot lazy load integration: ${e}`);let o=r[e];if(typeof o=="function"&&!("_isShim"in o))return o;let i=G7(n),a=J.document.createElement("script");a.src=i,a.crossOrigin="anonymous",a.referrerPolicy="strict-origin",t&&a.setAttribute("nonce",t);let s=new Promise((u,m)=>{a.addEventListener("load",()=>u()),a.addEventListener("error",m)}),l=J.document.currentScript,c=J.document.body||J.document.head||l?.parentElement;if(c)c.appendChild(a);else throw new Error(`Could not find parent element to insert lazy-loaded ${e} script`);try{await s}catch{throw new Error(`Error when loading integration: ${e}`)}let d=r[e];if(typeof d!="function")throw new Error(`Could not load integration: ${e}`);return d}function G7(e){let n=q()?.getOptions()?.cdnBaseUrl||"https://browser.sentry-cdn.com";return new URL(`/${mr}/${e}.min.js`,n).toString()}var bC=kb({lazyLoadIntegration:Ib});var tE=kb({getModalIntegration:()=>mC,getScreenshotIntegration:()=>gC});function Lu(e,t){let n=Nb(e,t),r={type:W7(t),value:Y7(t)};return n.length&&(r.stacktrace={frames:n}),r.type===void 0&&r.value===""&&(r.value="Unrecoverable error caught"),r}function $7(e,t,n,r){let i=q()?.getOptions().normalizeDepth,a=J7(t),s={__serialized__:Nf(t,i)};if(a)return{exception:{values:[Lu(e,a)]},extra:s};let l={exception:{values:[{type:Ga(t)?t.constructor.name:r?"UnhandledRejection":"Error",value:K7(t,{isUnhandledRejection:r})}]},extra:s};if(n){let c=Nb(e,n);c.length&&(l.exception.values[0].stacktrace={frames:c})}return l}function nE(e,t){return{exception:{values:[Lu(e,t)]}}}function Nb(e,t){let n=t.stacktrace||t.stack||"",r=q7(t),o=V7(t);try{return e(n,r,o)}catch{}return[]}var j7=/Minified React error #\d+;/i;function q7(e){return e&&j7.test(e.message)?1:0}function V7(e){return typeof e.framesToPop=="number"?e.framesToPop:0}function yC(e){return typeof WebAssembly<"u"&&typeof WebAssembly.Exception<"u"?e instanceof WebAssembly.Exception:!1}function W7(e){let t=e?.name;return!t&&yC(e)?e.message&&Array.isArray(e.message)&&e.message.length==2?e.message[0]:"WebAssembly.Exception":t}function Y7(e){let t=e?.message;return yC(e)?Array.isArray(e.message)&&e.message.length==2?e.message[1]:"wasm exception":t?t.error&&typeof t.error.message=="string"?jh(t.error):jh(e):"No error message"}function Rb(e,t,n,r){let o=n?.syntheticException||void 0,i=Uu(e,t,o,r);return Rn(i),i.level="error",n?.event_id&&(i.event_id=n.event_id),yi(i)}function Cb(e,t,n="info",r,o){let i=r?.syntheticException||void 0,a=rE(e,t,i,o);return a.level=n,r?.event_id&&(a.event_id=r.event_id),yi(a)}function Uu(e,t,n,r,o){let i;if(Gc(t)&&t.error)return nE(e,t.error);if(xf(t)||Dg(t)){let a=t;if("stack"in t){i=nE(e,t);let s=i.exception?.values?.[0];if(r&&n&&s&&!s.stacktrace){let l=Nb(e,n);l.length&&(s.stacktrace={frames:l},Rn(i,{synthetic:!0}))}}else{let s=a.name||(xf(a)?"DOMError":"DOMException"),l=a.message?`${s}: ${a.message}`:s;i=rE(e,l,n,r),sl(i,l)}return"code"in a&&(i.tags={...i.tags,"DOMException.code":`${a.code}`}),i}return En(t)?nE(e,t):Tt(t)||Ga(t)?(i=$7(e,t,n,o),Rn(i,{synthetic:!0}),i):(i=rE(e,t,n,r),sl(i,`${t}`,void 0),Rn(i,{synthetic:!0}),i)}function rE(e,t,n,r){let o={};if(r&&n){let i=Nb(e,n);i.length&&(o.exception={values:[{value:t,stacktrace:{frames:i}}]}),Rn(o,{synthetic:!0})}if(di(t)){let{__sentry_template_string__:i,__sentry_template_values__:a}=t;return o.logentry={message:i,params:a},o}return o.message=t,o}function K7(e,{isUnhandledRejection:t}){let n=Ug(e),r=t?"promise rejection":"exception";return Gc(e)?`Event \`ErrorEvent\` captured as ${r} with message \`${e.message}\``:Ga(e)?`Event \`${X7(e)}\` (type=${e.type}) captured as ${r}`:`Object captured as ${r} with keys: ${n}`}function X7(e){try{let t=Object.getPrototypeOf(e);return t?t.constructor.name:void 0}catch{}}function J7(e){return Object.values(e).find(t=>t instanceof Error)}var Pu=class extends rp{constructor(t){let n=Q7(t),r=J.SENTRY_SDK_SOURCE||$v();ip(n,"browser",["browser"],r),super(n);let{userInfo:o}=this.getDataCollectionOptions();n._metadata?.sdk&&(n._metadata.sdk.settings={infer_ip:o?"auto":"never",...n._metadata.sdk.settings});let{sendClientReports:i,enableLogs:a,_experiments:s,enableMetrics:l}=this._options,c=l??s?.enableMetrics??!0;J.document&&(i||a||c)&&J.document.addEventListener("visibilitychange",()=>{J.document.visibilityState==="hidden"&&(i&&this._flushOutcomes(),a&&vl(this),c&&cu(this))}),o&&this.on("beforeSendSession",iS)}eventFromException(t,n){return Rb(this._options.stackParser,t,n,this._options.attachStacktrace)}eventFromMessage(t,n="info",r){return Cb(this._options.stackParser,t,n,r,this._options.attachStacktrace)}_prepareEvent(t,n,r,o){return t.platform=t.platform||"javascript",super._prepareEvent(t,n,r,o)}};function Q7(e){return{release:typeof __SENTRY_RELEASE__=="string"?__SENTRY_RELEASE__:J.SENTRY_RELEASE?.id,sendClientReports:!0,parentSpanIsAlwaysRootSpan:!0,...e}}var On=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__;var fe=ne;var Z7=(e,t)=>e>t[1]?"poor":e>t[0]?"needs-improvement":"good",Ai=(e,t,n,r)=>{let o,i;return a=>{t.value>=0&&(a||r)&&(i=t.value-(o??0),(i||o===void 0)&&(o=t.value,t.delta=i,t.rating=Z7(t.value,n),e(t)))}};var ra=(e=!0)=>{let t=fe.performance?.getEntriesByType?.("navigation")[0];if(!e||t&&t.responseStart>0&&t.responseStart<performance.now())return t};var _o=()=>ra()?.activationStart??0;function vo(e,t,n){fe.document&&fe.addEventListener(e,t,n)}function Dl(e,t,n){fe.document&&fe.removeEventListener(e,t,n)}var Bu=-1,_C=new Set,e9=()=>fe.document?.visibilityState==="hidden"&&!fe.document?.prerendering?0:1/0,Mb=e=>{if(t9(e)&&Bu>-1){if(e.type==="visibilitychange"||e.type==="pagehide")for(let t of _C)t();isFinite(Bu)||(Bu=e.type==="visibilitychange"?e.timeStamp:0,Dl("prerenderingchange",Mb,!0))}},Ii=()=>{if(fe.document&&Bu<0){let e=_o();Bu=(fe.document.prerendering?void 0:globalThis.performance.getEntriesByType("visibility-state").filter(n=>n.name==="hidden"&&n.startTime>e)[0]?.startTime)??e9(),vo("visibilitychange",Mb,!0),vo("pagehide",Mb,!0),vo("prerenderingchange",Mb,!0)}return{get firstHiddenTime(){return Bu},onHidden(e){_C.add(e)}}};function t9(e){return e.type==="pagehide"||fe.document?.visibilityState==="hidden"}var vC=()=>`v5-${Date.now()}-${Math.floor(Math.random()*8999999999999)+1e12}`;var Ni=(e,t=-1)=>{let n=ra(),r="navigate";return n&&(fe.document?.prerendering||_o()>0?r="prerender":fe.document?.wasDiscarded?r="restore":n.type&&(r=n.type.replace(/_/g,"-"))),{name:e,value:t,rating:"good",delta:0,entries:[],id:vC(),navigationType:r}};var oE=new WeakMap;function zu(e,t){try{return oE.get(e)||oE.set(e,new t),oE.get(e)}catch{return new t}}var Ob=class{constructor(){this._sessionValue=0,this._sessionEntries=[]}_processEntry(t){if(t.hadRecentInput)return;let n=this._sessionEntries[0],r=this._sessionEntries[this._sessionEntries.length-1];this._sessionValue&&n&&r&&t.startTime-r.startTime<1e3&&t.startTime-n.startTime<5e3?(this._sessionValue+=t.value,this._sessionEntries.push(t)):(this._sessionValue=t.value,this._sessionEntries=[t]),this._onAfterProcessingUnexpectedShift?.(t)}};var So=(e,t,n={})=>{try{if(PerformanceObserver.supportedEntryTypes.includes(e)){let r=new PerformanceObserver(o=>{Promise.resolve().then(()=>{t(o.getEntries())})});return r.observe({type:e,buffered:!0,...n}),r}}catch{}};var Fu=e=>{let t=!1;return()=>{t||(e(),t=!0)}};var fs=e=>{fe.document?.prerendering?addEventListener("prerenderingchange",()=>e(),!0):e()};var n9=[1800,3e3],SC=(e,t={})=>{fs(()=>{let n=Ii(),r=Ni("FCP"),o,a=So("paint",s=>{for(let l of s)l.name==="first-contentful-paint"&&(a.disconnect(),l.startTime<n.firstHiddenTime&&(r.value=Math.max(l.startTime-_o(),0),r.entries.push(l),o(!0)))});a&&(o=Ai(e,r,n9,t.reportAllChanges))})};var r9=[.1,.25],EC=(e,t={})=>{SC(Fu(()=>{let n=Ni("CLS",0),r,o=Ii(),i=zu(t,Ob),a=l=>{for(let c of l)i._processEntry(c);i._sessionValue>n.value&&(n.value=i._sessionValue,n.entries=i._sessionEntries,r())},s=So("layout-shift",a);s&&(r=Ai(e,n,r9,t.reportAllChanges),o.onHidden(()=>{a(s.takeRecords()),r(!0)}),fe?.setTimeout?.(r))}))};var TC=0,iE=1/0,Db=0,o9=e=>{e.forEach(t=>{t.interactionId&&(iE=Math.min(iE,t.interactionId),Db=Math.max(Db,t.interactionId),TC=Db?(Db-iE)/7+1:0)})},aE,sE=()=>aE?TC:performance.interactionCount||0,wC=()=>{"interactionCount"in performance||aE||(aE=So("event",o9,{type:"event",buffered:!0,durationThreshold:0}))};var lE=10,xC=0,i9=()=>sE()-xC,Lb=class{constructor(){this._longestInteractionList=[],this._longestInteractionMap=new Map}_resetInteractions(){xC=sE(),this._longestInteractionList.length=0,this._longestInteractionMap.clear()}_estimateP98LongestInteraction(){let t=Math.min(this._longestInteractionList.length-1,Math.floor(i9()/50));return this._longestInteractionList[t]}_processEntry(t){if(this._onBeforeProcessingEntry?.(t),!(t.interactionId||t.entryType==="first-input"))return;let n=this._longestInteractionList.at(-1),r=this._longestInteractionMap.get(t.interactionId);if(r||this._longestInteractionList.length<lE||t.duration>n._latency){if(r?t.duration>r._latency?(r.entries=[t],r._latency=t.duration):t.duration===r._latency&&t.startTime===r.entries[0].startTime&&r.entries.push(t):(r={id:t.interactionId,entries:[t],_latency:t.duration},this._longestInteractionMap.set(r.id,r),this._longestInteractionList.push(r)),this._longestInteractionList.sort((o,i)=>i._latency-o._latency),this._longestInteractionList.length>lE){let o=this._longestInteractionList.splice(lE);for(let i of o)this._longestInteractionMap.delete(i.id)}this._onAfterProcessingINPCandidate?.(r)}}};var Ll=e=>{let t=fe.requestIdleCallback||fe.setTimeout;fe.document?.visibilityState==="hidden"?e():(e=Fu(e),vo("visibilitychange",e,{once:!0,capture:!0}),vo("pagehide",e,{once:!0,capture:!0}),t(()=>{e(),Dl("visibilitychange",e,{capture:!0}),Dl("pagehide",e,{capture:!0})}))};var a9=[200,500],s9=40,kC=(e,t={})=>{if(!(globalThis.PerformanceEventTiming&&"interactionId"in PerformanceEventTiming.prototype))return;let n=Ii();fs(()=>{wC();let r=Ni("INP"),o,i=zu(t,Lb),a=l=>{Ll(()=>{for(let d of l)i._processEntry(d);let c=i._estimateP98LongestInteraction();c&&c._latency!==r.value&&(r.value=c._latency,r.entries=c.entries,o())})},s=So("event",a,{durationThreshold:t.durationThreshold??s9});o=Ai(e,r,a9,t.reportAllChanges),s&&(s.observe({type:"first-input",buffered:!0}),n.onHidden(()=>{a(s.takeRecords()),o(!0)}))})};var Ub=class{_processEntry(t){this._onBeforeProcessingEntry?.(t)}};var l9=[2500,4e3],AC=(e,t={})=>{fs(()=>{let n=Ii(),r=Ni("LCP"),o,i=zu(t,Ub),a=l=>{t.reportAllChanges||(l=l.slice(-1));for(let c of l)i._processEntry(c),c.startTime<n.firstHiddenTime&&(r.value=Math.max(c.startTime-_o(),0),r.entries=[c],o())},s=So("largest-contentful-paint",a);if(s){o=Ai(e,r,l9,t.reportAllChanges);let l=Fu(()=>{a(s.takeRecords()),s.disconnect(),o(!0)}),c=d=>{d.isTrusted&&(Ll(l),Dl(d.type,c,{capture:!0}))};for(let d of["keydown","click","visibilitychange"])vo(d,c,{capture:!0})}})};var c9=[800,1800],cE=e=>{fe.document?.prerendering?fs(()=>cE(e)):fe.document?.readyState!=="complete"?addEventListener("load",()=>cE(e),!0):setTimeout(e)},IC=(e,t={})=>{let n=Ni("TTFB"),r=Ai(e,n,c9,t.reportAllChanges);cE(()=>{let o=ra();o&&(n.value=Math.max(o.responseStart-_o(),0),n.entries=[o],r(!0))})};var _p={},Pb={},NC,RC,CC,MC;function oa(e,t=!1){return Bb("cls",e,u9,NC,t)}function ia(e,t=!1){return Bb("lcp",e,d9,RC,t)}function uE(e){return Bb("ttfb",e,f9,CC)}function Ul(e){return Bb("inp",e,p9,MC)}function xr(e,t){return OC(e,t),Pb[e]||(m9(e),Pb[e]=!0),DC(e,t)}function vp(e,t){let n=_p[e];if(n?.length)for(let r of n)try{r(t)}catch(o){On&&A.error(`Error while triggering instrumentation handler.
497
- Type: ${e}
498
- Name: ${ir(r)}
499
- Error:`,o)}}function u9(){return EC(e=>{vp("cls",{metric:e}),NC=e},{reportAllChanges:!0})}function d9(){return AC(e=>{vp("lcp",{metric:e}),RC=e},{reportAllChanges:!0})}function f9(){return IC(e=>{vp("ttfb",{metric:e}),CC=e})}function p9(){return kC(e=>{vp("inp",{metric:e}),MC=e})}function Bb(e,t,n,r,o=!1){OC(e,t);let i;return Pb[e]||(i=n(),Pb[e]=!0),r&&t({metric:r}),DC(e,t,o?i:void 0)}function m9(e){let t={};e==="event"&&(t.durationThreshold=0),So(e,n=>{vp(e,{entries:n})},t)}function OC(e,t){_p[e]=_p[e]||[],_p[e].push(t)}function DC(e,t,n){return()=>{n&&n();let r=_p[e];if(!r)return;let o=r.indexOf(t);o!==-1&&r.splice(o,1)}}function LC(e){return"duration"in e}var g9=80,Pl={};try{typeof Node<"u"&&(Pl.parentNode=Object.getOwnPropertyDescriptor(Node.prototype,"parentNode").get),typeof Element<"u"&&(Pl.tagName=Object.getOwnPropertyDescriptor(Element.prototype,"tagName").get,Pl.id=Object.getOwnPropertyDescriptor(Element.prototype,"id").get,Pl.className=Object.getOwnPropertyDescriptor(Element.prototype,"className").get,Pl.getAttribute=Element.prototype.getAttribute),typeof HTMLElement<"u"&&(Pl.dataset=Object.getOwnPropertyDescriptor(HTMLElement.prototype,"dataset").get)}catch{}function ps(e,t,n){let r=Pl[t];if(r)try{return r.call(e,n)}catch{}let o=e[t];return typeof o=="function"?o.call(e,n):o}function _t(e,t={}){if(!e)return"<unknown>";try{let n=e,r=5,o=[],i=0,a=0,s=" > ",l=s.length,c,d=Array.isArray(t)?t:t.keyAttrs,u=!Array.isArray(t)&&t.maxStringLength||g9;for(;n&&i++<r&&(c=h9(n,d),!(c==="html"||i>1&&a+o.length*l+c.length>=u));)o.push(c),a+=c.length,n=ps(n,"parentNode");return o.reverse().join(s)}catch{return"<unknown>"}}function h9(e,t){let n=[],r=ps(e,"tagName");if(!r)return"";if(typeof HTMLElement<"u"&&e instanceof HTMLElement){let i=ps(e,"dataset");if(i){if(i.sentryComponent)return i.sentryComponent;if(i.sentryElement)return i.sentryElement}}n.push(r.toLowerCase());let o=t?.length?t.filter(i=>ps(e,"getAttribute",i)).map(i=>[i,ps(e,"getAttribute",i)]):null;if(o?.length)o.forEach(i=>{n.push(`[${i[0]}="${i[1]}"]`)});else{let i=ps(e,"id");i&&n.push(`#${i}`);let a=ps(e,"className");if(a&&Tn(a)){let s=a.split(/\s+/);for(let l of s)n.push(`.${l}`)}}for(let i of["aria-label","type","name","title","alt"]){let a=ps(e,"getAttribute",i);a&&n.push(`[${i}="${a}"]`)}return n.join("")}var UC=e=>{let t=n=>{(n.type==="pagehide"||fe.document?.visibilityState==="hidden")&&e(n)};vo("visibilitychange",t,{capture:!0,once:!0}),vo("pagehide",t,{capture:!0,once:!0})};function zb(e){return typeof e=="number"&&isFinite(e)}function aa(e,t,n,{...r}){let o=ie(e).start_timestamp;return o&&o>t&&typeof e.updateStartTime=="function"&&e.updateStartTime(t),co(e,()=>{let i=Dt({startTime:t,...r});return i&&i.end(n),i})}function Hu(e){let t=q();if(!t)return;let{name:n,transaction:r,attributes:o,startTime:i}=e,{release:a,environment:s}=t.getOptions(),{userInfo:l}=t.getDataCollectionOptions(),d=t.getIntegrationByName("Replay")?.getReplayId(),u=ae(),m=u.getUser(),p=m!==void 0?m.email||m.id||m.ip_address:void 0,g;try{g=u.getScopeData().contexts.profile.profile_id}catch{}let _={release:a,environment:s,user:p||void 0,profile_id:g||void 0,replay_id:d||void 0,transaction:r,"user_agent.original":fe.navigator?.userAgent,"client.address":l?"{{auto}}":void 0,...o};return Dt({name:n,attributes:_,startTime:i,experimental:{standalone:!0}})}function Eo(){return fe.addEventListener&&fe.performance}function pt(e){return e/1e3}function PC(e){let t="unknown",n="unknown",r="";for(let o of e){if(o==="/"){[t,n]=e.split("/");break}if(!isNaN(Number(o))){t=r==="h"?"http":r,n=e.split(r)[1];break}r+=o}return r===e&&(t=r),{name:t,version:n}}function Bl(e){try{return PerformanceObserver.supportedEntryTypes.includes(e)}catch{return!1}}function zl(e,t){let n,r=!1;function o(s){!r&&n&&t(s,n.spanContext().spanId,n),r=!0}UC(()=>{o("pagehide")});let i=e.on("beforeStartNavigationSpan",(s,l)=>{l?.isRedirect||(o("navigation"),i(),a())}),a=e.on("afterStartPageLoadSpan",s=>{n=s,a()})}function BC(e){let t=0,n;if(!Bl("layout-shift"))return;let r=oa(({metric:o})=>{let i=o.entries[o.entries.length-1];i&&(t=o.value,n=i)},!0);zl(e,(o,i)=>{b9(t,n,i,o),r()})}function b9(e,t,n,r){On&&A.log(`Sending CLS span (${e})`);let o=t?pt((ut()||0)+t.startTime):Ue(),i=ae().getScopeData().transactionName,a=t?_t(t.sources[0]?.node):"Layout shift",s={[le]:"auto.http.browser.cls",[_e]:"ui.webvital.cls",[Jn]:0,"sentry.pageload.span_id":n,"sentry.report_event":r};t?.sources&&t.sources.forEach((c,d)=>{s[`cls.source.${d+1}`]=_t(c.node)});let l=Hu({name:a,transaction:i,attributes:s,startTime:o});l&&(l.addEvent("cls",{[Wo]:"",[Yo]:e}),l.end(o))}var y9=6e4;function Fl(e){return e!=null&&e>0&&e<=y9}function zC(e){let t=0,n;if(!Bl("largest-contentful-paint"))return;let r=ia(({metric:o})=>{let i=o.entries[o.entries.length-1];!i||!Fl(o.value)||(t=o.value,n=i)},!0);zl(e,(o,i)=>{_9(t,n,i,o),r()})}function _9(e,t,n,r){if(!Fl(e))return;On&&A.log(`Sending LCP span (${e})`);let o=pt((ut()||0)+(t?.startTime||0)),i=ae().getScopeData().transactionName,a=t?_t(t.element):"Largest contentful paint",s={[le]:"auto.http.browser.lcp",[_e]:"ui.webvital.lcp",[Jn]:0,"sentry.pageload.span_id":n,"sentry.report_event":r};t&&(t.element&&(s["lcp.element"]=_t(t.element)),t.id&&(s["lcp.id"]=t.id),t.url&&(s["lcp.url"]=t.url),t.loadTime!=null&&(s["lcp.loadTime"]=t.loadTime),t.renderTime!=null&&(s["lcp.renderTime"]=t.renderTime),t.size!=null&&(s["lcp.size"]=t.size));let l=Hu({name:a,transaction:i,attributes:s,startTime:o});l&&(l.addEvent("lcp",{[Wo]:"millisecond",[Yo]:e}),l.end(o))}function To(e){return e&&((ut()||performance.timeOrigin)+e)/1e3}function Sp(e){let t={};if(e.nextHopProtocol!=null){let{name:n,version:r}=PC(e.nextHopProtocol);t["network.protocol.version"]=r,t["network.protocol.name"]=n}return ut()||Eo()?.timeOrigin?v9({...t,"http.request.redirect_start":To(e.redirectStart),"http.request.redirect_end":To(e.redirectEnd),"http.request.worker_start":To(e.workerStart),"http.request.fetch_start":To(e.fetchStart),"http.request.domain_lookup_start":To(e.domainLookupStart),"http.request.domain_lookup_end":To(e.domainLookupEnd),"http.request.connect_start":To(e.connectStart),"http.request.secure_connection_start":To(e.secureConnectionStart),"http.request.connection_end":To(e.connectEnd),"http.request.request_start":To(e.requestStart),"http.request.response_start":To(e.responseStart),"http.request.response_end":To(e.responseEnd),"http.request.time_to_first_byte":e.responseStart!=null?e.responseStart/1e3:void 0}):t}function v9(e){return Object.fromEntries(Object.entries(e).filter(([,t])=>t!=null))}var S9=2147483647,FC=0,Ar={},kr,Hb;function dE({recordClsStandaloneSpans:e,recordLcpStandaloneSpans:t,client:n}){let r=Eo();if(r&&ut()){r.mark&&fe.performance.mark("sentry-tracing-init");let o=t?zC(n):t===!1?T9():void 0,i=e?BC(n):e===!1?E9():void 0,a=w9(),s=x9();return()=>{a(),s(),o?.(),i?.()}}return()=>{}}function fE(){xr("longtask",({entries:e})=>{let t=Be();if(!t)return;let{op:n,start_timestamp:r}=ie(t);for(let o of e){let i=pt(ut()+o.startTime),a=pt(o.duration);n==="navigation"&&r&&i<r||aa(t,i,i+a,{name:"Main UI thread blocked",op:"ui.long-task",attributes:{[le]:"auto.ui.browser.metrics"}})}})}function pE(){new PerformanceObserver(t=>{let n=Be();if(n)for(let r of t.getEntries()){if(!r.scripts[0])continue;let o=pt(ut()+r.startTime),{start_timestamp:i,op:a}=ie(n);if(a==="navigation"&&i&&o<i)continue;let s=pt(r.duration),l={[le]:"auto.ui.browser.metrics"},c=r.scripts[0],{invoker:d,invokerType:u,sourceURL:m,sourceFunctionName:p,sourceCharPosition:g}=c;l["browser.script.invoker"]=d,l["browser.script.invoker_type"]=u,m&&(l["code.filepath"]=m),p&&(l["code.function"]=p),g!==-1&&(l["browser.script.source_char_position"]=g),aa(n,o,o+s,{name:"Main UI thread blocked",op:"ui.long-animation-frame",attributes:l})}}).observe({type:"long-animation-frame",buffered:!0})}function mE(){xr("event",({entries:e})=>{let t=Be();if(t){for(let n of e)if(n.name==="click"){let r=pt(ut()+n.startTime),o=pt(n.duration),i={name:_t(n.target),op:`ui.interaction.${n.name}`,startTime:r,attributes:{[le]:"auto.ui.browser.metrics"}},a=cs(n.target);a&&(i.attributes["ui.component_name"]=a),aa(t,r,r+o,i)}}})}function E9(){return oa(({metric:e})=>{let t=e.entries[e.entries.length-1];t&&(Ar.cls={value:e.value,unit:""},Hb=t)},!0)}function T9(){return ia(({metric:e})=>{let t=e.entries[e.entries.length-1];!t||!Fl(e.value)||(Ar.lcp={value:e.value,unit:"millisecond"},kr=t)},!0)}function w9(){return uE(({metric:e})=>{e.entries[e.entries.length-1]&&(Ar.ttfb={value:e.value,unit:"millisecond"})})}function x9(){return xr("paint",({entries:e})=>{let t=Ii();for(let n of e){let r=n.startTime<t.firstHiddenTime;n.name==="first-paint"&&r&&(Ar.fp={value:n.startTime,unit:"millisecond"}),n.name==="first-contentful-paint"&&r&&(Ar.fcp={value:n.startTime,unit:"millisecond"})}})}function gE(e,t){let n=Eo(),r=ut();if(!n?.getEntries||!r)return;let{spanStreamingEnabled:o,ignorePerformanceApiSpans:i,ignoreResourceSpans:a}=t,s=pt(r),l=n.getEntries(),{op:c,start_timestamp:d}=ie(e);l.slice(FC).forEach(u=>{let m=pt(u.startTime),p=pt(Math.max(0,u.duration));if(!(c==="navigation"&&d&&s+m<d))switch(u.entryType){case"navigation":{N9(e,u,s);break}case"mark":case"paint":case"measure":{A9(e,u,m,p,s,i);break}case"resource":{M9(e,u,u.name,m,p,s,a);break}}}),FC=Math.max(l.length-1,0),O9(e,o)}function hE(e,t){let n=ut();if(!Eo()?.getEntries||!n){HC();return}let{spanStreamingEnabled:r,recordClsOnPageloadSpan:o,recordLcpOnPageloadSpan:i}=t,a=pt(n);if(ie(e).op==="pageload"){if(U9(Ar),r){let s=(l,c,d)=>{let u=d??`browser.web_vital.${l}.value`;e.setAttribute(u,c),On&&A.log("Setting web vital attribute",{[u]:c},"on pageload span")};["ttfb","fp","fcp"].forEach(l=>{Ar[l]&&s(l,Ar[l].value)}),Ar["ttfb.requestTime"]&&s("ttfb.requestTime",Ar["ttfb.requestTime"].value,"browser.web_vital.ttfb.request_time")}else o||delete Ar.cls,i||delete Ar.lcp,Object.entries(Ar).forEach(([s,l])=>{ml(s,l.value,l.unit,e)}),D9(e,t);e.setAttribute(r?"browser.performance.time_origin":"performance.timeOrigin",a),e.setAttribute(r?"browser.performance.navigation.activation_start":"performance.activationStart",_o())}HC()}function HC(){kr=void 0,Hb=void 0,Ar={}}function k9(e){if(e?.entryType==="measure")try{return e.detail.devtools.track==="Components \u269B"}catch{return}}function A9(e,t,n,r,o,i){if(k9(t)||["mark","measure"].includes(t.entryType)&&fn(t.name,i))return;let a=ra(!1),s=pt(a?a.requestStart:0),l=o+Math.max(n,s),c=o+n,d=c+r,u={[le]:"auto.resource.browser.metrics"};l!==c&&(u["sentry.browser.measure_happened_before_request"]=!0,u["sentry.browser.measure_start_time"]=l),I9(u,t),l<=d&&aa(e,l,d,{name:t.name,op:t.entryType,attributes:u})}function I9(e,t){try{let n=t.detail;if(!n)return;if(typeof n=="object"){for(let[r,o]of Object.entries(n))if(o&&dn(o))e[`sentry.browser.measure.detail.${r}`]=o;else if(o!==void 0)try{e[`sentry.browser.measure.detail.${r}`]=JSON.stringify(o)}catch{}return}if(dn(n)){e["sentry.browser.measure.detail"]=n;return}try{e["sentry.browser.measure.detail"]=JSON.stringify(n)}catch{}}catch{}}function N9(e,t,n){["unloadEvent","redirect","domContentLoadedEvent","loadEvent","connect"].forEach(r=>{Fb(e,t,r,n)}),Fb(e,t,"secureConnection",n,"TLS/SSL"),Fb(e,t,"fetch",n,"cache"),Fb(e,t,"domainLookup",n,"DNS"),C9(e,t,n)}function Fb(e,t,n,r,o=n){let i=R9(n),a=t[i],s=t[`${n}Start`];!s||!a||aa(e,r+pt(s),r+pt(a),{op:`browser.${o}`,name:t.name,attributes:{[le]:"auto.ui.browser.metrics",...n==="redirect"&&t.redirectCount!=null?{"http.redirect_count":t.redirectCount}:{}}})}function R9(e){return e==="secureConnection"?"connectEnd":e==="fetch"?"domainLookupStart":`${e}End`}function C9(e,t,n){let r=n+pt(t.requestStart),o=n+pt(t.responseEnd),i=n+pt(t.responseStart);t.responseEnd&&(aa(e,r,o,{op:"browser.request",name:t.name,attributes:{[le]:"auto.ui.browser.metrics"}}),aa(e,i,o,{op:"browser.response",name:t.name,attributes:{[le]:"auto.ui.browser.metrics"}}))}function M9(e,t,n,r,o,i,a){if(t.initiatorType==="xmlhttprequest"||t.initiatorType==="fetch")return;let s=t.initiatorType?`resource.${t.initiatorType}`:"resource.other";if(a?.includes(s))return;let l={[le]:"auto.resource.browser.metrics"},c=fo(n);c.protocol&&(l["url.scheme"]=c.protocol.split(":").pop()),c.host&&(l["server.address"]=c.host),l["url.same_origin"]=n.includes(fe.location.origin),l[Kc]=n,L9(t,l,[["responseStatus","http.response.status_code"],["transferSize","http.response_transfer_size"],["encodedBodySize","http.response_content_length"],["decodedBodySize","http.decoded_response_content_length"],["renderBlockingStatus","resource.render_blocking_status"],["deliveryType","http.response_delivery_type"]]);let d={...l,...Sp(t)},u=i+r,m=u+o;aa(e,u,m,{name:n.replace(fe.location.origin,""),op:s,attributes:d})}function O9(e,t){let n=fe.navigator;if(!n)return;let r=n.connection;r&&(r.effectiveType&&e.setAttribute(t?"network.connection.effective_type":"effectiveConnectionType",r.effectiveType),r.type&&e.setAttribute(t?"network.connection.type":"connectionType",r.type),zb(r.rtt)&&(t?e.setAttribute("network.connection.rtt",r.rtt):ie(e).op==="pageload"&&ml("connection.rtt",r.rtt,"millisecond"))),zb(n.deviceMemory)&&(t?e.setAttribute("device.memory.estimated_capacity",n.deviceMemory):e.setAttribute("deviceMemory",`${n.deviceMemory} GB`)),zb(n.hardwareConcurrency)&&(t?e.setAttribute("device.processor_count",n.hardwareConcurrency):e.setAttribute("hardwareConcurrency",String(n.hardwareConcurrency)))}function D9(e,t){kr&&t.recordLcpOnPageloadSpan&&(kr.element&&e.setAttribute("lcp.element",_t(kr.element)),kr.id&&e.setAttribute("lcp.id",kr.id),kr.url&&e.setAttribute("lcp.url",kr.url.trim().slice(0,200)),kr.loadTime!=null&&e.setAttribute("lcp.loadTime",kr.loadTime),kr.renderTime!=null&&e.setAttribute("lcp.renderTime",kr.renderTime),e.setAttribute("lcp.size",kr.size)),Hb?.sources&&t.recordClsOnPageloadSpan&&Hb.sources.forEach((n,r)=>e.setAttribute(`cls.source.${r+1}`,_t(n.node)))}function L9(e,t,n){n.forEach(([r,o])=>{let i=e[r];i!=null&&(typeof i=="number"&&i<S9||typeof i=="string")&&(t[o]=i)})}function U9(e){let t=ra(!1);if(!t)return;let{responseStart:n,requestStart:r}=t;r<=n&&(e["ttfb.requestTime"]={value:n-r,unit:"millisecond"})}var P9="ElementTiming",B9=(()=>({name:P9,setup(){!Eo()||!ut()||xr("element",({entries:t})=>{for(let n of t){let r=n;if(!r.identifier)continue;let o=r.identifier,i=r.name,a=r.renderTime,s=r.loadTime,l={"sentry.origin":"auto.ui.browser.element_timing","ui.element.identifier":o};i&&(l["ui.element.paint_type"]=i),r.id&&(l["ui.element.id"]=r.id),r.element&&(l["ui.element.type"]=r.element.tagName.toLowerCase()),r.url&&(l["ui.element.url"]=r.url),r.naturalWidth&&(l["ui.element.width"]=r.naturalWidth),r.naturalHeight&&(l["ui.element.height"]=r.naturalHeight),a>0&&rs.distribution("ui.element.render_time",a,{unit:"millisecond",attributes:l}),s>0&&rs.distribution("ui.element.load_time",s,{unit:"millisecond",attributes:l})}})}})),bE=B9;var yE=[],Ep=new Map,Gu=new Map,_E=60;function vE(){if(Eo()&&ut()){let t=z9();return()=>{t()}}return()=>{}}var $u={click:"click",pointerdown:"click",pointerup:"click",mousedown:"click",mouseup:"click",touchstart:"click",touchend:"click",mouseover:"hover",mouseout:"hover",mouseenter:"hover",mouseleave:"hover",pointerover:"hover",pointerout:"hover",pointerenter:"hover",pointerleave:"hover",dragstart:"drag",dragend:"drag",drag:"drag",dragenter:"drag",dragleave:"drag",dragover:"drag",drop:"drag",keydown:"press",keyup:"press",keypress:"press",input:"press"};function z9(){return Ul(F9)}var F9=({metric:e})=>{if(e.value==null)return;let t=pt(e.value);if(t>_E)return;let n=e.entries.find(g=>g.duration===e.value&&$u[g.name]);if(!n)return;let{interactionId:r}=n,o=$u[n.name],i=pt(ut()+n.startTime),a=Be(),s=a?Fe(a):void 0,l=r!=null?Ep.get(r):void 0,c=l?.span||s,d=c?ie(c).description:ae().getScopeData().transactionName,u=l?.elementName||_t(n.target),m={[le]:"auto.http.browser.inp",[_e]:`ui.interaction.${o}`,[Jn]:n.duration},p=Hu({name:u,transaction:d,attributes:m,startTime:i});p&&(p.addEvent("inp",{[Wo]:"millisecond",[Yo]:e.value}),p.end(i+t))};function GC(e){return e!=null?Ep.get(e):void 0}function SE(){let e=Object.keys($u);Zn()&&e.forEach(o=>{fe.addEventListener(o,t,{capture:!0,passive:!0})});function t(o){let i=o.target;if(!i)return;let a=_t(i),s=Math.round(o.timeStamp);if(Gu.set(s,a),Gu.size>50){let l=Gu.keys().next().value;l!==void 0&&Gu.delete(l)}}function n(o){let i=Math.round(o.startTime),a=Gu.get(i);if(!a)for(let s=-5;s<=5;s++){let l=Gu.get(i+s);if(l){a=l;break}}return a||"<unknown>"}let r=({entries:o})=>{let i=Be(),a=i&&Fe(i);o.forEach(s=>{if(!LC(s))return;let l=s.interactionId;if(l==null||Ep.has(l))return;let c=s.target?_t(s.target):n(s);if(yE.length>10){let d=yE.shift();Ep.delete(d)}yE.push(l),Ep.set(l,{span:a,elementName:c})})};xr("event",r),xr("first-input",r)}function EE(e){let{name:t,op:n,origin:r,metricName:o,value:i,attributes:a,parentSpan:s,reportEvent:l,startTime:c,endTime:d}=e,u=ae().getScopeData().transactionName,m={[le]:r,[_e]:n,[Jn]:0,[`browser.web_vital.${o}.value`]:i,"sentry.transaction":u,"user_agent.original":fe.navigator?.userAgent,...a};s&&Ya(s).attributes?.[_e]==="pageload"&&(m["sentry.pageload.span_id"]=s.spanContext().spanId),l&&(m[`browser.web_vital.${o}.report_event`]=l);let p=Dt({name:t,attributes:m,startTime:c,parentSpan:s});p&&p.end(d??c)}function TE(e){let t=0,n;if(!Bl("largest-contentful-paint"))return;let r=ia(({metric:o})=>{let i=o.entries[o.entries.length-1];!i||!Fl(o.value)||(t=o.value,n=i)},!0);zl(e,(o,i,a)=>{H9(t,n,a,o),r()})}function H9(e,t,n,r){if(!Fl(e))return;On&&A.log(`Sending LCP span (${e})`);let o=ut()||0,i=pt(o),a=pt(o+(t?.startTime||0)),s=t?_t(t.element):"Largest contentful paint",l={};t?.element&&(l["browser.web_vital.lcp.element"]=_t(t.element)),t?.id&&(l["browser.web_vital.lcp.id"]=t.id),t?.url&&(l["browser.web_vital.lcp.url"]=t.url),t?.loadTime!=null&&(l["browser.web_vital.lcp.load_time"]=t.loadTime),t?.renderTime!=null&&(l["browser.web_vital.lcp.render_time"]=t.renderTime),t?.size!=null&&(l["browser.web_vital.lcp.size"]=t.size),EE({name:s,op:"ui.webvital.lcp",origin:"auto.http.browser.lcp",metricName:"lcp",value:e,attributes:l,parentSpan:n,reportEvent:r,startTime:i,endTime:a})}function wE(e){let t=0,n;if(!Bl("layout-shift"))return;let r=oa(({metric:o})=>{let i=o.entries[o.entries.length-1];i&&(t=o.value,n=i)},!0);zl(e,(o,i,a)=>{G9(t,n,a,o),r()})}function G9(e,t,n,r){On&&A.log(`Sending CLS span (${e})`);let o=t?pt((ut()||0)+t.startTime):Ue(),i=t?_t(t.sources[0]?.node):"Layout shift",a={};t?.sources&&t.sources.forEach((s,l)=>{a[`browser.web_vital.cls.source.${l+1}`]=_t(s.node)}),EE({name:i,op:"ui.webvital.cls",origin:"auto.http.browser.cls",metricName:"cls",value:e,attributes:a,parentSpan:n,reportEvent:r,startTime:o})}function xE(){if(!Eo()||!ut())return;Ul(({metric:n})=>{if(n.value==null||pt(n.value)>_E)return;let o=n.entries.find(i=>i.duration===n.value&&$u[i.name]);o&&$9(n.value,o)})}function $9(e,t){On&&A.log(`Sending INP span (${e})`);let n=pt(ut()+t.startTime),r=pt(e),o=$u[t.name],i=GC(t.interactionId),a=Be(),s=a?Fe(a):void 0,l=i?.span||s,c=l?Ya(l).name:ae().getScopeData().transactionName,d=i?.elementName||_t(t.target);EE({name:d,op:`ui.interaction.${o}`,origin:"auto.http.browser.inp",metricName:"inp",value:e,attributes:{[Jn]:t.duration,"sentry.transaction":c},startTime:n,endTime:n+r,parentSpan:l})}var j9=1e3,$C,kE,AE;function Tp(e){Vn("dom",e),Wn("dom",q9)}function q9(){if(!fe.document)return;let e=un.bind(null,"dom"),t=jC(e,!0);fe.document.addEventListener("click",t,!1),fe.document.addEventListener("keypress",t,!1),["EventTarget","Node"].forEach(n=>{let o=fe[n]?.prototype;o?.hasOwnProperty?.("addEventListener")&&(wt(o,"addEventListener",function(i){return function(a,s,l){if(a==="click"||a=="keypress")try{let c=this.__sentry_instrumentation_handlers__=this.__sentry_instrumentation_handlers__||{},d=c[a]=c[a]||{refCount:0};if(!d.handler){let u=jC(e);d.handler=u,i.call(this,a,u,l)}d.refCount++}catch{}return i.call(this,a,s,l)}}),wt(o,"removeEventListener",function(i){return function(a,s,l){if(a==="click"||a=="keypress")try{let c=this.__sentry_instrumentation_handlers__||{},d=c[a];d&&(d.refCount--,d.refCount<=0&&(i.call(this,a,d.handler,l),d.handler=void 0,delete c[a]),Object.keys(c).length===0&&delete this.__sentry_instrumentation_handlers__)}catch{}return i.call(this,a,s,l)}}))})}function V9(e){if(e.type!==kE)return!1;try{if(!e.target||e.target._sentryId!==AE)return!1}catch{}return!0}function W9(e,t){return e!=="keypress"?!1:t?.tagName?!(t.tagName==="INPUT"||t.tagName==="TEXTAREA"||t.isContentEditable):!0}function jC(e,t=!1){return n=>{if(!n||n._sentryCaptured)return;let r=Y9(n);if(W9(n.type,r))return;Ye(n,"_sentryCaptured",!0),r&&!r._sentryId&&Ye(r,"_sentryId",ft());let o=n.type==="keypress"?"input":n.type;V9(n)||(e({event:n,name:o,global:t}),kE=n.type,AE=r?r._sentryId:void 0),clearTimeout($C),$C=fe.setTimeout(()=>{AE=void 0,kE=void 0},j9)}}function Y9(e){try{return e.target}catch{return null}}var Gb;function sa(e){let t="history";Vn(t,e),Wn(t,K9)}function K9(){if(fe.addEventListener("popstate",()=>{let t=fe.location.href,n=Gb;if(Gb=t,n===t)return;un("history",{from:n,to:t})}),!fb())return;function e(t){return function(...n){let r=n.length>2?n[2]:void 0;if(r){let o=Gb,i=X9(String(r));if(Gb=i,o===i)return t.apply(this,n);un("history",{from:o,to:i})}return t.apply(this,n)}}wt(fe.history,"pushState",e),wt(fe.history,"replaceState",e)}function X9(e){try{return new URL(e,fe.location.origin).toString()}catch{return e}}var $b={};function ju(e){let t=$b[e];if(t)return t;let n=fe[e];if(Iu(n))return $b[e]=n.bind(fe);let r=fe.document;if(r&&typeof r.createElement=="function")try{let o=r.createElement("iframe");o.hidden=!0,r.head.appendChild(o);let i=o.contentWindow;i?.[e]&&(n=i[e]),r.head.removeChild(o)}catch(o){On&&A.warn(`Could not create sandbox iframe for ${e} check, bailing to window.${e}: `,o)}return n&&($b[e]=n.bind(fe))}function IE(e){$b[e]=void 0}function Hl(...e){return ju("setTimeout")(...e)}var sr="__sentry_xhr_v3__";function Gl(e){Vn("xhr",e),Wn("xhr",J9)}function J9(){if(!fe.XMLHttpRequest)return;let e=XMLHttpRequest.prototype;e.open=new Proxy(e.open,{apply(t,n,r){let o=new Error,i=Ue()*1e3,a=Tn(r[0])?r[0].toUpperCase():void 0,s=Q9(r[1]);if(!a||!s)return t.apply(n,r);n[sr]={method:a,url:s,request_headers:{}},a==="POST"&&s.match(/sentry_key/)&&(n.__sentry_own_request__=!0);let l=()=>{let c=n[sr];if(c&&n.readyState===4){try{c.status_code=n.status}catch{}let d={endTimestamp:Ue()*1e3,startTimestamp:i,xhr:n,virtualError:o};un("xhr",d)}};return"onreadystatechange"in n&&typeof n.onreadystatechange=="function"?n.onreadystatechange=new Proxy(n.onreadystatechange,{apply(c,d,u){return l(),c.apply(d,u)}}):n.addEventListener("readystatechange",l),n.setRequestHeader=new Proxy(n.setRequestHeader,{apply(c,d,u){let[m,p]=u,g=d[sr];return g&&Tn(m)&&Tn(p)&&(g.request_headers[m.toLowerCase()]=p),c.apply(d,u)}}),t.apply(n,r)}}),e.send=new Proxy(e.send,{apply(t,n,r){let o=n[sr];if(!o)return t.apply(n,r);r[0]!==void 0&&(o.body=r[0]);let i={startTimestamp:Ue()*1e3,xhr:n};return un("xhr",i),t.apply(n,r)}})}function Q9(e){if(Tn(e))return e;try{return e.toString()}catch{}}var Z9=Symbol.for("sentry__originalRequestBody");function jb(e){return new URLSearchParams(e).toString()}function $l(e,t=A){try{if(typeof e=="string")return[e];if(e instanceof URLSearchParams)return[e.toString()];if(e instanceof FormData)return[jb(e)];if(!e)return[void 0]}catch(n){return On&&t.error(n,"Failed to serialize body",e),[void 0,"BODY_PARSE_ERROR"]}return On&&t.log("Skipping network body because of body type",e),[void 0,"UNPARSEABLE_BODY_TYPE"]}function qu(e=[]){if(e.length>=2&&e[1]&&typeof e[1]=="object"&&"body"in e[1])return e[1].body;if(e.length>=1&&e[0]instanceof Request){let n=e[0][Z9];return n!==void 0?n:void 0}}function wp(e){let t;try{t=e.getAllResponseHeaders()}catch(n){return On&&A.error(n,"Failed to get xhr response headers",e),{}}return t?t.split(`\r
500
- `).reduce((n,r)=>{let[o,i]=r.split(": ");return i&&(n[o.toLowerCase()]=i),n},{}):{}}function NE(e){if(typeof Element>"u")return!1;try{return e instanceof Element}catch{return!1}}var eG=40;function Vu(e,t=ju("fetch")){let n=0,r=0;async function o(i){let a=i.body.length;n+=a,r++;let s={body:i.body,method:"POST",referrerPolicy:"strict-origin",headers:e.headers,keepalive:n<=6e4&&r<15,...e.fetchOptions};try{let l=await t(e.url,s);return{statusCode:l.status,headers:{"x-sentry-rate-limits":l.headers.get("X-Sentry-Rate-Limits"),"retry-after":l.headers.get("Retry-After")}}}catch(l){throw IE("fetch"),l}finally{n-=a,r--}}return tp(e,o,Sl(e.bufferSize||eG))}var Q=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__;function tG(){let e=q();if(!e){Q&&A.warn("No Sentry client available, profiling is not started");return}if(!e.getIntegrationByName("BrowserProfiling")){Q&&A.warn("BrowserProfiling integration is not available");return}e.emit("startUIProfiler")}function nG(){let e=q();if(!e){Q&&A.warn("No Sentry client available, profiling is not started");return}if(!e.getIntegrationByName("BrowserProfiling")){Q&&A.warn("ProfilingIntegration is not available");return}e.emit("stopUIProfiler")}var qC={startProfiler:tG,stopProfiler:nG};var rG=10,oG=20,iG=30,aG=40,sG=50;function Wu(e,t,n,r){let o={filename:e,function:t==="<anonymous>"?"?":t,in_app:!0};return n!==void 0&&(o.lineno=n),r!==void 0&&(o.colno=r),o}var lG=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,cG=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,uG=/\((\S*)(?::(\d+))(?::(\d+))\)/,dG=/at (.+?) ?\(data:(.+?),/,fG=e=>{let t=e.match(dG);if(t)return{filename:`<data:${t[2]}>`,function:t[1]};let n=lG.exec(e);if(n){let[,o,i,a]=n;return Wu(o,"?",+i,+a)}let r=cG.exec(e);if(r){if(r[2]?.indexOf("eval")===0){let s=uG.exec(r[2]);s&&(r[2]=s[1],r[3]=s[2],r[4]=s[3])}let[i,a]=KC(r[1]||"?",r[2]);return Wu(a,i,r[3]?+r[3]:void 0,r[4]?+r[4]:void 0)}},RE=[iG,fG],pG=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,mG=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,gG=e=>{let t=pG.exec(e);if(t){if(t[3]&&t[3].indexOf(" > eval")>-1){let i=mG.exec(t[3]);i&&(t[1]=t[1]||"eval",t[3]=i[1],t[4]=i[2],t[5]="")}let r=t[3],o=t[1]||"?";return[o,r]=KC(o,r),Wu(r,o,t[4]?+t[4]:void 0,t[5]?+t[5]:void 0)}},CE=[sG,gG],hG=/^\s*at (?:((?:\[object object\])?.+) )?\(?((?:[-a-z]+):.*?):(\d+)(?::(\d+))?\)?\s*$/i,bG=e=>{let t=hG.exec(e);return t?Wu(t[2],t[1]||"?",+t[3],t[4]?+t[4]:void 0):void 0},VC=[aG,bG],yG=/ line (\d+).*script (?:in )?(\S+)(?:: in function (\S+))?$/i,_G=e=>{let t=yG.exec(e);return t?Wu(t[2],t[3]||"?",+t[1]):void 0},WC=[rG,_G],vG=/ line (\d+), column (\d+)\s*(?:in (?:<anonymous function: ([^>]+)>|([^)]+))\(.*\))? in (.*):\s*$/i,SG=e=>{let t=vG.exec(e);return t?Wu(t[5],t[3]||t[4]||"?",+t[1],+t[2]):void 0},YC=[oG,SG],ME=[RE,CE],qb=Sf(...ME),KC=(e,t)=>{let n=e.indexOf("safari-extension")!==-1,r=e.indexOf("safari-web-extension")!==-1;return n||r?[e.indexOf("@")!==-1?e.split("@")[0]:"?",n?`safari-extension:${t}`:`safari-web-extension:${t}`]:[e,t]};function XC(e,{metadata:t,tunnel:n,dsn:r}){let o={event_id:e.event_id,sent_at:new Date().toISOString(),...t?.sdk&&{sdk:{name:t.sdk.name,version:t.sdk.version}},...!!n&&!!r&&{dsn:pn(r)}},i=EG(e);return $t(o,[i])}function EG(e){return[{type:"user_report"},e]}var Vb=1024,TG="Breadcrumbs",wG=((e={})=>{let t={console:!0,dom:!0,fetch:!0,history:!0,sentry:!0,xhr:!0,...e};return{name:TG,setup(n){t.console&&xl(AG(n)),t.dom&&Tp(kG(n,t.dom)),t.xhr&&Gl(IG(n)),t.fetch&&ki(NG(n)),t.history&&sa(RG(n)),t.sentry&&n.on("beforeSendEvent",xG(n))}}}),Wb=wG;function xG(e){return function(n){q()===e&&Mn({category:`sentry.${n.type==="transaction"?"transaction":"event"}`,event_id:n.event_id,level:n.level,message:qo(n)},{event:n})}}function kG(e,t){return function(r){if(q()!==e)return;let o,i,a=typeof t=="object"?t.serializeAttribute:void 0,s=typeof t=="object"&&typeof t.maxStringLength=="number"?t.maxStringLength:void 0;s&&s>Vb&&(Q&&A.warn(`\`dom.maxStringLength\` cannot exceed ${Vb}, but a value of ${s} was configured. Sentry will use ${Vb} instead.`),s=Vb),typeof a=="string"&&(a=[a]);try{let c=r.event,d=CG(c)?c.target:c;o=_t(d,{keyAttrs:a,maxStringLength:s}),i=cs(d)}catch{o="<unknown>"}if(o.length===0)return;let l={category:`ui.${r.name}`,message:o};i&&(l.data={"ui.component_name":i}),Mn(l,{event:r.event,name:r.name,global:r.global})}}function AG(e){return function(n){if(q()!==e)return;let r={category:"console",data:{arguments:n.args,logger:"console"},level:ea(n.level),message:ja(n.args," ")};if(n.level==="assert")if(n.args[0]===!1)r.message=`Assertion failed: ${ja(n.args.slice(1)," ")||"console.assert"}`,r.data.arguments=n.args.slice(1);else return;Mn(r,{input:n.args,level:n.level})}}function IG(e){return function(n){if(q()!==e)return;let{startTimestamp:r,endTimestamp:o}=n,i=n.xhr[sr];if(!r||!o||!i)return;let{method:a,url:s,status_code:l,body:c}=i,d={method:a,url:s,status_code:l},u={xhr:n.xhr,input:c,startTimestamp:r,endTimestamp:o},m={category:"xhr",data:d,type:"http",level:db(l)};e.emit("beforeOutgoingRequestBreadcrumb",m,u),Mn(m,u)}}function NG(e){return function(n){if(q()!==e)return;let{startTimestamp:r,endTimestamp:o}=n;if(o&&!(n.fetchData.url.match(/sentry_key/)&&n.fetchData.method==="POST"))if(n.error){let i={data:n.error,input:n.args,startTimestamp:r,endTimestamp:o},a={category:"fetch",data:n.fetchData,level:"error",type:"http"};e.emit("beforeOutgoingRequestBreadcrumb",a,i),Mn(a,i)}else{let i=n.response,a={...n.fetchData,status_code:i?.status},s={input:n.args,response:i,startTimestamp:r,endTimestamp:o},l={category:"fetch",data:a,type:"http",level:db(a.status_code)};e.emit("beforeOutgoingRequestBreadcrumb",l,s),Mn(l,s)}}}function RG(e){return function(n){if(q()!==e)return;let r=n.from,o=n.to,i=fo(J.location.href),a=r?fo(r):void 0,s=fo(o);a?.path||(a=i),i.protocol===s.protocol&&i.host===s.host&&(o=s.relative),i.protocol===a.protocol&&i.host===a.host&&(r=a.relative),Mn({category:"navigation",data:{from:r,to:o}})}}function CG(e){return!!e&&!!e.target}var MG="EventTarget,Window,Node,ApplicationCache,AudioTrackList,BroadcastChannel,ChannelMergerNode,CryptoOperation,EventSource,FileReader,HTMLUnknownElement,IDBDatabase,IDBRequest,IDBTransaction,KeyOperation,MediaController,MessagePort,ModalWindow,Notification,SVGElementInstance,Screen,SharedWorker,TextTrack,TextTrackCue,TextTrackList,WebSocket,WebSocketWorker,Worker,XMLHttpRequest,XMLHttpRequestEventTarget,XMLHttpRequestUpload".split(","),OG="BrowserApiErrors",DG=((e={})=>{let t={XMLHttpRequest:!0,eventTarget:!0,requestAnimationFrame:!0,setInterval:!0,setTimeout:!0,unregisterOriginalCallbacks:!1,...e};return{name:OG,setupOnce(){t.setTimeout&&wt(J,"setTimeout",JC),t.setInterval&&wt(J,"setInterval",JC),t.requestAnimationFrame&&wt(J,"requestAnimationFrame",LG),t.XMLHttpRequest&&"XMLHttpRequest"in J&&wt(XMLHttpRequest.prototype,"send",UG);let n=t.eventTarget;n&&(Array.isArray(n)?n:MG).forEach(o=>PG(o,t))}}}),Yb=DG;function JC(e){return function(...t){let n=t[0];return t[0]=Ol(n,{mechanism:{handled:!1,type:`auto.browser.browserapierrors.${ir(e)}`}}),e.apply(this,t)}}function LG(e){return function(t){return e.apply(this,[Ol(t,{mechanism:{data:{handler:ir(e)},handled:!1,type:"auto.browser.browserapierrors.requestAnimationFrame"}})])}}function UG(e){return function(...t){let n=this;return["onload","onerror","onprogress","onreadystatechange"].forEach(o=>{o in n&&typeof n[o]=="function"&&wt(n,o,function(i){let a={mechanism:{data:{handler:ir(i)},handled:!1,type:`auto.browser.browserapierrors.xhr.${o}`}},s=$a(i);return s&&(a.mechanism.data.handler=ir(s)),Ol(i,a)})}),e.apply(this,t)}}function PG(e,t){let r=J[e]?.prototype;r?.hasOwnProperty?.("addEventListener")&&(wt(r,"addEventListener",function(o){return function(i,a,s){try{BG(a)&&(a.handleEvent=Ol(a.handleEvent,{mechanism:{data:{handler:ir(a),target:e},handled:!1,type:"auto.browser.browserapierrors.handleEvent"}}))}catch{}return t.unregisterOriginalCallbacks&&zG(this,i,a),o.apply(this,[i,Ol(a,{mechanism:{data:{handler:ir(a),target:e},handled:!1,type:"auto.browser.browserapierrors.addEventListener"}}),s])}}),wt(r,"removeEventListener",function(o){return function(i,a,s){try{if(Object.prototype.hasOwnProperty.call(a,"__sentry_wrapped__")){let l=a.__sentry_wrapped__;l&&o.call(this,i,l,s)}}catch{}return o.call(this,i,a,s)}}))}function BG(e){return typeof e.handleEvent=="function"}function zG(e,t,n){e&&typeof e=="object"&&"removeEventListener"in e&&typeof e.removeEventListener=="function"&&e.removeEventListener(t,n)}var Kb=(e={})=>{let t=e.lifecycle??"route";return{name:"BrowserSession",setupOnce(){if(typeof J.document>"u"){Q&&A.warn("Using the `browserSessionIntegration` in non-browser environments is not supported.");return}yl({ignoreDuration:!0});let n=!1;Ll(()=>{n||(Za(),n=!0)});let r=je(),o=r.getUser();r.addScopeListener(i=>{let a=i.getUser();(o?.id!==a?.id||o?.ip_address!==a?.ip_address)&&(o=a,n&&Za())}),t==="route"&&sa(({from:i,to:a})=>{i!==a&&(yl({ignoreDuration:!0}),Za(),n=!0)})}}};var FG="CultureContext",HG=(()=>({name:FG,preprocessEvent(e){let t=QC();t&&(e.contexts={...e.contexts,culture:{...t,...e.contexts?.culture}})},processSegmentSpan(e){let t=QC();t&&zr(e,{"culture.locale":t.locale,"culture.timezone":t.timezone,"culture.calendar":t.calendar})}})),Xb=HG;function QC(){try{let e=J.Intl;if(!e)return;let t=e.DateTimeFormat().resolvedOptions();return{locale:t.locale,timezone:t.timeZone,calendar:t.calendar}}catch{return}}var GG="GlobalHandlers",$G=((e={})=>{let t={onerror:!0,onunhandledrejection:!0,...e};return{name:GG,setupOnce(){Error.stackTraceLimit=50},setup(n){t.onerror&&(jG(n),ZC("onerror")),t.onunhandledrejection&&(qG(n),ZC("onunhandledrejection"))}}}),Jb=$G;function jG(e){Tf(t=>{let{stackParser:n,attachStacktrace:r}=e2();if(q()!==e||eE())return;let{msg:o,url:i,line:a,column:s,error:l}=t,c=VG(Uu(n,l||o,void 0,r,!1),i,a,s);c.level="error",uo(c,{originalException:l,mechanism:{handled:!1,type:"auto.browser.global_handlers.onerror"}})})}function qG(e){wf(t=>{let{stackParser:n,attachStacktrace:r}=e2();if(q()!==e||eE())return;let o=OE(t),i=dn(o)?DE(o):Uu(n,o,void 0,r,!0);i.level="error",uo(i,{originalException:o,mechanism:{handled:!1,type:"auto.browser.global_handlers.onunhandledrejection"}})})}function OE(e){if(dn(e))return e;try{if("reason"in e)return e.reason;if("detail"in e&&"reason"in e.detail)return e.detail.reason}catch{}return e}function DE(e){return{exception:{values:[{type:"UnhandledRejection",value:`Non-Error promise rejection captured with value: ${String(e)}`}]}}}function VG(e,t,n,r){let o=e.exception=e.exception||{},i=o.values=o.values||[],a=i[0]=i[0]||{},s=a.stacktrace=a.stacktrace||{},l=s.frames=s.frames||[];return l.length===0&&l.push({colno:r,lineno:n,filename:WG(t)??nr(),function:"?",in_app:!0}),e}function ZC(e){Q&&A.log(`Global Handler attached: ${e}`)}function e2(){return q()?.getOptions()||{stackParser:()=>[],attachStacktrace:!1}}function WG(e){if(!(!Tn(e)||e.length===0))return e.startsWith("data:")?`<${er(e,!1)}>`:e}var Qb=()=>({name:"HttpContext",preprocessEvent(e){if(!J.navigator&&!J.location&&!J.document)return;let t=Du(),n={...t.headers,...e.request?.headers};e.request={...t,...e.request,headers:n}},processSegmentSpan(e){let t=e.attributes?.[_e];if(!J.navigator&&!J.location&&!J.document)return;let n=Du();zr(e,{"url.full":t!=="http.client"?n.url:void 0,"http.request.header.user_agent":n.headers["User-Agent"],"http.request.header.referer":n.headers.Referer})}});var YG="cause",KG=5,XG="LinkedErrors",JG=((e={})=>{let t=e.limit||KG,n=e.key||YG;return{name:XG,preprocessEvent(r,o,i){let a=i.getOptions();lS(Lu,a.stackParser,n,t,r,o)}}}),Zb=JG;var QG=/^HTML(\w*)Element$/;function Yu(e){if(typeof window<"u"&&e===window)return"[Window]";if(typeof document<"u"&&e===document)return"[Document]";if(NE(e)){let t=ZG(e);if(QG.test(t))return`[HTMLElement: ${_t(e)}]`}}function ZG(e){let t=Object.getPrototypeOf(e);return t?.constructor?t.constructor.name:"null prototype"}function t2(){return e$()?(Q&&Sn(()=>{console.error("[Sentry] You cannot use Sentry.init() in a browser extension, see: https://docs.sentry.io/platforms/javascript/best-practices/browser-extensions/")}),!0):!1}function e$(){if(typeof J.window>"u")return!1;let e=J;if(e.nw||!(e.chrome||e.browser)?.runtime?.id)return!1;let n=nr();return!(J===J.top&&/^(?:chrome-extension|moz-extension|ms-browser-extension|safari-web-extension):\/\//.test(n))}function LE(e){return[sp(),ap(),yS(),Yb(),Wb(),Jb(),Zb(),lp(),Qb(),Xb(),Kb()]}function UE(e={}){let t=!e.skipBrowserExtensionCheck&&t2(),n=e.defaultIntegrations==null?LE():e.defaultIntegrations,r={...e,enabled:t?!1:e.enabled,stackParser:Og(e.stackParser||qb),integrations:Dh({integrations:e.integrations,defaultIntegrations:n}),transport:e.transport||Vu};return jc(Yu),Qv(Pu,r)}function n2(){}function r2(e){e()}function xp(e={}){let t=J.document,n=t?.head||t?.body;if(!n){Q&&A.error("[showReportDialog] Global document not defined");return}let r=ae(),i=q()?.getDsn();if(!i){Q&&A.error("[showReportDialog] DSN not configured");return}let a={...e,user:{...r.getUser(),...e.user},eventId:e.eventId||iu()},s=J.document.createElement("script");s.async=!0,s.crossOrigin="anonymous",s.src=Pv(i,a);let{onLoad:l,onClose:c}=a;if(l&&(s.onload=l),c){let d=u=>{if(u.data==="__sentry_reportdialog_closed__")try{c()}finally{J.removeEventListener("message",d)}};J.addEventListener("message",d)}n.appendChild(s)}var t$=ne,n$="ReportingObserver",o2=new WeakMap,r$=((e={})=>{let t=e.types||["crash","deprecation","intervention"];function n(r){if(o2.has(q()))for(let o of r)Ht(i=>{i.setExtra("url",o.url);let a=`ReportingObserver [${o.type}]`,s="No details available";if(o.body){let l={};for(let c in o.body)l[c]=o.body[c];if(i.setExtra("body",l),o.type==="crash"){let c=o.body;s=[c.crashId||"",c.reason||""].join(" ").trim()||s}else s=o.body.message||s}Ja(`${a}: ${s}`)})}return{name:n$,setupOnce(){if(!pb())return;new t$.ReportingObserver(n,{buffered:!0,types:t}).observe()},setup(r){o2.set(r,!0)}}}),i2=r$;var o$="HttpClient",i$=((e={})=>{let t={failedRequestStatusCodes:[[500,599]],failedRequestTargets:[/.*/],...e};return{name:o$,setup(n){f$(n,t),p$(n,t)}}}),s2=i$;function a$(e,t,n,r,o){if(l2(e,n.status,n.url)){let i=m$(t,r),a,s,l,c,d=u2();if(d.requestHeaders!==!1&&(a=ns(a2(i.headers),d.requestHeaders)),d.responseHeaders!==!1&&(s=ns(a2(n.headers),d.responseHeaders)),d.cookies!==!1){let m=i.headers.get("Cookie")||void 0;if(m){let g=op(m,d.cookies);typeof g=="object"&&(l=g)}let p=n.headers.get("Set-Cookie")||void 0;if(p){let g=op(p,d.cookies);typeof g=="object"&&(c=g)}}let u=c2({url:i.url,method:i.method,status:n.status,requestHeaders:a,responseHeaders:s,requestCookies:l,responseCookies:c,error:o,type:"fetch"});uo(u)}}function s$(e,t,n,r,o){if(l2(e,t.status,t.responseURL)){let i,a,s,l=u2();if(l.cookies!==!1)try{let d=t.getResponseHeader("Set-Cookie")||t.getResponseHeader("set-cookie")||void 0;if(d){let u=op(d,l.cookies);typeof u=="object"&&(a=u)}}catch{}if(l.responseHeaders!==!1)try{s=ns(c$(t),l.responseHeaders)}catch{}l.requestHeaders!==!1&&(i=ns(r,l.requestHeaders));let c=c2({url:t.responseURL,method:n,status:t.status,requestHeaders:i,responseHeaders:s,responseCookies:a,error:o,type:"xhr"});uo(c)}}function l$(e){if(e){let t=e["Content-Length"]||e["content-length"];if(t)return parseInt(t,10)}}function a2(e){let t={};return e.forEach((n,r)=>{t[r]=n}),t}function c$(e){let t=e.getAllResponseHeaders();return t?t.split(`\r
501
- `).reduce((n,r)=>{let[o,i]=r.split(": ");return o&&i&&(n[o]=i),n},{}):{}}function u$(e,t){return e.some(n=>typeof n=="string"?t.includes(n):n.test(t))}function d$(e,t){return e.some(n=>typeof n=="number"?n===t:t>=n[0]&&t<=n[1])}function f$(e,t){Nu()&&ki(n=>{if(q()!==e)return;let{response:r,args:o,error:i,virtualError:a}=n,[s,l]=o;r&&a$(t,s,r,l,i||a)},!1)}function p$(e,t){"XMLHttpRequest"in ne&&Gl(n=>{if(q()!==e)return;let{error:r,virtualError:o}=n,i=n.xhr,a=i[sr];if(!a)return;let{method:s,request_headers:l}=a;try{s$(t,i,s,l,r||o)}catch(c){Q&&A.warn("Error while extracting response event form XHR response",c)}})}function l2(e,t,n){return d$(e.failedRequestStatusCodes,t)&&u$(e.failedRequestTargets,n)&&!mu(n,q())}function c2(e){let t=q(),n=t&&e.error&&e.error instanceof Error?e.error.stack:void 0,r=n&&t?t.getOptions().stackParser(n,0,1):void 0,o=`HTTP Client Error with status code: ${e.status}`,i={message:o,exception:{values:[{type:"Error",value:o,stacktrace:r?{frames:r}:void 0}]},request:{url:e.url,method:e.method,headers:e.requestHeaders,cookies:e.requestCookies},contexts:{response:{status_code:e.status,headers:e.responseHeaders,cookies:e.responseCookies,body_size:l$(e.responseHeaders)}}};return Rn(i,{type:`auto.http.client.${e.type}`,handled:!1}),i}function m$(e,t){return!t&&e instanceof Request||e instanceof Request&&e.bodyUsed?e:new Request(e,t)}function u2(){let e=q();if(!e)return{cookies:!1,requestHeaders:!1,responseHeaders:!1};let t=e.getOptions();if(t.dataCollection==null){let o=!!t.sendDefaultPii;return{cookies:o,requestHeaders:o,responseHeaders:o}}let{cookies:n,httpHeaders:r}=e.getDataCollectionOptions();return{cookies:n,requestHeaders:r.request,responseHeaders:r.response}}var PE=ne,g$=7,h$="ContextLines",b$=((e={})=>({name:h$,processEvent(t,n,r){let o=e.frameContextLines??r?.getDataCollectionOptions().frameContextLines??g$;return y$(t,o)}})),d2=b$;function y$(e,t){let n=PE.document,r=PE.location&&pu(PE.location.href);if(!n||!r)return e;let o=e.exception?.values;if(!o?.length)return e;let i=n.documentElement.innerHTML;if(!i)return e;let a=["<!DOCTYPE html>","<html>",...i.split(`
502
- `),"</html>"];return o.forEach(s=>{let l=s.stacktrace;l?.frames&&(l.frames=l.frames.map(c=>_$(c,a,r,t)))}),e}function _$(e,t,n,r){return e.filename!==n||!e.lineno||!t.length||Pg(t,e,r),e}var v$="GraphQLClient",S$=(e=>({name:v$,setup(t){E$(t,e),T$(t,e)}}));function E$(e,t){e.on("beforeOutgoingRequestSpan",(n,r)=>{let i=ie(n).data||{};if(!(i[_e]==="http.client"))return;let l=i[Kc]||i["http.url"]||i.url,c=i[eh]||i["http.method"];if(!Tn(l)||!Tn(c))return;let{endpoints:d}=t,u=fn(l,d),m=p2(r);if(u&&m){let p=m2(m);if(p){let g=f2(p);n.updateName(`${c} ${l} (${g})`),ty(p)&&n.setAttribute("graphql.document",p.query),ny(p)&&(n.setAttribute("graphql.persisted_query.hash.sha256",p.extensions.persistedQuery.sha256Hash),n.setAttribute("graphql.persisted_query.version",p.extensions.persistedQuery.version))}}})}function T$(e,t){e.on("beforeOutgoingRequestBreadcrumb",(n,r)=>{let{category:o,type:i,data:a}=n;if(i==="http"&&(o==="fetch"||o==="xhr")){let d=a?.url,{endpoints:u}=t,m=fn(d,u),p=p2(r);if(m&&a&&p){let g=m2(p);if(!a.graphql&&g){let _=f2(g);a["graphql.operation"]=_,ty(g)&&(a["graphql.document"]=g.query),ny(g)&&(a["graphql.persisted_query.hash.sha256"]=g.extensions.persistedQuery.sha256Hash,a["graphql.persisted_query.version"]=g.extensions.persistedQuery.version)}}}})}function f2(e){if(ny(e))return`persisted ${e.operationName}`;if(ty(e)){let{query:t,operationName:n}=e,{operationName:r=n,operationType:o}=w$(t);return r?`${o} ${r}`:`${o}`}return"unknown"}function p2(e){let t="xhr"in e,n;if(t){let r=e.xhr[sr];n=r&&$l(r.body)[0]}else{let r=qu(e.input);n=$l(r)[0]}return n}function w$(e){let t=/^(?:\s*)(query|mutation|subscription)(?:\s*)(\w+)(?:\s*)[{(]/,n=/^(?:\s*)(query|mutation|subscription)(?:\s*)[{(]/,r=e.match(t);if(r)return{operationType:r[1],operationName:r[2]};let o=e.match(n);return o?{operationType:o[1],operationName:void 0}:{operationType:void 0,operationName:void 0}}function ey(e){return typeof e=="object"&&e!==null}function ty(e){return ey(e)&&typeof e.query=="string"}function ny(e){return ey(e)&&typeof e.operationName=="string"&&ey(e.extensions)&&ey(e.extensions.persistedQuery)&&typeof e.extensions.persistedQuery.sha256Hash=="string"&&typeof e.extensions.persistedQuery.version=="number"}function m2(e){try{let t=JSON.parse(e);return ty(t)||ny(t)?t:void 0}catch{return}}var g2=S$;var h2=(e={})=>{let t=["script"];function n(r,o,i=0){if(!r)return;let a="shadowRoot"in r&&r.shadowRoot?r.shadowRoot.children:r.children;for(let s of a){if(!(s instanceof HTMLElement))continue;let l=cs(s,1)||void 0,c=s.tagName.toLowerCase();if(t.includes(c))continue;let d=e.onElement?.({element:s,componentName:l,tagName:c,depth:i})||{};if(d==="skip")continue;if(d==="children"){n(s,o,i+1);continue}let{x:u,y:m,width:p,height:g}=s.getBoundingClientRect(),_={identifier:s.id||void 0,type:l||c,visible:!0,alpha:1,height:g,width:p,x:u,y:m,...d},y=[];_.children=y,n(s,_.children,i+1),o.push(_)}}return{name:"ViewHierarchy",processEvent:(r,o)=>{if(r.type!==void 0||e.shouldAttach?.(r,o)===!1)return r;let i={rendering_system:"DOM",positioning:"absolute",windows:[]};n(e.rootElement?.()||J.document.body,i.windows);let a={filename:"view-hierarchy.json",attachmentType:"event.view_hierarchy",contentType:"application/json",data:JSON.stringify(i)};return o.attachments=o.attachments||[],o.attachments.push(a),r}}};var Mt=ne,pT="sentryReplaySession",x$="replay_event",mT="Unable to send Replay",k$=3e5,A$=9e5,I$=5e3,N$=5500,R$=6e4,C$=5e3,M$=3,b2=15e4,ry=5e3,O$=3e3,D$=300,gT=2e7,L$=4999,U$=5e4,y2=36e5,P$=Object.defineProperty,B$=(e,t,n)=>t in e?P$(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,_2=(e,t,n)=>B$(e,typeof t!="symbol"?t+"":t,n),gn=(e=>(e[e.Document=0]="Document",e[e.DocumentType=1]="DocumentType",e[e.Element=2]="Element",e[e.Text=3]="Text",e[e.CDATA=4]="CDATA",e[e.Comment=5]="Comment",e))(gn||{});function z$(e){return e.nodeType===e.ELEMENT_NODE}function Ip(e){return e?.host?.shadowRoot===e}function Np(e){return Object.prototype.toString.call(e)==="[object ShadowRoot]"}function F$(e){return e.includes(" background-clip: text;")&&!e.includes(" -webkit-background-clip: text;")&&(e=e.replace(/\sbackground-clip:\s*text;/g," -webkit-background-clip: text; background-clip: text;")),e}function H$(e){let{cssText:t}=e;if(t.split('"').length<3)return t;let n=["@import",`url(${JSON.stringify(e.href)})`];return e.layerName===""?n.push("layer"):e.layerName&&n.push(`layer(${e.layerName})`),e.supportsText&&n.push(`supports(${e.supportsText})`),e.media.length&&n.push(e.media.mediaText),n.join(" ")+";"}function ly(e){try{let t=e.rules||e.cssRules;return t?F$(Array.from(t,$2).join("")):null}catch{return null}}function G$(e){let t="";for(let n=0;n<e.style.length;n++){let r=e.style,o=r[n],i=r.getPropertyPriority(o);t+=`${o}:${r.getPropertyValue(o)}${i?" !important":""};`}return`${e.selectorText} { ${t} }`}function $2(e){let t;if(j$(e))try{t=ly(e.styleSheet)||H$(e)}catch{}else if(q$(e)){let n=e.cssText,r=e.selectorText.includes(":"),o=typeof e.style.all=="string"&&e.style.all;if(o&&(n=G$(e)),r&&(n=$$(n)),r||o)return n}return t||e.cssText}function $$(e){let t=/(\[(?:[\w-]+)[^\\])(:(?:[\w-]+)\])/gm;return e.replace(t,"$1\\$2")}function j$(e){return"styleSheet"in e}function q$(e){return"selectorText"in e}var cy=class{constructor(){_2(this,"idNodeMap",new Map),_2(this,"nodeMetaMap",new WeakMap)}getId(t){return t?this.getMeta(t)?.id??-1:-1}getNode(t){return this.idNodeMap.get(t)||null}getIds(){return Array.from(this.idNodeMap.keys())}getMeta(t){return this.nodeMetaMap.get(t)||null}removeNodeFromMap(t){let n=this.getId(t);this.idNodeMap.delete(n),t.childNodes&&t.childNodes.forEach(r=>this.removeNodeFromMap(r))}has(t){return this.idNodeMap.has(t)}hasNode(t){return this.nodeMetaMap.has(t)}add(t,n){let r=n.id;this.idNodeMap.set(r,t),this.nodeMetaMap.set(t,n)}replace(t,n){let r=this.getNode(t);if(r){let o=this.nodeMetaMap.get(r);o&&this.nodeMetaMap.set(n,o)}this.idNodeMap.set(t,n)}reset(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap}};function V$(){return new cy}function Ty({maskInputOptions:e,tagName:t,type:n}){return t==="OPTION"&&(t="SELECT"),!!(e[t.toLowerCase()]||n&&e[n]||n==="password"||t==="INPUT"&&!n&&e.text)}function Cp({isMasked:e,element:t,value:n,maskInputFn:r}){let o=n||"";return e?(r&&(o=r(o,t)),"*".repeat(o.length)):o}function nd(e){return e.toLowerCase()}function $E(e){return e.toUpperCase()}var v2="__rrweb_original__";function W$(e){let t=e.getContext("2d");if(!t)return!0;let n=50;for(let r=0;r<e.width;r+=n)for(let o=0;o<e.height;o+=n){let i=t.getImageData,a=v2 in i?i[v2]:i;if(new Uint32Array(a.call(t,r,o,Math.min(n,e.width-r),Math.min(n,e.height-o)).data.buffer).some(l=>l!==0))return!1}return!0}function hT(e){let t=e.type;return e.hasAttribute("data-rr-is-password")?"password":t?nd(t):null}function uy(e,t,n){return t==="INPUT"&&(n==="radio"||n==="checkbox")?e.getAttribute("value")||"":e.value}function j2(e,t){let n;try{n=new URL(e,t??window.location.href)}catch{return null}let r=/\.([0-9a-z]+)(?:$)/i;return n.pathname.match(r)?.[1]??null}var S2={};function q2(e){let t=S2[e];if(t)return t;let n=window.document,r=window[e];if(n&&typeof n.createElement=="function")try{let o=n.createElement("iframe");o.hidden=!0,n.head.appendChild(o);let i=o.contentWindow;i&&i[e]&&(r=i[e]),n.head.removeChild(o)}catch{}return S2[e]=r.bind(window)}function jE(...e){return q2("setTimeout")(...e)}function V2(...e){return q2("clearTimeout")(...e)}function W2(e){try{return e.contentDocument}catch{}}function Y$(e){try{return e.contentWindow}catch{}}var K$=1,X$=new RegExp("[^a-z0-9-_:]"),Mp=-2;function bT(){return K$++}function J$(e){if(e instanceof HTMLFormElement)return"form";let t=nd(e.tagName);return X$.test(t)?"div":t}function Q$(e){let t="";return e.indexOf("//")>-1?t=e.split("/").slice(0,3).join("/"):t=e.split("/")[0],t=t.split("?")[0],t}var Ku,E2,Z$=/url\((?:(')([^']*)'|(")(.*?)"|([^)]*))\)/gm,ej=/^(?:[a-z+]+:)?\/\//i,tj=/^www\..*/i,nj=/^(data:)([^,]*),(.*)/i;function rj(e,t){if(!e||t.size===0)return e;try{let n=e.split(";"),r=[];for(let o of n){if(o=o.trim(),!o)continue;let i=o.indexOf(":");if(i===-1){r.push(o);continue}let a=o.slice(0,i).trim();t.has(a)||r.push(o)}return r.join("; ")+(r.length>0&&e.endsWith(";")?";":"")}catch(n){return console.warn("Error filtering CSS properties:",n),e}}function dy(e,t){return(e||"").replace(Z$,(n,r,o,i,a,s)=>{let l=o||a||s,c=r||i||"";if(!l)return n;if(ej.test(l)||tj.test(l))return`url(${c}${l}${c})`;if(nj.test(l))return`url(${c}${l}${c})`;if(l[0]==="/")return`url(${c}${Q$(t)+l}${c})`;let d=t.split("/"),u=l.split("/");d.pop();for(let m of u)m!=="."&&(m===".."?d.pop():d.push(m));return`url(${c}${d.join("/")}${c})`})}var oj=/^[^ \t\n\r\u000c]+/,ij=/^[, \t\n\r\u000c]+/;function aj(e,t){if(t.trim()==="")return t;let n=0;function r(i){let a,s=i.exec(t.substring(n));return s?(a=s[0],n+=a.length,a):""}let o=[];for(;r(ij),!(n>=t.length);){let i=r(oj);if(i.slice(-1)===",")i=Qu(e,i.substring(0,i.length-1)),o.push(i);else{let a="";i=Qu(e,i);let s=!1;for(;;){let l=t.charAt(n);if(l===""){o.push((i+a).trim());break}else if(s)l===")"&&(s=!1);else if(l===","){n+=1,o.push((i+a).trim());break}else l==="("&&(s=!0);a+=l,n+=1}}}return o.join(", ")}var T2=new WeakMap;function Qu(e,t){return!t||t.trim()===""?t:wy(e,t)}function sj(e){return!!(e.tagName==="svg"||e.ownerSVGElement)}function wy(e,t){let n=T2.get(e);if(n||(n=e.createElement("a"),T2.set(e,n)),!t)t="";else if(t.startsWith("blob:")||t.startsWith("data:"))return t;return n.setAttribute("href",t),n.href}function Y2(e,t,n,r,o,i,a){if(!r)return r;if(n==="src"||n==="href"&&!(t==="use"&&r[0]==="#"))return Qu(e,r);if(n==="xlink:href"&&r[0]!=="#")return Qu(e,r);if(n==="background"&&(t==="table"||t==="td"||t==="th"))return Qu(e,r);if(n==="srcset")return aj(e,r);if(n==="style"){let s=dy(r,wy(e));return a&&a.size>0&&(s=rj(s,a)),s}else if(t==="object"&&n==="data")return Qu(e,r);return typeof i=="function"?i(n,r,o):r}function K2(e,t,n){return(e==="video"||e==="audio")&&t==="autoplay"}function lj(e,t,n,r){try{if(r&&e.matches(r))return!1;if(typeof t=="string"){if(e.classList.contains(t))return!0}else for(let o=e.classList.length;o--;){let i=e.classList[o];if(t.test(i))return!0}if(n)return e.matches(n)}catch{}return!1}function cj(e,t){for(let n=e.classList.length;n--;){let r=e.classList[n];if(t.test(r))return!0}return!1}function jl(e,t,n=1/0,r=0){return!e||e.nodeType!==e.ELEMENT_NODE||r>n?-1:t(e)?r:jl(e.parentNode,t,n,r+1)}function Zu(e,t){return n=>{let r=n;if(r===null)return!1;try{if(e){if(typeof e=="string"){if(r.matches(`.${e}`))return!0}else if(cj(r,e))return!0}return!!(t&&r.matches(t))}catch{return!1}}}function rd(e,t,n,r,o,i){try{let a=e.nodeType===e.ELEMENT_NODE?e:e.parentElement;if(a===null)return!1;if(a.tagName==="INPUT"){let c=a.getAttribute("autocomplete");if(["current-password","new-password","cc-number","cc-exp","cc-exp-month","cc-exp-year","cc-csc"].includes(c))return!0}let s=-1,l=-1;if(i){if(l=jl(a,Zu(r,o)),l<0)return!0;s=jl(a,Zu(t,n),l>=0?l:1/0)}else{if(s=jl(a,Zu(t,n)),s<0)return!1;l=jl(a,Zu(r,o),s>=0?s:1/0)}return s>=0?l>=0?s<=l:!0:l>=0?!1:!!i}catch{}return!!i}function uj(e,t,n){let r=Y$(e);if(!r)return;let o=!1,i;try{i=r.document.readyState}catch{return}if(i!=="complete"){let s=jE(()=>{o||(t(),o=!0)},n);e.addEventListener("load",()=>{V2(s),o=!0,t()});return}let a="about:blank";if(r.location.href!==a||e.src===a||e.src==="")return jE(t,0),e.addEventListener("load",t);e.addEventListener("load",t)}function dj(e,t,n){let r=!1,o;try{o=e.sheet}catch{o=null}if(o)return;let i=jE(()=>{r||(t(),r=!0)},n);e.addEventListener("load",()=>{V2(i),r=!0,t()})}function fj(e,t){let{doc:n,mirror:r,blockClass:o,blockSelector:i,unblockSelector:a,maskAllText:s,maskAttributeFn:l,maskTextClass:c,unmaskTextClass:d,maskTextSelector:u,unmaskTextSelector:m,inlineStylesheet:p,maskInputOptions:g={},maskTextFn:_,maskInputFn:y,dataURLOptions:h={},inlineImages:v,recordCanvas:T,keepIframeSrcFn:x,newlyAddedElement:N=!1,ignoreCSSAttributes:M}=t,k=pj(n,r);switch(e.nodeType){case e.DOCUMENT_NODE:return e.compatMode!=="CSS1Compat"?{type:gn.Document,childNodes:[],compatMode:e.compatMode}:{type:gn.Document,childNodes:[]};case e.DOCUMENT_TYPE_NODE:return{type:gn.DocumentType,name:e.name,publicId:e.publicId,systemId:e.systemId,rootId:k};case e.ELEMENT_NODE:return gj(e,{doc:n,blockClass:o,blockSelector:i,unblockSelector:a,inlineStylesheet:p,maskAttributeFn:l,maskInputOptions:g,maskInputFn:y,dataURLOptions:h,inlineImages:v,recordCanvas:T,keepIframeSrcFn:x,newlyAddedElement:N,rootId:k,maskTextClass:c,unmaskTextClass:d,maskTextSelector:u,unmaskTextSelector:m,ignoreCSSAttributes:M});case e.TEXT_NODE:return mj(e,{doc:n,maskAllText:s,maskTextClass:c,unmaskTextClass:d,maskTextSelector:u,unmaskTextSelector:m,maskTextFn:_,maskInputOptions:g,maskInputFn:y,rootId:k});case e.CDATA_SECTION_NODE:return{type:gn.CDATA,textContent:"",rootId:k};case e.COMMENT_NODE:return{type:gn.Comment,textContent:e.textContent||"",rootId:k};default:return!1}}function pj(e,t){if(!t.hasNode(e))return;let n=t.getId(e);return n===1?void 0:n}function mj(e,t){let{maskAllText:n,maskTextClass:r,unmaskTextClass:o,maskTextSelector:i,unmaskTextSelector:a,maskTextFn:s,maskInputOptions:l,maskInputFn:c,rootId:d}=t,u=e.parentNode&&e.parentNode.tagName,m=e.textContent,p=u==="STYLE"?!0:void 0,g=u==="SCRIPT"?!0:void 0,_=u==="TEXTAREA"?!0:void 0;if(p&&m){try{e.nextSibling||e.previousSibling||e.parentNode.sheet?.cssRules&&(m=ly(e.parentNode.sheet))}catch(h){console.warn(`Cannot get CSS styles from text's parentNode. Error: ${h}`,e)}m=dy(m,wy(t.doc))}g&&(m="SCRIPT_PLACEHOLDER");let y=rd(e,r,i,o,a,n);if(!p&&!g&&!_&&m&&y&&(m=s?s(m,e.parentElement):m.replace(/[\S]/g,"*")),_&&m&&(l.textarea||y)&&(m=c?c(m,e.parentNode):m.replace(/[\S]/g,"*")),u==="OPTION"&&m){let h=Ty({type:null,tagName:u,maskInputOptions:l});m=Cp({isMasked:rd(e,r,i,o,a,h),element:e,value:m,maskInputFn:c})}return{type:gn.Text,textContent:m||"",isStyle:p,rootId:d}}function gj(e,t){let{doc:n,blockClass:r,blockSelector:o,unblockSelector:i,inlineStylesheet:a,maskInputOptions:s={},maskAttributeFn:l,maskInputFn:c,dataURLOptions:d={},inlineImages:u,recordCanvas:m,keepIframeSrcFn:p,newlyAddedElement:g=!1,rootId:_,maskTextClass:y,unmaskTextClass:h,maskTextSelector:v,unmaskTextSelector:T,ignoreCSSAttributes:x}=t,N=lj(e,r,o,i),M=J$(e),k={},P=e.attributes.length;for(let U=0;U<P;U++){let X=e.attributes[U];X.name&&!K2(M,X.name,X.value)&&(k[X.name]=Y2(n,M,nd(X.name),X.value,e,l,x))}if(M==="link"&&a){let U=Array.from(n.styleSheets).find(G=>G.href===e.href),X=null;U&&(X=ly(U)),X&&(k.rel=null,k.href=null,k.crossorigin=null,k._cssText=dy(X,U.href))}if(M==="style"&&e.sheet&&!(e.innerText||e.textContent||"").trim().length){let U=ly(e.sheet);U&&(k._cssText=dy(U,wy(n)))}if(M==="input"||M==="textarea"||M==="select"||M==="option"){let U=e,X=hT(U),G=uy(U,$E(M),X),R=U.checked;if(X!=="submit"&&X!=="button"&&G){let C=rd(U,y,v,h,T,Ty({type:X,tagName:$E(M),maskInputOptions:s}));k.value=Cp({isMasked:C,element:U,value:G,maskInputFn:c})}R&&(k.checked=R)}if(M==="option"&&(e.selected&&!s.select?k.selected=!0:delete k.selected),M==="canvas"&&m){if(e.__context==="2d")W$(e)||(k.rr_dataURL=e.toDataURL(d.type,d.quality));else if(!("__context"in e)){let U=e.toDataURL(d.type,d.quality),X=n.createElement("canvas");X.width=e.width,X.height=e.height;let G=X.toDataURL(d.type,d.quality);U!==G&&(k.rr_dataURL=U)}}if(M==="img"&&u){Ku||(Ku=n.createElement("canvas"),E2=Ku.getContext("2d"));let U=e,X=U.currentSrc||U.getAttribute("src")||"<unknown-src>",G=U.crossOrigin,R=()=>{U.removeEventListener("load",R);try{Ku.width=U.naturalWidth,Ku.height=U.naturalHeight,E2.drawImage(U,0,0),k.rr_dataURL=Ku.toDataURL(d.type,d.quality)}catch(C){if(U.crossOrigin!=="anonymous"){U.crossOrigin="anonymous",U.complete&&U.naturalWidth!==0?R():U.addEventListener("load",R);return}else console.warn(`Cannot inline img src=${X}! Error: ${C}`)}U.crossOrigin==="anonymous"&&(G?k.crossOrigin=G:U.removeAttribute("crossorigin"))};U.complete&&U.naturalWidth!==0?R():U.addEventListener("load",R)}if((M==="audio"||M==="video")&&(k.rr_mediaState=e.paused?"paused":"played",k.rr_mediaCurrentTime=e.currentTime),g||(e.scrollLeft&&(k.rr_scrollLeft=e.scrollLeft),e.scrollTop&&(k.rr_scrollTop=e.scrollTop)),N){let{width:U,height:X}=e.getBoundingClientRect();k={class:k.class,rr_width:`${U}px`,rr_height:`${X}px`}}M==="iframe"&&!p(k.src)&&(!N&&!W2(e)&&(k.rr_src=k.src),delete k.src);let F;try{customElements.get(M)&&(F=!0)}catch{}return{type:gn.Element,tagName:M,attributes:k,childNodes:[],isSVG:sj(e)||void 0,needBlock:N,rootId:_,isCustom:F}}function Ct(e){return e==null?"":e.toLowerCase()}function hj(e,t){if(t.comment&&e.type===gn.Comment)return!0;if(e.type===gn.Element){if(t.script&&(e.tagName==="script"||e.tagName==="link"&&(e.attributes.rel==="preload"||e.attributes.rel==="modulepreload")||e.tagName==="link"&&e.attributes.rel==="prefetch"&&typeof e.attributes.href=="string"&&j2(e.attributes.href)==="js"))return!0;if(t.headFavicon&&(e.tagName==="link"&&e.attributes.rel==="shortcut icon"||e.tagName==="meta"&&(Ct(e.attributes.name).match(/^msapplication-tile(image|color)$/)||Ct(e.attributes.name)==="application-name"||Ct(e.attributes.rel)==="icon"||Ct(e.attributes.rel)==="apple-touch-icon"||Ct(e.attributes.rel)==="shortcut icon")))return!0;if(e.tagName==="meta"){if(t.headMetaDescKeywords&&Ct(e.attributes.name).match(/^description|keywords$/))return!0;if(t.headMetaSocial&&(Ct(e.attributes.property).match(/^(og|twitter|fb):/)||Ct(e.attributes.name).match(/^(og|twitter):/)||Ct(e.attributes.name)==="pinterest"))return!0;if(t.headMetaRobots&&(Ct(e.attributes.name)==="robots"||Ct(e.attributes.name)==="googlebot"||Ct(e.attributes.name)==="bingbot"))return!0;if(t.headMetaHttpEquiv&&e.attributes["http-equiv"]!==void 0)return!0;if(t.headMetaAuthorship&&(Ct(e.attributes.name)==="author"||Ct(e.attributes.name)==="generator"||Ct(e.attributes.name)==="framework"||Ct(e.attributes.name)==="publisher"||Ct(e.attributes.name)==="progid"||Ct(e.attributes.property).match(/^article:/)||Ct(e.attributes.property).match(/^product:/)))return!0;if(t.headMetaVerification&&(Ct(e.attributes.name)==="google-site-verification"||Ct(e.attributes.name)==="yandex-verification"||Ct(e.attributes.name)==="csrf-token"||Ct(e.attributes.name)==="p:domain_verify"||Ct(e.attributes.name)==="verify-v1"||Ct(e.attributes.name)==="verification"||Ct(e.attributes.name)==="shopify-checkout-api-token"))return!0}}return!1}function ed(e,t){let{doc:n,mirror:r,blockClass:o,blockSelector:i,unblockSelector:a,maskAllText:s,maskTextClass:l,unmaskTextClass:c,maskTextSelector:d,unmaskTextSelector:u,skipChild:m=!1,inlineStylesheet:p=!0,maskInputOptions:g={},maskAttributeFn:_,maskTextFn:y,maskInputFn:h,slimDOMOptions:v,dataURLOptions:T={},inlineImages:x=!1,recordCanvas:N=!1,onSerialize:M,onIframeLoad:k,iframeLoadTimeout:P=5e3,onBlockedImageLoad:F,onStylesheetLoad:U,stylesheetLoadTimeout:X=5e3,keepIframeSrcFn:G=()=>!1,newlyAddedElement:R=!1,ignoreCSSAttributes:C}=t,{preserveWhiteSpace:$=!0}=t,ee=fj(e,{doc:n,mirror:r,blockClass:o,blockSelector:i,maskAllText:s,unblockSelector:a,maskTextClass:l,unmaskTextClass:c,maskTextSelector:d,unmaskTextSelector:u,inlineStylesheet:p,maskInputOptions:g,maskAttributeFn:_,maskTextFn:y,maskInputFn:h,dataURLOptions:T,inlineImages:x,recordCanvas:N,keepIframeSrcFn:G,newlyAddedElement:R,ignoreCSSAttributes:C});if(!ee)return console.warn(e,"not serialized"),null;let B;r.hasNode(e)?B=r.getId(e):hj(ee,v)||!$&&ee.type===gn.Text&&!ee.isStyle&&!ee.textContent.trim().length?B=Mp:B=bT();let H=Object.assign(ee,{id:B});if(r.add(e,H),B===Mp)return null;M&&M(e);let se=!m;if(H.type===gn.Element){se=se&&!H.needBlock;let te=e.shadowRoot;te&&Np(te)&&(H.isShadowHost=!0)}if((H.type===gn.Document||H.type===gn.Element)&&se){v.headWhitespace&&H.type===gn.Element&&H.tagName==="head"&&($=!1);let te={doc:n,mirror:r,blockClass:o,blockSelector:i,maskAllText:s,unblockSelector:a,maskTextClass:l,unmaskTextClass:c,maskTextSelector:d,unmaskTextSelector:u,skipChild:m,inlineStylesheet:p,maskInputOptions:g,maskAttributeFn:_,maskTextFn:y,maskInputFn:h,slimDOMOptions:v,dataURLOptions:T,inlineImages:x,recordCanvas:N,preserveWhiteSpace:$,onSerialize:M,onIframeLoad:k,iframeLoadTimeout:P,onBlockedImageLoad:F,onStylesheetLoad:U,stylesheetLoadTimeout:X,keepIframeSrcFn:G,ignoreCSSAttributes:C},ve=e.childNodes?Array.from(e.childNodes):[];for(let pe of ve){let Ge=ed(pe,te);Ge&&H.childNodes.push(Ge)}if(z$(e)&&e.shadowRoot)for(let pe of Array.from(e.shadowRoot.childNodes)){let Ge=ed(pe,te);Ge&&(Np(e.shadowRoot)&&(Ge.isShadow=!0),H.childNodes.push(Ge))}}if(e.parentNode&&Ip(e.parentNode)&&Np(e.parentNode)&&(H.isShadow=!0),H.type===gn.Element&&H.tagName==="iframe"&&!H.needBlock&&uj(e,()=>{let te=W2(e);if(te&&k){let ve=ed(te,{doc:te,mirror:r,blockClass:o,blockSelector:i,unblockSelector:a,maskAllText:s,maskTextClass:l,unmaskTextClass:c,maskTextSelector:d,unmaskTextSelector:u,skipChild:!1,inlineStylesheet:p,maskInputOptions:g,maskAttributeFn:_,maskTextFn:y,maskInputFn:h,slimDOMOptions:v,dataURLOptions:T,inlineImages:x,recordCanvas:N,preserveWhiteSpace:$,onSerialize:M,onIframeLoad:k,iframeLoadTimeout:P,onStylesheetLoad:U,stylesheetLoadTimeout:X,keepIframeSrcFn:G,ignoreCSSAttributes:C});ve&&k(e,ve)}},P),H.type===gn.Element&&H.tagName==="img"&&!e.complete&&H.needBlock){let te=e,ve=()=>{if(te.isConnected&&!te.complete&&F)try{let pe=te.getBoundingClientRect();pe.width>0&&pe.height>0&&F(te,H,pe)}catch{}te.removeEventListener("load",ve)};te.isConnected&&te.addEventListener("load",ve)}return H.type===gn.Element&&H.tagName==="link"&&typeof H.attributes.rel=="string"&&(H.attributes.rel==="stylesheet"||H.attributes.rel==="preload"&&typeof H.attributes.href=="string"&&j2(H.attributes.href)==="css")&&dj(e,()=>{if(U){let te=ed(e,{doc:n,mirror:r,blockClass:o,blockSelector:i,unblockSelector:a,maskAllText:s,maskTextClass:l,unmaskTextClass:c,maskTextSelector:d,unmaskTextSelector:u,skipChild:!1,inlineStylesheet:p,maskInputOptions:g,maskAttributeFn:_,maskTextFn:y,maskInputFn:h,slimDOMOptions:v,dataURLOptions:T,inlineImages:x,recordCanvas:N,preserveWhiteSpace:$,onSerialize:M,onIframeLoad:k,iframeLoadTimeout:P,onStylesheetLoad:U,stylesheetLoadTimeout:X,keepIframeSrcFn:G,ignoreCSSAttributes:C});te&&U(e,te)}},X),H.type===gn.Element&&delete H.needBlock,H}function bj(e,t){let{mirror:n=new cy,blockClass:r="rr-block",blockSelector:o=null,unblockSelector:i=null,maskAllText:a=!1,maskTextClass:s="rr-mask",unmaskTextClass:l=null,maskTextSelector:c=null,unmaskTextSelector:d=null,inlineStylesheet:u=!0,inlineImages:m=!1,recordCanvas:p=!1,maskAllInputs:g=!1,maskAttributeFn:_,maskTextFn:y,maskInputFn:h,slimDOM:v=!1,dataURLOptions:T,preserveWhiteSpace:x,onSerialize:N,onIframeLoad:M,iframeLoadTimeout:k,onBlockedImageLoad:P,onStylesheetLoad:F,stylesheetLoadTimeout:U,keepIframeSrcFn:X=()=>!1,ignoreCSSAttributes:G=new Set([])}=t||{};return ed(e,{doc:e,mirror:n,blockClass:r,blockSelector:o,unblockSelector:i,maskAllText:a,maskTextClass:s,unmaskTextClass:l,maskTextSelector:c,unmaskTextSelector:d,skipChild:!1,inlineStylesheet:u,maskInputOptions:g===!0?{color:!0,date:!0,"datetime-local":!0,email:!0,month:!0,number:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0,textarea:!0,select:!0}:g===!1?{}:g,maskAttributeFn:_,maskTextFn:y,maskInputFn:h,slimDOMOptions:v===!0||v==="all"?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaDescKeywords:v==="all",headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaAuthorship:!0,headMetaVerification:!0}:v===!1?{}:v,dataURLOptions:T,inlineImages:m,recordCanvas:p,preserveWhiteSpace:x,onSerialize:N,onIframeLoad:M,iframeLoadTimeout:k,onBlockedImageLoad:P,onStylesheetLoad:F,stylesheetLoadTimeout:U,keepIframeSrcFn:X,newlyAddedElement:!1,ignoreCSSAttributes:G})}function cr(e,t,n=document){let r={capture:!0,passive:!0};return n.addEventListener(e,t,r),()=>n.removeEventListener(e,t,r)}var Xu=`Please stop import mirror directly. Instead of that,\r
503
- now you can use replayer.getMirror() to access the mirror instance of a replayer,\r
504
- or you can use record.mirror to access the mirror instance during recording.`,w2={map:{},getId(){return console.error(Xu),-1},getNode(){return console.error(Xu),null},removeNodeFromMap(){console.error(Xu)},has(){return console.error(Xu),!1},reset(){console.error(Xu)}};typeof window<"u"&&window.Proxy&&window.Reflect&&(w2=new Proxy(w2,{get(e,t,n){return t==="map"&&console.error(Xu),Reflect.get(e,t,n)}}));function Op(e,t,n={}){let r=null,o=0;return function(...i){let a=Date.now();!o&&n.leading===!1&&(o=a);let s=t-(a-o),l=this;s<=0||s>t?(r&&(Tj(r),r=null),o=a,e.apply(l,i)):!r&&n.trailing!==!1&&(r=xy(()=>{o=n.leading===!1?0:Date.now(),r=null,e.apply(l,i)},s))}}function X2(e,t,n,r,o=window){let i=o.Object.getOwnPropertyDescriptor(e,t);return o.Object.defineProperty(e,t,r?n:{set(a){xy(()=>{n.set.call(this,a)},0),i&&i.set&&i.set.call(this,a)}}),()=>X2(e,t,i||{},!0)}function yT(e,t,n){try{if(!(t in e))return()=>{};let r=e[t],o=n(r);return typeof o=="function"&&(o.prototype=o.prototype||{},Object.defineProperties(o,{__rrweb_original__:{enumerable:!1,value:r}})),e[t]=o,()=>{e[t]=r}}catch{return()=>{}}}var fy=Date.now;/[1-9][0-9]{12}/.test(Date.now().toString())||(fy=()=>new Date().getTime());function J2(e){let t=e.document;return{left:t.scrollingElement?t.scrollingElement.scrollLeft:e.pageXOffset!==void 0?e.pageXOffset:t?.documentElement.scrollLeft||t?.body?.parentElement?.scrollLeft||t?.body?.scrollLeft||0,top:t.scrollingElement?t.scrollingElement.scrollTop:e.pageYOffset!==void 0?e.pageYOffset:t?.documentElement.scrollTop||t?.body?.parentElement?.scrollTop||t?.body?.scrollTop||0}}function Q2(){return window.innerHeight||document.documentElement&&document.documentElement.clientHeight||document.body&&document.body.clientHeight}function Z2(){return window.innerWidth||document.documentElement&&document.documentElement.clientWidth||document.body&&document.body.clientWidth}function eM(e){if(!e)return null;try{return e.nodeType===e.ELEMENT_NODE?e:e.parentElement}catch{return null}}function qr(e,t,n,r,o){if(!e)return!1;let i=eM(e);if(!i)return!1;let a=Zu(t,n);if(!o){let c=r&&i.matches(r);return a(i)&&!c}let s=jl(i,a),l=-1;return s<0?!1:(r&&(l=jl(i,Zu(null,r))),s>-1&&l<0?!0:s<l)}function yj(e,t){return t.getId(e)!==-1}function BE(e,t){return t.getId(e)===Mp}function tM(e,t){if(Ip(e))return!1;let n=t.getId(e);return t.has(n)?e.parentNode&&e.parentNode.nodeType===e.DOCUMENT_NODE?!1:e.parentNode?tM(e.parentNode,t):!0:!0}function qE(e){return!!e.changedTouches}function _j(e=window){"NodeList"in e&&!e.NodeList.prototype.forEach&&(e.NodeList.prototype.forEach=Array.prototype.forEach),"DOMTokenList"in e&&!e.DOMTokenList.prototype.forEach&&(e.DOMTokenList.prototype.forEach=Array.prototype.forEach),Node.prototype.contains||(Node.prototype.contains=(...t)=>{let n=t[0];if(!(0 in t))throw new TypeError("1 argument is required");do if(this===n)return!0;while(n=n&&n.parentNode);return!1})}function nM(e,t){return!!(e.nodeName==="IFRAME"&&t.getMeta(e))}function rM(e,t){return!!(e.nodeName==="LINK"&&e.nodeType===e.ELEMENT_NODE&&e.getAttribute&&e.getAttribute("rel")==="stylesheet"&&t.getMeta(e))}function VE(e){return!!e?.shadowRoot}var WE=class{constructor(){this.id=1,this.styleIDMap=new WeakMap,this.idStyleMap=new Map}getId(t){return this.styleIDMap.get(t)??-1}has(t){return this.styleIDMap.has(t)}add(t,n){if(this.has(t))return this.getId(t);let r;return n===void 0?r=this.id++:r=n,this.styleIDMap.set(t,r),this.idStyleMap.set(r,t),r}getStyle(t){return this.idStyleMap.get(t)||null}reset(){this.styleIDMap=new WeakMap,this.idStyleMap=new Map,this.id=1}generateId(){return this.id++}};function oM(e){let t=null;return e.getRootNode?.()?.nodeType===Node.DOCUMENT_FRAGMENT_NODE&&e.getRootNode().host&&(t=e.getRootNode().host),t}function vj(e){let t=e,n;for(;n=oM(t);)t=n;return t}function Sj(e){let t=e.ownerDocument;if(!t)return!1;let n=vj(e);return t.contains(n)}function iM(e){let t=e.ownerDocument;return t?t.contains(e)||Sj(e):!1}var x2={};function _T(e){let t=x2[e];if(t)return t;let n=window.document,r=window[e];if(n&&typeof n.createElement=="function")try{let o=n.createElement("iframe");o.hidden=!0,n.head.appendChild(o);let i=o.contentWindow;i&&i[e]&&(r=i[e]),n.head.removeChild(o)}catch{}return x2[e]=r.bind(window)}function Ej(...e){return _T("requestAnimationFrame")(...e)}function xy(...e){return _T("setTimeout")(...e)}function Tj(...e){return _T("clearTimeout")(...e)}var Ke=(e=>(e[e.DomContentLoaded=0]="DomContentLoaded",e[e.Load=1]="Load",e[e.FullSnapshot=2]="FullSnapshot",e[e.IncrementalSnapshot=3]="IncrementalSnapshot",e[e.Meta=4]="Meta",e[e.Custom=5]="Custom",e[e.Plugin=6]="Plugin",e))(Ke||{}),Oe=(e=>(e[e.Mutation=0]="Mutation",e[e.MouseMove=1]="MouseMove",e[e.MouseInteraction=2]="MouseInteraction",e[e.Scroll=3]="Scroll",e[e.ViewportResize=4]="ViewportResize",e[e.Input=5]="Input",e[e.TouchMove=6]="TouchMove",e[e.MediaInteraction=7]="MediaInteraction",e[e.StyleSheetRule=8]="StyleSheetRule",e[e.CanvasMutation=9]="CanvasMutation",e[e.Font=10]="Font",e[e.Log=11]="Log",e[e.Drag=12]="Drag",e[e.StyleDeclaration=13]="StyleDeclaration",e[e.Selection=14]="Selection",e[e.AdoptedStyleSheet=15]="AdoptedStyleSheet",e[e.CustomElement=16]="CustomElement",e))(Oe||{}),lr=(e=>(e[e.MouseUp=0]="MouseUp",e[e.MouseDown=1]="MouseDown",e[e.Click=2]="Click",e[e.ContextMenu=3]="ContextMenu",e[e.DblClick=4]="DblClick",e[e.Focus=5]="Focus",e[e.Blur=6]="Blur",e[e.TouchStart=7]="TouchStart",e[e.TouchMove_Departed=8]="TouchMove_Departed",e[e.TouchEnd=9]="TouchEnd",e[e.TouchCancel=10]="TouchCancel",e))(lr||{}),la=(e=>(e[e.Mouse=0]="Mouse",e[e.Pen=1]="Pen",e[e.Touch=2]="Touch",e))(la||{}),Ju=(e=>(e[e.Play=0]="Play",e[e.Pause=1]="Pause",e[e.Seeked=2]="Seeked",e[e.VolumeChange=3]="VolumeChange",e[e.RateChange=4]="RateChange",e))(Ju||{}),Rp;function wj(e){Rp=e}function xj(){Rp=void 0}var st=e=>Rp?((...n)=>{try{return e(...n)}catch(r){if(Rp&&Rp(r)===!0)return()=>{};throw r}}):e,k2="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",kj=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(kp=0;kp<k2.length;kp++)kj[k2.charCodeAt(kp)]=kp;var kp,py=class{reset(){}freeze(){}unfreeze(){}lock(){}unlock(){}snapshot(){}addWindow(){}addShadowRoot(){}resetShadowRoots(){}};function vT(e){try{return e.contentDocument}catch{}}function Dp(e){try{return e.contentWindow}catch{}}var YE=class{constructor(t){this.doc=t,this.unattachedDoc=null}parse(t){return this.parseWithConstructableStylesheet(t)||this.parseWithDetachedElement(t)}parseWithConstructableStylesheet(t){if(typeof CSSStyleSheet>"u"||typeof CSSStyleSheet.prototype.replaceSync!="function")return null;try{let n=new CSSStyleSheet;n.replaceSync(`x { ${t} }`);let r=n.cssRules[0];return!r||r.type!==CSSRule.STYLE_RULE?null:r.style}catch{return null}}parseWithDetachedElement(t){let n=this.getUnattachedDoc().createElement("span");return n.setAttribute("style",t),n.style}getUnattachedDoc(){if(!this.unattachedDoc)try{this.unattachedDoc=document.implementation.createHTMLDocument()}catch{this.unattachedDoc=this.doc}return this.unattachedDoc}};function A2(e){return"__ln"in e}var KE=class{constructor(){this.length=0,this.head=null,this.tail=null}get(t){if(t>=this.length)throw new Error("Position outside of list range");let n=this.head;for(let r=0;r<t;r++)n=n?.next||null;return n}addNode(t){let n={value:t,previous:null,next:null};if(t.__ln=n,t.previousSibling&&A2(t.previousSibling)){let r=t.previousSibling.__ln.next;n.next=r,n.previous=t.previousSibling.__ln,t.previousSibling.__ln.next=n,r&&(r.previous=n)}else if(t.nextSibling&&A2(t.nextSibling)&&t.nextSibling.__ln.previous){let r=t.nextSibling.__ln.previous;n.previous=r,n.next=t.nextSibling.__ln,t.nextSibling.__ln.previous=n,r&&(r.next=n)}else this.head&&(this.head.previous=n),n.next=this.head,this.head=n;n.next===null&&(this.tail=n),this.length++}removeNode(t){let n=t.__ln;this.head&&(n.previous?(n.previous.next=n.next,n.next?n.next.previous=n.previous:this.tail=n.previous):(this.head=n.next,this.head?this.head.previous=null:this.tail=null),t.__ln&&delete t.__ln,this.length--)}},I2=(e,t)=>`${e}@${t}`,XE=class{constructor(){this.frozen=!1,this.locked=!1,this.texts=[],this.attributes=[],this.attributeMap=new WeakMap,this.removes=[],this.mapRemoves=[],this.movedMap={},this.addedSet=new Set,this.movedSet=new Set,this.droppedSet=new Set,this.processMutations=t=>{t.forEach(this.processMutation),this.emit()},this.emit=()=>{if(this.frozen||this.locked)return;let t=[],n=new Set,r=new KE,o=l=>{let c=l,d=Mp;for(;d===Mp;)c=c&&c.nextSibling,d=c&&this.mirror.getId(c);return d},i=l=>{if(!l.parentNode||!iM(l))return;let c=Ip(l.parentNode)?this.mirror.getId(oM(l)):this.mirror.getId(l.parentNode),d=o(l);if(c===-1||d===-1)return r.addNode(l);let u=ed(l,{doc:this.doc,mirror:this.mirror,blockClass:this.blockClass,blockSelector:this.blockSelector,maskAllText:this.maskAllText,unblockSelector:this.unblockSelector,maskTextClass:this.maskTextClass,unmaskTextClass:this.unmaskTextClass,maskTextSelector:this.maskTextSelector,unmaskTextSelector:this.unmaskTextSelector,skipChild:!0,newlyAddedElement:!0,inlineStylesheet:this.inlineStylesheet,maskInputOptions:this.maskInputOptions,maskAttributeFn:this.maskAttributeFn,maskTextFn:this.maskTextFn,maskInputFn:this.maskInputFn,slimDOMOptions:this.slimDOMOptions,dataURLOptions:this.dataURLOptions,recordCanvas:this.recordCanvas,inlineImages:this.inlineImages,onSerialize:m=>{nM(m,this.mirror)&&!qr(m,this.blockClass,this.blockSelector,this.unblockSelector,!1)&&this.iframeManager.addIframe(m),rM(m,this.mirror)&&this.stylesheetManager.trackLinkElement(m),VE(l)&&this.shadowDomManager.addShadowRoot(l.shadowRoot,this.doc)},onIframeLoad:(m,p)=>{if(qr(m,this.blockClass,this.blockSelector,this.unblockSelector,!1))return;this.iframeManager.attachIframe(m,p);let g=Dp(m);g&&this.canvasManager.addWindow(g),this.shadowDomManager.observeAttachShadow(m)},onStylesheetLoad:(m,p)=>{this.stylesheetManager.attachLinkElement(m,p)},onBlockedImageLoad:(m,p,{width:g,height:_})=>{this.mutationCb({adds:[],removes:[],texts:[],attributes:[{id:p.id,attributes:{style:{width:`${g}px`,height:`${_}px`}}}]})},ignoreCSSAttributes:this.ignoreCSSAttributes});u&&(t.push({parentId:c,nextId:d,node:u}),n.add(u.id))};for(;this.mapRemoves.length;)this.mirror.removeNodeFromMap(this.mapRemoves.shift());for(let l of this.movedSet)N2(this.removes,l,this.mirror)&&!this.movedSet.has(l.parentNode)||i(l);for(let l of this.addedSet)!R2(this.droppedSet,l)&&!N2(this.removes,l,this.mirror)||R2(this.movedSet,l)?i(l):this.droppedSet.add(l);let a=null;for(;r.length;){let l=null;if(a){let c=this.mirror.getId(a.value.parentNode),d=o(a.value);c!==-1&&d!==-1&&(l=a)}if(!l){let c=r.tail;for(;c;){let d=c;if(c=c.previous,d){let u=this.mirror.getId(d.value.parentNode);if(o(d.value)===-1)continue;if(u!==-1){l=d;break}else{let p=d.value;if(p.parentNode&&p.parentNode.nodeType===Node.DOCUMENT_FRAGMENT_NODE){let g=p.parentNode.host;if(this.mirror.getId(g)!==-1){l=d;break}}}}}}if(!l){for(;r.head;)r.removeNode(r.head.value);break}a=l.previous,r.removeNode(l.value),i(l.value)}let s={texts:this.texts.map(l=>({id:this.mirror.getId(l.node),value:l.value})).filter(l=>!n.has(l.id)).filter(l=>this.mirror.has(l.id)),attributes:this.attributes.map(l=>{let{attributes:c}=l;if(typeof c.style=="string"){let d=JSON.stringify(l.styleDiff),u=JSON.stringify(l._unchangedStyles);d.length<c.style.length&&(d+u).split("var(").length===c.style.split("var(").length&&(c.style=l.styleDiff)}return{id:this.mirror.getId(l.node),attributes:c}}).filter(l=>!n.has(l.id)).filter(l=>this.mirror.has(l.id)),removes:this.removes,adds:t};!s.texts.length&&!s.attributes.length&&!s.removes.length&&!s.adds.length||(this.texts=[],this.attributes=[],this.attributeMap=new WeakMap,this.removes=[],this.addedSet=new Set,this.movedSet=new Set,this.droppedSet=new Set,this.movedMap={},this.mutationCb(s))},this.processMutation=t=>{if(!BE(t.target,this.mirror))switch(t.type){case"characterData":{let n=t.target.textContent;!qr(t.target,this.blockClass,this.blockSelector,this.unblockSelector,!1)&&n!==t.oldValue&&this.texts.push({value:rd(t.target,this.maskTextClass,this.maskTextSelector,this.unmaskTextClass,this.unmaskTextSelector,this.maskAllText)&&n?this.maskTextFn?this.maskTextFn(n,eM(t.target)):n.replace(/[\S]/g,"*"):n,node:t.target});break}case"attributes":{let n=t.target,r=t.attributeName,o=t.target.getAttribute(r);if(r==="value"){let a=hT(n),s=n.tagName;o=uy(n,s,a);let l=Ty({maskInputOptions:this.maskInputOptions,tagName:s,type:a}),c=rd(t.target,this.maskTextClass,this.maskTextSelector,this.unmaskTextClass,this.unmaskTextSelector,l);o=Cp({isMasked:c,element:n,value:o,maskInputFn:this.maskInputFn})}if(qr(t.target,this.blockClass,this.blockSelector,this.unblockSelector,!1)||o===t.oldValue)return;let i=this.attributeMap.get(t.target);if(n.tagName==="IFRAME"&&r==="src"&&!this.keepIframeSrcFn(o))if(!vT(n))r="rr_src";else return;if(i||(i={node:t.target,attributes:{},styleDiff:{},_unchangedStyles:{}},this.attributes.push(i),this.attributeMap.set(t.target,i)),r==="type"&&n.tagName==="INPUT"&&(t.oldValue||"").toLowerCase()==="password"&&n.setAttribute("data-rr-is-password","true"),!K2(n.tagName,r)&&(i.attributes[r]=Y2(this.doc,nd(n.tagName),nd(r),o,n,this.maskAttributeFn),r==="style")){let a=t.oldValue?this.styleDeclarationParser.parse(t.oldValue):null;for(let s of Array.from(n.style)){let l=n.style.getPropertyValue(s),c=n.style.getPropertyPriority(s);l!==(a?.getPropertyValue(s)||"")||c!==(a?.getPropertyPriority(s)||"")?c===""?i.styleDiff[s]=l:i.styleDiff[s]=[l,c]:i._unchangedStyles[s]=[l,c]}if(a)for(let s of Array.from(a))n.style.getPropertyValue(s)===""&&(i.styleDiff[s]=!1)}break}case"childList":{if(qr(t.target,this.blockClass,this.blockSelector,this.unblockSelector,!0))return;t.addedNodes.forEach(n=>this.genAdds(n,t.target)),t.removedNodes.forEach(n=>{let r=this.mirror.getId(n),o=Ip(t.target)?this.mirror.getId(t.target.host):this.mirror.getId(t.target);qr(t.target,this.blockClass,this.blockSelector,this.unblockSelector,!1)||BE(n,this.mirror)||!yj(n,this.mirror)||(this.addedSet.has(n)?(JE(this.addedSet,n),this.droppedSet.add(n)):this.addedSet.has(t.target)&&r===-1||tM(t.target,this.mirror)||(this.movedSet.has(n)&&this.movedMap[I2(r,o)]?JE(this.movedSet,n):this.removes.push({parentId:o,id:r,isShadow:Ip(t.target)&&Np(t.target)?!0:void 0})),this.mapRemoves.push(n))});break}}},this.genAdds=(t,n)=>{if(!this.processedNodeManager.inOtherBuffer(t,this)&&!(this.addedSet.has(t)||this.movedSet.has(t))){if(this.mirror.hasNode(t)){if(BE(t,this.mirror))return;this.movedSet.add(t);let r=null;n&&this.mirror.hasNode(n)&&(r=this.mirror.getId(n)),r&&r!==-1&&(this.movedMap[I2(this.mirror.getId(t),r)]=!0)}else this.addedSet.add(t),this.droppedSet.delete(t);qr(t,this.blockClass,this.blockSelector,this.unblockSelector,!1)||(t.childNodes&&t.childNodes.forEach(r=>this.genAdds(r)),VE(t)&&t.shadowRoot.childNodes.forEach(r=>{this.processedNodeManager.add(r,this),this.genAdds(r,t)}))}}}init(t){["mutationCb","blockClass","blockSelector","unblockSelector","maskAllText","maskTextClass","unmaskTextClass","maskTextSelector","unmaskTextSelector","inlineStylesheet","maskInputOptions","maskAttributeFn","maskTextFn","maskInputFn","keepIframeSrcFn","recordCanvas","inlineImages","slimDOMOptions","dataURLOptions","doc","mirror","iframeManager","stylesheetManager","shadowDomManager","canvasManager","processedNodeManager","ignoreCSSAttributes"].forEach(n=>{this[n]=t[n]}),this.styleDeclarationParser=new YE(this.doc)}freeze(){this.frozen=!0,this.canvasManager.freeze()}unfreeze(){this.frozen=!1,this.canvasManager.unfreeze(),this.emit()}isFrozen(){return this.frozen}lock(){this.locked=!0,this.canvasManager.lock()}unlock(){this.locked=!1,this.canvasManager.unlock(),this.emit()}reset(){this.shadowDomManager.reset(),this.canvasManager.reset()}};function JE(e,t){e.delete(t),t.childNodes?.forEach(n=>JE(e,n))}function N2(e,t,n){return e.length===0?!1:Aj(e,t,n)}function Aj(e,t,n){let r=t.parentNode;for(;r;){let o=n.getId(r);if(e.some(i=>i.id===o))return!0;r=r.parentNode}return!1}function R2(e,t){return e.size===0?!1:aM(e,t)}function aM(e,t){let{parentNode:n}=t;return n?e.has(n)?!0:aM(e,n):!1}var td=[];function zp(e){try{if("composedPath"in e){let t=e.composedPath();if(t.length)return t[0]}else if("path"in e&&e.path.length)return e.path[0]}catch{}return e&&e.target}function sM(e,t){let n=new XE;td.push(n),n.init(e);let r=window.MutationObserver||window.__rrMutationObserver,o=window?.Zone?.__symbol__?.("MutationObserver");o&&window[o]&&(r=window[o]);let i=new r(st(a=>{e.onMutation&&e.onMutation(a)===!1||n.processMutations.bind(n)(a)}));return i.observe(t,{attributes:!0,attributeOldValue:!0,characterData:!0,characterDataOldValue:!0,childList:!0,subtree:!0}),i}function Ij({mousemoveCb:e,sampling:t,doc:n,mirror:r}){if(t.mousemove===!1)return()=>{};let o=typeof t.mousemove=="number"?t.mousemove:50,i=typeof t.mousemoveCallback=="number"?t.mousemoveCallback:500,a=[],s,l=Op(st(u=>{let m=Date.now()-s;e(a.map(p=>(p.timeOffset-=m,p)),u),a=[],s=null}),i),c=st(Op(st(u=>{let m=zp(u),{clientX:p,clientY:g}=qE(u)?u.changedTouches[0]:u;s||(s=fy()),a.push({x:p,y:g,id:r.getId(m),timeOffset:fy()-s}),l(typeof DragEvent<"u"&&u instanceof DragEvent?Oe.Drag:u instanceof MouseEvent?Oe.MouseMove:Oe.TouchMove)}),o,{trailing:!1})),d=[cr("mousemove",c,n),cr("touchmove",c,n),cr("drag",c,n)];return st(()=>{d.forEach(u=>u())})}function Nj({mouseInteractionCb:e,doc:t,mirror:n,blockClass:r,blockSelector:o,unblockSelector:i,sampling:a}){if(a.mouseInteraction===!1)return()=>{};let s=a.mouseInteraction===!0||a.mouseInteraction===void 0?{}:a.mouseInteraction,l=[],c=null,d=u=>m=>{let p=zp(m);if(qr(p,r,o,i,!0))return;let g=null,_=u;if("pointerType"in m){switch(m.pointerType){case"mouse":g=la.Mouse;break;case"touch":g=la.Touch;break;case"pen":g=la.Pen;break}g===la.Touch?lr[u]===lr.MouseDown?_="TouchStart":lr[u]===lr.MouseUp&&(_="TouchEnd"):la.Pen}else qE(m)&&(g=la.Touch);g!==null?(c=g,(_.startsWith("Touch")&&g===la.Touch||_.startsWith("Mouse")&&g===la.Mouse)&&(g=null)):lr[u]===lr.Click&&(g=c,c=null);let y=qE(m)?m.changedTouches[0]:m;if(!y)return;let h=n.getId(p),{clientX:v,clientY:T}=y;st(e)({type:lr[_],id:h,x:v,y:T,...g!==null&&{pointerType:g}})};return Object.keys(lr).filter(u=>Number.isNaN(Number(u))&&!u.endsWith("_Departed")&&s[u]!==!1).forEach(u=>{let m=nd(u),p=d(u);if(window.PointerEvent)switch(lr[u]){case lr.MouseDown:case lr.MouseUp:m=m.replace("mouse","pointer");break;case lr.TouchStart:case lr.TouchEnd:return}l.push(cr(m,p,t))}),st(()=>{l.forEach(u=>u())})}function lM({scrollCb:e,doc:t,mirror:n,blockClass:r,blockSelector:o,unblockSelector:i,sampling:a}){let s=st(Op(st(l=>{let c=zp(l);if(!c||qr(c,r,o,i,!0))return;let d=n.getId(c);if(c===t&&t.defaultView){let u=J2(t.defaultView);e({id:d,x:u.left,y:u.top})}else e({id:d,x:c.scrollLeft,y:c.scrollTop})}),a.scroll||100));return cr("scroll",s,t)}function Rj({viewportResizeCb:e},{win:t}){let n=-1,r=-1,o=st(Op(st(()=>{let i=Q2(),a=Z2();(n!==i||r!==a)&&(e({width:Number(a),height:Number(i)}),n=i,r=a)}),200));return cr("resize",o,t)}var Cj=["INPUT","TEXTAREA","SELECT"],C2=new WeakMap;function Mj({inputCb:e,doc:t,mirror:n,blockClass:r,blockSelector:o,unblockSelector:i,ignoreClass:a,ignoreSelector:s,maskInputOptions:l,maskInputFn:c,sampling:d,userTriggeredOnInput:u,maskTextClass:m,unmaskTextClass:p,maskTextSelector:g,unmaskTextSelector:_}){function y(k){let P=zp(k),F=k.isTrusted,U=P&&$E(P.tagName);if(U==="OPTION"&&(P=P.parentElement),!P||!U||Cj.indexOf(U)<0||qr(P,r,o,i,!0))return;let X=P;if(X.classList.contains(a)||s&&X.matches(s))return;let G=hT(P),R=uy(X,U,G),C=!1,$=Ty({maskInputOptions:l,tagName:U,type:G}),ee=rd(P,m,g,p,_,$);(G==="radio"||G==="checkbox")&&(C=P.checked),R=Cp({isMasked:ee,element:P,value:R,maskInputFn:c}),h(P,u?{text:R,isChecked:C,userTriggered:F}:{text:R,isChecked:C});let B=P.name;G==="radio"&&B&&C&&t.querySelectorAll(`input[type="radio"][name="${B}"]`).forEach(H=>{if(H!==P){let se=Cp({isMasked:ee,element:H,value:uy(H,U,G),maskInputFn:c});h(H,u?{text:se,isChecked:!C,userTriggered:!1}:{text:se,isChecked:!C})}})}function h(k,P){let F=C2.get(k);if(!F||F.text!==P.text||F.isChecked!==P.isChecked){C2.set(k,P);let U=n.getId(k);st(e)({...P,id:U})}}let T=(d.input==="last"?["change"]:["input","change"]).map(k=>cr(k,st(y),t)),x=t.defaultView;if(!x)return()=>{T.forEach(k=>k())};let N=x.Object.getOwnPropertyDescriptor(x.HTMLInputElement.prototype,"value"),M=[[x.HTMLInputElement.prototype,"value"],[x.HTMLInputElement.prototype,"checked"],[x.HTMLSelectElement.prototype,"value"],[x.HTMLTextAreaElement.prototype,"value"],[x.HTMLSelectElement.prototype,"selectedIndex"],[x.HTMLOptionElement.prototype,"selected"]];return N&&N.set&&T.push(...M.map(k=>X2(k[0],k[1],{set(){st(y)({target:this,isTrusted:!1})}},!1,x))),st(()=>{T.forEach(k=>k())})}function my(e){let t=[];function n(r,o){if(oy("CSSGroupingRule")&&r.parentRule instanceof CSSGroupingRule||oy("CSSMediaRule")&&r.parentRule instanceof CSSMediaRule||oy("CSSSupportsRule")&&r.parentRule instanceof CSSSupportsRule||oy("CSSConditionRule")&&r.parentRule instanceof CSSConditionRule){let a=Array.from(r.parentRule.cssRules).indexOf(r);o.unshift(a)}else if(r.parentStyleSheet){let a=Array.from(r.parentStyleSheet.cssRules).indexOf(r);o.unshift(a)}return o}return n(e,t)}function ms(e,t,n){let r,o;return e?(e.ownerNode?r=t.getId(e.ownerNode):o=n.getId(e),{styleId:o,id:r}):{}}function Oj({styleSheetRuleCb:e,mirror:t,stylesheetManager:n},{win:r}){if(!r.CSSStyleSheet||!r.CSSStyleSheet.prototype)return()=>{};let o=r.CSSStyleSheet.prototype.insertRule;r.CSSStyleSheet.prototype.insertRule=new Proxy(o,{apply:st((d,u,m)=>{let[p,g]=m,{id:_,styleId:y}=ms(u,t,n.styleMirror);return(_&&_!==-1||y&&y!==-1)&&e({id:_,styleId:y,adds:[{rule:p,index:g}]}),d.apply(u,m)})});let i=r.CSSStyleSheet.prototype.deleteRule;r.CSSStyleSheet.prototype.deleteRule=new Proxy(i,{apply:st((d,u,m)=>{let[p]=m,{id:g,styleId:_}=ms(u,t,n.styleMirror);return(g&&g!==-1||_&&_!==-1)&&e({id:g,styleId:_,removes:[{index:p}]}),d.apply(u,m)})});let a;r.CSSStyleSheet.prototype.replace&&(a=r.CSSStyleSheet.prototype.replace,r.CSSStyleSheet.prototype.replace=new Proxy(a,{apply:st((d,u,m)=>{let[p]=m,{id:g,styleId:_}=ms(u,t,n.styleMirror);return(g&&g!==-1||_&&_!==-1)&&e({id:g,styleId:_,replace:p}),d.apply(u,m)})}));let s;r.CSSStyleSheet.prototype.replaceSync&&(s=r.CSSStyleSheet.prototype.replaceSync,r.CSSStyleSheet.prototype.replaceSync=new Proxy(s,{apply:st((d,u,m)=>{let[p]=m,{id:g,styleId:_}=ms(u,t,n.styleMirror);return(g&&g!==-1||_&&_!==-1)&&e({id:g,styleId:_,replaceSync:p}),d.apply(u,m)})}));let l={};iy("CSSGroupingRule")?l.CSSGroupingRule=r.CSSGroupingRule:(iy("CSSMediaRule")&&(l.CSSMediaRule=r.CSSMediaRule),iy("CSSConditionRule")&&(l.CSSConditionRule=r.CSSConditionRule),iy("CSSSupportsRule")&&(l.CSSSupportsRule=r.CSSSupportsRule));let c={};return Object.entries(l).forEach(([d,u])=>{c[d]={insertRule:u.prototype.insertRule,deleteRule:u.prototype.deleteRule},u.prototype.insertRule=new Proxy(c[d].insertRule,{apply:st((m,p,g)=>{let[_,y]=g,{id:h,styleId:v}=ms(p.parentStyleSheet,t,n.styleMirror);return(h&&h!==-1||v&&v!==-1)&&e({id:h,styleId:v,adds:[{rule:_,index:[...my(p),y||0]}]}),m.apply(p,g)})}),u.prototype.deleteRule=new Proxy(c[d].deleteRule,{apply:st((m,p,g)=>{let[_]=g,{id:y,styleId:h}=ms(p.parentStyleSheet,t,n.styleMirror);return(y&&y!==-1||h&&h!==-1)&&e({id:y,styleId:h,removes:[{index:[...my(p),_]}]}),m.apply(p,g)})})}),st(()=>{r.CSSStyleSheet.prototype.insertRule=o,r.CSSStyleSheet.prototype.deleteRule=i,a&&(r.CSSStyleSheet.prototype.replace=a),s&&(r.CSSStyleSheet.prototype.replaceSync=s),Object.entries(l).forEach(([d,u])=>{u.prototype.insertRule=c[d].insertRule,u.prototype.deleteRule=c[d].deleteRule})})}function cM({mirror:e,stylesheetManager:t},n){let r=null;n.nodeName==="#document"?r=e.getId(n):r=e.getId(n.host);let o=n.nodeName==="#document"?n.defaultView?.Document:n.ownerDocument?.defaultView?.ShadowRoot,i=o?.prototype?Object.getOwnPropertyDescriptor(o?.prototype,"adoptedStyleSheets"):void 0;return r===null||r===-1||!o||!i?()=>{}:(Object.defineProperty(n,"adoptedStyleSheets",{configurable:i.configurable,enumerable:i.enumerable,get(){return i.get?.call(this)},set(a){let s=i.set?.call(this,a);if(r!==null&&r!==-1)try{t.adoptStyleSheets(a,r)}catch{}return s}}),st(()=>{Object.defineProperty(n,"adoptedStyleSheets",{configurable:i.configurable,enumerable:i.enumerable,get:i.get,set:i.set})}))}function Dj({styleDeclarationCb:e,mirror:t,ignoreCSSAttributes:n,stylesheetManager:r},{win:o}){let i=o.CSSStyleDeclaration.prototype.setProperty;o.CSSStyleDeclaration.prototype.setProperty=new Proxy(i,{apply:st((s,l,c)=>{let[d,u,m]=c;if(n.has(d))return i.apply(l,[d,u,m]);let{id:p,styleId:g}=ms(l.parentRule?.parentStyleSheet,t,r.styleMirror);return(p&&p!==-1||g&&g!==-1)&&e({id:p,styleId:g,set:{property:d,value:u,priority:m},index:my(l.parentRule)}),s.apply(l,c)})});let a=o.CSSStyleDeclaration.prototype.removeProperty;return o.CSSStyleDeclaration.prototype.removeProperty=new Proxy(a,{apply:st((s,l,c)=>{let[d]=c;if(n.has(d))return a.apply(l,[d]);let{id:u,styleId:m}=ms(l.parentRule?.parentStyleSheet,t,r.styleMirror);return(u&&u!==-1||m&&m!==-1)&&e({id:u,styleId:m,remove:{property:d},index:my(l.parentRule)}),s.apply(l,c)})}),st(()=>{o.CSSStyleDeclaration.prototype.setProperty=i,o.CSSStyleDeclaration.prototype.removeProperty=a})}function Lj({mediaInteractionCb:e,blockClass:t,blockSelector:n,unblockSelector:r,mirror:o,sampling:i,doc:a}){let s=st(c=>Op(st(d=>{let u=zp(d);if(!u||qr(u,t,n,r,!0))return;let{currentTime:m,volume:p,muted:g,playbackRate:_}=u;e({type:c,id:o.getId(u),currentTime:m,volume:p,muted:g,playbackRate:_})}),i.media||500)),l=[cr("play",s(Ju.Play),a),cr("pause",s(Ju.Pause),a),cr("seeked",s(Ju.Seeked),a),cr("volumechange",s(Ju.VolumeChange),a),cr("ratechange",s(Ju.RateChange),a)];return st(()=>{l.forEach(c=>c())})}function Uj({fontCb:e,doc:t}){let n=t.defaultView;if(!n)return()=>{};let r=[],o=new WeakMap,i=n.FontFace;n.FontFace=function(l,c,d){let u=new i(l,c,d);return o.set(u,{family:l,buffer:typeof c!="string",descriptors:d,fontSource:typeof c=="string"?c:JSON.stringify(Array.from(new Uint8Array(c)))}),u};let a=yT(t.fonts,"add",function(s){return function(l){return xy(st(()=>{let c=o.get(l);c&&(e(c),o.delete(l))}),0),s.apply(this,[l])}});return r.push(()=>{n.FontFace=i}),r.push(a),st(()=>{r.forEach(s=>s())})}function Pj(e){let{doc:t,mirror:n,blockClass:r,blockSelector:o,unblockSelector:i,selectionCb:a}=e,s=!0,l=st(()=>{let c=t.getSelection();if(!c||s&&c?.isCollapsed)return;s=c.isCollapsed||!1;let d=[],u=c.rangeCount||0;for(let m=0;m<u;m++){let p=c.getRangeAt(m),{startContainer:g,startOffset:_,endContainer:y,endOffset:h}=p;qr(g,r,o,i,!0)||qr(y,r,o,i,!0)||d.push({start:n.getId(g),startOffset:_,end:n.getId(y),endOffset:h})}a({ranges:d})});return l(),cr("selectionchange",l)}function Bj({doc:e,customElementCb:t}){let n=e.defaultView;return!n||!n.customElements?()=>{}:yT(n.customElements,"define",function(o){return function(i,a,s){try{t({define:{name:i}})}catch{}return o.apply(this,[i,a,s])}})}function zj(e,t={}){let n=e.doc.defaultView;if(!n)return()=>{};let r;e.recordDOM&&(r=sM(e,e.doc));let o=Ij(e),i=Nj(e),a=lM(e),s=Rj(e,{win:n}),l=Mj(e),c=Lj(e),d=()=>{},u=()=>{},m=()=>{},p=()=>{};e.recordDOM&&(d=Oj(e,{win:n}),u=cM(e,e.doc),m=Dj(e,{win:n}),e.collectFonts&&(p=Uj(e)));let g=Pj(e),_=Bj(e),y=[];for(let h of e.plugins)y.push(h.observer(h.callback,n,h.options));return st(()=>{td.forEach(h=>h.reset()),r?.disconnect(),o(),i(),a(),s(),l(),c(),d(),u(),m(),p(),g(),_(),y.forEach(h=>h())})}function oy(e){return typeof window[e]<"u"}function iy(e){return!!(typeof window[e]<"u"&&window[e].prototype&&"insertRule"in window[e].prototype&&"deleteRule"in window[e].prototype)}var Lp=class{constructor(t){this.generateIdFn=t,this.iframeIdToRemoteIdMap=new WeakMap,this.iframeRemoteIdToIdMap=new WeakMap}getId(t,n,r,o){let i=r||this.getIdToRemoteIdMap(t),a=o||this.getRemoteIdToIdMap(t),s=i.get(n);return s||(s=this.generateIdFn(),i.set(n,s),a.set(s,n)),s}getIds(t,n){let r=this.getIdToRemoteIdMap(t),o=this.getRemoteIdToIdMap(t);return n.map(i=>this.getId(t,i,r,o))}getRemoteId(t,n,r){let o=r||this.getRemoteIdToIdMap(t);if(typeof n!="number")return n;let i=o.get(n);return i||-1}getRemoteIds(t,n){let r=this.getRemoteIdToIdMap(t);return n.map(o=>this.getRemoteId(t,o,r))}reset(t){if(!t){this.iframeIdToRemoteIdMap=new WeakMap,this.iframeRemoteIdToIdMap=new WeakMap;return}this.iframeIdToRemoteIdMap.delete(t),this.iframeRemoteIdToIdMap.delete(t)}getIdToRemoteIdMap(t){let n=this.iframeIdToRemoteIdMap.get(t);return n||(n=new Map,this.iframeIdToRemoteIdMap.set(t,n)),n}getRemoteIdToIdMap(t){let n=this.iframeRemoteIdToIdMap.get(t);return n||(n=new Map,this.iframeRemoteIdToIdMap.set(t,n)),n}},QE=class{constructor(){this.crossOriginIframeMirror=new Lp(bT),this.crossOriginIframeRootIdMap=new WeakMap}addIframe(){}addLoadListener(){}attachIframe(){}},ZE=class{constructor(t){this.iframes=new WeakMap,this.crossOriginIframeMap=new WeakMap,this.crossOriginIframeMirror=new Lp(bT),this.crossOriginIframeRootIdMap=new WeakMap,this.mutationCb=t.mutationCb,this.wrappedEmit=t.wrappedEmit,this.stylesheetManager=t.stylesheetManager,this.recordCrossOriginIframes=t.recordCrossOriginIframes,this.crossOriginIframeStyleMirror=new Lp(this.stylesheetManager.styleMirror.generateId.bind(this.stylesheetManager.styleMirror)),this.mirror=t.mirror,this.recordCrossOriginIframes&&window.addEventListener("message",this.handleMessage.bind(this))}addIframe(t){this.iframes.set(t,!0);let n=Dp(t);n&&this.crossOriginIframeMap.set(n,t)}addLoadListener(t){this.loadListener=t}attachIframe(t,n){this.mutationCb({adds:[{parentId:this.mirror.getId(t),nextId:null,node:n}],removes:[],texts:[],attributes:[],isAttachIframe:!0}),this.recordCrossOriginIframes&&Dp(t)?.addEventListener("message",this.handleMessage.bind(this)),this.loadListener?.(t);let r=vT(t);r&&r.adoptedStyleSheets&&r.adoptedStyleSheets.length>0&&this.stylesheetManager.adoptStyleSheets(r.adoptedStyleSheets,this.mirror.getId(r))}handleMessage(t){let n=t;if(n.data.type!=="rrweb"||n.origin!==n.data.origin||!t.source)return;let o=this.crossOriginIframeMap.get(t.source);if(!o)return;let i=this.transformCrossOriginEvent(o,n.data.event);i&&this.wrappedEmit(i,n.data.isCheckout)}transformCrossOriginEvent(t,n){switch(n.type){case Ke.FullSnapshot:{this.crossOriginIframeMirror.reset(t),this.crossOriginIframeStyleMirror.reset(t),this.replaceIdOnNode(n.data.node,t);let r=n.data.node.id;return this.crossOriginIframeRootIdMap.set(t,r),this.patchRootIdOnNode(n.data.node,r),{timestamp:n.timestamp,type:Ke.IncrementalSnapshot,data:{source:Oe.Mutation,adds:[{parentId:this.mirror.getId(t),nextId:null,node:n.data.node}],removes:[],texts:[],attributes:[],isAttachIframe:!0}}}case Ke.Meta:case Ke.Load:case Ke.DomContentLoaded:return!1;case Ke.Plugin:return n;case Ke.Custom:return this.replaceIds(n.data.payload,t,["id","parentId","previousId","nextId"]),n;case Ke.IncrementalSnapshot:switch(n.data.source){case Oe.Mutation:return n.data.adds.forEach(r=>{this.replaceIds(r,t,["parentId","nextId","previousId"]),this.replaceIdOnNode(r.node,t);let o=this.crossOriginIframeRootIdMap.get(t);o&&this.patchRootIdOnNode(r.node,o)}),n.data.removes.forEach(r=>{this.replaceIds(r,t,["parentId","id"])}),n.data.attributes.forEach(r=>{this.replaceIds(r,t,["id"])}),n.data.texts.forEach(r=>{this.replaceIds(r,t,["id"])}),n;case Oe.Drag:case Oe.TouchMove:case Oe.MouseMove:return n.data.positions.forEach(r=>{this.replaceIds(r,t,["id"])}),n;case Oe.ViewportResize:return!1;case Oe.MediaInteraction:case Oe.MouseInteraction:case Oe.Scroll:case Oe.CanvasMutation:case Oe.Input:return this.replaceIds(n.data,t,["id"]),n;case Oe.StyleSheetRule:case Oe.StyleDeclaration:return this.replaceIds(n.data,t,["id"]),this.replaceStyleIds(n.data,t,["styleId"]),n;case Oe.Font:return n;case Oe.Selection:return n.data.ranges.forEach(r=>{this.replaceIds(r,t,["start","end"])}),n;case Oe.AdoptedStyleSheet:return this.replaceIds(n.data,t,["id"]),this.replaceStyleIds(n.data,t,["styleIds"]),n.data.styles?.forEach(r=>{this.replaceStyleIds(r,t,["styleId"])}),n}}return!1}replace(t,n,r,o){for(let i of o)!Array.isArray(n[i])&&typeof n[i]!="number"||(Array.isArray(n[i])?n[i]=t.getIds(r,n[i]):n[i]=t.getId(r,n[i]));return n}replaceIds(t,n,r){return this.replace(this.crossOriginIframeMirror,t,n,r)}replaceStyleIds(t,n,r){return this.replace(this.crossOriginIframeStyleMirror,t,n,r)}replaceIdOnNode(t,n){this.replaceIds(t,n,["id","rootId"]),"childNodes"in t&&t.childNodes.forEach(r=>{this.replaceIdOnNode(r,n)})}patchRootIdOnNode(t,n){t.type!==gn.Document&&!t.rootId&&(t.rootId=n),"childNodes"in t&&t.childNodes.forEach(r=>{this.patchRootIdOnNode(r,n)})}},eT=class{init(){}addShadowRoot(){}observeAttachShadow(){}reset(){}},tT=class{constructor(t){this.shadowDoms=new WeakSet,this.restoreHandlers=[],this.mutationCb=t.mutationCb,this.scrollCb=t.scrollCb,this.bypassOptions=t.bypassOptions,this.mirror=t.mirror,this.init()}init(){this.reset(),this.patchAttachShadow(Element,document)}addShadowRoot(t,n){if(!Np(t)||this.shadowDoms.has(t))return;this.shadowDoms.add(t),this.bypassOptions.canvasManager.addShadowRoot(t);let r=sM({...this.bypassOptions,doc:n,mutationCb:this.mutationCb,mirror:this.mirror,shadowDomManager:this},t);this.restoreHandlers.push(()=>r.disconnect()),this.restoreHandlers.push(lM({...this.bypassOptions,scrollCb:this.scrollCb,doc:t,mirror:this.mirror})),xy(()=>{t.adoptedStyleSheets&&t.adoptedStyleSheets.length>0&&this.bypassOptions.stylesheetManager.adoptStyleSheets(t.adoptedStyleSheets,this.mirror.getId(t.host)),this.restoreHandlers.push(cM({mirror:this.mirror,stylesheetManager:this.bypassOptions.stylesheetManager},t))},0)}observeAttachShadow(t){let n=vT(t),r=Dp(t);!n||!r||this.patchAttachShadow(r.Element,n)}patchAttachShadow(t,n){let r=this;this.restoreHandlers.push(yT(t.prototype,"attachShadow",function(o){return function(i){let a=o.call(this,i);return this.shadowRoot&&iM(this)&&r.addShadowRoot(this.shadowRoot,n),a}}))}reset(){this.restoreHandlers.forEach(t=>{try{t()}catch{}}),this.restoreHandlers=[],this.shadowDoms=new WeakSet,this.bypassOptions.canvasManager.resetShadowRoots()}},nT=class{constructor(t){this.trackedLinkElements=new WeakSet,this.styleMirror=new WE,this.mutationCb=t.mutationCb,this.adoptedStyleSheetCb=t.adoptedStyleSheetCb}attachLinkElement(t,n){"_cssText"in n.attributes&&this.mutationCb({adds:[],removes:[],texts:[],attributes:[{id:n.id,attributes:n.attributes}]}),this.trackLinkElement(t)}trackLinkElement(t){this.trackedLinkElements.has(t)||(this.trackedLinkElements.add(t),this.trackStylesheetInLinkElement(t))}adoptStyleSheets(t,n){if(t.length===0)return;let r={id:n,styleIds:[]},o=[];for(let i of t){let a;this.styleMirror.has(i)?a=this.styleMirror.getId(i):(a=this.styleMirror.add(i),o.push({styleId:a,rules:Array.from(i.rules||CSSRule,(s,l)=>({rule:$2(s),index:l}))})),r.styleIds.push(a)}o.length>0&&(r.styles=o),this.adoptedStyleSheetCb(r)}reset(){this.styleMirror.reset(),this.trackedLinkElements=new WeakSet}trackStylesheetInLinkElement(t){}},rT=class{constructor(){this.nodeMap=new WeakMap,this.active=!1}inOtherBuffer(t,n){let r=this.nodeMap.get(t);return r&&Array.from(r).some(o=>o!==n)}add(t,n){this.active||(this.active=!0,Ej(()=>{this.nodeMap=new WeakMap,this.active=!1})),this.nodeMap.set(t,(this.nodeMap.get(t)||new Set).add(n))}destroy(){}},nn,gy;try{if(Array.from([1],e=>e*2)[0]!==2){let e=document.createElement("iframe");document.body.appendChild(e),Array.from=e.contentWindow?.Array.from||Array.from,document.body.removeChild(e)}}catch(e){console.debug("Unable to override Array.from",e)}var ti=V$();function ni(e={}){let{emit:t,checkoutEveryNms:n,checkoutEveryNth:r,blockClass:o="rr-block",blockSelector:i=null,unblockSelector:a=null,ignoreClass:s="rr-ignore",ignoreSelector:l=null,maskAllText:c=!1,maskTextClass:d="rr-mask",unmaskTextClass:u=null,maskTextSelector:m=null,unmaskTextSelector:p=null,inlineStylesheet:g=!0,maskAllInputs:_,maskInputOptions:y,slimDOMOptions:h,maskAttributeFn:v,maskInputFn:T,maskTextFn:x,maxCanvasSize:N=null,packFn:M,sampling:k={},dataURLOptions:P={},mousemoveWait:F,recordDOM:U=!0,recordCanvas:X=!1,recordCrossOriginIframes:G=!1,recordAfter:R=e.recordAfter==="DOMContentLoaded"?e.recordAfter:"load",userTriggeredOnInput:C=!1,collectFonts:$=!1,inlineImages:ee=!1,plugins:B,keepIframeSrcFn:H=()=>!1,ignoreCSSAttributes:se=new Set([]),errorHandler:te,onMutation:ve,getCanvasManager:pe}=e;wj(te);let Ge=G?window.parent===window:!0,re=!1;if(!Ge)try{window.parent.document&&(re=!1)}catch{re=!0}if(Ge&&!t)throw new Error("emit function is required");if(!Ge&&!re)return()=>{};F!==void 0&&k.mousemove===void 0&&(k.mousemove=F),ti.reset();let Je=_===!0?{color:!0,date:!0,"datetime-local":!0,email:!0,month:!0,number:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0,textarea:!0,select:!0,radio:!0,checkbox:!0}:y!==void 0?y:{},Kt=h===!0||h==="all"?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaVerification:!0,headMetaAuthorship:h==="all",headMetaDescKeywords:h==="all"}:h||{};_j();let it,Z=0,Le=ue=>{for(let Ve of B||[])Ve.eventProcessor&&(ue=Ve.eventProcessor(ue));return M&&!re&&(ue=M(ue)),ue};nn=(ue,Ve)=>{let Te=ue;if(Te.timestamp=fy(),td[0]?.isFrozen()&&Te.type!==Ke.FullSnapshot&&!(Te.type===Ke.IncrementalSnapshot&&Te.data.source===Oe.Mutation)&&td.forEach(We=>We.unfreeze()),Ge)t?.(Le(Te),Ve);else if(re){let We={type:"rrweb",event:Le(Te),origin:window.location.origin,isCheckout:Ve};window.parent.postMessage(We,"*")}if(Te.type===Ke.FullSnapshot)it=Te,Z=0;else if(Te.type===Ke.IncrementalSnapshot){if(Te.data.source===Oe.Mutation&&Te.data.isAttachIframe)return;Z++;let We=r&&Z>=r,oe=n&&it&&Te.timestamp-it.timestamp>n;(We||oe)&&an(!0)}};let De=ue=>{nn({type:Ke.IncrementalSnapshot,data:{source:Oe.Mutation,...ue}})},et=ue=>nn({type:Ke.IncrementalSnapshot,data:{source:Oe.Scroll,...ue}}),dt=ue=>nn({type:Ke.IncrementalSnapshot,data:{source:Oe.CanvasMutation,...ue}}),me=ue=>nn({type:Ke.IncrementalSnapshot,data:{source:Oe.AdoptedStyleSheet,...ue}}),lt=new nT({mutationCb:De,adoptedStyleSheetCb:me}),we=typeof __RRWEB_EXCLUDE_IFRAME__=="boolean"&&__RRWEB_EXCLUDE_IFRAME__?new QE:new ZE({mirror:ti,mutationCb:De,stylesheetManager:lt,recordCrossOriginIframes:G,wrappedEmit:nn});for(let ue of B||[])ue.getMirror&&ue.getMirror({nodeMirror:ti,crossOriginIframeMirror:we.crossOriginIframeMirror,crossOriginIframeStyleMirror:we.crossOriginIframeStyleMirror});let tt=new rT,vn=Hj(pe,{mirror:ti,win:window,mutationCb:ue=>nn({type:Ke.IncrementalSnapshot,data:{source:Oe.CanvasMutation,...ue}}),recordCanvas:X,blockClass:o,blockSelector:i,unblockSelector:a,maxCanvasSize:N,sampling:k.canvas,dataURLOptions:P,errorHandler:te}),An=typeof __RRWEB_EXCLUDE_SHADOW_DOM__=="boolean"&&__RRWEB_EXCLUDE_SHADOW_DOM__?new eT:new tT({mutationCb:De,scrollCb:et,bypassOptions:{onMutation:ve,blockClass:o,blockSelector:i,unblockSelector:a,maskAllText:c,maskTextClass:d,unmaskTextClass:u,maskTextSelector:m,unmaskTextSelector:p,inlineStylesheet:g,maskInputOptions:Je,dataURLOptions:P,maskAttributeFn:v,maskTextFn:x,maskInputFn:T,recordCanvas:X,inlineImages:ee,sampling:k,slimDOMOptions:Kt,iframeManager:we,stylesheetManager:lt,canvasManager:vn,keepIframeSrcFn:H,processedNodeManager:tt,ignoreCSSAttributes:se},mirror:ti}),an=(ue=!1)=>{if(!U)return;nn({type:Ke.Meta,data:{href:window.location.href,width:Z2(),height:Q2()}},ue),lt.reset(),An.init(),td.forEach(Te=>Te.lock());let Ve=bj(document,{mirror:ti,blockClass:o,blockSelector:i,unblockSelector:a,maskAllText:c,maskTextClass:d,unmaskTextClass:u,maskTextSelector:m,unmaskTextSelector:p,inlineStylesheet:g,maskAllInputs:Je,maskAttributeFn:v,maskInputFn:T,maskTextFn:x,slimDOM:Kt,dataURLOptions:P,recordCanvas:X,inlineImages:ee,onSerialize:Te=>{nM(Te,ti)&&we.addIframe(Te),rM(Te,ti)&&lt.trackLinkElement(Te),VE(Te)&&An.addShadowRoot(Te.shadowRoot,document)},onIframeLoad:(Te,We)=>{we.attachIframe(Te,We);let oe=Dp(Te);oe&&vn.addWindow(oe),An.observeAttachShadow(Te)},onStylesheetLoad:(Te,We)=>{lt.attachLinkElement(Te,We)},onBlockedImageLoad:(Te,We,{width:oe,height:ge})=>{De({adds:[],removes:[],texts:[],attributes:[{id:We.id,attributes:{style:{width:`${oe}px`,height:`${ge}px`}}}]})},keepIframeSrcFn:H,ignoreCSSAttributes:se});if(!Ve)return console.warn("Failed to snapshot the document");nn({type:Ke.FullSnapshot,data:{node:Ve,initialOffset:J2(window)}}),td.forEach(Te=>Te.unlock()),document.adoptedStyleSheets&&document.adoptedStyleSheets.length>0&&lt.adoptStyleSheets(document.adoptedStyleSheets,ti.getId(document))};gy=an;try{let ue=[],Ve=We=>st(zj)({onMutation:ve,mutationCb:De,mousemoveCb:(oe,ge)=>nn({type:Ke.IncrementalSnapshot,data:{source:ge,positions:oe}}),mouseInteractionCb:oe=>nn({type:Ke.IncrementalSnapshot,data:{source:Oe.MouseInteraction,...oe}}),scrollCb:et,viewportResizeCb:oe=>nn({type:Ke.IncrementalSnapshot,data:{source:Oe.ViewportResize,...oe}}),inputCb:oe=>nn({type:Ke.IncrementalSnapshot,data:{source:Oe.Input,...oe}}),mediaInteractionCb:oe=>nn({type:Ke.IncrementalSnapshot,data:{source:Oe.MediaInteraction,...oe}}),styleSheetRuleCb:oe=>nn({type:Ke.IncrementalSnapshot,data:{source:Oe.StyleSheetRule,...oe}}),styleDeclarationCb:oe=>nn({type:Ke.IncrementalSnapshot,data:{source:Oe.StyleDeclaration,...oe}}),canvasMutationCb:dt,fontCb:oe=>nn({type:Ke.IncrementalSnapshot,data:{source:Oe.Font,...oe}}),selectionCb:oe=>{nn({type:Ke.IncrementalSnapshot,data:{source:Oe.Selection,...oe}})},customElementCb:oe=>{nn({type:Ke.IncrementalSnapshot,data:{source:Oe.CustomElement,...oe}})},blockClass:o,ignoreClass:s,ignoreSelector:l,maskAllText:c,maskTextClass:d,unmaskTextClass:u,maskTextSelector:m,unmaskTextSelector:p,maskInputOptions:Je,inlineStylesheet:g,sampling:k,recordDOM:U,recordCanvas:X,inlineImages:ee,userTriggeredOnInput:C,collectFonts:$,doc:We,maskAttributeFn:v,maskInputFn:T,maskTextFn:x,keepIframeSrcFn:H,blockSelector:i,unblockSelector:a,slimDOMOptions:Kt,dataURLOptions:P,mirror:ti,iframeManager:we,stylesheetManager:lt,shadowDomManager:An,processedNodeManager:tt,canvasManager:vn,ignoreCSSAttributes:se,plugins:B?.filter(oe=>oe.observer)?.map(oe=>({observer:oe.observer,options:oe.options,callback:ge=>nn({type:Ke.Plugin,data:{plugin:oe.name,payload:ge}})}))||[]},{});we.addLoadListener(We=>{try{ue.push(Ve(We.contentDocument))}catch(oe){console.warn(oe)}});let Te=()=>{an(),ue.push(Ve(document))};return document.readyState==="interactive"||document.readyState==="complete"?Te():(ue.push(cr("DOMContentLoaded",()=>{nn({type:Ke.DomContentLoaded,data:{}}),R==="DOMContentLoaded"&&Te()})),ue.push(cr("load",()=>{nn({type:Ke.Load,data:{}}),R==="load"&&Te()},window))),()=>{ue.forEach(We=>We()),tt.destroy(),gy=void 0,xj()}}catch(ue){console.warn(ue)}}function Fj(e){if(!gy)throw new Error("please take full snapshot after start recording");gy(e)}ni.mirror=ti;ni.takeFullSnapshot=Fj;function Hj(e,t){try{return e?e(t):new py}catch{return console.warn("Unable to initialize CanvasManager"),new py}}var M2;(function(e){e[e.NotStarted=0]="NotStarted",e[e.Running=1]="Running",e[e.Stopped=2]="Stopped"})(M2||(M2={}));var Gj=3,$j=5;function ST(e){return e>9999999999?e:e*1e3}function zE(e){return e>9999999999?e/1e3:e}function Fp(e,t){t.category!=="sentry.transaction"&&(["ui.click","ui.input"].includes(t.category)?e.triggerUserActivity():e.checkAndHandleExpiredSession(),e.addUpdate(()=>(e.throttledAddEvent({type:Ke.Custom,timestamp:(t.timestamp||0)*1e3,data:{tag:"breadcrumb",payload:ht(t,10,1e3)}}),t.category==="console")))}var jj="button,a";function uM(e){return e.closest(jj)||e}function dM(e){let t=fM(e);return!t||!(t instanceof Element)?t:uM(t)}function fM(e){return qj(e)?e.target:e}function qj(e){return typeof e=="object"&&!!e&&"target"in e}var gs;function Vj(e){return gs||(gs=[],Wj()),gs.push(e),()=>{let t=gs?gs.indexOf(e):-1;t>-1&&gs.splice(t,1)}}function Wj(){wt(Mt,"open",function(e){return function(...t){if(gs)try{gs.forEach(n=>n())}catch{}return e.apply(Mt,t)}})}var Yj=new Set([Oe.Mutation,Oe.StyleSheetRule,Oe.StyleDeclaration,Oe.AdoptedStyleSheet,Oe.CanvasMutation,Oe.Selection,Oe.MediaInteraction]);function Kj(e,t,n){e.handleClick(t,n)}var oT=class{constructor(t,n,r=Fp){this._lastMutation=0,this._lastScroll=0,this._clicks=[],this._timeout=n.timeout/1e3,this._threshold=n.threshold/1e3,this._scrollTimeout=n.scrollTimeout/1e3,this._replay=t,this._ignoreSelector=n.ignoreSelector,this._addBreadcrumbEvent=r}addListeners(){let t=Vj(()=>{this._lastMutation=O2()});this._teardown=()=>{t(),this._clicks=[],this._lastMutation=0,this._lastScroll=0}}removeListeners(){this._teardown&&this._teardown(),this._checkClickTimeout&&clearTimeout(this._checkClickTimeout)}handleClick(t,n){if(Jj(n,this._ignoreSelector)||!Qj(t))return;let r={timestamp:zE(t.timestamp),clickBreadcrumb:t,clickCount:0,node:n};this._clicks.some(o=>o.node===r.node&&Math.abs(o.timestamp-r.timestamp)<1)||(this._clicks.push(r),this._clicks.length===1&&this._scheduleCheckClicks())}registerMutation(t=Date.now()){this._lastMutation=zE(t)}registerScroll(t=Date.now()){this._lastScroll=zE(t)}registerClick(t){let n=uM(t);this._handleMultiClick(n)}_handleMultiClick(t){this._getClicks(t).forEach(n=>{n.clickCount++})}_getClicks(t){return this._clicks.filter(n=>n.node===t)}_checkClicks(){let t=[],n=O2();this._clicks.forEach(r=>{!r.mutationAfter&&this._lastMutation&&(r.mutationAfter=r.timestamp<=this._lastMutation?this._lastMutation-r.timestamp:void 0),!r.scrollAfter&&this._lastScroll&&(r.scrollAfter=r.timestamp<=this._lastScroll?this._lastScroll-r.timestamp:void 0),r.timestamp+this._timeout<=n&&t.push(r)});for(let r of t){let o=this._clicks.indexOf(r);o>-1&&(this._generateBreadcrumbs(r),this._clicks.splice(o,1))}this._clicks.length&&this._scheduleCheckClicks()}_generateBreadcrumbs(t){let n=this._replay,r=t.scrollAfter&&t.scrollAfter<=this._scrollTimeout,o=t.mutationAfter&&t.mutationAfter<=this._threshold,i=!r&&!o,{clickCount:a,clickBreadcrumb:s}=t;if(i){let l=Math.min(t.mutationAfter||this._timeout,this._timeout)*1e3,c=l<this._timeout*1e3?"mutation":"timeout",d={type:"default",message:s.message,timestamp:s.timestamp,category:"ui.slowClickDetected",data:{...s.data,url:Mt.location.href,route:n.getCurrentRoute(),timeAfterClickMs:l,endReason:c,clickCount:a||1}};this._addBreadcrumbEvent(n,d);return}if(a>1){let l={type:"default",message:s.message,timestamp:s.timestamp,category:"ui.multiClick",data:{...s.data,url:Mt.location.href,route:n.getCurrentRoute(),clickCount:a,metric:!0}};this._addBreadcrumbEvent(n,l)}}_scheduleCheckClicks(){this._checkClickTimeout&&clearTimeout(this._checkClickTimeout),this._checkClickTimeout=Hl(()=>this._checkClicks(),1e3)}},Xj=["A","BUTTON","INPUT"];function Jj(e,t){return!!(!Xj.includes(e.tagName)||e.tagName==="INPUT"&&!["submit","button"].includes(e.getAttribute("type")||"")||e.tagName==="A"&&(e.hasAttribute("download")||e.hasAttribute("target")&&e.getAttribute("target")!=="_self")||t&&e.matches(t))}function Qj(e){return!!(e.data&&typeof e.data.nodeId=="number"&&e.timestamp)}function O2(){return Date.now()/1e3}function Zj(e,t){try{if(!eq(t))return;let{source:n}=t.data;if(Yj.has(n)&&e.registerMutation(t.timestamp),n===Oe.Scroll&&e.registerScroll(t.timestamp),tq(t)){let{type:r,id:o}=t.data,i=ni.mirror.getNode(o);i instanceof HTMLElement&&r===lr.Click&&e.registerClick(i)}}catch{}}function eq(e){return e.type===Gj}function tq(e){return e.data.source===Oe.MouseInteraction}function Ri(e){return{timestamp:Date.now()/1e3,type:"default",...e}}var ky=(e=>(e[e.Document=0]="Document",e[e.DocumentType=1]="DocumentType",e[e.Element=2]="Element",e[e.Text=3]="Text",e[e.CDATA=4]="CDATA",e[e.Comment=5]="Comment",e))(ky||{}),nq=new Set(["id","class","aria-label","role","name","alt","title","data-test-id","data-testid","disabled","aria-disabled","data-sentry-component"]);function rq(e){let t={};!e["data-sentry-component"]&&e["data-sentry-element"]&&(e["data-sentry-component"]=e["data-sentry-element"]);for(let n in e)if(nq.has(n)){let r=n;(n==="data-testid"||n==="data-test-id")&&(r="testId"),t[r]=e[n]}return t}var oq=e=>t=>{if(!e.isEnabled())return;let n=iq(t);if(!n)return;let r=t.name==="click",o=r?t.event:void 0;r&&e.clickDetector&&o?.target&&!o.altKey&&!o.metaKey&&!o.ctrlKey&&!o.shiftKey&&Kj(e.clickDetector,n,dM(t.event)),Fp(e,n)};function pM(e,t){let n=ni.mirror.getId(e),r=n&&ni.mirror.getNode(n),o=r&&ni.mirror.getMeta(r),i=o&&sq(o)?o:null;return{message:t,data:i?{nodeId:n,node:{id:n,tagName:i.tagName,textContent:Array.from(i.childNodes).map(a=>a.type===ky.Text&&a.textContent).filter(Boolean).map(a=>a.trim()).join(""),attributes:rq(i.attributes)}}:{}}}function iq(e){let{target:t,message:n}=aq(e);return Ri({category:`ui.${e.name}`,...pM(t,n)})}function aq(e){let t=e.name==="click",n,r=null;try{r=t?dM(e.event):fM(e.event),n=_t(r,{maxStringLength:200})||"<unknown>"}catch{n="<unknown>"}return{target:r,message:n}}function sq(e){return e.type===ky.Element}function lq(e,t){if(!e.isEnabled())return;e.updateUserActivity();let n=cq(t);n&&Fp(e,n)}function cq(e){let{metaKey:t,shiftKey:n,ctrlKey:r,altKey:o,key:i,target:a}=e;if(!a||uq(a)||!i)return null;let s=t||r||o,l=i.length===1;if(!s&&l)return null;let c=_t(a,{maxStringLength:200})||"<unknown>",d=pM(a,c);return Ri({category:"ui.keyDown",message:c,data:{...d.data,metaKey:t,shiftKey:n,ctrlKey:r,altKey:o,key:i}})}function uq(e){return e.tagName==="INPUT"||e.tagName==="TEXTAREA"||e.isContentEditable}var dq={resource:hq,paint:mq,navigation:gq};function FE(e,t){return({metric:n})=>void t.replayPerformanceEntries.push(e(n))}function fq(e){return e.map(pq).filter(Boolean)}function pq(e){let t=dq[e.entryType];return t?t(e):null}function od(e){return((ut()||Mt.performance.timeOrigin)+e)/1e3}function mq(e){let{duration:t,entryType:n,name:r,startTime:o}=e,i=od(o);return{type:n,name:r,start:i,end:i+t,data:void 0}}function gq(e){let{entryType:t,name:n,decodedBodySize:r,duration:o,domComplete:i,encodedBodySize:a,domContentLoadedEventStart:s,domContentLoadedEventEnd:l,domInteractive:c,loadEventStart:d,loadEventEnd:u,redirectCount:m,startTime:p,transferSize:g,type:_}=e;return o===0?null:{type:`${t}.${_}`,start:od(p),end:od(i),name:n,data:{size:g,decodedBodySize:r,encodedBodySize:a,duration:o,domInteractive:c,domContentLoadedEventStart:s,domContentLoadedEventEnd:l,loadEventStart:d,loadEventEnd:u,domComplete:i,redirectCount:m}}}function hq(e){let{entryType:t,initiatorType:n,name:r,responseEnd:o,startTime:i,decodedBodySize:a,encodedBodySize:s,responseStatus:l,transferSize:c}=e;return["fetch","xmlhttprequest"].includes(n)?null:{type:`${t}.${n}`,start:od(i),end:od(o),name:r,data:{size:c,statusCode:l,decodedBodySize:a,encodedBodySize:s}}}function bq(e){let t=e.entries[e.entries.length-1],n=t?.element?[t.element]:void 0;return ET(e,"largest-contentful-paint",n)}function yq(e){return e.sources!==void 0}function _q(e){let t=[],n=[];for(let r of e.entries)if(yq(r)){let o=[];for(let i of r.sources)if(i.node){n.push(i.node);let a=ni.mirror.getId(i.node);a&&o.push(a)}t.push({value:r.value,nodeIds:o.length?o:void 0})}return ET(e,"cumulative-layout-shift",n,t)}function vq(e){let t=e.entries[e.entries.length-1],n=t?.target?[t.target]:void 0;return ET(e,"interaction-to-next-paint",n)}function ET(e,t,n,r){let o=e.value,i=e.rating,a=od(o);return{type:"web-vital",name:t,start:a,end:a,data:{value:o,size:o,rating:i,nodeIds:n?n.map(s=>ni.mirror.getId(s)):void 0,attributions:r}}}function Sq(e){function t(o){e.performanceEntries.includes(o)||e.performanceEntries.push(o)}function n({entries:o}){o.forEach(t)}let r=[];return["navigation","paint","resource"].forEach(o=>{r.push(xr(o,n))}),r.push(ia(FE(bq,e)),oa(FE(_q,e)),Ul(FE(vq,e))),()=>{r.forEach(o=>o())}}var ke=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__,Eq='var t=Uint8Array,n=Uint16Array,r=Int32Array,e=new t([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),i=new t([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),s=new t([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),a=function(t,e){for(var i=new n(31),s=0;s<31;++s)i[s]=e+=1<<t[s-1];var a=new r(i[30]);for(s=1;s<30;++s)for(var o=i[s];o<i[s+1];++o)a[o]=o-i[s]<<5|s;return{b:i,r:a}},o=a(e,2),h=o.b,f=o.r;h[28]=258,f[258]=28;for(var l=a(i,0).r,u=new n(32768),c=0;c<32768;++c){var v=(43690&c)>>1|(21845&c)<<1;v=(61680&(v=(52428&v)>>2|(13107&v)<<2))>>4|(3855&v)<<4,u[c]=((65280&v)>>8|(255&v)<<8)>>1}var d=function(t,r,e){for(var i=t.length,s=0,a=new n(r);s<i;++s)t[s]&&++a[t[s]-1];var o,h=new n(r);for(s=1;s<r;++s)h[s]=h[s-1]+a[s-1]<<1;if(e){o=new n(1<<r);var f=15-r;for(s=0;s<i;++s)if(t[s])for(var l=s<<4|t[s],c=r-t[s],v=h[t[s]-1]++<<c,d=v|(1<<c)-1;v<=d;++v)o[u[v]>>f]=l}else for(o=new n(i),s=0;s<i;++s)t[s]&&(o[s]=u[h[t[s]-1]++]>>15-t[s]);return o},p=new t(288);for(c=0;c<144;++c)p[c]=8;for(c=144;c<256;++c)p[c]=9;for(c=256;c<280;++c)p[c]=7;for(c=280;c<288;++c)p[c]=8;var g=new t(32);for(c=0;c<32;++c)g[c]=5;var w=d(p,9,0),y=d(g,5,0),m=function(t){return(t+7)/8|0},b=function(n,r,e){return(null==e||e>n.length)&&(e=n.length),new t(n.subarray(r,e))},M=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],E=function(t,n,r){var e=new Error(n||M[t]);if(e.code=t,Error.captureStackTrace&&Error.captureStackTrace(e,E),!r)throw e;return e},z=function(t,n,r){r<<=7&n;var e=n/8|0;t[e]|=r,t[e+1]|=r>>8},_=function(t,n,r){r<<=7&n;var e=n/8|0;t[e]|=r,t[e+1]|=r>>8,t[e+2]|=r>>16},x=function(r,e){for(var i=[],s=0;s<r.length;++s)r[s]&&i.push({s:s,f:r[s]});var a=i.length,o=i.slice();if(!a)return{t:F,l:0};if(1==a){var h=new t(i[0].s+1);return h[i[0].s]=1,{t:h,l:1}}i.sort(function(t,n){return t.f-n.f}),i.push({s:-1,f:25001});var f=i[0],l=i[1],u=0,c=1,v=2;for(i[0]={s:-1,f:f.f+l.f,l:f,r:l};c!=a-1;)f=i[i[u].f<i[v].f?u++:v++],l=i[u!=c&&i[u].f<i[v].f?u++:v++],i[c++]={s:-1,f:f.f+l.f,l:f,r:l};var d=o[0].s;for(s=1;s<a;++s)o[s].s>d&&(d=o[s].s);var p=new n(d+1),g=A(i[c-1],p,0);if(g>e){s=0;var w=0,y=g-e,m=1<<y;for(o.sort(function(t,n){return p[n.s]-p[t.s]||t.f-n.f});s<a;++s){var b=o[s].s;if(!(p[b]>e))break;w+=m-(1<<g-p[b]),p[b]=e}for(w>>=y;w>0;){var M=o[s].s;p[M]<e?w-=1<<e-p[M]++-1:++s}for(;s>=0&&w;--s){var E=o[s].s;p[E]==e&&(--p[E],++w)}g=e}return{t:new t(p),l:g}},A=function(t,n,r){return-1==t.s?Math.max(A(t.l,n,r+1),A(t.r,n,r+1)):n[t.s]=r},D=function(t){for(var r=t.length;r&&!t[--r];);for(var e=new n(++r),i=0,s=t[0],a=1,o=function(t){e[i++]=t},h=1;h<=r;++h)if(t[h]==s&&h!=r)++a;else{if(!s&&a>2){for(;a>138;a-=138)o(32754);a>2&&(o(a>10?a-11<<5|28690:a-3<<5|12305),a=0)}else if(a>3){for(o(s),--a;a>6;a-=6)o(8304);a>2&&(o(a-3<<5|8208),a=0)}for(;a--;)o(s);a=1,s=t[h]}return{c:e.subarray(0,i),n:r}},T=function(t,n){for(var r=0,e=0;e<n.length;++e)r+=t[e]*n[e];return r},k=function(t,n,r){var e=r.length,i=m(n+2);t[i]=255&e,t[i+1]=e>>8,t[i+2]=255^t[i],t[i+3]=255^t[i+1];for(var s=0;s<e;++s)t[i+s+4]=r[s];return 8*(i+4+e)},U=function(t,r,a,o,h,f,l,u,c,v,m){z(r,m++,a),++h[256];for(var b=x(h,15),M=b.t,E=b.l,A=x(f,15),U=A.t,C=A.l,F=D(M),I=F.c,S=F.n,L=D(U),O=L.c,j=L.n,q=new n(19),B=0;B<I.length;++B)++q[31&I[B]];for(B=0;B<O.length;++B)++q[31&O[B]];for(var G=x(q,7),H=G.t,J=G.l,K=19;K>4&&!H[s[K-1]];--K);var N,P,Q,R,V=v+5<<3,W=T(h,p)+T(f,g)+l,X=T(h,M)+T(f,U)+l+14+3*K+T(q,H)+2*q[16]+3*q[17]+7*q[18];if(c>=0&&V<=W&&V<=X)return k(r,m,t.subarray(c,c+v));if(z(r,m,1+(X<W)),m+=2,X<W){N=d(M,E,0),P=M,Q=d(U,C,0),R=U;var Y=d(H,J,0);z(r,m,S-257),z(r,m+5,j-1),z(r,m+10,K-4),m+=14;for(B=0;B<K;++B)z(r,m+3*B,H[s[B]]);m+=3*K;for(var Z=[I,O],$=0;$<2;++$){var tt=Z[$];for(B=0;B<tt.length;++B){var nt=31&tt[B];z(r,m,Y[nt]),m+=H[nt],nt>15&&(z(r,m,tt[B]>>5&127),m+=tt[B]>>12)}}}else N=w,P=p,Q=y,R=g;for(B=0;B<u;++B){var rt=o[B];if(rt>255){_(r,m,N[(nt=rt>>18&31)+257]),m+=P[nt+257],nt>7&&(z(r,m,rt>>23&31),m+=e[nt]);var et=31&rt;_(r,m,Q[et]),m+=R[et],et>3&&(_(r,m,rt>>5&8191),m+=i[et])}else _(r,m,N[rt]),m+=P[rt]}return _(r,m,N[256]),m+P[256]},C=new r([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),F=new t(0),I=function(){for(var t=new Int32Array(256),n=0;n<256;++n){for(var r=n,e=9;--e;)r=(1&r&&-306674912)^r>>>1;t[n]=r}return t}(),S=function(){var t=1,n=0;return{p:function(r){for(var e=t,i=n,s=0|r.length,a=0;a!=s;){for(var o=Math.min(a+2655,s);a<o;++a)i+=e+=r[a];e=(65535&e)+15*(e>>16),i=(65535&i)+15*(i>>16)}t=e,n=i},d:function(){return(255&(t%=65521))<<24|(65280&t)<<8|(255&(n%=65521))<<8|n>>8}}},L=function(s,a,o,h,u){if(!u&&(u={l:1},a.dictionary)){var c=a.dictionary.subarray(-32768),v=new t(c.length+s.length);v.set(c),v.set(s,c.length),s=v,u.w=c.length}return function(s,a,o,h,u,c){var v=c.z||s.length,d=new t(h+v+5*(1+Math.ceil(v/7e3))+u),p=d.subarray(h,d.length-u),g=c.l,w=7&(c.r||0);if(a){w&&(p[0]=c.r>>3);for(var y=C[a-1],M=y>>13,E=8191&y,z=(1<<o)-1,_=c.p||new n(32768),x=c.h||new n(z+1),A=Math.ceil(o/3),D=2*A,T=function(t){return(s[t]^s[t+1]<<A^s[t+2]<<D)&z},F=new r(25e3),I=new n(288),S=new n(32),L=0,O=0,j=c.i||0,q=0,B=c.w||0,G=0;j+2<v;++j){var H=T(j),J=32767&j,K=x[H];if(_[J]=K,x[H]=J,B<=j){var N=v-j;if((L>7e3||q>24576)&&(N>423||!g)){w=U(s,p,0,F,I,S,O,q,G,j-G,w),q=L=O=0,G=j;for(var P=0;P<286;++P)I[P]=0;for(P=0;P<30;++P)S[P]=0}var Q=2,R=0,V=E,W=J-K&32767;if(N>2&&H==T(j-W))for(var X=Math.min(M,N)-1,Y=Math.min(32767,j),Z=Math.min(258,N);W<=Y&&--V&&J!=K;){if(s[j+Q]==s[j+Q-W]){for(var $=0;$<Z&&s[j+$]==s[j+$-W];++$);if($>Q){if(Q=$,R=W,$>X)break;var tt=Math.min(W,$-2),nt=0;for(P=0;P<tt;++P){var rt=j-W+P&32767,et=rt-_[rt]&32767;et>nt&&(nt=et,K=rt)}}}W+=(J=K)-(K=_[J])&32767}if(R){F[q++]=268435456|f[Q]<<18|l[R];var it=31&f[Q],st=31&l[R];O+=e[it]+i[st],++I[257+it],++S[st],B=j+Q,++L}else F[q++]=s[j],++I[s[j]]}}for(j=Math.max(j,B);j<v;++j)F[q++]=s[j],++I[s[j]];w=U(s,p,g,F,I,S,O,q,G,j-G,w),g||(c.r=7&w|p[w/8|0]<<3,w-=7,c.h=x,c.p=_,c.i=j,c.w=B)}else{for(j=c.w||0;j<v+g;j+=65535){var at=j+65535;at>=v&&(p[w/8|0]=g,at=v),w=k(p,w+1,s.subarray(j,at))}c.i=v}return b(d,0,h+m(w)+u)}(s,null==a.level?6:a.level,null==a.mem?u.l?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(s.length)))):20:12+a.mem,o,h,u)},O=function(t,n,r){for(;r;++n)t[n]=r,r>>>=8},j=function(){function n(n,r){if("function"==typeof n&&(r=n,n={}),this.ondata=r,this.o=n||{},this.s={l:0,i:32768,w:32768,z:32768},this.b=new t(98304),this.o.dictionary){var e=this.o.dictionary.subarray(-32768);this.b.set(e,32768-e.length),this.s.i=32768-e.length}}return n.prototype.p=function(t,n){this.ondata(L(t,this.o,0,0,this.s),n)},n.prototype.push=function(n,r){this.ondata||E(5),this.s.l&&E(4);var e=n.length+this.s.z;if(e>this.b.length){if(e>2*this.b.length-32768){var i=new t(-32768&e);i.set(this.b.subarray(0,this.s.z)),this.b=i}var s=this.b.length-this.s.z;this.b.set(n.subarray(0,s),this.s.z),this.s.z=this.b.length,this.p(this.b,!1),this.b.set(this.b.subarray(-32768)),this.b.set(n.subarray(s),32768),this.s.z=n.length-s+32768,this.s.i=32766,this.s.w=32768}else this.b.set(n,this.s.z),this.s.z+=n.length;this.s.l=1&r,(this.s.z>this.s.w+8191||r)&&(this.p(this.b,r||!1),this.s.w=this.s.i,this.s.i-=2)},n.prototype.flush=function(){this.ondata||E(5),this.s.l&&E(4),this.p(this.b,!1),this.s.w=this.s.i,this.s.i-=2},n}();function q(t,n){n||(n={});var r=function(){var t=-1;return{p:function(n){for(var r=t,e=0;e<n.length;++e)r=I[255&r^n[e]]^r>>>8;t=r},d:function(){return~t}}}(),e=t.length;r.p(t);var i,s=L(t,n,10+((i=n).filename?i.filename.length+1:0),8),a=s.length;return function(t,n){var r=n.filename;if(t[0]=31,t[1]=139,t[2]=8,t[8]=n.level<2?4:9==n.level?2:0,t[9]=3,0!=n.mtime&&O(t,4,Math.floor(new Date(n.mtime||Date.now())/1e3)),r){t[3]=8;for(var e=0;e<=r.length;++e)t[e+10]=r.charCodeAt(e)}}(s,n),O(s,a-8,r.d()),O(s,a-4,e),s}var B=function(){function t(t,n){this.c=S(),this.v=1,j.call(this,t,n)}return t.prototype.push=function(t,n){this.c.p(t),j.prototype.push.call(this,t,n)},t.prototype.p=function(t,n){var r=L(t,this.o,this.v&&(this.o.dictionary?6:2),n&&4,this.s);this.v&&(function(t,n){var r=n.level,e=0==r?0:r<6?1:9==r?3:2;if(t[0]=120,t[1]=e<<6|(n.dictionary&&32),t[1]|=31-(t[0]<<8|t[1])%31,n.dictionary){var i=S();i.p(n.dictionary),O(t,2,i.d())}}(r,this.o),this.v=0),n&&O(r,r.length-4,this.c.d()),this.ondata(r,n)},t.prototype.flush=function(){j.prototype.flush.call(this)},t}(),G="undefined"!=typeof TextEncoder&&new TextEncoder,H="undefined"!=typeof TextDecoder&&new TextDecoder;try{H.decode(F,{stream:!0})}catch(t){}var J=function(){function t(t){this.ondata=t}return t.prototype.push=function(t,n){this.ondata||E(5),this.d&&E(4),this.ondata(K(t),this.d=n||!1)},t}();function K(n,r){if(G)return G.encode(n);for(var e=n.length,i=new t(n.length+(n.length>>1)),s=0,a=function(t){i[s++]=t},o=0;o<e;++o){if(s+5>i.length){var h=new t(s+8+(e-o<<1));h.set(i),i=h}var f=n.charCodeAt(o);f<128||r?a(f):f<2048?(a(192|f>>6),a(128|63&f)):f>55295&&f<57344?(a(240|(f=65536+(1047552&f)|1023&n.charCodeAt(++o))>>18),a(128|f>>12&63),a(128|f>>6&63),a(128|63&f)):(a(224|f>>12),a(128|f>>6&63),a(128|63&f))}return b(i,0,s)}const N=new class{constructor(){this._init()}clear(){this._init()}addEvent(t){if(!t)throw new Error("Adding invalid event");const n=this._hasEvents?",":"";this.stream.push(n+t),this._hasEvents=!0}finish(){this.stream.push("]",!0);const t=function(t){let n=0;for(const r of t)n+=r.length;const r=new Uint8Array(n);for(let n=0,e=0,i=t.length;n<i;n++){const i=t[n];r.set(i,e),e+=i.length}return r}(this._deflatedData);return this._init(),t}_init(){this._hasEvents=!1,this._deflatedData=[],this.deflate=new B,this.deflate.ondata=(t,n)=>{this._deflatedData.push(t)},this.stream=new J((t,n)=>{this.deflate.push(t,n)}),this.stream.push("[")}},P={clear:()=>{N.clear()},addEvent:t=>N.addEvent(t),finish:()=>N.finish(),compress:t=>function(t){return q(K(t))}(t)};addEventListener("message",function(t){const n=t.data.method,r=t.data.id,e=t.data.arg;if(n in P&&"function"==typeof P[n])try{const t=P[n](e);postMessage({id:r,method:n,success:!0,response:t})}catch(t){postMessage({id:r,method:n,success:!1,response:t.message}),console.error(t)}}),postMessage({id:void 0,method:"init",success:!0,response:void 0});';function Tq(){let e=new Blob([Eq]);return URL.createObjectURL(e)}var D2=["log","warn","error"],sy="[Replay] ";function HE(e,t="info"){Mn({category:"console",data:{logger:"replay"},level:t,message:`${sy}${e}`},{level:t})}function wq(){let e=!1,t=!1,n={exception:()=>{},infoTick:()=>{},setConfig:r=>{e=!!r.captureExceptions,t=!!r.traceInternals}};return ke?(D2.forEach(r=>{n[r]=(...o)=>{A[r](sy,...o),t&&HE(o.join(""),ea(r))}}),n.exception=(r,...o)=>{o.length&&n.error&&n.error(...o),A.error(sy,r),e?xe(r,{mechanism:{handled:!0,type:"auto.function.replay.debug"}}):t&&HE(r,"error")},n.infoTick=(...r)=>{A.log(sy,...r),t&&setTimeout(()=>HE(r[0]),0)}):D2.forEach(r=>{n[r]=()=>{}}),n}var Ae=wq(),Up=class extends Error{constructor(){super(`Event buffer exceeded maximum size of ${gT}.`)}},hy=class{constructor(){this.events=[],this._totalSize=0,this.hasCheckout=!1,this.waitForCheckout=!1}get hasEvents(){return this.events.length>0}get type(){return"sync"}destroy(){this.events=[]}async addEvent(t){let n=JSON.stringify(t).length;if(this._totalSize+=n,this._totalSize>gT)throw new Up;this.events.push(t)}finish(){return new Promise(t=>{let n=this.events;this.clear(),t(JSON.stringify(n))})}clear(){this.events=[],this._totalSize=0,this.hasCheckout=!1}getEarliestTimestamp(){let t=null;for(let{timestamp:n}of this.events)(t===null||n<t)&&(t=n);return t===null?t:ST(t)}},iT=class{constructor(t){this._onMessage=({data:n})=>{let r=n;if(typeof r.id!="number")return;let o=this._pending.get(r.id);if(!(!o||o.method!==r.method)){if(this._pending.delete(r.id),!r.success){ke&&Ae.error("Error in compression worker: ",r.response),o.reject(new Error("Error in compression worker"));return}o.resolve(r.response)}},this._worker=t,this._id=0,this._pending=new Map,this._worker.addEventListener("message",this._onMessage)}ensureReady(){return this._ensureReadyPromise?this._ensureReadyPromise:(this._ensureReadyPromise=new Promise((t,n)=>{this._worker.addEventListener("message",({data:r})=>{r.success?t():(ke&&Ae.warn("Received worker message with unsuccessful status",r),n(new Error("Received worker message with unsuccessful status")))},{once:!0}),this._worker.addEventListener("error",r=>{ke&&Ae.warn("Failed to load Replay compression worker",r),n(new Error(`Failed to load Replay compression worker: ${r instanceof ErrorEvent&&r.message?r.message:"Unknown error. This can happen due to CSP policy restrictions, network issues, or the worker script failing to load."}`))},{once:!0})}),this._ensureReadyPromise)}destroy(){ke&&Ae.log("Destroying compression worker"),this._worker.removeEventListener("message",this._onMessage),this._pending.forEach(t=>t.reject(new Error("Worker destroyed"))),this._pending.clear(),this._worker.terminate()}postMessage(t,n){let r=this._getAndIncrementId();return new Promise((o,i)=>{this._pending.set(r,{method:t,resolve:o,reject:i});try{this._worker.postMessage({id:r,method:t,arg:n})}catch(a){this._pending.delete(r),i(a)}})}_getAndIncrementId(){return this._id++}},aT=class{constructor(t){this._worker=new iT(t),this._earliestTimestamp=null,this._totalSize=0,this.hasCheckout=!1,this.waitForCheckout=!1}get hasEvents(){return!!this._earliestTimestamp}get type(){return"worker"}ensureReady(){return this._worker.ensureReady()}destroy(){this._worker.destroy()}addEvent(t){let n=ST(t.timestamp);(!this._earliestTimestamp||n<this._earliestTimestamp)&&(this._earliestTimestamp=n);let r=JSON.stringify(t);return this._totalSize+=r.length,this._totalSize>gT?Promise.reject(new Up):this._sendEventToWorker(r)}finish(){return this._finishRequest()}clear(){this._earliestTimestamp=null,this._totalSize=0,this.hasCheckout=!1,this._worker.postMessage("clear").then(null,t=>{ke&&Ae.exception(t,'Sending "clear" message to worker failed',t)})}getEarliestTimestamp(){return this._earliestTimestamp}_sendEventToWorker(t){return this._worker.postMessage("addEvent",t)}async _finishRequest(){let t=await this._worker.postMessage("finish");return this._earliestTimestamp=null,this._totalSize=0,t}},sT=class{constructor(t){this._fallback=new hy,this._compression=new aT(t),this._used=this._fallback,this._ensureWorkerIsLoadedPromise=this._ensureWorkerIsLoaded()}get waitForCheckout(){return this._used.waitForCheckout}get type(){return this._used.type}get hasEvents(){return this._used.hasEvents}get hasCheckout(){return this._used.hasCheckout}set hasCheckout(t){this._used.hasCheckout=t}set waitForCheckout(t){this._used.waitForCheckout=t}destroy(){this._fallback.destroy(),this._compression.destroy()}clear(){return this._used.clear()}getEarliestTimestamp(){return this._used.getEarliestTimestamp()}addEvent(t){return this._used.addEvent(t)}async finish(){return await this.ensureWorkerIsLoaded(),this._used.finish()}ensureWorkerIsLoaded(){return this._ensureWorkerIsLoadedPromise}async _ensureWorkerIsLoaded(){try{await this._compression.ensureReady()}catch(t){ke&&Ae.exception(t,"Failed to load the compression worker, falling back to simple buffer");return}await this._switchToCompressionWorker()}async _switchToCompressionWorker(){let{events:t,hasCheckout:n,waitForCheckout:r}=this._fallback,o=[];for(let i of t)o.push(this._compression.addEvent(i));this._compression.hasCheckout=n,this._compression.waitForCheckout=r,this._used=this._compression;try{await Promise.all(o),this._fallback.clear()}catch(i){ke&&Ae.exception(i,"Failed to add events when switching buffers.")}}};function xq({useCompression:e,workerUrl:t}){if(e&&window.Worker){let n=kq(t);if(n)return n}return ke&&Ae.log("Using simple buffer"),new hy}function kq(e){try{let t=e||Aq();if(!t)return;ke&&Ae.log(`Using compression worker${e?` from ${e}`:""}`);let n=new Worker(t);return new sT(n)}catch(t){ke&&Ae.exception(t,"Failed to create compression worker")}}function Aq(){return typeof __SENTRY_EXCLUDE_REPLAY_WORKER__>"u"||!__SENTRY_EXCLUDE_REPLAY_WORKER__?Tq():""}function TT(){try{return"sessionStorage"in Mt&&!!Mt.sessionStorage}catch{return!1}}function Iq(e){Nq(),e.session=void 0}function Nq(){if(TT())try{Mt.sessionStorage.removeItem(pT)}catch{}}function mM(e){return e===void 0?!1:Math.random()<e}function Ay(e){if(TT())try{Mt.sessionStorage.setItem(pT,JSON.stringify(e))}catch{}}function gM(e){let t=Date.now(),n=e.id||ft(),r=e.started||t,o=e.lastActivity||t,i=e.segmentId||0,a=e.sampled,s=e.previousSessionId,l=e.dirty||!1;return{id:n,started:r,lastActivity:o,segmentId:i,sampled:a,previousSessionId:s,dirty:l}}function Rq(e,t){return mM(e)?"session":t?"buffer":!1}function L2({sessionSampleRate:e,allowBuffering:t,stickySession:n=!1},{previousSessionId:r}={}){let o=Rq(e,t),i=gM({sampled:o,previousSessionId:r});return n&&Ay(i),i}function Cq(){if(!TT())return null;try{let e=Mt.sessionStorage.getItem(pT);if(!e)return null;let t=JSON.parse(e);return ke&&Ae.infoTick("Loading existing session"),gM(t)}catch{return null}}function lT(e,t,n=+new Date){return e===null||t===void 0||t<0?!0:t===0?!1:e+t<=n}function Mq(e,{maxReplayDuration:t,sessionIdleExpire:n,targetTime:r=Date.now()}){return lT(e.started,t,r)||lT(e.lastActivity,n,r)}function by(e,{sessionIdleExpire:t,maxReplayDuration:n}){return!(!Mq(e,{sessionIdleExpire:t,maxReplayDuration:n})||e.sampled==="buffer"&&e.segmentId===0)}function GE({sessionIdleExpire:e,maxReplayDuration:t,previousSessionId:n},r){let o=r.stickySession&&Cq();return o?by(o,{sessionIdleExpire:e,maxReplayDuration:t})?(ke&&Ae.infoTick("Session in sessionStorage is expired, creating new one..."),L2(r,{previousSessionId:o.id})):o:(ke&&Ae.infoTick("Creating new session"),L2(r,{previousSessionId:n}))}function Oq(e){return e.type===Ke.Custom}function wT(e,t,n){return bM(e,t)?(hM(e,t,n),!0):!1}function Dq(e,t,n){return bM(e,t)?hM(e,t,n):Promise.resolve(null)}async function hM(e,t,n){let{eventBuffer:r}=e;if(!r||r.waitForCheckout&&!n)return null;let o=e.recordingMode==="buffer";try{n&&o&&r.clear(),n&&(r.hasCheckout=!0,r.waitForCheckout=!1);let i=e.getOptions(),a=Lq(t,i.beforeAddRecordingEvent);return a?await r.addEvent(a):void 0}catch(i){let a=i&&i instanceof Up,s=a?"eventBufferOverflow":"eventBufferError",l=q();if(l){let c=a?"buffer_overflow":"internal_sdk_error";l.recordDroppedEvent(c,"replay")}if(a&&o)return r.clear(),r.waitForCheckout=!0,null;e.handleException(i),await e.stop({reason:s})}}function bM(e,t){if(!e.eventBuffer||e.isPaused()||!e.isEnabled())return!1;let n=ST(t.timestamp);return n+e.timeouts.sessionIdlePause<Date.now()?!1:n>e.getContext().initialTimestamp+e.getOptions().maxReplayDuration?(ke&&Ae.infoTick(`Skipping event with timestamp ${n} because it is after maxReplayDuration`),!1):!0}function Lq(e,t){try{if(typeof t=="function"&&Oq(e))return t(e)}catch(n){return ke&&Ae.exception(n,"An error occurred in the `beforeAddRecordingEvent` callback, skipping the event..."),null}return e}var Uq=100;function yM(e,t){let n=e.getContext();n.traceIds.size<Uq&&n.traceIds.add(t)}function Pq(e){return t=>{if(!e.isEnabled()||!Cn(t))return;let n=t.spanContext().traceId;n&&yM(e,n)}}function xT(e){return!e.type}function cT(e){return e.type==="transaction"}function Bq(e){return e.type==="replay_event"}function U2(e){return e.type==="feedback"}function zq(e){return(t,n)=>{if(!e.isEnabled()||!xT(t)&&!cT(t))return;let r=n.statusCode;if(!(!r||r<200||r>=300)){if(cT(t)){Fq(e,t);return}Hq(e,t)}}}function Fq(e,t){let n=t.contexts?.trace?.trace_id;n&&yM(e,n)}function Hq(e,t){let n=e.getContext();if(t.event_id&&n.errorIds.size<100&&n.errorIds.add(t.event_id),e.recordingMode!=="buffer"||!t.tags?.replayId)return;let{beforeErrorSampling:r}=e.getOptions();typeof r=="function"&&!r(t)||Hl(async()=>{try{await e.sendBufferedReplayOrFlush()}catch(o){e.handleException(o)}})}function Gq(e){return t=>{!e.isEnabled()||!xT(t)||$q(e,t)}}function $q(e,t){let n=t.exception?.values?.[0]?.value;if(typeof n=="string"&&(n.match(/(reactjs\.org\/docs\/error-decoder\.html\?invariant=|react\.dev\/errors\/)(418|419|422|423|425)/)||n.match(/(does not match server-rendered HTML|Hydration failed because)/i))){let r=Ri({category:"replay.hydrate-error",data:{url:nr()}});Fp(e,r)}}function jq(e){let t=q();t&&t.on("beforeAddBreadcrumb",n=>qq(e,n))}function qq(e,t){if(!e.isEnabled()||!_M(t))return;let n=Vq(t);n&&Fp(e,n)}function Vq(e){return!_M(e)||["fetch","xhr","sentry.event","sentry.transaction"].includes(e.category)||e.category.startsWith("ui.")?null:e.category==="console"?Wq(e):Ri(e)}function Wq(e){let t=e.data?.arguments;if(!Array.isArray(t)||t.length===0)return Ri(e);let n=!1,r=t.map(o=>{if(!o)return o;if(typeof o=="string")return o.length>ry?(n=!0,`${o.slice(0,ry)}\u2026`):o;if(typeof o=="object")try{let i=ht(o,7);return JSON.stringify(i).length>ry?(n=!0,`${JSON.stringify(i,null,2).slice(0,ry)}\u2026`):i}catch{}return o});return Ri({...e,data:{...e.data,arguments:r,...n?{_meta:{warnings:["CONSOLE_ARG_TRUNCATED"]}}:{}}})}function _M(e){return!!e.category}function Yq(e,t){return e.type||!e.exception?.values?.length?!1:!!t.originalException?.__rrweb__}function yy(){let e=ae().getPropagationContext().dsc;e&&delete e.replay_id;let t=Be();if(t){let n=en(t);delete n.replay_id}}function P2(e){let t=ae().getPropagationContext().dsc;t&&(t.replay_id=e);let n=Be();if(n){let r=en(n);r.replay_id=e}}function Kq(e,t){e.triggerUserActivity(),e.addUpdate(()=>t.timestamp?(e.throttledAddEvent({type:Ke.Custom,timestamp:t.timestamp*1e3,data:{tag:"breadcrumb",payload:{timestamp:t.timestamp,type:"default",category:"sentry.feedback",data:{feedbackId:t.event_id}}}}),!1):!0)}function Xq(e,t){return e.recordingMode!=="buffer"||t.message===mT||!t.exception||t.type?!1:mM(e.getOptions().errorSampleRate)}function Jq(e){return Object.assign((t,n)=>{if(e.session&&by(e.session,{maxReplayDuration:e.getOptions().maxReplayDuration,sessionIdleExpire:e.timeouts.sessionIdleExpire})&&yy(),!e.isEnabled()||e.isPaused())return t;if(Bq(t))return delete t.breadcrumbs,t;if(!xT(t)&&!cT(t)&&!U2(t))return t;if(!e.checkAndHandleExpiredSession())return yy(),t;if(U2(t))return e.flush(),t.contexts.feedback.replay_id=e.getSessionId(),Kq(e,t),t;if(Yq(t,n)&&!e.getOptions()._experiments.captureExceptions)return ke&&Ae.log("Ignoring error from rrweb internals",t),null;let o=Xq(e,t);if((o||e.recordingMode==="session")&&(t.tags={...t.tags,replayId:e.getSessionId()}),o&&e.recordingMode==="buffer"&&e.session?.sampled==="buffer"){let a=e.session;a.dirty=!0,e.getOptions().stickySession&&Ay(a)}return t},{id:"Replay"})}function Iy(e,t){return t.map(({type:n,start:r,end:o,name:i,data:a})=>{let s=e.throttledAddEvent({type:Ke.Custom,timestamp:r,data:{tag:"performanceSpan",payload:{op:n,description:i,startTimestamp:r,endTimestamp:o,data:a}}});return typeof s=="string"?Promise.resolve(null):s})}function Qq(e){let{from:t,to:n}=e,r=Date.now()/1e3;return{type:"navigation.push",start:r,end:r,name:n,data:{previous:t}}}function Zq(e){return t=>{if(!e.isEnabled())return;let n=Qq(t);n!==null&&(e.getContext().urls.push(n.name),e.triggerUserActivity(),e.addUpdate(()=>(Iy(e,[n]),!1)))}}function eV(e,t){return ke&&e.getOptions()._experiments.traceInternals?!1:mu(t,q())}function vM(e,t){e.isEnabled()&&t!==null&&(eV(e,t.name)||e.addUpdate(()=>(Iy(e,[t]),!0)))}function Ny(e){if(!e)return;let t=new TextEncoder;try{if(typeof e=="string")return t.encode(e).length;if(e instanceof URLSearchParams)return t.encode(e.toString()).length;if(e instanceof FormData){let n=jb(e);return t.encode(n).length}if(e instanceof Blob)return e.size;if(e instanceof ArrayBuffer)return e.byteLength}catch{}}function SM(e){if(!e)return;let t=parseInt(e,10);return isNaN(t)?void 0:t}function _y(e,t){if(!e)return{headers:{},size:void 0,_meta:{warnings:[t]}};let n={...e._meta},r=n.warnings||[];return n.warnings=[...r,t],e._meta=n,e}function EM(e,t){if(!t)return null;let{startTimestamp:n,endTimestamp:r,url:o,method:i,statusCode:a,request:s,response:l}=t;return{type:e,start:n/1e3,end:r/1e3,name:o,data:{method:i,statusCode:a,request:s,response:l}}}function Pp(e){return{headers:{},size:e,_meta:{warnings:["URL_SKIPPED"]}}}function hs(e,t,n){if(!t&&Object.keys(e).length===0)return;if(!t)return{headers:e};if(!n)return{headers:e,size:t};let r={headers:e,size:t},{body:o,warnings:i}=tV(n);return r.body=o,i?.length&&(r._meta={warnings:i}),r}function uT(e,t){return Object.entries(e).reduce((n,[r,o])=>{let i=r.toLowerCase();return t.includes(i)&&e[r]&&(n[i]=o),n},{})}function tV(e){if(!e||typeof e!="string")return{body:e};let t=e.length>b2,n=nV(e);if(t){let r=e.slice(0,b2);return n?{body:r,warnings:["MAYBE_JSON_TRUNCATED"]}:{body:`${r}\u2026`,warnings:["TEXT_TRUNCATED"]}}if(n)try{return{body:JSON.parse(e)}}catch{}return{body:e}}function nV(e){let t=e[0],n=e[e.length-1];return t==="["&&n==="]"||t==="{"&&n==="}"}function vy(e,t){let n=rV(e);return fn(n,t)}function rV(e,t=Mt.document.baseURI){if(e.startsWith("http://")||e.startsWith("https://")||e.startsWith(Mt.location.origin))return e;let n=new URL(e,t);if(n.origin!==new URL(t).origin)return e;let r=n.href;return!e.endsWith("/")&&r.endsWith("/")?r.slice(0,-1):r}async function oV(e,t,n){try{let r=await aV(e,t,n),o=EM("resource.fetch",r);vM(n.replay,o)}catch(r){ke&&Ae.exception(r,"Failed to capture fetch breadcrumb")}}function iV(e,t){let{input:n,response:r}=t,o=n?qu(n):void 0,i=Ny(o),a=r?SM(r.headers.get("content-length")):void 0;i!==void 0&&(e.data.request_body_size=i),a!==void 0&&(e.data.response_body_size=a)}async function aV(e,t,n){let r=Date.now(),{startTimestamp:o=r,endTimestamp:i=r}=t,{url:a,method:s,status_code:l=0,request_body_size:c,response_body_size:d}=e.data,u=vy(a,n.networkDetailAllowUrls)&&!vy(a,n.networkDetailDenyUrls),m=u?sV(n,t.input,c):Pp(c),p=await lV(u,n,t.response,d);return{startTimestamp:o,endTimestamp:i,url:a,method:s,statusCode:l,request:m,response:p}}function sV({networkCaptureBodies:e,networkRequestHeaders:t},n,r){let o=n?dV(n,t):{};if(!e)return hs(o,r,void 0);let i=qu(n),[a,s]=$l(i,Ae),l=hs(o,r,a);return s?_y(l,s):l}async function lV(e,{networkCaptureBodies:t,networkResponseHeaders:n},r,o){if(!e&&o!==void 0)return Pp(o);let i=r?TM(r.headers,n):{};if(!r||!t&&o!==void 0)return hs(i,o,void 0);let[a,s]=await uV(r),l=cV(a,{networkCaptureBodies:t,responseBodySize:o,captureDetails:e,headers:i});return s?_y(l,s):l}function cV(e,{networkCaptureBodies:t,responseBodySize:n,captureDetails:r,headers:o}){try{let i=e?.length&&n===void 0?Ny(e):n;return r?t?hs(o,i,e):hs(o,i,void 0):Pp(i)}catch(i){return ke&&Ae.exception(i,"Failed to serialize response body"),hs(o,n,void 0)}}async function uV(e){let t=fV(e);if(!t)return[void 0,"BODY_PARSE_ERROR"];try{return[await pV(t)]}catch(n){return n instanceof Error&&n.message.indexOf("Timeout")>-1?(ke&&Ae.warn("Parsing text body from response timed out"),[void 0,"BODY_PARSE_TIMEOUT"]):(ke&&Ae.exception(n,"Failed to get text body from response"),[void 0,"BODY_PARSE_ERROR"])}}function TM(e,t){let n={};return t.forEach(r=>{e.get(r)&&(n[r]=e.get(r))}),n}function dV(e,t){return e.length===1&&typeof e[0]!="string"?B2(e[0],t):e.length===2?B2(e[1],t):{}}function B2(e,t){if(!e)return{};let n=e.headers;return n?n instanceof Headers?TM(n,t):Array.isArray(n)?{}:uT(n,t):{}}function fV(e){try{return e.clone()}catch(t){ke&&Ae.exception(t,"Failed to clone response body")}}function pV(e){return new Promise((t,n)=>{let r=Hl(()=>n(new Error("Timeout while trying to read response body")),500);mV(e).then(o=>t(o),o=>n(o)).finally(()=>clearTimeout(r))})}async function mV(e){return await e.text()}async function gV(e,t,n){try{let r=bV(e,t,n),o=EM("resource.xhr",r);vM(n.replay,o)}catch(r){ke&&Ae.exception(r,"Failed to capture xhr breadcrumb")}}function hV(e,t){let{xhr:n,input:r}=t;if(!n)return;let o=Ny(r),i=n.getResponseHeader("content-length")?SM(n.getResponseHeader("content-length")):vV(n.response,n.responseType);o!==void 0&&(e.data.request_body_size=o),i!==void 0&&(e.data.response_body_size=i)}function bV(e,t,n){let r=Date.now(),{startTimestamp:o=r,endTimestamp:i=r,input:a,xhr:s}=t,{url:l,method:c,status_code:d=0,request_body_size:u,response_body_size:m}=e.data;if(!l)return null;if(!s||!vy(l,n.networkDetailAllowUrls)||vy(l,n.networkDetailDenyUrls)){let M=Pp(u),k=Pp(m);return{startTimestamp:o,endTimestamp:i,url:l,method:c,statusCode:d,request:M,response:k}}let p=s[sr],g=p?uT(p.request_headers,n.networkRequestHeaders):{},_=uT(wp(s),n.networkResponseHeaders),[y,h]=n.networkCaptureBodies?$l(a,Ae):[void 0],[v,T]=n.networkCaptureBodies?yV(s):[void 0],x=hs(g,u,y),N=hs(_,m,v);return{startTimestamp:o,endTimestamp:i,url:l,method:c,statusCode:d,request:h?_y(x,h):x,response:T?_y(N,T):N}}function yV(e){let t=[];try{return[e.responseText]}catch(n){t.push(n)}try{return _V(e.response,e.responseType)}catch(n){t.push(n)}return ke&&Ae.warn("Failed to get xhr response body",...t),[void 0]}function _V(e,t){try{if(typeof e=="string")return[e];if(e instanceof Document)return[e.body.outerHTML];if(t==="json"&&e&&typeof e=="object")return[JSON.stringify(e)];if(!e)return[void 0]}catch(n){return ke&&Ae.exception(n,"Failed to serialize body",e),[void 0,"BODY_PARSE_ERROR"]}return ke&&Ae.log("Skipping network body because of body type",e),[void 0,"UNPARSEABLE_BODY_TYPE"]}function vV(e,t){try{let n=t==="json"&&e&&typeof e=="object"?JSON.stringify(e):e;return Ny(n)}catch{return}}function SV(e){let t=q();try{let{networkDetailAllowUrls:n,networkDetailDenyUrls:r,networkCaptureBodies:o,networkRequestHeaders:i,networkResponseHeaders:a}=e.getOptions(),s={replay:e,networkDetailAllowUrls:n,networkDetailDenyUrls:r,networkCaptureBodies:o,networkRequestHeaders:i,networkResponseHeaders:a};t&&t.on("beforeAddBreadcrumb",(l,c)=>EV(s,l,c))}catch{}}function EV(e,t,n){if(t.data)try{TV(t)&&xV(n)&&(hV(t,n),gV(t,n,e)),wV(t)&&kV(n)&&(iV(t,n),oV(t,n,e))}catch(r){ke&&Ae.exception(r,"Error when enriching network breadcrumb")}}function TV(e){return e.category==="xhr"}function wV(e){return e.category==="fetch"}function xV(e){return e?.xhr}function kV(e){return e?.input!==void 0}function AV(e){let t=q();Tp(oq(e)),sa(Zq(e)),jq(e),SV(e);let n=Jq(e);su(n),t&&(t.on("beforeSendEvent",Gq(e)),t.on("afterSendEvent",zq(e)),t.on("createDsc",r=>{let o=e.getSessionId();o&&e.isEnabled()&&e.recordingMode==="session"&&e.checkAndHandleExpiredSession()&&(r.replay_id=o)}),t.on("afterSegmentSpanEnd",Pq(e)),t.on("spanStart",r=>{e.lastActiveSpan=r}),t.on("spanEnd",r=>{e.lastActiveSpan=r}),t.on("beforeSendFeedback",async(r,o)=>{let i=e.getSessionId();o?.includeReplay&&e.isEnabled()&&i&&r.contexts?.feedback&&(r.contexts.feedback.source==="api"&&await e.sendBufferedReplayOrFlush(),r.contexts.feedback.replay_id=i)}),t.on("openFeedbackWidget",async()=>{await e.sendBufferedReplayOrFlush()}))}async function IV(e){try{return Promise.all(Iy(e,[NV(Mt.performance.memory)]))}catch{return[]}}function NV(e){let{jsHeapSizeLimit:t,totalJSHeapSize:n,usedJSHeapSize:r}=e,o=Date.now()/1e3;return{type:"memory",name:"memory",start:o,end:o,data:{memory:{jsHeapSizeLimit:t,totalJSHeapSize:n,usedJSHeapSize:r}}}}function RV(e,t,n){return aS(e,t,{...n,setTimeoutImpl:Hl})}var ay=ne.navigator;function CV(){return/iPhone|iPad|iPod/i.test(ay?.userAgent??"")||/Macintosh/i.test(ay?.userAgent??"")&&ay?.maxTouchPoints&&ay?.maxTouchPoints>1?{sampling:{mousemove:!1}}:{}}function MV(e){let t=!1;return(n,r)=>{if(!e.checkAndHandleExpiredSession()){ke&&Ae.warn("Received replay event after session expired.");return}let o=r||!t;t=!0,OV(n),e.clickDetector&&Zj(e.clickDetector,n),e.addUpdate(()=>{if(e.recordingMode==="buffer"&&o&&e.setInitialState(),!wT(e,n,o))return!0;if(!o)return!1;let i=e.session;if(LV(e,o),e.recordingMode==="buffer"&&i&&e.eventBuffer&&!i.dirty){let a=e.eventBuffer.getEarliestTimestamp();a&&(ke&&Ae.log(`Updating session start time to earliest event in buffer to ${new Date(a)}`),i.started=a,e.getOptions().stickySession&&Ay(i))}return i?.previousSessionId||e.recordingMode==="session"&&e.flush(),!0})}}function OV(e){let t=e.data;if(!(e.type!==Ke.IncrementalSnapshot||!t||typeof t!="object"||!("source"in t)||t.source!==Oe.Mutation||!("attributes"in t)||!Array.isArray(t.attributes)))for(let n of t.attributes){let r=ni.mirror.getNode(n.id),o=r&&ni.mirror.getMeta(r);if(o?.type===ky.Element)for(let[i,a]of Object.entries(n.attributes))a===null?delete o.attributes[i]:o.attributes[i]=a}}function DV(e){let t=e.getOptions();return{type:Ke.Custom,timestamp:Date.now(),data:{tag:"options",payload:{shouldRecordCanvas:e.isRecordingCanvas(),sessionSampleRate:t.sessionSampleRate,errorSampleRate:t.errorSampleRate,useCompressionOption:t.useCompression,blockAllMedia:t.blockAllMedia,maskAllText:t.maskAllText,maskAllInputs:t.maskAllInputs,useCompression:e.eventBuffer?e.eventBuffer.type==="worker":!1,networkDetailHasUrls:t.networkDetailAllowUrls.length>0,networkCaptureBodies:t.networkCaptureBodies,networkRequestHasHeaders:t.networkRequestHeaders.length>0,networkResponseHasHeaders:t.networkResponseHeaders.length>0}}}}function LV(e,t){!t||e.session?.segmentId!==0||wT(e,DV(e),!1)}function UV(e){if(!e)return null;try{return e.nodeType===e.ELEMENT_NODE?e:e.parentElement}catch{return null}}function PV(e,t,n,r){return $t(eu(e,Xo(e),r,n),[[{type:"replay_event"},e],[{type:"replay_recording",length:typeof t=="string"?new TextEncoder().encode(t).length:t.length},t]])}function BV({recordingData:e,headers:t}){let n,r=`${JSON.stringify(t)}
505
- `;if(typeof e=="string")n=`${r}${e}`;else{let i=new TextEncoder().encode(r);n=new Uint8Array(i.length+e.length),n.set(i),n.set(e,i.length)}return n}async function zV({client:e,scope:t,replayId:n,event:r}){let o=typeof e._integrations=="object"&&e._integrations!==null&&!Array.isArray(e._integrations)?Object.keys(e._integrations):void 0,i={event_id:n,integrations:o};e.emit("preprocessEvent",r,i);let a=await Jf(e.getOptions(),r,i,t,e,je());if(!a)return null;e.emit("postprocessEvent",a,i),a.platform=a.platform||"javascript";let s=e.getSdkMetadata(),{name:l,version:c,settings:d}=s?.sdk||{};return a.sdk={...a.sdk,name:l||"sentry.javascript.unknown",version:c||"0.0.0",settings:d},a}async function FV({recordingData:e,replayId:t,segmentId:n,eventContext:r,timestamp:o,session:i}){let a=BV({recordingData:e,headers:{segment_id:n}}),{urls:s,errorIds:l,traceIds:c,initialTimestamp:d}=r,u=q(),m=ae(),p=u?.getTransport(),g=u?.getDsn();if(!u||!p||!g||!i.sampled)return Promise.resolve({});let _={type:x$,replay_start_timestamp:d/1e3,timestamp:o/1e3,error_ids:l,trace_ids:c,urls:s,replay_id:t,segment_id:n,replay_type:i.sampled},y=await zV({scope:m,client:u,replayId:t,event:_});if(!y)return u.recordDroppedEvent("event_processor","replay"),ke&&Ae.log("An event processor returned `null`, will not send event."),Promise.resolve({});delete y.sdkProcessingMetadata;let h=PV(y,a,g,u.getOptions().tunnel),v;try{v=await p.send(h)}catch(x){let N=new Error(mT);try{N.cause=x}catch{}throw N}let T=ep({},v);if(Zf(T,"replay"))throw new Bp(T);if(typeof v.statusCode=="number"&&(v.statusCode<200||v.statusCode>=300))throw new Sy(v.statusCode);return v}var Sy=class extends Error{constructor(t){super(`Transport returned status code ${t}`)}},Bp=class extends Error{constructor(t){super("Rate limit hit"),this.rateLimits=t}},Ey=class extends Error{constructor(){super("Session is too long, not sending replay")}};async function wM(e,t={count:0,interval:C$}){let{recordingData:n,onError:r}=e;if(n.length)try{return await FV(e),!0}catch(o){if(o instanceof Sy||o instanceof Bp)throw o;if(Qa("Replays",{_retryCount:t.count}),r&&r(o),t.count>=M$){let i=new Error(`${mT} - max retries exceeded`);try{i.cause=o}catch{}throw i}return t.interval*=++t.count,new Promise((i,a)=>{Hl(async()=>{try{await wM(e,t),i(!0)}catch(s){a(s)}},t.interval)})}}var xM="__THROTTLED",HV="__SKIPPED";function GV(e,t,n){let r=new Map,o=s=>{let l=s-n;r.forEach((c,d)=>{d<l&&r.delete(d)})},i=()=>[...r.values()].reduce((s,l)=>s+l,0),a=!1;return(...s)=>{let l=Math.floor(Date.now()/1e3);if(o(l),i()>=t){let d=a;return a=!0,d?HV:xM}a=!1;let c=r.get(l)||0;return r.set(l,c+1),e(...s)}}var dT=class{constructor({options:t,recordingOptions:n}){this.eventBuffer=null,this.performanceEntries=[],this.replayPerformanceEntries=[],this.recordingMode="session",this.timeouts={sessionIdlePause:k$,sessionIdleExpire:A$},this._lastActivity=Date.now(),this._isEnabled=!1,this._isPaused=!1,this._requiresManualStart=!1,this._hasInitializedCoreListeners=!1,this._context={errorIds:new Set,traceIds:new Set,urls:[],initialTimestamp:Date.now(),initialUrl:""},this._recordingOptions=n,this._options=t,this._debouncedFlush=RV(()=>this._flush(),this._options.flushMinDelay,{maxWait:this._options.flushMaxDelay}),this._throttledAddEvent=GV((a,s)=>Dq(this,a,s),300,5);let{slowClickTimeout:r,slowClickIgnoreSelectors:o}=this.getOptions(),i=r?{threshold:Math.min(O$,r),timeout:r,scrollTimeout:D$,ignoreSelector:o?o.join(","):""}:void 0;if(i&&(this.clickDetector=new oT(this,i)),ke){let a=t._experiments;Ae.setConfig({captureExceptions:!!a.captureExceptions,traceInternals:!!a.traceInternals})}this._handleVisibilityChange=()=>{Mt.document.visibilityState==="visible"?this._doChangeToForegroundTasks():this._doChangeToBackgroundTasks()},this._handleWindowBlur=()=>{let a=Ri({category:"ui.blur"});this._doChangeToBackgroundTasks(a)},this._handleWindowFocus=()=>{let a=Ri({category:"ui.focus"});this._doChangeToForegroundTasks(a)},this._handleKeyboardEvent=a=>{lq(this,a)}}getContext(){return this._context}isEnabled(){return this._isEnabled}isPaused(){return this._isPaused}isRecordingCanvas(){return!!this._canvas}getOptions(){return this._options}handleException(t){ke&&Ae.exception(t),this._options.onError&&this._options.onError(t)}initializeSampling(t){let{errorSampleRate:n,sessionSampleRate:r}=this._options,o=n<=0&&r<=0;if(this._requiresManualStart=o,!o){if(this._initializeSessionForSampling(t),!this.session){ke&&Ae.exception(new Error("Unable to initialize and create session"));return}this.session.sampled!==!1&&(this.recordingMode=this.session.sampled==="buffer"&&this.session.segmentId===0?"buffer":"session",ke&&Ae.infoTick(`Starting replay in ${this.recordingMode} mode`),this._initializeRecording())}}start(){if(this._isEnabled&&this.recordingMode==="session"){ke&&Ae.log("Recording is already in progress");return}if(this._isEnabled&&this.recordingMode==="buffer"){ke&&Ae.log("Buffering is in progress, call `flush()` to save the replay");return}ke&&Ae.infoTick("Starting replay in session mode"),this._updateUserActivity();let t=GE({maxReplayDuration:this._options.maxReplayDuration,sessionIdleExpire:this.timeouts.sessionIdleExpire},{stickySession:this._options.stickySession,sessionSampleRate:1,allowBuffering:!1});this.session=t,this.recordingMode="session",this._initializeRecording()}startBuffering(){if(this._isEnabled){ke&&Ae.log("Buffering is in progress, call `flush()` to save the replay");return}ke&&Ae.infoTick("Starting replay in buffer mode");let t=GE({sessionIdleExpire:this.timeouts.sessionIdleExpire,maxReplayDuration:this._options.maxReplayDuration},{stickySession:this._options.stickySession,sessionSampleRate:0,allowBuffering:!0});this.session=t,this.recordingMode="buffer",this._initializeRecording()}startRecording(){try{let t=this._canvas;this._stopRecording=ni({...this._recordingOptions,...this.recordingMode==="buffer"?{checkoutEveryNms:R$}:this._options._experiments.continuousCheckout&&{checkoutEveryNms:Math.max(36e4,this._options._experiments.continuousCheckout)},emit:MV(this),...CV(),onMutation:this._onMutationHandler.bind(this),...t?{recordCanvas:t.recordCanvas,getCanvasManager:t.getCanvasManager,sampling:t.sampling,dataURLOptions:t.dataURLOptions}:{}})}catch(t){this.handleException(t)}}stopRecording(){try{return this._stopRecording&&(this._stopRecording(),this._stopRecording=void 0),!0}catch(t){return this.handleException(t),!1}}async stop({forceFlush:t=!1,reason:n}={}){if(!this._isEnabled)return;this._isEnabled=!1,this.recordingMode="buffer";let r=n??"manual";q()?.emit("replayEnd",{sessionId:this.session?.id,reason:r});try{ke&&Ae.log(`Stopping Replay triggered by ${r}`),yy(),this._removeListeners(),this.stopRecording(),this._debouncedFlush.cancel(),t&&await this._flush({force:!0}),this.eventBuffer?.destroy(),this.eventBuffer=null,Iq(this)}catch(o){this.handleException(o)}}pause(){this._isPaused||(this._isPaused=!0,this.stopRecording(),ke&&Ae.log("Pausing replay"))}resume(){!this._isPaused||!this._checkSession()||(this._isPaused=!1,this.startRecording(),ke&&Ae.log("Resuming replay"))}async sendBufferedReplayOrFlush({continueRecording:t=!0}={}){if(this.recordingMode==="session")return this.flushImmediate();let n=Date.now();ke&&Ae.log("Converting buffer to session"),await this.flushImmediate();let r=this.stopRecording();!t||!r||this.recordingMode!=="session"&&(this.recordingMode="session",this.session&&(this.session.dirty=!1,this._updateUserActivity(n),this._updateSessionActivity(n),this._maybeSaveSession(),P2(this.session.id)),this.startRecording())}addUpdate(t){let n=t();this.recordingMode==="buffer"||!this._isEnabled||n!==!0&&this._debouncedFlush()}triggerUserActivity(){if(this._updateUserActivity(),!this._stopRecording){if(!this._checkSession())return;this.resume();return}this.checkAndHandleExpiredSession(),this._updateSessionActivity()}updateUserActivity(){this._updateUserActivity(),this._updateSessionActivity()}conditionalFlush(){return this.recordingMode==="buffer"?Promise.resolve():this.flushImmediate()}flush(){return this._debouncedFlush()}flushImmediate(){return this._debouncedFlush(),this._debouncedFlush.flush()}cancelFlush(){this._debouncedFlush.cancel()}getSessionId(t){if(!(t&&this.session?.sampled===!1))return this.session?.id}checkAndHandleExpiredSession(){if(this._lastActivity&&lT(this._lastActivity,this.timeouts.sessionIdlePause)&&this.session?.sampled==="session"){this.pause();return}return!!this._checkSession()}setInitialState(){let t=`${Mt.location.pathname}${Mt.location.hash}${Mt.location.search}`,n=`${Mt.location.origin}${t}`;this.performanceEntries=[],this.replayPerformanceEntries=[],this._clearContext(),this._context.initialUrl=n,this._context.initialTimestamp=Date.now(),this._context.urls.push(n)}throttledAddEvent(t,n){let r=this._throttledAddEvent(t,n);if(r===xM){let o=Ri({category:"replay.throttled"});this.addUpdate(()=>!wT(this,{type:$j,timestamp:o.timestamp||0,data:{tag:"breadcrumb",payload:o,metric:!0}}))}return r}getCurrentRoute(){let t=this.lastActiveSpan||Be(),n=t&&Fe(t),o=(n&&ie(n).data||{})[Pe];if(!(!n||!o||!["route","custom"].includes(o)))return ie(n).description}_initializeRecording(){this.setInitialState(),this._updateSessionActivity(),this.eventBuffer=xq({useCompression:this._options.useCompression,workerUrl:this._options.workerUrl}),this._removeListeners(),this._addListeners(),this._isEnabled=!0,this._isPaused=!1,this.session&&q()?.emit("replayStart",{sessionId:this.session.id,recordingMode:this.recordingMode}),this.startRecording(),this.recordingMode==="session"&&this.session&&P2(this.session.id)}_initializeSessionForSampling(t){let n=this._options.errorSampleRate>0,r=GE({sessionIdleExpire:this.timeouts.sessionIdleExpire,maxReplayDuration:this._options.maxReplayDuration,previousSessionId:t},{stickySession:this._options.stickySession,sessionSampleRate:this._options.sessionSampleRate,allowBuffering:n});this.session=r}_checkSession(){if(!this.session)return!1;let t=this.session;return by(t,{sessionIdleExpire:this.timeouts.sessionIdleExpire,maxReplayDuration:this._options.maxReplayDuration})?(this._refreshSession(t),!1):!0}async _refreshSession(t){this._isEnabled&&(await this.stop({reason:"sessionExpired"}),this.initializeSampling(t.id))}_addListeners(){try{Mt.document.addEventListener("visibilitychange",this._handleVisibilityChange),Mt.addEventListener("blur",this._handleWindowBlur),Mt.addEventListener("focus",this._handleWindowFocus),Mt.addEventListener("keydown",this._handleKeyboardEvent),this.clickDetector&&this.clickDetector.addListeners(),this._hasInitializedCoreListeners||(AV(this),this._hasInitializedCoreListeners=!0)}catch(t){this.handleException(t)}this._performanceCleanupCallback=Sq(this)}_removeListeners(){try{Mt.document.removeEventListener("visibilitychange",this._handleVisibilityChange),Mt.removeEventListener("blur",this._handleWindowBlur),Mt.removeEventListener("focus",this._handleWindowFocus),Mt.removeEventListener("keydown",this._handleKeyboardEvent),this.clickDetector&&this.clickDetector.removeListeners(),this._performanceCleanupCallback&&this._performanceCleanupCallback()}catch(t){this.handleException(t)}}_doChangeToBackgroundTasks(t){if(!this.session)return;if(by(this.session,{maxReplayDuration:this._options.maxReplayDuration,sessionIdleExpire:this.timeouts.sessionIdleExpire})){yy();return}t&&this._createCustomBreadcrumb(t),this.conditionalFlush()}_doChangeToForegroundTasks(t){if(!this.session)return;if(!this.checkAndHandleExpiredSession()){ke&&Ae.log("Document has become active, but session has expired");return}t&&this._createCustomBreadcrumb(t)}_updateUserActivity(t=Date.now()){this._lastActivity=t}_updateSessionActivity(t=Date.now()){this.session&&(this.session.lastActivity=t,this._maybeSaveSession())}_createCustomBreadcrumb(t){this.addUpdate(()=>{this.throttledAddEvent({type:Ke.Custom,timestamp:t.timestamp||0,data:{tag:"breadcrumb",payload:t}})})}_addPerformanceEntries(){let t=fq(this.performanceEntries).concat(this.replayPerformanceEntries);if(this.performanceEntries=[],this.replayPerformanceEntries=[],this._requiresManualStart){let n=this._context.initialTimestamp/1e3;t=t.filter(r=>r.start>=n)}return Promise.all(Iy(this,t))}_clearContext(){this._context.errorIds.clear(),this._context.traceIds.clear(),this._context.urls=[]}_updateInitialTimestampFromEventBuffer(){let{session:t,eventBuffer:n}=this;if(!t||!n||this._requiresManualStart||t.segmentId)return;let r=n.getEarliestTimestamp();r&&r<this._context.initialTimestamp&&(this._context.initialTimestamp=r)}_popEventContext(){let t={initialTimestamp:this._context.initialTimestamp,initialUrl:this._context.initialUrl,errorIds:Array.from(this._context.errorIds),traceIds:Array.from(this._context.traceIds),urls:this._context.urls};return this._clearContext(),t}async _runFlush(){let t=this.getSessionId();if(!this.session||!this.eventBuffer||!t){ke&&Ae.error("No session or eventBuffer found to flush.");return}if(await this._addPerformanceEntries(),!!this.eventBuffer?.hasEvents&&(await IV(this),!!this.eventBuffer&&t===this.getSessionId()))try{this._updateInitialTimestampFromEventBuffer();let n=Date.now();if(n-this._context.initialTimestamp>this._options.maxReplayDuration+3e4)throw new Ey;let r=this._popEventContext(),o=this.session.segmentId++;this._maybeSaveSession();let i=await this.eventBuffer.finish();await wM({replayId:t,recordingData:i,segmentId:o,eventContext:r,session:this.session,timestamp:n,onError:a=>this.handleException(a)})}catch(n){this.handleException(n),this.stop({reason:"sendError"});let r=q();if(r){let o;n instanceof Bp?o="ratelimit_backoff":n instanceof Ey?o="invalid":o="send_error",r.recordDroppedEvent(o,"replay")}}}async _flush({force:t=!1}={}){if(!this._isEnabled&&!t)return;if(!this.checkAndHandleExpiredSession()){ke&&Ae.error("Attempting to finish replay event after session expired.");return}if(!this.session)return;let n=this.session.started,o=Date.now()-n;this._debouncedFlush.cancel();let i=o<this._options.minReplayDuration,a=o>this._options.maxReplayDuration+5e3;if(i||a){ke&&Ae.log(`Session duration (${Math.floor(o/1e3)}s) is too ${i?"short":"long"}, not sending replay.`),i&&this._debouncedFlush();return}let s=this.eventBuffer;s&&this.session.segmentId===0&&!s.hasCheckout&&ke&&Ae.log("Flushing initial segment without checkout.");let l=!!this._flushLock;this._flushLock||(this._flushLock=this._runFlush());try{await this._flushLock}catch(c){this.handleException(c)}finally{this._flushLock=void 0,l&&this._debouncedFlush()}}_maybeSaveSession(){this.session&&this._options.stickySession&&Ay(this.session)}_onMutationHandler(t){let{ignoreMutations:n}=this._options._experiments;if(n?.length&&t.some(s=>{let l=UV(s.target),c=n.join(",");return l?.matches(c)}))return!1;let r=t.length,o=this._options.mutationLimit,i=this._options.mutationBreadcrumbLimit,a=o&&r>o;if(r>i||a){let s=Ri({category:"replay.mutations",data:{count:r,limit:a}});this._createCustomBreadcrumb(s)}return a?(this.stop({reason:"mutationLimit",forceFlush:this.recordingMode==="session"}),!1):!0}};function Ap(e,t){return[...e,...t].join(",")}function $V({mask:e,unmask:t,block:n,unblock:r,ignore:o}){let i=["base","iframe[srcdoc]:not([src])"],a=Ap(e,[".sentry-mask","[data-sentry-mask]"]),s=Ap(t,[]);return{maskTextSelector:a,unmaskTextSelector:s,blockSelector:Ap(n,[".sentry-block","[data-sentry-block]",...i]),unblockSelector:Ap(r,[]),ignoreSelector:Ap(o,[".sentry-ignore","[data-sentry-ignore]",'input[type="file"]'])}}function jV({el:e,key:t,maskAttributes:n,maskAllText:r,privacyOptions:o,value:i}){if(o.unmaskTextSelector&&e.matches(o.unmaskTextSelector))return i;let a=n.includes(t),s=r&&t==="value"&&e.tagName==="INPUT"&&["submit","button"].includes(e.getAttribute("type")||"");return a||s?i.replace(/[\S]/g,"*"):i}var z2='img,image,svg,video,object,picture,embed,map,audio,link[rel="icon"],link[rel="apple-touch-icon"]',qV=["content-length","content-type","accept"],VV=Symbol.for("sentry__originalRequestBody"),F2=!1,H2=!1;function WV(){if(typeof Request>"u"||H2)return;let e=Request;try{let t=function(n,r){let o=new e(n,r);return r?.body!=null&&(o[VV]=r.body),o};t.prototype=e.prototype,ne.Request=t,H2=!0}catch{}}var Ry=(e=>new fT(e)),fT=class{constructor({flushMinDelay:t=I$,flushMaxDelay:n=N$,minReplayDuration:r=L$,maxReplayDuration:o=y2,stickySession:i=!0,useCompression:a=!0,workerUrl:s,_experiments:l={},maskAllText:c=!0,maskAllInputs:d=!0,blockAllMedia:u=!0,mutationBreadcrumbLimit:m=750,mutationLimit:p=1e4,slowClickTimeout:g=7e3,slowClickIgnoreSelectors:_=[],networkDetailAllowUrls:y=[],networkDetailDenyUrls:h=[],networkCaptureBodies:v=!0,networkRequestHeaders:T=[],networkResponseHeaders:x=[],mask:N=[],maskAttributes:M=["title","placeholder","aria-label"],unmask:k=[],block:P=[],unblock:F=[],ignore:U=[],maskFn:X,beforeAddRecordingEvent:G,beforeErrorSampling:R,onError:C,attachRawBodyFromRequest:$=!1}={}){this.name="Replay";let ee=$V({mask:N,unmask:k,block:P,unblock:F,ignore:U});if(this._recordingOptions={maskAllInputs:d,maskAllText:c,maskInputOptions:{password:!0},maskTextFn:X,maskInputFn:X,maskAttributeFn:(B,H,se)=>jV({maskAttributes:M,maskAllText:c,privacyOptions:ee,key:B,value:H,el:se}),...ee,slimDOMOptions:"all",inlineStylesheet:!0,inlineImages:!1,collectFonts:!0,errorHandler:B=>{try{B.__rrweb__=!0}catch{}},recordCrossOriginIframes:!!l.recordCrossOriginIframes},this._initialOptions={flushMinDelay:t,flushMaxDelay:n,minReplayDuration:Math.min(r,U$),maxReplayDuration:Math.min(o,y2),stickySession:i,useCompression:a,workerUrl:s,blockAllMedia:u,maskAllInputs:d,maskAllText:c,mutationBreadcrumbLimit:m,mutationLimit:p,slowClickTimeout:g,slowClickIgnoreSelectors:_,networkDetailAllowUrls:y,networkDetailDenyUrls:h,networkCaptureBodies:v,networkRequestHeaders:G2(T),networkResponseHeaders:G2(x),beforeAddRecordingEvent:G,beforeErrorSampling:R,onError:C,attachRawBodyFromRequest:$,_experiments:l},this._initialOptions.blockAllMedia&&(this._recordingOptions.blockSelector=this._recordingOptions.blockSelector?`${this._recordingOptions.blockSelector},${z2}`:z2,this._recordingOptions.ignoreCSSAttributes=new Set(["background-image"])),this._isInitialized&&Zn())throw new Error("Multiple Sentry Session Replay instances are not supported");this._isInitialized=!0}get _isInitialized(){return F2}set _isInitialized(t){F2=t}afterAllSetup(t){!Zn()||this._replay||(this._initialOptions.attachRawBodyFromRequest&&WV(),this._setup(t),this._initialize(t))}start(){this._replay&&this._replay.start()}startBuffering(){this._replay&&this._replay.startBuffering()}stop(){return this._replay?this._replay.stop({forceFlush:this._replay.recordingMode==="session",reason:"manual"}):Promise.resolve()}flush(t){return this._replay?this._replay.isEnabled()?this._replay.sendBufferedReplayOrFlush(t):(this._replay.start(),Promise.resolve()):Promise.resolve()}getReplayId(t){if(this._replay?.isEnabled())return this._replay.getSessionId(t)}getRecordingMode(){if(this._replay?.isEnabled())return this._replay.recordingMode}processSpan(t){let n=this.getReplayId(!0);n&&(zr(t,{"sentry.replay_id":n}),this.getRecordingMode()==="buffer"&&zr(t,{"sentry._internal.replay_is_buffering":!0}))}_initialize(t){this._replay&&(this._maybeLoadFromReplayCanvasIntegration(t),this._replay.initializeSampling())}_setup(t){let n=YV(this._initialOptions,t);this._replay=new dT({options:n,recordingOptions:this._recordingOptions})}_maybeLoadFromReplayCanvasIntegration(t){try{let n=t.getIntegrationByName("ReplayCanvas");if(!n)return;this._replay._canvas=n.getOptions()}catch{}}};function YV(e,t){let n=t.getOptions(),r={sessionSampleRate:0,errorSampleRate:0,...e},o=Br(n.replaysSessionSampleRate),i=Br(n.replaysOnErrorSampleRate);return o==null&&i==null&&Sn(()=>{console.warn("Replay is disabled because neither `replaysSessionSampleRate` nor `replaysOnErrorSampleRate` are set.")}),o!=null&&(r.sessionSampleRate=o),i!=null&&(r.errorSampleRate=i),r}function G2(e){return[...qV,...e.map(t=>t.toLowerCase())]}function kM(){return q()?.getIntegrationByName("Replay")}var KV=Object.defineProperty,XV=(e,t,n)=>t in e?KV(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,AM=(e,t,n)=>XV(e,typeof t!="symbol"?t+"":t,n),AT=class{constructor(){AM(this,"idNodeMap",new Map),AM(this,"nodeMetaMap",new WeakMap)}getId(t){return t?this.getMeta(t)?.id??-1:-1}getNode(t){return this.idNodeMap.get(t)||null}getIds(){return Array.from(this.idNodeMap.keys())}getMeta(t){return this.nodeMetaMap.get(t)||null}removeNodeFromMap(t){let n=this.getId(t);this.idNodeMap.delete(n),t.childNodes&&t.childNodes.forEach(r=>this.removeNodeFromMap(r))}has(t){return this.idNodeMap.has(t)}hasNode(t){return this.nodeMetaMap.has(t)}add(t,n){let r=n.id;this.idNodeMap.set(r,t),this.nodeMetaMap.set(t,n)}replace(t,n){let r=this.getNode(t);if(r){let o=this.nodeMetaMap.get(r);o&&this.nodeMetaMap.set(n,o)}this.idNodeMap.set(t,n)}reset(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap}};function JV(){return new AT}function QV(e,t){for(let n=e.classList.length;n--;){let r=e.classList[n];if(t.test(r))return!0}return!1}function IT(e,t,n=1/0,r=0){return!e||e.nodeType!==e.ELEMENT_NODE||r>n?-1:t(e)?r:IT(e.parentNode,t,n,r+1)}function IM(e,t){return n=>{let r=n;if(r===null)return!1;try{if(e){if(typeof e=="string"){if(r.matches(`.${e}`))return!0}else if(QV(r,e))return!0}return!!(t&&r.matches(t))}catch{return!1}}}var id=`Please stop import mirror directly. Instead of that,\r
506
- now you can use replayer.getMirror() to access the mirror instance of a replayer,\r
507
- or you can use record.mirror to access the mirror instance during recording.`,NM={map:{},getId(){return console.error(id),-1},getNode(){return console.error(id),null},removeNodeFromMap(){console.error(id)},has(){return console.error(id),!1},reset(){console.error(id)}};typeof window<"u"&&window.Proxy&&window.Reflect&&(NM=new Proxy(NM,{get(e,t,n){return t==="map"&&console.error(id),Reflect.get(e,t,n)}}));function RT(e,t,n,r,o=window){let i=o.Object.getOwnPropertyDescriptor(e,t);return o.Object.defineProperty(e,t,r?n:{set(a){PM(()=>{n.set.call(this,a)},0),i&&i.set&&i.set.call(this,a)}}),()=>RT(e,t,i||{},!0)}function CT(e,t,n){try{if(!(t in e))return()=>{};let r=e[t],o=n(r);return typeof o=="function"&&(o.prototype=o.prototype||{},Object.defineProperties(o,{__rrweb_original__:{enumerable:!1,value:r}})),e[t]=o,()=>{e[t]=r}}catch{return()=>{}}}Date.now().toString();function ZV(e){if(!e)return null;try{return e.nodeType===e.ELEMENT_NODE?e:e.parentElement}catch{return null}}function Dy(e,t,n,r,o){if(!e)return!1;let i=ZV(e);if(!i)return!1;let a=IM(t,n);if(!o){let c=r&&i.matches(r);return a(i)&&!c}let s=IT(i,a),l=-1;return s<0?!1:(r&&(l=IT(i,IM(null,r))),s>-1&&l<0?!0:s<l)}var RM={};function UM(e){let t=RM[e];if(t)return t;let n=window.document,r=window[e];if(n&&typeof n.createElement=="function")try{let o=n.createElement("iframe");o.hidden=!0,n.head.appendChild(o);let i=o.contentWindow;i&&i[e]&&(r=i[e]),n.head.removeChild(o)}catch{}return RM[e]=r.bind(window)}function ql(...e){return UM("requestAnimationFrame")(...e)}function PM(...e){return UM("setTimeout")(...e)}var sd=(e=>(e[e["2D"]=0]="2D",e[e.WebGL=1]="WebGL",e[e.WebGL2=2]="WebGL2",e))(sd||{}),My;function eW(e){My=e}var kT=e=>My?((...n)=>{try{return e(...n)}catch(r){if(My&&My(r)===!0)return()=>{};throw r}}):e,ad="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",tW=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(Hp=0;Hp<ad.length;Hp++)tW[ad.charCodeAt(Hp)]=Hp;var Hp,nW=function(e){var t=new Uint8Array(e),n,r=t.length,o="";for(n=0;n<r;n+=3)o+=ad[t[n]>>2],o+=ad[(t[n]&3)<<4|t[n+1]>>4],o+=ad[(t[n+1]&15)<<2|t[n+2]>>6],o+=ad[t[n+2]&63];return r%3===2?o=o.substring(0,o.length-1)+"=":r%3===1&&(o=o.substring(0,o.length-2)+"=="),o},CM=new Map;function rW(e,t){let n=CM.get(e);return n||(n=new Map,CM.set(e,n)),n.has(t)||n.set(t,[]),n.get(t)}var BM=(e,t,n)=>{if(!e||!(FM(e,t)||typeof e=="object"))return;let r=e.constructor.name,o=rW(n,r),i=o.indexOf(e);return i===-1&&(i=o.length,o.push(e)),i};function Oy(e,t,n){if(e instanceof Array)return e.map(r=>Oy(r,t,n));if(e===null)return e;if(e instanceof Float32Array||e instanceof Float64Array||e instanceof Int32Array||e instanceof Uint32Array||e instanceof Uint8Array||e instanceof Uint16Array||e instanceof Int16Array||e instanceof Int8Array||e instanceof Uint8ClampedArray)return{rr_type:e.constructor.name,args:[Object.values(e)]};if(e instanceof ArrayBuffer){let r=e.constructor.name,o=nW(e);return{rr_type:r,base64:o}}else{if(e instanceof DataView)return{rr_type:e.constructor.name,args:[Oy(e.buffer,t,n),e.byteOffset,e.byteLength]};if(e instanceof HTMLImageElement){let r=e.constructor.name,{src:o}=e;return{rr_type:r,src:o}}else if(e instanceof HTMLCanvasElement){let r="HTMLImageElement",o=e.toDataURL();return{rr_type:r,src:o}}else{if(e instanceof ImageData)return{rr_type:e.constructor.name,args:[Oy(e.data,t,n),e.width,e.height]};if(FM(e,t)||typeof e=="object"){let r=e.constructor.name,o=BM(e,t,n);return{rr_type:r,index:o}}}}return e}var zM=(e,t,n)=>e.map(r=>Oy(r,t,n)),FM=(e,t)=>!!["WebGLActiveInfo","WebGLBuffer","WebGLFramebuffer","WebGLProgram","WebGLRenderbuffer","WebGLShader","WebGLShaderPrecisionFormat","WebGLTexture","WebGLUniformLocation","WebGLVertexArrayObject","WebGLVertexArrayObjectOES"].filter(o=>typeof t[o]=="function").find(o=>e instanceof t[o]);function oW(e,t,n,r,o){let i=[],a=Object.getOwnPropertyNames(t.CanvasRenderingContext2D.prototype);for(let s of a)try{if(typeof t.CanvasRenderingContext2D.prototype[s]!="function")continue;let l=CT(t.CanvasRenderingContext2D.prototype,s,function(c){return function(...d){return Dy(this.canvas,n,r,o,!0)||PM(()=>{let u=zM(d,t,this);e(this.canvas,{type:sd["2D"],property:s,args:u})},0),c.apply(this,d)}});i.push(l)}catch{let l=RT(t.CanvasRenderingContext2D.prototype,s,{set(c){e(this.canvas,{type:sd["2D"],property:s,args:[c],setter:!0})}});i.push(l)}return()=>{i.forEach(s=>s())}}function iW(e){return e==="experimental-webgl"?"webgl":e}function MM(e,t,n,r,o){let i=[];try{let a=CT(e.HTMLCanvasElement.prototype,"getContext",function(s){return function(l,...c){if(!Dy(this,t,n,r,!0)){let d=iW(l);if("__context"in this||(this.__context=d),o&&["webgl","webgl2"].includes(d))if(c[0]&&typeof c[0]=="object"){let u=c[0];u.preserveDrawingBuffer||(u.preserveDrawingBuffer=!0)}else c.splice(0,1,{preserveDrawingBuffer:!0})}return s.apply(this,[l,...c])}});i.push(a)}catch{console.error("failed to patch HTMLCanvasElement.prototype.getContext")}return()=>{i.forEach(a=>a())}}function OM(e,t,n,r,o,i,a,s){let l=[],c=Object.getOwnPropertyNames(e);for(let d of c)if(!["isContextLost","canvas","drawingBufferWidth","drawingBufferHeight"].includes(d))try{if(typeof e[d]!="function")continue;let u=CT(e,d,function(m){return function(...p){let g=m.apply(this,p);if(BM(g,s,this),"tagName"in this.canvas&&!Dy(this.canvas,r,o,i,!0)){let _=zM(p,s,this),y={type:t,property:d,args:_};n(this.canvas,y)}return g}});l.push(u)}catch{let u=RT(e,d,{set(m){n(this.canvas,{type:t,property:d,args:[m],setter:!0})}});l.push(u)}return l}function aW(e,t,n,r,o,i){let a=[];return a.push(...OM(t.WebGLRenderingContext.prototype,sd.WebGL,e,n,r,o,i,t)),typeof t.WebGL2RenderingContext<"u"&&a.push(...OM(t.WebGL2RenderingContext.prototype,sd.WebGL2,e,n,r,o,i,t)),()=>{a.forEach(s=>s())}}var sW='for(var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",t="undefined"==typeof Uint8Array?[]:new Uint8Array(256),a=0;a<64;a++)t[e.charCodeAt(a)]=a;var n=function(t){var a,n=new Uint8Array(t),r=n.length,s="";for(a=0;a<r;a+=3)s+=e[n[a]>>2],s+=e[(3&n[a])<<4|n[a+1]>>4],s+=e[(15&n[a+1])<<2|n[a+2]>>6],s+=e[63&n[a+2]];return r%3==2?s=s.substring(0,s.length-1)+"=":r%3==1&&(s=s.substring(0,s.length-2)+"=="),s};const r=new Map,s=new Map;const i=self;i.onmessage=async function(e){if(!("OffscreenCanvas"in globalThis))return i.postMessage({id:e.data.id});{const{id:t,bitmap:a,width:o,height:f,maxCanvasSize:c,dataURLOptions:g}=e.data,u=async function(e,t,a){const r=e+"-"+t;if("OffscreenCanvas"in globalThis){if(s.has(r))return s.get(r);const i=new OffscreenCanvas(e,t);i.getContext("2d");const o=await i.convertToBlob(a),f=await o.arrayBuffer(),c=n(f);return s.set(r,c),c}return""}(o,f,g),[h,d]=function(e,t,a){if(!a)return[e,t];const[n,r]=a;if(e<=n&&t<=r)return[e,t];let s=e,i=t;return s>n&&(i=Math.floor(n*t/e),s=n),i>r&&(s=Math.floor(r*e/t),i=r),[s,i]}(o,f,c),l=new OffscreenCanvas(h,d),w=l.getContext("bitmaprenderer"),p=h===o&&d===f?a:await createImageBitmap(a,{resizeWidth:h,resizeHeight:d,resizeQuality:"low"});w?.transferFromImageBitmap(p),a.close();const y=await l.convertToBlob(g),v=y.type,b=await y.arrayBuffer(),m=n(b);if(p.close(),!r.has(t)&&await u===m)return r.set(t,m),i.postMessage({id:t});if(r.get(t)===m)return i.postMessage({id:t});i.postMessage({id:t,type:v,base64:m,width:o,height:f}),r.set(t,m)}};';function lW(){let e=new Blob([sW]);return URL.createObjectURL(e)}var NT=class{constructor(t){this.pendingCanvasMutations=new Map,this.rafStamps={latestId:0,invokeId:null},this.shadowDoms=new Set,this.windowsSet=new WeakSet,this.windows=[],this.restoreHandlers=[],this.frozen=!1,this.locked=!1,this.snapshotInProgressMap=new Map,this.worker=null,this.lastSnapshotTime=0,this.processMutation=(s,l)=>{(this.rafStamps.invokeId&&this.rafStamps.latestId!==this.rafStamps.invokeId||!this.rafStamps.invokeId)&&(this.rafStamps.invokeId=this.rafStamps.latestId),this.pendingCanvasMutations.has(s)||this.pendingCanvasMutations.set(s,[]),this.pendingCanvasMutations.get(s).push(l)};let{enableManualSnapshot:n,sampling:r="all",win:o,recordCanvas:i,errorHandler:a}=t;t.sampling=r,this.mutationCb=t.mutationCb,this.mirror=t.mirror,this.options=t,a&&eW(a),(i&&typeof r=="number"||n)&&(this.worker=this.initFPSWorker()),this.addWindow(o),!n&&kT(()=>{i&&r==="all"&&(this.startRAFTimestamping(),this.startPendingCanvasMutationFlusher()),i&&typeof r=="number"&&this.initCanvasFPSObserver()})()}reset(){this.pendingCanvasMutations.clear(),this.restoreHandlers.forEach(t=>{try{t()}catch{}}),this.restoreHandlers=[],this.windowsSet=new WeakSet,this.windows=[],this.shadowDoms=new Set,this.worker?.terminate(),this.worker=null,this.snapshotInProgressMap=new Map}freeze(){this.frozen=!0}unfreeze(){this.frozen=!1}lock(){this.locked=!0}unlock(){this.locked=!1}addWindow(t){let{sampling:n="all",blockClass:r,blockSelector:o,unblockSelector:i,recordCanvas:a,enableManualSnapshot:s}=this.options;if(!this.windowsSet.has(t)){if(s){this.windowsSet.add(t),this.windows.push(new WeakRef(t));return}kT(()=>{if(a&&n==="all"&&this.initCanvasMutationObserver(t,r,o,i),a&&typeof n=="number"){let l=MM(t,r,o,i,!0);this.restoreHandlers.push(()=>{l()})}})(),this.windowsSet.add(t),this.windows.push(new WeakRef(t))}}addShadowRoot(t){this.shadowDoms.add(new WeakRef(t))}resetShadowRoots(){this.shadowDoms=new Set}snapshot(t,n){if(n?.skipRequestAnimationFrame){this.takeSnapshot(performance.now(),!0,t);return}ql(r=>this.takeSnapshot(r,!0,t))}initFPSWorker(){let t=new Worker(lW());return t.onmessage=n=>{let r=n.data,{id:o}=r;if(this.snapshotInProgressMap.set(o,!1),!("base64"in r))return;let{base64:i,type:a,width:s,height:l}=r;this.mutationCb({id:o,type:sd["2D"],commands:[{property:"clearRect",args:[0,0,s,l]},{property:"drawImage",args:[{rr_type:"ImageBitmap",args:[{rr_type:"Blob",data:[{rr_type:"ArrayBuffer",base64:i}],type:a}]},0,0,s,l]}]})},t}initCanvasFPSObserver(){let t;if(!this.windows.length&&!this.shadowDoms.size)return;let n=r=>{this.takeSnapshot(r,!1),t=ql(n)};t=ql(n),this.restoreHandlers.push(()=>{t&&cancelAnimationFrame(t)})}initCanvasMutationObserver(t,n,r,o){let i=MM(t,n,r,o,!1),a=oW(this.processMutation.bind(this),t,n,r,o),s=aW(this.processMutation.bind(this),t,n,r,o,this.mirror);this.restoreHandlers.push(()=>{i(),a(),s()})}getCanvasElements(t,n,r){let o=[],i=a=>{a.querySelectorAll("canvas").forEach(s=>{Dy(s,t,n,r,!0)||o.push(s)})};for(let a of this.windows){let s=a.deref(),l;try{l=s&&s.document}catch{}l&&i(l)}for(let a of this.shadowDoms){let s=a.deref();s&&i(s)}return o}takeSnapshot(t,n,r){let{sampling:o,blockClass:i,blockSelector:a,unblockSelector:s,dataURLOptions:l,maxCanvasSize:c}=this.options,u=1e3/(o==="all"?2:o||2);return this.lastSnapshotTime&&t-this.lastSnapshotTime<u?!1:(this.lastSnapshotTime=t,(r?[r]:this.getCanvasElements(i,a,s)).forEach(g=>{let _=this.mirror.getId(g);if(!(!this.mirror.hasNode(g)||!g.width||!g.height||this.snapshotInProgressMap.get(_))){if(this.snapshotInProgressMap.set(_,!0),!n&&["webgl","webgl2"].includes(g.__context)){let y=g.getContext(g.__context);y?.getContextAttributes()?.preserveDrawingBuffer===!1&&y.clear(y.COLOR_BUFFER_BIT)}createImageBitmap(g).then(y=>{this.worker?.postMessage({id:_,bitmap:y,width:g.width,height:g.height,dataURLOptions:l,maxCanvasSize:c},[y])}).catch(y=>{kT(()=>{throw this.snapshotInProgressMap.delete(_),y})()})}}),!0)}startPendingCanvasMutationFlusher(){ql(()=>this.flushPendingCanvasMutations())}startRAFTimestamping(){let t=n=>{this.rafStamps.latestId=n,ql(t)};ql(t)}flushPendingCanvasMutations(){this.pendingCanvasMutations.forEach((t,n)=>{let r=this.mirror.getId(n);this.flushPendingCanvasMutationFor(n,r)}),ql(()=>this.flushPendingCanvasMutations())}flushPendingCanvasMutationFor(t,n){if(this.frozen||this.locked)return;let r=this.pendingCanvasMutations.get(t);if(!r||n===-1)return;let o=r.map(a=>{let{type:s,...l}=a;return l}),{type:i}=r[0];this.mutationCb({id:n,type:i,commands:o}),this.pendingCanvasMutations.delete(t)}};try{if(Array.from([1],e=>e*2)[0]!==2){let e=document.createElement("iframe");document.body.appendChild(e),Array.from=e.contentWindow?.Array.from||Array.from,document.body.removeChild(e)}}catch(e){console.debug("Unable to override Array.from",e)}JV();var DM;(function(e){e[e.NotStarted=0]="NotStarted",e[e.Running=1]="Running",e[e.Stopped=2]="Stopped"})(DM||(DM={}));var LM={low:{sampling:{canvas:1},dataURLOptions:{type:"image/webp",quality:.25}},medium:{sampling:{canvas:2},dataURLOptions:{type:"image/webp",quality:.4}},high:{sampling:{canvas:4},dataURLOptions:{type:"image/webp",quality:.5}}},cW="ReplayCanvas",Cy=1280,uW=((e={})=>{let[t,n]=e.maxCanvasSize||[],r={quality:e.quality||"medium",enableManualSnapshot:e.enableManualSnapshot,maxCanvasSize:[t?Math.min(t,Cy):Cy,n?Math.min(n,Cy):Cy]},o,i,a=new Promise(s=>i=s);return{name:cW,getOptions(){let{quality:s,enableManualSnapshot:l,maxCanvasSize:c}=r;return{enableManualSnapshot:l,recordCanvas:!0,getCanvasManager:d=>{let u=new NT({...d,enableManualSnapshot:l,maxCanvasSize:c,errorHandler:m=>{try{typeof m=="object"&&(m.__rrweb__=!0)}catch{}}});return o=u,i(u),u},...LM[s]||LM.medium}},async snapshot(s,l){(o||await a).snapshot(s,l)}}}),HM=uW;function GM(e){return e.split(",").some(t=>t.trim().startsWith("sentry-"))}function MT(e){try{return new URL(e,J.location.origin).href}catch{return}}function $M(e){return e.entryType==="resource"&&"initiatorType"in e&&typeof e.nextHopProtocol=="string"&&(e.initiatorType==="fetch"||e.initiatorType==="xmlhttprequest")}function OT(e){try{return new Headers(e)}catch{return}}var Gp={traceFetch:!0,traceXHR:!0,enableHTTPTimings:!0,trackFetchStreamPerformance:!1};function Ly(e,t){let{traceFetch:n,traceXHR:r,shouldCreateSpanForRequest:o,enableHTTPTimings:i,tracePropagationTargets:a,onRequestSpanStart:s,onRequestSpanEnd:l}={...Gp,...t},c=typeof o=="function"?o:p=>!0,d=p=>fW(p,a),u={},m=e.getOptions().propagateTraceparent;n&&ki(p=>{let g=_S(p,c,d,u,{propagateTraceparent:m,onRequestSpanEnd:l});if(g){let _=MT(p.fetchData.url),y=_?fo(_).host:void 0,h=_?er(_):void 0;g.setAttributes({"http.url":h,"url.full":h,"server.address":y}),i&&jM(g,e),s?.(g,{headers:p.headers})}}),r&&Gl(p=>{let g=pW(p,c,d,u,m,l);g&&(i&&jM(g,e),s?.(g,{headers:OT(p.xhr.__sentry_xhr_v3__?.request_headers)}))})}var dW=300;function jM(e,t){let{url:n}=ie(e).data;if(!n||typeof n!="string")return;let r=()=>void setTimeout(o);if(tn(t)){let i=e.end.bind(e);e.end=a=>{let s=a??Ue(),l=!1,c=()=>{l||(l=!0,setTimeout(o),i(s),clearTimeout(d))};r=c;let d=setTimeout(c,dW)}}let o=xr("resource",({entries:i})=>{i.forEach(a=>{$M(a)&&a.name.endsWith(n)&&(e.setAttributes(Sp(a)),r())})})}function fW(e,t){let n=nr();if(n){let r,o;try{r=new URL(e,n),o=new URL(n).origin}catch{return!1}let i=r.origin===o;return t?fn(r.toString(),t)||i&&fn(r.pathname,t):i}else{let r=!!e.match(/^\/(?!\/)/);return t?fn(e,t):r}}function pW(e,t,n,r,o,i){let a=e.xhr,s=a?.[sr];if(!a||a.__sentry_own_request__||!s)return;let{url:l,method:c}=s,d=Gt()&&t(l);if(e.endTimestamp){let T=a.__sentry_xhr_span_id__;if(!T)return;let x=r[T];x&&(d&&s.status_code!==void 0&&(pi(x,s.status_code),x.end(),i?.(x,{headers:OT(wp(a)),error:e.error})),delete r[T]);return}let u=MT(l),m=u?fo(u):fo(l),p=u?er(u):void 0,g=er(pu(l)),_=q(),h=!!Be()||!!_&&tn(_),v=d&&h?Dt({name:`${c} ${g}`,attributes:{url:er(l),type:"xhr","http.method":c,"http.url":p,"url.full":p,"server.address":m?.host,[le]:"auto.http.browser",[_e]:"http.client",...m?.search&&{"http.query":m?.search},...m?.hash&&{"http.fragment":m?.hash}}}):new _r;return d&&!h&&_?.recordDroppedEvent("no_parent_span","span"),a.__sentry_xhr_span_id__=v.spanContext().spanId,r[a.__sentry_xhr_span_id__]=v,n(l)&&mW(a,Gt()&&h?v:void 0,o),_&&_.emit("beforeOutgoingRequestSpan",v,e),v}function mW(e,t,n){let{"sentry-trace":r,baggage:o,traceparent:i}=wl({span:t,propagateTraceparent:n});r&&gW(e,r,o,i)}function gW(e,t,n,r){let o=e.__sentry_xhr_v3__?.request_headers;if(!(o?.["sentry-trace"]||!e.setRequestHeader))try{if(e.setRequestHeader("sentry-trace",t),r&&!o?.traceparent&&e.setRequestHeader("traceparent",r),n){let i=o?.baggage;(!i||!GM(i))&&e.setRequestHeader("baggage",n)}}catch{}}var qM=new WeakMap,VM=new WeakMap,hW=9e4,bW=["text/event-stream","application/x-ndjson","application/stream+json"],Uy=()=>({name:"FetchStreamPerformance",setup(){gb(e=>{if(e.response){let t=qM.get(e.response);if(t&&e.endTimestamp){t.end(e.endTimestamp);let n=VM.get(e.response);n&&clearTimeout(n)}}}),ki(e=>{if(e.endTimestamp&&e.response){let t=e.response.headers?.get("content-type")||"";if(e.response.headers?.get("content-length")||!bW.some(l=>t.startsWith(l)))return;let n=e.fetchData?.url||"",r=e.fetchData?.method||"GET",o=vi(n),i=n.startsWith("data:")?er(n):o?fu(o):n,a=Dt({name:`${r} ${i}`,startTime:e.endTimestamp,attributes:{url:er(n),"http.method":r,type:"fetch",[_e]:"http.client.stream",[le]:"auto.http.browser.stream"}});qM.set(e.response,a);let s=setTimeout(()=>{a.isRecording()&&a.end()},hW);VM.set(e.response,s)}})}});var DT="WebVitals",Py=(e={})=>{let t=new Set(e.ignore??[]);return{name:DT,setup(n){let r=tn(n),{enableStandaloneClsSpans:o,enableStandaloneLcpSpans:i}=e._experiments??{},a=r||t.has("cls")?void 0:o||!1,s=r||t.has("lcp")?void 0:i||!1,l=dE({recordClsStandaloneSpans:a,recordLcpStandaloneSpans:s,client:n}),c=new WeakSet;n.on("afterStartPageLoadSpan",d=>{c.add(d)}),n.on("spanEnd",d=>{c.delete(d)&&(l(),hE(d,{recordClsOnPageloadSpan:a===!1,recordLcpOnPageloadSpan:s===!1,spanStreamingEnabled:r}))}),r?(t.has("lcp")||TE(n),t.has("cls")||wE(n),t.has("inp")||xE()):t.has("inp")||vE()},afterAllSetup(){t.has("inp")||SE()}}};function WM(){J.document?J.document.addEventListener("visibilitychange",()=>{let e=Be();if(!e)return;let t=Fe(e);if(J.document.hidden&&t){let n="cancelled",{op:r,status:o}=ie(t);Q&&A.log(`[Tracing] Transaction: ${n} -> since tab moved to the background, op: ${r}`),o||t.setStatus({code:2,message:n}),t.setAttribute("sentry.cancellation_reason","document.hidden"),t.end()}}):Q&&A.warn("[Tracing] Could not set up background tab detection due to lack of global document")}var yW=3600,YM="sentry_previous_trace",_W="sentry.previous_trace";function KM(e,{linkPreviousTrace:t,consistentTraceSampling:n}){let r=t==="session-storage",o=r?EW():void 0;e.on("spanStart",a=>{if(Fe(a)!==a)return;let s=ae().getPropagationContext();o=vW(o,a,s),r&&SW(o)});let i=!0;n&&e.on("beforeSampling",a=>{if(!o)return;let s=ae(),l=s.getPropagationContext();if(i&&l.parentSpanId){i=!1;return}s.setPropagationContext({...l,dsc:{...l.dsc,sample_rate:String(o.sampleRate),sampled:String(LT(o.spanContext))},sampleRand:o.sampleRand}),a.parentSampled=LT(o.spanContext),a.parentSampleRate=o.sampleRate,a.spanAttributes={...a.spanAttributes,[Yc]:o.sampleRate}})}function vW(e,t,n){let r=ie(t);function o(){try{let s=Number(r.data?.[fi]??n.dsc?.sample_rate);return Number.isNaN(s)?0:s}catch{return 0}}let i={spanContext:t.spanContext(),startTimestamp:r.start_timestamp,sampleRate:o(),sampleRand:n.sampleRand};if(!e)return i;let a=e.spanContext;return a.traceId===r.trace_id?e:(Date.now()/1e3-e.startTimestamp<=yW&&(Q&&A.log(`Adding previous_trace \`${JSON.stringify(a)}\` link to span \`${JSON.stringify({op:r.op,...t.spanContext()})}\``),t.addLink({context:a,attributes:{[th]:"previous_trace"}}),t.setAttribute(_W,`${a.traceId}-${a.spanId}-${LT(a)?1:0}`)),i)}function SW(e){try{J.sessionStorage.setItem(YM,JSON.stringify(e))}catch(t){Q&&A.warn("Could not store previous trace in sessionStorage",t)}}function EW(){try{let e=J.sessionStorage?.getItem(YM);return JSON.parse(e)}catch{return}}function LT(e){return e.traceFlags===1}var TW="BrowserTracing",wW=/Googlebot|Google-InspectionTool|Storebot-Google|Bingbot|Slurp|DuckDuckBot|Baiduspider|YandexBot|Facebot|facebookexternalhit|LinkedInBot|Twitterbot|Applebot/i;function UT(){let e=J.navigator;return e?.userAgent?wW.test(e.userAgent):!1}var xW={...nu,instrumentNavigation:!0,instrumentPageLoad:!0,markBackgroundSpan:!0,enableLongTask:!0,enableLongAnimationFrame:!0,enableInp:!0,ignoreResourceSpans:[],ignorePerformanceApiSpans:[],detectRedirects:!0,linkPreviousTrace:"in-memory",consistentTraceSampling:!1,enableReportPageLoaded:!1,_experiments:{},...Gp},Vr=((e={})=>{"enableElementTiming"in e&&Sn(()=>{console.warn("[Sentry] `enableElementTiming` is deprecated and no longer has any effect. Use the standalone `elementTimingIntegration` instead.")});let t={name:void 0,source:void 0},n=J.document,{enableInp:r,enableLongTask:o,enableLongAnimationFrame:i,_experiments:{enableInteractions:a,enableStandaloneClsSpans:s,enableStandaloneLcpSpans:l},beforeStartSpan:c,idleTimeout:d,finalTimeout:u,childSpanTimeout:m,markBackgroundSpan:p,traceFetch:g,traceXHR:_,trackFetchStreamPerformance:y,shouldCreateSpanForRequest:h,enableHTTPTimings:v,ignoreResourceSpans:T,ignorePerformanceApiSpans:x,instrumentPageLoad:N,instrumentNavigation:M,detectRedirects:k,linkPreviousTrace:P,consistentTraceSampling:F,enableReportPageLoaded:U,onRequestSpanStart:X,onRequestSpanEnd:G}={...xW,...e},R=UT(),C,$;function ee(B,H,se=!0){let te=H.op==="pageload",ve=H.name,pe=c?c(H):H,Ge=pe.attributes||{};if(ve!==pe.name&&(Ge[Pe]="custom",pe.attributes=Ge),!se){let Kt=hr();Dt({...pe,startTime:Kt}).end(Kt);return}t.name=pe.name,t.source=Ge[Pe];let re=_h(pe,{idleTimeout:d,finalTimeout:u,childSpanTimeout:m,disableAutoFinish:te,beforeSpanEnd:Kt=>{gE(Kt,{ignoreResourceSpans:T,ignorePerformanceApiSpans:x,spanStreamingEnabled:tn(B)}),QM(B,void 0);let it=ae(),Z=it.getPropagationContext();it.setPropagationContext({...Z,traceId:re.spanContext().traceId,sampled:Cn(re),dsc:en(Kt)}),te&&($=void 0)},trimIdleSpanEndTimestamp:!U});te&&U&&($=re),QM(B,re);function Je(){n&&["interactive","complete"].includes(n.readyState)&&(B.emit("idleSpanEnableAutoFinish",re),n.removeEventListener("readystatechange",Je))}te&&!U&&n&&(n.addEventListener("readystatechange",Je),Je())}return{name:TW,setup(B){if(R){Q&&A.log("[Tracing] Skipping browserTracingIntegration setup for bot user agent.");return}if(Hf(),i&&ne.PerformanceObserver&&PerformanceObserver.supportedEntryTypes?.includes("long-animation-frame")?pE():o&&fE(),a&&mE(),k&&n){let se=()=>{C=Ue()};addEventListener("click",se,{capture:!0}),addEventListener("keydown",se,{capture:!0,passive:!0})}function H(){let se=$p(B);se&&!ie(se).timestamp&&(Q&&A.log(`[Tracing] Finishing current active span with op: ${ie(se).op}`),se.setAttribute(Yi,"cancelled"),se.end())}B.on("startNavigationSpan",(se,te)=>{if(q()!==B)return;if(te?.isRedirect){Q&&A.warn("[Tracing] Detected redirect, navigation span will not be the root span, but a child span."),ee(B,{op:"navigation.redirect",...se},!1);return}C=void 0,H(),je().setPropagationContext({traceId:zn(),sampleRand:Math.random(),propagationSpanId:Gt()?void 0:Kn()});let ve=ae();ve.setPropagationContext({traceId:zn(),sampleRand:Math.random(),propagationSpanId:Gt()?void 0:Kn()}),ve.setSDKProcessingMetadata({normalizedRequest:void 0}),ee(B,{op:"navigation",...se,parentSpan:null,forceTransaction:!0})}),B.on("startPageLoadSpan",(se,te={})=>{if(q()!==B)return;H();let ve=te.sentryTrace||XM("sentry-trace")||JM("sentry-trace"),pe=te.baggage||XM("baggage")||JM("baggage"),Ge=Df(ve,pe),re=ae();re.setPropagationContext(Ge),Gt()||(re.getPropagationContext().propagationSpanId=Kn()),re.setSDKProcessingMetadata({normalizedRequest:Du()}),ee(B,{op:"pageload",...se})}),B.on("endPageloadSpan",()=>{U&&$&&($.setAttribute(Yi,"reportPageLoaded"),$.end())})},afterAllSetup(B){if(R)return;B.addIntegration&&!B.getIntegrationByName?.(DT)&&B.addIntegration(Py({ignore:r?[]:["inp"],_experiments:{enableStandaloneClsSpans:s,enableStandaloneLcpSpans:l}}));let H=nr();if(P!=="off"&&KM(B,{linkPreviousTrace:P,consistentTraceSampling:F}),J.location){if(N){let se=ut();ri(B,{name:J.location.pathname,startTime:se?se/1e3:void 0,attributes:{[Pe]:"url",[le]:"auto.pageload.browser"}})}M&&sa(({to:se,from:te})=>{if(te===void 0&&H?.indexOf(se)!==-1){H=void 0;return}H=void 0;let ve=vi(se),pe=$p(B),Ge=pe&&k&&AW(pe,C);oi(B,{name:ve?.pathname||J.location.pathname,attributes:{[Pe]:"url",[le]:"auto.navigation.browser"}},{url:se,isRedirect:Ge})})}p&&WM(),a&&kW(B,d,u,m,t),Ly(B,{traceFetch:g,traceXHR:_,tracePropagationTargets:B.getOptions().tracePropagationTargets,shouldCreateSpanForRequest:h,enableHTTPTimings:v,onRequestSpanStart:X,onRequestSpanEnd:G}),y&&B.addIntegration(Uy())}}});function ri(e,t,n){e.emit("startPageLoadSpan",t,n),ae().setTransactionName(t.name);let r=$p(e);return r&&e.emit("afterStartPageLoadSpan",r),r}function oi(e,t,n){let{url:r,isRedirect:o}=n||{};e.emit("beforeStartNavigationSpan",t,{isRedirect:o}),e.emit("startNavigationSpan",t,{isRedirect:o});let i=ae();return i.setTransactionName(t.name),r&&!o&&i.setSDKProcessingMetadata({normalizedRequest:{...Du(),url:r}}),$p(e)}function XM(e){return J.document?.querySelector(`meta[name=${e}]`)?.getAttribute("content")||void 0}function JM(e){return J.performance?.getEntriesByType?.("navigation")[0]?.serverTiming?.find(r=>r.name===e)?.description}function kW(e,t,n,r,o){let i=J.document,a,s=()=>{let l="ui.action.click",c=$p(e);if(c){let d=ie(c).op;if(["navigation","pageload"].includes(d)){Q&&A.warn(`[Tracing] Did not create ${l} span because a pageload or navigation span is in progress.`);return}}if(a&&(a.setAttribute(Yi,"interactionInterrupted"),a.end(),a=void 0),!o.name){Q&&A.warn(`[Tracing] Did not create ${l} transaction because _latestRouteName is missing.`);return}a=_h({name:o.name,op:l,attributes:{[Pe]:o.source||"url"}},{idleTimeout:t,finalTimeout:n,childSpanTimeout:r})};i&&addEventListener("click",s,{capture:!0})}var eO="_sentry_idleSpan";function $p(e){return e[eO]}function QM(e,t){Ye(e,eO,t)}var ZM=1.5;function AW(e,t){let n=ie(e),r=hr(),o=n.start_timestamp;return!(r-o>ZM||t&&r-t<=ZM)}function tO(e=q()){e?.emit("endPageloadSpan")}function nO(e){let t=Be();if(t===e)return;let n=ae();e.end=new Proxy(e.end,{apply(r,o,i){return ar(n,t),Reflect.apply(r,o,i)}}),ar(n,e)}var rO=()=>({name:"SpanStreaming",beforeSetup(e){let t=e.getOptions();t.traceLifecycle||(Q&&A.log('[SpanStreaming] setting `traceLifecycle` to "stream"'),t.traceLifecycle="stream")},setup(e){let t="SpanStreaming integration requires",n="Falling back to static trace lifecycle.",r=e.getOptions();if(!tn(e)){r.traceLifecycle="static",Q&&A.warn(`${t} \`traceLifecycle\` to be set to "stream"! ${n}`);return}let o=r.beforeSendSpan;if(o&&!Ji(o)){r.traceLifecycle="static",Q&&A.warn(`${t} a beforeSendSpan callback using \`withStreamedSpan\`! ${n}`);return}let i=new mp(e);e.on("afterSpanEnd",a=>{Cn(a)&&i.add(Sh(a,e))}),e.on("afterSegmentSpanEnd",a=>{let s=a.spanContext().traceId;setTimeout(()=>{i.flush(s)},500)})}});function ld(e){return new Promise((t,n)=>{e.oncomplete=e.onsuccess=()=>t(e.result),e.onabort=e.onerror=()=>n(e.error)})}function IW(e,t){let n=indexedDB.open(e);n.onupgradeneeded=()=>n.result.createObjectStore(t);let r=ld(n);return o=>r.then(i=>o(i.transaction(t,"readwrite").objectStore(t)))}function PT(e){return ld(e.getAllKeys())}function NW(e,t,n){return e(r=>PT(r).then(o=>{if(!(o.length>=n))return r.put(t,Math.max(...o,0)+1),ld(r.transaction)}))}function RW(e,t,n){return e(r=>PT(r).then(o=>{if(!(o.length>=n))return r.put(t,Math.min(...o,0)-1),ld(r.transaction)}))}function CW(e){return e(t=>PT(t).then(n=>{let r=n[0];if(r!=null)return ld(t.get(r)).then(o=>(t.delete(r),ld(t.transaction).then(()=>o)))}))}function MW(e){let t;function n(){return t==null&&(t=IW(e.dbName||"sentry-offline",e.storeName||"queue")),t}return{push:async r=>{try{let o=Qi(r);await NW(n(),o,e.maxQueueSize||30)}catch{}},unshift:async r=>{try{let o=Qi(r);await RW(n(),o,e.maxQueueSize||30)}catch{}},shift:async()=>{try{let r=await CW(n());if(r)return gh(r)}catch{}}}}function OW(e){return t=>{let n=e({...t,createStore:MW});return J.addEventListener("online",async r=>{await n.flush()}),n}}function oO(e=Vu){return OW(tS(e))}var iO=1e6,DW="window"in ne&&ne.window===ne&&typeof importScripts>"u",Wl=String(0),zT=DW?"main":"worker",By=J.navigator,sO="",lO="",cO="",BT=By?.userAgent||"",uO="",LW=By?.language||By?.languages?.[0]||"";function UW(e){return typeof e=="object"&&e!==null&&"getHighEntropyValues"in e}var aO=By?.userAgentData;UW(aO)&&aO.getHighEntropyValues(["architecture","model","platform","platformVersion","fullVersionList"]).then(e=>{if(sO=e.platform||"",cO=e.architecture||"",uO=e.model||"",lO=e.platformVersion||"",e.fullVersionList?.length){let t=e.fullVersionList[e.fullVersionList.length-1];BT=`${t.brand} ${t.version}`}}).catch(e=>{});function PW(e){return!("thread_metadata"in e)}function BW(e){return PW(e)?GW(e):e}function zW(e){let t=e.contexts?.trace?.trace_id;return typeof t=="string"&&t.length!==32&&Q&&A.log(`[Profiling] Invalid traceId: ${t} on profiled event`),typeof t!="string"?"":t}function FW(e,t,n,r){if(r.type!=="transaction")throw new TypeError("Profiling events may only be attached to transactions, this should never occur.");if(n==null)throw new TypeError(`Cannot construct profiling event envelope without a valid profile. Got ${n} instead.`);let o=zW(r),i=BW(n),a=t||(typeof r.start_timestamp=="number"?r.start_timestamp*1e3:Ue()*1e3),s=typeof r.timestamp=="number"?r.timestamp*1e3:Ue()*1e3;return{event_id:e,timestamp:new Date(a).toISOString(),platform:"javascript",version:"1",release:r.release||"",environment:r.environment||Ko,runtime:{name:"javascript",version:J.navigator.userAgent},os:{name:sO,version:lO,build_number:BT},device:{locale:LW,model:uO,manufacturer:BT,architecture:cO,is_emulator:!1},debug_meta:{images:gO(n.resources)},profile:i,transactions:[{name:r.transaction||"",id:r.event_id||ft(),trace_id:o,active_thread_id:Wl,relative_start_ns:"0",relative_end_ns:((s-a)*1e6).toFixed(0)}]}}function dO(e,t,n){if(e==null)throw new TypeError(`Cannot construct profiling event envelope without a valid profile. Got ${e} instead.`);let r=HW(e),o=t.getOptions(),i=t.getSdkMetadata?.()?.sdk;return{chunk_id:ft(),client_sdk:{name:i?.name??"sentry.javascript.browser",version:i?.version??"0.0.0"},profiler_id:n||ft(),platform:"javascript",version:"2",release:o.release??"",environment:o.environment??"production",debug_meta:{images:gO(e.resources)},profile:r}}function fO(e){try{if(!e||typeof e!="object")return{reason:"chunk is not an object"};let t=r=>typeof r=="string"&&/^[a-f0-9]{32}$/.test(r);if(!t(e.profiler_id))return{reason:"missing or invalid profiler_id"};if(!t(e.chunk_id))return{reason:"missing or invalid chunk_id"};if(!e.client_sdk)return{reason:"missing client_sdk metadata"};let n=e.profile;return n?!Array.isArray(n.frames)||!n.frames.length?{reason:"profile has no frames"}:!Array.isArray(n.stacks)||!n.stacks.length?{reason:"profile has no stacks"}:!Array.isArray(n.samples)||!n.samples.length?{reason:"profile has no samples"}:{valid:!0}:{reason:"missing profile data"}}catch(t){return{reason:`unknown validation error: ${t}`}}}function HW(e){let t=[];for(let s=0;s<e.frames.length;s++){let l=e.frames[s];l&&(t[s]={function:l.name,abs_path:typeof l.resourceId=="number"?e.resources[l.resourceId]:void 0,lineno:l.line,colno:l.column})}let n=[];for(let s=0;s<e.stacks.length;s++){let l=e.stacks[s];if(!l)continue;let c=[],d=l;for(;d;)c.push(d.frameId),d=d.parentId===void 0?void 0:e.stacks[d.parentId];n[s]=c}let r=ut(),o=typeof performance.timeOrigin=="number"?performance.timeOrigin:r||0,i=o-(r||o),a=[];for(let s=0;s<e.samples.length;s++){let l=e.samples[s];if(!l)continue;let c=(o+(l.timestamp-i))/1e3;a[s]={stack_id:l.stackId??0,thread_id:Wl,timestamp:c}}return{frames:t,stacks:n,samples:a,thread_metadata:{[Wl]:{name:zT}}}}function zy(e){return ie(e).op==="pageload"}function GW(e){let t,n=0,r={samples:[],stacks:[],frames:[],thread_metadata:{[Wl]:{name:zT}}},o=e.samples[0];if(!o)return r;let i=o.timestamp,a=ut(),s=typeof performance.timeOrigin=="number"?performance.timeOrigin:a||0,l=s-(a||s);return e.samples.forEach((c,d)=>{if(c.stackId===void 0){t===void 0&&(t=n,r.stacks[t]=[],n++),r.samples[d]={elapsed_since_start_ns:((c.timestamp+l-i)*iO).toFixed(0),stack_id:t,thread_id:Wl};return}let u=e.stacks[c.stackId],m=[];for(;u;){m.push(u.frameId);let g=e.frames[u.frameId];g&&r.frames[u.frameId]===void 0&&(r.frames[u.frameId]={function:g.name,abs_path:typeof g.resourceId=="number"?e.resources[g.resourceId]:void 0,lineno:g.line,colno:g.column}),u=u.parentId===void 0?void 0:e.stacks[u.parentId]}let p={elapsed_since_start_ns:((c.timestamp+l-i)*iO).toFixed(0),stack_id:n,thread_id:Wl};r.stacks[n]=m,r.samples[d]=p,n++}),r}function pO(e,t){if(!t.length)return e;for(let n of t)e[1].push([{type:"profile"},n]);return e}function mO(e){let t=[];return vr(e,(n,r)=>{if(r==="transaction")for(let o=1;o<n.length;o++)n[o]?.contexts?.profile?.profile_id&&t.push(n[o])}),t}function gO(e){let r=q()?.getOptions()?.stackParser;return r?Uv(r,e):[]}function hO(e){return typeof e!="number"&&typeof e!="boolean"||typeof e=="number"&&isNaN(e)?(Q&&A.warn(`[Profiling] Invalid sample rate. Sample rate must be a boolean or a number between 0 and 1. Got ${JSON.stringify(e)} of type ${JSON.stringify(typeof e)}.`),!1):e===!0||e===!1?!0:e<0||e>1?(Q&&A.warn(`[Profiling] Invalid sample rate. Sample rate must be between 0 and 1. Got ${e}.`),!1):!0}function $W(e){return e.samples.length<2?(Q&&A.log("[Profiling] Discarding profile because it contains less than 2 samples"),!1):e.frames.length?!0:(Q&&A.log("[Profiling] Discarding profile because it contains no frames"),!1)}var FT=!1,HT=3e4;function jW(e){return typeof e=="function"}function Fy(){let e=J.Profiler;if(!jW(e)){Q&&A.log("[Profiling] Profiling is not supported by this browser, Profiler interface missing on window object.");return}let t=10,n=Math.floor(HT/t);try{return new e({sampleInterval:t,maxBufferSize:n})}catch{Q&&(A.log("[Profiling] Failed to initialize the Profiling constructor, this is likely due to a missing 'Document-Policy': 'js-profiling' header."),A.log("[Profiling] Disabling profiling for current user session.")),FT=!0}}function GT(e){if(FT)return Q&&A.log("[Profiling] Profiling has been disabled for the duration of the current user session."),!1;if(!e.isRecording())return Q&&A.log("[Profiling] Discarding profile because root span was not sampled."),!1;let n=q()?.getOptions();if(!n)return Q&&A.log("[Profiling] Profiling disabled, no options found."),!1;let r=n.profilesSampleRate;return hO(r)?r?(r===!0?!0:Math.random()<r)?!0:(Q&&A.log(`[Profiling] Discarding profile because it's not included in the random sample (sampling rate = ${Number(r)})`),!1):(Q&&A.log("[Profiling] Discarding profile because a negative sampling decision was inherited or profileSampleRate is set to 0"),!1):(Q&&A.warn("[Profiling] Discarding profile because of invalid sample rate."),!1)}function bO(e){if(FT)return Q&&A.log("[Profiling] Profiling has been disabled for the duration of the current user session as the JS Profiler could not be started."),!1;if(e.profileLifecycle!=="trace"&&e.profileLifecycle!=="manual")return Q&&A.warn("[Profiling] Session not sampled. Invalid `profileLifecycle` option."),!1;let t=e.profileSessionSampleRate;return hO(t)?t?Math.random()<=t:(Q&&A.log("[Profiling] Discarding profile because profileSessionSampleRate is not defined or set to 0"),!1):(Q&&A.warn("[Profiling] Discarding profile because of invalid profileSessionSampleRate."),!1)}function jp(e){return typeof e.profilesSampleRate<"u"}function yO(e,t,n,r){return $W(n)?FW(e,t,n,r):null}var Vl=new Map;function _O(){return Vl.size}function vO(e){let t=Vl.get(e);return t&&Vl.delete(e),t}function SO(e,t){if(Vl.set(e,t),Vl.size>30){let n=Vl.keys().next().value;n!==void 0&&Vl.delete(n)}}var Hy=new WeakSet;function Yl(e){e.setAttribute("thread.id",Wl),e.setAttribute("thread.name",zT)}function $T(e){let t;zy(e)&&(t=Ue()*1e3);let n=Fy();if(!n)return;Q&&A.log(`[Profiling] started profiling span: ${ie(e).description}`);let r=ft(),o=null;ae().setContext("profile",{profile_id:r,start_timestamp:t}),Hy.add(e),Yl(e);async function i(){if(e&&n){if(o){Q&&A.log("[Profiling] profile for:",ie(e).description,"already exists, returning early");return}return n.stop().then(c=>{if(a&&(J.clearTimeout(a),a=void 0),Q&&A.log(`[Profiling] stopped profiling of span: ${ie(e).description}`),!c){Q&&A.log(`[Profiling] profiler returned null profile for: ${ie(e).description}`,"this may indicate an overlapping span or a call to stopProfiling with a profile title that was never started");return}o=c,SO(r,c)}).catch(c=>{Q&&A.log("[Profiling] error while stopping profiler:",c)})}}let a=J.setTimeout(()=>{Q&&A.log("[Profiling] max profile duration elapsed, stopping profiling for:",ie(e).description),i()},HT),s=e.end.bind(e);function l(){return e?(i().then(()=>{s()},()=>{s()}),e):s()}e.end=l}var qW=6e4,VW=3e5,Gy=class{constructor(){this._client=void 0,this._profiler=void 0,this._chunkTimer=void 0,this._profilerId=void 0,this._isRunning=!1,this._sessionSampled=!1,this._lifecycleMode=void 0,this._activeRootSpanIds=new Set,this._rootSpanTimeouts=new Map}initialize(t){let n=t.getOptions().profileLifecycle,r=bO(t.getOptions());Q&&A.log(`[Profiling] Initializing profiler (lifecycle='${n}').`),r||Q&&A.log("[Profiling] Session not sampled. Skipping lifecycle profiler initialization."),this._profilerId=ft(),this._client=t,this._sessionSampled=r,this._lifecycleMode=n,n==="trace"&&this._setupTraceLifecycleListeners(t),t.on("spanStart",o=>{this._isRunning&&Yl(o)})}start(){if(this._lifecycleMode==="trace"){Q&&A.warn('[Profiling] `profileLifecycle` is set to "trace". Calls to `uiProfiler.start()` are ignored in trace mode.');return}if(this._isRunning){Q&&A.warn("[Profiling] Profile session is already running, `uiProfiler.start()` is a no-op.");return}if(!this._sessionSampled){Q&&A.warn("[Profiling] Session is not sampled, `uiProfiler.start()` is a no-op.");return}this._beginProfiling()}stop(){if(this._lifecycleMode==="trace"){Q&&A.warn('[Profiling] `profileLifecycle` is set to "trace". Calls to `uiProfiler.stop()` are ignored in trace mode.');return}if(!this._isRunning){Q&&A.warn("[Profiling] Profiler is not running, `uiProfiler.stop()` is a no-op.");return}this._endProfiling()}notifyRootSpanActive(t){if(this._lifecycleMode!=="trace"||!this._sessionSampled)return;let n=t.spanContext().spanId;if(!n||this._activeRootSpanIds.has(n))return;this._registerTraceRootSpan(n);let r=this._activeRootSpanIds.size;r===1&&(Q&&A.log("[Profiling] Detected already active root span during setup. Active root spans now:",r),this._beginProfiling()),this._isRunning&&Yl(t)}_beginProfiling(){if(!this._isRunning){if(this._isRunning=!0,Q&&A.log("[Profiling] Started profiling with profiler ID:",this._profilerId),br().setContext("profile",{profiler_id:this._profilerId}),this._startProfilerInstance(),!this._profiler){Q&&A.log("[Profiling] Failed to start JS Profiler; stopping."),this._resetProfilerInfo();return}this._startPeriodicChunking()}}_endProfiling(){this._isRunning&&(this._isRunning=!1,this._chunkTimer&&(clearTimeout(this._chunkTimer),this._chunkTimer=void 0),this._clearAllRootSpanTimeouts(),this._collectCurrentChunk().catch(t=>{Q&&A.error("[Profiling] Failed to collect current profile chunk on `stop()`:",t)}),this._lifecycleMode==="manual"&&br().setContext("profile",{}))}_setupTraceLifecycleListeners(t){t.on("spanStart",n=>{if(!this._sessionSampled){Q&&A.log("[Profiling] Span not profiled because of negative sampling decision for user session.");return}if(n!==Fe(n))return;if(!n.isRecording()){Q&&A.log("[Profiling] Discarding profile because root span was not sampled.");return}let r=n.spanContext().spanId;if(!r||this._activeRootSpanIds.has(r))return;this._registerTraceRootSpan(r);let o=this._activeRootSpanIds.size;o===1&&(Q&&A.log(`[Profiling] Root span ${r} started. Profiling active while there are active root spans (count=${o}).`),this._beginProfiling())}),t.on("spanEnd",n=>{if(!this._sessionSampled)return;let r=n.spanContext().spanId;if(!r||!this._activeRootSpanIds.has(r))return;this._activeRootSpanIds.delete(r);let o=this._activeRootSpanIds.size;Q&&A.log(`[Profiling] Root span with ID ${r} ended. Will continue profiling for as long as there are active root spans (currently: ${o}).`),o===0&&(this._collectCurrentChunk().catch(i=>{Q&&A.error("[Profiling] Failed to collect current profile chunk on last `spanEnd`:",i)}),this._endProfiling())})}_resetProfilerInfo(){this._isRunning=!1,br().setContext("profile",{})}_clearAllRootSpanTimeouts(){this._rootSpanTimeouts.forEach(t=>clearTimeout(t)),this._rootSpanTimeouts.clear()}_registerTraceRootSpan(t){this._activeRootSpanIds.add(t);let n=setTimeout(()=>this._onRootSpanTimeout(t),VW);this._rootSpanTimeouts.set(t,n)}_startProfilerInstance(){if(this._profiler?.stopped===!1)return;let t=Fy();if(!t){Q&&A.log("[Profiling] Failed to start JS Profiler.");return}this._profiler=t}_startPeriodicChunking(){this._isRunning&&(this._chunkTimer=setTimeout(()=>{if(this._collectCurrentChunk().catch(t=>{Q&&A.error("[Profiling] Failed to collect current profile chunk during periodic chunking:",t)}),this._isRunning){if(this._startProfilerInstance(),!this._profiler){this._resetProfilerInfo();return}this._startPeriodicChunking()}},qW))}_onRootSpanTimeout(t){this._rootSpanTimeouts.has(t)&&(this._rootSpanTimeouts.delete(t),this._activeRootSpanIds.has(t)&&(Q&&A.log(`[Profiling] Reached 5-minute timeout for root span ${t}. You likely started a manual root span that never called \`.end()\`.`),this._activeRootSpanIds.delete(t),this._activeRootSpanIds.size===0&&this._endProfiling()))}async _collectCurrentChunk(){let t=this._profiler;if(this._profiler=void 0,!!t)try{let n=await t.stop(),r=dO(n,this._client,this._profilerId),o=fO(r);if("reason"in o){Q&&A.log("[Profiling] Discarding invalid profile chunk (this is probably a bug in the SDK):",o.reason);return}this._sendProfileChunk(r),Q&&A.log("[Profiling] Collected browser profile chunk.")}catch(n){Q&&A.log("[Profiling] Error while stopping JS Profiler for chunk:",n)}}_sendProfileChunk(t){let n=this._client,r=Xo(n.getSdkMetadata?.()),o=n.getDsn(),i=n.getOptions().tunnel,a=$t({event_id:ft(),sent_at:new Date().toISOString(),...r&&{sdk:r},...!!i&&o&&{dsn:pn(o)}},[[{type:"profile_chunk",platform:"javascript"},t]]);n.sendEnvelope(a).then(null,s=>{Q&&A.error("Error while sending profile chunk envelope:",s)})}};var WW="BrowserProfiling",YW=(()=>({name:WW,setup(e){let t=e.getOptions(),n=new Gy;if(!jp(t)&&!t.profileLifecycle&&(t.profileLifecycle="manual"),jp(t)&&!t.profilesSampleRate){Q&&A.log("[Profiling] Profiling disabled, no profiling options found.");return}let r=Be(),o=r&&Fe(r);if(jp(t)&&t.profileSessionSampleRate!==void 0&&Q&&A.warn("[Profiling] Both legacy profiling (`profilesSampleRate`) and UI profiling settings are defined. `profileSessionSampleRate` has no effect when legacy profiling is enabled."),jp(t))o&&zy(o)&&GT(o)&&$T(o),e.on("spanStart",i=>{let a=Fe(i);i===a?GT(i)&&$T(i):Hy.has(a)&&Yl(i)}),e.on("beforeEnvelope",i=>{if(!_O())return;let a=mO(i);if(!a.length)return;let s=[];for(let l of a){let c=l?.contexts,d=c?.profile?.profile_id,u=c?.profile?.start_timestamp;if(typeof d!="string"){Q&&A.log("[Profiling] cannot find profile for a span without a profile context");continue}if(!d){Q&&A.log("[Profiling] cannot find profile for a span without a profile context");continue}c?.profile&&delete c.profile;let m=vO(d);if(!m){Q&&A.log(`[Profiling] Could not retrieve profile for span: ${d}`);continue}let p=yO(d,u,m,l);p&&s.push(p)}pO(i,s)});else{let i=t.profileLifecycle;if(e.on("startUIProfiler",()=>n.start()),e.on("stopUIProfiler",()=>n.stop()),i==="manual")n.initialize(e);else if(i==="trace"){if(!Gt(t)){Q&&A.warn("[Profiling] `profileLifecycle` is 'trace' but tracing is disabled. Set a `tracesSampleRate` or `tracesSampler` to enable span tracing.");return}n.initialize(e),o&&n.notifyRootSpanActive(o),J.setTimeout(()=>{let a=Be(),s=a&&Fe(a);s&&n.notifyRootSpanActive(s)},0)}}}})),EO=YW;var KW="SpotlightBrowser",XW=[{op:"ui.interaction.click",name:"#sentry-spotlight"}],JW=((e={})=>{let t=e.sidecarUrl||"http://localhost:8969/stream";return{name:KW,setup:()=>{Q&&A.log("Using Sidecar URL",t)},beforeSetup(n){let r=n.getOptions();r.ignoreSpans=[...r.ignoreSpans||[],...XW]},afterAllSetup:n=>{QW(n,t)}}});function QW(e,t){let n=ju("fetch"),r=0;e.on("beforeEnvelope",o=>{if(r>3){A.warn("[Spotlight] Disabled Sentry -> Spotlight integration due to too many failed requests:",r);return}n(t,{method:"POST",body:Qi(o),headers:{"Content-Type":"application/x-sentry-envelope"},mode:"cors"}).then(i=>{i.status>=200&&i.status<400&&(r=0)},i=>{r++,A.error("Sentry SDK can't connect to Sidecar is it running? See: https://spotlightjs.com/sidecar/npx/",i)})})}var TO=JW;var wO=()=>({name:"LaunchDarkly",processEvent(e,t,n){return Fr(e)}});function xO(){return{name:"sentry-flag-auditor",type:"flag-used",synchronous:!0,method:(e,t,n)=>{Sr(e,t.value),Er(e,t.value)}}}var kO=()=>({name:"OpenFeature",processEvent(e,t,n){return Fr(e)}}),$y=class{after(t,n){Sr(n.flagKey,n.value),Er(n.flagKey,n.value)}error(t,n,r){Sr(t.flagKey,t.defaultValue),Er(t.flagKey,t.defaultValue)}};var AO=({featureFlagClientClass:e})=>({name:"Unleash",setupOnce(){let t=e.prototype;wt(t,"isEnabled",ZW)},processEvent(t,n,r){return Fr(t)}});function ZW(e){return function(...t){let n=t[0],r=e.apply(this,t);return typeof n=="string"&&typeof r=="boolean"?(Sr(n,r),Er(n,r)):Q&&A.error(`[Feature Flags] UnleashClient.isEnabled does not match expected signature. arg0: ${n} (${typeof n}), result: ${r} (${typeof r})`),r}}var IO=(({growthbookClass:e})=>bS({growthbookClass:e}));var NO=({featureFlagClient:e})=>({name:"Statsig",setup(t){e.on("gate_evaluation",n=>{Sr(n.gate.name,n.gate.value),Er(n.gate.name,n.gate.value)})},processEvent(t,n,r){return Fr(t)}});async function RO(){let e=q();if(!e)return"no-client-active";if(!e.getDsn())return"no-dsn-configured";let r=e.getOptions().tunnel||"https://o447951.ingest.sentry.io/api/4509632503087104/envelope/?sentry_version=7&sentry_key=c1dfb07d783ad5325c245c1fd3725390&sentry_client=sentry.javascript.browser%2F1.33.7";try{await tu(()=>fetch(r,{body:"{}",method:"POST",mode:"cors",credentials:"omit"}))}catch{return"sentry-unreachable"}}var eY="WebWorker",MO=({worker:e})=>({name:eY,setupOnce:()=>{(Array.isArray(e)?e:[e]).forEach(t=>CO(t))},addWorker:t=>CO(t)});function CO(e){e.addEventListener("message",t=>{if(nY(t.data)){if(t.stopImmediatePropagation(),t.data._sentryDebugIds&&(Q&&A.log("Sentry debugId web worker message received",t.data),J._sentryDebugIds={...t.data._sentryDebugIds,...J._sentryDebugIds}),t.data._sentryModuleMetadata&&(Q&&A.log("Sentry module metadata web worker message received",t.data),J._sentryModuleMetadata={...t.data._sentryModuleMetadata,...J._sentryModuleMetadata}),t.data._sentryWasmImages){Q&&A.log("Sentry WASM images web worker message received",t.data);let n=J._sentryWasmImages||[],r=t.data._sentryWasmImages.filter(o=>Tt(o)&&typeof o.code_file=="string"&&!n.some(i=>i.code_file===o.code_file));J._sentryWasmImages=[...n,...r]}t.data._sentryWorkerError&&(Q&&A.log("Sentry worker rejection message received",t.data._sentryWorkerError),tY(t.data._sentryWorkerError))}})}function tY(e){let t=q();if(!t)return;let n=t.getOptions().stackParser,r=t.getOptions().attachStacktrace,o=e.reason,i=dn(o)?DE(o):Uu(n,o,void 0,r,!0);i.level="error",e.filename&&(i.contexts={...i.contexts,worker:{filename:e.filename}}),uo(i,{originalException:o,mechanism:{handled:!1,type:"auto.browser.web_worker.onunhandledrejection"}}),Q&&A.log("Captured worker unhandled rejection",o)}function OO({self:e}){e.postMessage({_sentryMessage:!0,_sentryDebugIds:e._sentryDebugIds??void 0,_sentryModuleMetadata:e._sentryModuleMetadata??void 0}),e.addEventListener("unhandledrejection",t=>{let r={reason:OE(t),filename:e.location?.href};e.postMessage({_sentryMessage:!0,_sentryWorkerError:r}),Q&&A.log("[Sentry Worker] Forwarding unhandled rejection to parent",r)}),Q&&A.log("[Sentry Worker] Registered worker with unhandled rejection handling")}function nY(e){if(!Tt(e)||e._sentryMessage!==!0)return!1;let t="_sentryDebugIds"in e,n="_sentryModuleMetadata"in e,r="_sentryWorkerError"in e,o="_sentryWasmImages"in e;return!(!t&&!n&&!r&&!o||t&&!(Tt(e._sentryDebugIds)||e._sentryDebugIds===void 0)||n&&!(Tt(e._sentryModuleMetadata)||e._sentryModuleMetadata===void 0)||r&&!Tt(e._sentryWorkerError)||o&&(!Array.isArray(e._sentryWasmImages)||!e._sentryWasmImages.every(i=>Tt(i)&&typeof i.code_file=="string")))}var LO=so(za(),1);function DO(e){return Tt(e)&&"nativeEvent"in e&&"preventDefault"in e&&"stopPropagation"in e}function jy(e){let t={...e};ip(t,"react"),Qa("react",{version:LO.version});let n=UE(t);return jc(rY),n}function rY(e){return DO(e)?"[SyntheticEvent]":Yu(e)}var UO=so(za(),1);function oY(e){let t=e.match(/^([^.]+)/);return t!==null&&parseInt(t[0])>=17}function iY(e,t){let n=new WeakSet;function r(o,i){if(!n.has(o)){if(o.cause)return n.add(o),r(o.cause,i);o.cause=i}}r(e,t)}function qp(e,{componentStack:t},n){if(oY(UO.version)&&En(e)&&t){let r=new Error(e.message);r.name=`React ErrorBoundary ${e.name}`,r.stack=t,iY(e,r)}return xe(e,n)}function PO(e){return(t,n)=>{let r=!!e,o=qp(t,n,{mechanism:{handled:r,type:"auto.function.react.error_handler"}});r&&e(t,n,o)}}var ua=so(za(),1);var jT="ui.react.render",BO="ui.react.update",qT="ui.react.mount";var aY={childContextTypes:!0,contextType:!0,contextTypes:!0,defaultProps:!0,displayName:!0,getDefaultProps:!0,getDerivedStateFromError:!0,getDerivedStateFromProps:!0,mixins:!0,propTypes:!0,type:!0},sY={name:!0,length:!0,prototype:!0,caller:!0,callee:!0,arguments:!0,arity:!0},lY={$$typeof:!0,render:!0,defaultProps:!0,displayName:!0,propTypes:!0},$O={$$typeof:!0,compare:!0,defaultProps:!0,displayName:!0,propTypes:!0,type:!0},cY=Symbol.for("react.forward_ref"),jO=Symbol.for("react.memo");function uY(e){return typeof e=="object"&&e!==null&&e.$$typeof===jO}var VT={};VT[cY]=lY;VT[jO]=$O;function zO(e){if(uY(e))return $O;let t=e.$$typeof;return t&&VT[t]||aY}var dY=Object.defineProperty.bind(Object),fY=Object.getOwnPropertyNames.bind(Object),FO=Object.getOwnPropertySymbols?.bind(Object),HO=Object.getOwnPropertyDescriptor.bind(Object),pY=Object.getPrototypeOf.bind(Object),GO=Object.prototype;function ca(e,t,n){if(typeof t!="string"){if(GO){let a=pY(t);a&&a!==GO&&ca(e,a)}let r=fY(t);FO&&(r=r.concat(FO(t)));let o=zO(e),i=zO(t);for(let a of r)if(!sY[a]&&!i?.[a]&&!o?.[a]&&!HO(e,a)){let s=HO(t,a);if(s)try{dY(e,a,s)}catch{}}}return e}var mY="unknown",cd=class extends ua.Component{constructor(t){super(t);let{name:n,disabled:r=!1}=this.props;r||(this._mountSpan=Dt({name:`<${n}>`,onlyIfParent:!0,op:qT,attributes:{[le]:"auto.ui.react.profiler","ui.component_name":n}}))}componentDidMount(){this._mountSpan&&this._mountSpan.end()}shouldComponentUpdate({updateProps:t,includeUpdates:n=!0}){if(n&&this._mountSpan&&t!==this.props.updateProps){let r=Object.keys(t).filter(o=>t[o]!==this.props.updateProps[o]);if(r.length>0){let o=Ue();this._updateSpan=co(this._mountSpan,()=>Dt({name:`<${this.props.name}>`,onlyIfParent:!0,op:BO,startTime:o,attributes:{[le]:"auto.ui.react.profiler","ui.component_name":this.props.name,"ui.react.changed_props":r}}))}}return!0}componentDidUpdate(){this._updateSpan&&(this._updateSpan.end(),this._updateSpan=void 0)}componentWillUnmount(){let t=Ue(),{name:n,includeRender:r=!0}=this.props;if(this._mountSpan&&r){let o=ie(this._mountSpan).timestamp;co(this._mountSpan,()=>{let i=Dt({onlyIfParent:!0,name:`<${n}>`,op:jT,startTime:o,attributes:{[le]:"auto.ui.react.profiler","ui.component_name":n}});i&&i.end(t)})}}render(){return this.props.children}};Object.assign(cd,{defaultProps:{disabled:!1,includeRender:!0,includeUpdates:!0}});function qO(e,t){let n=t?.name||e.displayName||e.name||mY,r=o=>ua.createElement(cd,{...t,name:n,updateProps:o},ua.createElement(e,{...o}));return r.displayName=`profiler(${n})`,ca(r,e),r}function VO(e,t={disabled:!1,hasRenderSpan:!0}){let[n]=ua.useState(()=>{if(!t?.disabled)return Dt({name:`<${e}>`,onlyIfParent:!0,op:qT,attributes:{[le]:"auto.ui.react.profiler","ui.component_name":e}})});ua.useEffect(()=>(n&&n.end(),()=>{if(n&&t.hasRenderSpan){let r=ie(n).timestamp,o=Ue(),i=Dt({name:`<${e}>`,onlyIfParent:!0,op:jT,startTime:r,attributes:{[le]:"auto.ui.react.profiler","ui.component_name":e}});i&&i.end(o)}}),[])}var Ci=so(za(),1);var qt=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__;var gY="unknown",WT={componentStack:null,error:null,eventId:null},Vp=class extends Ci.Component{constructor(t){super(t),this.state=WT,this._openFallbackReportDialog=!0;let n=q();n&&t.showDialog&&(this._openFallbackReportDialog=!1,this._cleanupHook=n.on("afterSendEvent",r=>{!r.type&&this._lastEventId&&r.event_id===this._lastEventId&&xp({...t.dialogOptions,eventId:this._lastEventId})}))}componentDidCatch(t,n){let{componentStack:r}=n,{beforeCapture:o,onError:i,showDialog:a,dialogOptions:s}=this.props;Ht(l=>{o&&o(l,t,r);let c=this.props.handled!=null?this.props.handled:!!this.props.fallback,d=qp(t,n,{mechanism:{handled:c,type:"auto.function.react.error_boundary"}});i&&i(t,r,d),a&&(this._lastEventId=d,this._openFallbackReportDialog&&xp({...s,eventId:d})),this.setState({error:t,componentStack:r,eventId:d})})}componentDidMount(){let{onMount:t}=this.props;t&&t()}componentWillUnmount(){let{error:t,componentStack:n,eventId:r}=this.state,{onUnmount:o}=this.props;o&&(this.state===WT?o(null,null,null):o(t,n,r)),this._cleanupHook&&(this._cleanupHook(),this._cleanupHook=void 0)}resetErrorBoundary(){let{onReset:t}=this.props,{error:n,componentStack:r,eventId:o}=this.state;t&&t(n,r,o),this.setState(WT)}render(){let{fallback:t,children:n}=this.props,r=this.state;if(r.componentStack===null)return typeof n=="function"?n():n;let o=typeof t=="function"?Ci.createElement(t,{error:r.error,componentStack:r.componentStack,resetError:()=>this.resetErrorBoundary(),eventId:r.eventId}):t;return Ci.isValidElement(o)?o:(t&&qt&&A.warn("fallback did not produce a valid ReactElement"),null)}};function WO(e,t){let n=e.displayName||e.name||gY,r=Ci.memo(o=>Ci.createElement(Vp,{...t},Ci.createElement(e,{...o})));return r.displayName=`errorBoundary(${n})`,ca(r,e),r}var hY="redux.action",bY="info",yY={attachReduxState:!0,actionTransformer:e=>e,stateTransformer:e=>e||null};function YO(e){let t={...yY,...e};return n=>(r,o)=>{t.attachReduxState&&br().addEventProcessor((s,l)=>{try{s.type===void 0&&s.contexts.state.state.type==="redux"&&(l.attachments=[...l.attachments||[],{filename:"redux_state.json",data:JSON.stringify(s.contexts.state.state.value)}])}catch{}return s});function i(s){return(l,c)=>{let d=s(l,c),u=ae(),m=t.actionTransformer(c);typeof m<"u"&&m!==null&&Mn({category:hY,data:m,type:bY});let p=t.stateTransformer(d);if(typeof p<"u"&&p!==null){let h=q()?.getOptions()?.normalizeDepth||3,v={state:{type:"redux",value:p}};dv(v,3+h),u.setContext("state",v)}else u.setContext("state",null);let{configureScopeWithState:g}=t;return typeof g=="function"&&g(u,d),d}}let a=n(i(r),o);return a.replaceReducer=new Proxy(a.replaceReducer,{apply:function(s,l,c){s.apply(l,[i(c[0])])}}),a}}function XO(e){let t=Vr({...e,instrumentPageLoad:!1,instrumentNavigation:!1}),{history:n,routes:r,match:o,instrumentPageLoad:i=!0,instrumentNavigation:a=!0}=e;return{...t,afterAllSetup(s){t.afterAllSetup(s),i&&J.location&&KO(r,J.location,o,(l,c="url")=>{ri(s,{name:l,attributes:{[_e]:"pageload",[le]:"auto.pageload.react.reactrouter_v3",[Pe]:c}})}),a&&n.listen&&n.listen(l=>{(l.action==="PUSH"||l.action==="POP")&&KO(r,l,o,(c,d="url")=>{oi(s,{name:c,attributes:{[_e]:"navigation",[le]:"auto.navigation.react.reactrouter_v3",[Pe]:d}})})})}}}function KO(e,t,n,r){let o=t.pathname;n({location:t,routes:e},(i,a,s)=>{if(i||!s)return r(o);let l=_Y(s.routes||[]);return l.length===0||l==="/*"?r(o):(o=l,r(o,"route"))})}function _Y(e){if(!Array.isArray(e)||e.length===0)return"";let t=e.filter(r=>!!r.path),n=-1;for(let r=t.length-1;r>=0;r--)if(t[r].path?.startsWith("/")){n=r;break}return t.slice(n).reduce((r,{path:o})=>{let i=r==="/"||r===""?o:`/${o}`;return`${r}${i}`},"")}function QO(e,t={}){let n=e,r=Vr({...t,instrumentNavigation:!1,instrumentPageLoad:!1}),{instrumentPageLoad:o=!0,instrumentNavigation:i=!0}=t;return{...r,afterAllSetup(a){r.afterAllSetup(a);let s=J.location;if(o&&s){let l=n.matchRoutes(s.pathname,n.options.parseSearch(s.search),{preload:!1,throwOnError:!1}),c=l[l.length-1],d=c?.routeId!=="__root__"?c:void 0;ri(a,{name:d?d.routeId:s.pathname,attributes:{[_e]:"pageload",[le]:"auto.pageload.react.tanstack_router",[Pe]:d?"route":"url",...JO(d)}})}i&&n.subscribe("onBeforeNavigate",l=>{if(!l.fromLocation||l.toLocation.state===l.fromLocation.state)return;let c=n.matchRoutes(l.toLocation.pathname,l.toLocation.search,{preload:!1,throwOnError:!1}),d=c[c.length-1],u=d?.routeId!=="__root__"?d:void 0,m=J.location,p=oi(a,{name:u?u.routeId:m.pathname,attributes:{[_e]:"navigation",[le]:"auto.navigation.react.tanstack_router",[Pe]:u?"route":"url"}}),g=n.subscribe("onResolved",_=>{if(g(),p){let y=n.matchRoutes(_.toLocation.pathname,_.toLocation.search,{preload:!1,throwOnError:!1}),h=y[y.length-1],v=h?.routeId!=="__root__"?h:void 0;v&&(p.updateName(v.routeId),p.setAttribute(Pe,"route"),p.setAttributes(JO(v)))}})})}}}function JO(e){if(!e)return{};let t={};return Object.entries(e.params).forEach(([n,r])=>{t[`url.path.params.${n}`]=r,t[`url.path.parameter.${n}`]=r,t[`params.${n}`]=r}),t}var ZO=so(za(),1);function e5(e){let t=Vr({...e,instrumentPageLoad:!1,instrumentNavigation:!1}),{history:n,routes:r,matchPath:o,instrumentPageLoad:i=!0,instrumentNavigation:a=!0}=e;return{...t,afterAllSetup(s){t.afterAllSetup(s),n5(s,i,a,n,"reactrouter_v4",r,o)}}}function t5(e){let t=Vr({...e,instrumentPageLoad:!1,instrumentNavigation:!1}),{history:n,routes:r,matchPath:o,instrumentPageLoad:i=!0,instrumentNavigation:a=!0}=e;return{...t,afterAllSetup(s){t.afterAllSetup(s),n5(s,i,a,n,"reactrouter_v5",r,o)}}}function n5(e,t,n,r,o,i=[],a){function s(){if(r.location)return r.location.pathname;if(J.location)return J.location.pathname}function l(c){if(i.length===0||!a)return[c,"url"];let d=r5(i,c,a);for(let u of d)if(u.match.isExact)return[u.match.path,"route"];return[c,"url"]}if(t){let c=s();if(c){let[d,u]=l(c);ri(e,{name:d,attributes:{[_e]:"pageload",[le]:`auto.pageload.react.${o}`,[Pe]:u}})}}n&&r.listen&&r.listen((c,d)=>{if(d&&(d==="PUSH"||d==="POP")){let[u,m]=l(c.pathname);oi(e,{name:u,attributes:{[_e]:"navigation",[le]:`auto.navigation.react.${o}`,[Pe]:m}})}})}function r5(e,t,n,r=[]){return e.some(o=>{let i=o.path?n(t,o):r.length?r[r.length-1].match:vY(t);return i&&(r.push({route:o,match:i}),o.routes&&r5(o.routes,t,n,r)),!!i}),r}function vY(e){return{path:"/",url:"/",params:{},isExact:e==="/"}}function o5(e){let t=e.displayName||e.name,n=r=>{if(r?.computedMatch?.isExact){let o=r.computedMatch.path,i=SY();ae().setTransactionName(o),i&&(i.updateName(o),i.setAttribute(Pe,"route"))}return ZO.createElement(e,{...r})};return n.displayName=`sentryRoute(${t})`,ca(n,e),n}function SY(){let e=Be(),t=e&&Fe(e);if(!t)return;let n=ie(t).op;return n==="navigation"||n==="pageload"?t:void 0}var Mi=so(za(),1);function ud(e,t){if(!t||t==="/"||!e.toLowerCase().startsWith(t.toLowerCase()))return e;let n=t.endsWith("/")?t.length-1:t.length,r=e.charAt(n);return r&&r!=="/"?e:e.slice(n)||"/"}var i5=new WeakMap;function c5(e,t,n){if(!e||!t?.length)return null;let r=n?ud(e,n):e,o=i5.get(t);o||(o=AY(t),i5.set(t,o),qt&&A.log("[React Router] Sorted route manifest by specificity:",o.length,"patterns"));for(let i of o)if(EY(r,i))return qt&&A.log("[React Router] Matched pathname",r,"to pattern",i),i;return qt&&A.log("[React Router] No manifest match found for pathname:",r),null}function EY(e,t){if(t==="/")return e==="/"||e==="";let n=s5(e),r=s5(t);if(r.length>0&&r[r.length-1]==="*"){let i=r.slice(0,-1);if(n.length<i.length)return!1;for(let[a,s]of i.entries())if(!a5(n[a],s))return!1;return!0}if(n.length!==r.length)return!1;for(let[i,a]of r.entries())if(!a5(n[i],a))return!1;return!0}function a5(e,t){return e===void 0||t===void 0?!1:u5.test(t)?!0:e===t}function s5(e){return e.split("/").filter(Boolean)}var u5=/^:[\w-]+$/,TY=10,wY=3,xY=1,kY=-2;function l5(e){let t=e.split("/"),n=t.length;t.includes("*")&&(n+=kY);for(let r of t)r!=="*"&&(u5.test(r)?n+=wY:r===""?n+=xY:n+=TY);return n}function AY(e){return[...e].sort((t,n)=>{let r=l5(t);return l5(n)-r})}var YT,Kl=!1,bs=[],IY=10;function m5(e,t){let n={};return bs.length>=IY&&(qt&&A.warn("[React Router] Navigation context stack overflow - removing oldest context"),bs.shift()),bs.push({token:n,targetPath:e,span:t}),n}function g5(e){bs[bs.length-1]?.token===e&&bs.pop()}function KT(){let e=bs.length;return e>0?bs[e-1]??null:null}function h5(e,t=!1){YT=e,Kl=t}function NY(e){return CY(e.route.path||"")}function RY(e){return e.params["*"]||""}function CY(e){return e[e.length-1]==="*"?e.slice(0,-1):e}function dd(e){return e[e.length-1]==="/"?e.slice(0,-1):e}function b5(e){return e.endsWith("*")}function da(e){return e.includes("/*")||e.endsWith("*")}function d5(e,t){return b5(e)&&!!t.route.children?.length||!1}function MY(e){return!!(!e.children&&e.element&&e.path?.endsWith("/*"))}function OY(e,t,n){let r=e&&e.length>0?e:Kl?ud(t,n):t,o=r.slice(-2)==="/*"?r.slice(0,-2):r;return o.length>1&&o[o.length-1]==="/"&&(o=o.slice(0,-1)),[o,"route"]}function f5(e){return e.split(/\\?\//).filter(t=>t.length>0&&t!==",").length}function qy(e){return e[0]==="/"?e:`/${e}`}function y5(e,t){let n=YT(e,t);if(!n||n.length===0)return"";for(let r of n)if(r.route.path&&r.route.path!=="*"){let o=NY(r),i=ud(t.pathname,qy(r.pathnameBase));return t.pathname===i?dd(i):dd(dd(o||"")+qy(y5(e.filter(a=>a!==r.route),{pathname:i})))}return""}function DY(e,t){let n=YT(t,e);if(n){for(let r of n)if(MY(r.route)&&RY(r))return!0}return!1}function p5(e,t){return Kl?ud(e.pathname,t):e.pathname||""}function LY(e,t,n,r=""){if(!e||e.length===0)return[Kl?ud(t.pathname,r):t.pathname,"url"];if(!n)return[p5(t,r),"url"];let o="";for(let i of n){let a=i.route;if(!a)continue;if(a.index)return OY(o,i.pathname,r);let s=a.path;if(!s||d5(s,i))continue;let l=s[0]==="/"||o[o.length-1]==="/"?s:`/${s}`;if(o=dd(o)+qy(l),dd(t.pathname)===dd(r+i.pathname))return f5(o)!==f5(i.pathname)&&!b5(o)?[(Kl?"":r)+l,"route"]:(d5(o,i)&&(o=o.slice(0,-1)),[(Kl?"":r)+o,"route"])}return[p5(t,r),"url"]}function Wp(e,t,n,r,o="",i,a){if(a&&i&&i.length>0){let d=c5(e.pathname,i,o);if(d)return[(Kl?"":o)+d,"route"]}let s,l="url",c=DY(e,n);return c&&(s=qy(y5(n,e)),l="route"),(!c||!s)&&([s,l]=LY(t,e,r,o)),[s||e.pathname,l]}function wo(){let e=Be(),t=e?Fe(e):void 0;if(!t)return;let n=ie(t).op;return n==="navigation"||n==="pageload"?t:void 0}function UY(){let e=KT();if(e)return e.targetPath?{pathname:e.targetPath,search:"",hash:"",state:null,key:"default"}:null;if(typeof J<"u")try{let t=J.location;if(t)return{pathname:t.pathname,search:t.search||"",hash:t.hash||"",state:null,key:"default"}}catch{qt&&A.warn("[React Router] Could not access window.location")}return null}function PY(){let e=KT();return e?e.span:wo()}function BY(e,t,n,r){let o=new Proxy(e,{apply(i,a,s){let l=UY(),c=PY(),d=i.apply(a,s);return zY(d,t,n,r,l,c),d}});return Ye(o,"__sentry_proxied__",!0),o}function zY(e,t,n,r,o,i){Bn(e)?e.then(a=>{Array.isArray(a)&&r(a,t,o??void 0,i)}).catch(a=>{qt&&A.warn(`Error resolving async handler '${n}' for route`,t,a)}):Array.isArray(e)&&r(e,t,o??void 0,i)}function Yp(e,t){if(e.handle&&typeof e.handle=="object")for(let n of Object.keys(e.handle)){let r=e.handle[n];typeof r=="function"&&!r.__sentry_proxied__&&(e.handle[n]=BY(r,e,n,t))}if(Array.isArray(e.children))for(let n of e.children)Yp(n,t)}var fd,ys,_s,Vy,xo,vs=!1,Jl=3e3,Kp,ew="",S5=new WeakSet,E5=J?.document?Mi.useLayoutEffect:Mi.useEffect,Xl=new WeakMap,Dn=new Set,Wy=new WeakMap,JT=new WeakMap;function FY(e){return J?.requestAnimationFrame?J.requestAnimationFrame(e):setTimeout(e,0)}function _5(e){J?.cancelAnimationFrame?J.cancelAnimationFrame(e):clearTimeout(e)}function T5(e){return`${e.pathname}${e.search||""}${e.hash||""}`}function v5(e){return e.includes(":")||e.includes("*")}function HY(e,t,n,r){if(!e)return{skip:!1,shouldUpdate:!1};if(e.locationKey===t&&(e.isPlaceholder||!r)){let i=!!e.routeName&&da(e.routeName),a=da(n),s=!!e.routeName&&v5(e.routeName),l=v5(n),c=i&&!a,d=!s&&l,u=n!==e.routeName&&n.length>(e.routeName?.length||0)&&!a;return{skip:!0,shouldUpdate:!!(e.routeName&&(c||d||u))}}return{skip:!1,shouldUpdate:!1}}function w5(e,t){let n=t.children||[],r=e.filter(o=>!n.some(i=>i===o||o.path&&i.path===o.path||o.id&&i.id===o.id));r.length>0&&(t.children=[...n,...r])}function x5(e,t){let n=Wy.get(e);n||(n=new Set,Wy.set(e,n)),n.add(t),t.finally(()=>{let r=Wy.get(e);r&&r.delete(t)})}function k5(e){let t=new Promise(n=>{JT.set(e,n)});x5(e,t)}function GY(e){let t=JT.get(e);t&&(t(),JT.delete(e),e.__sentry_may_have_lazy_routes__&&(e.__sentry_may_have_lazy_routes__=!1))}function tw(e,t,n=null,r){e.forEach(i=>{Dn.add(i),vs&&Yp(i,tw)}),t&&w5(e,t);let o=r??wo();if(o){let i=ie(o);if(i.timestamp){qt&&A.warn("[React Router] Lazy handler resolved after span ended - skipping update");return}let a=i.op,s=n;if(!s&&!r&&typeof J<"u"){let l=J.location;l?.pathname&&(s={pathname:l.pathname})}s&&(a==="pageload"?Jp({activeRootSpan:o,location:{pathname:s.pathname},routes:Array.from(Dn),allRoutes:Array.from(Dn)}):a==="navigation"&&QT(o,s,Array.from(Dn),!1,xo))}}function QT(e,t,n,r=!1,o){let i=ie(e),a=i.description,s=e?.__sentry_navigation_name_set__,l=a&&da(a);if((!s||r||l)&&!i.timestamp){let d=o(n,t),[u,m]=Wp(t,n,n,d||[],ew,Kp,vs),p=i.data?.[Pe];u&&(!a||!s&&(p!=="route"||m==="route")||p!=="route"&&m==="route"||p==="route"&&m==="route"&&l)&&(e.updateName(u),e.setAttribute(Pe,m),!da(u)&&m==="route"&&Ye(e,"__sentry_navigation_name_set__",!0))}}function A5(e,t,n,r,o){let i=!1,a=!!o&&ie(o).op==="pageload",s=!1,l=null,c=null;e.subscribe(d=>{if(!i){let m=wo();m&&ie(m).op==="pageload"?a=!0:a&&(d.historyAction==="POP"&&!s?s=!0:i=!0)}if(d.historyAction==="PUSH"||d.historyAction==="POP"&&i){let m=T5(d.location),p=()=>{c!==m&&(c=m,l=null,nw({location:d.location,routes:t,navigationType:d.historyAction,version:n,basename:r,allRoutes:Array.from(Dn)}))};d.navigation.state!=="idle"?(c!==m&&(c=null),l!==null&&_5(l),l=FY(p)):(l!==null&&(_5(l),l=null),p())}})}function pd(e,t){return!fd||!ys||!_s||!xo?(qt&&A.warn(`reactRouter${t?`V${t}`:""}Instrumentation was unable to wrap the \`createRouter\` function because of one or more missing parameters.`),e):function(n,r){if(Xp(n),vs)for(let c of n)Yp(c,tw);let o=wo();r&&"patchRoutesOnNavigation"in r&&typeof r.patchRoutesOnNavigation=="function"&&o&&(Ye(o,"__sentry_may_have_lazy_routes__",!0),k5(o));let a=I5(r,!1,o),s=e(n,a),l=r?.basename;return s.state.historyAction==="POP"&&o&&Jp({activeRootSpan:o,location:s.state.location,routes:n,basename:l,allRoutes:Array.from(Dn)}),ew=l||"",A5(s,n,t,l,o),s}}function md(e,t){return!fd||!ys||!_s||!xo?(qt&&A.warn(`reactRouter${t?`V${t}`:""}Instrumentation was unable to wrap the \`createMemoryRouter\` function because of one or more missing parameters.`),e):function(n,r){if(Xp(n),vs)for(let y of n)Yp(y,tw);let o=wo();r&&"patchRoutesOnNavigation"in r&&typeof r.patchRoutesOnNavigation=="function"&&o&&(Ye(o,"__sentry_may_have_lazy_routes__",!0),k5(o));let a=I5(r,!0,o),s=e(n,a),l=r?.basename,c,d=r?.initialEntries,u=r?.initialIndex,m=d?.length===1,p=u!==void 0&&d?.[u];c=m?d[0]:p?d[u]:void 0;let g=c?typeof c=="string"?{pathname:c}:c:s.state.location,_=wo();return s.state.historyAction==="POP"&&_&&Jp({activeRootSpan:_,location:g,routes:n,basename:l,allRoutes:Array.from(Dn)}),ew=l||"",A5(s,n,t,l,_),s}}function gd(e,t){let n=Vr({...e,instrumentPageLoad:!1,instrumentNavigation:!1}),{useEffect:r,useLocation:o,useNavigationType:i,createRoutesFromChildren:a,matchRoutes:s,stripBasename:l,enableAsyncRouteHandlers:c=!1,instrumentPageLoad:d=!0,instrumentNavigation:u=!0,lazyRouteTimeout:m,lazyRouteManifest:p}=e;return{...n,setup(g){n.setup(g);let _=e.finalTimeout??3e4,y=(e.idleTimeout??1e3)*3,h=m??y;h===1/0?(Jl=_,qt&&A.log("[React Router] lazyRouteTimeout set to Infinity, capping at finalTimeout:",_,"ms to prevent indefinite hangs")):Number.isNaN(h)?(qt&&A.warn("[React Router] lazyRouteTimeout must be a number, falling back to default:",y),Jl=y):h<0?(qt&&A.warn("[React Router] lazyRouteTimeout must be non-negative or Infinity, got:",h,"falling back to:",y),Jl=y):Jl=h,fd=r,ys=o,_s=i,xo=s,Vy=a,vs=c,Kp=p,h5(s,l||!1)},afterAllSetup(g){n.afterAllSetup(g);let _=J.location?.pathname;d&&_&&ri(g,{name:_,attributes:{[Pe]:"url",[_e]:"pageload",[le]:`auto.pageload.react.reactrouter${t?`_v${t}`:""}`}}),u&&S5.add(g)}}}function hd(e,t){if(!fd||!ys||!_s||!xo)return qt&&A.warn("reactRouterV6Instrumentation was unable to wrap `useRoutes` because of one or more missing parameters."),e;let n=r=>{let o=Mi.useRef(!0),{routes:i,locationArg:a}=r,s=e(i,a),l=ys(),c=_s(),d=typeof a=="string"||a?.pathname?a:l;return E5(()=>{let u=typeof d=="string"?{pathname:d}:d;o.current?(Xp(i),Jp({activeRootSpan:wo(),location:u,routes:i,allRoutes:Array.from(Dn)}),o.current=!1):nw({location:u,routes:i,navigationType:c,version:t,allRoutes:Array.from(Dn)})},[c,d]),s};return(r,o)=>Mi.createElement(n,{routes:r,locationArg:o})}function I5(e,t=!1,n){if(!e||!("patchRoutesOnNavigation"in e)||typeof e.patchRoutesOnNavigation!="function")return e||{};let r=e.patchRoutesOnNavigation;return{...e,patchRoutesOnNavigation:async o=>{let i=o?.path,a=wo()??n;if(!t){let l=o?.patch,c=o?.matches;l&&(o.patch=(d,u)=>{if(Xp(u),c&&c.length>0){let g=c[c.length-1]?.route;if(g){let _=Array.from(Dn).find(y=>{let h=y.id!==void 0&&y.id===d,v=y===g,T=y.path!==void 0&&g.path!==void 0&&y.path===g.path;return h||v||T});_&&w5(u,_)}}let m=a?ie(a):void 0;return i&&a&&m&&!m.timestamp&&m.op==="navigation"&&QT(a,{pathname:i,search:"",hash:"",state:null,key:"default"},Array.from(Dn),!0,xo),l(d,u)})}let s=(async()=>{let l=m5(i,a),c;try{c=await r(o)}finally{g5(l),a&&GY(a)}let d=a?ie(a):void 0;if(a&&d&&!d.timestamp&&d.op==="navigation"){let u=i;u&&QT(a,{pathname:u,search:"",hash:"",state:null,key:"default"},Array.from(Dn),!1,xo)}return c})();return a&&x5(a,s),s}}}function nw(e){let{location:t,routes:n,navigationType:r,version:o,matches:i,basename:a,allRoutes:s}=e,l=Array.isArray(i)?i:xo(s||n,t,a),c=q();if(!c||!S5.has(c))return;let d=wo();if(!(d&&ie(d).op==="pageload"&&r==="POP")&&(r==="PUSH"||r==="POP")&&l){let[u,m]=Wp(t,s||n,s||n,l,a,Kp,vs),p=T5(t),g=Xl.get(c),_=g&&!g.isPlaceholder?!!ie(g.span).timestamp:!1,{skip:y,shouldUpdate:h}=HY(g,p,u,_);if(y){if(h&&g){let N=g.routeName;g.isPlaceholder?(g.routeName=u,qt&&A.log(`[Tracing] Updated placeholder navigation name from "${N}" to "${u}" (will apply to real span)`)):(g.span.updateName(u),g.span.setAttribute(Pe,m),Ye(g.span,"__sentry_navigation_name_set__",!0),g.routeName=u,qt&&A.log(`[Tracing] Updated navigation span name from "${N}" to "${u}"`))}else qt&&A.log(`[Tracing] Skipping duplicate navigation for location: ${p}`);return}let T={span:{end:()=>{}},routeName:u,pathname:t.pathname,locationKey:p,isPlaceholder:!0};Xl.set(c,T);let x;try{x=oi(c,{name:T.routeName,attributes:{[Pe]:m,[_e]:"navigation",[le]:`auto.navigation.react.reactrouter${o?`_v${o}`:""}`}})}catch(N){throw Xl.delete(c),N}x?(Xl.set(c,{span:x,routeName:T.routeName,pathname:t.pathname,locationKey:p}),ZT(x,t,n,a,"navigation")):Xl.delete(c)}}function Xp(e){e.forEach(t=>{N5(t).forEach(r=>{Dn.add(r)})})}function N5(e,t=new Set){return t.has(e)||(t.add(e),e.children&&!e.index&&e.children.forEach(n=>{N5(n,t).forEach(o=>{t.add(o)})})),t}function Jp({activeRootSpan:e,location:t,routes:n,matches:r,basename:o,allRoutes:i}){let a=Array.isArray(r)?r:xo(i||n,t,o);if(a){let[s,l]=Wp(t,i||n,i||n,a,o,Kp,vs);ae().setTransactionName(s||"/"),e&&(e.updateName(s),e.setAttribute(Pe,l),ZT(e,t,n,o,"pageload"))}else e&&ZT(e,t,n,o,"pageload")}function $Y(e,t,n,r,o=!1){return n?!!(!e&&o||e&&da(e)&&r==="route"&&!da(n)||t!=="route"&&r==="route"):!1}function XT(e,t,n,r,o,i,a,s){try{let l=t.data?.[Pe];if(l==="route"&&n&&!da(n))return;let c=Array.from(s),d=c.length>0?c:o,u=xo(d,r,i);if(!u)return;let[m,p]=Wp(r,d,d,u,i,Kp,vs),g=$Y(n,l,m,p,!0),_=a==="pageload"||!t.timestamp;g&&_&&(e.updateName(m),e.setAttribute(Pe,p))}catch(l){qt&&A.warn(`Error updating span details before ending: ${l}`)}}function ZT(e,t,n,r,o){let i=`__sentry_${o}_end_patched__`;if(e?.[i]||!e.end)return;let s=e.end.bind(e),l=!1;e.end=function(...d){if(l)return;l=!0;let u=d.length>0?d[0]:Date.now()/1e3,m=ie(e),p=m.description,g=m.data?.[Pe],_=()=>{let x=q();if(x&&o==="navigation"){let N=Xl.get(x);N&&N.span===e&&Xl.delete(x)}},y=Wy.get(e),h=e.__sentry_may_have_lazy_routes__;if((y&&y.size>0||h)&&p&&(da(p)||g!=="route")){if(Jl===0){XT(e,m,p,t,n,r,o,Dn),_(),s(u);return}let x=new Promise(M=>setTimeout(M,Jl)),N;if(y&&y.size>0){let M=Promise.allSettled(y).then(()=>{});N=Jl===1/0?M:Promise.race([M,x])}else N=x;N.then(()=>{let M=ie(e);XT(e,M,M.description,t,n,r,o,Dn),_(),s(u)}).catch(()=>{_(),s(u)});return}XT(e,m,p,t,n,r,o,Dn),_(),s(u)},Ye(e,i,!0)}function bd(e,t){if(!fd||!ys||!_s||!Vy||!xo)return qt&&A.warn(`reactRouterV6Instrumentation was unable to wrap Routes because of one or more missing parameters.
508
- useEffect: ${fd}. useLocation: ${ys}. useNavigationType: ${_s}.
509
- createRoutesFromChildren: ${Vy}. matchRoutes: ${xo}.`),e;let n=r=>{let o=Mi.useRef(!0),i=ys(),a=_s();return E5(()=>{let s=Vy(r.children);o.current?(Xp(s),Jp({activeRootSpan:wo(),location:i,routes:s,allRoutes:Array.from(Dn)}),o.current=!1):nw({location:i,routes:s,navigationType:a,version:t,allRoutes:Array.from(Dn)})},[i,a]),Mi.createElement(e,{...r})};return ca(n,e),n}function R5(e){return gd(e,"6")}function C5(e){return hd(e,"6")}function M5(e){return pd(e,"6")}function O5(e){return md(e,"6")}function D5(e){return bd(e,"6")}function L5(e){return gd(e,"7")}function U5(e){return bd(e,"7")}function P5(e){return pd(e,"7")}function B5(e){return md(e,"7")}function z5(e){return hd(e,"7")}function F5(e){return gd(e,"")}function H5(e){return bd(e,"")}function G5(e){return pd(e,"")}function $5(e){return md(e,"")}function j5(e){return hd(e,"")}function rw(e,t){if(e==null||e==="")return t;let n=typeof e=="number"?e:Number(e);return Number.isFinite(n)&&n>=0&&n<=1?n:t}var fa=typeof window<"u"?window.__vidfarmSentry:void 0,ow=fa?.dsn?.trim()||"";if(ow&&typeof window<"u"&&!window.__vidfarmSentryInitialized){window.__vidfarmSentryInitialized=!0;let e=fa?.environment?.trim()||"development",t=e==="production"?.1:1,n=e==="production"?.1:1,r=["localhost",window.location.origin,`${window.location.origin}/api`],o=Array.from(new Set([...r,...fa?.tracePropagationTargets??[]].filter(Boolean)));jy({dsn:ow,environment:e,release:fa?.release?.trim()||void 0,integrations:[Vr(),Ry({maskAllText:!0,blockAllMedia:!0})],tracesSampleRate:rw(fa?.tracesSampleRate,t),tracePropagationTargets:o,replaysSessionSampleRate:rw(fa?.replaysSessionSampleRate,n),replaysOnErrorSampleRate:rw(fa?.replaysOnErrorSampleRate,1),enableLogs:fa?.enableLogs??!0,sendDefaultPii:fa?.sendDefaultPii??!0}),ou("vidfarm.bundle","hyperframes-editor")}function q5(){return!!ow&&typeof window<"u"&&window.__vidfarmSentryInitialized===!0}function pa(e,t){if(q5())try{xe(e,t?{extra:t}:void 0)}catch{}}function V5(e,t){if(q5())try{Ja(e,t?{level:"error",extra:t}:{level:"error"})}catch{}}var C4=so(_6(),1);var hJ="[vidfarm-demo]",v6=1e3;function bJ(e){if(e!=="debug")return!0;if(typeof window>"u")return!1;try{return new URLSearchParams(window.location.search).has("debug")||window.localStorage?.getItem("VIDFARM_DEMO_DEBUG")==="1"}catch{return!1}}function P1(e,t,n){let r={event:t,detail:n,timestamp:new Date().toISOString()};typeof window<"u"&&(window.__VIDFARM_DEBUG_LOGS__=window.__VIDFARM_DEBUG_LOGS__??[],window.__VIDFARM_DEBUG_LOGS__.push(r),window.__VIDFARM_DEBUG_LOGS__.length>v6&&window.__VIDFARM_DEBUG_LOGS__.splice(0,window.__VIDFARM_DEBUG_LOGS__.length-v6)),bJ(e)&&console[e](hJ,t,n??"")}function Ie(e,t){P1("debug",e,t)}function dr(e,t){P1("warn",e,t)}function Po(e,t){P1("error",e,t);let n=t instanceof Error?t:t&&typeof t=="object"&&"error"in t&&t.error instanceof Error?t.error:null;n?pa(n,{event:e,detail:t}):V5(`vidfarm-demo:${e}`,{detail:t})}function S6(){typeof window>"u"||window.__VIDFARM_DEBUG_HOOKS__||(window.__VIDFARM_DEBUG_HOOKS__=!0,Ie("boot.hooks-installed",{href:window.location.href,readyState:document.readyState,userAgent:navigator.userAgent}),window.addEventListener("error",e=>{let t=e.error instanceof Error?e.error:null;Po("window.error",{message:e.message,filename:e.filename,lineno:e.lineno,colno:e.colno,error:t?t.stack:e.error}),t&&pa(t,{source:"window.error"})}),window.addEventListener("unhandledrejection",e=>{let t=e.reason instanceof Error?e.reason:null;Po("window.unhandledrejection",{reason:t?t.stack:e.reason}),t&&pa(t,{source:"window.unhandledrejection"})}))}var S=so(za(),1);var f=so(Cg(),1),W6="rgba(60, 60, 60, 0.78)";function Y6(){if(typeof window>"u")return null;let e=window.location.pathname.match(/^\/editor\/[^/]+\/fork\/([^/]+)\/?$/);if(!e)return null;let t=decodeURIComponent(e[1]);return t==="new"?null:t}var yJ="__VF_KENBURNS_V1__",_J=["zoom-in","zoom-out","pan-left","pan-right","pan-up","pan-down","zoom-in-left","zoom-in-right"],vJ=`/*${yJ}*/
510
- @keyframes vf-kb-zoom-in { from { transform: translate(0%, 0%) scale(1); } to { transform: translate(0%, 0%) scale(calc(1 + var(--vf-kb-amount, 0.18))); } }
511
- @keyframes vf-kb-zoom-out { from { transform: translate(0%, 0%) scale(calc(1 + var(--vf-kb-amount, 0.18))); } to { transform: translate(0%, 0%) scale(1); } }
512
- @keyframes vf-kb-pan-left { from { transform: translate(calc(var(--vf-kb-amount, 0.18) * 45%), 0%) scale(calc(1 + var(--vf-kb-amount, 0.18))); } to { transform: translate(calc(var(--vf-kb-amount, 0.18) * -45%), 0%) scale(calc(1 + var(--vf-kb-amount, 0.18))); } }
513
- @keyframes vf-kb-pan-right { from { transform: translate(calc(var(--vf-kb-amount, 0.18) * -45%), 0%) scale(calc(1 + var(--vf-kb-amount, 0.18))); } to { transform: translate(calc(var(--vf-kb-amount, 0.18) * 45%), 0%) scale(calc(1 + var(--vf-kb-amount, 0.18))); } }
514
- @keyframes vf-kb-pan-up { from { transform: translate(0%, calc(var(--vf-kb-amount, 0.18) * 45%)) scale(calc(1 + var(--vf-kb-amount, 0.18))); } to { transform: translate(0%, calc(var(--vf-kb-amount, 0.18) * -45%)) scale(calc(1 + var(--vf-kb-amount, 0.18))); } }
515
- @keyframes vf-kb-pan-down { from { transform: translate(0%, calc(var(--vf-kb-amount, 0.18) * -45%)) scale(calc(1 + var(--vf-kb-amount, 0.18))); } to { transform: translate(0%, calc(var(--vf-kb-amount, 0.18) * 45%)) scale(calc(1 + var(--vf-kb-amount, 0.18))); } }
516
- @keyframes vf-kb-zoom-in-left { from { transform: translate(0%, 0%) scale(1); } to { transform: translate(calc(var(--vf-kb-amount, 0.18) * -45%), 0%) scale(calc(1 + var(--vf-kb-amount, 0.18))); } }
517
- @keyframes vf-kb-zoom-in-right { from { transform: translate(0%, 0%) scale(1); } to { transform: translate(calc(var(--vf-kb-amount, 0.18) * 45%), 0%) scale(calc(1 + var(--vf-kb-amount, 0.18))); } }
518
- [data-kenburns] {
519
- transform-origin: var(--vf-kb-origin, 50% 50%);
520
- animation-duration: var(--vf-kb-dur, 5s);
521
- animation-timing-function: var(--vf-kb-ease, linear);
522
- animation-fill-mode: both;
523
- animation-play-state: paused;
524
- will-change: transform;
525
- backface-visibility: hidden;
526
- }
527
- [data-kenburns="zoom-in"] { animation-name: vf-kb-zoom-in; }
528
- [data-kenburns="zoom-out"] { animation-name: vf-kb-zoom-out; }
529
- [data-kenburns="pan-left"] { animation-name: vf-kb-pan-left; }
530
- [data-kenburns="pan-right"] { animation-name: vf-kb-pan-right; }
531
- [data-kenburns="pan-up"] { animation-name: vf-kb-pan-up; }
532
- [data-kenburns="pan-down"] { animation-name: vf-kb-pan-down; }
533
- [data-kenburns="zoom-in-left"] { animation-name: vf-kb-zoom-in-left; }
534
- [data-kenburns="zoom-in-right"] { animation-name: vf-kb-zoom-in-right; }
535
- `,SJ=[{value:"none",label:"None (static)"},{value:"zoom-in",label:"Zoom in"},{value:"zoom-out",label:"Zoom out"},{value:"pan-left",label:"Pan left"},{value:"pan-right",label:"Pan right"},{value:"pan-up",label:"Pan up"},{value:"pan-down",label:"Pan down"},{value:"zoom-in-left",label:"Zoom in + pan left"},{value:"zoom-in-right",label:"Zoom in + pan right"}];function EJ(e){return e&&_J.includes(e)?e:null}function pg(e,t,n){let r=EJ(t);if(!r){e.removeAttribute("data-kenburns"),e.style.removeProperty("--vf-kb-amount"),e.style.removeProperty("--vf-kb-origin"),e.style.removeProperty("--vf-kb-dur");return}e.setAttribute("data-kenburns",r);let o=Number(e.getAttribute("data-duration"));Number.isFinite(o)&&o>0&&e.style.setProperty("--vf-kb-dur",`${Number(o.toFixed(3))}s`),n!==void 0&&Number.isFinite(n)&&e.style.setProperty("--vf-kb-amount",String(Math.max(.04,Math.min(.5,n))))}function TJ(e){try{if(typeof e.getAnimations!="function")return;let t=e.ownerDocument?.defaultView,n=t?.__player&&Number(t.__player.getTime())||0,r=Number(e.getAttribute("data-start"))||0,o=Number(e.getAttribute("data-duration"))||0,i=o>0?Math.max(0,Math.min(1,(n-r)/o)):0;for(let a of e.getAnimations({subtree:!0})){let s=a.animationName;if(typeof s!="string"||s.indexOf("vf-kb-")!==0)continue;let l=Number(a.effect?.getComputedTiming?.().duration)||0;l&&(a.pause(),a.currentTime=i*l)}}catch{}}var K6="__VF_TRANSITIONS_V2__",X1=["crossfade","fade-black","fade-white","flash","smoke","blur","slide-left","slide-right","slide-up","slide-down","whip-left","whip-right","wipe-left","wipe-right","wipe-up","wipe-down","zoom-in","zoom-out","circle-open"],X6=["fade","fade-black","fade-white","flash","smoke","blur","slide-left","slide-right","slide-up","slide-down","wipe-left","wipe-right","wipe-up","wipe-down","zoom-in","zoom-out","circle-close"],wJ=`/*__VF_TRANSITIONS_V1__*/
536
- @keyframes vf-tr-crossfade { from { opacity: 0; } }
537
- @keyframes vf-tr-fade-black { 0% { opacity: 0; filter: brightness(0); } 35% { opacity: 1; filter: brightness(0); } }
538
- @keyframes vf-tr-slide-left { from { translate: 100% 0; } }
539
- @keyframes vf-tr-slide-right { from { translate: -100% 0; } }
540
- @keyframes vf-tr-slide-up { from { translate: 0 100%; } }
541
- @keyframes vf-tr-slide-down { from { translate: 0 -100%; } }
542
- @keyframes vf-tr-wipe-left { from { clip-path: inset(0 0 0 100%); } to { clip-path: inset(0 0 0 0); } }
543
- @keyframes vf-tr-wipe-right { from { clip-path: inset(0 100% 0 0); } to { clip-path: inset(0 0 0 0); } }
544
- @keyframes vf-tr-wipe-up { from { clip-path: inset(100% 0 0 0); } to { clip-path: inset(0 0 0 0); } }
545
- @keyframes vf-tr-wipe-down { from { clip-path: inset(0 0 100% 0); } to { clip-path: inset(0 0 0 0); } }
546
- @keyframes vf-tr-zoom-in { from { opacity: 0; scale: 1.18; } }
547
- @keyframes vf-tr-zoom-out { from { opacity: 0; scale: 0.82; } }
548
- @keyframes vf-tr-circle-open { from { clip-path: circle(0% at 50% 50%); } to { clip-path: circle(75% at 50% 50%); } }
549
- [data-transition] {
550
- animation-duration: var(--vf-tr-dur, 0.5s);
551
- animation-timing-function: var(--vf-tr-ease, ease-in-out);
552
- animation-fill-mode: both;
553
- animation-play-state: paused;
554
- }
555
- [data-transition="crossfade"] { animation-name: vf-tr-crossfade; }
556
- [data-transition="fade-black"] { animation-name: vf-tr-fade-black; }
557
- [data-transition="slide-left"] { animation-name: vf-tr-slide-left; }
558
- [data-transition="slide-right"] { animation-name: vf-tr-slide-right; }
559
- [data-transition="slide-up"] { animation-name: vf-tr-slide-up; }
560
- [data-transition="slide-down"] { animation-name: vf-tr-slide-down; }
561
- [data-transition="wipe-left"] { animation-name: vf-tr-wipe-left; }
562
- [data-transition="wipe-right"] { animation-name: vf-tr-wipe-right; }
563
- [data-transition="wipe-up"] { animation-name: vf-tr-wipe-up; }
564
- [data-transition="wipe-down"] { animation-name: vf-tr-wipe-down; }
565
- [data-transition="zoom-in"] { animation-name: vf-tr-zoom-in; }
566
- [data-transition="zoom-out"] { animation-name: vf-tr-zoom-out; }
567
- [data-transition="circle-open"] { animation-name: vf-tr-circle-open; }
568
- `,J6=`/*${K6}*/
569
- @keyframes vf-tr-crossfade { from { opacity: 0; } }
570
- @keyframes vf-tr-fade-black { 0% { opacity: 0; filter: brightness(0); } 35% { opacity: 1; filter: brightness(0); } }
571
- @keyframes vf-tr-fade-white { 0% { opacity: 0; filter: saturate(0.55) brightness(3); } 45% { opacity: 1; filter: saturate(0.7) brightness(2.1); } }
572
- @keyframes vf-tr-flash { 0% { filter: saturate(0.3) brightness(5); } 55% { filter: saturate(0.9) brightness(1.6); } }
573
- @keyframes vf-tr-smoke { 0% { opacity: 0; filter: blur(26px) saturate(0.65) brightness(1.55); } 55% { opacity: 1; } }
574
- @keyframes vf-tr-blur { from { opacity: 0; filter: blur(16px); } }
575
- @keyframes vf-tr-slide-left { from { translate: 100% 0; } }
576
- @keyframes vf-tr-slide-right { from { translate: -100% 0; } }
577
- @keyframes vf-tr-slide-up { from { translate: 0 100%; } }
578
- @keyframes vf-tr-slide-down { from { translate: 0 -100%; } }
579
- @keyframes vf-tr-whip-left { 0% { translate: 110% 0; filter: blur(14px); } 60% { filter: blur(5px); } }
580
- @keyframes vf-tr-whip-right { 0% { translate: -110% 0; filter: blur(14px); } 60% { filter: blur(5px); } }
581
- @keyframes vf-tr-wipe-left { from { clip-path: inset(0 0 0 100%); } to { clip-path: inset(0 0 0 0); } }
582
- @keyframes vf-tr-wipe-right { from { clip-path: inset(0 100% 0 0); } to { clip-path: inset(0 0 0 0); } }
583
- @keyframes vf-tr-wipe-up { from { clip-path: inset(100% 0 0 0); } to { clip-path: inset(0 0 0 0); } }
584
- @keyframes vf-tr-wipe-down { from { clip-path: inset(0 0 100% 0); } to { clip-path: inset(0 0 0 0); } }
585
- @keyframes vf-tr-zoom-in { from { opacity: 0; scale: 1.18; } }
586
- @keyframes vf-tr-zoom-out { from { opacity: 0; scale: 0.82; } }
587
- @keyframes vf-tr-circle-open { from { clip-path: circle(0% at 50% 50%); } to { clip-path: circle(75% at 50% 50%); } }
588
- @keyframes vf-tr-out-fade { to { opacity: 0; } }
589
- @keyframes vf-tr-out-fade-black { to { filter: brightness(0); } }
590
- @keyframes vf-tr-out-fade-white { to { filter: saturate(0.35) brightness(6); } }
591
- @keyframes vf-tr-out-flash { 65% { filter: brightness(1); } 100% { filter: saturate(0.3) brightness(5); } }
592
- @keyframes vf-tr-out-smoke { to { opacity: 0; filter: blur(24px) saturate(0.7) brightness(1.5); } }
593
- @keyframes vf-tr-out-blur { to { opacity: 0; filter: blur(16px); } }
594
- @keyframes vf-tr-out-slide-left { to { translate: -100% 0; } }
595
- @keyframes vf-tr-out-slide-right { to { translate: 100% 0; } }
596
- @keyframes vf-tr-out-slide-up { to { translate: 0 -100%; } }
597
- @keyframes vf-tr-out-slide-down { to { translate: 0 100%; } }
598
- @keyframes vf-tr-out-wipe-left { from { clip-path: inset(0 0 0 0); } to { clip-path: inset(0 100% 0 0); } }
599
- @keyframes vf-tr-out-wipe-right { from { clip-path: inset(0 0 0 0); } to { clip-path: inset(0 0 0 100%); } }
600
- @keyframes vf-tr-out-wipe-up { from { clip-path: inset(0 0 0 0); } to { clip-path: inset(0 0 100% 0); } }
601
- @keyframes vf-tr-out-wipe-down { from { clip-path: inset(0 0 0 0); } to { clip-path: inset(100% 0 0 0); } }
602
- @keyframes vf-tr-out-zoom-in { to { opacity: 0; scale: 1.18; } }
603
- @keyframes vf-tr-out-zoom-out { to { opacity: 0; scale: 0.82; } }
604
- @keyframes vf-tr-out-circle-close { from { clip-path: circle(75% at 50% 50%); } to { clip-path: circle(0% at 50% 50%); } }
605
- [data-transition], [data-transition-out] {
606
- animation-name: var(--vf-tr-in-name, none), var(--vf-tr-out-name, none);
607
- animation-duration: var(--vf-tr-dur, 0.5s), var(--vf-tr-out-dur, 0.5s);
608
- animation-delay: 0s, var(--vf-tr-out-delay, 0s);
609
- animation-timing-function: var(--vf-tr-ease, ease-in-out), var(--vf-tr-out-ease, ease-in-out);
610
- animation-fill-mode: both, both;
611
- animation-play-state: paused, paused;
612
- }
613
- [data-kenburns][data-transition], [data-kenburns][data-transition-out] {
614
- animation-name: var(--vf-kb-name, none), var(--vf-tr-in-name, none), var(--vf-tr-out-name, none);
615
- animation-duration: var(--vf-kb-dur, 5s), var(--vf-tr-dur, 0.5s), var(--vf-tr-out-dur, 0.5s);
616
- animation-delay: 0s, 0s, var(--vf-tr-out-delay, 0s);
617
- animation-timing-function: var(--vf-kb-ease, linear), var(--vf-tr-ease, ease-in-out), var(--vf-tr-out-ease, ease-in-out);
618
- animation-fill-mode: both, both, both;
619
- animation-play-state: paused, paused, paused;
620
- }
621
- [data-kenburns="zoom-in"] { --vf-kb-name: vf-kb-zoom-in; }
622
- [data-kenburns="zoom-out"] { --vf-kb-name: vf-kb-zoom-out; }
623
- [data-kenburns="pan-left"] { --vf-kb-name: vf-kb-pan-left; }
624
- [data-kenburns="pan-right"] { --vf-kb-name: vf-kb-pan-right; }
625
- [data-kenburns="pan-up"] { --vf-kb-name: vf-kb-pan-up; }
626
- [data-kenburns="pan-down"] { --vf-kb-name: vf-kb-pan-down; }
627
- [data-kenburns="zoom-in-left"] { --vf-kb-name: vf-kb-zoom-in-left; }
628
- [data-kenburns="zoom-in-right"] { --vf-kb-name: vf-kb-zoom-in-right; }
629
- [data-transition="crossfade"] { --vf-tr-in-name: vf-tr-crossfade; }
630
- [data-transition="fade-black"] { --vf-tr-in-name: vf-tr-fade-black; }
631
- [data-transition="fade-white"] { --vf-tr-in-name: vf-tr-fade-white; }
632
- [data-transition="flash"] { --vf-tr-in-name: vf-tr-flash; --vf-tr-ease: cubic-bezier(0.3, 0, 0.55, 1); }
633
- [data-transition="smoke"] { --vf-tr-in-name: vf-tr-smoke; --vf-tr-ease: cubic-bezier(0.25, 0.4, 0.3, 1); }
634
- [data-transition="blur"] { --vf-tr-in-name: vf-tr-blur; }
635
- [data-transition="slide-left"] { --vf-tr-in-name: vf-tr-slide-left; --vf-tr-ease: cubic-bezier(0.22, 1, 0.36, 1); }
636
- [data-transition="slide-right"] { --vf-tr-in-name: vf-tr-slide-right; --vf-tr-ease: cubic-bezier(0.22, 1, 0.36, 1); }
637
- [data-transition="slide-up"] { --vf-tr-in-name: vf-tr-slide-up; --vf-tr-ease: cubic-bezier(0.22, 1, 0.36, 1); }
638
- [data-transition="slide-down"] { --vf-tr-in-name: vf-tr-slide-down; --vf-tr-ease: cubic-bezier(0.22, 1, 0.36, 1); }
639
- [data-transition="whip-left"] { --vf-tr-in-name: vf-tr-whip-left; --vf-tr-ease: cubic-bezier(0.16, 1, 0.3, 1); }
640
- [data-transition="whip-right"] { --vf-tr-in-name: vf-tr-whip-right; --vf-tr-ease: cubic-bezier(0.16, 1, 0.3, 1); }
641
- [data-transition="wipe-left"] { --vf-tr-in-name: vf-tr-wipe-left; --vf-tr-ease: cubic-bezier(0.45, 0.05, 0.35, 0.95); }
642
- [data-transition="wipe-right"] { --vf-tr-in-name: vf-tr-wipe-right; --vf-tr-ease: cubic-bezier(0.45, 0.05, 0.35, 0.95); }
643
- [data-transition="wipe-up"] { --vf-tr-in-name: vf-tr-wipe-up; --vf-tr-ease: cubic-bezier(0.45, 0.05, 0.35, 0.95); }
644
- [data-transition="wipe-down"] { --vf-tr-in-name: vf-tr-wipe-down; --vf-tr-ease: cubic-bezier(0.45, 0.05, 0.35, 0.95); }
645
- [data-transition="zoom-in"] { --vf-tr-in-name: vf-tr-zoom-in; --vf-tr-ease: cubic-bezier(0.16, 1, 0.3, 1); }
646
- [data-transition="zoom-out"] { --vf-tr-in-name: vf-tr-zoom-out; --vf-tr-ease: cubic-bezier(0.16, 1, 0.3, 1); }
647
- [data-transition="circle-open"] { --vf-tr-in-name: vf-tr-circle-open; --vf-tr-ease: cubic-bezier(0.3, 0.6, 0.3, 1); }
648
- [data-transition-out="fade"] { --vf-tr-out-name: vf-tr-out-fade; }
649
- [data-transition-out="fade-black"] { --vf-tr-out-name: vf-tr-out-fade-black; }
650
- [data-transition-out="fade-white"] { --vf-tr-out-name: vf-tr-out-fade-white; }
651
- [data-transition-out="flash"] { --vf-tr-out-name: vf-tr-out-flash; --vf-tr-out-ease: cubic-bezier(0.45, 0, 0.7, 0.4); }
652
- [data-transition-out="smoke"] { --vf-tr-out-name: vf-tr-out-smoke; --vf-tr-out-ease: cubic-bezier(0.7, 0, 0.75, 0.6); }
653
- [data-transition-out="blur"] { --vf-tr-out-name: vf-tr-out-blur; }
654
- [data-transition-out="slide-left"] { --vf-tr-out-name: vf-tr-out-slide-left; --vf-tr-out-ease: cubic-bezier(0.55, 0.06, 0.68, 0.19); }
655
- [data-transition-out="slide-right"] { --vf-tr-out-name: vf-tr-out-slide-right; --vf-tr-out-ease: cubic-bezier(0.55, 0.06, 0.68, 0.19); }
656
- [data-transition-out="slide-up"] { --vf-tr-out-name: vf-tr-out-slide-up; --vf-tr-out-ease: cubic-bezier(0.55, 0.06, 0.68, 0.19); }
657
- [data-transition-out="slide-down"] { --vf-tr-out-name: vf-tr-out-slide-down; --vf-tr-out-ease: cubic-bezier(0.55, 0.06, 0.68, 0.19); }
658
- [data-transition-out="wipe-left"] { --vf-tr-out-name: vf-tr-out-wipe-left; --vf-tr-out-ease: cubic-bezier(0.45, 0.05, 0.35, 0.95); }
659
- [data-transition-out="wipe-right"] { --vf-tr-out-name: vf-tr-out-wipe-right; --vf-tr-out-ease: cubic-bezier(0.45, 0.05, 0.35, 0.95); }
660
- [data-transition-out="wipe-up"] { --vf-tr-out-name: vf-tr-out-wipe-up; --vf-tr-out-ease: cubic-bezier(0.45, 0.05, 0.35, 0.95); }
661
- [data-transition-out="wipe-down"] { --vf-tr-out-name: vf-tr-out-wipe-down; --vf-tr-out-ease: cubic-bezier(0.45, 0.05, 0.35, 0.95); }
662
- [data-transition-out="zoom-in"] { --vf-tr-out-name: vf-tr-out-zoom-in; --vf-tr-out-ease: cubic-bezier(0.5, 0, 0.75, 0.4); }
663
- [data-transition-out="zoom-out"] { --vf-tr-out-name: vf-tr-out-zoom-out; --vf-tr-out-ease: cubic-bezier(0.5, 0, 0.75, 0.4); }
664
- [data-transition-out="circle-close"] { --vf-tr-out-name: vf-tr-out-circle-close; --vf-tr-out-ease: cubic-bezier(0.6, 0, 0.7, 0.4); }
665
- `,ik=[{value:"none",label:"None (hard cut)"},{value:"crossfade",label:"Crossfade"},{value:"fade-black",label:"Fade through black"},{value:"fade-white",label:"Fade through white"},{value:"flash",label:"Flash"},{value:"smoke",label:"Smoke"},{value:"blur",label:"Blur dissolve"},{value:"slide-left",label:"Slide left"},{value:"slide-right",label:"Slide right"},{value:"slide-up",label:"Slide up"},{value:"slide-down",label:"Slide down"},{value:"whip-left",label:"Whip left"},{value:"whip-right",label:"Whip right"},{value:"wipe-left",label:"Wipe left"},{value:"wipe-right",label:"Wipe right"},{value:"wipe-up",label:"Wipe up"},{value:"wipe-down",label:"Wipe down"},{value:"zoom-in",label:"Zoom in"},{value:"zoom-out",label:"Zoom out"},{value:"circle-open",label:"Circle open"}],ak=[{value:"none",label:"None (hard cut)"},{value:"fade",label:"Fade out"},{value:"fade-black",label:"Fade to black"},{value:"fade-white",label:"Fade to white"},{value:"flash",label:"Flash out"},{value:"smoke",label:"Smoke out"},{value:"blur",label:"Blur out"},{value:"slide-left",label:"Slide out left"},{value:"slide-right",label:"Slide out right"},{value:"slide-up",label:"Slide out up"},{value:"slide-down",label:"Slide out down"},{value:"wipe-left",label:"Wipe out left"},{value:"wipe-right",label:"Wipe out right"},{value:"wipe-up",label:"Wipe out up"},{value:"wipe-down",label:"Wipe out down"},{value:"zoom-in",label:"Zoom out (push in)"},{value:"zoom-out",label:"Zoom out (pull back)"},{value:"circle-close",label:"Circle close"}],Q6=.5;function J1(e){return e&&X1.includes(e)?e:null}function Z6(e){return e&&X6.includes(e)?e:null}function Js(e){return e===void 0||!Number.isFinite(e)||e<=0?Q6:Math.max(.1,Math.min(2.5,e))}function Qs(e,t,n){let r=J1(t);if(!r){e.removeAttribute("data-transition"),e.removeAttribute("data-transition-duration"),e.style.removeProperty("--vf-tr-dur");return}let o=Number(e.getAttribute("data-transition-duration")),i=Js(n!==void 0?n:Number.isFinite(o)?o:void 0);e.setAttribute("data-transition",r),e.setAttribute("data-transition-duration",String(Number(i.toFixed(3)))),e.style.setProperty("--vf-tr-dur",`${Number(i.toFixed(3))}s`)}function Ec(e,t,n){let r=Z6(t);if(!r){e.removeAttribute("data-transition-out"),e.removeAttribute("data-transition-out-duration"),e.style.removeProperty("--vf-tr-out-dur"),e.style.removeProperty("--vf-tr-out-delay");return}let o=Number(e.getAttribute("data-transition-out-duration")),i=Js(n!==void 0?n:Number.isFinite(o)?o:void 0),a=Number(e.getAttribute("data-duration"))||0,s=Math.max(0,Number((a-i).toFixed(3)));e.setAttribute("data-transition-out",r),e.setAttribute("data-transition-out-duration",String(Number(i.toFixed(3)))),e.style.setProperty("--vf-tr-out-dur",`${Number(i.toFixed(3))}s`),e.style.setProperty("--vf-tr-out-delay",`${s}s`)}function Q1(e){try{if(typeof e.getAnimations!="function")return;let t=e.ownerDocument?.defaultView,n=t?.__player&&Number(t.__player.getTime())||0,r=Number(e.getAttribute("data-start"))||0,o=Math.max(0,n-r)*1e3;for(let i of e.getAnimations({subtree:!0})){let a=i.animationName;typeof a!="string"||a.indexOf("vf-tr-")!==0||(i.pause(),i.currentTime=o)}}catch{}}var xJ="__VF_CAPTIONS_V1__",e4=["highlight-pop","karaoke-fill","word-pop","cumulative-reveal","glow-pulse","bounce-wave"],kJ=`/*${xJ}*/
666
- [data-caption-animation] [data-cap-word] {
667
- display:inline-block;
668
- animation-play-state:paused;
669
- animation-timing-function:ease-out;
670
- animation-fill-mode:none;
671
- will-change:transform,opacity;
672
- }
673
- [data-caption-uppercase="1"] { text-transform:uppercase; }
674
- @keyframes vf-cap-highlight { 14%, 100% { background-color:var(--vf-cap-hl, #7C3AED); color:var(--vf-cap-active, #FFFFFF); transform:scale(1.06); } }
675
- [data-caption-animation="highlight-pop"] [data-cap-word] { animation-name:vf-cap-highlight; padding:0.08em 0.18em; margin:-0.08em -0.05em; border-radius:0.3em; }
676
- @keyframes vf-cap-karaoke { to { color:var(--vf-cap-active, #FFE14D); } }
677
- [data-caption-animation="karaoke-fill"] [data-cap-word] { animation-name:vf-cap-karaoke; animation-fill-mode:forwards; animation-timing-function:linear; }
678
- @keyframes vf-cap-word-pop { 0% { opacity:0; transform:scale(0.45); } 22% { opacity:1; transform:scale(1.14); } 38%, 100% { opacity:1; transform:scale(1); } }
679
- [data-caption-animation="word-pop"] [data-vf-text-inline] { display:grid; place-items:center; }
680
- [data-caption-animation="word-pop"] [data-cap-word] { animation-name:vf-cap-word-pop; opacity:0; grid-area:1 / 1; }
681
- @keyframes vf-cap-reveal { from { opacity:0; transform:translateY(0.4em); } 40%, 100% { opacity:1; transform:none; } }
682
- [data-caption-animation="cumulative-reveal"] [data-cap-word] { animation-name:vf-cap-reveal; animation-fill-mode:forwards; opacity:0; }
683
- @keyframes vf-cap-glow { 20%, 80% { color:var(--vf-cap-active, #9BFF57); text-shadow:0 0 0.14em var(--vf-cap-active, #9BFF57), 0 0 0.5em var(--vf-cap-active, #9BFF57); transform:scale(1.04); } }
684
- [data-caption-animation="glow-pulse"] [data-cap-word] { animation-name:vf-cap-glow; }
685
- @keyframes vf-cap-bounce { 25% { transform:translateY(-0.22em) scale(1.08); } 55% { transform:translateY(0.05em); } 75% { transform:none; } }
686
- [data-caption-animation="bounce-wave"] [data-cap-word] { animation-name:vf-cap-bounce; }
687
- `,L_=[{id:"spotlight",label:"Spotlight",animation:"highlight-pop",color:"#ffffff",background:"#000000",textBackgroundStyle:"outline",highlightColor:"#7C3AED",activeColor:"#ffffff",fontWeight:800,uppercase:!0},{id:"karaoke",label:"Karaoke",animation:"karaoke-fill",color:"#ffffff",background:"#000000",textBackgroundStyle:"outline",activeColor:"#FFE14D",fontWeight:800},{id:"word-pop",label:"Word Pop",animation:"word-pop",color:"#ffffff",background:"#000000",textBackgroundStyle:"outline",fontWeight:900,uppercase:!0},{id:"stack-up",label:"Stack Up",animation:"cumulative-reveal",color:"#ffffff",background:"#000000",textBackgroundStyle:"highlight-translucent",fontWeight:700},{id:"neon",label:"Neon Glow",animation:"glow-pulse",color:"#eafff1",background:"#04140a",textBackgroundStyle:"plain",activeColor:"#9BFF57",fontWeight:800,uppercase:!0},{id:"bounce",label:"Bounce",animation:"bounce-wave",color:"#FFE14D",background:"#000000",textBackgroundStyle:"outline",activeColor:"#FFE14D",fontWeight:900,uppercase:!0}];function t4(e){return e&&e4.includes(e)?e:null}function sk(e,t){let n=String(e||"").trim().split(/\s+/).filter(Boolean),r=Number.isFinite(t)&&t>0?t:n.length*.32;if(!n.length)return[];let o=n.map(l=>Math.max(2,l.length)+1.5),i=o.reduce((l,c)=>l+c,0),a=[],s=0;for(let l=0;l<n.length;l+=1){let c=o[l]/i*r,d=Math.min(.03,c*.1);a.push({text:n[l],start:Number(s.toFixed(3)),end:Number(Math.max(s+.05,s+c-d).toFixed(3))}),s+=c}return a}function n4(e){return Array.from(e.querySelectorAll("[data-cap-word]")).map(t=>({text:(t.textContent||"").trim(),start:Number(t.getAttribute("data-word-start"))||0,end:Number(t.getAttribute("data-word-end"))||0})).filter(t=>t.text)}function lk(e){let t=n4(e);return t.length?t.map(n=>n.text).join(" "):e.querySelector("[data-vf-text-inline]")?.textContent||e.textContent||""}function ck(e,t,n){if(!e.hasAttribute("data-caption-animation"))return;let r=e.querySelector("[data-vf-text-inline]");if(!r)return;let o=n4(e),i=t!==void 0?t:o.length?o.map(c=>c.text).join(" "):r.textContent||"",a=String(i||"").trim().split(/\s+/).filter(Boolean),s;if(n&&n.length)s=n;else if(o.length===a.length&&o.every((c,d)=>c.text===a[d])&&o.some(c=>c.end>c.start))s=o;else{let c=Number(e.getAttribute("data-duration"))||0;s=sk(a.join(" "),c)}r.textContent="";let l=e.ownerDocument;s.forEach((c,d)=>{let u=l.createElement("span");u.setAttribute("data-cap-word","true"),u.setAttribute("data-word-start",String(Number(c.start.toFixed(3)))),u.setAttribute("data-word-end",String(Number(c.end.toFixed(3)))),u.style.animationDelay=`${Number(c.start.toFixed(3))}s`,u.style.animationDuration=`${Number(Math.max(.05,c.end-c.start).toFixed(3))}s`,u.textContent=c.text,d>0&&r.append(l.createTextNode(" ")),r.append(u)})}function mg(e,t,n){let r=t4(t);if(!r){let o=lk(e).trim();e.removeAttribute("data-caption-animation"),e.hasAttribute("data-caption-uppercase")&&(e.removeAttribute("data-caption-uppercase"),e.style.textTransform="none"),e.style.removeProperty("--vf-cap-active"),e.style.removeProperty("--vf-cap-hl");let i=e.querySelector("[data-vf-text-inline]");i&&o&&(i.textContent=o);return}e.setAttribute("data-caption-animation",r),n?.uppercase!==void 0&&(n.uppercase?e.setAttribute("data-caption-uppercase","1"):e.removeAttribute("data-caption-uppercase"),e.style.textTransform=n.uppercase?"uppercase":"none"),n?.activeColor&&e.style.setProperty("--vf-cap-active",n.activeColor),n?.highlightColor&&e.style.setProperty("--vf-cap-hl",n.highlightColor),ck(e,n?.text,n?.words)}function uk(e){if(!e)return null;let t=String(e).trim().toLowerCase();return L_.find(n=>n.id===t)||null}function r4(e,t,n){let r=dk(n.background_style??t?.textBackgroundStyle??e.getAttribute("data-text-background-style")??"plain"),o=n.color??t?.color??(e.style.color||"#ffffff"),i=n.background??t?.background??e.getAttribute("data-text-background-color")??"#000000",a=n.font_family??e.getAttribute("data-font-family")??"Montserrat",s=n.font_weight??t?.fontWeight??700,l=lk(e);e.style.color=o,e.style.fontWeight=String(s),tl(e,l,r,o,i,a,s)}function E6(e){try{if(typeof e.getAnimations!="function")return;let t=e.ownerDocument?.defaultView,n=t?.__player&&Number(t.__player.getTime())||0,r=Number(e.getAttribute("data-start"))||0,o=Math.max(0,n-r)*1e3;for(let i of e.getAnimations({subtree:!0})){let a=i.animationName;typeof a!="string"||a.indexOf("vf-cap-")!==0||(i.pause(),i.currentTime=o)}}catch{}}var Z1=class extends S.Component{state={error:null};static getDerivedStateFromError(t){return{error:t instanceof Error?t.message:String(t)}}componentDidCatch(t,n){Po("react.editor-boundary",{error:t instanceof Error?t.stack:t,componentStack:n.componentStack}),t instanceof Error&&pa(t,{source:"EditorErrorBoundary",componentStack:n.componentStack})}render(){return this.state.error?(0,f.jsxs)("section",{className:"editor-loading-shell","aria-label":"Editor crashed",children:[(0,f.jsx)("span",{children:"Editor view crashed"}),(0,f.jsx)("small",{children:this.state.error})]}):this.props.children}};function Ks({label:e="Loading"}){return(0,f.jsx)("span",{className:"vf-inline-spinner",role:"status","aria-label":e})}function AJ(e,t){return e==="SUCCEEDED"?"succeeded":t||e==="FAILED"||e==="TIMED_OUT"||e==="ABORTED"?"failed":"running"}function o4(e,t){return{phase:AJ(e.status,e.fatalErrorEncountered),title:e.title||t,renderId:e.renderId,version:typeof e.version=="number"?e.version:void 0,status:e.status,progress:typeof e.progress=="number"?e.progress:0,framesRendered:e.framesRendered,totalFrames:e.totalFrames,lambdasInvoked:e.lambdasInvoked,cost:e.cost,outputS3Uri:e.outputS3Uri,outputUrl:e.outputUrl,error:e.error,errors:e.errors}}function i4(e){return Math.max(0,Math.min(100,Math.round((e.progress??0)*100)))}var lg="/media/inspiration-posts/simple-video/best-at-what-cost.mp4",ng=54.533333,IJ={shellBackground:"#0d100c",shellBorder:"#252c23",clipBackground:"#78C25E",clipBackgroundActive:"#F2CD46",clipBorderActive:"#F2CD46",textPrimary:"#f5f1e8",textSecondary:"#a7aea2"},E_=32,B1=24,T_=48,a4=["TikTok Sans","Montserrat","Source Code Pro","Yesteryear","Georgia","Abel"],s4=[{id:"plain",label:"No border"},{id:"outline",label:"Text border"},{id:"highlight-solid",label:"Solid highlight"},{id:"highlight-translucent",label:"Translucent highlight"},{id:"fullwidth",label:"Fullwidth"}],NJ='@import url("https://fonts.googleapis.com/css2?family=Abel&family=Montserrat:wght@600&family=Source+Code+Pro:wght@700&family=TikTok+Sans:wght@400;600;700;800;900&family=Yesteryear&display=swap");',z1=null,F1=null;function N_(){return z1=z1??import("./chunks/dist-ADSJKBVE.js"),z1}function RJ(){if(typeof window>"u")return N_(),()=>{};let e=window;if(e.requestIdleCallback){let n=e.requestIdleCallback(()=>{N_()},{timeout:1200});return()=>e.cancelIdleCallback?.(n)}let t=window.setTimeout(()=>{N_()},80);return()=>window.clearTimeout(t)}function CJ(){if(typeof window>"u"||typeof document>"u")return()=>{};let e=()=>{if(F1)return;let n=document.createElement("video");n.preload="auto",n.muted=!0,n.playsInline=!0,n.src=lg,n.setAttribute("aria-hidden","true"),n.style.cssText="position:absolute;width:1px;height:1px;opacity:0;pointer-events:none;left:-9999px;top:0;",document.body.append(n),F1=n;try{n.load()}catch{n.remove(),F1=null}},t=window.setTimeout(e,120);return()=>window.clearTimeout(t)}function C_(e){let t=(e??"").split(",")[0].replaceAll('"',"").replaceAll("'","").trim();return a4.find(n=>n.toLowerCase()===t.toLowerCase())??"TikTok Sans"}function Zs(e){return e==="Georgia"?"Georgia":`'${e}'`}function el(e){return e==="Georgia"||e==="Source Code Pro"?700:e==="Montserrat"?600:900}function MJ(e,t){let n=Number.parseInt(e??"",10);return Number.isFinite(n)?Math.max(100,Math.min(900,n)):t}function OJ(e){return e==="Georgia"?"Georgia Bold":e==="Montserrat"?"Montserrat Semibold":e==="Source Code Pro"?"Source Code Pro Bold":e}function l4(e,t,n=el(t)){let r=`${Zs(t)}, 'TikTok Sans'`,o=String(n),i=[e,...Array.from(e.querySelectorAll("[data-vf-text-lines], [data-vf-text-inline]"))];for(let a of i)a.style.setProperty("font-family",r),a.style.setProperty("font-weight",o)}function dk(e){return s4.some(t=>t.id===e)?e:"highlight-solid"}function fk(e,t){let n=e.trim(),r=n.startsWith("#")?n.slice(1):"";if(r.length===3||r.length===6){let o=r.length===3?r.split("").map(a=>a+a).join(""):r,i=Number.parseInt(o,16);if(Number.isFinite(i)){let a=i>>16&255,s=i>>8&255,l=i&255;return`rgba(${a}, ${s}, ${l}, ${t})`}}return n.startsWith("rgba(")||n.startsWith("rgb(")?n:`rgba(0, 0, 0, ${t})`}function c4(e,t,n,r,o){let i=["display:inline","box-decoration-break:clone","-webkit-box-decoration-break:clone","line-height:inherit"];return e==="plain"&&i.push("padding:0","border-radius:0","background:transparent","text-shadow:none","-webkit-text-stroke:0 transparent"),e==="outline"&&i.push("padding:0","border-radius:0","background:transparent",`text-shadow:2px 0 ${n},-2px 0 ${n},0 2px ${n},0 -2px ${n},1.5px 1.5px ${n},-1.5px 1.5px ${n},1.5px -1.5px ${n},-1.5px -1.5px ${n}`,`-webkit-text-stroke:1.5px ${n}`,"paint-order:stroke fill"),e==="highlight-solid"&&i.push("padding:0.07em 0.46em 0.09em","border-radius:0.32em",`background:${n}`,"text-shadow:none","-webkit-text-stroke:0 transparent"),e==="highlight-translucent"&&i.push("padding:0.07em 0.46em 0.09em","border-radius:0.32em",`background:${fk(n,.34)}`,"text-shadow:none","-webkit-text-stroke:0 transparent"),e==="fullwidth"&&i.push("padding:0","border-radius:0","background:transparent","text-shadow:none","-webkit-text-stroke:0 transparent"),r&&i.push(`font-family:${Zs(r)}, 'TikTok Sans'`),o&&i.push(`font-weight:${o}`),i.push(`color:${t}`),i.join(";")}function u4(e){let t=["display:block","max-width:100%","text-align:inherit","line-height:1.48","white-space:pre-wrap","overflow:visible"];return e==="fullwidth"&&t.push("width:100%","box-sizing:border-box","padding:0.18em 0.5em",`background:${W6}`),t.join(";")}function tl(e,t,n,r,o,i,a){e.textContent="",e.style.background="transparent",e.setAttribute("data-text-background-style",n),e.setAttribute("data-text-background-color",o),i&&(e.setAttribute("data-font-family",i),e.style.fontFamily=`${Zs(i)}, 'TikTok Sans'`),a&&(e.style.fontWeight=String(a));let s=e.ownerDocument.createElement("span");s.setAttribute("data-vf-text-lines","true"),s.style.cssText=u4(n);let l=e.ownerDocument.createElement("span");l.setAttribute("data-vf-text-inline","true"),i&&l.setAttribute("data-font-family",i),l.style.cssText=c4(n,r,o,i,a),l.textContent=t,s.append(l),e.append(s)}function M_(e){let t=Number.isFinite(e)&&e>0?e:0,n=Math.floor(t/60),r=Math.floor(t%60);return`${n}:${r.toString().padStart(2,"0")}`}function Ys(e){let t=Number.isFinite(e)&&e>0?e:0,n=Math.round(t*100),r=Math.floor(n/6e3),o=Math.floor(n%6e3/100),i=n%100;return[r.toString().padStart(2,"0"),o.toString().padStart(2,"0"),i.toString().padStart(2,"0")].join(":")}function T6(e){let t=e.trim().split(":");if(t.length!==3)return null;let[n,r,o]=t,i=Number(n),a=Number(r),s=Number(o);return!Number.isFinite(i)||!Number.isFinite(a)||!Number.isFinite(s)||i<0||a<0||a>=60||s<0||s>=100?null:i*60+a+s/100}function Re(e,t,n){return Math.max(t,Math.min(n,e))}var cg=[{id:"source-video",label:"best-at-what-cost.mp4",kind:"video",mode:"both",start:0,duration:ng,track:0,z:0,viralNote:"Dominant source footage is the proof layer. It makes the cost feel physically real.",src:lg},{id:"source-audio",label:"Original audio",kind:"audio",mode:"both",start:0,duration:ng,track:1,z:1,viralNote:"Native source audio stays separate from the visual layer so it can be muted, replaced, or timed independently.",src:lg,volume:1,muted:!1},{id:"caption-hook-promise",label:"Original hook caption",kind:"caption",mode:"publish",start:0,duration:8.2,track:2,z:8,viralNote:"Persistent lowercase caption frames the destination as desirable while immediately introducing the cost.",text:`best beach in vancouver
688
- but at what cost`,color:"#ffffff",background:"#000000",textBackgroundStyle:"plain",fontFamily:"Montserrat",fontWeight:600,fontSize:32,radius:0,x:13.5,width:73,y:47.25,height:10.5},{id:"caption-descent-tension",label:"Descent tension caption",kind:"caption",mode:"publish",start:8.2,duration:33.8,track:2,z:8,viralNote:"The same caption stays on-screen through the stair descent so the viewer keeps measuring payoff against effort.",text:`best beach in vancouver
689
- but at what cost`,color:"#ffffff",background:"#000000",textBackgroundStyle:"plain",fontFamily:"Montserrat",fontWeight:600,fontSize:32,radius:0,x:13.5,width:73,y:47.25,height:10.5},{id:"caption-payoff-context",label:"Payoff context caption",kind:"caption",mode:"publish",start:42,duration:ng-42,track:2,z:8,viralNote:"The caption persists into the beach reveal, preserving the cost-versus-reward question until the payoff lands.",text:`best beach in vancouver
690
- but at what cost`,color:"#ffffff",background:"#000000",textBackgroundStyle:"plain",fontFamily:"Montserrat",fontWeight:600,fontSize:32,radius:0,x:13.5,width:73,y:47.25,height:10.5}],uf={hook:"A high-reward claim is immediately paired with physical cost: the viewer wants to know whether the beach is worth the stairs.",retention:"The long stair descent creates escalating proof and makes the payoff feel earned.",payoff:"The beach reveal resolves the cost-benefit question.",preserve:["Persistent lowercase white caption: destination promise versus visible effort.","Source video remains dominant so the proof is experiential, not decorative.","The timeline must hold tension through the descent before the reveal.","The payoff must arrive late enough to reward retention."],avoid:["Do not cover the stair footage with large decorative panels.","Do not reveal the beach payoff too early.","Do not replace the physical-cost proof with unrelated b-roll."]},ug=[{id:"hard-video",eyebrow:"Hard Video",title:"drafts/inspiration-posts/hard-video/ssstik.io_@asimon313__1782769678573.mp4",sourceFolder:"drafts/inspiration-posts/hard-video",sourceType:"video",duration:12.7,width:720,height:1280,summary:"A wedding dance-floor reference with scene cuts and an editable top comment screenshot hook.",media:{type:"video",src:"/drafts/inspiration-posts/hard-video/ssstik.io_@asimon313__1782769678573.mp4"},viralDna:{hook:"A pinned comment screenshot creates the social dare before the dance payoff.",retention:"Scene cuts move from living-room practice to wedding-floor crowd energy while the comment stays visible.",payoff:"The wedding dance resolves the comment's relationship prediction.",preserve:["Keep the top comment as editable HTML.","Keep the living-room setup and wedding payoff as separate scene clips.","Keep source audio separately editable."],avoid:["Do not flatten the comment into the video.","Do not cover the dancers with oversized UI.","Do not remove the practice-to-wedding contrast."]},layers:[{id:"hard-video-scene-1",kind:"video",label:"Living-room dance hook",note:"Introduces the couple dancing under the comment dare.",start:0,duration:3.566667},{id:"hard-video-scene-2",kind:"video",label:"Wedding dance reveal",note:"Hard cut from practice to wedding-floor payoff.",start:3.566667,duration:3.033333},{id:"hard-video-scene-3",kind:"video",label:"Crowd energy escalation",note:"Keeps the relationship payoff alive through public reaction.",start:6.6,duration:2.6},{id:"hard-video-scene-4",kind:"video",label:"Bride spin payoff",note:"Final energetic proof that the comment was right.",start:9.2,duration:3.5},{id:"hard-video-audio",kind:"audio",label:"Original audio",note:"Continuous source audio across the scene split.",start:0,duration:12.7},{id:"hard-video-comment",kind:"shape",label:"Pinned TikTok comment screenshot",note:"Editable deterministic HTML recreation of the comment screenshot.",start:0,duration:12.7}],editable:!0},{id:"medium-easy-video",eyebrow:"Medium Easy Video",title:"drafts/inspiration-posts/medium-easy-video/ssstik.io_@indeed_au_1782770164389.mp4",sourceFolder:"drafts/inspiration-posts/medium-easy-video",sourceType:"video",duration:12.833333,width:576,height:1024,summary:"A Gen Z workplace-reply meme decomposed into a face-reaction scene, caption, and slow-zoom screenshot images.",media:{type:"video",src:"/drafts/inspiration-posts/medium-easy-video/ssstik.io_@indeed_au_1782770164389.mp4"},viralDna:{hook:"A face reaction labeled 'gen z' frames the screenshots as a workplace-email joke.",retention:"Short screenshot beats reveal increasingly blunt reply lines with slow zoom movement.",payoff:"The tip-screen screenshot turns the joke into a payment UI punchline.",preserve:["Keep the first face scene as live source video.","Keep the 'gen z' caption editable.","Use separate image layers for the screenshot beats."],avoid:["Do not flatten the screenshots into one video track.","Do not remove the slow zoom movement.","Do not cover the readable screenshot text."]},layers:[{id:"medium-easy-video-face",kind:"video",label:"Face reaction hook",note:"Live reaction hook before the email screenshots.",start:0,duration:1.733333},{id:"medium-easy-video-caption",kind:"caption",label:"gen z caption",note:"Editable first-scene label.",start:0,duration:1.733333},{id:"medium-easy-video-email-1",kind:"image",label:"Have the day you deserve image",note:"First readable email screenshot beat.",start:1.733333,duration:2.3},{id:"medium-easy-video-email-2",kind:"image",label:"Crying but trying image",note:"Blunt workplace reply screenshot.",start:4.033333,duration:1.666667},{id:"medium-easy-video-email-3",kind:"image",label:"Please hesitate image",note:"Punchline phrasing stays readable while zooming.",start:5.7,duration:1.866667},{id:"medium-easy-video-email-4",kind:"image",label:"Literal trenches image",note:"Another screenshot escalation.",start:7.566667,duration:1.9},{id:"medium-easy-video-email-5",kind:"image",label:"Leave me alone image",note:"Last email-copy beat before the UI payoff.",start:9.466667,duration:1.866666},{id:"medium-easy-video-tip",kind:"image",label:"Leave a tip image",note:"Final UI screenshot payoff.",start:11.333333,duration:1.5},{id:"medium-easy-video-audio",kind:"audio",label:"Original audio",note:"Continuous source audio across the face scene and image beats.",start:0,duration:12.833333}],editable:!0},{id:"simple-video",eyebrow:"Simple Video",title:"drafts/inspiration-posts/simple-video/best-at-what-cost.mp4",sourceFolder:"drafts/inspiration-posts/simple-video",sourceType:"video",duration:ng,width:576,height:1024,summary:uf.hook,media:{type:"video",src:lg},viralDna:{hook:uf.hook,retention:uf.retention,payoff:uf.payoff,preserve:uf.preserve,avoid:uf.avoid},layers:cg.filter(e=>e.mode==="both"||e.mode==="publish").map(e=>({id:e.id,kind:e.kind,label:e.label,note:e.viralNote,start:e.start,duration:e.duration})),editable:!0},{id:"medium-video-loop-split",eyebrow:"Medium Video Loop Split",title:"drafts/inspiration-posts/medium-video-loop-split/ssstik.io_@shaymarie.00_1782767642405.mp4",sourceFolder:"drafts/inspiration-posts/medium-video-loop-split",sourceType:"video",duration:40.533333,width:576,height:1024,summary:"A medium-length TikTok reference video decomposed conservatively into editable source video and separate audio tracks.",media:{type:"video",src:"/drafts/inspiration-posts/medium-video-loop-split/ssstik.io_@shaymarie.00_1782767642405.mp4"},viralDna:{hook:"Use the first visual beat as the scroll-stopping reference before adding derived overlays.",retention:"Keep the source clip intact while editing timeline cuts, captions, and replacement layers around it.",payoff:"The full reference remains editable as separate video and audio foundations.",preserve:["Keep source video and source audio separated.","Keep the original vertical framing.","Add new caption/media layers on their own tracks."],avoid:["Do not invent baked captions during decomposition.","Do not put simultaneous frames on the same timeline track.","Do not flatten audio into the video layer."]},layers:[{id:"medium-video-loop-split-video",kind:"video",label:"Source video",note:"Editable source visual track.",start:0,duration:40.533333},{id:"medium-video-loop-split-audio",kind:"audio",label:"Source audio",note:"Editable source audio track.",start:0,duration:40.533333}],editable:!0},{id:"medium-video",eyebrow:"Medium Video",title:"drafts/inspiration-posts/medium-video/ssstik.io_@cailinsummer_1782717838898.mp4",sourceFolder:"drafts/inspiration-posts/medium-video",sourceType:"video",duration:24.1,width:720,height:1280,summary:"A medium TikTok reference video decomposed into editable source video and separate audio tracks.",media:{type:"video",src:"/drafts/inspiration-posts/medium-video/ssstik.io_@cailinsummer_1782717838898.mp4"},viralDna:{hook:"Start from the original reference footage, then layer edits without flattening the source.",retention:"A clean two-track base keeps visual timing and audio timing independently adjustable.",payoff:"The clip can be edited immediately in the timeline while preserving the original reference.",preserve:["Keep the native vertical video aspect ratio.","Keep source audio separately editable.","Use dedicated tracks for any added captions or media."],avoid:["Do not add guessed captions as baked decomposition output.","Do not overlap two frames on one track.","Do not reset the source timing during import."]},layers:[{id:"medium-video-video",kind:"video",label:"Source video",note:"Editable source visual track.",start:0,duration:24.1},{id:"medium-video-audio",kind:"audio",label:"Source audio",note:"Editable source audio track.",start:0,duration:24.1}],editable:!0},{id:"slides",eyebrow:"Slideshow",title:"drafts/inspiration-posts/slides",sourceFolder:"drafts/inspiration-posts/slides",sourceType:"slideshow",duration:9,width:1080,height:1920,summary:"A viral advice carousel using 9:16 lifestyle/fashion images with bold centered white captions and black outline.",media:{type:"slideshow",slides:["/drafts/inspiration-posts/slides/1-slide.webp","/drafts/inspiration-posts/slides/2-slide.webp","/drafts/inspiration-posts/slides/3-slide.webp"]},viralDna:{hook:"The first slide promises a cleaner, more viral slideshow format and frames the advice as opinionated.",retention:"Numbered rules create an open loop because viewers expect the missing steps and continue swiping.",payoff:"Each slide gives one concrete visual cleanliness rule.",preserve:["Keep all slides vertical 9:16.","Use lifestyle/fashion imagery as the visual proof layer.","Use bold white caption text with black outline, centered over the subject."],avoid:["Do not use block text backgrounds for these slides.","Do not make captions tiny or move them into TikTok UI-safe dead zones.","Do not break the numbered advice pattern."]},layers:[{id:"slide-1-image",kind:"image",label:"1-slide.webp",note:"Source slideshow image.",start:0,duration:3},{id:"slide-1-title-caption",kind:"caption",label:"Slide 1 title",note:"Editable baked slideshow caption.",start:0,duration:3},{id:"slide-1-opinion-caption",kind:"caption",label:"Slide 1 opinion",note:"Editable baked slideshow caption.",start:0,duration:3},{id:"slide-2-image",kind:"image",label:"2-slide.webp",note:"Source slideshow image.",start:3,duration:3},{id:"slide-2-rule-caption",kind:"caption",label:"Slide 2 rule",note:"Editable baked slideshow caption.",start:3,duration:3},{id:"slide-3-image",kind:"image",label:"3-slide.webp",note:"Source slideshow image.",start:6,duration:3},{id:"slide-3-rule-caption",kind:"caption",label:"Slide 3 rule",note:"Editable baked slideshow caption.",start:6,duration:3}],editable:!0}];function DJ(){let t={kind:"caption",mode:"publish",track:1,z:5,viralNote:"Editable baked slideshow caption.",color:"#ffffff",background:"#000000",textBackgroundStyle:"outline",fontFamily:"Montserrat",fontWeight:600,fontSize:54,radius:0},n=["/drafts/inspiration-posts/slides/1-slide.webp","/drafts/inspiration-posts/slides/2-slide.webp","/drafts/inspiration-posts/slides/3-slide.webp"],r=[[{id:"slide-1-title-caption",label:"Slide 1 title",text:`How to make
691
- your Slideshows cleaner
692
- (Viral)`,track:1,x:13,y:43,width:74,height:17},{id:"slide-1-opinion-caption",label:"Slide 1 opinion",text:"(My opinion)",track:2,x:16,y:72,width:68,height:8}],[{id:"slide-2-rule-caption",label:"Slide 2 rule",text:`2. never blur your face
693
- Its not 2019 anymore\u{1F940}`,track:1,x:6,y:49,width:88,height:15}],[{id:"slide-3-rule-caption",label:"Slide 3 rule",text:`4. make sure all pics
694
- are in (9:16) format`,track:1,x:8,y:41,width:84,height:16}]];return n.flatMap((o,i)=>{let a=i*3;return[{id:`slide-${i+1}-image`,label:`${i+1}-slide.webp`,kind:"image",mode:"both",start:a,duration:3,track:0,z:0,viralNote:"Source slideshow image.",src:o,x:0,y:0,width:100,height:100},...(r[i]??[]).map(s=>({...t,...s,start:a,duration:3}))]})}function rg(e){return decodeURIComponent(e.split("/").pop()??e)}function pk(e,t,n=[]){if(e.media.type!=="video")return[];let r=rg(e.media.src),o=[];for(let i=0;i<t.length-1;i+=1){let a=t[i],s=t[i+1],l=Math.max(.05,s-a);o.push({id:`${e.id}-scene-${i+1}`,label:n[i]??`Scene ${i+1}`,kind:"video",mode:"both",start:a,duration:l,track:0,z:0,viralNote:`Scene clip from ${r}.`,src:e.media.src,playbackStart:a})}return o}function LJ(e){return e.media.type!=="video"?[]:[...pk(e,[0,3.566667,6.6,9.2,12.7],["Living-room dance hook","Wedding dance reveal","Crowd energy escalation","Bride spin payoff"]),{id:`${e.id}-audio`,label:"Original audio",kind:"audio",mode:"both",start:0,duration:e.duration,track:1,z:1,viralNote:"Continuous source audio across the scene split.",src:e.media.src,playbackStart:0,volume:1,muted:!1},{id:`${e.id}-comment`,label:"Pinned TikTok comment screenshot",kind:"shape",mode:"publish",start:0,duration:e.duration,track:2,z:12,viralNote:"Editable deterministic HTML recreation of the source comment screenshot.",x:13.9,y:11.6,width:72,height:7.5,radius:2,color:"#ffffff",background:"#17181d",textBackgroundStyle:"plain",fontFamily:"TikTok Sans",fontWeight:600,fontSize:18,customHtml:[`<div style="display:grid;grid-template-columns:44px 1fr;column-gap:12px;width:100%;height:100%;box-sizing:border-box;padding:10px 12px 8px 12px;text-align:left;font-family:'TikTok Sans',Arial,sans-serif;color:#fff;line-height:1.08;background:#17181d">`,'<div style="width:40px;height:40px;border-radius:50%;background:linear-gradient(135deg,#2f3138,#0d0e12);border:1px solid rgba(255,255,255,.18);position:relative;overflow:hidden"><span style="position:absolute;left:12px;top:8px;width:15px;height:15px;border-radius:50%;background:#d0b489"></span><span style="position:absolute;left:7px;bottom:5px;width:26px;height:15px;border-radius:15px 15px 7px 7px;background:#efe2c2"></span></div>',`<div><div style="font-size:18px;font-weight:500;color:#d8d9de">kay</div><div style="font-size:18px;font-weight:600;color:#fff;white-space:nowrap">if they don't get married I'm gonna scream</div><div style="display:flex;align-items:center;gap:18px;margin-top:8px;font-size:15px;color:#999ca6"><span>2020-9-22</span><span>Reply</span><span style="margin-left:auto;color:#ff2d74;font-size:22px;line-height:1">\u2665</span><span style="color:#d8d9de">1,317</span><span style="color:#d8d9de">\u25B1</span></div></div>`,"</div>"].join("")}]}function UJ(e){return e.media.type!=="video"?[]:[...pk(e,[0,1.2,3.066667,4.733333,6.5,8.733333,15.366667,16.033333,22.2,22.933333,23.533333,29.266667,30.3,35.433333,36.366667,37.733333,39.766667,40.533333],["Road hazard hook","Driver reaction","Windshield impact","Driver reaction smile","Bison on road","Driver concern","Bison close pass","Driver checks blind spot","Side look reaction","Bison standoff","Driver considers next move","Hands up reaction","Insurance visor check","Visor proof beat","Pointing payoff","Final disbelief","End reaction"]),{id:`${e.id}-audio`,label:"Original audio",kind:"audio",mode:"both",start:0,duration:e.duration,track:1,z:1,viralNote:"Continuous source audio across scene cuts.",src:e.media.src,playbackStart:0,volume:1,muted:!1}]}function PJ(e){if(e.media.type!=="video")return[];let t={kind:"image",mode:"both",track:0,z:0,viralNote:"Slow-zoom screenshot image beat.",x:0,y:0,width:100,height:100},n="/drafts/inspiration-posts/medium-easy-video",r=[{id:"email-1",label:"Have the day you deserve image",start:1.733333,duration:2.3,src:`${n}/email-scene-01.jpg`,note:"First readable email screenshot beat."},{id:"email-2",label:"Crying but trying image",start:4.033333,duration:1.666667,src:`${n}/email-scene-02.jpg`,note:"Blunt workplace reply screenshot."},{id:"email-3",label:"Please hesitate image",start:5.7,duration:1.866667,src:`${n}/email-scene-03.jpg`,note:"Punchline phrasing stays readable while zooming."},{id:"email-4",label:"Literal trenches image",start:7.566667,duration:1.9,src:`${n}/email-scene-04.jpg`,note:"Another screenshot escalation."},{id:"email-5",label:"Leave me alone image",start:9.466667,duration:1.866666,src:`${n}/email-scene-05.jpg`,note:"Last email-copy beat before the UI payoff."},{id:"tip",label:"Leave a tip image",start:11.333333,duration:1.5,src:`${n}/email-scene-06.jpg`,note:"Final UI screenshot payoff."}];return[{id:`${e.id}-face`,label:"Face reaction hook",kind:"video",mode:"both",start:0,duration:1.733333,track:0,z:0,viralNote:"Live reaction hook before the email screenshots.",src:e.media.src,playbackStart:0},...r.map(o=>({...t,id:`${e.id}-${o.id}`,label:o.label,start:o.start,duration:o.duration,src:o.src,viralNote:o.note})),{id:`${e.id}-audio`,label:"Original audio",kind:"audio",mode:"both",start:0,duration:e.duration,track:1,z:1,viralNote:"Continuous source audio across the face scene and image beats.",src:e.media.src,playbackStart:0,volume:1,muted:!1},{id:`${e.id}-caption`,label:"gen z caption",kind:"caption",mode:"publish",start:0,duration:1.733333,track:2,z:8,viralNote:"Editable first-scene label that establishes the meme target.",text:"gen z",color:"#fff0a8",background:"#000000",textBackgroundStyle:"plain",fontFamily:"TikTok Sans",fontWeight:700,fontSize:25,radius:0,x:35,y:45.5,width:30,height:6}]}function BJ(e){if(e.media.type!=="video")return[];let t=[0,3.733333,6,8.3,10.866667,13.133333,15.133333,17.366667,19.166667,21.8,24.1],n={kind:"caption",mode:"publish",track:2,z:8,viralNote:"Editable source caption extracted from the reference video.",color:"#ffffff",background:"#000000",textBackgroundStyle:"outline",fontFamily:"Montserrat",fontWeight:600,fontSize:24,radius:0,x:12,width:76,height:8},r=[{text:`I was a 10/10
695
- daughter until...`,y:46},{text:`9/10 I started asking
696
- questions`,y:42},{text:`8/10 I started using my
697
- money to travel`,y:49},{text:`7/10 I started to detach
698
- from their religion`,y:34},{text:`6/10 when I didn't agree
699
- with them politically`,y:34},{text:`5/10 when I was true
700
- to myself`,y:35},{text:`4/10 when I told
701
- them no`,y:34},{text:`3/10 when I followed
702
- my heart`,y:34},{text:`2/10 when I spoke up
703
- for myself`,y:43},{text:`1/10 when I chose
704
- myself`,y:22}];return[...pk(e,t,r.map((o,i)=>`${10-i}/10 scene`)),{id:`${e.id}-audio`,label:"Original audio",kind:"audio",mode:"both",start:0,duration:e.duration,track:1,z:1,viralNote:"Continuous source audio across scene cuts.",src:e.media.src,playbackStart:0,volume:1,muted:!1},...r.map((o,i)=>({...n,id:`${e.id}-caption-${10-i}`,label:`${10-i}/10 caption`,text:o.text,start:t[i],duration:t[i+1]-t[i],y:o.y}))]}function zJ(e){if(e.media.type!=="video")return[];let t=rg(e.media.src);return[{id:`${e.id}-video`,label:t,kind:"video",mode:"both",start:0,duration:e.duration,track:0,z:0,viralNote:"Editable source visual track.",src:e.media.src},{id:`${e.id}-audio`,label:"Original audio",kind:"audio",mode:"both",start:0,duration:e.duration,track:1,z:1,viralNote:"Editable source audio track.",src:e.media.src,volume:1,muted:!1}]}var d4="https://vidfarmprodstack-vidfarmbucket335ee12f-0vsvtd5earqy.s3.us-east-1.amazonaws.com/primitives/placeholders/scene-placeholder.png",FJ=3,H1=4;function HJ(){let e=[];for(let t=0;t<FJ;t+=1){let n=t*H1,r=t+1;e.push({id:`scene-${r}-image`,label:`Scene ${r}`,kind:"image",mode:"both",start:n,duration:H1,track:0,z:0,viralNote:"Placeholder scene backdrop \u2014 replace with your own media.",src:d4}),e.push({id:`scene-${r}-caption`,label:`Scene ${r} label`,kind:"caption",mode:"publish",start:n,duration:H1,track:3,z:8,viralNote:"Placeholder scene label \u2014 edit or delete once you add real media.",text:`Scene ${r}`,color:"#ffffff",background:"#000000",textBackgroundStyle:"highlight-solid",fontFamily:"TikTok Sans",fontWeight:700,fontSize:34,radius:0,x:13.5,width:73,y:44,height:12})}return e}function mk(e){return e.id==="original"?HJ():e.id==="slides"?DJ():e.id==="simple-video"?cg.filter(t=>t.mode==="both"||t.mode==="publish"):e.id==="hard-video"?LJ(e):e.id==="medium-easy-video"?PJ(e):e.id==="medium-video-loop-split"?UJ(e):e.id==="medium-video"?BJ(e):zJ(e)}function f4(e){return mk(e).reduce((t,n)=>Math.max(t,n.start+n.duration),e.duration)}function GJ(e){let t=e.filter(n=>n.duration>0);for(let n=0;n<t.length;n+=1){let r=t[n];for(let o of t.slice(n+1))if(ff(r,o))throw new Error(`Track collision: ${r.id} overlaps ${o.id} on track ${r.track}.`)}}function p4(e){return e.replaceAll("&","&amp;").replaceAll("<","&lt;").replaceAll(">","&gt;").replaceAll('"',"&quot;")}function Yt(e){return p4(String(e))}function He(e){return Number(e.toFixed(3)).toString()}function Qm(e){let t=e.fontSize??18,n=e.fontFamily??"TikTok Sans",r=e.fontWeight??el(n),o=["position:absolute",`left:${e.x??0}%`,`top:${e.y??0}%`,`width:${e.width??100}%`,`height:${e.height??100}%`,`z-index:${e.z}`,`opacity:${e.opacity??1}`,`border-radius:${e.radius??0}px`,"overflow:hidden"];return(e.kind==="video"||e.kind==="image")&&o.push("object-fit:cover"),(e.kind==="text"||e.kind==="caption"||e.kind==="shape")&&(o.push("display:flex","align-items:center","justify-content:center","padding:3px",`font-family:${Zs(n)}, 'TikTok Sans', Montserrat, Abel`,`font-weight:${r}`,`line-height:${e.lineHeight??1.48}`,"text-align:center","text-transform:none",`font-size:${t}px`,`color:${e.color??"#ffffff"}`,"background:transparent"),e.letterSpacing!==void 0&&o.push(`letter-spacing:${e.letterSpacing}px`)),o.join(";")}function $J(e){let t=[`id="${Yt(e.id)}"`,`data-hf-id="${Yt(e.id)}"`,`data-layer-mode="${Yt(e.mode)}"`,`data-layer-kind="${Yt(e.kind)}"`,`data-viral-note="${Yt(e.viralNote)}"`,`data-start="${He(e.start)}"`,`data-duration="${He(e.duration)}"`,`data-track-index="${e.track}"`,`data-label="${Yt(e.label)}"`];return(e.kind==="text"||e.kind==="caption"||e.kind==="shape")&&t.push(`data-text-background-style="${Yt(e.textBackgroundStyle??"highlight-solid")}"`,`data-text-background-color="${Yt(e.background??"#000000")}"`,`data-font-family="${Yt(e.fontFamily??"TikTok Sans")}"`),e.customHtml&&t.push('data-layer-format="html"'),(e.kind==="video"||e.kind==="audio")&&e.playbackStart!==void 0&&t.push(`data-media-start="${He(e.playbackStart)}"`,`data-playback-start="${He(e.playbackStart)}"`),t.join(" ")}function jJ(e){let t=$J(e);if(e.kind==="video")return e.playbackStart!==void 0?`<div ${t} data-vf-timeline-proxy="video" data-src="${Yt(e.src??"")}" style="${Yt(Qm({...e,x:0,y:0,width:1,height:1}))};display:none;pointer-events:none;"></div>`:`<video ${t} src="${Yt(e.src??"")}" muted playsinline preload="auto" style="${Yt(Qm(e))}"></video>`;if(e.kind==="audio")return`<audio ${t} src="${Yt(e.src??"")}" data-timeline-role="music" data-volume="${He(e.volume??1)}" ${e.muted?"muted":""} preload="metadata"></audio>`;if(e.kind==="image")return`<img ${t} src="${Yt(e.src??"")}" alt="" style="${Yt(Qm(e))}" />`;if(e.customHtml)return`<div ${t} style="${Yt(Qm(e))}">${e.customHtml}</div>`;let n=e.text??e.label,r=c4(e.textBackgroundStyle??"highlight-solid",e.color??"#ffffff",e.background??"#000000",e.fontFamily??"TikTok Sans",e.fontWeight??el(e.fontFamily??"TikTok Sans")),o=u4(e.textBackgroundStyle??"highlight-solid");return`<div ${t} style="${Yt(Qm(e))}"><span data-vf-text-lines="true" style="${Yt(o)}"><span data-vf-text-inline="true" style="${Yt(r)}">${p4(n)}</span></span></div>`}function qJ(e,t){return e==="shape"&&t?"HTML":e}function VJ(e,t){return e==="shape"&&t?"HTML":e.slice(0,3).toUpperCase()}function WJ(e,t){if(e.media.type!=="video"||!t.some(o=>o.kind==="video"&&o.playbackStart!==void 0))return"";let r=["position:absolute","left:0%","top:0%","width:100%","height:100%","z-index:0","object-fit:cover","background:#050604"].join(";");return`<video data-vf-playback-source="true" src="${Yt(e.media.src)}" muted playsinline preload="auto" style="${Yt(r)}"></video>`}function m4(){return`<script>
705
- (() => {
706
- const root = document.querySelector("[data-composition-id]");
707
- let declaredDuration = Number(root?.getAttribute("data-duration") || 0);
708
- let duration = declaredDuration;
709
- let time = 0;
710
- let playing = false;
711
- let playbackRate = 1;
712
- let previewMuted = false;
713
- let raf = 0;
714
- let last = 0;
715
- const backingVideo = document.querySelector("[data-vf-playback-source]");
716
- const initialMuted = new WeakMap();
717
- if (backingVideo instanceof HTMLMediaElement) {
718
- initialMuted.set(backingVideo, backingVideo.muted || backingVideo.hasAttribute("muted"));
719
- }
720
- let clips = [];
721
- let activeVideoProxyKey = null;
722
- let activeVideoProxyNode = null;
723
- let hasVideoProxies = false;
724
- const activeMedia = new WeakSet();
725
- const mediaStateKeys = new WeakMap();
726
- const visibilityStates = new WeakMap();
727
-
728
- function clampTime(nextTime) {
729
- const safe = Number(nextTime);
730
- if (!Number.isFinite(safe)) return 0;
731
- return Math.max(0, Math.min(duration, safe));
732
- }
733
-
734
- function readNumberAttr(node, names, fallback = 0) {
735
- for (const name of names) {
736
- const raw = node.getAttribute(name);
737
- if (raw !== null) {
738
- const value = Number(raw);
739
- return Number.isFinite(value) ? value : fallback;
740
- }
741
- }
742
- return fallback;
743
- }
744
-
745
- function readTiming(clip) {
746
- const start = readNumberAttr(clip, ["data-start"], 0);
747
- const clipDuration = readNumberAttr(clip, ["data-duration"], 0);
748
- const mediaStart = readNumberAttr(clip, ["data-playback-start", "data-media-start"], 0);
749
- return { start, duration: clipDuration, end: start + clipDuration, mediaStart };
750
- }
751
-
752
- function refreshClips() {
753
- // The parent editor can live-swap the composition DOM (undo/redo). Re-read
754
- // everything derivable from the document so a swap never leaves the player
755
- // clamped to a stale duration or a stale authored-mute state.
756
- declaredDuration = Number(root?.getAttribute("data-duration") || 0);
757
- duration = declaredDuration;
758
- clips = Array.from(document.querySelectorAll("[data-start]")).filter((node) => node !== root);
759
- for (const clip of clips) {
760
- if (clip instanceof HTMLMediaElement) {
761
- initialMuted.set(clip, clip.hasAttribute("muted"));
762
- }
763
- if (clip instanceof HTMLMediaElement) {
764
- clip.preload = "auto";
765
- if (clip.readyState === 0) {
766
- try { clip.load(); } catch {}
767
- }
768
- }
769
- }
770
- if (backingVideo instanceof HTMLMediaElement) {
771
- initialMuted.set(backingVideo, backingVideo.hasAttribute("muted"));
772
- backingVideo.preload = "auto";
773
- if (backingVideo.readyState === 0) {
774
- try { backingVideo.load(); } catch {}
775
- }
776
- }
777
- activeVideoProxyKey = null;
778
- activeVideoProxyNode = null;
779
- hasVideoProxies = clips.some((clip) => clip instanceof Element && clip.getAttribute("data-vf-timeline-proxy") === "video");
780
- ensureDuration();
781
- time = clampTime(time);
782
- discoverGeneralCssAnimations();
783
- apply(time, { forceSeek: true });
784
- }
785
-
786
- function applyMediaState(clip) {
787
- const volume = Number(clip.getAttribute("data-volume") || 1);
788
- const nextMuted = previewMuted || initialMuted.get(clip) === true;
789
- const stateKey = playbackRate + "|" + volume + "|" + nextMuted;
790
- if (mediaStateKeys.get(clip) === stateKey) return;
791
- mediaStateKeys.set(clip, stateKey);
792
- if (Number.isFinite(volume)) clip.volume = Math.max(0, Math.min(1, volume));
793
- clip.muted = nextMuted;
794
- try { clip.playbackRate = playbackRate; } catch {}
795
- try { clip.defaultPlaybackRate = playbackRate; } catch {}
796
- try {
797
- if ("preservesPitch" in clip) clip.preservesPitch = true;
798
- if ("mozPreservesPitch" in clip) clip.mozPreservesPitch = true;
799
- if ("webkitPreservesPitch" in clip) clip.webkitPreservesPitch = true;
800
- } catch {}
801
- }
802
-
803
- function setVisibility(node, active) {
804
- const next = active ? "visible" : "hidden";
805
- if (visibilityStates.get(node) === next) return;
806
- visibilityStates.set(node, next);
807
- node.style.visibility = next;
808
- }
809
-
810
- function setPlaybackRate(nextRate) {
811
- const next = Number(nextRate);
812
- playbackRate = Number.isFinite(next) && next > 0 ? Math.max(0.05, Math.min(8, next)) : 1;
813
- for (const clip of clips) {
814
- if (clip instanceof HTMLMediaElement) applyMediaState(clip);
815
- }
816
- if (backingVideo instanceof HTMLMediaElement) applyMediaState(backingVideo);
817
- }
818
-
819
- function setMuted(nextMuted) {
820
- previewMuted = Boolean(nextMuted);
821
- for (const clip of clips) {
822
- if (clip instanceof HTMLMediaElement) applyMediaState(clip);
823
- }
824
- if (backingVideo instanceof HTMLMediaElement) applyMediaState(backingVideo);
825
- }
826
-
827
- function clipKey(clip) {
828
- return clip.getAttribute("data-hf-id") || clip.id || clip.getAttribute("data-label") || "";
829
- }
830
-
831
- function ensurePlaying(media) {
832
- if (!playing) {
833
- if (!media.paused) media.pause();
834
- activeMedia.delete(media);
835
- return;
836
- }
837
- if (!activeMedia.has(media) || media.paused) {
838
- activeMedia.add(media);
839
- void media.play().catch(() => {});
840
- }
841
- }
842
-
843
- function pauseInactiveMedia(media) {
844
- activeMedia.delete(media);
845
- if (!media.paused) media.pause();
846
- }
847
-
848
- function seekMedia(media, target, forceSeek, driftLimit) {
849
- if (!Number.isFinite(target)) return;
850
- if (forceSeek || Math.abs(media.currentTime - target) > driftLimit) {
851
- try { media.currentTime = Math.max(0, target); } catch {}
852
- }
853
- }
854
-
855
- // Runtime-adapter bridge \u2014 mirrors the official @hyperframes/producer
856
- // deterministic adapters so compositions driven by a registered GSAP
857
- // timeline (window.__timelines), Anime.js (window.__hfAnime), Lottie
858
- // (window.__hfLottie), or Three.js/TypeGPU (window.__hfThreeTime/
859
- // __hfTypegpuTime + the hf-seek CustomEvent) scrub with the player instead
860
- // of running on the wall clock. Everything is duck-typed and try/caught so
861
- // a broken composition script never kills the apply loop.
862
- function compositionTimeline() {
863
- let registry = null;
864
- try { registry = window.__timelines; } catch { return null; }
865
- if (!registry || typeof registry !== "object") return null;
866
- const compId = root?.getAttribute("data-composition-id") || "";
867
- let timeline = compId ? registry[compId] : null;
868
- if (!timeline) {
869
- const keys = Object.keys(registry);
870
- if (keys.length === 1) timeline = registry[keys[0]];
871
- }
872
- if (!timeline || typeof timeline.pause !== "function") return null;
873
- if (typeof timeline.totalTime !== "function" && typeof timeline.seek !== "function") return null;
874
- return timeline;
875
- }
876
-
877
- function timelineDuration(timeline) {
878
- try {
879
- const value = typeof timeline.duration === "function" ? Number(timeline.duration()) : Number(timeline.duration);
880
- if (Number.isFinite(value) && value > 0) return value;
881
- } catch {}
882
- return 0;
883
- }
884
-
885
- function syncTimeline() {
886
- const timeline = compositionTimeline();
887
- if (!timeline) return;
888
- try {
889
- timeline.pause();
890
- // Official gsap adapter seek: nudge to time+1ms with suppressed events,
891
- // then land exactly, so gsap re-renders even when the target equals the
892
- // timeline's current time.
893
- if (typeof timeline.totalTime === "function") {
894
- timeline.totalTime(time + 0.001, true);
895
- timeline.totalTime(time, false);
896
- } else {
897
- timeline.seek(time, false);
898
- }
899
- } catch {}
900
- }
901
-
902
- function syncAnimeInstances() {
903
- let instances = null;
904
- try { instances = window.__hfAnime; } catch { return; }
905
- if (!Array.isArray(instances) || instances.length === 0) return;
906
- const ms = Math.max(0, time) * 1000;
907
- for (const instance of instances) {
908
- try {
909
- if (instance && typeof instance.seek === "function") instance.seek(ms);
910
- } catch {}
911
- }
912
- }
913
-
914
- function syncLottiePlayers() {
915
- let players = null;
916
- try { players = window.__hfLottie; } catch { return; }
917
- if (!Array.isArray(players) || players.length === 0) return;
918
- const safe = Math.max(0, time);
919
- for (const player of players) {
920
- try {
921
- if (!player || typeof player !== "object") continue;
922
- if (typeof player.goToAndStop === "function") {
923
- player.goToAndStop(safe * 1000, false);
924
- } else if (typeof player.pause === "function" && ("totalFrames" in player || "duration" in player)) {
925
- if (typeof player.setCurrentRawFrameValue === "function") {
926
- const totalFrames = player.totalFrames ?? 0;
927
- const frameRate = player.frameRate ?? 30;
928
- if (totalFrames > 0) player.setCurrentRawFrameValue(Math.min(safe * frameRate, totalFrames - 1));
929
- } else if (typeof player.seek === "function") {
930
- player.seek(Math.min(100, (safe / (player.duration ?? 1)) * 100));
931
- }
932
- }
933
- } catch {}
934
- }
935
- }
936
-
937
- let lastDispatchedSeekTime = -1;
938
- function syncSeekGlobals() {
939
- const safe = Math.max(0, time);
940
- try { window.__hfThreeTime = safe; } catch {}
941
- try { window.__hfTypegpuTime = safe; } catch {}
942
- // The official three/typegpu adapters dedupe the hf-seek dispatch on the
943
- // last dispatched time.
944
- if (safe === lastDispatchedSeekTime) return;
945
- lastDispatchedSeekTime = safe;
946
- try { window.dispatchEvent(new CustomEvent("hf-seek", { detail: { time: safe } })); } catch {}
947
- }
948
-
949
- function syncRuntimeAdapters() {
950
- syncTimeline();
951
- syncAnimeInstances();
952
- syncLottiePlayers();
953
- syncSeekGlobals();
954
- }
955
-
956
- // data-duration on the root is authoritative when present. Arbitrary
957
- // compositions may omit it, so infer the duration from clip extents,
958
- // preferring a registered GSAP timeline that reports a longer duration.
959
- // Recomputed on every apply so a timeline registered after load still
960
- // corrects the duration (and seek clamping) lazily.
961
- function ensureDuration() {
962
- if (declaredDuration > 0) {
963
- duration = declaredDuration;
964
- return;
965
- }
966
- let inferred = 0;
967
- for (const clip of clips) {
968
- const timing = readTiming(clip);
969
- if (timing.end > inferred) inferred = timing.end;
970
- }
971
- const timeline = compositionTimeline();
972
- if (timeline) {
973
- const reported = timelineDuration(timeline);
974
- if (reported > inferred) inferred = reported;
975
- }
976
- duration = inferred;
977
- }
978
-
979
- function deriveTimelineTimeFromBackingVideo() {
980
- if (!(backingVideo instanceof HTMLVideoElement)) return null;
981
- if (activeVideoProxyNode instanceof Element && !activeVideoProxyNode.isConnected) {
982
- activeVideoProxyNode = null;
983
- activeVideoProxyKey = null;
984
- refreshClips();
985
- }
986
- if (activeVideoProxyNode instanceof Element) {
987
- const timing = readTiming(activeVideoProxyNode);
988
- const mapped = timing.start + (backingVideo.currentTime - timing.mediaStart);
989
- if (Number.isFinite(mapped)) return clampTime(mapped);
990
- }
991
- return clampTime(backingVideo.currentTime);
992
- }
993
-
994
- // Mirror of syncKenBurnsClip in src/composition-runtime.ts. Scrubs the CSS
995
- // transform animation on a [data-kenburns] <img> to the clip's normalized
996
- // progress so pan/zoom previews in lockstep with the player time.
997
- function syncKenBurnsClip(clip, timing) {
998
- if (typeof clip.getAnimations !== "function") return;
999
- const progress = timing.duration > 0
1000
- ? Math.max(0, Math.min(1, (time - timing.start) / timing.duration))
1001
- : 0;
1002
- let anims = [];
1003
- try { anims = clip.getAnimations({ subtree: true }); } catch { return; }
1004
- for (const anim of anims) {
1005
- if (typeof anim.animationName !== "string" || anim.animationName.indexOf("vf-kb-") !== 0) continue;
1006
- let total = 0;
1007
- try { total = Number(anim.effect?.getComputedTiming?.().duration) || 0; } catch {}
1008
- if (!total) continue;
1009
- try {
1010
- anim.pause();
1011
- anim.currentTime = progress * total;
1012
- } catch {}
1013
- }
1014
- }
1015
-
1016
- // Mirror of the scene-transition trio in src/composition-runtime.ts: a
1017
- // [data-transition] clip animates in over the previous clip on its track, so
1018
- // that clip stays active for the transition window (publish materializes the
1019
- // same overlap into data-duration via normalizePublishHtml).
1020
- function collectTransitionWindows() {
1021
- const windows = [];
1022
- for (const clip of clips) {
1023
- if (!(clip instanceof HTMLElement) || clip instanceof HTMLAudioElement) continue;
1024
- if (!clip.hasAttribute("data-transition")) continue;
1025
- const timing = readTiming(clip);
1026
- let transitionDuration = Number(clip.getAttribute("data-transition-duration"));
1027
- if (!Number.isFinite(transitionDuration) || transitionDuration <= 0) transitionDuration = 0.5;
1028
- windows.push({
1029
- track: Number(clip.getAttribute("data-track-index")) || 0,
1030
- start: timing.start,
1031
- duration: Math.min(transitionDuration, timing.duration)
1032
- });
1033
- }
1034
- return windows;
1035
- }
1036
-
1037
- function transitionHoldFor(clip, timing, windows) {
1038
- if (!windows.length) return 0;
1039
- if (!(clip instanceof HTMLElement) || clip instanceof HTMLAudioElement) return 0;
1040
- const track = Number(clip.getAttribute("data-track-index")) || 0;
1041
- let hold = 0;
1042
- for (const window of windows) {
1043
- if (window.track !== track) continue;
1044
- if (Math.abs(window.start - timing.end) > 0.05) continue;
1045
- if (window.duration > hold) hold = window.duration;
1046
- }
1047
- return hold;
1048
- }
1049
-
1050
- function syncTransitionClip(clip, timing, hold) {
1051
- if (typeof clip.getAnimations !== "function") return;
1052
- // Exit animations sit at the clip's tail via the inline --vf-tr-out-delay
1053
- // var. Timeline edits touch data-duration only, so re-derive the delay
1054
- // (duration + any live hold \u2212 out duration) before scrubbing; publish
1055
- // materializes the same value for the render producer.
1056
- if (clip.hasAttribute("data-transition-out")) {
1057
- let outDuration = Number(clip.getAttribute("data-transition-out-duration"));
1058
- if (!Number.isFinite(outDuration) || outDuration <= 0) outDuration = 0.5;
1059
- outDuration = Math.min(outDuration, timing.duration);
1060
- const expectedDelay = Math.max(0, timing.duration + (hold || 0) - outDuration);
1061
- try {
1062
- if (Math.abs((parseFloat(clip.style.getPropertyValue("--vf-tr-out-dur")) || 0) - outDuration) > 0.002) {
1063
- clip.style.setProperty("--vf-tr-out-dur", outDuration.toFixed(3) + "s");
1064
- }
1065
- if (Math.abs((parseFloat(clip.style.getPropertyValue("--vf-tr-out-delay")) || 0) - expectedDelay) > 0.002) {
1066
- clip.style.setProperty("--vf-tr-out-delay", expectedDelay.toFixed(3) + "s");
1067
- }
1068
- } catch {}
1069
- }
1070
- const offsetMs = Math.max(0, (time - timing.start)) * 1000;
1071
- let anims = [];
1072
- try { anims = clip.getAnimations({ subtree: true }); } catch { return; }
1073
- for (const anim of anims) {
1074
- if (typeof anim.animationName !== "string" || anim.animationName.indexOf("vf-tr-") !== 0) continue;
1075
- try {
1076
- anim.pause();
1077
- anim.currentTime = offsetMs;
1078
- } catch {}
1079
- }
1080
- }
1081
-
1082
- // Mirror of syncCaptionClip in src/composition-runtime.ts. Word windows are
1083
- // the inline animation-delay/duration relative to the layer start, so the
1084
- // scrub is the absolute offset into the layer.
1085
- //
1086
- // Stability: Chrome PERMANENTLY drops a paused fill:none CSS animation the
1087
- // moment its currentTime is pushed past the effect end, and never re-creates
1088
- // it while the computed animation-name is unchanged \u2014 so one forward scrub
1089
- // across a word's window would leave that word stuck in its resting state
1090
- // (invisible for word-pop/stack-up) on every later frame. Past the end, a
1091
- // parked fill:none animation looks identical to the resting styles, so park
1092
- // at 0 instead of overshooting. fill:forwards presets (karaoke-fill,
1093
- // cumulative-reveal) must overshoot to hold their final keyframe \u2014 finished
1094
- // + forwards animations keep applying their effect and survive. If a word's
1095
- // animation is missing anyway (dropped before this guard, or an innerHTML
1096
- // morph replaced the spans mid-scrub), restart it declaratively by cycling
1097
- // animation-name through none.
1098
- function captionWordAnimationFor(word) {
1099
- let anims = [];
1100
- try { anims = word.getAnimations(); } catch { return null; }
1101
- for (const anim of anims) {
1102
- if (typeof anim.animationName === "string" && anim.animationName.indexOf("vf-cap-") === 0) return anim;
1103
- }
1104
- return null;
1105
- }
1106
-
1107
- function syncCaptionClip(clip, timing) {
1108
- if (typeof clip.getAnimations !== "function") return;
1109
- const offsetMs = Math.max(0, (time - timing.start)) * 1000;
1110
- let words = [];
1111
- try { words = Array.from(clip.querySelectorAll('[data-cap-word="true"]')); } catch { return; }
1112
- for (const word of words) {
1113
- if (typeof word.getAnimations !== "function") continue;
1114
- let anim = captionWordAnimationFor(word);
1115
- if (!anim) {
1116
- const inlineEndMs =
1117
- ((parseFloat(word.style.animationDelay) || 0) + (parseFloat(word.style.animationDuration) || 0)) * 1000;
1118
- let needed = offsetMs <= inlineEndMs;
1119
- if (!needed) {
1120
- try { needed = getComputedStyle(word).animationFillMode.indexOf("forward") !== -1 || getComputedStyle(word).animationFillMode.indexOf("both") !== -1; } catch {}
1121
- }
1122
- if (!needed) continue;
1123
- try {
1124
- word.style.animationName = "none";
1125
- void word.offsetWidth;
1126
- word.style.removeProperty("animation-name");
1127
- } catch { continue; }
1128
- anim = captionWordAnimationFor(word);
1129
- if (!anim) continue;
1130
- }
1131
- let target = offsetMs;
1132
- try {
1133
- const computed = anim.effect && typeof anim.effect.getComputedTiming === "function"
1134
- ? anim.effect.getComputedTiming()
1135
- : null;
1136
- if (computed && typeof computed.endTime === "number" && offsetMs >= computed.endTime
1137
- && computed.fill !== "forwards" && computed.fill !== "both") {
1138
- target = 0;
1139
- }
1140
- } catch {}
1141
- try {
1142
- anim.pause();
1143
- anim.currentTime = target;
1144
- } catch {}
1145
- }
1146
- }
1147
-
1148
- // Generalized CSS keyframe scrub \u2014 the preview twin of the official
1149
- // producer CSS adapter: every element whose computed animation-name is set
1150
- // gets its animations paused and scrubbed to the player time relative to
1151
- // the nearest ancestor-or-self [data-start] (0 when none). vf-* animations
1152
- // (Ken Burns, transitions, captions) keep their dedicated machinery above.
1153
- // Discovery is cached per refreshClips like the official adapter's discover
1154
- // pass; elements added by live patches are picked up on the next refresh.
1155
- // Each entry also caches its clip-relative start at discovery so the
1156
- // per-frame sync skips the ancestor walk; a re-parented or retimed element
1157
- // is likewise re-resolved on the next refreshClips discovery.
1158
- let generalCssEntries = [];
1159
-
1160
- function discoverGeneralCssAnimations() {
1161
- generalCssEntries = [];
1162
- let nodes = [];
1163
- try { nodes = document.querySelectorAll("*"); } catch { return; }
1164
- for (const node of nodes) {
1165
- if (!(node instanceof HTMLElement) || typeof node.getAnimations !== "function") continue;
1166
- let names = "";
1167
- try { names = getComputedStyle(node).animationName || ""; } catch { continue; }
1168
- if (!names || names === "none") continue;
1169
- const expected = [];
1170
- for (const name of names.split(",")) {
1171
- const trimmed = name.trim();
1172
- if (!trimmed || trimmed === "none" || trimmed.indexOf("vf-") === 0) continue;
1173
- expected.push(trimmed);
1174
- }
1175
- if (expected.length) generalCssEntries.push({ el: node, names: expected, start: generalClipStartFor(node) });
1176
- }
1177
- }
1178
-
1179
- function hasAnimationNamed(anims, name) {
1180
- for (const anim of anims) {
1181
- if (anim.animationName === name) return true;
1182
- }
1183
- return false;
1184
- }
1185
-
1186
- function generalClipStartFor(node) {
1187
- const holder = node.closest("[data-start]");
1188
- return holder ? readNumberAttr(holder, ["data-start"], 0) : 0;
1189
- }
1190
-
1191
- // Cycling animation-name through none re-creates dropped CSS animations
1192
- // declaratively (same trick as the caption resurrection above), preserving
1193
- // any authored inline animation-name.
1194
- function resurrectCssAnimations(node) {
1195
- try {
1196
- const inline = node.style.animationName;
1197
- node.style.animationName = "none";
1198
- void node.offsetWidth;
1199
- if (inline && inline !== "none") {
1200
- node.style.animationName = inline;
1201
- } else {
1202
- node.style.removeProperty("animation-name");
1203
- }
1204
- } catch {}
1205
- }
1206
-
1207
- function scrubGeneralAnimation(anim, offsetMs) {
1208
- let target = offsetMs;
1209
- try {
1210
- const computed = anim.effect && typeof anim.effect.getComputedTiming === "function"
1211
- ? anim.effect.getComputedTiming()
1212
- : null;
1213
- const endTime = computed && typeof computed.endTime === "number" ? computed.endTime : NaN;
1214
- if (Number.isFinite(endTime) && offsetMs >= endTime) {
1215
- // Same Chrome guard as the caption scrub: paused fill:none/backwards
1216
- // animations pushed past their effect end are destroyed permanently,
1217
- // so park them at 0; fill:forwards/both hold their final keyframe at
1218
- // the clamped end. Infinite-iteration animations (endTime Infinity)
1219
- // take the raw clip-relative offset like the official CSS adapter \u2014
1220
- // the browser resolves the iteration phase.
1221
- target = computed.fill === "forwards" || computed.fill === "both" ? endTime : 0;
1222
- }
1223
- } catch {}
1224
- try {
1225
- anim.pause();
1226
- anim.currentTime = target;
1227
- } catch {}
1228
- }
1229
-
1230
- function syncGeneralCssAnimations() {
1231
- for (const entry of generalCssEntries) {
1232
- const node = entry.el;
1233
- if (!node.isConnected) continue;
1234
- const offsetMs = Math.max(0, time - entry.start) * 1000;
1235
- let anims = [];
1236
- try { anims = node.getAnimations(); } catch { continue; }
1237
- let missing = null;
1238
- for (const name of entry.names) {
1239
- if (!hasAnimationNamed(anims, name)) (missing || (missing = [])).push(name);
1240
- }
1241
- if (missing) {
1242
- resurrectCssAnimations(node);
1243
- try { anims = node.getAnimations(); } catch { anims = []; }
1244
- // Names that still have no live animation (e.g. a display:none
1245
- // subtree) are dropped until the next discovery so a hidden element
1246
- // is not forced through a reflow every frame.
1247
- entry.names = entry.names.filter((name) => missing.indexOf(name) === -1 || hasAnimationNamed(anims, name));
1248
- }
1249
- for (const anim of anims) {
1250
- if (typeof anim.animationName !== "string" || anim.animationName.indexOf("vf-") === 0) continue;
1251
- scrubGeneralAnimation(anim, offsetMs);
1252
- }
1253
- }
1254
- }
1255
-
1256
- function apply(nextTime, options = {}) {
1257
- const forceSeek = Boolean(options.forceSeek);
1258
- const fromClock = Boolean(options.fromClock);
1259
- ensureDuration();
1260
- time = clampTime(nextTime);
1261
- let activeVideoProxy = null;
1262
- let activeVideoProxyStart = -Infinity;
1263
- const transitionWindows = collectTransitionWindows();
1264
- for (const clip of clips) {
1265
- const timing = readTiming(clip);
1266
- const hold = transitionHoldFor(clip, timing, transitionWindows);
1267
- // hyperframes-core clip windows are inclusive of both ends \u2014 the final
1268
- // frame holds.
1269
- const active = time >= timing.start && time <= timing.end + hold;
1270
- if (clip instanceof HTMLElement && !(clip instanceof HTMLAudioElement)) {
1271
- if (clip.getAttribute("data-vf-timeline-proxy") === "video") {
1272
- // Clip windows are inclusive of both ends, so at an exact butt-cut
1273
- // the outgoing AND incoming proxies are both active. Prefer the
1274
- // greatest data-start (timeline order \u2014 the incoming clip wins);
1275
- // DOM order only breaks ties between equal starts.
1276
- if (active && timing.start >= activeVideoProxyStart) {
1277
- activeVideoProxy = clip;
1278
- activeVideoProxyStart = timing.start;
1279
- }
1280
- } else {
1281
- setVisibility(clip, active);
1282
- }
1283
- if (clip.hasAttribute("data-kenburns")) syncKenBurnsClip(clip, timing);
1284
- if (clip.hasAttribute("data-caption-animation")) syncCaptionClip(clip, timing);
1285
- if (clip.hasAttribute("data-transition") || clip.hasAttribute("data-transition-out")) syncTransitionClip(clip, timing, hold);
1286
- }
1287
- if (clip instanceof HTMLMediaElement) {
1288
- applyMediaState(clip);
1289
- if (active) {
1290
- const target = Math.max(0, timing.mediaStart + time - timing.start);
1291
- const enteringClip = !activeMedia.has(clip);
1292
- seekMedia(clip, target, forceSeek || enteringClip, playing ? 0.75 : 0.08);
1293
- if (playing) {
1294
- ensurePlaying(clip);
1295
- } else {
1296
- pauseInactiveMedia(clip);
1297
- }
1298
- } else {
1299
- pauseInactiveMedia(clip);
1300
- }
1301
- }
1302
- }
1303
- syncGeneralCssAnimations();
1304
- syncRuntimeAdapters();
1305
- if (backingVideo instanceof HTMLVideoElement) {
1306
- applyMediaState(backingVideo);
1307
- const shouldShowBackingVideo = !hasVideoProxies || Boolean(activeVideoProxy);
1308
- backingVideo.style.visibility = shouldShowBackingVideo ? "visible" : "hidden";
1309
- if (activeVideoProxy) {
1310
- const nextProxyKey = clipKey(activeVideoProxy);
1311
- const proxyChanged = nextProxyKey !== activeVideoProxyKey;
1312
- activeVideoProxyKey = nextProxyKey;
1313
- activeVideoProxyNode = activeVideoProxy;
1314
- const timing = readTiming(activeVideoProxy);
1315
- const target = Math.max(0, timing.mediaStart + time - timing.start);
1316
- const driftLimit = playing ? (fromClock ? 0.75 : 2.0) : 0.08;
1317
- const drifting = !backingVideo.seeking && Math.abs(backingVideo.currentTime - target) > driftLimit;
1318
- if (forceSeek || proxyChanged || !playing || drifting) {
1319
- seekMedia(backingVideo, target, true, 0.08);
1320
- }
1321
- } else {
1322
- activeVideoProxyKey = null;
1323
- activeVideoProxyNode = null;
1324
- if (!hasVideoProxies && !fromClock) seekMedia(backingVideo, time, forceSeek, playing ? 1.25 : 0.08);
1325
- }
1326
- if (playing && shouldShowBackingVideo) {
1327
- ensurePlaying(backingVideo);
1328
- } else {
1329
- pauseInactiveMedia(backingVideo);
1330
- }
1331
- }
1332
- }
1333
-
1334
- function tick(now) {
1335
- if (!playing) return;
1336
- if (!last) last = now;
1337
- const delta = ((now - last) / 1000) * playbackRate;
1338
- const next = time + delta;
1339
- last = now;
1340
- apply(next >= duration ? duration : next, { fromClock: true });
1341
- if (time >= duration) {
1342
- playing = false;
1343
- for (const clip of clips) {
1344
- if (clip instanceof HTMLMediaElement) pauseInactiveMedia(clip);
1345
- }
1346
- if (backingVideo instanceof HTMLMediaElement) pauseInactiveMedia(backingVideo);
1347
- return;
1348
- }
1349
- raf = requestAnimationFrame(tick);
1350
- }
1351
-
1352
- window.__player = {
1353
- play() {
1354
- if (playing) return;
1355
- if (time >= duration) time = 0;
1356
- playing = true;
1357
- last = 0;
1358
- apply(time, { forceSeek: true });
1359
- cancelAnimationFrame(raf);
1360
- raf = requestAnimationFrame(tick);
1361
- },
1362
- pause() {
1363
- playing = false;
1364
- cancelAnimationFrame(raf);
1365
- for (const clip of clips) {
1366
- if (clip instanceof HTMLMediaElement) pauseInactiveMedia(clip);
1367
- }
1368
- if (backingVideo instanceof HTMLMediaElement) pauseInactiveMedia(backingVideo);
1369
- },
1370
- seek(nextTime, options = {}) {
1371
- const shouldKeepPlaying = playing || options.keepPlaying === true;
1372
- playing = shouldKeepPlaying;
1373
- if (!shouldKeepPlaying) cancelAnimationFrame(raf);
1374
- apply(nextTime, { forceSeek: true });
1375
- if (shouldKeepPlaying) {
1376
- last = 0;
1377
- cancelAnimationFrame(raf);
1378
- raf = requestAnimationFrame(tick);
1379
- }
1380
- },
1381
- getTime() {
1382
- return time;
1383
- },
1384
- getDuration() {
1385
- return duration;
1386
- },
1387
- isPlaying() {
1388
- return playing;
1389
- },
1390
- setPlaybackRate,
1391
- getPlaybackRate() {
1392
- return playbackRate;
1393
- },
1394
- setMuted,
1395
- refreshClips,
1396
- // Re-scrub caption word animations at the current playhead without a full
1397
- // apply(). The editor calls this after live-patching a caption layer's
1398
- // DOM (style/text edits rebuild the word spans, whose fresh CSS-paused
1399
- // animations sit at currentTime 0 \u2014 resting/invisible \u2014 until scrubbed).
1400
- syncCaptions() {
1401
- for (const clip of Array.from(document.querySelectorAll("[data-caption-animation]"))) {
1402
- if (clip instanceof HTMLElement) syncCaptionClip(clip, readTiming(clip));
1403
- }
1404
- }
1405
- };
1406
-
1407
- refreshClips();
1408
- if (backingVideo instanceof HTMLMediaElement) {
1409
- backingVideo.addEventListener("loadedmetadata", () => {
1410
- if (!playing) apply(time, { forceSeek: true });
1411
- });
1412
- }
1413
- window.addEventListener("load", () => {
1414
- // Composition scripts may register adapter instances (GSAP timelines,
1415
- // Lottie players, ...) or start CSS animations on the load event \u2014
1416
- // re-discover and re-scrub so late registrations preview correctly.
1417
- discoverGeneralCssAnimations();
1418
- if (!playing) apply(time, { forceSeek: true });
1419
- });
1420
-
1421
- // Cache the parent frame's origin from the first accepted control message
1422
- // and pin all outbound postMessages to it. Falls back to document.referrer's
1423
- // origin so drag/select events still reach the editor before any control
1424
- // message has been received. Without pinning, sending "*" leaks preview
1425
- // frame coordinates and layer ids to any embedding third-party page.
1426
- let trustedParentOrigin = null;
1427
- try {
1428
- if (document.referrer) {
1429
- trustedParentOrigin = new URL(document.referrer).origin;
1430
- }
1431
- } catch {}
1432
- function parentTargetOrigin() {
1433
- return trustedParentOrigin || "*";
1434
- }
1435
- function postToParent(payload) {
1436
- if (!window.parent || window.parent === window) return;
1437
- try {
1438
- window.parent.postMessage(payload, parentTargetOrigin());
1439
- } catch {}
1440
- }
1441
-
1442
- window.addEventListener("message", (event) => {
1443
- // Only accept messages from the direct parent frame. Blocks sibling
1444
- // iframes and popups that could otherwise spoof play/pause/seek by
1445
- // forging data.source.
1446
- if (event.source !== window.parent) return;
1447
- const data = event.data || {};
1448
- if (data.type !== "control" && data.source !== "hf-parent") return;
1449
- if (event.origin && event.origin !== "null") {
1450
- trustedParentOrigin = event.origin;
1451
- }
1452
- if (data.action === "play") {
1453
- window.__player.play();
1454
- }
1455
- if (data.action === "pause" || data.action === "stop-media") {
1456
- window.__player.pause();
1457
- }
1458
- if (data.action === "seek") {
1459
- const nextTime = Number.isFinite(Number(data.time))
1460
- ? Number(data.time)
1461
- : Number.isFinite(Number(data.frame))
1462
- ? Number(data.frame) / 30
1463
- : Number.isFinite(Number(data.payload?.time))
1464
- ? Number(data.payload.time)
1465
- : time;
1466
- window.__player.seek(nextTime);
1467
- }
1468
- if (data.action === "set-playback-rate") {
1469
- setPlaybackRate(data.playbackRate ?? data.payload?.playbackRate);
1470
- }
1471
- if (data.action === "set-muted") {
1472
- setMuted(data.muted ?? data.payload?.muted);
1473
- }
1474
- });
1475
-
1476
- function selectTargetFromEvent(event) {
1477
- const handle = event.target instanceof Element
1478
- ? event.target.closest("[data-vf-frame-handle]")
1479
- : null;
1480
- const handleTargetId = handle?.getAttribute("data-vf-target-id") || null;
1481
- if (handleTargetId) {
1482
- return document.querySelector("[data-hf-id='" + CSS.escape(handleTargetId) + "'], #" + CSS.escape(handleTargetId));
1483
- }
1484
- return event.target instanceof Element
1485
- ? event.target.closest("[data-start]")
1486
- : null;
1487
- }
1488
-
1489
- function postSelectedLayer(event) {
1490
- const target = selectTargetFromEvent(event);
1491
- const rawId = target?.getAttribute("data-hf-id") || target?.id || null;
1492
- const id = rawId === "source-video" ? null : rawId;
1493
- postToParent({
1494
- source: "vidfarm-composition",
1495
- action: "select-layer",
1496
- id
1497
- });
1498
- }
1499
-
1500
- function postPreviewContextMenu(event) {
1501
- event.preventDefault();
1502
- const root = document.querySelector("[data-composition-id]");
1503
- const rect = root instanceof HTMLElement ? root.getBoundingClientRect() : null;
1504
- const target = selectTargetFromEvent(event);
1505
- const rawId = target?.getAttribute("data-hf-id") || target?.id || null;
1506
- const id = rawId === "source-video" ? null : rawId;
1507
- const x = rect ? ((event.clientX - rect.left) / Math.max(1, rect.width)) * 100 : 12;
1508
- const y = rect ? ((event.clientY - rect.top) / Math.max(1, rect.height)) * 100 : 70;
1509
- postToParent({
1510
- source: "vidfarm-composition",
1511
- action: "preview-context-menu",
1512
- id,
1513
- clientX: event.clientX,
1514
- clientY: event.clientY,
1515
- time,
1516
- frame: {
1517
- x: Math.max(0, Math.min(95, x)),
1518
- y: Math.max(0, Math.min(95, y)),
1519
- width: 42,
1520
- height: 12
1521
- }
1522
- });
1523
- }
1524
-
1525
- function frameFromNode(node) {
1526
- return {
1527
- x: Number.parseFloat(node.style.left || "0") || 0,
1528
- y: Number.parseFloat(node.style.top || "0") || 0,
1529
- width: Number.parseFloat(node.style.width || "100") || 100,
1530
- height: Number.parseFloat(node.style.height || "100") || 100,
1531
- // NaN (not 18) when the wrapper has no inline font-size \u2014 see frameFromNode
1532
- // in composition-runtime.ts. Prevents a plain MOVE from collapsing
1533
- // span-sized text to 18px; apply/stage paths all guard Number.isFinite.
1534
- fontSize: Number.parseFloat(node.style.fontSize)
1535
- };
1536
- }
1537
-
1538
- function isVisualFrameTarget(node) {
1539
- if (!(node instanceof HTMLElement) || node instanceof HTMLAudioElement) return false;
1540
- const id = node.getAttribute("data-hf-id") || node.id || "";
1541
- return id !== "source-video";
1542
- }
1543
-
1544
- function isTextFrameTarget(node) {
1545
- return node instanceof HTMLElement &&
1546
- !(node instanceof HTMLAudioElement) &&
1547
- !(node instanceof HTMLVideoElement) &&
1548
- !(node instanceof HTMLImageElement);
1549
- }
1550
-
1551
- function syncRuntimeFrameControls(node) {
1552
- if (!isVisualFrameTarget(node)) return;
1553
- const root = document.querySelector("[data-composition-id]");
1554
- if (!(root instanceof HTMLElement)) return;
1555
- const targetId = node.getAttribute("data-hf-id") || node.id || "";
1556
- if (!targetId) return;
1557
- let ring = document.querySelector("[data-vf-selection-ring='true']");
1558
- if (!(ring instanceof HTMLElement)) {
1559
- ring = document.createElement("div");
1560
- ring.setAttribute("data-vf-selection-ring", "true");
1561
- root.append(ring);
1562
- }
1563
- ring.style.display = "block";
1564
- ring.style.position = "absolute";
1565
- ring.style.left = node.style.left || "0%";
1566
- ring.style.top = node.style.top || "0%";
1567
- ring.style.width = node.style.width || "100%";
1568
- ring.style.height = node.style.height || "100%";
1569
- ring.style.borderRadius = node.style.borderRadius || "0";
1570
- ring.style.zIndex = "9999";
1571
- ring.style.pointerEvents = "auto";
1572
- ring.style.cursor = "grab";
1573
- ring.style.border = "1px dashed #F2CD46";
1574
- ring.style.boxShadow = "0 0 0 2px #118df2";
1575
- ring.setAttribute("data-vf-frame-handle", "move");
1576
- ring.setAttribute("data-vf-target-id", targetId);
1577
- for (const handle of Array.from(ring.querySelectorAll("[data-vf-frame-handle]"))) {
1578
- if (handle !== ring) handle.remove();
1579
- }
1580
- for (const [mode, cssText] of [
1581
- ["top-left", "left:-7px;top:-7px;cursor:nwse-resize;"],
1582
- ["top", "top:-7px;left:50%;transform:translateX(-50%);cursor:ns-resize;"],
1583
- ["top-right", "right:-7px;top:-7px;cursor:nesw-resize;"],
1584
- ["right", "right:-7px;top:50%;transform:translateY(-50%);cursor:ew-resize;"],
1585
- ["bottom-right", "right:-7px;bottom:-7px;cursor:nwse-resize;"],
1586
- ["bottom", "bottom:-7px;left:50%;transform:translateX(-50%);cursor:ns-resize;"],
1587
- ["bottom-left", "left:-7px;bottom:-7px;cursor:nesw-resize;"],
1588
- ["left", "left:-7px;top:50%;transform:translateY(-50%);cursor:ew-resize;"]
1589
- ]) {
1590
- const handle = document.createElement("span");
1591
- handle.setAttribute("data-vf-frame-handle", mode);
1592
- handle.setAttribute("data-vf-target-id", targetId);
1593
- handle.style.cssText = [
1594
- "position:absolute",
1595
- "display:block",
1596
- "width:14px",
1597
- "height:14px",
1598
- "box-sizing:border-box",
1599
- "border-radius:999px",
1600
- "border:2px solid #0b0d0a",
1601
- "background:#F2CD46",
1602
- "box-shadow:0 0 0 2px rgba(242,205,70,0.32),0 1px 4px rgba(0,0,0,0.38)",
1603
- "pointer-events:auto",
1604
- "touch-action:none",
1605
- cssText
1606
- ].join(";");
1607
- ring.append(handle);
1608
- }
1609
- }
1610
-
1611
- function applyFrameToNode(node, frame) {
1612
- node.style.left = frame.x + "%";
1613
- node.style.top = frame.y + "%";
1614
- node.style.width = frame.width + "%";
1615
- node.style.height = frame.height + "%";
1616
- if (Number.isFinite(frame.fontSize)) {
1617
- node.style.fontSize = frame.fontSize + "px";
1618
- }
1619
- syncRuntimeFrameControls(node);
1620
- }
1621
-
1622
- function postFrameDraft(node, phase) {
1623
- const id = node.getAttribute("data-hf-id") || node.id || null;
1624
- if (!id) return;
1625
- postToParent({
1626
- source: "vidfarm-composition",
1627
- action: "visual-frame-draft",
1628
- phase,
1629
- id,
1630
- frame: frameFromNode(node)
1631
- });
1632
- }
1633
-
1634
- let visualFrameDrag = null;
1635
- // Notifying the parent editor of an in-flight frame drag re-renders its
1636
- // whole tree; at raw pointermove rate (2-4x/frame on trackpads) the
1637
- // re-render backlog saturates the shared main thread and the layer lags the
1638
- // cursor. The node itself is moved directly every event (applyFrameToNode),
1639
- // so we only need to coalesce the parent postMessage to one-per-frame.
1640
- let pendingFrameDraftRaf = 0;
1641
-
1642
- function flushFrameDraftMove() {
1643
- pendingFrameDraftRaf = 0;
1644
- if (visualFrameDrag && visualFrameDrag.moved) {
1645
- postFrameDraft(visualFrameDrag.node, "move");
1646
- }
1647
- }
1648
-
1649
- function scheduleFrameDraftMove() {
1650
- if (pendingFrameDraftRaf) return;
1651
- pendingFrameDraftRaf = requestAnimationFrame(flushFrameDraftMove);
1652
- }
1653
-
1654
- function cancelPendingFrameDraftMove() {
1655
- if (!pendingFrameDraftRaf) return;
1656
- cancelAnimationFrame(pendingFrameDraftRaf);
1657
- pendingFrameDraftRaf = 0;
1658
- }
1659
-
1660
- function beginVisualFrameDrag(event) {
1661
- if (event.button !== 0) return;
1662
- const handle = event.target instanceof Element
1663
- ? event.target.closest("[data-vf-frame-handle]")
1664
- : null;
1665
- const handleTargetId = handle?.getAttribute("data-vf-target-id") || null;
1666
- const target = handleTargetId
1667
- ? document.querySelector("[data-hf-id='" + CSS.escape(handleTargetId) + "'], #" + CSS.escape(handleTargetId))
1668
- : event.target instanceof Element
1669
- ? event.target.closest("[data-start]")
1670
- : null;
1671
- if (!isVisualFrameTarget(target)) return;
1672
- const root = document.querySelector("[data-composition-id]");
1673
- if (!(root instanceof HTMLElement)) return;
1674
- const rootRect = root.getBoundingClientRect();
1675
- event.preventDefault();
1676
- event.stopPropagation();
1677
- postSelectedLayer(event);
1678
- visualFrameDrag = {
1679
- node: target,
1680
- mode: handle?.getAttribute("data-vf-frame-handle") || "move",
1681
- startX: event.clientX,
1682
- startY: event.clientY,
1683
- rootWidth: Math.max(1, rootRect.width),
1684
- rootHeight: Math.max(1, rootRect.height),
1685
- frame: frameFromNode(target),
1686
- moved: false
1687
- };
1688
- syncRuntimeFrameControls(target);
1689
- target.style.cursor = "grabbing";
1690
- postFrameDraft(target, "start");
1691
- }
1692
-
1693
- function updateVisualFrameDrag(event) {
1694
- if (!visualFrameDrag) return;
1695
- const drag = visualFrameDrag;
1696
- const dx = ((event.clientX - drag.startX) / drag.rootWidth) * 100;
1697
- const dy = ((event.clientY - drag.startY) / drag.rootHeight) * 100;
1698
- if (!drag.moved && Math.hypot(event.clientX - drag.startX, event.clientY - drag.startY) < 2) return;
1699
- drag.moved = true;
1700
- event.preventDefault();
1701
- const next = { ...drag.frame };
1702
- if (drag.mode === "move") {
1703
- next.x = Math.max(0, Math.min(100 - drag.frame.width, drag.frame.x + dx));
1704
- next.y = Math.max(0, Math.min(100 - drag.frame.height, drag.frame.y + dy));
1705
- }
1706
- if (drag.mode === "left" || drag.mode === "top-left" || drag.mode === "bottom-left") {
1707
- const nextX = Math.max(0, Math.min(drag.frame.x + drag.frame.width - 1, drag.frame.x + dx));
1708
- next.x = nextX;
1709
- next.width = Math.max(1, Math.min(100 - nextX, drag.frame.width + (drag.frame.x - nextX)));
1710
- }
1711
- if (drag.mode === "right" || drag.mode === "top-right" || drag.mode === "bottom-right") {
1712
- next.width = Math.max(1, Math.min(100 - drag.frame.x, drag.frame.width + dx));
1713
- }
1714
- if (drag.mode === "top" || drag.mode === "top-left" || drag.mode === "top-right") {
1715
- const nextY = Math.max(0, Math.min(drag.frame.y + drag.frame.height - 1, drag.frame.y + dy));
1716
- next.y = nextY;
1717
- next.height = Math.max(1, Math.min(100 - nextY, drag.frame.height + (drag.frame.y - nextY)));
1718
- }
1719
- if (drag.mode === "bottom" || drag.mode === "bottom-left" || drag.mode === "bottom-right") {
1720
- next.height = Math.max(1, Math.min(100 - drag.frame.y, drag.frame.height + dy));
1721
- }
1722
- if (
1723
- isTextFrameTarget(drag.node) &&
1724
- ["top-left", "top-right", "bottom-left", "bottom-right"].includes(drag.mode)
1725
- ) {
1726
- const widthScale = next.width / Math.max(1, drag.frame.width);
1727
- const heightScale = next.height / Math.max(1, drag.frame.height);
1728
- const scale = Math.sqrt(Math.max(0.05, widthScale * heightScale));
1729
- next.fontSize = Math.max(8, Math.min(180, (drag.frame.fontSize || 18) * scale));
1730
- }
1731
- applyFrameToNode(drag.node, next);
1732
- scheduleFrameDraftMove();
1733
- }
1734
-
1735
- function endVisualFrameDrag() {
1736
- if (!visualFrameDrag) return;
1737
- // Drop any coalesced "move" still queued for this frame; the "end"/"tap"
1738
- // message below carries the final frame, so a late "move" after it would
1739
- // only cause a redundant re-render (and race the commit).
1740
- cancelPendingFrameDraftMove();
1741
- visualFrameDrag.node.style.cursor = "";
1742
- postFrameDraft(visualFrameDrag.node, visualFrameDrag.moved ? "end" : "tap");
1743
- visualFrameDrag = null;
1744
- }
1745
-
1746
- function hoverVisualFrameTarget(event) {
1747
- const handle = event.target instanceof Element
1748
- ? event.target.closest("[data-vf-frame-handle]")
1749
- : null;
1750
- const handleTargetId = handle?.getAttribute("data-vf-target-id") || null;
1751
- const target = handleTargetId
1752
- ? document.querySelector("[data-hf-id='" + CSS.escape(handleTargetId) + "'], #" + CSS.escape(handleTargetId))
1753
- : event.target instanceof Element
1754
- ? event.target.closest("[data-start]")
1755
- : null;
1756
- if (!isVisualFrameTarget(target)) return;
1757
- target.style.cursor = "grab";
1758
- syncRuntimeFrameControls(target);
1759
- }
1760
-
1761
- document.addEventListener("pointerover", hoverVisualFrameTarget, true);
1762
- document.addEventListener("pointerdown", beginVisualFrameDrag, true);
1763
- document.addEventListener("pointermove", updateVisualFrameDrag, { passive: false });
1764
- document.addEventListener("pointerup", endVisualFrameDrag);
1765
- document.addEventListener("pointercancel", endVisualFrameDrag);
1766
- document.addEventListener("pointerdown", postSelectedLayer);
1767
- document.addEventListener("click", postSelectedLayer);
1768
- document.addEventListener("contextmenu", postPreviewContextMenu, true);
1769
-
1770
- apply(0);
1771
- })();
1772
- <\/script>`}function YJ(e){if(!e.includes(K6)&&e.includes("__VF_TRANSITIONS_V1__")&&(e=e.split(wJ).join(J6)),/window\.__player\s*=/.test(e))return e;let t=m4();return/<\/body>/i.test(e)?e.replace(/<\/body>/i,`${t}
1773
- </body>`):`${e}
1774
- ${t}`}function g4(e=ug[0]){let t=mk(e);GJ(t);let n=f4(e),r=e.width,o=e.height;return`<!doctype html>
1775
- <html>
1776
- <head>
1777
- <meta charset="UTF-8" />
1778
- <base href="/" />
1779
- <meta name="viewport" content="width=device-width, initial-scale=1.0" />
1780
- <style>
1781
- ${NJ}
1782
- html, body { width:100%; height:100%; margin:0; overflow:hidden; background:#050604; }
1783
- [data-composition-id] { position:relative; width:100vw; height:100vh; overflow:hidden; background:#050604; }
1784
- [data-vf-selected="true"] {
1785
- outline: 2px solid #118df2 !important;
1786
- outline-offset: 3px !important;
1787
- box-shadow: 0 0 0 1px #ffffff, 0 0 0 7px rgba(17, 141, 242, 0.20) !important;
1788
- }
1789
- audio { display:none; }
1790
- ${vJ}
1791
- ${kJ}
1792
- ${J6}
1793
- </style>
1794
- </head>
1795
- <body>
1796
- <div data-composition-id="${Yt(e.id)}"${e.origin==="raw"?' data-vf-origin="raw"':""} data-source-video="${Yt(e.title)}" data-width="${r}" data-height="${o}" data-duration="${He(n)}">
1797
- ${WJ(e,t)}
1798
- ${t.map(jJ).join(`
1799
- `)}
1800
- </div>
1801
- ${m4()}
1802
- </body>
1803
- </html>`}function Se(e){return e.key??e.id}function gk(e){return Array.from(new Set(e.filter(t=>!!t)))}function KJ(e){let t=[];for(let n of gk([e.hfId,e.domId,e.id,e.key]))t.push(`[data-hf-id="${CSS.escape(n)}"]`),t.push(`#${CSS.escape(n)}`);return e.selector&&t.push(e.selector),t}function gg(e){return`<!doctype html>
1804
- ${e.documentElement.outerHTML}`}function rt(e){return!!(e&&typeof e=="object"&&e.nodeType===1&&"style"in e)}function U_(e,t){return rt(e)&&e.tagName.toLowerCase()===t.toLowerCase()}function ci(e,t,n){let r=new DOMParser().parseFromString(e,"text/html"),o=cn(r,t);return rt(o)?(n(o),gg(r)):e}function eg(e,t,n){try{let r=e?.contentDocument,o=r?cn(r,t):null;return rt(o)?(n(o),!0):!1}catch{return!1}}function G1(e,t){try{let n=e?.contentDocument;if(!n)return 0;let r=new DOMParser().parseFromString(t,"text/html"),o=new Map;for(let a of Array.from(n.querySelectorAll("[data-start]"))){if(!rt(a))continue;let s=ui(a);s&&o.set(s,a)}let i=0;for(let a of Array.from(r.querySelectorAll("[data-start]"))){if(!rt(a))continue;let s=ui(a),l=s?o.get(s):null;if(!l)continue;for(let d of["data-start","data-duration","data-track-index","data-media-start","data-playback-start"]){let u=a.getAttribute(d);u===null?l.removeAttribute(d):l.setAttribute(d,u)}let c=Number(a.getAttribute("data-track-index")??Number.NaN);Number.isFinite(c)&&!U_(l,"audio")&&(l.style.zIndex=String(c)),i+=1}return i}catch{return 0}}var w6=new WeakSet;function XJ(e){return e.hasAttribute("data-vf-selection-ring")||e.hasAttribute("data-vf-frame-handle")}function x6(e){return e.hasAttribute("data-vf-playback-source")?"@playback-source":e.getAttribute("data-hf-id")||e.id||null}function h4(e,t){let n=e.style.visibility;for(let r of Array.from(e.attributes))r.name!=="data-vf-selected"&&(t.hasAttribute(r.name)||e.removeAttribute(r.name));for(let r of Array.from(t.attributes))e.getAttribute(r.name)!==r.value&&e.setAttribute(r.name,r.value);e.style.visibility!==n&&(e.style.visibility=n)}function JJ(e,t){h4(e,t),e.innerHTML!==t.innerHTML&&(e.innerHTML=t.innerHTML)}function k6(e,t){try{let n=e?.contentDocument,r=n?.querySelector("[data-composition-id]");if(!n||!rt(r))return!1;let i=new DOMParser().parseFromString(t,"text/html").querySelector("[data-composition-id]");if(!rt(i))return!1;let a=r.querySelector("[data-vf-playback-source]"),s=i.querySelector("[data-vf-playback-source]");if(!!a!=!!s)return!1;h4(r,i);let l=new Set,c=new Map;for(let g of Array.from(r.children)){if(XJ(g)){l.add(g);continue}let _=x6(g);_!==null&&rt(g)&&!c.has(_)&&c.set(_,g)}let d=new Set,u=[];for(let g of Array.from(i.children)){if(!rt(g))continue;let _=x6(g),y=_!==null?c.get(_):void 0;y&&!d.has(y)&&y.tagName===g.tagName?(d.add(y),JJ(y,g),u.push(y)):u.push(n.importNode(g,!0))}let m=new Set(u);for(let g of Array.from(r.children))l.has(g)||m.has(g)||(g instanceof HTMLMediaElement&&g.pause(),g.remove());let p=r.firstElementChild;for(let g of u){for(;p&&l.has(p);)p=p.nextElementSibling;if(p===g){p=p.nextElementSibling;continue}r.insertBefore(g,p)}return!0}catch{return!1}}function A6(e,t){try{let n=e?.contentDocument;return n?(n.open(),n.write(t),n.close(),!0):!1}catch{return!1}}function Zm(e,t){for(let n of t){let r=e.getAttribute(n);if(r!==null){let o=Number(r);if(Number.isFinite(o))return o}}}function I6(e){let t=fg(e),n=t.querySelector("[data-composition-id]"),r=[];for(let i of Array.from(t.querySelectorAll("[data-start]")))i===n||!rt(i)||r.push(i);let o=n?Number(n.getAttribute("data-duration")||0):0;return{nodes:r,duration:o}}function N6(e){return gk([e.getAttribute("data-hf-id")??void 0,e.id||void 0])}function R6(e){return gk([e.key,e.hfId,e.domId,e.id])}function $1(e,t,n){let r=e.getState(),o=r.elements,i=I6(t),a=I6(n),s=new Set(i.nodes.flatMap(N6)),l=new Set,c=[];for(let u of a.nodes){let m=N6(u);if(m.length===0)continue;let p=Zm(u,["data-start"])??0,g=Zm(u,["data-duration"])??0,_=Zm(u,["data-track-index"])??0,y=Zm(u,["data-playback-start","data-media-start"]),h=Zm(u,["data-volume"]),v=o.findIndex((T,x)=>!l.has(x)&&R6(T).some(N=>m.includes(N)));if(v>=0){l.add(v);let T=o[v],x=u.getAttribute("data-timeline-label")??u.getAttribute("data-label")??T.label??m[0],N=T.start===p&&T.duration===g&&T.track===_&&T.playbackStart===y&&T.volume===h&&T.label===x;c.push(N?T:{...T,start:p,duration:g,track:_,playbackStart:y,volume:h,label:x})}else{let T=m[0];c.push({id:T,key:T,hfId:u.getAttribute("data-hf-id")??void 0,domId:u.id||void 0,tag:u.tagName.toLowerCase(),label:u.getAttribute("data-timeline-label")??u.getAttribute("data-label")??T,start:p,duration:g,track:_,playbackStart:y,volume:h})}}o.forEach((u,m)=>{if(l.has(m))return;R6(u).some(g=>s.has(g))||c.push(u)});let d=c.length!==o.length||c.some((u,m)=>u!==o[m]);return d&&r.setElements(c),a.duration>0&&Math.abs(a.duration-r.duration)>.001&&r.setDuration?.(a.duration),d}function Fi(e,t){try{let a=function(){rt(i)&&(i.style.display="none")};var n=a;let r=e?.contentDocument;if(!r)return!1;let o=r.querySelector("[data-composition-id]"),i=r.querySelector("[data-vf-selection-ring='true']");for(let l of Array.from(r.querySelectorAll("[data-vf-selected='true']")))l.removeAttribute("data-vf-selected");if(!t)return a(),!0;let s=cn(r,t);return!s||U_(s,"audio")?(a(),!1):(!rt(i)&&rt(o)&&(i=r.createElement("div"),i.setAttribute("data-vf-selection-ring","true"),o.append(i)),rt(i)&&NQ(i,s,t),s.setAttribute("data-vf-selected","true"),!0)}catch{return!1}}function ui(e){return e.getAttribute("data-hf-id")||e.id}function Sc(e){let t=Number(e.getAttribute("data-start")??0),n=Number(e.getAttribute("data-duration")??0),r=Number(e.getAttribute("data-track-index")??0);return{start:t,duration:n,track:r}}function ff(e,t){if(e.track!==t.track)return!1;let n=e.start+e.duration,r=t.start+t.duration;return e.start<r-.001&&t.start<n-.001}function QJ(e){let t=new Map;for(let n of e){let r=n.tag==="audio",o=t.get(n.track);t.set(n.track,(o===void 0||o)&&r)}return t}function j1(e){return Array.from(new Set(e.map(t=>t.track))).sort((t,n)=>n-t)}function C6(e,t,n){let r=new Set([Se(t),t.hfId,t.domId,t.id].filter(o=>!!o));return e.filter(o=>![Se(o),o.hfId,o.domId,o.id].some(a=>a&&r.has(a))).filter(o=>!n||O_(n,o)!=="track-placeholder").map(o=>({start:o.start,duration:o.duration,track:o.track}))}function dg(e){return Number.isFinite(e.duration)&&e.duration>0}function q1(e,t){return dg(e)?t.some(n=>dg(n)&&ff(e,n)):!1}function ZJ(e,t,n,r,o){if(!Number.isFinite(n)||n<=0)return Math.max(0,r);let a=e.filter(p=>p.track===t&&dg(p)).map(p=>({start:p.start,end:p.start+p.duration})).sort((p,g)=>p.start-g.start),s=[];for(let p of a){let g=s[s.length-1];g&&p.start<=g.end+.001?g.end=Math.max(g.end,p.end):s.push({...p})}let l=Math.max(0,o-n),c=[],d=0;for(let p of s)p.start-d>=n-.001&&c.push({lo:d,hi:p.start-n}),d=Math.max(d,p.end);d<=l+.001&&c.push({lo:d,hi:l});let u=null,m=1/0;for(let p of c){let g=Math.min(p.hi,l);if(g<p.lo-.001)continue;let _=Re(r,p.lo,Math.max(p.lo,g)),y=Math.abs(_-r);y<m-.001&&(u=_,m=y)}return u}function Tc(e,t,n=new Set){if(!Number.isFinite(t.duration)||t.duration<=0)return t.track;let r=Array.from(e.querySelectorAll("[data-start]")).filter(a=>rt(a)),o=new Set;for(let a of r){let s=ui(a);if(s&&n.has(s))continue;let l=Sc(a);!Number.isFinite(l.duration)||l.duration<=0||ff({...t},l)&&o.add(l.track)}let i=Math.max(0,Math.floor(t.track));for(let a=0;a<512&&o.has(i);a+=1)i+=1;return i}function cn(e,t){let n=KJ(t);for(let r of n){if(r===t.selector&&t.selectorIndex!==void 0){let i=e.querySelectorAll(r).item(t.selectorIndex);if(rt(i))return i;continue}let o=e.querySelector(r);if(rt(o))return o}return null}function M6(e,t){return cn(e,t)?.getAttribute("data-vf-group")||null}function ek(e,t,n){return t?Array.from(e.querySelectorAll(`[data-vf-group="${CSS.escape(t)}"]`)).filter(r=>rt(r)&&r.hasAttribute("data-start")):[n]}function eQ(e,t,n){let r=new Set(t.map(ui)),o=Array.from(e.querySelectorAll("[data-start]")).filter(a=>rt(a));for(let a of t){let s=ui(a),l=n.get(s);if(!(!s||!l))for(let c of o){let d=ui(c);if(!(!d||r.has(d))&&ff(l,Sc(c)))throw new Error("Track collision: only one clip can occupy a track at a time.")}}let i=Array.from(n.entries()).filter(([,a])=>a.duration>0);for(let a=0;a<i.length;a+=1){let[s,l]=i[a];for(let[c,d]of i.slice(a+1))if(ff(l,d))throw new Error(`Track collision: ${s} overlaps ${c} on track ${l.track}.`)}}function tQ(e){let t=Array.from(e.querySelectorAll("[data-start]")).filter(r=>{if(!rt(r))return!1;let o=Number(r.getAttribute("data-duration")??0);return Number.isFinite(o)&&o>0});t.sort((r,o)=>{let i=Number(r.getAttribute("data-track-index")??0),a=Number(o.getAttribute("data-track-index")??0);if(i!==a)return i-a;let s=Number(r.getAttribute("data-start")??0),l=Number(o.getAttribute("data-start")??0);return s-l});let n=0;for(let r=0;r<t.length;r+=1){let o=t[r],i=Sc(o),a=!1;for(let d=0;d<r;d+=1)if(ff(i,Sc(t[d]))){a=!0;break}if(!a)continue;let s=new Set,l=ui(o);l&&s.add(l);let c=Tc(e,i,s);c!==i.track&&(o.setAttribute("data-track-index",String(c)),o.style.zIndex&&(o.style.zIndex=String(c)),n+=1)}return n}function fr(e,t){let n=new DOMParser().parseFromString(e,"text/html");t(n);let r=tQ(n);return{html:gg(n),resolvedCollisions:r}}function b4(e){if(!e)return null;let t=/<[^>]*data-composition-id[^>]*>/i.exec(e);if(!t)return null;let n=/\sdata-viral-dna\s*=\s*(?:"([^"]*)"|'([^']*)')/i.exec(t[0]),r=n?.[1]??n?.[2];if(!r)return null;try{let o=r.replace(/&quot;/g,'"').replace(/&amp;/g,"&").replace(/&lt;/g,"<").replace(/&gt;/g,">"),i=JSON.parse(o);if(!i||typeof i!="object")return null;let a=p=>typeof p=="string"?p.trim():"",s=p=>Array.isArray(p)?p.map(g=>typeof g=="string"?g.trim():"").filter(g=>g.length>0):[],l=i,c=l.emotional_punch??l.emotionalPunch,d=c&&typeof c=="object"?{coreEmotion:a(c.core_emotion??c.coreEmotion),tone:a(c.tone),arc:a(c.arc),peakMoment:a(c.peak_moment??c.peakMoment),mechanism:a(c.mechanism),contrast:a(c.contrast),humor:a(c.humor),audioVisualTension:a(c.audio_visual_tension??c.audioVisualTension),delivery:a(c.delivery),preserve:s(c.preserve)}:void 0,u=!!(d&&(d.coreEmotion||d.tone||d.arc||d.peakMoment||d.mechanism||d.contrast||d.audioVisualTension||d.delivery||d.humor&&d.humor.toLowerCase()!=="none"||d.preserve.length>0)),m={trendTagline:a(l.trend_tagline??l.trendTagline),hook:a(i.hook),retention:a(i.retention),payoff:a(i.payoff),emotionalPunch:u?d:void 0,preserve:s(i.preserve),avoid:s(i.avoid),promotions:s(l.promotions)};return!m.trendTagline&&!m.hook&&!m.retention&&!m.payoff&&!u&&m.preserve.length===0&&m.avoid.length===0&&m.promotions.length===0?null:m}catch{return null}}function nQ(e){if(!e)return null;let t=/<[^>]*data-composition-id[^>]*>/i.exec(e);if(!t)return null;let n=/\sdata-editor-harness\s*=\s*(?:"([^"]*)"|'([^']*)')/i.exec(t[0]),r=n?.[1]??n?.[2];if(!r)return null;try{let o=r.replace(/&quot;/g,'"').replace(/&amp;/g,"&").replace(/&lt;/g,"<").replace(/&gt;/g,">"),i=JSON.parse(o);return!i||typeof i!="object"?null:!!(i.one_liner&&i.one_liner.trim()||i.format&&i.format!=="other"||Array.isArray(i.scenes)&&i.scenes.length>0||Array.isArray(i.editing_bias)&&i.editing_bias.length>0)?i:null}catch{return null}}function rQ(e){if(!e||!e.includes("data-composition-id"))return!1;let t=/<[^>]*data-composition-id[^>]*>/i.exec(e);return!(t&&/\sdata-vf-origin\s*=\s*(?:"raw"|'raw')/i.test(t[0])||e.includes('data-vf-timeline-proxy="video"')||!e.includes("data-vf-playback-source")&&!/<video\b/i.test(e))}function vc(e){if(!e||!e.includes("data-track-index"))return e;let t=/<([a-zA-Z][a-zA-Z0-9-]*)((?:\s+[^\s"'>/=]+(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s"'`=<>]+))?)*)\s*(\/?)>/g,n=/\s+([^\s"'>/=]+)(?:\s*=\s*("[^"]*"|'[^']*'|[^\s"'`=<>]+))?/g;return e.replace(t,(r,o,i,a)=>{let s=null,l='"',c=null,d=-1,u=-1;n.lastIndex=0;let m;for(;m=n.exec(i);){let g=m[1].toLowerCase(),_=m[2];if(_===void 0)continue;let y=_.startsWith('"')||_.startsWith("'"),h=y?_.slice(1,-1):_;if(g==="data-track-index"){let v=Number.parseInt(h,10);Number.isFinite(v)&&(s=v)}else g==="style"&&(l=y?_[0]:'"',c=h,d=m.index,u=m.index+m[0].length)}if(s===null)return r;let p=String(s);if(c!==null){let g;if(/(^|;)\s*z-index\s*:/i.test(c)){if(new RegExp(`(^|;)\\s*z-index\\s*:\\s*${p}\\s*(;|$)`,"i").test(c))return r;g=c.replace(/(^|;)\s*z-index\s*:\s*[^;]*/i,(y,h)=>`${h}z-index:${p}`)}else g=c.endsWith(";")||c.length===0?`${c}z-index:${p}`:`${c};z-index:${p}`;let _=`${i.slice(0,d)} style=${l}${g}${l}${i.slice(u)}`;return`<${o}${_}${a?"/":""}>`}return`<${o}${i} style="z-index:${p}"${a?"/":""}>`})}var O6=null,V1=null;function fg(e){if(O6===e&&V1)return V1;let t=new DOMParser().parseFromString(e,"text/html");return O6=e,V1=t,t}function P_(e,t){return cn(fg(e),t)}function li(e,t,n){let r=e?.getPropertyValue(t)??"",o=Number.parseFloat(r);return Number.isFinite(o)?o:n}function D6(e,t){let n=P_(e,t),r=hk(t),o=n?.querySelector("[data-vf-text-inline]"),i=n?.getAttribute("data-text-background-style"),a=n?.getAttribute("data-text-background-color"),s=n?.style.background&&n.style.background!=="transparent"?n.style.background:"";return{text:n?.textContent?.trim()||r?.text||t.label||"",src:n?.getAttribute("src")||r?.src||"",fontFamily:C_(o?.style.fontFamily||n?.style.fontFamily),fontWeight:MJ(o?.style.fontWeight||n?.style.fontWeight,el(C_(o?.style.fontFamily||n?.style.fontFamily))),italic:n?.style.fontStyle==="italic",underline:(n?.style.textDecorationLine||n?.style.textDecoration||"").includes("underline"),color:o?.style.color||n?.style.color||r?.color||"#ffffff",background:a||o?.style.background||s||r?.background||"#000000",textBackgroundStyle:dk(i||r?.textBackgroundStyle),fontSize:li(n?.style,"font-size",r?.fontSize??18),radius:li(n?.style,"border-radius",r?.radius??0),x:li(n?.style,"left",r?.x??0),y:li(n?.style,"top",r?.y??0),width:li(n?.style,"width",r?.width??100),height:li(n?.style,"height",r?.height??100),volume:Number(n?.getAttribute("data-volume")??t.volume??r?.volume??1),muted:!!(n?.hasAttribute("muted")||r?.muted),objectFit:oQ(n?.style.objectFit),objectPosition:iQ(n?.style.objectPosition),kenBurns:n?.getAttribute("data-kenburns")||"none",transition:n?.getAttribute("data-transition")||"none",transitionDuration:Js(Number.parseFloat(n?.getAttribute("data-transition-duration")??"")),transitionOut:n?.getAttribute("data-transition-out")||"none",transitionOutDuration:Js(Number.parseFloat(n?.getAttribute("data-transition-out-duration")??"")),captionAnimation:n?.getAttribute("data-caption-animation")||"none",captionActiveColor:n?.style.getPropertyValue("--vf-cap-active").trim()||"#FFE14D",captionHighlightColor:n?.style.getPropertyValue("--vf-cap-hl").trim()||"#7C3AED",captionUppercase:n?.getAttribute("data-caption-uppercase")==="1",slug:n?.getAttribute("data-hf-slug")??"",note:n?.getAttribute("data-hf-note")??""}}function B_(e){return e.toLowerCase().replace(/[^a-z0-9]+/g,"_").replace(/^_+|_+$/g,"").slice(0,64)}function oQ(e){let t=(e??"").trim().toLowerCase();return t==="contain"||t==="fill"||t==="none"||t==="scale-down"?t:"cover"}function iQ(e){let t=(e??"").trim().toLowerCase().replace(/\s+/g," ");if(!t)return"center";let n=t.split(" ");if(n.length<1||n.length>4)return"center";let r=o=>o==="center"||o==="left"||o==="right"||o==="top"||o==="bottom"||/^-?\d+(?:\.\d+)?(?:%|px)$/.test(o);return n.every(r)?t:"center"}function y4(e,t,n){let r=cn(e,t);if(!r)return;let o=n.start??t.start,i=n.duration??t.duration,a=n.track??t.track;if(r.setAttribute("data-start",He(o)),r.setAttribute("data-duration",He(i)),r.setAttribute("data-end",He(o+i)),r.setAttribute("data-track-index",String(a)),n.playbackStart!==void 0){let s=He(n.playbackStart);r.setAttribute("data-media-start",s),r.setAttribute("data-playback-start",s)}}function z_(e,t,n){return fr(e,r=>y4(r,t,n))}function og(e,t){return fr(e,n=>{for(let r of t)y4(n,r.element,r.updates)})}function hk(e){return cg.find(t=>t.id===e.hfId||t.id===e.domId||t.id===e.id)}function O_(e,t){return P_(e,t)?.getAttribute("data-layer-kind")||null}function _4(e,t){return P_(e,t)?.getAttribute("data-layer-format")||null}function L6(e){return!Number.isFinite(e)||e<=0?1:Math.max(.05,Math.min(8,e))}function Da(e){try{let t=e?.contentWindow;return t?.__player&&typeof t.__player.play=="function"?t.__player:null}catch{return null}}function w_(e){try{let t=Da(e);return t?.refreshClips?.(),!!t?.refreshClips}catch{return!1}}function U6(e){try{Da(e)?.syncCaptions?.()}catch{}}function P6(e,t,n){try{e?.contentWindow?.postMessage({source:"hf-parent",type:"control",action:t,...n},"*")}catch{}}var aQ=(0,S.memo)(function({disabled:t,speedDraft:n,onSpeedDraftChange:r,onCommitSpeed:o,onSeek:i,onTogglePlay:a,onUndo:s,onRedo:l,canUndo:c,canRedo:d,usePlayerStore:u,onOpenUploadMedia:m,uploadMediaActive:p=!1}){let g=u(R=>R.isPlaying),_=u(R=>R.currentTime),y=u(R=>R.duration),h=u(R=>R.zoomMode),v=u(R=>R.manualZoomPercent),T=u(R=>R.setZoomMode),x=u(R=>R.setManualZoomPercent),N=y>0?y:ng,M=h==="fit"?100:v,[k,P]=(0,S.useState)(()=>Ys(_)),[F,U]=(0,S.useState)(!1);(0,S.useEffect)(()=>{F||P(Ys(_))},[_,F]);function X(R){T("manual"),x(Math.max(25,Math.min(400,R)))}function G(){let R=T6(k);if(R===null){P(Ys(_));return}i(Math.max(0,Math.min(N,R)))}return(0,f.jsxs)("div",{className:"direct-player-controls",children:[(0,f.jsx)("button",{className:"history-icon-button",type:"button","aria-label":"Undo",disabled:!c,onClick:s,children:(0,f.jsx)("span",{"aria-hidden":"true",children:"\u21B6"})}),(0,f.jsx)("button",{className:"play-icon-button",type:"button","aria-label":g?"Pause":"Play",disabled:t,onClick:a,children:(0,f.jsx)("span",{className:g?"pause-glyph":"play-glyph"})}),(0,f.jsx)("button",{className:"history-icon-button",type:"button","aria-label":"Redo",disabled:!d,onClick:l,children:(0,f.jsx)("span",{"aria-hidden":"true",children:"\u21B7"})}),(0,f.jsxs)("span",{className:"time-readout",children:[(0,f.jsx)("span",{className:"inline-time-input",children:(0,f.jsx)("input",{"aria-label":"Timeline position",type:"text",inputMode:"numeric",pattern:"\\\\d+:\\\\d{2}:\\\\d{2}",value:k,disabled:t,onFocus:()=>{U(!0),P(Ys(Math.min(_,N)))},onChange:R=>{let C=R.target.value;P(C);let $=T6(C);$!==null&&i(Math.max(0,Math.min(N,$)))},onBlur:()=>{U(!1),G()},onKeyDown:R=>{R.key==="Enter"&&R.currentTarget.blur(),R.key==="Escape"&&(P(Ys(_)),R.currentTarget.blur())}})}),(0,f.jsxs)("span",{children:["/ ",Ys(N)]})]}),(0,f.jsx)("input",{className:"preview-scrubber",type:"range",min:"0",max:N,step:"0.01",value:Math.min(_,N),disabled:t,onChange:R=>i(Number(R.target.value))}),(0,f.jsxs)("label",{className:"speed-input",children:[(0,f.jsx)("span",{children:"Speed"}),(0,f.jsxs)("span",{className:"suffix-number",children:[(0,f.jsx)("input",{type:"number",min:"0.05",max:"8",step:"0.05",value:n,disabled:t,onChange:R=>r(R.target.value),onBlur:R=>o(Number(R.target.value)),onKeyDown:R=>{R.key==="Enter"&&R.currentTarget.blur()}}),(0,f.jsx)("b",{children:"x"})]})]}),(0,f.jsxs)("label",{className:"zoom-input",children:[(0,f.jsx)("span",{children:"Zoom"}),(0,f.jsxs)("span",{className:"suffix-number",children:[(0,f.jsx)("input",{type:"number",min:"25",max:"400",step:"5",value:Math.round(M),disabled:t,onChange:R=>X(Number(R.target.value))}),(0,f.jsx)("b",{children:"%"})]})]}),m&&(0,f.jsxs)("button",{type:"button",className:`upload-media-button${p?" is-active":""}`,"aria-label":"Upload media","aria-pressed":p,title:"Upload media \u2014 add a file from your computer, My Files, or a raw",onClick:m,children:[(0,f.jsxs)("svg",{width:"17",height:"17",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[(0,f.jsx)("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}),(0,f.jsx)("path",{d:"M17 8l-5-5-5 5"}),(0,f.jsx)("path",{d:"M12 3v12"})]}),(0,f.jsx)("span",{children:"Upload media"})]})]})});function D_(e,t,n){let r=(t||"").toLowerCase();if(r.startsWith("video/"))return"video";if(r.startsWith("image/"))return"image";if(r.startsWith("audio/"))return"audio";let o=`${n||""} ${e||""}`.toLowerCase();return/\.(mp4|mov|webm|m4v|mkv|ogv)(?=$|[?#&/])/.test(o)?"video":/\.(png|jpe?g|gif|webp|avif|svg|bmp)(?=$|[?#&/])/.test(o)?"image":/\.(mp3|wav|m4a|aac|ogg|oga|flac)(?=$|[?#&/])/.test(o)?"audio":null}function sQ(e,t,n){let r=new URLSearchParams,o=(e||"").trim();if(o&&(r.set(n==="video"?"source_video_url":"source_image_url",o),t&&r.set(n==="video"?"source_video_name":"source_image_name",t)),typeof window<"u"){let s=new URLSearchParams(window.location.search).get("account");s&&r.set("account",s),r.set("tracer",`inpaint_${Date.now().toString(36)}`)}let i=n==="video"?"/tools/video":"/tools/image",a=r.toString();return a?`${i}?${a}`:i}var lQ=(0,S.memo)(function({value:t,x:n,y:r,onClose:o,onApply:i}){let a=(0,S.useRef)(null),[s,l]=(0,S.useState)(t);(0,S.useEffect)(()=>{function g(y){a.current?.contains(y.target)||o()}function _(y){y.key==="Escape"&&o()}return window.addEventListener("pointerdown",g),window.addEventListener("keydown",_),()=>{window.removeEventListener("pointerdown",g),window.removeEventListener("keydown",_)}},[o]);let c=340,d=168,u=Math.min(Math.max(8,n-c/2),Math.max(8,window.innerWidth-c-8)),m=Math.min(Math.max(8,r+10),Math.max(8,window.innerHeight-d-8));function p(){i(s.trim()),o()}return(0,f.jsxs)("div",{ref:a,className:"media-source-path-popover",style:{left:u,top:m},children:[(0,f.jsx)("div",{className:"media-source-path-popover-title",children:"Path or public URL"}),(0,f.jsx)("textarea",{className:"media-source-path-input",value:s,autoFocus:!0,spellCheck:!1,placeholder:"/files/my-clip.mp4 or https://\u2026",onChange:g=>l(g.target.value),onKeyDown:g=>{g.key==="Enter"&&(g.metaKey||g.ctrlKey)&&(g.preventDefault(),p())}}),(0,f.jsxs)("div",{className:"media-source-path-popover-foot",children:[(0,f.jsx)("span",{children:"Directory-relative path or absolute public link."}),(0,f.jsx)("button",{type:"button",className:"media-source-path-apply",onClick:p,children:"Apply"})]})]})});function tk({onInsert:e}){let[t,n]=(0,S.useState)(!1);return(0,f.jsxs)(f.Fragment,{children:[(0,f.jsxs)("button",{type:"button",className:"timeline-menu-item timeline-menu-expand","aria-expanded":t,onClick:()=>n(r=>!r),children:[(0,f.jsx)("span",{children:"Insert Media"}),(0,f.jsx)("span",{className:"timeline-menu-caret","aria-hidden":"true",children:t?"\u25BE":"\u25B8"})]}),t&&(0,f.jsxs)("div",{className:"timeline-submenu",role:"group","aria-label":"Insert media kind",children:[(0,f.jsx)("button",{type:"button",className:"timeline-menu-item timeline-submenu-item",onClick:()=>e("video"),children:"Video"}),(0,f.jsx)("button",{type:"button",className:"timeline-menu-item timeline-submenu-item",onClick:()=>e("image"),children:"Image"}),(0,f.jsx)("button",{type:"button",className:"timeline-menu-item timeline-submenu-item",onClick:()=>e("audio"),children:"Audio"})]})]})}var cQ=(0,S.memo)(function({x:t,y:n,onClose:r,actions:o}){let i=(0,S.useRef)(null);(0,S.useEffect)(()=>{function d(m){i.current?.contains(m.target)||r()}function u(m){m.key==="Escape"&&r()}return window.addEventListener("pointerdown",d),window.addEventListener("keydown",u),()=>{window.removeEventListener("pointerdown",d),window.removeEventListener("keydown",u)}},[r]);let a=208,s=Math.min(340,12+o.length*42),l=Math.min(Math.max(8,t-a),Math.max(8,window.innerWidth-a-8)),c=Math.min(Math.max(8,n+8),Math.max(8,window.innerHeight-s-8));return(0,f.jsx)("div",{ref:i,className:"media-actions-menu",style:{left:l,top:c,width:a},children:o.map((d,u)=>(0,f.jsxs)("button",{type:"button",className:"media-actions-menu-item",disabled:d.disabled,onClick:()=>{d.disabled||(d.onClick(),r())},children:[(0,f.jsx)("span",{className:"media-actions-menu-label",children:d.label}),d.hint?(0,f.jsx)("span",{className:"media-actions-menu-hint",children:d.hint}):null]},u))})}),uQ=(0,S.memo)(function({chip:t,x:n,y:r,onClose:o,onApply:i}){let a=(0,S.useRef)(null),[s,l]=(0,S.useState)(t.duration||Q6),c=t.kind==="out"?ak:ik,d=t.preset??"none",u=t.kind==="junction"?"Transition between clips":t.kind==="in"?"Transition in":"Transition out";(0,S.useEffect)(()=>{function y(v){a.current?.contains(v.target)||o()}function h(v){v.key==="Escape"&&o()}return window.addEventListener("pointerdown",y),window.addEventListener("keydown",h),()=>{window.removeEventListener("pointerdown",y),window.removeEventListener("keydown",h)}},[o]);let m=296,p=404,g=Math.min(Math.max(8,n-m/2),Math.max(8,window.innerWidth-m-8)),_=Math.min(Math.max(8,r-p-14),Math.max(8,window.innerHeight-p-8));return(0,f.jsxs)("div",{ref:a,className:"timeline-transition-picker",style:{left:g,top:_},children:[(0,f.jsxs)("div",{className:"timeline-transition-picker-title",children:[(0,f.jsx)("b",{children:u}),(0,f.jsx)("span",{children:t.element.label??t.element.id})]}),(0,f.jsx)("div",{className:"text-background-options transition-preset-options",role:"radiogroup","aria-label":u,children:c.map(y=>(0,f.jsx)("button",{type:"button",role:"radio","aria-checked":d===y.value,className:`text-background-option${d===y.value?" selected":""}`,onClick:()=>i(y.value==="none"?null:y.value,s),children:(0,f.jsx)("b",{children:y.label})},y.value))}),(0,f.jsxs)("div",{className:"timeline-transition-picker-durations",children:[(0,f.jsx)("span",{children:"Length"}),[.3,.5,.8,1.2,2].map(y=>(0,f.jsxs)("button",{type:"button",className:`transition-duration-chip${Math.abs(s-y)<.01?" selected":""}`,onClick:()=>{l(y),d!=="none"&&i(d,y)},children:[y,"s"]},y))]})]})}),dQ=(0,S.memo)(function({state:t,usePlayerStore:n,canGroup:r,canUngroup:o,onClose:i,onSeek:a,onSplit:s,onInsertLayer:l,onInsertText:c,onInsertCaptions:d,onInsertMedia:u,onUploadMedia:m,onCopyTimestamp:p,onCopyCoordinates:g,onGroup:_,onUngroup:y,onDelete:h}){let v=n(R=>R.currentTime),T=(0,S.useRef)(null),x=220,N=t.element?362:258,M=Math.min(Math.max(8,t.x),Math.max(8,window.innerWidth-x-8)),k=Math.min(Math.max(8,t.y),Math.max(8,window.innerHeight-N-8)),P=t.element?.track??t.track,F=typeof P=="number",U=!!(t.element&&v>t.element.start&&v<t.element.start+t.element.duration),X=!!(t.element&&t.element.hfId!=="source-video");(0,S.useEffect)(()=>{function R($){T.current?.contains($.target)||i()}function C($){$.key==="Escape"&&i()}return window.addEventListener("pointerdown",R),window.addEventListener("keydown",C),()=>{window.removeEventListener("pointerdown",R),window.removeEventListener("keydown",C)}},[i]);function G({children:R,disabled:C,danger:$,onClick:ee}){return(0,f.jsx)("button",{type:"button",disabled:C,className:`timeline-menu-item ${$?"danger":""}`,onClick:()=>{C||(ee(),i())},children:R})}return(0,f.jsx)("div",{ref:T,className:"timeline-context-menu",style:{left:M,top:k},onContextMenu:R=>R.preventDefault(),children:t.element?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsxs)("div",{className:"timeline-menu-title",children:[(0,f.jsx)("span",{children:t.element.label??t.element.id}),(0,f.jsx)("time",{children:M_(v)})]}),(0,f.jsx)(G,{disabled:!U,onClick:()=>t.element&&s(t.element,v),children:"Split at playhead"}),(0,f.jsx)(G,{disabled:!F,onClick:()=>F&&l(P,"above"),children:"New layer above"}),(0,f.jsx)(G,{disabled:!F,onClick:()=>F&&l(P,"below"),children:"New layer below"}),(0,f.jsx)(G,{onClick:()=>c({time:v,track:null}),children:"Insert Text"}),(0,f.jsx)(G,{onClick:()=>d({time:v,track:null}),children:"Insert Captions"}),(0,f.jsx)(tk,{onInsert:R=>{u({time:v,track:null},R),i()}}),(0,f.jsx)(G,{onClick:()=>m({time:v,track:null}),children:"Upload Media\u2026"}),(0,f.jsx)(G,{onClick:()=>p(v),children:"Copy Timestamp"}),(0,f.jsx)(G,{onClick:()=>g({time:v,track:P??null}),children:"Copy Coordinates"}),r&&(0,f.jsx)(G,{onClick:_,children:"Group selected"}),o&&(0,f.jsx)(G,{onClick:y,children:"Ungroup"}),(0,f.jsx)(G,{disabled:!X,danger:!0,onClick:()=>t.element&&h(t.element),children:"Delete layer"})]}):(0,f.jsxs)(f.Fragment,{children:[(0,f.jsxs)(G,{onClick:()=>a(t.time),children:["Seek to ",M_(t.time)]}),(0,f.jsx)(G,{disabled:!F,onClick:()=>F&&l(P,"above"),children:"New layer above"}),(0,f.jsx)(G,{disabled:!F,onClick:()=>F&&l(P,"below"),children:"New layer below"}),(0,f.jsx)(G,{onClick:()=>c({time:t.time,track:null}),children:"Insert Text"}),(0,f.jsx)(G,{onClick:()=>d({time:t.time,track:null}),children:"Insert Captions"}),(0,f.jsx)(tk,{onInsert:R=>{u({time:t.time,track:null},R),i()}}),(0,f.jsx)(G,{onClick:()=>m({time:t.time,track:null}),children:"Upload Media\u2026"}),(0,f.jsx)(G,{onClick:()=>p(t.time),children:"Copy Timestamp"}),(0,f.jsx)(G,{onClick:()=>g({time:t.time,track:P??null}),children:"Copy Coordinates"})]})})});function fQ({state:e,onClose:t,onInsertText:n,onInsertCaptions:r,onInsertMedia:o,onUploadMedia:i,onCopyTimestamp:a,onCopyCoordinates:s}){let l=(0,S.useRef)(null),c=220,d=174,u=Math.min(Math.max(8,e.x),Math.max(8,window.innerWidth-c-8)),m=Math.min(Math.max(8,e.y),Math.max(8,window.innerHeight-d-8));(0,S.useEffect)(()=>{function g(y){l.current?.contains(y.target)||t()}function _(y){y.key==="Escape"&&t()}return window.addEventListener("pointerdown",g),window.addEventListener("keydown",_),()=>{window.removeEventListener("pointerdown",g),window.removeEventListener("keydown",_)}},[t]);function p({children:g,onClick:_}){return(0,f.jsx)("button",{type:"button",className:"timeline-menu-item",onClick:()=>{_(),t()},children:g})}return(0,f.jsxs)("div",{ref:l,className:"timeline-context-menu preview-context-menu",style:{left:u,top:m},onContextMenu:g=>g.preventDefault(),children:[(0,f.jsx)(p,{onClick:()=>n({time:e.time,frame:e.frame}),children:"Insert Text"}),(0,f.jsx)(p,{onClick:()=>r({time:e.time,frame:e.frame}),children:"Insert Captions"}),(0,f.jsx)(tk,{onInsert:g=>{o({time:e.time,frame:e.frame},g),t()}}),(0,f.jsx)(p,{onClick:()=>i({time:e.time,frame:e.frame}),children:"Upload Media\u2026"}),(0,f.jsx)(p,{onClick:()=>a(e.time),children:"Copy Timestamp"}),(0,f.jsx)(p,{onClick:()=>s(e.frame),children:"Copy Coordinates"})]})}function pQ({state:e,forkId:t,onClose:n,onViewAllRenders:r,otherRenderCount:o=0}){let i=i4(e),a=e.phase==="starting"||e.phase==="running",s=e.phase==="succeeded"?"Rendered":e.phase==="failed"?"Render failed":"Rendering...",l=e.status||(e.phase==="starting"?"STARTING":"RUNNING"),c=e.totalFrames?`${e.framesRendered??0} / ${e.totalFrames} frames`:`${e.framesRendered??0} frames`,d=!!Xs()?.localRender,[u,m]=(0,S.useState)(!1),p=(0,S.useMemo)(()=>{if(!d||!t)return null;let _=window.location.origin;return["Render my Vidfarm composition to an MP4 with the vidfarm devcli.","",`Local server: ${_} (a \`vidfarm serve\` box \u2014 renders are free and run in-process)`,`Fork id: ${t}`,"",`Run: vidfarm render ${t} --wait --host ${_}`,"","Auth: add --api-key <key> using the same key `vidfarm serve` was started with (its --key / VIDFARM_API_KEY value; the default dev key is vidfarm-local-dev-key).","If the vidfarm CLI is not installed, install it first: npm i -g @mevdragon/vidfarm-devcli","The command prints the finished MP4 URL when the render completes. If it fails, show me the full error output."].join(`
1805
- `)},[t,d]),g=(0,S.useCallback)(()=>{if(!p)return;let _=()=>{m(!0),window.setTimeout(()=>m(!1),2e3)},y=()=>{let h=document.createElement("textarea");h.value=p,h.setAttribute("readonly",""),h.style.position="fixed",h.style.opacity="0",document.body.appendChild(h),h.select();try{document.execCommand("copy"),_()}finally{h.remove()}};navigator.clipboard?.writeText?navigator.clipboard.writeText(p).then(_).catch(y):y()},[p]);return(0,f.jsx)("div",{className:"publish-modal-backdrop",role:"presentation",children:(0,f.jsxs)("section",{className:"publish-modal",role:"dialog","aria-modal":"true","aria-labelledby":"publish-modal-title",children:[(0,f.jsxs)("div",{className:"publish-modal-kicker",children:[(0,f.jsx)("span",{children:d?"Local render \u2014 vidfarm serve":"Production AWS Lambda"}),(0,f.jsx)("button",{type:"button",className:"publish-modal-close","aria-label":a?"Minimize \u2014 render continues in the background":"Close publish status",title:a?"Minimize \u2014 render continues in the background":"Close",onClick:n,children:a?"\u2013":"x"})]}),(0,f.jsxs)("h2",{id:"publish-modal-title",children:[a&&(0,f.jsx)(Ks,{label:"Rendering"}),s,a&&(0,f.jsx)("span",{style:{fontWeight:400,opacity:.6,fontSize:"0.72em",marginLeft:"0.5em"},children:"\xB7 about 5 min"})]}),(0,f.jsxs)("p",{className:"publish-modal-summary",children:["Rendering ",(0,f.jsx)("strong",{children:e.title})," ",d?"in-process on this machine (free)":"on production infrastructure",". The final output link will appear when the render succeeds."]}),a&&(0,f.jsx)("p",{className:"publish-modal-eta",children:"Estimated time: ~5 minutes. Feel free to open new tabs and keep working \u2014 this render continues in the background and the output link will appear here when it's ready."}),(0,f.jsx)("div",{className:"publish-progress-shell","aria-label":`Publish progress ${i}%`,children:(0,f.jsx)("span",{style:{width:`${i}%`}})}),(0,f.jsxs)("dl",{className:"publish-detail-grid",children:[(0,f.jsxs)("div",{children:[(0,f.jsx)("dt",{children:"Status"}),(0,f.jsx)("dd",{children:l})]}),(0,f.jsxs)("div",{children:[(0,f.jsx)("dt",{children:"Progress"}),(0,f.jsxs)("dd",{children:[i,"%"]})]}),(0,f.jsxs)("div",{children:[(0,f.jsx)("dt",{children:"Frames"}),(0,f.jsx)("dd",{children:c})]}),(0,f.jsxs)("div",{children:[(0,f.jsx)("dt",{children:"Cost"}),(0,f.jsx)("dd",{children:e.cost||"$0.0000"})]}),e.renderId&&(0,f.jsxs)("div",{children:[(0,f.jsx)("dt",{children:"Render ID"}),(0,f.jsx)("dd",{children:e.renderId})]}),e.phase==="succeeded"&&e.outputS3Uri&&(0,f.jsxs)("div",{children:[(0,f.jsx)("dt",{children:"Output"}),(0,f.jsx)("dd",{children:e.outputS3Uri})]})]}),e.error||e.errors?.length?(0,f.jsxs)("div",{className:"publish-error-box",children:[(0,f.jsx)("strong",{children:e.error||e.errors?.[0]?.error||"Render failed"}),e.errors?.slice(0,2).map((_,y)=>(0,f.jsxs)("p",{children:[_.state?`${_.state}: `:"",_.cause||_.error]},`${_.state||"state"}-${y}`))]}):null,e.phase==="failed"&&p?(0,f.jsxs)("div",{className:"publish-agent-fallback",children:[(0,f.jsx)("strong",{children:"Backup: render with your local AI agent"}),(0,f.jsx)("p",{children:"Copy this prompt into the AI coding agent on this machine (Claude Code, Codex, ...) \u2014 it renders the same composition through the vidfarm devcli."}),(0,f.jsx)("pre",{children:p}),(0,f.jsx)("button",{type:"button",onClick:g,children:u?"Copied!":"Copy prompt"})]}):null,(0,f.jsxs)("div",{className:"publish-modal-actions",children:[e.outputUrl&&(0,f.jsx)("a",{href:e.outputUrl,target:"_blank",rel:"noreferrer",children:"Open output"}),a&&(0,f.jsx)("button",{type:"button",className:"publish-modal-minimize",onClick:n,children:"Keep working (render in background)"}),r&&o>0&&(0,f.jsxs)("button",{type:"button",className:"publish-modal-allrenders",onClick:r,children:["All renders (",o+1,")"]})]})]})})}function mQ({forkId:e,renderId:t,fallbackTitle:n,onUpdate:r}){let o=(0,S.useRef)(r);return o.current=r,(0,S.useEffect)(()=>{let i=!1,a=0,s=0,l=async()=>{try{let c=await fetch(`/api/v1/compositions/${encodeURIComponent(e)}/renders/${encodeURIComponent(t)}`),d=await c.json().catch(()=>({}));if(i)return;if(!c.ok||d.ok===!1)throw new Error(d.error||`Publish progress failed with ${c.status}`);a=0;let u=o4(d,n);o.current(u),u.phase==="running"&&(s=window.setTimeout(()=>{l()},4500))}catch(c){if(i)return;if(Po("editor.publish-poll-error",c instanceof Error?c.stack:c),a+=1,a<5){s=window.setTimeout(()=>{l()},4500);return}o.current({phase:"failed",title:n,status:"FAILED",error:"Lost connection while checking render status \u2014 the render may still be running. Check your jobs list."})}};return s=window.setTimeout(()=>{l()},4500),()=>{i=!0,window.clearTimeout(s)}},[e,t,n]),null}function gQ({renders:e,onClose:t,onOpen:n}){let r=[...e].sort((o,i)=>i.startedAt-o.startedAt);return(0,f.jsx)("div",{className:"publish-modal-backdrop",role:"presentation",onClick:t,children:(0,f.jsxs)("section",{className:"render-history-modal",role:"dialog","aria-modal":"true","aria-label":"Render history",onClick:o=>o.stopPropagation(),children:[(0,f.jsxs)("div",{className:"publish-modal-kicker",children:[(0,f.jsx)("span",{children:"Renders"}),(0,f.jsx)("button",{type:"button",className:"publish-modal-close","aria-label":"Close render history",onClick:t,children:"x"})]}),(0,f.jsx)("h2",{children:"Render history"}),r.length===0?(0,f.jsx)("p",{className:"render-history-empty",children:"No renders yet. Hit Render to export the final MP4."}):(0,f.jsx)("ul",{className:"render-history-list",children:r.map(o=>{let i=o.state,a=i4(i),s=i.phase==="starting"||i.phase==="running",l=i.phase==="succeeded"?"Done":i.phase==="failed"?"Failed":`Rendering ${a}%`;return(0,f.jsxs)("li",{className:"render-history-item",children:[(0,f.jsxs)("button",{type:"button",className:"render-history-row",onClick:()=>n(o.localId),children:[(0,f.jsx)("span",{className:`render-history-dot is-${i.phase}`,"aria-hidden":"true",children:s?(0,f.jsx)(Ks,{label:"Rendering"}):null}),(0,f.jsx)("span",{className:"render-history-title",children:i.title||"Untitled render"}),(0,f.jsx)("span",{className:"render-history-status",children:l})]}),i.phase==="succeeded"&&i.outputUrl?(0,f.jsx)("a",{href:i.outputUrl,target:"_blank",rel:"noreferrer",className:"render-history-open",children:"Open MP4"}):null]},o.localId)})})]})})}function hQ({action:e,composition:t=ug[0],onPublish:n,publishOptions:r=null,onPublishOption:o,publishDisabled:i=!1,publishLabel:a="Publish",templateId:s=null,forkId:l=null,publishVersion:c=null,originalUrl:d=null,songName:u=null,songUrl:m=null,onOpenShare:p,onOpenDecompose:g,onOpenNewFork:_,onOpenHistory:y,renderActiveCount:h=0,renderTotalCount:v=0,onOpenRenderHistory:T,decomposeDismissed:x=!1,decomposeBusy:N=!1,onResumeDecompose:M}){let k=t.viralDna,P=k.promotions??[],[F,U]=(0,S.useState)(!1),X=(0,S.useRef)(null),[G,R]=(0,S.useState)(!1),C=(0,S.useRef)(null),$=!!(r&&r.length>1&&o);(0,S.useEffect)(()=>{if(!G)return;let B=se=>{C.current&&(C.current.contains(se.target)||R(!1))},H=se=>{se.key==="Escape"&&R(!1)};return document.addEventListener("mousedown",B),document.addEventListener("keydown",H),()=>{document.removeEventListener("mousedown",B),document.removeEventListener("keydown",H)}},[G]),(0,S.useEffect)(()=>{if(!F)return;let B=se=>{X.current&&(X.current.contains(se.target)||U(!1))},H=se=>{se.key==="Escape"&&U(!1)};return document.addEventListener("mousedown",B),document.addEventListener("keydown",H),()=>{document.removeEventListener("mousedown",B),document.removeEventListener("keydown",H)}},[F]);let ee=[{label:"New decompose\u2026",handler:g,disabled:!g},{label:"New fork\u2026",handler:_,disabled:!_},{label:"History\u2026",handler:y,disabled:!y||!l,hint:l?void 0:"Save first"}];return(0,f.jsxs)("section",{className:"dna-panel",children:[v>0&&T&&(0,f.jsxs)("button",{type:"button",className:`dna-render-banner${h>0?" is-active":""}`,onClick:T,title:"View render history",children:[h>0?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(Ks,{label:"Rendering"}),(0,f.jsxs)("span",{children:[h," Rendering\u2026"]})]}):(0,f.jsxs)("span",{children:[v," render",v>1?"s":""," \xB7 view history"]}),(0,f.jsx)("span",{className:"dna-render-banner-caret","aria-hidden":"true",children:"\u203A"})]}),(0,f.jsxs)("div",{className:"panel-title",children:[(0,f.jsx)("span",{children:"Viral DNA"}),(0,f.jsxs)("div",{className:"panel-title-actions",children:[(0,f.jsx)(SQ,{templateId:s,forkId:l,publishVersion:c,originalUrl:d,songName:u,songUrl:m,trendTagline:k.trendTagline??null}),(0,f.jsxs)("div",{className:"panel-menu-wrap",ref:X,children:[(0,f.jsx)("button",{type:"button",className:"panel-action-button panel-menu-button","aria-haspopup":"menu","aria-expanded":F,"aria-label":"More actions",title:"More actions",onClick:()=>U(B=>!B),children:"\u22EF"}),F&&(0,f.jsx)("div",{className:"panel-menu-popover",role:"menu",children:ee.map(B=>(0,f.jsx)("button",{type:"button",role:"menuitem",className:"panel-menu-item",disabled:B.disabled,title:B.hint,onClick:()=>{U(!1),B.handler?.()},children:B.label},B.label))})]}),(0,f.jsxs)("div",{className:"panel-menu-wrap",ref:C,children:[(0,f.jsxs)("button",{type:"button",className:"panel-action-button primary",disabled:i,"aria-busy":i?"true":void 0,"aria-haspopup":$?"menu":void 0,"aria-expanded":$?G:void 0,onClick:()=>{$?R(B=>!B):n?.()},children:[a==="Rendering"&&(0,f.jsx)(Ks,{label:"Rendering"}),a]}),$&&G&&(0,f.jsx)("div",{className:"panel-menu-popover",role:"menu",children:r.map(B=>(0,f.jsx)("button",{type:"button",role:"menuitem",className:"panel-menu-item",title:B.hint,onClick:()=>{R(!1),o?.(B.key)},children:B.label},B.key))})]})]})]}),e,x&&M&&(0,f.jsxs)("article",{className:"decompose-cta",children:[(0,f.jsx)("strong",{children:"Not decomposed yet"}),(0,f.jsx)("p",{children:"Split this reference into editable scenes, captions, and viral DNA whenever you're ready. You can keep playing the preview and chatting with the AI in the meantime."}),(0,f.jsxs)("button",{type:"button",className:"panel-action-button primary",onClick:M,disabled:N,"aria-busy":N?"true":void 0,children:[N&&(0,f.jsx)(Ks,{label:"Decomposing"}),N?"Decomposing\u2026":"Decompose"]})]}),(0,f.jsxs)("article",{className:"source-card",children:[(0,f.jsx)("h2",{children:"Reference"}),(0,f.jsx)("p",{children:t.title})]}),(0,f.jsxs)("article",{className:"dna-card",children:[(0,f.jsx)("strong",{children:"Hook"}),(0,f.jsx)("p",{children:k.hook})]}),(0,f.jsxs)("article",{children:[(0,f.jsx)("h2",{children:"Retention"}),(0,f.jsx)("p",{children:k.retention})]}),(0,f.jsxs)("article",{children:[(0,f.jsx)("h2",{children:"Payoff"}),(0,f.jsx)("p",{children:k.payoff})]}),k.emotionalPunch&&(0,f.jsxs)("article",{className:"dna-punch",children:[(0,f.jsx)("h2",{children:"Emotional punch"}),k.emotionalPunch.coreEmotion&&(0,f.jsx)("p",{className:"dna-punch-lead",children:k.emotionalPunch.coreEmotion}),(0,f.jsxs)("dl",{children:[k.emotionalPunch.tone&&(0,f.jsxs)("div",{children:[(0,f.jsx)("dt",{children:"Tone"}),(0,f.jsx)("dd",{children:k.emotionalPunch.tone})]}),k.emotionalPunch.arc&&(0,f.jsxs)("div",{children:[(0,f.jsx)("dt",{children:"Arc"}),(0,f.jsx)("dd",{children:k.emotionalPunch.arc})]}),k.emotionalPunch.peakMoment&&(0,f.jsxs)("div",{children:[(0,f.jsx)("dt",{children:"Peak moment"}),(0,f.jsx)("dd",{children:k.emotionalPunch.peakMoment})]}),k.emotionalPunch.mechanism&&(0,f.jsxs)("div",{children:[(0,f.jsx)("dt",{children:"Mechanism"}),(0,f.jsx)("dd",{children:k.emotionalPunch.mechanism})]}),k.emotionalPunch.contrast&&k.emotionalPunch.contrast.toLowerCase()!=="none"&&(0,f.jsxs)("div",{children:[(0,f.jsx)("dt",{children:"Contrast"}),(0,f.jsx)("dd",{children:k.emotionalPunch.contrast})]}),k.emotionalPunch.humor&&k.emotionalPunch.humor.toLowerCase()!=="none"&&(0,f.jsxs)("div",{children:[(0,f.jsx)("dt",{children:"Humor"}),(0,f.jsx)("dd",{children:k.emotionalPunch.humor})]}),k.emotionalPunch.audioVisualTension&&k.emotionalPunch.audioVisualTension.toLowerCase()!=="none"&&(0,f.jsxs)("div",{children:[(0,f.jsx)("dt",{children:"Audio / visual"}),(0,f.jsx)("dd",{children:k.emotionalPunch.audioVisualTension})]}),k.emotionalPunch.delivery&&(0,f.jsxs)("div",{children:[(0,f.jsx)("dt",{children:"Delivery"}),(0,f.jsx)("dd",{children:k.emotionalPunch.delivery})]})]}),k.emotionalPunch.preserve.length>0&&(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)("h3",{className:"dna-punch-subhead",children:"Keep these beats"}),(0,f.jsx)("ul",{children:k.emotionalPunch.preserve.map(B=>(0,f.jsx)("li",{children:B},B))})]})]}),(0,f.jsxs)("article",{children:[(0,f.jsx)("h2",{children:"Preserve"}),(0,f.jsx)("ul",{children:k.preserve.map(B=>(0,f.jsx)("li",{children:B},B))})]}),(0,f.jsxs)("article",{children:[(0,f.jsx)("h2",{children:"Avoid"}),(0,f.jsx)("ul",{children:k.avoid.map(B=>(0,f.jsx)("li",{children:B},B))})]}),P.length>0&&(0,f.jsxs)("article",{children:[(0,f.jsx)("h2",{children:"Reuse for promotions"}),(0,f.jsx)("p",{className:"dna-panel-hint",children:"Same viral tactic, different pitch. Ideas for what this format can promote without breaking the hook:"}),(0,f.jsx)("ul",{children:P.map(B=>(0,f.jsx)("li",{children:B},B))})]})]})}function bQ({value:e,onChange:t}){let n=C_(e);return(0,f.jsxs)("div",{className:"font-select-wrap",children:[(0,f.jsx)("select",{"aria-label":"Caption font",value:n,style:{fontFamily:`${Zs(n)}, 'TikTok Sans'`,fontWeight:el(n)},onChange:r=>t(C_(r.target.value)),children:a4.map(r=>(0,f.jsx)("option",{value:r,style:{fontFamily:`${Zs(r)}, 'TikTok Sans'`,fontWeight:el(r)},children:OJ(r)},r))}),(0,f.jsx)("span",{"aria-hidden":"true",children:"v"})]})}function yQ({value:e,color:t,background:n,onChange:r}){return(0,f.jsx)("div",{className:"text-background-options",role:"radiogroup","aria-label":"Text background style",children:s4.map(o=>(0,f.jsxs)("button",{type:"button",role:"radio","aria-checked":e===o.id,className:`text-background-option ${e===o.id?"selected":""}`,onClick:()=>r(o.id),children:[(0,f.jsx)("span",{style:{color:t,width:o.id==="fullwidth"?"100%":void 0,background:o.id==="highlight-solid"?n:o.id==="highlight-translucent"?fk(n,.34):o.id==="fullwidth"?W6:"transparent",WebkitTextStroke:o.id==="outline"?`1px ${n}`:"0 transparent",textShadow:o.id==="outline"?`1px 0 ${n}, -1px 0 ${n}, 0 1px ${n}, 0 -1px ${n}`:"none"},children:"Aa"}),(0,f.jsx)("b",{children:o.label})]},o.id))})}function _Q({value:e,onSelect:t}){return(0,f.jsxs)("div",{className:"text-background-options caption-style-options",role:"radiogroup","aria-label":"Caption style",children:[(0,f.jsxs)("button",{type:"button",role:"radio","aria-checked":e==="none",className:`text-background-option ${e==="none"?"selected":""}`,onClick:()=>t(null),children:[(0,f.jsx)("span",{style:{color:"#ffffff"},children:"Aa"}),(0,f.jsx)("b",{children:"Static"})]}),L_.map(n=>{let r=n.textBackgroundStyle==="outline",o=n.background||"#000000";return(0,f.jsxs)("button",{type:"button",role:"radio","aria-checked":e===n.animation,className:`text-background-option ${e===n.animation?"selected":""}`,onClick:()=>t(n),children:[(0,f.jsx)("span",{style:{color:(n.animation==="karaoke-fill"||n.animation==="bounce-wave")&&n.activeColor||n.color,background:n.animation==="highlight-pop"?n.highlightColor:n.textBackgroundStyle==="highlight-translucent"?fk(o,.34):"transparent",borderRadius:"0.3em",padding:"0 0.18em",WebkitTextStroke:r?`1px ${o}`:"0 transparent",textShadow:n.animation==="glow-pulse"?`0 0 6px ${n.activeColor||"#9BFF57"}`:r?`1px 0 ${o}, -1px 0 ${o}, 0 1px ${o}, 0 -1px ${o}`:"none",fontWeight:n.fontWeight??800,textTransform:n.uppercase?"uppercase":"none"},children:"Aa"}),(0,f.jsx)("b",{children:n.label})]},n.id)})]})}function vQ({value:e,onChange:t,onCommit:n}){let[r,o]=(0,S.useState)(!1);return(0,f.jsx)("div",{className:`text-draft-shell ${r?"active":""}`,children:(0,f.jsx)("textarea",{rows:3,value:e,onFocus:()=>o(!0),onBlur:()=>{o(!1),n()},onChange:i=>t(i.target.value),onKeyDown:i=>{(i.metaKey||i.ctrlKey)&&i.key==="Enter"&&(i.preventDefault(),n())}})})}function W1(e,t){return{...t,start:e.start,duration:e.duration,track:e.track}}function B6(e,t){return t?{...e,...t.updates}:e}function nk(e,t){let n=cn(fg(e),t);return n?{...t,...Sc(n)}:t}function x_(e,t){return!e||!t?e===t:e.text===t.text&&e.src===t.src&&e.fontFamily===t.fontFamily&&e.fontWeight===t.fontWeight&&e.italic===t.italic&&e.underline===t.underline&&e.color===t.color&&e.background===t.background&&e.textBackgroundStyle===t.textBackgroundStyle&&e.fontSize===t.fontSize&&e.radius===t.radius&&e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height&&e.volume===t.volume&&e.muted===t.muted&&e.kenBurns===t.kenBurns&&e.transition===t.transition&&e.transitionDuration===t.transitionDuration&&e.transitionOut===t.transitionOut&&e.transitionOutDuration===t.transitionOutDuration&&e.captionAnimation===t.captionAnimation&&e.captionActiveColor===t.captionActiveColor&&e.captionHighlightColor===t.captionHighlightColor&&e.captionUppercase===t.captionUppercase&&e.start===t.start&&e.duration===t.duration&&e.track===t.track}function z6(e,t){if(!t)return{...e};let n={};for(let r of["text","src","fontFamily","fontWeight","italic","underline","color","background","textBackgroundStyle","fontSize","radius","x","y","width","height","volume","muted","kenBurns","transition","transitionDuration","transitionOut","transitionOutDuration","captionAnimation","captionActiveColor","captionHighlightColor","captionUppercase","start","duration","track"])e[r]!==t[r]&&(n[r]=e[r]);return n}function k_({value:e}){let[t,n]=(0,S.useState)("idle");(0,S.useEffect)(()=>{if(t==="idle")return;let o=window.setTimeout(()=>n("idle"),900);return()=>window.clearTimeout(o)},[t]);let r=()=>{if(!e||!navigator.clipboard){n("error");return}navigator.clipboard.writeText(e).then(()=>n("done")).catch(()=>n("error"))};return(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)("code",{className:"publish-info-value",title:e?`Click to copy: ${e}`:"no value",onClick:r,children:e||"\u2014"}),(0,f.jsx)("button",{type:"button",className:`inspector-id-copy inspector-id-copy--${t}`,onClick:r,disabled:!e,"aria-label":"Copy value",title:"Copy",children:t==="done"?(0,f.jsx)("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:(0,f.jsx)("path",{d:"M20 6L9 17l-5-5"})}):(0,f.jsxs)("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[(0,f.jsx)("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2"}),(0,f.jsx)("path",{d:"M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"})]})})]})}function SQ({templateId:e,forkId:t,publishVersion:n,originalUrl:r,songName:o,songUrl:i,trendTagline:a}){let[s,l]=(0,S.useState)(!1),c=(0,S.useRef)(null);return(0,S.useEffect)(()=>{if(!s)return;let d=m=>{c.current&&!c.current.contains(m.target)&&l(!1)},u=m=>{m.key==="Escape"&&l(!1)};return window.addEventListener("mousedown",d),window.addEventListener("keydown",u),()=>{window.removeEventListener("mousedown",d),window.removeEventListener("keydown",u)}},[s]),(0,f.jsxs)("div",{className:"publish-info-wrap",ref:c,children:[(0,f.jsx)("button",{type:"button",className:"publish-info-trigger",onClick:()=>l(d=>!d),"aria-label":"Template info",title:"Template info",children:(0,f.jsxs)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[(0,f.jsx)("circle",{cx:"12",cy:"12",r:"10"}),(0,f.jsx)("line",{x1:"12",y1:"16",x2:"12",y2:"12"}),(0,f.jsx)("line",{x1:"12",y1:"8",x2:"12.01",y2:"8"})]})}),s&&(0,f.jsxs)("div",{className:"publish-info-popover",role:"dialog",children:[a?(0,f.jsxs)("div",{className:"publish-info-row",children:[(0,f.jsx)("span",{className:"publish-info-label",children:"trend_tagline"}),(0,f.jsx)(k_,{value:a})]}):null,(0,f.jsxs)("div",{className:"publish-info-row",children:[(0,f.jsx)("span",{className:"publish-info-label",children:"template_id"}),(0,f.jsx)(k_,{value:e??""})]}),(0,f.jsxs)("div",{className:"publish-info-row",children:[(0,f.jsx)("span",{className:"publish-info-label",children:"fork_id"}),(0,f.jsx)(k_,{value:t??""})]}),(0,f.jsxs)("div",{className:"publish-info-row",children:[(0,f.jsx)("span",{className:"publish-info-label",children:"version"}),(0,f.jsx)(k_,{value:n!==null?String(n):""})]}),r?(0,f.jsxs)("div",{className:"publish-info-row",children:[(0,f.jsx)("span",{className:"publish-info-label",children:"original"}),(0,f.jsx)("a",{className:"publish-info-link",href:r,target:"_blank",rel:"noopener noreferrer",children:r})]}):null,o||i?(0,f.jsxs)("div",{className:"publish-info-row",children:[(0,f.jsx)("span",{className:"publish-info-label",children:"song"}),i?(0,f.jsx)("a",{className:"publish-info-link",href:i,target:"_blank",rel:"noopener noreferrer",children:o||i}):(0,f.jsx)("span",{children:o})]}):null]})]})}function EQ({mode:e,busy:t,finished:n,error:r,scenesCreated:o,ghostcutStatus:i,ghostcutProgress:a,userPrompt:s,onUserPromptChange:l,onDecompose:c,onFinish:d,onCancel:u,onDismiss:m}){let p=!!m&&!n;return(0,f.jsx)("div",{className:"decompose-modal-backdrop",role:"dialog","aria-modal":"true","aria-labelledby":"decompose-modal-title",children:(0,f.jsxs)("div",{className:"decompose-modal",children:[p&&(0,f.jsx)("button",{type:"button",className:"decompose-modal-close","aria-label":"Dismiss \u2014 decompose later",title:"Later",onClick:m,disabled:t,children:"\u2715"}),n?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)("h2",{id:"decompose-modal-title",children:"Decomposed \u2713"}),(0,f.jsxs)("p",{children:[o!==null?`Split the video into ${o} editable scene${o===1?"":"s"}.`:"Split the video into editable scenes."," Click Finish to load the timeline."]}),i==="pending"&&(0,f.jsxs)("p",{className:"decompose-modal-note",children:["Removing hardcoded subtitles\u2026",a!==null&&` (${Math.round(a)}%)`," This usually takes about 5 minutes. You can leave this tab open, work in another tab, or come back later \u2014 Finish will unlock automatically once the cleaned video is ready."]}),i==="done"&&(0,f.jsx)("p",{className:"decompose-modal-note",children:"Hardcoded subtitles removed \u2713 \u2014 click Finish to load the cleaned video."}),i==="failed"&&(0,f.jsx)("p",{className:"decompose-modal-note",children:"Subtitle removal failed; original video retained."}),(0,f.jsx)("div",{className:"decompose-modal-actions",children:(0,f.jsxs)("button",{type:"button",className:"panel-action-button primary",onClick:d,disabled:i==="pending","aria-busy":i==="pending",children:[i==="pending"&&(0,f.jsx)(Ks,{label:"Removing subtitles"}),i==="pending"?"Removing subtitles\u2026":"Finish"]})})]}):(0,f.jsxs)(f.Fragment,{children:[(0,f.jsxs)("h2",{id:"decompose-modal-title",children:[e==="redo"?"Re-decompose this composition":"Decompose this composition",(0,f.jsx)("span",{style:{fontWeight:400,opacity:.6,fontSize:"0.72em",marginLeft:"0.5em"},children:"\xB7 about 1\u20132 min"})]}),(0,f.jsx)("p",{children:e==="redo"?"Runs the AI decomposer again from the current source video. Your existing timeline edits on this working copy will be replaced \u2014 publish or snapshot first if you want to keep them.":"Smart-decompose splits the source video into scenes, extracts on-screen captions, and generates viral DNA using your saved AI provider key (Gemini \u2192 OpenAI \u2192 OpenRouter). Requires an AI provider key in Settings. If you're the first user to decompose this inspiration, your decomposition becomes the default template fork for everyone else."}),(0,f.jsxs)("label",{className:"decompose-modal-prompt",children:[(0,f.jsx)("span",{children:"Guidance for the AI (optional)"}),(0,f.jsx)("textarea",{className:"decompose-modal-textarea",placeholder:"e.g. Pay attention to the pinned comment as the hook; the payoff is the dance-floor reveal at ~00:08; keep captions in lowercase to match the original TikTok voice.",value:s,rows:4,maxLength:4e3,onChange:g=>l(g.target.value),disabled:t}),(0,f.jsx)("span",{className:"decompose-modal-hint",children:"Tell the model what to focus on: which beats matter, which captions are the hook, tone, preferred scene granularity, etc. Left blank uses the default extraction prompt."})]}),r&&(0,f.jsx)("p",{className:"decompose-modal-error",children:r}),(0,f.jsxs)("div",{className:"decompose-modal-actions",children:[p&&(0,f.jsx)("button",{type:"button",className:"panel-action-button secondary",onClick:m,disabled:t,children:"Later"}),u&&(0,f.jsx)("button",{type:"button",className:"panel-action-button secondary",onClick:u,disabled:t,children:"Cancel"}),(0,f.jsxs)("button",{type:"button",className:"panel-action-button primary",onClick:c,disabled:t,"aria-busy":t,children:[t&&(0,f.jsx)(Ks,{label:"Decomposing"}),t?"Decomposing\u2026":e==="redo"?"Re-decompose":"Decompose"]})]})]})]})})}function TQ({busy:e,error:t,onCreate:n,onCancel:r}){let[o,i]=(0,S.useState)("current"),a={display:"flex",gap:"0.6em",alignItems:"flex-start",padding:"0.7em 0.8em",border:"1px solid rgba(148,163,184,0.35)",borderRadius:"10px",cursor:e?"default":"pointer",marginBottom:"0.5em"},s={display:"block",opacity:.62,fontSize:"0.82em",marginTop:"0.15em",fontWeight:400};return(0,f.jsx)("div",{className:"decompose-modal-backdrop",role:"dialog","aria-modal":"true","aria-labelledby":"new-fork-modal-title",children:(0,f.jsxs)("div",{className:"decompose-modal",children:[(0,f.jsx)("button",{type:"button",className:"decompose-modal-close","aria-label":"Cancel",title:"Cancel",onClick:r,disabled:e,children:"\u2715"}),(0,f.jsx)("h2",{id:"new-fork-modal-title",children:"New fork"}),(0,f.jsx)("p",{children:"Create a new editable copy of this project. Your current copy stays untouched, so you can branch off without losing anything."}),(0,f.jsxs)("label",{style:{...a,borderColor:o==="current"?"var(--accent, #6366f1)":a.border},children:[(0,f.jsx)("input",{type:"radio",name:"new-fork-from",checked:o==="current",onChange:()=>i("current"),disabled:e,style:{marginTop:"0.2em"}}),(0,f.jsxs)("span",{children:[(0,f.jsx)("strong",{children:"Fork from this branch"}),(0,f.jsx)("span",{style:s,children:"Copy the current working timeline \u2014 all your edits carry over into the new fork."})]})]}),(0,f.jsxs)("label",{style:{...a,borderColor:o==="default"?"var(--accent, #6366f1)":a.border},children:[(0,f.jsx)("input",{type:"radio",name:"new-fork-from",checked:o==="default",onChange:()=>i("default"),disabled:e,style:{marginTop:"0.2em"}}),(0,f.jsxs)("span",{children:[(0,f.jsx)("strong",{children:"Fresh from default"}),(0,f.jsx)("span",{style:s,children:"Start over from the original template's default composition \u2014 discards the current edits (they stay in this copy)."})]})]}),t&&(0,f.jsx)("p",{className:"decompose-modal-error",children:t}),(0,f.jsxs)("div",{className:"decompose-modal-actions",children:[(0,f.jsx)("button",{type:"button",className:"panel-action-button secondary",onClick:r,disabled:e,children:"Cancel"}),(0,f.jsxs)("button",{type:"button",className:"panel-action-button primary",onClick:()=>n(o),disabled:e,"aria-busy":e,children:[e&&(0,f.jsx)(Ks,{label:"Creating fork"}),e?"Creating\u2026":"Create fork"]})]})]})})}function wQ({forkId:e,templateId:t,onClose:n}){let[r,o]=(0,S.useState)(null),[i,a]=(0,S.useState)(!1),[s,l]=(0,S.useState)(null),[c,d]=(0,S.useState)(!1);(0,S.useEffect)(()=>{let p=!0;return fetch(`/api/v1/compositions/${encodeURIComponent(e)}`).then(g=>g.ok?g.json():null).then(g=>{if(!p||!g)return;let _=g.visibility;o(_==="private"||_==="public"||_==="unlisted"?_:"private")}).catch(()=>p&&o("private")),()=>{p=!1}},[e]);let u=(0,S.useCallback)(async p=>{a(!0),l(null),d(!1);try{let g=await fetch(`/api/v1/compositions/${encodeURIComponent(e)}/visibility`,{method:"PATCH",headers:{"content-type":"application/json"},body:JSON.stringify({visibility:p})}),_=await g.json().catch(()=>({}));if(!g.ok||_?.ok===!1)throw new Error(_?.error||`Save failed (${g.status})`);o(p),d(!0)}catch(g){l(g instanceof Error?g.message:String(g))}finally{a(!1)}},[e]),m=typeof window<"u"?`${window.location.origin}/editor/${encodeURIComponent(t)}/fork/${encodeURIComponent(e)}`:"";return(0,f.jsx)("div",{className:"decompose-modal-backdrop",role:"dialog","aria-modal":"true","aria-labelledby":"share-modal-title",children:(0,f.jsxs)("div",{className:"decompose-modal",children:[(0,f.jsx)("h2",{id:"share-modal-title",children:"Share this composition"}),(0,f.jsx)("p",{children:"Anyone with the link can view a public composition. Private compositions are only visible to you."}),r===null?(0,f.jsx)("p",{className:"decompose-modal-note",children:"Loading current visibility\u2026"}):(0,f.jsxs)("div",{className:"share-modal-choices",children:[(0,f.jsxs)("label",{className:`share-choice${r==="private"?" share-choice--active":""}`,children:[(0,f.jsx)("input",{type:"radio",name:"visibility",value:"private",checked:r==="private",disabled:i,onChange:()=>void u("private")}),(0,f.jsx)("span",{className:"share-choice-label",children:"Private"}),(0,f.jsx)("span",{className:"share-choice-hint",children:"Only you can view or edit."})]}),(0,f.jsxs)("label",{className:`share-choice${r==="public"?" share-choice--active":""}`,children:[(0,f.jsx)("input",{type:"radio",name:"visibility",value:"public",checked:r==="public",disabled:i,onChange:()=>void u("public")}),(0,f.jsx)("span",{className:"share-choice-label",children:"Public (view-only)"}),(0,f.jsx)("span",{className:"share-choice-hint",children:"Anyone with the link can view."})]})]}),r==="public"&&(0,f.jsxs)("div",{className:"share-modal-link",children:[(0,f.jsx)("input",{readOnly:!0,value:m,onFocus:p=>p.currentTarget.select()}),(0,f.jsx)("button",{type:"button",className:"panel-action-button secondary",onClick:()=>{typeof navigator<"u"&&navigator.clipboard&&navigator.clipboard.writeText(m)},children:"Copy"})]}),r==="unlisted"&&(0,f.jsx)("p",{className:"decompose-modal-note",children:'Currently "unlisted" (legacy). Switch to Public or Private to update.'}),s&&(0,f.jsx)("p",{className:"decompose-modal-error",children:s}),c&&!s&&(0,f.jsx)("p",{className:"decompose-modal-note",children:"Saved \u2713"}),(0,f.jsx)("div",{className:"decompose-modal-actions",children:(0,f.jsx)("button",{type:"button",className:"panel-action-button primary",onClick:n,disabled:i,children:"Done"})})]})})}function xQ({forkId:e,templateId:t,currentVersion:n,onClose:r,onReverted:o}){let[i,a]=(0,S.useState)(null),[s,l]=(0,S.useState)(null),[c,d]=(0,S.useState)(null);(0,S.useEffect)(()=>{let p=!0;return fetch(`/api/v1/compositions/${encodeURIComponent(e)}/versions?limit=100`).then(g=>g.ok?g.json():null).then(g=>{if(!p)return;if(!g){l("Could not load versions");return}let y=(Array.isArray(g.versions)?g.versions:[]).map(h=>({version:Number(h.version),createdAt:typeof h.created_at=="string"?h.created_at:null,message:typeof h.message=="string"?h.message:null,reason:typeof h.reason=="string"?h.reason:null})).filter(h=>Number.isFinite(h.version));y.sort((h,v)=>v.version-h.version),a(y)}).catch(g=>p&&l(g instanceof Error?g.message:String(g))),()=>{p=!1}},[e]);let u=()=>{if(typeof window>"u"||!t)return;let p=`/editor/${encodeURIComponent(t)}/fork/${encodeURIComponent(e)}`;window.open(p,"_blank","noopener,noreferrer")},m=(0,S.useCallback)(async p=>{d(p),l(null);try{let g=await fetch(`/api/v1/compositions/${encodeURIComponent(e)}/versions/${p}/composition.html`);if(!g.ok)throw new Error(`Load HTML failed (${g.status})`);let _=await g.text(),y=await fetch(`/api/v1/compositions/${encodeURIComponent(e)}/versions/${p}/composition.json`),h=y.ok?await y.text():null,v=await fetch(`/api/v1/compositions/${encodeURIComponent(e)}/composition.html`,{method:"PUT",headers:{"content-type":"text/html"},body:_});if(!v.ok){let T=await v.json().catch(()=>({}));throw new Error(T?.error||`Save HTML failed (${v.status})`)}h&&await fetch(`/api/v1/compositions/${encodeURIComponent(e)}/composition.json`,{method:"PATCH",headers:{"content-type":"application/json"},body:h}).catch(()=>{}),o()}catch(g){l(g instanceof Error?g.message:String(g)),d(null)}},[e,o]);return(0,f.jsx)("div",{className:"decompose-modal-backdrop",role:"dialog","aria-modal":"true","aria-labelledby":"history-modal-title",children:(0,f.jsxs)("div",{className:"decompose-modal history-modal",children:[(0,f.jsx)("h2",{id:"history-modal-title",children:"Version history"}),(0,f.jsx)("p",{children:"Every publish or manual snapshot creates an immutable version. Open this fork in the editor in a new tab, or revert this working copy to a past version."}),i===null&&!s&&(0,f.jsx)("p",{className:"decompose-modal-note",children:"Loading versions\u2026"}),s&&(0,f.jsx)("p",{className:"decompose-modal-error",children:s}),i!==null&&i.length===0&&!s&&(0,f.jsx)("p",{className:"decompose-modal-note",children:"No published versions yet. Publish once to create v1."}),i&&i.length>0&&(0,f.jsx)("ul",{className:"history-list",children:i.map(p=>{let g=n!==null&&p.version===n;return(0,f.jsxs)("li",{className:`history-row${g?" history-row--current":""}`,children:[(0,f.jsxs)("div",{className:"history-row-head",children:[(0,f.jsxs)("span",{className:"history-version",children:["v",p.version,g&&" (current)"]}),p.createdAt&&(0,f.jsx)("span",{className:"history-date",children:new Date(p.createdAt).toLocaleString()})]}),p.message&&(0,f.jsx)("div",{className:"history-message",children:p.message}),p.reason&&(0,f.jsxs)("div",{className:"history-reason",children:["reason: ",p.reason]}),(0,f.jsxs)("div",{className:"history-actions",children:[(0,f.jsx)("button",{type:"button",className:"panel-action-button secondary",disabled:!t,onClick:u,children:"Open in new tab"}),(0,f.jsx)("button",{type:"button",className:"panel-action-button primary",disabled:c!==null||g,onClick:()=>void m(p.version),children:c===p.version?"Reverting\u2026":"Revert to this"})]})]},p.version)})}),(0,f.jsx)("div",{className:"decompose-modal-actions",children:(0,f.jsx)("button",{type:"button",className:"panel-action-button secondary",onClick:r,disabled:c!==null,children:"Close"})})]})})}function kQ({id:e}){let[t,n]=(0,S.useState)("idle");(0,S.useEffect)(()=>{if(t==="idle")return;let o=window.setTimeout(()=>n("idle"),900);return()=>window.clearTimeout(o)},[t]);let r=()=>{if(e){if(typeof navigator>"u"||!navigator.clipboard){n("error");return}navigator.clipboard.writeText(e).then(()=>n("done")).catch(()=>n("error"))}};return(0,f.jsxs)("button",{type:"button",className:`click-copy-id click-copy-id--${t}`,onClick:r,disabled:!e,"aria-label":"Copy element id",title:e?`Click to copy: ${e}`:"No id",children:[(0,f.jsx)("code",{children:e||"\u2014"}),(0,f.jsx)("span",{className:"click-copy-id-state","aria-live":"polite",children:t==="done"?"\u2713":t==="error"?"!":"\u29C9"})]})}function A_({value:e,min:t,max:n,step:r=.01,onCommit:o}){let[i,a]=(0,S.useState)(()=>Number(e.toFixed(2)).toString()),[s,l]=(0,S.useState)(!1),c=(0,S.useRef)(!1);(0,S.useEffect)(()=>{s||a(Number(e.toFixed(2)).toString())},[s,e]);function d(m){return Number.isFinite(m)?Math.max(t??Number.NEGATIVE_INFINITY,Math.min(n??Number.POSITIVE_INFINITY,m)):e}function u(m=i){let p=Number(m);if(!Number.isFinite(p)){a(Number(e.toFixed(2)).toString());return}let g=d(p);a(Number(g.toFixed(2)).toString()),o(g)}return(0,f.jsx)("input",{type:"number",min:t,max:n,step:r,value:i,onFocus:()=>l(!0),onChange:m=>{a(m.target.value)},onBlur:()=>{if(l(!1),c.current){c.current=!1,a(Number(e.toFixed(2)).toString());return}u()},onKeyDown:m=>{m.key==="Enter"&&m.currentTarget.blur(),m.key==="Escape"&&(c.current=!0,a(Number(e.toFixed(2)).toString()),m.currentTarget.blur())}})}function AQ(e,t,n,r){let o=t.slug.trim();o?e.setAttribute("data-hf-slug",o):e.removeAttribute("data-hf-slug");let i=t.note.trim();i?e.setAttribute("data-hf-note",i):e.removeAttribute("data-hf-note"),r.isMedia&&(e.setAttribute("src",t.src),r.isAudio||(e.style.objectFit=t.objectFit,e.style.objectPosition=t.objectPosition),U_(e,"img")&&pg(e,t.kenBurns==="none"?null:t.kenBurns),r.isAudio||(Qs(e,t.transition==="none"?null:t.transition,t.transitionDuration),Ec(e,t.transitionOut==="none"?null:t.transitionOut,t.transitionOutDuration))),(r.isAudio||r.isVideoElement)&&(t.muted?e.setAttribute("muted",""):e.removeAttribute("muted"),e.setAttribute("data-volume",He(t.volume))),r.isVisual&&(e.style.left=`${t.x}%`,e.style.top=`${t.y}%`,e.style.width=`${t.width}%`,e.style.height=`${t.height}%`),r.isTextLike&&(e.setAttribute("data-label",t.text.slice(0,48)||n.label||n.id),l4(e,t.fontFamily,t.fontWeight),e.style.fontWeight=String(t.fontWeight),e.style.fontStyle=t.italic?"italic":"normal",e.style.textDecorationLine=t.underline?"underline":"none",e.style.color=t.color,e.style.background="transparent",e.style.fontSize=`${t.fontSize}px`,e.style.borderRadius=`${t.radius}px`,tl(e,t.text,t.textBackgroundStyle,t.color,t.background,t.fontFamily,t.fontWeight))}function I_(e,t,n,r,o){if(r.isMedia&&"src"in o&&e.setAttribute("src",t.src),r.isMedia&&!r.isAudio&&("objectFit"in o&&(e.style.objectFit=t.objectFit),"objectPosition"in o&&(e.style.objectPosition=t.objectPosition),"kenBurns"in o&&U_(e,"img")&&(pg(e,t.kenBurns==="none"?null:t.kenBurns),TJ(e)),("transition"in o||"transitionDuration"in o)&&!r.isAudio&&(Qs(e,t.transition==="none"?null:t.transition,t.transitionDuration),Q1(e)),("transitionOut"in o||"transitionOutDuration"in o)&&!r.isAudio&&(Ec(e,t.transitionOut==="none"?null:t.transitionOut,t.transitionOutDuration),Q1(e))),(r.isAudio||r.isVideoElement)&&("muted"in o&&(t.muted?e.setAttribute("muted",""):e.removeAttribute("muted")),"volume"in o&&e.setAttribute("data-volume",He(t.volume))),r.isVisual&&("x"in o&&(e.style.left=`${t.x}%`),"y"in o&&(e.style.top=`${t.y}%`),"width"in o&&(e.style.width=`${t.width}%`),"height"in o&&(e.style.height=`${t.height}%`)),"slug"in o){let s=t.slug.trim();s?e.setAttribute("data-hf-slug",s):e.removeAttribute("data-hf-slug")}if("note"in o){let s=t.note.trim();s?e.setAttribute("data-hf-note",s):e.removeAttribute("data-hf-note")}if(!r.isTextLike)return;let i=e.querySelector("[data-vf-text-inline]"),a=e.querySelector("[data-vf-text-lines]");"text"in o&&e.setAttribute("data-label",t.text.slice(0,48)||n.label||n.id),("fontFamily"in o||"fontWeight"in o)&&(e.setAttribute("data-font-family",t.fontFamily),l4(e,t.fontFamily,t.fontWeight),i&&i.setAttribute("data-font-family",t.fontFamily),a&&(a.style.fontFamily=`${Zs(t.fontFamily)}, 'TikTok Sans'`)),"italic"in o&&(e.style.fontStyle=t.italic?"italic":"normal"),"underline"in o&&(e.style.textDecorationLine=t.underline?"underline":"none"),"color"in o&&(e.style.color=t.color,i&&(i.style.color=t.color)),"fontSize"in o&&(e.style.fontSize=`${t.fontSize}px`),"radius"in o&&(e.style.borderRadius=`${t.radius}px`),("text"in o||"textBackgroundStyle"in o||"background"in o)&&(e.style.background="transparent",tl(e,t.text,t.textBackgroundStyle,t.color,t.background,t.fontFamily,t.fontWeight),e.hasAttribute("data-caption-animation")&&(ck(e,t.text),E6(e))),("captionAnimation"in o||"captionActiveColor"in o||"captionHighlightColor"in o||"captionUppercase"in o)&&(mg(e,t.captionAnimation==="none"?null:t.captionAnimation,{activeColor:t.captionActiveColor,highlightColor:t.captionHighlightColor,uppercase:t.captionUppercase,text:t.text}),E6(e))}function IQ(e){return e?e.tag!=="audio"&&e.tag!=="video"&&e.tag!=="img"&&e.tag!=="image":!1}function bk(e){return!e||e.tag==="audio"?!1:(e.hfId||e.domId||e.id||e.key)!=="source-video"}function v4(e){return{x:li(e.style,"left",0),y:li(e.style,"top",0),width:li(e.style,"width",100),height:li(e.style,"height",100),fontSize:li(e.style,"font-size",NaN)}}function rk(e,t){e.style.left=`${t.x}%`,e.style.top=`${t.y}%`,e.style.width=`${t.width}%`,e.style.height=`${t.height}%`,Number.isFinite(t.fontSize)&&(e.style.fontSize=`${t.fontSize}px`)}function NQ(e,t,n){e.style.display="block",e.style.position="absolute",e.style.left=t.style.left||"0%",e.style.top=t.style.top||"0%",e.style.width=t.style.width||"100%",e.style.height=t.style.height||"100%",e.style.borderRadius=t.style.borderRadius||"0",e.style.zIndex="9999";let r=bk(n),o=t.getAttribute("data-hf-id")||t.id||Se(n);r?(e.style.pointerEvents="auto",e.style.cursor="move",e.setAttribute("data-vf-frame-handle","move"),e.setAttribute("data-vf-target-id",o)):(e.style.pointerEvents="none",e.style.cursor="",e.removeAttribute("data-vf-frame-handle"),e.removeAttribute("data-vf-target-id")),e.style.border=r?"1px dashed #F2CD46":"3px solid #F2CD46",e.style.boxShadow=r?"0 0 0 2px #118df2":"inset 0 0 0 1px #000000, 0 0 0 7px rgba(242, 205, 70, 0.32)";for(let i of Array.from(e.querySelectorAll("[data-vf-frame-handle]")))i.remove();if(r)for(let[i,a]of[["top-left","left:-7px;top:-7px;cursor:nwse-resize;"],["top","top:-7px;left:50%;transform:translateX(-50%);cursor:ns-resize;"],["top-right","right:-7px;top:-7px;cursor:nesw-resize;"],["right","right:-7px;top:50%;transform:translateY(-50%);cursor:ew-resize;"],["bottom-right","right:-7px;bottom:-7px;cursor:nwse-resize;"],["bottom","bottom:-7px;left:50%;transform:translateX(-50%);cursor:ns-resize;"],["bottom-left","left:-7px;bottom:-7px;cursor:nesw-resize;"],["left","left:-7px;top:50%;transform:translateY(-50%);cursor:ew-resize;"]]){let s=e.ownerDocument.createElement("span");s.setAttribute("data-vf-frame-handle",i),s.setAttribute("data-vf-target-id",o),s.style.cssText=["position:absolute","display:block","width:14px","height:14px","box-sizing:border-box","border-radius:999px","border:2px solid #0b0d0a","background:#F2CD46","box-shadow:0 0 0 2px rgba(242,205,70,0.32),0 1px 4px rgba(0,0,0,0.38)","pointer-events:auto","touch-action:none",a].join(";"),e.append(s)}}var RQ=(0,S.memo)(function({selected:t,html:n,visualFrameDraft:r,stageRef:o,getIframe:i,onStageFrame:a,onCommitDrag:s}){let[l,c]=(0,S.useState)(null),d=(0,S.useRef)(null),u=(0,S.useRef)(()=>{});u.current=()=>{if(!t||!bk(t)){c(null);return}let y=i(),h=o.current,v=y?.contentDocument,T=v?.querySelector("[data-composition-id]"),x=v?cn(v,t):null;if(!y||!h||!rt(T)||!rt(x)){c(null);return}let N=y.getBoundingClientRect(),M=h.getBoundingClientRect(),k=r??v4(x);c({left:N.left-M.left+k.x/100*N.width,top:N.top-M.top+k.y/100*N.height,width:k.width/100*N.width,height:k.height/100*N.height,draft:k})},(0,S.useEffect)(()=>{u.current()},[n,t,r]),(0,S.useEffect)(()=>{let y=()=>u.current();return window.addEventListener("resize",y),()=>window.removeEventListener("resize",y)},[]);function m(y){if(!t)return;let h=i();eg(h,t,N=>rk(N,y));let v=o.current;if(!h||!v)return;let T=h.getBoundingClientRect(),x=v.getBoundingClientRect();c({left:T.left-x.left+y.x/100*T.width,top:T.top-x.top+y.y/100*T.height,width:y.width/100*T.width,height:y.height/100*T.height,draft:y})}function p(y,h){if(!l)return;h.preventDefault(),h.stopPropagation();let v=i(),T=v?.getBoundingClientRect().width??1,x=v?.getBoundingClientRect().height??1;d.current={mode:y,originX:h.clientX,originY:h.clientY,rootWidth:T,rootHeight:x,draft:l.draft,latest:l.draft},h.currentTarget.setPointerCapture(h.pointerId)}function g(y){let h=d.current;if(!h)return;y.preventDefault(),y.stopPropagation();let v=(y.clientX-h.originX)/Math.max(1,h.rootWidth)*100,T=(y.clientY-h.originY)/Math.max(1,h.rootHeight)*100,x={...h.draft};if(h.mode==="move"&&(x.x=Re(h.draft.x+v,0,100-h.draft.width),x.y=Re(h.draft.y+T,0,100-h.draft.height)),h.mode==="left"||h.mode==="top-left"||h.mode==="bottom-left"){let N=Re(h.draft.x+v,0,h.draft.x+h.draft.width-1);x.x=N,x.width=Re(h.draft.width+(h.draft.x-N),1,100-N)}if((h.mode==="right"||h.mode==="top-right"||h.mode==="bottom-right")&&(x.width=Re(h.draft.width+v,1,100-h.draft.x)),h.mode==="top"||h.mode==="top-left"||h.mode==="top-right"){let N=Re(h.draft.y+T,0,h.draft.y+h.draft.height-1);x.y=N,x.height=Re(h.draft.height+(h.draft.y-N),1,100-N)}if((h.mode==="bottom"||h.mode==="bottom-left"||h.mode==="bottom-right")&&(x.height=Re(h.draft.height+T,1,100-h.draft.y)),IQ(t)&&["top-left","top-right","bottom-left","bottom-right"].includes(h.mode)){let N=x.width/Math.max(1,h.draft.width),M=x.height/Math.max(1,h.draft.height),k=Math.sqrt(Math.max(.05,N*M));x.fontSize=Math.max(8,Math.min(180,(h.draft.fontSize??18)*k))}h.latest=x,m(x)}function _(y){let h=d.current;!h||!t||(y.preventDefault(),y.stopPropagation(),d.current=null,a(t,h.latest),s?.())}return l?(0,f.jsx)("div",{className:"canvas-frame-overlay",style:{left:l.left,top:l.top,width:l.width,height:l.height},onPointerDown:y=>p("move",y),onPointerMove:g,onPointerUp:_,onPointerCancel:_,onLostPointerCapture:_,children:["top-left","top","top-right","right","bottom-right","bottom","bottom-left","left"].map(y=>(0,f.jsx)("span",{className:`canvas-frame-handle ${y}`,onPointerDown:h=>p(y,h),"aria-hidden":"true"},y))}):null}),CQ=(0,S.memo)(function({composition:t,selected:n,html:r,onPatchHtml:o,onPatchLiveElement:i,onPreviewLiveElement:a,onUnselect:s,onDraftStateChange:l,onStageTimelineDraft:c,onStageVisualFrameDraft:d,timelineDraft:u,visualFrameDraft:m,onClearTimelineDraft:p,onClearVisualFrameDraft:g,onDiscardVisualFrameDraft:_,onDiscardTimelineDraft:y,onDelete:h,maxDuration:v,onPublish:T,publishOptions:x=null,onPublishOption:N,publishDisabled:M,publishLabel:k,templateId:P,forkId:F,publishVersion:U,originalUrl:X,songName:G,songUrl:R,onOpenShare:C,onOpenDecompose:$,onOpenNewFork:ee,onOpenHistory:B,renderActiveCount:H=0,renderTotalCount:se=0,onOpenRenderHistory:te,decomposeDismissed:ve=!1,decomposeBusy:pe=!1,onResumeDecompose:Ge}){let re=n?Se(n):null,Je=n?D6(r,n):null,Kt=n?nk(r,n):null,it=Kt&&Je?W1(Kt,Je):null,[Z,Le]=(0,S.useState)(it),[De,et]=(0,S.useState)(re),[dt,me]=(0,S.useState)(!1),[lt,we]=(0,S.useState)(null),[tt,vn]=(0,S.useState)(null),[An,an]=(0,S.useState)(null),ue=(0,S.useRef)(null),[Ve,Te]=(0,S.useState)(!1);(0,S.useEffect)(()=>{let D=it?{...it,...u?.updates,...m}:null;Le(D),et(re);let he=!x_(D,it);me(!1),we(null),an(null),l({dirty:he,commit:he&&D?()=>zo(D):null})},[re,r,u,m,l]);let We=(0,S.useRef)(null);if((0,S.useEffect)(()=>{We.current=n&&re&&De===re&&Z&&!x_(Z,it)?{key:re,commit:()=>Ua(Z)}:null}),(0,S.useEffect)(()=>{let D=re;return()=>{let he=We.current;We.current=null,he&&D&&he.key===D&&he.commit()}},[re]),!n)return(0,f.jsx)(hQ,{composition:t,onPublish:T,publishOptions:x,onPublishOption:N,publishDisabled:M,publishLabel:k,templateId:P,forkId:F,publishVersion:U,originalUrl:X,songName:G,songUrl:R,onOpenShare:C,onOpenDecompose:$,onOpenNewFork:ee,onOpenHistory:B,renderActiveCount:H,renderTotalCount:se,onOpenRenderHistory:te,decomposeDismissed:ve,decomposeBusy:pe,onResumeDecompose:Ge});let oe=Kt??n,ge=hk(oe),Ce=O_(r,oe)??ge?.kind,$e=_4(r,oe),at=oe.tag==="audio"||Ce==="audio",Xt=oe.tag==="video"||Ce==="video",wc=oe.tag==="img"||oe.tag==="image"||Ce==="image",oo=at||Xt||wc,Bo=oe.tag==="video",mf=at||Bo,gf=$e==="html"||Ce==="shape"&&!!ge?.customHtml,Hi=!at,Lr=!oo&&!gf,Gi=Je??D6(r,oe),ce=Z??W1(oe,Gi),rl=!x_(ce,it),xc=ce.volume;function hf(D,he){let Jt={isAudio:at,isMedia:oo,isTextLike:Lr,isVisual:Hi,isVideoElement:Bo};a(oe,zt=>{I_(zt,D,oe,Jt,he)})}function ze(D){let he={...Z??W1(oe,Gi),...D};if(("start"in D||"duration"in D||"track"in D)&&!c(oe,{start:he.start,duration:he.duration,track:he.track}))return;if("x"in D||"y"in D||"width"in D||"height"in D){let Et={x:Re(he.x,0,Math.max(0,100-he.width)),y:Re(he.y,0,Math.max(0,100-he.height)),width:Re(he.width,1,100-he.x),height:Re(he.height,1,100-he.y)};he.x=Et.x,he.y=Et.y,he.width=Et.width,he.height=Et.height,d(oe,Et)}("src"in D||"objectFit"in D||"objectPosition"in D||"volume"in D||"muted"in D||"x"in D||"y"in D||"width"in D||"height"in D||"fontFamily"in D||"fontWeight"in D||"fontSize"in D||"textBackgroundStyle"in D||"background"in D||"color"in D||"text"in D||"italic"in D||"underline"in D||"kenBurns"in D||"transition"in D||"transitionDuration"in D||"transitionOut"in D||"transitionOutDuration"in D||"radius"in D)&&hf(he,D);let zt=!x_(he,it);Le(he),l({dirty:zt,commit:zt?()=>zo(he):null})}function $i(D){i(oe,D)}function zo(D){let he={isAudio:at,isMedia:oo,isTextLike:Lr,isVisual:Hi,isVideoElement:Bo},Jt=z6(D,it),zt=D.start!==oe.start||D.duration!==oe.duration||D.track!==oe.track;try{if(zt){let{html:Et}=z_(r,oe,{start:D.start,duration:D.duration,track:D.track});o(ci(Et,oe,kc=>{I_(kc,D,oe,he,Jt)})),re&&p(re),re&&g(re);return}$i(Et=>{I_(Et,D,oe,he,Jt)}),re&&p(re),re&&g(re)}catch(Et){dr("editor.inspector-update-rejected",Et instanceof Error?Et.message:Et)}}function La(){rl&&zo(ce)}function Ua(D){if(De!==re)return;let he={isAudio:at,isMedia:oo,isTextLike:Lr,isVisual:Hi,isVideoElement:Bo},Jt=z6(D,it),zt=["start","duration","track","x","y","width","height"];Number.isFinite(m?.fontSize)&&zt.push("fontSize");for(let Et of zt)delete Jt[Et];if(Object.keys(Jt).length!==0)try{$i(Et=>{I_(Et,D,oe,he,Jt)})}catch(Et){dr("editor.inspector-switch-commit-rejected",Et instanceof Error?Et.message:Et)}}function Fo(){let D=at?"audio/":Xt?"video/":"image/",he=at?"an audio file":Xt?"a video":"an image",Jt=window.__vidfarmDirectory;if(!Jt||!Jt.pick){window.alert("File browser isn't available on this page yet.");return}Jt.pick({select:"file",title:`Choose ${he}`,initialPath:"/",allowUpload:!0,hint:"Click a file to use it as the new source, or drop one into a Files/Temp folder to add it. Browse Files, Temp, Raws, Projects or Approved.",rejectMessage:`Pick ${he} (that item can't be used here).`,accept:zt=>{if(!zt.viewUrl)return!1;if((zt.contentType||"").toLowerCase().indexOf(D)===0)return!0;let kc=/\.([a-z0-9]+)$/i.exec(zt.name||""),F_=kc?kc[1].toLowerCase():"";return({"image/":["png","jpg","jpeg","gif","webp","svg","avif","bmp"],"video/":["mp4","webm","mov","m4v","ogv"],"audio/":["mp3","wav","m4a","aac","ogg","oga","flac"]}[D]||[]).indexOf(F_)!==-1},onPick:zt=>io(zt.viewUrl)})}function io(D){D&&(Xt||at?vn({src:D,kind:at?"audio":"video",replace:!0}):ze({src:D}))}async function hg(D){if(!D)return;let he=D_(D.name,D.type,D.name),Jt=at?"audio":Xt?"video":"image";if(he&&he!==Jt){window.alert(`This layer expects ${Jt==="audio"?"an audio file":Jt==="video"?"a video":"an image"}. Pick a matching file.`);return}Te(!0);try{let zt=await _k(D);io(zt.url)}catch(zt){window.alert(zt instanceof Error?zt.message:"Upload failed.")}finally{Te(!1)}}function bg(D){D.src&&D.src!==ce.src&&ze({src:D.src}),c(oe,{playbackStart:Math.max(0,D.playbackStart),duration:Math.max(.05,D.duration)})}return(0,f.jsxs)("section",{className:"dna-panel",children:[(0,f.jsxs)("div",{className:"panel-title",children:[(0,f.jsx)("span",{children:"Native Inspector"}),(0,f.jsx)("strong",{children:oe.tag}),rl?(0,f.jsxs)("div",{className:"panel-action-pair",children:[(0,f.jsx)("button",{type:"button",className:"panel-action-button secondary",onClick:()=>{if(it){let D={isAudio:at,isMedia:oo,isTextLike:Lr,isVisual:Hi,isVideoElement:Bo};a(oe,he=>{AQ(he,it,oe,D)})}Le(it),re&&y(re),_(oe),l({dirty:!1,commit:null})},children:"Cancel"}),(0,f.jsx)("button",{type:"button",className:"panel-action-button primary",onClick:()=>{La(),l({dirty:!1,commit:null})},children:"Update"})]}):(0,f.jsx)("button",{type:"button",className:"panel-close-button","aria-label":"Unselect layer",onClick:s,children:"x"})]}),(0,f.jsxs)("article",{className:"dna-card selected-card",children:[(0,f.jsx)("strong",{children:oe.label??oe.id}),(0,f.jsx)("p",{children:ge?.viralNote??"Native timeline element."})]}),(0,f.jsxs)("article",{className:"inspector-identity",children:[(0,f.jsx)(kQ,{id:oe.hfId??oe.id??""}),(0,f.jsxs)("div",{className:"inspector-identity-fields",children:[(0,f.jsx)("input",{className:"inspector-identity-input",type:"text",placeholder:"slug (snake_case)",spellCheck:!1,value:ce.slug,onChange:D=>ze({slug:B_(D.target.value)})}),(0,f.jsx)("input",{className:"inspector-identity-input",type:"text",placeholder:"note \u2014 viral DNA reference",value:ce.note,onChange:D=>ze({note:D.target.value})})]})]}),(0,f.jsxs)("article",{className:"inspector-timing",children:[(0,f.jsxs)("div",{className:"inspector-section-header",children:[(0,f.jsx)("h2",{children:"Timing"}),(0,f.jsx)("span",{className:"inspector-help-inline",children:"drag to move \xB7 edges to trim"})]}),(0,f.jsxs)("div",{className:"inspector-timing-grid",children:[(0,f.jsxs)("label",{className:"inspector-field compact",children:[(0,f.jsx)("span",{children:"Start"}),(0,f.jsx)(A_,{min:0,max:Math.max(0,v-ce.duration),value:ce.start,onCommit:D=>ze({start:D})})]}),(0,f.jsxs)("label",{className:"inspector-field compact",children:[(0,f.jsx)("span",{children:"End"}),(0,f.jsx)(A_,{min:.05,max:v,value:ce.start+ce.duration,onCommit:D=>ze({duration:Math.max(.05,D-ce.start)})})]}),(0,f.jsxs)("label",{className:"inspector-field compact",children:[(0,f.jsx)("span",{children:"Dur"}),(0,f.jsx)(A_,{min:.05,max:Math.max(.05,v-ce.start),value:ce.duration,onCommit:D=>ze({duration:Math.max(.05,D)})})]}),(0,f.jsxs)("label",{className:"inspector-field compact",children:[(0,f.jsx)("span",{children:"Layer"}),(0,f.jsx)(A_,{min:0,step:1,value:ce.track,onCommit:D=>ze({track:Math.max(0,Math.round(D))})})]})]})]}),mf&&(0,f.jsxs)("article",{children:[(0,f.jsx)("h2",{children:"Audio"}),(0,f.jsxs)("label",{className:"switch-row",children:[(0,f.jsx)("span",{children:"Mute audio"}),(0,f.jsx)("input",{type:"checkbox",checked:ce.muted,onChange:D=>ze({muted:D.target.checked})})]}),(0,f.jsxs)("label",{className:"volume-row",children:[(0,f.jsxs)("span",{children:["Volume ",Math.round(xc*100),"%"]}),(0,f.jsx)("input",{type:"range",min:"0",max:"1",step:"0.01",value:xc,onChange:D=>ze({volume:Number(D.target.value)})})]})]}),oo&&(0,f.jsxs)("article",{children:[(0,f.jsx)("h2",{children:at?"Replace audio":Xt?"Replace video":"Replace image"}),(0,f.jsxs)("div",{className:"inspector-field",children:[(0,f.jsx)("span",{children:at?"Audio file":Xt?"Video file":"Image file"}),(0,f.jsxs)("div",{className:"media-source-row",children:[(0,f.jsxs)("button",{type:"button",className:"media-source-file",title:ce.src?`${ce.src}
1806
-
1807
- Click to browse and replace`:"Click to choose a file",onClick:Fo,children:[(0,f.jsx)("span",{className:"media-source-file-icon","aria-hidden":"true",children:at?"\u266A":Xt?"\u25B6":"\u25A3"}),(0,f.jsx)("span",{className:"media-source-file-name",children:Ve?"Uploading\u2026":ce.src?rg(ce.src):"Choose a file\u2026"})]}),(0,f.jsx)("button",{type:"button",className:"media-source-path-btn",title:"Media actions","aria-label":"Media actions","aria-haspopup":"menu",onClick:D=>{let he=D.currentTarget.getBoundingClientRect();an(Jt=>Jt?null:{x:he.right,y:he.bottom})},children:"\u22EF"})]})]}),(0,f.jsx)("input",{ref:ue,type:"file",accept:at?"audio/*":Xt?"video/*":"image/*",style:{display:"none"},onChange:D=>{let he=D.target.files?.[0]??null;D.target.value="",hg(he)}}),An&&(0,f.jsx)(cQ,{x:An.x,y:An.y,onClose:()=>an(null),actions:[{label:"Swap URL",hint:"Paste a path or public link",onClick:()=>we({x:An.x-60,y:An.y})},{label:"Browse files",hint:"Files \xB7 Temp \xB7 Raws \xB7 Projects \xB7 Approved",onClick:Fo},{label:"Upload",hint:"From this device",disabled:Ve,onClick:()=>ue.current?.click()},...(Xt||at)&&ce.src?[{label:"Segment",hint:"Choose which part plays",onClick:()=>vn({src:ce.src,kind:at?"audio":"video",replace:!1})}]:[],...(wc||Xt)&&ce.src?[{label:"Edit media",hint:"Open in the Tools editor",onClick:()=>{if(typeof window>"u")return;let D=sQ(ce.src,rg(ce.src),Xt?"video":"image");window.open(D,"_blank","noopener,noreferrer")}}]:[]]}),lt&&(0,f.jsx)(lQ,{value:ce.src,x:lt.x,y:lt.y,onClose:()=>we(null),onApply:D=>ze({src:D})}),tt&&(0,f.jsx)(T4,{src:tt.src,kind:tt.kind,title:rg(tt.src)||void 0,targetDuration:ce.duration,initialPlaybackStart:tt.replace?0:oe.playbackStart??0,onClose:()=>vn(null),onConfirm:({playbackStart:D,duration:he})=>{bg({src:tt.replace?tt.src:void 0,playbackStart:D,duration:he}),vn(null)}}),!at&&(0,f.jsxs)("div",{className:"inspector-grid",children:[(0,f.jsxs)("label",{className:"inspector-field",children:[(0,f.jsx)("span",{children:"Fit"}),(0,f.jsxs)("select",{value:ce.objectFit,onChange:D=>ze({objectFit:D.target.value}),children:[(0,f.jsx)("option",{value:"cover",children:"Cover (fill + crop)"}),(0,f.jsx)("option",{value:"contain",children:"Contain (letterbox)"}),(0,f.jsx)("option",{value:"fill",children:"Fill (stretch)"}),(0,f.jsx)("option",{value:"none",children:"None (native)"}),(0,f.jsx)("option",{value:"scale-down",children:"Scale-down"})]})]}),(0,f.jsxs)("label",{className:"inspector-field",children:[(0,f.jsx)("span",{children:"Position"}),(0,f.jsxs)("select",{value:ce.objectPosition,onChange:D=>ze({objectPosition:D.target.value}),children:[(0,f.jsx)("option",{value:"center",children:"Center"}),(0,f.jsx)("option",{value:"top",children:"Top"}),(0,f.jsx)("option",{value:"bottom",children:"Bottom"}),(0,f.jsx)("option",{value:"left",children:"Left"}),(0,f.jsx)("option",{value:"right",children:"Right"}),(0,f.jsx)("option",{value:"top left",children:"Top-left"}),(0,f.jsx)("option",{value:"top right",children:"Top-right"}),(0,f.jsx)("option",{value:"bottom left",children:"Bottom-left"}),(0,f.jsx)("option",{value:"bottom right",children:"Bottom-right"})]})]})]}),wc&&(0,f.jsxs)("label",{className:"inspector-field",children:[(0,f.jsx)("span",{children:"Animate (Ken Burns)"}),(0,f.jsx)("select",{value:ce.kenBurns||"none",onChange:D=>ze({kenBurns:D.target.value}),children:SJ.map(D=>(0,f.jsx)("option",{value:D.value,children:D.label},D.value))})]}),(0,f.jsxs)("label",{className:"inspector-field",children:[(0,f.jsx)("span",{children:"Transition in"}),(0,f.jsx)("select",{value:ce.transition||"none",onChange:D=>ze({transition:D.target.value}),children:ik.map(D=>(0,f.jsx)("option",{value:D.value,children:D.label},D.value))})]}),ce.transition!=="none"&&(0,f.jsxs)("label",{className:"inspector-field",children:[(0,f.jsx)("span",{children:"Transition in length (s)"}),(0,f.jsx)("input",{type:"number",min:.1,max:2.5,step:.1,value:ce.transitionDuration,onChange:D=>{let he=Number.parseFloat(D.target.value);Number.isFinite(he)&&ze({transitionDuration:Js(he)})}})]}),(0,f.jsxs)("label",{className:"inspector-field",children:[(0,f.jsx)("span",{children:"Transition out"}),(0,f.jsx)("select",{value:ce.transitionOut||"none",onChange:D=>ze({transitionOut:D.target.value}),children:ak.map(D=>(0,f.jsx)("option",{value:D.value,children:D.label},D.value))})]}),ce.transitionOut!=="none"&&(0,f.jsxs)("label",{className:"inspector-field",children:[(0,f.jsx)("span",{children:"Transition out length (s)"}),(0,f.jsx)("input",{type:"number",min:.1,max:2.5,step:.1,value:ce.transitionOutDuration,onChange:D=>{let he=Number.parseFloat(D.target.value);Number.isFinite(he)&&ze({transitionOutDuration:Js(he)})}})]})]}),Lr&&(0,f.jsxs)("article",{children:[(0,f.jsx)("h2",{children:"Text"}),(0,f.jsxs)("label",{className:"inspector-field",children:[(0,f.jsx)("span",{children:"Content"}),(0,f.jsx)(vQ,{value:ce.text,onChange:D=>ze({text:D}),onCommit:()=>Ua(ce)})]}),(0,f.jsxs)("label",{className:"inspector-field",children:[(0,f.jsx)("span",{children:"Font"}),(0,f.jsx)(bQ,{value:ce.fontFamily,onChange:D=>ze({fontFamily:D,fontWeight:ce.fontWeight>=600?el(D):400})})]}),(0,f.jsx)("div",{className:"inspector-grid",children:(0,f.jsxs)("label",{className:"inspector-field",children:[(0,f.jsx)("span",{children:"Size"}),(0,f.jsx)("input",{type:"number",min:"8",max:"120",step:"1",value:ce.fontSize,onChange:D=>ze({fontSize:Number(D.target.value)})})]})}),(0,f.jsxs)("div",{className:"text-style-toggles",children:[(0,f.jsxs)("label",{className:"style-toggle bold",title:"Bold",children:[(0,f.jsx)("input",{type:"checkbox","aria-label":"Bold",checked:ce.fontWeight>=600,onChange:D=>ze({fontWeight:D.target.checked?el(ce.fontFamily):400})}),(0,f.jsx)("span",{"aria-hidden":"true",children:"B"})]}),(0,f.jsxs)("label",{className:"style-toggle italic",title:"Italic",children:[(0,f.jsx)("input",{type:"checkbox","aria-label":"Italic",checked:ce.italic,onChange:D=>ze({italic:D.target.checked})}),(0,f.jsx)("span",{"aria-hidden":"true",children:"I"})]}),(0,f.jsxs)("label",{className:"style-toggle underline",title:"Underline",children:[(0,f.jsx)("input",{type:"checkbox","aria-label":"Underline",checked:ce.underline,onChange:D=>ze({underline:D.target.checked})}),(0,f.jsx)("span",{"aria-hidden":"true",children:"U"})]})]}),(0,f.jsxs)("div",{className:"inspector-grid",children:[(0,f.jsxs)("label",{className:"inspector-field",children:[(0,f.jsx)("span",{children:"Text"}),(0,f.jsx)("input",{type:"color",value:ce.color.startsWith("#")?ce.color:"#ffffff",onChange:D=>ze({color:D.target.value})})]}),(0,f.jsxs)("label",{className:"inspector-field",children:[(0,f.jsx)("span",{children:"Effect color"}),(0,f.jsx)("input",{type:"color",value:ce.background.startsWith("#")?ce.background:"#000000",onChange:D=>ze({background:D.target.value})})]})]}),(0,f.jsxs)("label",{className:"inspector-field",children:[(0,f.jsx)("span",{children:"Background"}),(0,f.jsx)(yQ,{value:ce.textBackgroundStyle,color:ce.color,background:ce.background,onChange:D=>ze({textBackgroundStyle:D})})]}),(0,f.jsxs)("label",{className:"inspector-field",children:[(0,f.jsx)("span",{children:"Animated captions"}),(0,f.jsx)(_Q,{value:ce.captionAnimation||"none",onSelect:D=>ze(D?{captionAnimation:D.animation,captionActiveColor:D.activeColor??ce.captionActiveColor,captionHighlightColor:D.highlightColor??ce.captionHighlightColor,captionUppercase:D.uppercase??!1,...D.color?{color:D.color}:{},...D.background?{background:D.background}:{},...D.textBackgroundStyle?{textBackgroundStyle:D.textBackgroundStyle}:{},...D.fontWeight?{fontWeight:D.fontWeight}:{}}:{captionAnimation:"none"})})]}),ce.captionAnimation!=="none"&&(0,f.jsxs)("div",{className:"inspector-grid",children:[(0,f.jsxs)("label",{className:"inspector-field",children:[(0,f.jsx)("span",{children:"Active word"}),(0,f.jsx)("input",{type:"color",value:ce.captionActiveColor.startsWith("#")?ce.captionActiveColor:"#FFE14D",onChange:D=>ze({captionActiveColor:D.target.value})})]}),ce.captionAnimation==="highlight-pop"&&(0,f.jsxs)("label",{className:"inspector-field",children:[(0,f.jsx)("span",{children:"Highlight"}),(0,f.jsx)("input",{type:"color",value:ce.captionHighlightColor.startsWith("#")?ce.captionHighlightColor:"#7C3AED",onChange:D=>ze({captionHighlightColor:D.target.value})})]}),(0,f.jsxs)("label",{className:"inspector-field",children:[(0,f.jsx)("span",{children:"Uppercase"}),(0,f.jsx)("input",{type:"checkbox",checked:ce.captionUppercase,onChange:D=>ze({captionUppercase:D.target.checked})})]})]})]}),Hi&&(0,f.jsxs)("article",{children:[(0,f.jsx)("h2",{children:"Frame"}),(0,f.jsxs)("div",{className:"inspector-grid",children:[(0,f.jsxs)("label",{className:"inspector-field",children:[(0,f.jsx)("span",{children:"X %"}),(0,f.jsx)("input",{type:"number",min:"0",max:"100",step:"0.5",value:ce.x,onChange:D=>ze({x:Number(D.target.value)})})]}),(0,f.jsxs)("label",{className:"inspector-field",children:[(0,f.jsx)("span",{children:"Y %"}),(0,f.jsx)("input",{type:"number",min:"0",max:"100",step:"0.5",value:ce.y,onChange:D=>ze({y:Number(D.target.value)})})]}),(0,f.jsxs)("label",{className:"inspector-field",children:[(0,f.jsx)("span",{children:"W %"}),(0,f.jsx)("input",{type:"number",min:"1",max:"100",step:"0.5",value:ce.width,onChange:D=>ze({width:Number(D.target.value)})})]}),(0,f.jsxs)("label",{className:"inspector-field",children:[(0,f.jsx)("span",{children:"H %"}),(0,f.jsx)("input",{type:"number",min:"1",max:"100",step:"0.5",value:ce.height,onChange:D=>ze({height:Number(D.target.value)})})]}),Lr&&(0,f.jsx)(f.Fragment,{children:(0,f.jsxs)("label",{className:"inspector-field",children:[(0,f.jsx)("span",{children:"Radius"}),(0,f.jsx)("input",{type:"number",min:"0",max:"999",step:"1",value:ce.radius,onChange:D=>ze({radius:Number(D.target.value)})})]})})]})]}),(0,f.jsx)("div",{className:"inspector-danger-zone",children:dt?(0,f.jsxs)("div",{className:"delete-confirm",children:[(0,f.jsx)("span",{children:"Delete this layer?"}),(0,f.jsx)("button",{type:"button",className:"panel-action-button secondary",onClick:()=>me(!1),children:"Cancel"}),(0,f.jsx)("button",{type:"button",className:"panel-action-button danger",onClick:()=>{h(oe),s()},children:"Delete"})]}):(0,f.jsx)("button",{type:"button",className:"inspector-delete-button",disabled:oe.hfId==="source-video",onClick:()=>me(!0),children:"Delete layer"})})]})}),df={current:null},tg={current:null},yk={current:[]};function ok(e){let t=yk.current;t.push(e),t.length>8&&t.splice(0,t.length-8)}var ig={current:null},ag={current:[]};function MQ(e){if(ig.current){ig.current.onExportComplete(e);return}ag.current.some(n=>n.url===e.url&&n.renderId===e.renderId)||ag.current.push(e)}function _c(e){let t=typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():`${Date.now().toString(36)}${Math.random().toString(36).slice(2,10)}`;return`${e}-${t}`}async function OQ(e,t){let n=e.body?.getReader();if(!n)throw new Error("No response body");let r=new TextDecoder,o="";for(;;){let{value:i,done:a}=await n.read();if(a)break;o+=r.decode(i,{stream:!0});let s=o.split(`
1808
-
1809
- `);o=s.pop()??"";for(let l of s)for(let c of l.split(`
1810
- `)){if(!c.startsWith("data:"))continue;let d=c.slice(5).trim();if(!d||d==="[DONE]")continue;let u;try{u=JSON.parse(d)}catch{continue}if(!u||typeof u!="object")continue;let m=u,p=typeof m.type=="string"?m.type:null;if(p==="text-delta"&&typeof m.delta=="string")t.onDelta(m.delta);else if(p==="status"){let g=typeof m.status=="string"?m.status:typeof m.message=="string"?m.message:null;g&&t.onStatus&&t.onStatus(g)}else if(p==="tool-call"&&typeof m.toolCallId=="string"&&typeof m.toolName=="string")t.onToolCall?.({toolCallId:m.toolCallId,toolName:m.toolName,args:m.args&&typeof m.args=="object"?m.args:void 0});else if(p==="tool-result"&&typeof m.toolCallId=="string"&&typeof m.toolName=="string")t.onToolResult?.({toolCallId:m.toolCallId,toolName:m.toolName,result:m.result});else if(p==="error"){let g=typeof m.errorText=="string"?m.errorText:m.error&&typeof m.error=="object"&&typeof m.error.message=="string"?m.error.message:"Stream error";t.onError?.(g)}}}}async function S4(e){let t=new FormData;t.append("file",e.file),t.append("folder_path","");let n=await fetch("/api/v1/user/me/attachments/upload",{method:"POST",headers:{"vidfarm-api-key":e.apiKey},body:t}),r=await n.json().catch(()=>({}));if(!n.ok||!r?.attachment)throw new Error(r?.error||`Upload failed with status ${n.status}`);let o=r.attachment,i=o.viewUrl||o.view_url||o.publicUrl||o.public_url||o.url,a=o.fileName||o.file_name||o.name,s=o.contentType||o.content_type||o.mimeType||o.mime_type,l=o.id||o.attachmentId||o.attachment_id;if(!i||!a||!l)throw new Error("Attachment response was incomplete.");return{id:l,fileName:a,contentType:s||e.file.type||"application/octet-stream",viewUrl:i,sizeBytes:typeof o.sizeBytes=="number"?o.sizeBytes:typeof o.size_bytes=="number"?o.size_bytes:e.file.size}}async function _k(e){let n=Xs()?.vidfarmApiKey??null;if(!n)throw new Error("Sign in required to upload media from your computer.");let r=await S4({file:e,apiKey:n});return{url:r.viewUrl,contentType:r.contentType,fileName:r.fileName}}function E4(e){let t=(e.type||"").toLowerCase();if(t.startsWith("video/"))return"video";if(t.startsWith("image/"))return"image";if(t.startsWith("audio/"))return"audio";let n=e.name.toLowerCase();return/\.(mp4|mov|webm|m4v|avi|mkv)$/.test(n)?"video":/\.(png|jpe?g|gif|webp|avif|bmp|svg)$/.test(n)?"image":/\.(mp3|wav|m4a|aac|ogg|flac)$/.test(n)?"audio":null}function DQ({onClose:e,onInsertMedia:t}){let n=(0,S.useRef)(null),[r,o]=(0,S.useState)(null),[i,a]=(0,S.useState)(!1),[s,l]=(0,S.useState)(!1),[c,d]=(0,S.useState)(null);function u(_){let y=t(_);o(y.ok?{kind:"ok",text:`Added \u201C${_.name||"media"}\u201D to the timeline.`}:{kind:"err",text:y.error||"Couldn't add that media."})}function m(_){let y=D_(_.url,_.contentType,_.name);if(y==="video"||y==="audio"){d({..._,kind:y});return}u(_)}async function p(_){if(!E4(_)){o({kind:"err",text:"Pick a video, image, or audio file."});return}a(!0),o({kind:"busy",text:`Uploading \u201C${_.name}\u201D\u2026`});try{let y=await _k(_);m({url:y.url,name:y.fileName,contentType:y.contentType})}catch(y){o({kind:"err",text:y instanceof Error?y.message:"Upload failed."})}finally{a(!1)}}function g(){let _=window.__vidfarmDirectory;if(!_||!_.pick){o({kind:"err",text:"The file browser isn't available on this page yet."});return}_.pick({select:"file",title:"Attach media from your files",initialPath:"/",allowUpload:!0,hint:"Click a video, image, or audio file to add it to the timeline, or drop one into a Files/Temp folder to add it. Browse Files, Temp, Raws, Projects or Approved.",rejectMessage:"Pick a video, image, or audio file (that item can't be placed).",accept:y=>!!y.viewUrl&&!!D_(y.viewUrl||"",y.contentType,y.name),onPick:y=>{y.viewUrl&&m({url:y.viewUrl,name:y.name,contentType:y.contentType})}})}return(0,f.jsxs)("section",{className:"dna-panel upload-media-panel",children:[(0,f.jsxs)("div",{className:"panel-title",children:[(0,f.jsx)("span",{children:"Upload media"}),(0,f.jsx)("button",{type:"button",className:"panel-close-button","aria-label":"Close upload media",onClick:e,children:"x"})]}),(0,f.jsx)("p",{className:"upload-media-intro",children:"Bring footage, images, audio, or a fresh clip into this project."}),(0,f.jsxs)("div",{className:"upload-media-options",children:[(0,f.jsxs)("button",{type:"button",className:"upload-media-option",disabled:i,onClick:()=>n.current?.click(),children:[(0,f.jsx)("span",{className:"upload-media-option-icon","aria-hidden":"true",children:(0,f.jsxs)("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,f.jsx)("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}),(0,f.jsx)("path",{d:"M17 8l-5-5-5 5"}),(0,f.jsx)("path",{d:"M12 3v12"})]})}),(0,f.jsxs)("span",{className:"upload-media-option-text",children:[(0,f.jsx)("strong",{children:"Upload from Computer"}),(0,f.jsx)("small",{children:"Pick a video, image, or audio file from this device."})]})]}),(0,f.jsxs)("button",{type:"button",className:"upload-media-option",disabled:i,onClick:g,children:[(0,f.jsx)("span",{className:"upload-media-option-icon","aria-hidden":"true",children:(0,f.jsx)("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:(0,f.jsx)("path",{d:"M4 20h16a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z"})})}),(0,f.jsxs)("span",{className:"upload-media-option-text",children:[(0,f.jsx)("strong",{children:"Attach from Files"}),(0,f.jsx)("small",{children:"Reuse an asset from My Files, Temp, Raws, or Projects."})]})]}),(0,f.jsxs)("button",{type:"button",className:"upload-media-option",disabled:i,onClick:()=>l(!0),children:[(0,f.jsx)("span",{className:"upload-media-option-icon","aria-hidden":"true",children:(0,f.jsxs)("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,f.jsx)("circle",{cx:"6",cy:"6",r:"3"}),(0,f.jsx)("circle",{cx:"6",cy:"18",r:"3"}),(0,f.jsx)("path",{d:"M20 4 8.12 15.88"}),(0,f.jsx)("path",{d:"M14.47 14.48 20 20"}),(0,f.jsx)("path",{d:"M8.12 8.12 12 12"})]})}),(0,f.jsxs)("span",{className:"upload-media-option-text",children:[(0,f.jsx)("strong",{children:"Clip from Raw"}),(0,f.jsx)("small",{children:"Import a video by URL \u2014 whole or AI-clipped \u2014 into a raws folder."})]})]})]}),r&&(0,f.jsx)("p",{className:`upload-media-status is-${r.kind}`,children:r.text}),(0,f.jsx)("input",{ref:n,type:"file",accept:"video/*,image/*,audio/*",style:{display:"none"},onChange:_=>{let y=_.target.files?.[0];_.target.value="",y&&p(y)}}),s&&(0,f.jsx)(LQ,{onClose:()=>l(!1),onDone:_=>{l(!1),o({kind:"ok",text:_})}}),c&&(0,f.jsx)(T4,{src:c.url,kind:c.kind,title:c.name,onClose:()=>d(null),onConfirm:({playbackStart:_,duration:y})=>{u({url:c.url,name:c.name,contentType:c.contentType,playbackStart:_,duration:y}),d(null)}})]})}function LQ({onClose:e,onDone:t}){let[n,r]=(0,S.useState)(""),[o,i]=(0,S.useState)(""),[a,s]=(0,S.useState)(!1),[l,c]=(0,S.useState)(""),[d,u]=(0,S.useState)(""),[m,p]=(0,S.useState)(!1),[g,_]=(0,S.useState)(null);async function y(){let h=n.trim();if(!/^https?:\/\//i.test(h)){_("Paste a valid video URL (TikTok, YouTube, Instagram, X, or a direct link).");return}p(!0),_(null);try{let T=Xs()?.vidfarmApiKey??null,x=o.trim(),N={source_url:h};a?(l.trim()&&(N.prompt=l.trim()),d&&(N.provider=d)):N.import_only=!0,x&&(N.folder_path=x,N.tracer=x);let M={"content-type":"application/json"};T&&(M["vidfarm-api-key"]=T);let k=await fetch("/raws/scan",{method:"POST",credentials:"include",headers:M,body:JSON.stringify(N)}),P=await k.json().catch(()=>({}));if(!k.ok)throw new Error(P?.error||`Import failed (${k.status}).`);let F=x?`/raws/${x}`:"your raws library";t(a?`Started clipping \u2014 new clips will land in ${F}. Track progress in the Raws library.`:`Imported the video into ${F}.`)}catch(v){_(v instanceof Error?v.message:"Import failed.")}finally{p(!1)}}return(0,f.jsx)("div",{className:"upload-clip-modal-backdrop",role:"dialog","aria-modal":"true","aria-label":"Clip from raw",children:(0,f.jsxs)("div",{className:"upload-clip-modal",children:[(0,f.jsxs)("div",{className:"upload-clip-modal-head",children:[(0,f.jsx)("span",{className:"upload-clip-eyebrow",children:"Import source"}),(0,f.jsx)("h2",{children:"Clip from Raw"}),(0,f.jsx)("p",{children:"Paste a video URL \u2014 TikTok, YouTube, Instagram, X, or a direct link. It goes into your raws library, ready to attach."})]}),(0,f.jsxs)("label",{className:"upload-clip-field",children:[(0,f.jsx)("span",{children:"Video URL"}),(0,f.jsx)("input",{type:"url",value:n,autoFocus:!0,placeholder:"https://youtube.com/watch?v=\u2026 or https://\u2026/video.mp4",onChange:h=>r(h.target.value)})]}),(0,f.jsxs)("label",{className:"upload-clip-field",children:[(0,f.jsxs)("span",{children:["Folder ",(0,f.jsx)("em",{children:"optional"})]}),(0,f.jsx)("input",{type:"text",value:o,placeholder:"my-campaign-001",onChange:h=>i(h.target.value)}),(0,f.jsx)("small",{children:"The raws folder to save into (used as the tracer too)."})]}),(0,f.jsxs)("label",{className:"upload-clip-toggle",children:[(0,f.jsx)("input",{type:"checkbox",checked:a,onChange:h=>s(h.target.checked)}),(0,f.jsxs)("span",{children:[(0,f.jsx)("b",{children:"Clip raws"})," \u2014 mine this video into matching moments with AI, instead of importing the whole thing."]})]}),a&&(0,f.jsxs)("div",{className:"upload-clip-advanced",children:[(0,f.jsxs)("label",{className:"upload-clip-field",children:[(0,f.jsx)("span",{children:"What to clip for"}),(0,f.jsx)("textarea",{value:l,placeholder:"Clip scenes of people reacting, no text on screen, vertical, 5\u201310 secs long",onChange:h=>c(h.target.value)})]}),(0,f.jsxs)("label",{className:"upload-clip-field",children:[(0,f.jsx)("span",{children:"AI provider"}),(0,f.jsxs)("select",{value:d,onChange:h=>u(h.target.value),children:[(0,f.jsx)("option",{value:"",children:"Auto \u2014 use my saved keys"}),(0,f.jsx)("option",{value:"gemini",children:"Gemini"}),(0,f.jsx)("option",{value:"openai",children:"OpenAI"}),(0,f.jsx)("option",{value:"openrouter",children:"OpenRouter"})]})]})]}),(0,f.jsx)("p",{className:"upload-clip-note",children:a?"AI tagging runs on your own saved key (BYOK).":"We'll pull the whole video into your raws library."}),g&&(0,f.jsx)("p",{className:"upload-clip-error",children:g}),(0,f.jsxs)("div",{className:"upload-clip-actions",children:[(0,f.jsx)("button",{type:"button",className:"upload-clip-btn ghost",onClick:e,disabled:m,children:"Cancel"}),(0,f.jsx)("button",{type:"button",className:"upload-clip-btn gold",onClick:()=>void y(),disabled:m,"aria-busy":m,children:m?"Working\u2026":a?"Start scan":"Import video"})]})]})})}function R_(e){return String(Math.floor(Math.max(0,e))).padStart(2,"0")}function yc(e){let t=Math.max(0,Number.isFinite(e)?e:0),n=Math.floor(t),r=Math.floor(n/3600),o=Math.floor(n%3600/60),i=n%60,a=Math.min(9999,Math.round((t-n)*1e4));return`${R_(r)}:${R_(o)}:${R_(i)}:${String(a).padStart(4,"0")}`}function F6(e){let t=(e||"").trim();if(!t)return null;let n=0,r=t.indexOf(".");if(r>=0){let s=t.slice(r+1).replace(/[^0-9]/g,"");s&&(n=+`0.${s}`||0),t=t.slice(0,r)}let o=t.split(":").map(s=>s.trim());if(o.length>4)return null;if(r<0&&o.length===4){let s=o.pop().replace(/[^0-9]/g,"");s&&(n=+`0.${s}`||0)}if(o.some(s=>s===""||!/^\d+$/.test(s)))return null;let i=o.map(s=>Number(s)),a=0;if(i.length===3)a=i[0]*3600+i[1]*60+i[2];else if(i.length===2)a=i[0]*60+i[1];else if(i.length===1)a=i[0];else return null;return a+n}function H6(e){return Math.round(e*1e3)/1e3}function G6(e){let t=Math.max(0,e||0);return t<60?`${Number(t.toFixed(2))}s`:`${Math.floor(t/60)}:${R_(Math.floor(t%60))}`}function T4({src:e,kind:t,targetDuration:n,initialPlaybackStart:r=0,title:o,onConfirm:i,onClose:a}){let s=(0,S.useRef)(null),[l,c]=(0,S.useState)(null),[d,u]=(0,S.useState)(Math.max(0,r)),[m,p]=(0,S.useState)(null),[g,_]=(0,S.useState)(yc(Math.max(0,r))),[y,h]=(0,S.useState)(""),[v,T]=(0,S.useState)(!1),x=(R,C,$)=>Math.min($,Math.max(C,R)),N=l??0,M=m??N,k=Math.max(0,M-d);function P(){let R=s.current;if(!R)return;let C=Number.isFinite(R.duration)&&R.duration>0?R.duration:0;c(C);let $=x(Math.max(0,r),0,Math.max(0,C-.05)),ee=n&&n>0?x($+n,$+.05,C):C;u($),p(ee),_(yc($)),h(yc(ee));try{R.currentTime=$}catch{}}function F(R){let C=x(R,0,Math.max(0,M-.05));u(C),_(yc(C));let $=s.current;if($)try{$.currentTime=C}catch{}}function U(R){let C=N>0?N:R,$=x(R,d+.05,C);p($),h(yc($))}(0,S.useEffect)(()=>{let R=s.current;if(!R||!v)return;let C=()=>{R.currentTime>=M&&(R.pause(),T(!1))};return R.addEventListener("timeupdate",C),()=>R.removeEventListener("timeupdate",C)},[v,M]);function X(){let R=s.current;if(!R)return;try{R.currentTime=d}catch{}let C=R.play?.();C&&typeof C.then=="function"&&C.catch(()=>{}),T(!0)}let G=R=>{s.current=R};return(0,f.jsx)("div",{className:"upload-clip-modal-backdrop",role:"dialog","aria-modal":"true","aria-label":"Choose media segment",children:(0,f.jsxs)("div",{className:"upload-clip-modal media-segment-modal",children:[(0,f.jsxs)("div",{className:"upload-clip-modal-head",children:[(0,f.jsx)("span",{className:"upload-clip-eyebrow",children:"Choose segment"}),(0,f.jsx)("h2",{children:o||(t==="audio"?"Trim audio":"Trim video")}),(0,f.jsxs)("p",{children:["Pick which part of this ",t," to use \u2014 drag the handles, scrub the preview, or type exact times."]})]}),(0,f.jsx)("div",{className:`media-segment-preview media-segment-preview--${t}`,children:t==="video"?(0,f.jsx)("video",{ref:G,src:e,controls:!0,playsInline:!0,preload:"metadata",onLoadedMetadata:P}):(0,f.jsx)("audio",{ref:G,src:e,controls:!0,preload:"metadata",onLoadedMetadata:P})}),l==null?(0,f.jsx)("p",{className:"upload-clip-note",children:"Loading media\u2026"}):(0,f.jsxs)(f.Fragment,{children:[(0,f.jsxs)("div",{className:"media-segment-ranges",children:[(0,f.jsxs)("label",{className:"media-segment-range-row",children:[(0,f.jsx)("span",{children:"In"}),(0,f.jsx)("input",{type:"range",min:0,max:N||0,step:.001,value:d,onChange:R=>F(Number(R.target.value))})]}),(0,f.jsxs)("label",{className:"media-segment-range-row",children:[(0,f.jsx)("span",{children:"Out"}),(0,f.jsx)("input",{type:"range",min:0,max:N||0,step:.001,value:M,onChange:R=>U(Number(R.target.value))})]})]}),(0,f.jsxs)("div",{className:"media-segment-fields",children:[(0,f.jsxs)("label",{className:"upload-clip-field",children:[(0,f.jsxs)("span",{children:["In ",(0,f.jsx)("em",{children:"HH:MM:SS:ffff"})]}),(0,f.jsxs)("div",{className:"media-segment-time-row",children:[(0,f.jsx)("input",{type:"text",value:g,spellCheck:!1,onChange:R=>_(R.target.value),onBlur:()=>{let R=F6(g);R==null?_(yc(d)):F(R)},onKeyDown:R=>{R.key==="Enter"&&R.currentTarget.blur()}}),(0,f.jsx)("button",{type:"button",className:"media-segment-mini",onClick:()=>{let R=s.current;R&&F(R.currentTime)},children:"Set to playhead"})]})]}),(0,f.jsxs)("label",{className:"upload-clip-field",children:[(0,f.jsxs)("span",{children:["Out ",(0,f.jsx)("em",{children:"HH:MM:SS:ffff"})]}),(0,f.jsxs)("div",{className:"media-segment-time-row",children:[(0,f.jsx)("input",{type:"text",value:y,spellCheck:!1,onChange:R=>h(R.target.value),onBlur:()=>{let R=F6(y);R==null?h(yc(M)):U(R)},onKeyDown:R=>{R.key==="Enter"&&R.currentTarget.blur()}}),(0,f.jsx)("button",{type:"button",className:"media-segment-mini",onClick:()=>{let R=s.current;R&&U(R.currentTime)},children:"Set to playhead"})]})]})]}),(0,f.jsxs)("div",{className:"media-segment-readout",children:[(0,f.jsxs)("span",{children:["Segment ",(0,f.jsx)("b",{children:G6(k)})," of ",G6(N)]}),(0,f.jsx)("button",{type:"button",className:"media-segment-mini",onClick:X,children:v?"Playing\u2026":"\u25B6 Preview segment"})]})]}),(0,f.jsxs)("div",{className:"upload-clip-actions",children:[(0,f.jsx)("button",{type:"button",className:"upload-clip-btn ghost",onClick:a,children:"Cancel"}),(0,f.jsx)("button",{type:"button",className:"upload-clip-btn gold",disabled:!(k>0),onClick:()=>i({playbackStart:H6(d),duration:H6(k)}),children:"Use segment"})]})]})})}function UQ(e){return e.replace(/\/$/,"")}function $6(e){let t=[];for(let n of e){if(!n||typeof n!="object")continue;let r=n,o=r.role==="user"||r.role==="assistant"?r.role:null,i=typeof r.id=="string"?r.id:null;if(!o||!i)continue;let a=typeof r.text=="string"?r.text:"",l=(Array.isArray(r.attachments)?r.attachments:[]).filter(u=>!!u&&typeof u=="object").map(u=>({id:typeof u.id=="string"?u.id:_c("user").replace("user-","att-"),fileName:typeof u.fileName=="string"?u.fileName:"attachment",contentType:typeof u.contentType=="string"?u.contentType:"application/octet-stream",viewUrl:typeof u.viewUrl=="string"?u.viewUrl:"",sizeBytes:typeof u.sizeBytes=="number"?u.sizeBytes:0})),d=(Array.isArray(r.toolExchanges)?r.toolExchanges:[]).filter(u=>!!u&&typeof u=="object").map(u=>({toolCallId:typeof u.toolCallId=="string"?u.toolCallId:"",toolName:typeof u.toolName=="string"?u.toolName:"",args:u.args??void 0,result:u.result,status:u.status==="pending"||u.status==="complete"||u.status==="error"?u.status:"complete"}));t.push({id:i,role:o,text:a,attachments:l,toolExchanges:d,status:"complete"})}return t}function PQ({boot:e,composition:t}){let[n,r]=(0,S.useState)([]),[o,i]=(0,S.useState)(""),[a,s]=(0,S.useState)(!1),[l,c]=(0,S.useState)(null),[d,u]=(0,S.useState)([]),[m,p]=(0,S.useState)(!1),[g,_]=(0,S.useState)(!1),[y,h]=(0,S.useState)([]),v=(0,S.useRef)(_c("thread")),T=(0,S.useRef)(null),x=(0,S.useRef)(null),N=(0,S.useRef)(0),M=e?.vidfarmApiKey??null,k=e?.editorChatApiUrl?.trim()||"/api/v1/editor-chat",P=UQ(k),F=e?.compositionId??t.templateId;(0,S.useEffect)(()=>{if(!M)return;let Z=!1;return(async()=>{try{let Le=new URLSearchParams({template_id:F??"",include_messages:"true",limit:"50"}),De=await fetch(`${P}/threads?${Le.toString()}`,{headers:{"vidfarm-api-key":M}});if(!De.ok)return;let et=await De.json().catch(()=>null);if(Z||!Array.isArray(et?.threads))return;let dt=et.threads.filter(me=>!!me&&typeof me=="object").map(me=>({id:String(me.id??""),title:String(me.title??"Chat"),templateId:String(me.templateId??F),updatedAt:String(me.updatedAt??""),lastMessageAt:typeof me.lastMessageAt=="string"?me.lastMessageAt:null,messageCount:typeof me.messageCount=="number"?me.messageCount:0,messages:Array.isArray(me.messages)?me.messages:[]})).filter(me=>me.id);if(Z)return;if(h(dt),dt.length>0){let me=dt[0];v.current=me.id,r($6(me.messages))}}catch{}})(),()=>{Z=!0}},[M,P,F]);let U=(0,S.useCallback)(Z=>{v.current=Z.id,r($6(Z.messages)),_(!1),c(null)},[]),X=(0,S.useCallback)(()=>{v.current=_c("thread"),r([]),_(!1),c(null)},[]);(0,S.useEffect)(()=>{let Z=T.current;Z&&(Z.scrollTop=Z.scrollHeight)},[n]),(0,S.useEffect)(()=>{let Z={onExportComplete:Le=>{r(De=>{if(De.some(lt=>lt.role==="assistant"&&lt.status==="complete"&&typeof lt.text=="string"&&lt.text.includes(Le.url)))return De;let dt=Le.title?`"${Le.title}" `:"",me={id:_c("assistant"),role:"assistant",text:`Render ${dt}finished. Rendered MP4: ${Le.url}
1811
-
1812
- Say "approve it" to publish this MP4 as an approved post.`,toolExchanges:[],status:"complete"};return[...De,me]})}};if(ig.current=Z,ag.current.length>0){let Le=ag.current.slice();ag.current=[];for(let De of Le)Z.onExportComplete(De)}return()=>{ig.current===Z&&(ig.current=null)}},[]);let G=(0,S.useCallback)((Z,Le)=>{r(De=>De.map(et=>et.id===Z?Le(et):et))},[]),R=(0,S.useCallback)(async Z=>{if(!M||Z.length===0)return;let Le=Z.map(De=>({id:_c("user").replace("user-","att-"),fileName:De.name,contentType:De.type||"application/octet-stream",viewUrl:"",sizeBytes:De.size,status:"uploading"}));u(De=>[...De,...Le]);for(let De=0;De<Z.length;De+=1){let et=Z[De],dt=Le[De];try{let me=await S4({file:et,apiKey:M});u(lt=>lt.map(we=>we.id===dt.id?{...me,status:"ready"}:we))}catch(me){let lt=me instanceof Error?me.message:String(me);u(we=>we.map(tt=>tt.id===dt.id?{...tt,status:"error",error:lt}:tt))}}},[M]),C=(0,S.useCallback)(()=>{x.current?.click()},[]),$=(0,S.useCallback)(Z=>{let Le=Z.target.files?Array.from(Z.target.files):[];Z.target.value="",Le.length>0&&R(Le)},[R]),ee=(0,S.useCallback)(Z=>{u(Le=>Le.filter(De=>De.id!==Z))},[]),B=(0,S.useCallback)(Z=>{if(!M)return;let Le=Z.clipboardData?.items?Array.from(Z.clipboardData.items):[],De=[];for(let et of Le)if(et.kind==="file"){let dt=et.getAsFile();dt&&De.push(dt)}De.length>0&&(Z.preventDefault(),R(De))},[M,R]),H=(0,S.useCallback)(Z=>{M&&Z.dataTransfer?.types?.includes("Files")&&(Z.preventDefault(),N.current+=1,p(!0))},[M]),se=(0,S.useCallback)(Z=>{M&&Z.dataTransfer?.types?.includes("Files")&&(Z.preventDefault(),Z.dataTransfer.dropEffect="copy")},[M]),te=(0,S.useCallback)(Z=>{M&&(Z.preventDefault(),N.current=Math.max(0,N.current-1),N.current===0&&p(!1))},[M]),ve=(0,S.useCallback)(Z=>{if(!M)return;Z.preventDefault(),N.current=0,p(!1);let Le=Z.dataTransfer?.files?Array.from(Z.dataTransfer.files):[];Le.length>0&&R(Le)},[M,R]),pe=(0,S.useCallback)(async()=>{let Z=o.trim(),Le=d.filter(ge=>ge.status==="ready");if(d.filter(ge=>ge.status==="uploading").length>0){c("Waiting for uploads to finish...");return}if(!Z&&Le.length===0||a)return;if(!M){c("Sign in required to chat.");return}let et=Le.map(({status:ge,error:Ce,...$e})=>$e),dt={id:_c("user"),role:"user",text:Z,attachments:et,toolExchanges:[],status:"complete"},me={id:_c("assistant"),role:"assistant",text:"",toolExchanges:[],status:"pending"},lt=n;r(ge=>[...ge,dt,me]),i(""),u(ge=>ge.filter(Ce=>Ce.status!=="ready")),s(!0),c("Sending...");let we=e?.compositionId??t.id,tt=e?.slugId??t.id,vn=e?.title??t.title,An=t.summary??"",an=df.current?.getSnapshot();yk.current=[];let ue=et.length>0?[`
1813
-
1814
- <attachments>`,...et.map(ge=>`- ${ge.fileName} (${ge.contentType}): ${ge.viewUrl}`),"</attachments>"].join(`
1815
- `):"",Ve=an?`${Z}${ue}
1816
-
1817
- <editor_context>
1818
- ${JSON.stringify(an,null,2)}
1819
- </editor_context>`:`${Z}${ue}`,Te=ge=>{let Ce=[];ge.text.trim()&&Ce.push({type:"text",text:ge.text});for(let $e of ge.attachments??[])Ce.push({type:"file",data:$e.viewUrl,mediaType:$e.contentType});return Ce},We=[...lt.filter(ge=>ge.text.trim().length>0||(ge.attachments?.length??0)>0).map(ge=>({role:ge.role,content:Te(ge)})),{role:"user",content:[{type:"text",text:Ve},...et.map(ge=>({type:"file",data:ge.viewUrl,mediaType:ge.contentType}))]}],oe={template:{page:"docs",tracerId:null,tracers:[],defaultRequestTracer:null,templateId:we,templateSlug:tt,templateTitle:vn,templateDescription:An,docsRoutes:[]},messages:We,thread_id:v.current,thread_template_id:we,thread_title:vn,thread_tracers:[],user_message:{id:dt.id,role:"user",text:Ve,attachments:et.map(ge=>({id:ge.id,fileName:ge.fileName,contentType:ge.contentType,viewUrl:ge.viewUrl}))},assistant_message:{id:me.id}};try{let ge=await fetch(k,{method:"POST",headers:{"content-type":"application/json","vidfarm-api-key":M},body:JSON.stringify(oe)});if(!ge.ok){let Ce=await ge.text().catch(()=>ge.statusText);throw new Error(Ce||`HTTP ${ge.status}`)}G(me.id,Ce=>({...Ce,status:"streaming"})),await OQ(ge,{onDelta:Ce=>{G(me.id,$e=>({...$e,text:$e.text+Ce}))},onStatus:Ce=>c(Ce),onToolCall:Ce=>{G(me.id,$e=>({...$e,toolExchanges:[...$e.toolExchanges,{toolCallId:Ce.toolCallId,toolName:Ce.toolName,args:Ce.args,status:"pending"}]}))},onToolResult:Ce=>{let $e=null;if(Ce.toolName==="editor_action"){let at=N4(Ce.result);if(at&&df.current)try{$e=df.current.applyAction(at)}catch(Xt){$e={ok:!1,error:Xt instanceof Error?Xt.message:String(Xt)}}else at&&($e={ok:!1,error:"Editor not ready to apply action."});at&&ok({action_type:at.action_type,layer_key:at.layer_key,ok:!!$e?.ok,error:$e&&!$e.ok?$e.error:void 0,summary:$e?.ok?$e.summary:void 0})}G(me.id,at=>({...at,toolExchanges:at.toolExchanges.map(Xt=>Xt.toolCallId===Ce.toolCallId?{...Xt,result:Ce.result,status:"complete",appliedSummary:$e?.ok?$e.summary:void 0,appliedError:$e&&!$e.ok?$e.error:void 0}:Xt)}))},onError:Ce=>{G(me.id,$e=>({...$e,status:"error",error:Ce}))}}),G(me.id,Ce=>Ce.status==="error"?Ce:{...Ce,status:"complete"}),c(null)}catch(ge){let Ce=ge instanceof Error?ge.message:String(ge);G(me.id,$e=>({...$e,status:"error",error:Ce})),c(`Error: ${Ce}`)}finally{s(!1)}},[M,e,t,o,a,n,d,G]),Ge=(0,S.useCallback)(Z=>{Z.preventDefault(),pe()},[pe]),re=(0,S.useCallback)(Z=>{Z.key==="Enter"&&!Z.shiftKey&&(Z.preventDefault(),pe())},[pe]),Je=d.filter(Z=>Z.status==="uploading").length,Kt=d.filter(Z=>Z.status==="ready").length,it=!!M&&!a&&Je===0&&(o.trim().length>0||Kt>0);return(0,f.jsxs)("aside",{className:`chat-workspace${m?" chat-workspace--drag":""}`,"aria-label":"Creative chat",onDragEnter:H,onDragOver:se,onDragLeave:te,onDrop:ve,children:[(0,f.jsxs)("div",{className:"chat-header chat-header-row",children:[(0,f.jsx)("button",{type:"button",className:"chat-header-history","aria-label":g?"Back to chat":"Open chat history","aria-pressed":g,onClick:()=>_(Z=>!Z),children:g?(0,f.jsx)("svg",{width:"16",height:"16",viewBox:"0 0 20 20",fill:"none",stroke:"currentColor",strokeWidth:"1.9",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:(0,f.jsx)("path",{d:"m12 4-6 6 6 6"})}):(0,f.jsxs)("svg",{width:"16",height:"16",viewBox:"0 0 20 20",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[(0,f.jsx)("circle",{cx:"10",cy:"10",r:"7.2"}),(0,f.jsx)("path",{d:"M10 6v4l2.6 1.6"})]})}),(0,f.jsxs)("div",{className:"chat-header-titles",children:[(0,f.jsx)("span",{children:"Vidfarm"}),(0,f.jsx)("strong",{children:g?"Chat history":e?.title??t.title??"Creative Chat"})]}),g?(0,f.jsx)("button",{type:"button",className:"chat-header-new",onClick:X,children:"New chat"}):null]}),(0,f.jsxs)("div",{className:"chat-thread","aria-live":"polite",ref:T,children:[g?y.length===0?(0,f.jsx)("div",{className:"chat-empty",children:"No previous conversations yet \u2014 start chatting to create one."}):(0,f.jsx)("ul",{className:"chat-thread-history",children:y.map(Z=>(0,f.jsx)("li",{children:(0,f.jsxs)("button",{type:"button",className:"chat-thread-history-item","data-active":Z.id===v.current?"true":"false",onClick:()=>U(Z),children:[(0,f.jsx)("span",{className:"chat-thread-history-title",children:Z.title||"Untitled chat"}),(0,f.jsxs)("span",{className:"chat-thread-history-meta",children:[Z.messageCount," message",Z.messageCount===1?"":"s"]})]})},Z.id))}):n.length===0?(0,f.jsx)("div",{className:"chat-empty",children:M?"Ask about this composition, request edits, or run a tool. Paste, drop, or clip an image to attach.":"Sign in to chat with Vidfarm."}):n.map(Z=>(0,f.jsx)(FQ,{message:Z},Z.id)),l&&!g&&(0,f.jsx)("div",{className:"chat-status",children:l})]}),(0,f.jsxs)("form",{className:"chat-composer",onSubmit:Ge,hidden:g,children:[d.length>0&&(0,f.jsx)("div",{className:"chat-composer-attachments",children:d.map(Z=>(0,f.jsx)(BQ,{attachment:Z,onRemove:()=>ee(Z.id)},Z.id))}),(0,f.jsxs)("div",{className:"chat-composer-shell",children:[(0,f.jsx)("textarea",{"aria-label":"Message",placeholder:M?"Message Vidfarm...":"Sign in required",rows:3,value:o,onChange:Z=>i(Z.target.value),onKeyDown:re,onPaste:B,disabled:!M||a}),(0,f.jsxs)("div",{className:"chat-composer-actions",children:[(0,f.jsx)("button",{type:"button",className:"chat-composer-icon",onClick:C,disabled:!M||a,"aria-label":"Attach files",title:"Attach files (or paste / drop)",children:(0,f.jsx)("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:(0,f.jsx)("path",{d:"M21.44 11.05 12.25 20.24a6 6 0 0 1-8.49-8.49l9.19-9.19a4 4 0 0 1 5.66 5.66l-9.2 9.19a2 2 0 0 1-2.83-2.83l8.49-8.48"})})}),(0,f.jsx)("button",{type:"submit",className:"chat-composer-send",disabled:!it,"aria-label":"Send",title:"Send (Enter)",children:a?(0,f.jsx)("span",{className:"chat-composer-send-label",children:"\u2026"}):(0,f.jsxs)("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[(0,f.jsx)("path",{d:"M5 12h14"}),(0,f.jsx)("path",{d:"M13 5l7 7-7 7"})]})})]})]}),(0,f.jsx)("input",{ref:x,type:"file",multiple:!0,hidden:!0,onChange:$}),m&&(0,f.jsx)("div",{className:"chat-composer-drop-hint","aria-hidden":"true",children:"Drop files to attach"})]})]})}function BQ({attachment:e,onRemove:t}){let n=e.contentType.startsWith("image/");return(0,f.jsxs)("div",{className:`chat-attachment-chip chat-attachment-chip--${e.status}`,children:[n&&e.viewUrl?(0,f.jsx)("img",{src:e.viewUrl,alt:"",className:"chat-attachment-chip-thumb"}):(0,f.jsx)("span",{className:"chat-attachment-chip-file","aria-hidden":"true",children:"\u{1F4CE}"}),(0,f.jsxs)("div",{className:"chat-attachment-chip-meta",children:[(0,f.jsx)("span",{className:"chat-attachment-chip-name",title:e.fileName,children:e.fileName}),(0,f.jsx)("span",{className:"chat-attachment-chip-status",children:e.status==="uploading"?"Uploading\u2026":e.status==="error"?e.error||"Failed":"Ready"})]}),(0,f.jsx)("button",{type:"button",className:"chat-attachment-chip-remove",onClick:t,"aria-label":`Remove ${e.fileName}`,children:"\xD7"})]})}function w4(e){return e.replaceAll("&","&amp;").replaceAll("<","&lt;").replaceAll(">","&gt;").replaceAll('"',"&quot;").replaceAll("'","&#39;")}function Y1(e){let t=w4(e);return t=t.replace(/`([^`]+)`/g,"<code>$1</code>"),t=t.replace(/\*\*([^*]+)\*\*/g,"<strong>$1</strong>"),t=t.replace(/(^|[^\*])\*([^*]+)\*(?!\*)/g,"$1<em>$2</em>"),t=t.replace(/\[([^\]]+)\]\((https?:\/\/[^\s)]+)\)/g,'<a href="$2" target="_blank" rel="noopener noreferrer">$1</a>'),t=t.replace(/(^|[\s(])(https?:\/\/[^\s<]+[^<.,:;"')\]\s])/g,'$1<a href="$2" target="_blank" rel="noopener noreferrer">$2</a>'),t}function zQ(e){let t=e.replace(/\r\n/g,`
1820
- `).trim();return t?t.split(/\n{2,}/).map(r=>{let o=r.trim();if(!o)return"";if(o.startsWith("```")&&o.endsWith("```")){let l=o.replace(/^```[^\n]*\n?/,"").replace(/\n?```$/,"");return`<pre><code>${w4(l)}</code></pre>`}let i=o.split(`
1821
- `);return i.every(l=>/^[-*]\s+/.test(l.trim()))?`<ul>${i.map(c=>c.trim().replace(/^[-*]\s+/,"")).map(c=>`<li>${Y1(c)}</li>`).join("")}</ul>`:i.every(l=>/^\d+\.\s+/.test(l.trim()))?`<ol>${i.map(c=>c.trim().replace(/^\d+\.\s+/,"")).map(c=>`<li>${Y1(c)}</li>`).join("")}</ol>`:`<p>${i.map(l=>Y1(l.trim())).join("<br />")}</p>`}).filter(Boolean).join(""):""}function FQ({message:e}){let t=e.text.trim().length>0,n=t?zQ(e.text):"";return(0,f.jsxs)("div",{className:`chat-message chat-message--${e.role} chat-message--${e.status}`,children:[(0,f.jsx)("div",{className:"chat-message-role",children:e.role==="user"?"You":"Vidfarm"}),t&&(0,f.jsx)("div",{className:"chat-message-text chat-message-text--markdown",dangerouslySetInnerHTML:{__html:n}}),e.attachments&&e.attachments.length>0&&(0,f.jsx)("div",{className:"chat-message-attachments",children:e.attachments.map(r=>r.contentType.startsWith("image/")?(0,f.jsx)("a",{href:r.viewUrl,target:"_blank",rel:"noreferrer",className:"chat-message-attachment chat-message-attachment--image",children:(0,f.jsx)("img",{src:r.viewUrl,alt:r.fileName})},r.id):(0,f.jsxs)("a",{href:r.viewUrl,target:"_blank",rel:"noreferrer",className:"chat-message-attachment chat-message-attachment--file",children:["\u{1F4CE} ",r.fileName]},r.id))}),e.toolExchanges.map(r=>(0,f.jsx)(HQ,{exchange:r},r.toolCallId)),e.status==="error"&&e.error&&(0,f.jsx)("div",{className:"chat-message-error",children:e.error}),e.status==="pending"&&!e.text&&e.toolExchanges.length===0&&(0,f.jsx)("div",{className:"chat-message-pending",children:"Thinking..."})]})}function HQ({exchange:e}){let t=e.args?GQ(e.toolName,e.args):null,n=e.appliedError?"failed":e.appliedSummary?"applied":e.status==="pending"?"...":"done";return(0,f.jsxs)("details",{className:`chat-tool chat-tool--${e.status}${e.appliedError?" chat-tool--apply-error":""}`,children:[(0,f.jsxs)("summary",{children:[(0,f.jsx)("span",{className:"chat-tool-name",children:e.toolName}),t&&(0,f.jsx)("span",{className:"chat-tool-args",children:t}),(0,f.jsx)("span",{className:"chat-tool-status",children:n})]}),e.appliedSummary&&(0,f.jsx)("div",{className:"chat-tool-applied",children:e.appliedSummary}),e.appliedError&&(0,f.jsx)("div",{className:"chat-tool-applied chat-tool-applied--error",children:e.appliedError}),e.args&&(0,f.jsx)("pre",{className:"chat-tool-payload",children:JSON.stringify(e.args,null,2)}),e.result!==void 0&&(0,f.jsx)("pre",{className:"chat-tool-payload chat-tool-result",children:dZ(e.result)})]})}function GQ(e,t){if(e==="http_request"){let o=typeof t.method=="string"?t.method:"GET",i=typeof t.path=="string"?t.path:"";return`${o} ${i}`}if(e==="editor_action"){let o=typeof t.action_type=="string"?t.action_type:"?",i=typeof t.layer_key=="string"?` ${t.layer_key}`:"",a=typeof t.kind=="string"?` ${t.kind}`:"";return`${o}${a}${i}`}let n=Object.keys(t)[0];if(!n)return null;let r=t[n];return typeof r=="string"?`${n}: ${r.slice(0,60)}`:n}function ro(e,t){if(!t)return e;let n=t===1?"auto-resolved 1 track collision":`auto-resolved ${t} track collisions`;return`${e} (${n})`}function vk(e,t,n){let r=n.trim();if(!r)return null;let o=t?new DOMParser().parseFromString(t,"text/html"):null,i=M=>{let k=[M];return M.startsWith("element_")?k.push(M.slice(8)):k.push(`element_${M}`),k},a=M=>!o||!!cn(o,M),s=new Set(i(r)),l=M=>[M.key,M.id,M.hfId,M.domId,Se(M)].some(k=>k!==void 0&&s.has(k)),c=e.draftedElements.find(l);if(c&&a(c))return c;if(!o)return c??null;let d=r.includes("#")?r.slice(r.lastIndexOf("#")+1):r,u=M=>M.replace(/["\\]/g,"\\$&"),m=Array.from(new Set([...i(d),...i(r)])),p=m.reduce((M,k)=>M??o.querySelector(`[data-hf-slug="${u(k)}"]`),null),g=m.reduce((M,k)=>M??o.querySelector(`[data-hf-id="${u(k)}"]`)??o.getElementById(k),null),_=(p instanceof Element?p:null)??(g instanceof Element?g:null);if(!_)return c??null;let y=_.getAttribute("data-hf-id")||_.id;if(!y)return c??null;let h=e.draftedElements.find(M=>M.hfId===y||M.domId===y||M.id===y||M.key===y);if(h&&a(h))return h;let v=Number(_.getAttribute("data-start")??0),T=Number(_.getAttribute("data-duration")??0),x=Number(_.getAttribute("data-track-index")??0),N=_ instanceof HTMLElement&&_.id?_.id:void 0;return{id:y,key:y,hfId:y,domId:N,tag:_.tagName.toLowerCase(),start:Number.isFinite(v)?v:0,duration:Number.isFinite(T)?T:0,track:Number.isFinite(x)?x:0}}function x4(e,t){try{let n=new DOMParser().parseFromString(e,"text/html"),r=[];for(let i of Array.from(n.querySelectorAll("[data-hf-id]"))){if(!(i instanceof Element))continue;let a=i.getAttribute("data-hf-id")||i.id||"";if(!a)continue;let s=i.tagName.toLowerCase(),c=(i.getAttribute("data-layer-kind")||"").toLowerCase()||(s==="img"?"image":s==="video"?"video":s==="audio"?"audio":s),d=["video","image","audio"].includes(c)||["video","img","audio"].includes(s);if(t?.mediaOnly&&!d)continue;let u=i.getAttribute("data-hf-slug"),m=i.getAttribute("src")||"",p=m?(m.split("?")[0].split("/").pop()||"").slice(0,44):"";r.push(`\u2022 key=${a}${u?` slug=${u}`:""} (${c}${p?`, currently ${p}`:""})`)}return r.length?` The ${t?.mediaOnly?"media layers":"layers"} you can actually target (use one of these EXACT keys or its slug \u2014 do not invent a layer name):
1822
- ${r.slice(0,50).join(`
1823
- `)}`:""}catch{return""}}function $Q(e,t){if(!Number.isFinite(e)||!Number.isFinite(t)||e<=0||t<=0)return;let n=(a,s)=>s===0?a:n(s,a%s),r=Math.round(e),o=Math.round(t),i=n(r,o)||1;return`${r/i}:${o/i}`}function jQ(e,t){let r=l=>Number(l.toFixed(3));if(!Number.isFinite(t)||t<=0)return[];let o=e.filter(l=>Number.isFinite(l.start)&&Number.isFinite(l.end)&&l.end>l.start).sort((l,c)=>l.start-c.start),i=[];for(let l of o){let c=i[i.length-1];c&&l.start<=c.end+.001?c.end=Math.max(c.end,l.end):i.push({start:Math.max(0,l.start),end:l.end})}let a=[],s=0;for(let l of i)l.start-s>=.2&&a.push({start:r(s),end:r(l.start),duration:r(l.start-s)}),s=Math.max(s,l.end);return t-s>=.2&&a.push({start:r(s),end:r(t),duration:r(t-s)}),a}function k4(e){let t=e.trim();return t?/^(data:|blob:)/i.test(t)?!0:/\.(mp4|mov|webm|m4v|mkv|png|jpe?g|gif|webp|avif|svg|mp3|wav|m4a|aac|ogg|oga|flac)(?=$|[?#&/])/i.test(t):!1}function A4(e,t){let n=Number.isFinite(t)&&t>0?t:0;if(!e)return n;let r=0;try{let o=new DOMParser().parseFromString(e,"text/html");for(let i of Array.from(o.querySelectorAll("[data-start]"))){let a=Number(i.getAttribute("data-start")),s=Number(i.getAttribute("data-duration"));Number.isFinite(a)&&Number.isFinite(s)&&(r=Math.max(r,a+s))}}catch{return n}return r>0?r:n}function I4(e,t,n){if(!e)return 1/0;let r=1/0;try{let o=new DOMParser().parseFromString(e,"text/html");for(let i of Array.from(o.querySelectorAll("[data-start]"))){if(!rt(i))continue;let a=i.getAttribute("data-hf-id")||i.id;if(a&&n.has(a))continue;let s=(i.getAttribute("data-layer-kind")||"").toLowerCase(),l=i.getAttribute("data-vf-timeline-proxy")!==null;if(!(l||["video","image","html","shape"].includes(s))||!(l||i.getAttribute("data-vf-full-canvas")==="true"||Number.parseFloat(i.style.width)>=99.5&&Number.parseFloat(i.style.height)>=99.5))continue;let u=Number(i.getAttribute("data-start"));Number.isFinite(u)&&u>t+.05&&(r=Math.min(r,u))}}catch{return 1/0}return r}function j6(e){let t=e.compositionHtmlRef.current,n=t?new DOMParser().parseFromString(t,"text/html"):null,r=tg.current,o=yk.current.map(R=>R.ok?{action_type:R.action_type,layer_key:R.layer_key,ok:!0,summary:R.summary}:R),i=e.getLastExport(),a=e.getCast(),s=[],l=e.draftedElements.map(R=>{let C=n?cn(n,R):null,$=C?.style,ee=C?.getAttribute("data-layer-kind")??void 0,B=C?.getAttribute("data-vf-timeline-proxy")==="video",H=tt=>{if(!tt)return;let vn=tt.match(/(-?\d+(?:\.\d+)?)\s*%/);return vn?Number(vn[1]):void 0},se=H($?.left),te=H($?.top),ve=H($?.width),pe=H($?.height),Ge=B||se!==void 0&&te!==void 0&&ve!==void 0&&pe!==void 0&&se<=.5&&te<=.5&&ve>=99.5&&pe>=99.5,re=C?.getAttribute("src")??void 0,Je=C?.getAttribute("data-volume"),Kt=Je&&Number.isFinite(Number(Je))?Number(Je):void 0,it=$?.color||void 0,Z=$?.background||void 0,Le=$?.opacity&&Number.isFinite(Number($.opacity))?Number($.opacity):void 0,De=$?.lineHeight&&Number.isFinite(Number($.lineHeight))?Number($.lineHeight):void 0,et=$?.letterSpacing?parseFloat($.letterSpacing):void 0,dt=C?.getAttribute("data-hf-id")??R.hfId??R.id,me=C?.getAttribute("data-hf-slug")??void 0,lt=C?.getAttribute("data-hf-note")??void 0,we=(ee??"").toLowerCase();return(B||["video","image","html","shape"].includes(we))&&Number.isFinite(R.duration)&&R.duration>0&&s.push({start:R.start,end:R.start+R.duration}),{key:Se(R),element_id:dt??void 0,slug:me,note:lt,label:R.label,kind:ee,tag:R.tag,is_timeline_proxy:B||void 0,is_full_canvas:Ge||void 0,src:re,start:R.start,duration:R.duration,track:R.track,playback_start:R.playbackStart,x:se,y:te,width:ve,height:pe,opacity:Le!==void 0&&Number.isFinite(Le)&&Le<1?Le:void 0,line_height:De,letter_spacing:et!==void 0&&Number.isFinite(et)?et:void 0,volume:Kt,color:it,background:Z,object_fit:(we==="video"||we==="image")&&$?.objectFit||void 0,object_position:(we==="video"||we==="image")&&$?.objectPosition||void 0,caption_animation:C?.getAttribute("data-caption-animation")??void 0,text:C&&["caption","text"].includes(we)&&lk(C).trim().slice(0,160)||void 0,transition:C?.getAttribute("data-transition")??void 0,transition_out:C?.getAttribute("data-transition-out")??void 0,transition_duration:C?.getAttribute("data-transition-duration")??void 0,ken_burns:C?.getAttribute("data-kenburns")??void 0,animation:$?.animationName&&$.animationName!=="none"&&$.animationName.indexOf("vf-")!==0?$.animationName:void 0}}),c=n?.querySelector("[data-composition-id]"),d=Number(c?.getAttribute("data-width")),u=Number(c?.getAttribute("data-height")),m=Number.isFinite(d)&&d>0?d:e.composition.width,p=Number.isFinite(u)&&u>0?u:e.composition.height,g=l.reduce((R,C)=>{let $=(C.start??0)+(C.duration??0);return Number.isFinite($)?Math.max(R,$):R},0),_=Number.isFinite(e.activeCompositionDuration)?e.activeCompositionDuration:0,y=g>0?g:_,h=jQ(s,y),v=[];if(n)for(let R of Array.from(n.querySelectorAll("[data-vf-gen-media]"))){if(!rt(R))continue;let C=R.getAttribute("data-vf-gen-media"),$=C==="image"?"image":C==="video"?"video":null;if(!$)continue;let ee=Number(R.getAttribute("data-start")),B=Number(R.getAttribute("data-duration"));v.push({layer_key:R.getAttribute("data-hf-id")||R.id,media_type:$,status:R.getAttribute("data-vf-gen-status")||"generating",job_id:R.getAttribute("data-vf-gen-job")||void 0,start:Number.isFinite(ee)?ee:void 0,duration:Number.isFinite(B)?B:void 0,prompt:R.getAttribute("data-vf-gen-prompt")||void 0,error:R.getAttribute("data-vf-gen-error")||void 0})}let T=b4(t),x=(n?.querySelector("[data-composition-id]")?.getAttribute("data-source-title")||"").trim(),N=T?.emotionalPunch,M=N?{core_emotion:N.coreEmotion||void 0,tone:N.tone||void 0,arc:N.arc||void 0,peak_moment:N.peakMoment||void 0,mechanism:N.mechanism||void 0,contrast:N.contrast||void 0,humor:N.humor&&N.humor.toLowerCase()!=="none"?N.humor:void 0,audio_visual_tension:N.audioVisualTension||void 0,delivery:N.delivery||void 0,preserve:N.preserve?.length?N.preserve:void 0}:void 0,k={source_title:x||void 0,trend_tagline:T?.trendTagline||void 0,hook:T?.hook||void 0,retention:T?.retention||void 0,payoff:T?.payoff||void 0,emotional_punch:M&&Object.values(M).some(R=>R!==void 0)?M:void 0,preserve:T?.preserve?.length?T.preserve:void 0,avoid:T?.avoid?.length?T.avoid:void 0,promotions:T?.promotions?.length?T.promotions:void 0},P=Object.values(k).some(R=>R!==void 0),F=nQ(t)??void 0,U=Y6(),X=U!==null,G=e.composition.origin==="raw"||e.composition.origin==="inspiration"?e.composition.origin:void 0;return{composition_id:e.composition.id,fork_id:U??void 0,composition_title:e.composition.title,composition_origin:G,has_saved_fork:X,is_new_project:!X&&e.composition.id==="original"?!0:void 0,composition_context:P?k:void 0,editor_harness:F,composition_duration_seconds:y>0?Number(y.toFixed(3)):e.activeCompositionDuration,composition_width:m&&m>0?m:void 0,composition_height:p&&p>0?p:void 0,aspect_ratio:$Q(m,p),selected_layer_key:e.selectedElementId,cast:a&&a.length?a:void 0,timeline_gaps:h.length?h:void 0,pending_generations:v.length?v:void 0,last_export_url:i.url,last_export_title:i.title,last_export_status:i.status,last_export_render_id:i.renderId,...r&&r.status==="error"?{save_status:"error",save_error:r.readOnly?"This video isn't editable from here (read-only fork) \u2014 edits preview but are NOT saved. Tell the user to open their own copy to edit.":r.message||"The last change failed to save.",is_read_only:r.readOnly||void 0}:{},...o.length?{recent_action_results:o}:{},layers:l}}function K1(e,t){let n=t.compositionHtmlRef.current;if(!n)return{ok:!1,error:"Composition not loaded yet."};if(e.action_type==="replace_composition_html"){let i=e.composition_html;return!i||!i.includes("data-composition-id=")?{ok:!1,error:"composition_html must be a full HTML document containing data-composition-id."}:(t.patchCompositionHtml(i),{ok:!0,summary:`Replaced composition (${i.length} bytes).`})}if(e.action_type==="set_composition"){if(!(e.canvas_width!==void 0||e.canvas_height!==void 0||e.canvas_duration!==void 0||e.background_color!==void 0))return{ok:!1,error:"set_composition needs at least one of canvas_width, canvas_height, canvas_duration, or background_color."};let a=new DOMParser().parseFromString(n,"text/html"),s=a.querySelector("[data-composition-id]");if(!s)return{ok:!1,error:"No [data-composition-id] root found in the composition HTML."};let l=[];return e.canvas_width!==void 0&&Number.isFinite(e.canvas_width)&&e.canvas_width>0&&(s.setAttribute("data-width",String(Math.round(e.canvas_width))),l.push(`width=${Math.round(e.canvas_width)}`)),e.canvas_height!==void 0&&Number.isFinite(e.canvas_height)&&e.canvas_height>0&&(s.setAttribute("data-height",String(Math.round(e.canvas_height))),l.push(`height=${Math.round(e.canvas_height)}`)),e.canvas_duration!==void 0&&Number.isFinite(e.canvas_duration)&&e.canvas_duration>0&&(s.setAttribute("data-duration",String(Number(e.canvas_duration.toFixed(3)))),l.push(`duration=${Number(e.canvas_duration.toFixed(3))}`)),e.background_color!==void 0&&e.background_color.trim()&&(s.style.background=e.background_color.trim(),l.push(`background=${e.background_color.trim()}`)),l.length===0?{ok:!1,error:"set_composition received no valid values (width/height/duration must be positive numbers)."}:(t.patchCompositionHtml(gg(a)),{ok:!0,summary:`Updated composition (${l.join(" ")}). Resize/duration changes reflect on the next editor_context.`})}if(e.action_type==="export_composition")return t.isExportInFlight()?{ok:!1,error:"Render already in flight \u2014 wait for the current render to finish."}:(t.startExport(),{ok:!0,summary:"Started composition export. The exported MP4 URL will land in editor_context.last_export_url when it succeeds."});if(e.action_type==="fork_composition"){let i=e.fork_from==="default"?"default":"current";return t.forkComposition(i),{ok:!0,summary:i==="default"?"Starting a fresh fork from the original template \u2014 the editor will open the new copy.":"Branching a new fork from the current working copy \u2014 the editor will open the new copy."}}if(e.action_type==="add_layer")return qQ(e,t,n);if(e.action_type==="set_captions")return WQ(e,t,n);if(e.action_type==="set_transitions")return YQ(e,t,n);if(e.action_type==="generate_layer")return KQ(e,t,n);if(e.action_type==="group_layers")return rZ(e,t,n);if(e.action_type==="ungroup_layers")return oZ(e,t,n);if(e.action_type==="nudge_layers")return sZ(e,t,n);if(e.action_type==="ripple_edit")return lZ(e,t,n);let r=e.layer_key;if(!r)return{ok:!1,error:`layer_key required for ${e.action_type}.`};let o=vk(t,n,r);if(!o){let i=e.action_type==="set_layer_media";return{ok:!1,error:`Layer not found: ${r}.${x4(n,{mediaOnly:i})}`}}if(e.action_type==="set_layer_identity"){let i=ci(n,o,a=>{if(e.slug!==void 0){let s=B_(e.slug);s?a.setAttribute("data-hf-slug",s):a.removeAttribute("data-hf-slug")}if(e.note!==void 0){let s=e.note.trim();s?a.setAttribute("data-hf-note",s):a.removeAttribute("data-hf-note")}});return i===n?{ok:!1,error:"No change applied \u2014 element selector did not match the composition HTML."}:(t.patchCompositionHtml(i),{ok:!0,summary:`Updated identity of ${r} (slug=${e.slug??"-"} note=${e.note?"yes":"-"}).`})}if(e.action_type==="remove_layer")try{let{html:i,resolvedCollisions:a}=fr(n,s=>{let l=cn(s,o);l?.parentNode&&l.parentNode.removeChild(l)});return i===n?{ok:!1,error:"No change applied \u2014 element selector did not match the composition HTML."}:(t.patchCompositionHtml(i),{ok:!0,summary:ro(`Removed layer ${r}.`,a)})}catch(i){return{ok:!1,error:i instanceof Error?i.message:String(i)}}if(e.action_type==="set_layer_timing"){let i={};if(e.start!==void 0&&(i.start=e.start),e.duration!==void 0&&(i.duration=e.duration),e.track!==void 0&&(i.track=e.track),e.playback_start!==void 0&&(i.playbackStart=e.playback_start),Object.keys(i).length===0)return{ok:!1,error:"set_layer_timing needs at least one of start, duration, track, or playback_start."};{let a=i.start??o.start,s=i.duration??o.duration,l=i.track??o.track,c=o.hfId||o.domId||o.id,d=new DOMParser().parseFromString(n,"text/html"),u=Tc(d,{start:a,duration:s,track:l},new Set(c?[c]:[]));u!==l&&(i.track=u)}try{let{html:a,resolvedCollisions:s}=z_(n,o,i);if(a===n)return{ok:!1,error:"No change applied \u2014 element selector did not match the composition HTML."};t.patchCompositionHtml(a);let l=Object.entries(i).map(([c,d])=>`${c}=${d}`).join(" ");return{ok:!0,summary:ro(`Updated ${r} timing (${l}).`,s)}}catch(a){return{ok:!1,error:a instanceof Error?a.message:String(a)}}}if(e.action_type==="set_layer_visual"){let a=["x","y","width","height","font_size","border_radius","opacity"].filter(c=>e[c]!==void 0);if(a.length===0)return{ok:!1,error:"set_layer_visual needs at least one of x, y, width, height, font_size, border_radius, or opacity."};let s=ci(n,o,c=>{e.x!==void 0&&(c.style.left=`${e.x}%`),e.y!==void 0&&(c.style.top=`${e.y}%`),e.width!==void 0&&(c.style.width=`${e.width}%`),e.height!==void 0&&(c.style.height=`${e.height}%`),e.font_size!==void 0&&(c.style.fontSize=`${e.font_size}px`),e.border_radius!==void 0&&(c.style.borderRadius=`${e.border_radius}px`),e.opacity!==void 0&&(c.style.opacity=String(Math.max(0,Math.min(1,e.opacity))))});if(s===n)return{ok:!1,error:"No change applied \u2014 element selector did not match the composition HTML."};t.patchCompositionHtml(s);let l=a.map(c=>`${c}=${e[c]}`).join(" ");return{ok:!0,summary:`Updated ${r} visual (${l}).`}}if(e.action_type==="set_layer_media")return ZQ(e,t,n,o);if(e.action_type==="set_layer_style")return eZ(e,t,n,o);if(e.action_type==="duplicate_layer")return tZ(e,t,n,o);if(e.action_type==="split_layer")return nZ(e,t,n,o);if(e.action_type==="set_layer_keyframes")return aZ(e,t,n,o);if(e.action_type==="set_layer_zindex")return cZ(e,t,n,o);if(e.action_type==="trim_layer")return uZ(e,t,n,o);if(e.action_type==="set_layer_text"){if(e.text===void 0)return{ok:!1,error:"set_layer_text requires a text value."};let i=e.text,a=ci(n,o,s=>{if(s.hasAttribute("data-caption-animation")&&s.querySelector("[data-vf-text-inline]"))ck(s,i);else if(s.querySelector("[data-vf-text-inline]")){let l=s.getAttribute("data-text-background-style")||"plain",c=s.getAttribute("data-text-background-color")||"#000000",d=s.style.color||"#ffffff",u=s.getAttribute("data-font-family")||void 0,m=Number(s.style.fontWeight),p=Number.isFinite(m)&&m>0?m:void 0;tl(s,i,l,d,c,u,p),s.setAttribute("data-label",i.slice(0,48)||s.getAttribute("data-label")||"")}else s.textContent=i});return a===n?{ok:!1,error:"No change applied \u2014 element selector did not match the composition HTML."}:(t.patchCompositionHtml(a),{ok:!0,summary:`Updated ${r} text.`})}return{ok:!1,error:`Unknown action_type: ${e.action_type??"(none)"}`}}function qQ(e,t,n){let r=e.kind;if(!r)return{ok:!1,error:"add_layer requires a kind (video, image, audio, text, or html)."};if((r==="video"||r==="image"||r==="audio")&&!e.src?.trim())return{ok:!1,error:`add_layer kind=${r} requires src (media URL).`};if((r==="video"||r==="image"||r==="audio")&&e.src&&!k4(e.src))return{ok:!1,error:`add_layer kind=${r} src "${e.src.trim().slice(0,80)}" is not a media-file URL. Use a real video/image/audio file URL (a browse_files result, a /raws clip, a My Files asset, or a generated media URL) \u2014 not a folder or page.`};if(r==="text"&&e.text===void 0)return{ok:!1,error:"add_layer kind=text requires text."};if(r==="html"&&!e.html?.trim())return{ok:!1,error:"add_layer kind=html requires html."};let o=A4(n,t.activeCompositionDuration),i=e.start??0,a=Math.max(0,o>0?Math.min(o-.1,i):i),s=o>0?Math.max(.1,o-a):4,l=e.duration??Math.min(4,s),c=Math.max(.1,o>0?Math.min(l,s):l),d=r==="text"?{x:12,y:68,width:76,height:12}:r==="audio"?{x:0,y:0,width:0,height:0}:{x:0,y:0,width:100,height:100},u=Re(e.x??d.x,0,100),m=Re(e.y??d.y,0,100),p=Re(e.width??d.width,0,100),g=Re(e.height??d.height,0,100),_=1,y=(r==="video"||r==="image")&&p>=99.5&&g>=99.5&&u<=.5&&m<=.5;if(e.duration===void 0&&y&&c<_){let N=I4(n,a,new Set),k=(Number.isFinite(N)?N:o>0?o:a+4)-a;c=Math.max(_,Number.isFinite(k)&&k>0?k:Math.min(4,s))}let h=e.layer_key?.trim(),T=(h&&/^[A-Za-z][\w-]{0,63}$/.test(h)?h.startsWith("element_")?h:`element_${h}`:null)??`element_${r}_${Date.now().toString(36)}${Math.floor(Math.random()*1e3).toString(36)}`,x=e.label?.trim()||(r==="text"?"New text":r==="html"?"Custom HTML":`New ${r}`);try{let{html:N,resolvedCollisions:M}=fr(n,k=>{let P=k.querySelector("[data-composition-id]");if(!rt(P))throw new Error("Composition root not found.");let F=Array.from(k.querySelectorAll("[data-start]")).filter(ee=>rt(ee)),U=e.track,X=F.reduce((ee,B)=>{let H=Number(B.getAttribute("data-track-index")??0);return Number.isFinite(H)?Math.max(ee,H+1):ee},0),G=Number.isFinite(U)&&U!==void 0?Math.max(0,Math.floor(U)):X,R=Tc(k,{start:a,duration:c,track:G},new Set([T])),C;r==="video"?C=k.createElement("video"):r==="image"?C=k.createElement("img"):r==="audio"?C=k.createElement("audio"):C=k.createElement("div"),C.id=T,C.setAttribute("data-hf-id",T),C.setAttribute("data-layer-mode","publish");let $=r==="text"?"caption":r;if(C.setAttribute("data-layer-kind",$),C.setAttribute("data-viral-note",`AI inserted ${r} layer.`),C.setAttribute("data-start",He(a)),C.setAttribute("data-duration",He(c)),C.setAttribute("data-end",He(a+c)),C.setAttribute("data-track-index",String(R)),C.setAttribute("data-label",x),C.classList.add("clip"),e.slug){let ee=B_(e.slug);ee&&C.setAttribute("data-hf-slug",ee)}if(e.note&&e.note.trim()&&C.setAttribute("data-hf-note",e.note.trim()),r!=="audio"?(C.style.position="absolute",C.style.left=`${u}%`,C.style.top=`${m}%`,C.style.width=`${p}%`,C.style.height=`${g}%`,C.style.zIndex=String(R),C.style.overflow="hidden"):C.style.display="none",r==="video"&&e.src){C.setAttribute("src",e.src),C.setAttribute("playsinline",""),C.setAttribute("preload","auto"),e.muted===!1||e.volume!==void 0&&e.volume>0||C.setAttribute("muted",""),C.setAttribute("data-volume",String(e.volume??1));let B=He(e.playback_start??0);C.setAttribute("data-media-start",B),C.setAttribute("data-playback-start",B),C.style.objectFit=e.object_fit??"cover",e.object_position&&(C.style.objectPosition=e.object_position),C.style.background="#050604"}else if(r==="image"&&e.src)C.setAttribute("src",e.src),C.style.objectFit=e.object_fit??"cover",e.object_position&&(C.style.objectPosition=e.object_position),e.ken_burns&&e.ken_burns!=="none"&&pg(C,e.ken_burns,e.ken_burns_intensity);else if(r==="audio"&&e.src){if(C.setAttribute("src",e.src),C.setAttribute("preload","auto"),e.volume!==void 0&&C.setAttribute("data-volume",String(e.volume)),e.playback_start!==void 0){let ee=He(e.playback_start);C.setAttribute("data-media-start",ee),C.setAttribute("data-playback-start",ee)}}else if(r==="text"){C.setAttribute("data-text-background-style","plain"),C.setAttribute("data-text-background-color",e.background??"#000000"),C.setAttribute("data-font-family","Montserrat"),C.style.display="flex",C.style.alignItems="center",C.style.justifyContent="center",C.style.padding="3px",C.style.boxSizing="border-box",C.style.textAlign="center",C.style.color=e.color??"#ffffff",C.style.background="transparent",C.style.fontFamily="Montserrat, 'TikTok Sans', sans-serif",C.style.fontWeight="600",C.style.fontSize=`${e.font_size??22}px`,C.style.lineHeight="1.2",tl(C,e.text??"","plain",e.color??"#ffffff",e.background??"#000000","Montserrat",600);let ee=uk(e.caption_style),B=e.caption_animation&&e.caption_animation!=="none"?e.caption_animation:ee?.animation;B&&(r4(C,ee,e),mg(C,B,{activeColor:e.caption_active_color??ee?.activeColor,highlightColor:e.caption_highlight_color??ee?.highlightColor,uppercase:e.caption_uppercase??ee?.uppercase,text:e.text??""}))}else r==="html"&&e.html&&(C.innerHTML=e.html,e.color&&(C.style.color=e.color),e.background&&(C.style.background=e.background),e.font_size!==void 0&&(C.style.fontSize=`${e.font_size}px`));r!=="audio"&&e.transition&&e.transition!=="none"&&Qs(C,e.transition,e.transition_duration),r!=="audio"&&e.transition_out&&e.transition_out!=="none"&&Ec(C,e.transition_out,e.transition_out_duration),P.append(C)});return t.patchCompositionHtml(N),{ok:!0,summary:ro(`Added ${r} layer ${T} (start=${a} duration=${c}).`,M)}}catch(N){return{ok:!1,error:N instanceof Error?N.message:String(N)}}}function VQ(e,t,n,r=4){let o=sk(e,n),i=[],a=[],s=()=>{if(!a.length)return;let l=a[0].start,c=a[a.length-1].end+.12;i.push({text:a.map(d=>d.text).join(" "),start:Number((t+l).toFixed(3)),duration:Number(Math.max(.2,c-l).toFixed(3)),words:a.map(d=>({text:d.text,start:Number((d.start-l).toFixed(3)),end:Number((d.end-l).toFixed(3))}))}),a=[]};for(let l of o)(a.length>=r||a.length>0&&/[.!?…]["')\]]?$/.test(a[a.length-1].text))&&s(),a.push(l);s();for(let l=0;l<i.length-1;l+=1){let c=i[l+1].start-.02;i[l].start+i[l].duration>c&&(i[l].duration=Number(Math.max(.1,c-i[l].start).toFixed(3)))}return i}function WQ(e,t,n){let r=e.caption_animation==="none",o=r?null:uk(e.caption_style)??(e.caption_animation?null:L_[0]),i=r?null:t4(e.caption_animation??o?.animation);if(!r&&!i)return{ok:!1,error:`Unknown caption_animation "${e.caption_animation}". Use one of: ${e4.join(", ")}, or "none" for static (unanimated) captions.`};let a=Array.isArray(e.captions)?e.captions.filter(y=>y&&typeof y.text=="string"&&y.text.trim()&&Number.isFinite(y.start)&&Number.isFinite(y.duration)&&y.duration>0).map(y=>({text:y.text.trim(),start:y.start,duration:y.duration,words:Array.isArray(y.words)&&y.words.length?y.words.map(h=>({text:String(h.text??"").trim(),start:Number(h.start)||0,end:Number(h.end)||0})).filter(h=>h.text&&h.end>h.start):sk(y.text,y.duration)})):[];if(!a.length&&e.text?.trim()){let y=t.activeCompositionDuration>0?t.activeCompositionDuration:60,h=Math.max(0,e.start??0),v=Math.max(.4,e.duration??y-h);a=VQ(e.text,h,v)}if(!a.length)return{ok:!1,error:"set_captions needs captions (array of {text,start,duration,words?}) or text (+ optional start/duration window)."};let s=e.color??o?.color??"#ffffff",l=e.background??o?.background??"#000000",c=dk(e.background_style??o?.textBackgroundStyle??"plain"),d=(y,h)=>typeof y=="number"&&Number.isFinite(y)&&y>0?y:h,u=e.font_family?.trim()?e.font_family.trim():"Montserrat",m=e.font_weight??o?.fontWeight??800,p=d(e.font_size,38),g=(y,h)=>typeof y=="number"&&Number.isFinite(y)?y:h,_={x:Re(g(e.x,10),0,100),y:Re(g(e.y,70),0,100),width:Re(d(e.width,80),1,100),height:Re(d(e.height,14),1,100)};try{let y=0,{html:h,resolvedCollisions:v}=fr(n,x=>{let N=x.querySelector("[data-composition-id]");if(!rt(N))throw new Error("Composition root not found.");let M=new Set;for(let C of Array.from(x.querySelectorAll("[data-caption-animation]")))M.add(C);for(let C of Array.from(x.querySelectorAll('[data-layer-kind="caption"]')))M.add(C);for(let C of M)C.parentNode?.removeChild(C),y+=1;let k=Math.min(...a.map(C=>C.start)),P=Math.max(...a.map(C=>C.start+C.duration)),U=Array.from(x.querySelectorAll("[data-start]")).filter(C=>rt(C)).reduce((C,$)=>{let ee=Number($.getAttribute("data-track-index")??0);return Number.isFinite(ee)?Math.max(C,ee+1):C},0),X=e.track!==void 0&&Number.isFinite(e.track)?Math.max(0,Math.floor(e.track)):U,G=Tc(x,{start:k,duration:Math.max(.1,P-k),track:X},new Set),R=Date.now().toString(36);a.forEach((C,$)=>{let ee=`element_cap_${R}_${$}`,B=x.createElement("div");B.id=ee,B.setAttribute("data-hf-id",ee),B.setAttribute("data-layer-mode","publish"),B.setAttribute("data-layer-kind","caption"),B.setAttribute("data-viral-note","Animated caption cue."),B.setAttribute("data-start",He(C.start)),B.setAttribute("data-duration",He(C.duration)),B.setAttribute("data-end",He(C.start+C.duration)),B.setAttribute("data-track-index",String(G)),B.setAttribute("data-label",C.text.slice(0,48)),B.classList.add("clip"),B.setAttribute("data-text-background-style",c),B.setAttribute("data-text-background-color",l),B.setAttribute("data-font-family",u),B.style.position="absolute",B.style.left=`${_.x}%`,B.style.top=`${_.y}%`,B.style.width=`${_.width}%`,B.style.height=`${_.height}%`,B.style.zIndex=String(G),B.style.display="flex",B.style.alignItems="center",B.style.justifyContent="center",B.style.padding="3px",B.style.boxSizing="border-box",B.style.textAlign="center",B.style.color=s,B.style.background="transparent",B.style.fontFamily=`${Zs(u)}, 'TikTok Sans', sans-serif`,B.style.fontWeight=String(m),B.style.fontSize=`${p}px`,B.style.lineHeight="1.2",B.style.overflow="visible",tl(B,C.text,c,s,l,u,m),i&&mg(B,i,{activeColor:e.caption_active_color??o?.activeColor,highlightColor:e.caption_highlight_color??o?.highlightColor,uppercase:e.caption_uppercase??o?.uppercase,text:C.text,words:C.words}),N.append(B)})});t.patchCompositionHtml(h);let T=y>0?` (replaced ${y} previous caption cues)`:"";return{ok:!0,summary:ro(`Set ${a.length} ${i?"animated":"static"} caption cues, style ${o?.id??i??"none (static text)"}${T}.`,v)}}catch(y){return{ok:!1,error:y instanceof Error?y.message:String(y)}}}function YQ(e,t,n){let r=e.transition,o=e.transition_intro,i=e.transition_outro;if(r===void 0&&o===void 0&&i===void 0)return{ok:!1,error:'set_transitions needs transition (junction preset or "none"), transition_intro and/or transition_outro.'};if(r!==void 0&&r!=="none"&&!J1(r))return{ok:!1,error:`Unknown transition "${r}". Use one of: none, ${X1.join(", ")}.`};if(o!==void 0&&o!=="none"&&!J1(o))return{ok:!1,error:`Unknown transition_intro "${o}". Use one of: none, ${X1.join(", ")}.`};if(i!==void 0&&i!=="none"&&!Z6(i))return{ok:!1,error:`Unknown transition_outro "${i}". Use one of: none, ${X6.join(", ")}.`};try{let a=0,{html:s,resolvedCollisions:l}=fr(n,d=>{let u=Array.from(d.querySelectorAll("[data-start]")).filter(y=>{if(!rt(y)||y.hasAttribute("data-composition-id")||y.hasAttribute("data-vf-playback-source"))return!1;let h=y.tagName.toLowerCase();if(h==="audio")return!1;let v=y.getAttribute("data-layer-kind");return h==="video"||h==="img"||y.getAttribute("data-vf-timeline-proxy")==="video"||v==="video"||v==="image"});if(!u.length)throw new Error("No scene clips (video/image layers) found in the composition.");let m=u.map(y=>({node:y,start:Number.parseFloat(y.getAttribute("data-start")||"")||0,duration:Number.parseFloat(y.getAttribute("data-duration")||"")||0,track:Number.parseInt(y.getAttribute("data-track-index")||"0",10)||0})).sort((y,h)=>y.start-h.start||y.track-h.track),p=new Map;for(let y of m){let h=p.get(y.track);(!h||y.start<h.start)&&p.set(y.track,y)}if(r!==void 0)for(let y of m)p.get(y.track)!==y&&(Qs(y.node,r==="none"?null:r,e.transition_duration),a+=1);let g=m[0],_=m.reduce((y,h)=>h.start+h.duration>y.start+y.duration?h:y,m[0]);o!==void 0&&g&&Qs(g.node,o==="none"?null:o,e.transition_duration),i!==void 0&&_&&Ec(_.node,i==="none"?null:i,e.transition_out_duration??e.transition_duration)});t.patchCompositionHtml(s);let c=[];return r!==void 0&&c.push(r==="none"?`cleared junction transitions on ${a} clips`:`${r} at ${a} junctions`),o!==void 0&&c.push(o==="none"?"intro cleared":`intro ${o}`),i!==void 0&&c.push(i==="none"?"outro cleared":`outro ${i}`),{ok:!0,summary:ro(`Set scene transitions: ${c.join(", ")}.`,l)}}catch(a){return{ok:!1,error:a instanceof Error?a.message:String(a)}}}var q6="data:image/svg+xml;charset=utf-8,"+encodeURIComponent("<svg xmlns='http://www.w3.org/2000/svg' width='360' height='640' viewBox='0 0 360 640'><rect width='360' height='640' fill='#0c0f0a'/><circle cx='180' cy='300' r='34' fill='none' stroke='#3ad07a' stroke-width='6' stroke-linecap='round' stroke-dasharray='150 60'/><text x='180' y='378' fill='#8ad9a6' font-family='monospace' font-size='20' text-anchor='middle'>Generating\u2026</text></svg>");function KQ(e,t,n){let r=e.media_type==="image"?"image":e.media_type==="video"?"video":null;if(!r)return{ok:!1,error:"generate_layer requires media_type 'video' or 'image'."};let o=e.prompt?.trim();if(!o)return{ok:!1,error:"generate_layer requires a non-empty prompt."};let i=e.intent??(e.replace_layer_key?"replace_layer":"add"),a=e.start,s=e.duration,l=e.track,c=e.x,d=e.y,u=e.width,m=e.height,p=null;if(i==="replace_layer"){let $=(e.replace_layer_key||e.layer_key||"").trim();if(!$)return{ok:!1,error:"generate_layer intent=replace_layer requires replace_layer_key (the layer to replace)."};let ee=vk(t,n,$);if(!ee)return{ok:!1,error:`generate_layer: layer to replace not found: ${$}`};p=ee;let B=new DOMParser().parseFromString(n,"text/html"),H=cn(B,ee),se=H?H.getAttribute("data-vf-timeline-proxy")!==null||H.getAttribute("data-vf-full-canvas")==="true"||H.style.width==="100%"&&H.style.height==="100%":!1;if(a===void 0&&(a=ee.start),s===void 0&&(s=ee.duration>0?ee.duration:void 0),l===void 0&&(l=ee.track),se)c=0,d=0,u=100,m=100;else if(H){let te=ve=>{let pe=Number.parseFloat(ve);return Number.isFinite(pe)?pe:void 0};c===void 0&&(c=te(H.style.left)),d===void 0&&(d=te(H.style.top)),u===void 0&&(u=te(H.style.width)),m===void 0&&(m=te(H.style.height))}}let g=p?p.hfId||p.id:null,_=e.layer_key?.trim(),y=_&&_!==g&&/^[A-Za-z][\w-]{0,63}$/.test(_)?_:`vf-gen-${Date.now().toString(36)}${Math.floor(Math.random()*1e3).toString(36)}`,h=y.startsWith("element_")?y:`element_${y}`,v=A4(n,t.activeCompositionDuration),T=a??0,x=Math.max(0,v>0?Math.min(v-.1,T):T),N=v>0?Math.max(.1,v-x):4,M=s??Math.min(r==="video"?e.gen_duration??4:4,N),k=Math.max(.1,v>0?Math.min(M,N):M),P=Re(c??0,0,100),F=Re(d??0,0,100),U=Re(u??100,0,100),X=Re(m??100,0,100),G=1,R=U>=99.5&&X>=99.5&&P<=.5&&F<=.5;if(e.duration===void 0&&R&&k<G){let $=new Set([h]);p?.hfId&&$.add(p.hfId),p?.id&&$.add(p.id);let ee=I4(n,x,$),H=(Number.isFinite(ee)?ee:v>0?v:x+4)-x;k=Math.max(G,Number.isFinite(H)&&H>0?H:Math.min(4,N))}let C=o.length>140?`${o.slice(0,137)}\u2026`:o;try{let{html:$,resolvedCollisions:ee}=fr(n,H=>{let se=H.querySelector("[data-composition-id]");if(!rt(se))throw new Error("Composition root not found.");if(p){let Je=cn(H,p);Je?.parentNode&&Je.parentNode.removeChild(Je)}let te=l,ve=Array.from(H.querySelectorAll("[data-start]")).reduce((Je,Kt)=>{let it=Number(Kt.getAttribute("data-track-index")??0);return Number.isFinite(it)?Math.max(Je,it+1):Je},0),pe=Number.isFinite(te)&&te!==void 0?Math.max(0,Math.floor(te)):ve,Ge=Tc(H,{start:x,duration:k,track:pe},new Set([h])),re=r==="video"?H.createElement("video"):H.createElement("img");if(re.id=h,re.setAttribute("data-hf-id",h),re.setAttribute("data-layer-mode","publish"),re.setAttribute("data-layer-kind",r),re.setAttribute("data-viral-note",`AI generating ${r}: ${C}`),re.setAttribute("data-start",He(x)),re.setAttribute("data-duration",He(k)),re.setAttribute("data-end",He(x+k)),re.setAttribute("data-track-index",String(Ge)),re.setAttribute("data-label",`Generating ${r}\u2026`),re.classList.add("clip"),e.slug){let Je=B_(e.slug);Je&&re.setAttribute("data-hf-slug",Je)}re.setAttribute("data-vf-gen","1"),re.setAttribute("data-vf-gen-media",r),re.setAttribute("data-vf-gen-status","submitting"),re.setAttribute("data-vf-gen-prompt",C),re.style.position="absolute",re.style.left=`${P}%`,re.style.top=`${F}%`,re.style.width=`${U}%`,re.style.height=`${X}%`,re.style.zIndex=String(Ge),re.style.overflow="hidden",re.style.objectFit=e.object_fit??"cover",re.style.background="#0c0f0a",r==="video"?(re.setAttribute("poster",q6),re.setAttribute("playsinline",""),re.setAttribute("preload","auto"),re.setAttribute("muted",""),re.setAttribute("data-volume","1"),re.setAttribute("data-media-start","0"),re.setAttribute("data-playback-start","0")):(re.setAttribute("src",q6),e.ken_burns&&e.ken_burns!=="none"&&pg(re,e.ken_burns,e.ken_burns_intensity)),e.transition&&e.transition!=="none"&&Qs(re,e.transition,e.transition_duration),e.transition_out&&e.transition_out!=="none"&&Ec(re,e.transition_out,e.transition_out_duration),se.append(re)});t.patchCompositionHtml($),XQ({deps:t,genId:h,mediaType:r,prompt:o,action:e});let B=i==="replace_layer"?`replacing ${g}`:`at ${x.toFixed(2)}s`;return{ok:!0,summary:ro(`Started ${r} generation (${B}). A placeholder is on the timeline as ${y}; it will swap to the finished media automatically. Watch editor_context.pending_generations.`,ee)}}catch($){return{ok:!1,error:$ instanceof Error?$.message:String($)}}}function sg(e,t,n){let r=e.compositionHtmlRef.current;if(!r)return!1;let o=t.replace(/["\\]/g,"\\$&"),i=new DOMParser().parseFromString(r,"text/html"),a=i.querySelector(`[data-hf-id="${o}"]`);return rt(a)?(n(a),e.patchCompositionHtml(gg(i)),!0):!1}async function XQ(e){let{deps:t,genId:n,mediaType:r,prompt:o,action:i}=e,a=r==="video"?"/api/v1/primitives/videos/generate":"/api/v1/primitives/images/generate",s=i.aspect_ratio?.trim(),l=i.provider?.trim(),c=i.model?.trim(),d=(i.input_references??[]).filter(g=>typeof g=="string"&&/^https?:\/\//i.test(g)),u=(i.prompt_attachments??[]).filter(g=>typeof g=="string"&&/^https?:\/\//i.test(g)),m={prompt:o};s&&(m.aspect_ratio=s),l&&(m.provider=l),c&&(m.model=c),r==="video"?(i.gen_duration&&Number.isFinite(i.gen_duration)&&(m.duration=Math.round(i.gen_duration)),i.resolution&&(m.resolution=i.resolution),i.generate_audio!==void 0&&(m.generate_audio=i.generate_audio),d.length&&(m.input_references=d.slice(0,8))):u.length&&(m.prompt_attachments=u.slice(0,16));let p=`editor-gen-${Date.now().toString(36)}`;try{let g=await fetch(a,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({tracer:p,payload:m})}),_=await g.json().catch(()=>({}));if(!g.ok||!_.job_id){let y=_.error||`generation request failed (${g.status})`;sg(t,n,h=>{h.setAttribute("data-vf-gen-status","error"),h.setAttribute("data-vf-gen-error",y.slice(0,200))});return}sg(t,n,y=>{y.setAttribute("data-vf-gen-job",_.job_id),y.setAttribute("data-vf-gen-tracer",p),y.setAttribute("data-vf-gen-status","generating")})}catch(g){sg(t,n,_=>{_.setAttribute("data-vf-gen-status","error"),_.setAttribute("data-vf-gen-error",(g instanceof Error?g.message:String(g)).slice(0,200))})}}function JQ(e){if(!e)return null;let t=l=>typeof l=="string"&&l.trim()?l.trim():null,n=l=>l&&typeof l=="object"?l:null,r=n(e.result)??{},o=n(r.output)??r,i=t(o.primary_file_url)??t(n(o.video)?.file_url)??t(n(o.image)?.file_url)??t(n(o.render)?.output_url);if(i)return i;let a=o.files;if(Array.isArray(a))for(let l of a){let c=t(typeof l=="string"?l:n(l)?.file_url??n(l)?.url);if(c)return c}let s=Array.isArray(e.artifacts)?e.artifacts:[];for(let l of s){let c=t(n(l)?.public_url);if(c)return c}return null}function QQ(e,t,n){return sg(e,t,r=>{let o=r.getAttribute("data-vf-gen-media");r.setAttribute("src",n),r.removeAttribute("poster"),r.removeAttribute("data-vf-gen"),r.removeAttribute("data-vf-gen-media"),r.removeAttribute("data-vf-gen-prompt"),r.removeAttribute("data-vf-gen-job"),r.removeAttribute("data-vf-gen-tracer"),r.removeAttribute("data-vf-gen-error"),r.removeAttribute("data-vf-gen-status");let i=r.getAttribute("data-label");i&&/generating/i.test(i)&&r.setAttribute("data-label",o==="image"?"AI image":"AI video"),r.setAttribute("data-viral-note",`AI generated ${o==="image"?"image":"video"}.`)})}function ZQ(e,t,n,r){if(e.src!==void 0&&e.src.trim()&&!k4(e.src))return{ok:!1,error:`set_layer_media src "${e.src.trim().slice(0,80)}" is not a media-file URL. Point it at a real video/image/audio file (a browse_files result, a /raws clip's view URL, a My Files asset, or a generated media URL) \u2014 not a folder, page, or bare path.`};let o=[],i=ci(n,r,a=>{if(e.src!==void 0&&(a.setAttribute("src",e.src),o.push(`src=${e.src.slice(0,60)}`)),e.volume!==void 0&&(a.setAttribute("data-volume",String(e.volume)),o.push(`volume=${e.volume}`)),e.muted!==void 0&&(e.muted?a.setAttribute("muted",""):a.removeAttribute("muted"),o.push(`muted=${e.muted}`)),e.playback_start!==void 0){let s=He(e.playback_start);a.setAttribute("data-media-start",s),a.setAttribute("data-playback-start",s),o.push(`playback_start=${s}`)}e.object_fit&&(a.style.objectFit=e.object_fit,o.push(`object_fit=${e.object_fit}`)),e.object_position&&(a.style.objectPosition=e.object_position,o.push(`object_position=${e.object_position}`)),e.ken_burns!==void 0&&(pg(a,e.ken_burns==="none"?null:e.ken_burns,e.ken_burns_intensity),o.push(`ken_burns=${e.ken_burns}`)),e.transition!==void 0&&(Qs(a,e.transition==="none"?null:e.transition,e.transition_duration),o.push(`transition=${e.transition}`)),e.transition_out!==void 0&&(Ec(a,e.transition_out==="none"?null:e.transition_out,e.transition_out_duration),o.push(`transition_out=${e.transition_out}`))});return o.length===0?{ok:!1,error:"set_layer_media needs at least one of src, volume, muted, playback_start, object_fit, object_position, ken_burns, transition, or transition_out."}:i===n?{ok:!1,error:`No change applied \u2014 the layer "${e.layer_key??r.id}" did not resolve to a live media element in the composition (it may be a scene label/group, not the video/image itself).${x4(n,{mediaOnly:!0})}`}:(t.patchCompositionHtml(i),{ok:!0,summary:`Updated ${r.id} media (${o.join(" ")}).`})}function eZ(e,t,n,r){let o=[],i=ci(n,r,a=>{if(e.color){a.style.color=e.color;let c=a.querySelector("[data-vf-text-inline]");c&&(c.style.color=e.color),o.push(`color=${e.color}`)}if(e.background_style||e.background!==void 0){let c=e.background_style??a.getAttribute("data-text-background-style")??"plain",d=e.background??a.getAttribute("data-text-background-color")??"#000000";a.setAttribute("data-text-background-style",c),a.setAttribute("data-text-background-color",d),o.push(`background=${d}(${c})`)}e.font_family&&(a.setAttribute("data-font-family",e.font_family),a.style.fontFamily=`${e.font_family}, 'TikTok Sans', sans-serif`,o.push(`font_family=${e.font_family}`)),e.font_weight!==void 0&&(a.style.fontWeight=String(e.font_weight),o.push(`font_weight=${e.font_weight}`)),e.italic!==void 0&&(a.style.fontStyle=e.italic?"italic":"normal",o.push(`italic=${e.italic}`)),e.underline!==void 0&&(a.style.textDecorationLine=e.underline?"underline":"none",o.push(`underline=${e.underline}`)),e.text_align&&(a.style.textAlign=e.text_align,o.push(`text_align=${e.text_align}`)),e.border_radius!==void 0&&(a.style.borderRadius=`${e.border_radius}px`,o.push(`border_radius=${e.border_radius}`)),e.font_size!==void 0&&(a.style.fontSize=`${e.font_size}px`,o.push(`font_size=${e.font_size}`)),e.line_height!==void 0&&(a.style.lineHeight=String(e.line_height),o.push(`line_height=${e.line_height}`)),e.letter_spacing!==void 0&&(a.style.letterSpacing=`${e.letter_spacing}px`,o.push(`letter_spacing=${e.letter_spacing}`));let s=uk(e.caption_style),l=e.caption_animation??s?.animation;if(s&&(r4(a,s,e),o.push(`caption_style=${s.id}`)),l!==void 0||e.caption_active_color!==void 0||e.caption_highlight_color!==void 0||e.caption_uppercase!==void 0){let c=l==="none"?null:l??a.getAttribute("data-caption-animation");mg(a,c,{activeColor:e.caption_active_color??s?.activeColor,highlightColor:e.caption_highlight_color??s?.highlightColor,uppercase:e.caption_uppercase??s?.uppercase}),o.push(`caption_animation=${c??"none"}`)}});return o.length===0?{ok:!1,error:"set_layer_style needs at least one style field."}:i===n?{ok:!1,error:"No change applied \u2014 element selector did not match the composition HTML."}:(t.patchCompositionHtml(i),{ok:!0,summary:`Updated ${r.id} style (${o.join(" ")}).`})}function tZ(e,t,n,r){let o=e.layer_keys?.[1]?.trim(),a=(o&&/^[A-Za-z][\w-]{0,63}$/.test(o)?o.startsWith("element_")?o:`element_${o}`:null)??`element_dup_${Date.now().toString(36)}${Math.floor(Math.random()*1e3).toString(36)}`;try{let{html:s,resolvedCollisions:l}=fr(n,c=>{let d=cn(c,r);if(!d)throw new Error(`Layer node not found: ${r.id}`);let u=d.cloneNode(!0);u.id=a,u.setAttribute("data-hf-id",a),e.start!==void 0&&u.setAttribute("data-start",He(e.start)),e.duration!==void 0&&u.setAttribute("data-duration",He(e.duration)),e.label&&u.setAttribute("data-label",e.label);let m=Number(u.getAttribute("data-start")??r.start),p=Number(u.getAttribute("data-duration")??r.duration),g=e.track!==void 0?Math.max(0,Math.floor(e.track)):r.track,_=Tc(c,{start:m,duration:p,track:g},new Set([r.hfId,r.domId,r.id,a].filter(y=>!!y)));u.setAttribute("data-track-index",String(_)),d.after(u)});return s===n?{ok:!1,error:"No change applied \u2014 element selector did not match the composition HTML."}:(t.patchCompositionHtml(s),{ok:!0,summary:ro(`Duplicated ${r.id} as ${a}.`,l)})}catch(s){return{ok:!1,error:s instanceof Error?s.message:String(s)}}}function nZ(e,t,n,r){let o=e.split_time;if(o===void 0)return{ok:!1,error:"split_layer requires split_time."};if(o<=r.start||o>=r.start+r.duration)return{ok:!1,error:"split_time must fall inside the layer's [start, start+duration] range."};let i=`element_split_${Date.now().toString(36)}${Math.floor(Math.random()*1e3).toString(36)}`;try{let a=ci(n,r,s=>{let l=Number(s.getAttribute("data-start")??r.start),c=Number(s.getAttribute("data-duration")??r.duration),d=o-l,u=l+c-o,m=Number(s.getAttribute("data-playback-start")??s.getAttribute("data-media-start")??r.playbackStart??0),p=He(m+d),g=s.getAttribute("data-layer-kind")??"layer";s.setAttribute("data-duration",He(d));let _=s.cloneNode(!0);_.id=i,_.setAttribute("data-hf-id",i),_.setAttribute("data-start",He(o)),_.setAttribute("data-duration",He(u)),_.setAttribute("data-media-start",p),_.setAttribute("data-playback-start",p),_.setAttribute("data-layer-kind",g),_.setAttribute("data-label",`${r.label??r.id} split`),s.after(_)});return a===n?{ok:!1,error:"No change applied \u2014 element selector did not match the composition HTML."}:(t.patchCompositionHtml(a),{ok:!0,summary:`Split ${r.id} at ${o}; new layer ${i}.`})}catch(a){return{ok:!1,error:a instanceof Error?a.message:String(a)}}}function rZ(e,t,n){let r=(e.layer_keys??[]).filter(c=>typeof c=="string"&&c.trim().length>0);if(r.length<2)return{ok:!1,error:"group_layers requires layer_keys with at least two entries."};let o=r.map(c=>t.draftedElements.find(d=>Se(d)===c)).filter(c=>!!c);if(o.length!==r.length)return{ok:!1,error:"One or more layer_keys not found in the composition."};let i=`vf-group-${Date.now().toString(36)}`,a=e.group_label?.trim()||"Vidfarm group",{html:s,resolvedCollisions:l}=fr(n,c=>{for(let d of o){let u=cn(c,d);u&&(u.setAttribute("data-vf-group",i),u.setAttribute("data-vf-group-label",a))}});return s===n?{ok:!1,error:"No change applied \u2014 layers not found."}:(t.patchCompositionHtml(s),{ok:!0,summary:ro(`Grouped ${o.length} layers as ${i}.`,l)})}function oZ(e,t,n){let r=(e.layer_keys??[]).filter(s=>typeof s=="string"&&s.trim().length>0);if(r.length===0)return{ok:!1,error:"ungroup_layers requires layer_keys."};let o=r.map(s=>t.draftedElements.find(l=>Se(l)===s)).filter(s=>!!s);if(o.length===0)return{ok:!1,error:"No matching layers found for ungroup_layers."};let{html:i,resolvedCollisions:a}=fr(n,s=>{let l=new Set;for(let c of o){let u=cn(s,c)?.getAttribute("data-vf-group");u&&l.add(u)}for(let c of l)for(let d of Array.from(s.querySelectorAll(`[data-vf-group="${CSS.escape(c)}"]`)))rt(d)&&(d.removeAttribute("data-vf-group"),d.removeAttribute("data-vf-group-label"))});return i===n?{ok:!1,error:"No change applied \u2014 layers were not grouped."}:(t.patchCompositionHtml(i),{ok:!0,summary:ro(`Ungrouped ${o.length} layers.`,a)})}function iZ(e){let t=(e??"").trim().toLowerCase();return["linear","ease","ease-in","ease-out","ease-in-out","step-start","step-end"].includes(t)||/^cubic-bezier\(\s*(-?\d*\.?\d+\s*,\s*){3}-?\d*\.?\d+\s*\)$/.test(t)||/^steps\(\s*\d+\s*(,\s*(start|end|jump-(start|end|none|both))\s*)?\)$/.test(t)?t:"linear"}function aZ(e,t,n,r){let o=e.keyframes;if(!o||o.length<2)return{ok:!1,error:"set_layer_keyframes requires a keyframes array with at least 2 stops, each with an offset (0..1)."};let i=o.filter(m=>Number.isFinite(m.offset)).sort((m,p)=>m.offset-p.offset);if(i.length<2)return{ok:!1,error:"keyframes need numeric offset values in 0..1 (e.g. 0, 0.5, 1)."};if(i.every(m=>m.opacity===void 0&&m.translate_x===void 0&&m.translate_y===void 0&&m.scale===void 0&&m.rotate===void 0))return{ok:!1,error:"each keyframe needs at least one animated property (opacity, translate_x, translate_y, scale, rotate)."};let s=`hfk-${(r.hfId||r.domId||r.id||"layer").replace(/[^A-Za-z0-9_-]/g,"-")}`,l=e.keyframe_duration!==void 0&&e.keyframe_duration>0?e.keyframe_duration:Number.isFinite(r.duration)&&r.duration>0?r.duration:1,c=iZ(e.keyframe_easing),d=i.map(m=>{let p=Math.max(0,Math.min(100,m.offset*100)),g=Number(p.toFixed(3)).toString(),_=[];(m.translate_x!==void 0||m.translate_y!==void 0)&&_.push(`translate(${m.translate_x??0}%, ${m.translate_y??0}%)`),m.scale!==void 0&&_.push(`scale(${m.scale})`),m.rotate!==void 0&&_.push(`rotate(${m.rotate}deg)`);let y=[];return _.length&&y.push(`transform:${_.join(" ")}`),m.opacity!==void 0&&y.push(`opacity:${Math.max(0,Math.min(1,m.opacity))}`),`${g}%{${y.join(";")}}`}).join(""),u=`@keyframes ${s}{${d}}`;try{let{html:m}=fr(n,p=>{let g=cn(p,r);if(!g)throw new Error(`Layer node not found: ${r.id}`);for(let y of Array.from(p.querySelectorAll(`style[data-vf-kf="${CSS.escape(s)}"]`)))y.parentNode?.removeChild(y);let _=p.createElement("style");_.setAttribute("data-vf-kf",s),_.textContent=u,(p.head||p.body||p.documentElement).appendChild(_),g.style.setProperty("animation",`${s} ${He(l)}s ${c} both paused`)});return m===n?{ok:!1,error:"No change applied \u2014 element selector did not match the composition HTML."}:(t.patchCompositionHtml(m),{ok:!0,summary:`Set a ${i.length}-stop CSS keyframe animation on ${Se(r)} (${He(l)}s ${c}).`})}catch(m){return{ok:!1,error:m instanceof Error?m.message:String(m)}}}function sZ(e,t,n){let r=(e.layer_keys&&e.layer_keys.length?e.layer_keys:e.layer_key?[e.layer_key]:[]).filter(s=>typeof s=="string"&&s.trim().length>0);if(!r.length)return{ok:!1,error:"nudge_layers requires layer_key or layer_keys."};let o=e.delta_start??0,i=e.delta_track??0;if(!o&&!i)return{ok:!1,error:"nudge_layers needs a non-zero delta_start (seconds) and/or delta_track (lanes)."};let a=r.map(s=>vk(t,n,s)).filter(s=>!!s);if(!a.length)return{ok:!1,error:"No matching layers found for nudge_layers."};try{let s=new DOMParser().parseFromString(n,"text/html"),l=new Map;for(let m of a){let p=cn(s,m),g=p?p.getAttribute("data-vf-group"):null;if(g&&p)for(let _ of ek(s,g,p)){let y=ui(_),h=t.draftedElements.find(v=>(v.hfId||v.domId||v.id)===y);h&&l.set(Se(h),h)}else l.set(Se(m),m)}let c=Array.from(l.values()).map(m=>({element:m,updates:{start:Math.max(0,m.start+o),track:Math.max(0,m.track+Math.trunc(i))}})),{html:d,resolvedCollisions:u}=og(n,c);return d===n?{ok:!1,error:"No change applied \u2014 layers not found in the composition HTML."}:(t.patchCompositionHtml(d),{ok:!0,summary:ro(`Nudged ${c.length} layer(s) by \u0394start=${o}s \u0394track=${Math.trunc(i)}.`,u)})}catch(s){return{ok:!1,error:s instanceof Error?s.message:String(s)}}}function lZ(e,t,n){let r=e.at_time,o=e.delta_start;if(r===void 0||!Number.isFinite(r))return{ok:!1,error:"ripple_edit requires at_time (seconds on the composition timeline)."};if(o===void 0||!o)return{ok:!1,error:"ripple_edit requires a non-zero delta_start (seconds; positive inserts a gap, negative closes one)."};let i=t.draftedElements.filter(s=>s.start>=r-1e-4);if(!i.length)return{ok:!1,error:`No clips start at or after ${r}s to ripple.`};let a=i.map(s=>({element:s,updates:{start:Math.max(0,s.start+o)}}));try{let{html:s,resolvedCollisions:l}=og(n,a);return s===n?{ok:!1,error:"No change applied \u2014 clips not found in the composition HTML."}:(t.patchCompositionHtml(s),{ok:!0,summary:ro(`Rippled ${a.length} clip(s) at ${r}s by ${o>0?"+":""}${o}s.`,l)})}catch(s){return{ok:!1,error:s instanceof Error?s.message:String(s)}}}function cZ(e,t,n,r){let o=e.z_order,i=e.track;if(!o&&i===void 0)return{ok:!1,error:"set_layer_zindex needs z_order ('front'|'back'|'forward'|'backward') or an explicit track."};let a=t.draftedElements.map(p=>p.track).filter(p=>Number.isFinite(p)),s=a.length?Math.max(...a):r.track,l=a.length?Math.min(...a):r.track,c;i!==void 0?c=Math.max(0,Math.trunc(i)):o==="front"?c=s+1:o==="back"?c=Math.max(0,l-1):o==="forward"?c=r.track+1:c=Math.max(0,r.track-1);let d=r.hfId||r.domId||r.id,u=new DOMParser().parseFromString(n,"text/html"),m=Tc(u,{start:r.start,duration:r.duration,track:c},new Set(d?[d]:[]));if(m===r.track)return{ok:!1,error:`${Se(r)} is already at track ${r.track} \u2014 no stacking change.`};try{let{html:p,resolvedCollisions:g}=z_(n,r,{track:m});return p===n?{ok:!1,error:"No change applied \u2014 element selector did not match the composition HTML."}:(t.patchCompositionHtml(p),{ok:!0,summary:ro(`Set ${Se(r)} stacking to track ${m} (${o??"explicit"}; higher = on top).`,g)})}catch(p){return{ok:!1,error:p instanceof Error?p.message:String(p)}}}function uZ(e,t,n,r){let o=e.edge,i=e.to_time;if(o!=="start"&&o!=="end")return{ok:!1,error:"trim_layer requires edge ('start' or 'end')."};if(i===void 0||!Number.isFinite(i))return{ok:!1,error:"trim_layer requires to_time (seconds on the composition timeline)."};let a=r.start,s=r.start+r.duration,l=r.tag==="video"||r.tag==="audio",c=r.playbackStart??0,d;if(o==="start"){if(i<=a+1e-4)return{ok:!1,error:`Left trim to_time (${i}s) must be after the clip start (${a}s). Use nudge_layers to move the clip earlier.`};if(i>=s-.05)return{ok:!1,error:"Left trim would leave no duration \u2014 pick a to_time before the clip's end."};let u=i-a;d={start:i,duration:r.duration-u},l&&(d.playbackStart=c+u)}else{if(i<=a+.05)return{ok:!1,error:`Right trim to_time (${i}s) must be after the clip start (${a}s).`};d={duration:i-a}}try{let{html:u,resolvedCollisions:m}=z_(n,r,d);if(u===n)return{ok:!1,error:"No change applied \u2014 element selector did not match the composition HTML."};t.patchCompositionHtml(u);let p=Object.entries(d).map(([g,_])=>`${g}=${He(_)}`).join(" ");return{ok:!0,summary:ro(`Trimmed ${Se(r)} ${o} to ${i}s (${p}).`,m)}}catch(u){return{ok:!1,error:u instanceof Error?u.message:String(u)}}}function N4(e){if(!e||typeof e!="object")return null;let t=e,n=t.action_type;if(typeof n!="string"||!["add_layer","remove_layer","set_layer_timing","set_layer_visual","set_layer_text","set_layer_media","set_layer_style","set_layer_identity","duplicate_layer","split_layer","group_layers","ungroup_layers","replace_composition_html","export_composition","generate_layer","set_captions","set_transitions","set_layer_keyframes","nudge_layers","ripple_edit","set_layer_zindex","trim_layer","set_composition","fork_composition"].includes(n))return null;let o=y=>typeof t[y]=="string"?t[y]:void 0,i=y=>typeof t[y]=="number"&&Number.isFinite(t[y])?t[y]:void 0,a=y=>typeof t[y]=="boolean"?t[y]:void 0,s=y=>Array.isArray(t[y])?t[y].filter(h=>typeof h=="string"):void 0,l=t.kind,c=l==="video"||l==="image"||l==="audio"||l==="text"||l==="html"?l:void 0,d=t.background_style,u=d==="plain"||d==="outline"||d==="highlight-solid"||d==="highlight-translucent"||d==="fullwidth"?d:void 0,m=t.media_type,p=m==="video"||m==="image"?m:void 0,g=t.intent,_=g==="fill_gap"||g==="replace_layer"||g==="add"?g:void 0;return{action_type:n,layer_key:o("layer_key"),layer_keys:s("layer_keys"),kind:c,src:o("src"),html:o("html"),label:o("label"),start:i("start"),duration:i("duration"),track:i("track"),playback_start:i("playback_start"),split_time:i("split_time"),x:i("x"),y:i("y"),width:i("width"),height:i("height"),font_size:i("font_size"),font_family:o("font_family"),font_weight:i("font_weight"),italic:a("italic"),underline:a("underline"),text_align:o("text_align"),border_radius:i("border_radius"),opacity:i("opacity"),line_height:i("line_height"),letter_spacing:i("letter_spacing"),canvas_width:i("canvas_width"),canvas_height:i("canvas_height"),canvas_duration:i("canvas_duration"),background_color:o("background_color"),color:o("color"),background:o("background"),background_style:u,object_fit:o("object_fit"),object_position:o("object_position"),ken_burns:o("ken_burns"),ken_burns_intensity:i("ken_burns_intensity"),transition:o("transition"),transition_duration:i("transition_duration"),transition_out:o("transition_out"),transition_out_duration:i("transition_out_duration"),transition_intro:o("transition_intro"),transition_outro:o("transition_outro"),caption_style:o("caption_style"),caption_animation:o("caption_animation"),caption_active_color:o("caption_active_color"),caption_highlight_color:o("caption_highlight_color"),caption_uppercase:a("caption_uppercase"),captions:Array.isArray(t.captions)?t.captions.filter(y=>!!y&&typeof y=="object").map(y=>({text:typeof y.text=="string"?y.text:"",start:typeof y.start=="number"&&Number.isFinite(y.start)?y.start:NaN,duration:typeof y.duration=="number"&&Number.isFinite(y.duration)?y.duration:NaN,words:Array.isArray(y.words)?y.words.filter(h=>!!h&&typeof h=="object").map(h=>({text:typeof h.text=="string"?h.text:"",start:typeof h.start=="number"?h.start:0,end:typeof h.end=="number"?h.end:0})):void 0})):void 0,slug:o("slug"),note:o("note"),volume:i("volume"),muted:a("muted"),group_label:o("group_label"),text:o("text"),composition_html:o("composition_html"),explanation:o("explanation"),media_type:p,intent:_,prompt:o("prompt"),input_references:s("input_references"),prompt_attachments:s("prompt_attachments"),aspect_ratio:o("aspect_ratio"),gen_duration:i("gen_duration"),provider:o("provider"),model:o("model"),resolution:o("resolution"),generate_audio:a("generate_audio"),replace_layer_key:o("replace_layer_key"),keyframes:Array.isArray(t.keyframes)?t.keyframes.filter(y=>!!y&&typeof y=="object").map(y=>({offset:typeof y.offset=="number"&&Number.isFinite(y.offset)?y.offset:NaN,opacity:typeof y.opacity=="number"&&Number.isFinite(y.opacity)?y.opacity:void 0,translate_x:typeof y.translate_x=="number"&&Number.isFinite(y.translate_x)?y.translate_x:void 0,translate_y:typeof y.translate_y=="number"&&Number.isFinite(y.translate_y)?y.translate_y:void 0,scale:typeof y.scale=="number"&&Number.isFinite(y.scale)?y.scale:void 0,rotate:typeof y.rotate=="number"&&Number.isFinite(y.rotate)?y.rotate:void 0})):void 0,keyframe_easing:o("keyframe_easing"),keyframe_duration:i("keyframe_duration"),delta_start:i("delta_start"),delta_track:i("delta_track"),at_time:i("at_time"),edge:t.edge==="start"||t.edge==="end"?t.edge:void 0,to_time:i("to_time"),z_order:t.z_order==="front"||t.z_order==="back"||t.z_order==="forward"||t.z_order==="backward"?t.z_order:void 0,fork_from:t.fork_from==="current"||t.fork_from==="default"?t.fork_from:void 0}}function dZ(e){try{return JSON.stringify(e,null,2)}catch{return String(e)}}function fZ({item:e}){let[t,n]=(0,S.useState)(0);if(e.media.type==="slideshow"){let r=e.media.slides.length,o=i=>{n((i+r)%r)};return(0,f.jsx)("div",{className:"document-video-block slideshow-preview-block",children:(0,f.jsxs)("div",{className:"document-video-stage slideshow-preview-stage",children:[(0,f.jsxs)("div",{className:"slideshow-preview-stack",children:[(0,f.jsx)("button",{type:"button",className:"carousel-nav previous","aria-label":"Previous slide",onClick:()=>o(t-1),children:"\u2039"}),(0,f.jsx)("img",{src:e.media.slides[t],alt:`Slide ${t+1}`}),(0,f.jsx)("button",{type:"button",className:"carousel-nav next","aria-label":"Next slide",onClick:()=>o(t+1),children:"\u203A"}),(0,f.jsxs)("span",{className:"carousel-count",children:[t+1," / ",r]})]}),(0,f.jsx)("div",{className:"slideshow-thumb-strip","aria-label":"Slides",children:e.media.slides.map((i,a)=>(0,f.jsx)("button",{type:"button",className:t===a?"active":"","aria-label":`Show slide ${a+1}`,onClick:()=>n(a),children:(0,f.jsx)("img",{src:i,alt:""})},i))})]})})}return(0,f.jsx)("div",{className:"document-video-block repeated-video-block",children:(0,f.jsx)("div",{className:"document-video-stage",children:(0,f.jsx)("video",{src:e.media.src,controls:!0,playsInline:!0,preload:"metadata",onLoadedMetadata:r=>{let o=r.currentTarget;Ie("preview.video.loaded-metadata",{id:e.id,currentSrc:o.currentSrc,duration:o.duration,videoWidth:o.videoWidth,videoHeight:o.videoHeight})},onError:r=>{let o=r.currentTarget;Po("preview.video.error",{id:e.id,currentSrc:o.currentSrc,errorCode:o.error?.code,errorMessage:o.error?.message})}})})})}function pZ({onEdit:e}){return(0,f.jsx)("div",{className:"preview-feed","aria-label":"Preview output",children:ug.map(t=>{let n=[["Hook",t.viralDna.hook],["Retention",t.viralDna.retention],["Payoff",t.viralDna.payoff]];return(0,f.jsxs)("article",{className:"preview-feed-card",children:[(0,f.jsxs)("header",{className:"markdown-preview-header",children:[(0,f.jsxs)("div",{children:[(0,f.jsx)("p",{children:t.eyebrow}),(0,f.jsx)("h1",{children:t.title})]}),(0,f.jsx)("div",{className:"markdown-preview-actions",children:(0,f.jsx)("button",{type:"button",className:"main-action-button",title:"Edit composition",onClick:()=>{Ie("preview.edit-click",{id:t.id}),e(t)},children:"Edit"})})]}),(0,f.jsxs)("div",{className:"preview-feed-body",children:[(0,f.jsx)("div",{className:"preview-feed-spacer","aria-hidden":"true"}),(0,f.jsx)("section",{className:"preview-video-column","aria-label":"Reference render",children:(0,f.jsx)(fZ,{item:t})}),(0,f.jsxs)("aside",{className:"preview-detail-scroll","aria-label":"Preview details",children:[(0,f.jsxs)("section",{className:"markdown-section hero-section",children:[(0,f.jsx)("h2",{children:"Reference Render"}),(0,f.jsx)("p",{children:t.summary})]}),(0,f.jsxs)("section",{className:"markdown-section",children:[(0,f.jsx)("h2",{children:"Viral DNA"}),n.map(([r,o])=>(0,f.jsxs)("section",{className:"markdown-subsection",children:[(0,f.jsx)("h3",{children:r}),(0,f.jsx)("p",{children:o})]},r))]}),(0,f.jsxs)("section",{className:"markdown-section",children:[(0,f.jsx)("h2",{children:"Preserve"}),(0,f.jsx)("ul",{children:t.viralDna.preserve.map(r=>(0,f.jsx)("li",{children:r},r))})]}),(0,f.jsxs)("section",{className:"markdown-section",children:[(0,f.jsx)("h2",{children:"Avoid"}),(0,f.jsx)("ul",{children:t.viralDna.avoid.map(r=>(0,f.jsx)("li",{children:r},r))})]}),(0,f.jsxs)("section",{className:"markdown-section",children:[(0,f.jsx)("h2",{children:"Semantic Layers"}),(0,f.jsx)("div",{className:"markdown-layer-list",children:mk(t).map(r=>(0,f.jsxs)("article",{className:"markdown-layer-row",children:[(0,f.jsx)("span",{children:qJ(r.kind,r.customHtml)}),(0,f.jsxs)("div",{children:[(0,f.jsx)("h3",{children:r.label}),(0,f.jsx)("p",{children:r.viralNote})]}),(0,f.jsxs)("time",{children:[M_(r.start)," - ",M_(r.start+r.duration)]})]},r.id))})]})]})]})]},t.id)})})}function mZ({onPreview:e,composition:t}){let[n,r]=(0,S.useState)(null),[o,i]=(0,S.useState)(null),[a,s]=(0,S.useState)(()=>Y6()),[l,c]=(0,S.useState)(null),d=(0,S.useMemo)(()=>g4(t),[t]),u=(0,S.useRef)(null);(0,S.useEffect)(()=>{let p=!0;return Ie("editor.studio-import-start"),N_().then(g=>{Ie("editor.studio-import-success",{exports:Object.keys(g).sort()}),p&&r(g)}).catch(g=>{Po("editor.studio-import-error",g instanceof Error?g.stack:g),p&&i(g instanceof Error?g.message:String(g))}),()=>{p=!1,Ie("editor.studio-import-cleanup")}},[]),(0,S.useEffect)(()=>{let p=!0,g=a?`/api/v1/compositions/${encodeURIComponent(a)}/composition.html`:`/editor/${encodeURIComponent(t.id)}/composition`;return fetch(g,{cache:"default"}).then(_=>_.ok?_.text():null).then(_=>{p&&c(vc(_??d))}).catch(()=>{p&&c(vc(d))}),()=>{p=!1}},[t.id,d,a]),(0,S.useEffect)(()=>{!n||!l||n.usePlayerStore.getState().reset()},[l,n]);let m=(0,S.useCallback)(async()=>{if(a)return a;if(u.current)return u.current;let p=(async()=>{let g=await fetch("/api/v1/compositions",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({source:t.id,title:t.title})}),_=await g.json().catch(()=>({}));if(!g.ok||!_?.fork_id)throw new Error(_?.error||`Fork creation failed (${g.status})`);if(s(_.fork_id),typeof window<"u"){let y=t.templateId??t.id,h=new URL(window.location.href);h.pathname=`/editor/${encodeURIComponent(y)}/fork/${encodeURIComponent(_.fork_id)}`,h.searchParams.delete("fork"),window.history.replaceState(null,"",h)}return _.fork_id})();u.current=p;try{return await p}finally{u.current=null}},[t.id,t.title,a]);return o?(0,f.jsxs)("section",{className:"editor-loading-shell","aria-label":"Editor load failed",children:[(0,f.jsx)("span",{children:"Editor failed to load"}),(0,f.jsx)("small",{children:o})]}):!n||!l?(0,f.jsx)("section",{className:"editor-loading-shell","aria-label":"Loading video editor",children:(0,f.jsx)("span",{children:"Loading editor"})}):(0,f.jsx)(gZ,{studio:n,onPreview:e,composition:t,initialCompositionHtml:l,forkId:a,ensureFork:m,replaceForkId:s})}function gZ({studio:e,onPreview:t,composition:n,initialCompositionHtml:r,forkId:o,ensureFork:i,replaceForkId:a}){let{Player:s,Timeline:l,liveTime:c,resolveIframe:d,usePlayerStore:u,useTimelinePlayer:m}=e,p=f4(n),[g,_]=(0,S.useState)(()=>r),y=(0,S.useMemo)(()=>{let b=b4(g);return b?{...n,viralDna:b}:n},[n,g]),h=(0,S.useRef)(g),[v,T]=(0,S.useState)(0),[x,N]=(0,S.useState)(!0),[M,k]=(0,S.useState)("1"),[P,F]=(0,S.useState)(null),[U,X]=(0,S.useState)(null),G=(0,S.useRef)(null),R=(0,S.useRef)(null),[C,$]=(0,S.useState)(null),[ee,B]=(0,S.useState)(null),[H,se]=(0,S.useState)(()=>new Map),[te,ve]=(0,S.useState)(()=>new Map),[pe,Ge]=(0,S.useState)([]),[re,Je]=(0,S.useState)(null),[Kt,it]=(0,S.useState)(!1),Z=(0,S.useRef)(0),Le=(0,S.useRef)(new Set),De=pe.find(b=>b.localId===re)??null,et=De?.state??null,dt=pe.reduce((b,E)=>E.state.phase==="starting"||E.state.phase==="running"?b+1:b,0),me=(0,S.useCallback)((b,E)=>{Ge(w=>w.map(I=>I.localId===b?{...I,state:E}:I))},[]),lt=pe.reduce((b,E)=>typeof E.state.version=="number"?Math.max(b??0,E.state.version):b,null),[we,tt]=(0,S.useState)(null),[vn,An]=(0,S.useState)(!1),[an,ue]=(0,S.useState)({preview:!0,inspector:!1,timeline:!0}),Ve=b=>ue(E=>({...E,[b]:!E[b]})),[Te,We]=(0,S.useState)(!1),[oe,ge]=(0,S.useState)(!1),Ce=b=>{let E=df.current;if(!E)return{ok:!1,error:"The editor isn't ready yet \u2014 try again in a moment."};let w=(b.url||"").trim();if(!w)return{ok:!1,error:"No media URL to add."};let I=D_(w,b.contentType,b.name);if(!I)return{ok:!1,error:"That file isn't a video, image, or audio file."};let L=b.name?b.name.replace(/\.[a-z0-9]+$/i,"").slice(0,48):void 0,O=(I==="video"||I==="audio")&&b.playbackStart!==void 0?{playback_start:Math.max(0,b.playbackStart),...b.duration!==void 0&&b.duration>0?{duration:b.duration}:{}}:{},z=E.applyAction({action_type:"add_layer",kind:I,src:w,...L?{label:L}:{},...O});return z.ok?{ok:!0}:{ok:!1,error:z.error}},[$e,at]=(0,S.useState)(null);(0,S.useEffect)(()=>{if(!o){at(null);return}let b=!0;return fetch(`/api/v1/compositions/${encodeURIComponent(o)}`).then(E=>E.ok?E.json():null).then(E=>{if(!b||!E)return;let w=Number(E.latest_version);Number.isFinite(w)&&at(w)}).catch(()=>{}),()=>{b=!1}},[o,lt]);let[Xt,wc]=(0,S.useState)(0),[oo,Bo]=(0,S.useState)(!1),mf=(0,S.useRef)(null),gf=(0,S.useRef)(null),Hi=(0,S.useRef)(null),Lr=(0,S.useRef)(null),Gi=(0,S.useRef)(null),ce=(0,S.useRef)(null),rl=(0,S.useRef)(0),xc=(0,S.useRef)(0),hf=(0,S.useRef)(-1),ze=(0,S.useRef)(null),$i=(0,S.useRef)(!1),zo=(0,S.useRef)([]),La=(0,S.useRef)([]),Ua=(0,S.useRef)(null),Fo=(0,S.useRef)({timing:()=>{},visual:()=>{},flushAll:()=>{}}),io=(0,S.useRef)(null),hg=(0,S.useRef)(!1),bg=(0,S.useRef)(!1),D=(0,S.useRef)(null),he=(0,S.useRef)({active:!1,pendingBody:null,pendingRevBump:!1});(0,S.useEffect)(()=>{let b=`comp:${n.id}`;D.current!==b&&rQ(g)&&(D.current=b,tt({mode:"initial",dismissed:!1,busy:!1,finished:!1,error:null,scenesCreated:null,ghostcutStatus:null,ghostcutProgress:null,userPrompt:""}))},[n.id,g]);let Jt=(0,S.useRef)(null);(0,S.useEffect)(()=>{if(!o||Jt.current===o)return;Jt.current=o;let b=!1;return(async()=>{let E=Date.now(),w=900*1e3;for(await new Promise(I=>setTimeout(I,3e3));!b&&Date.now()-E<w;){try{let I=await fetch(`/api/v1/compositions/${encodeURIComponent(o)}/remove-video-captions-poll`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({})}),L=await I.json().catch(()=>({}));if(!I.ok||L?.ok===!1){await new Promise(z=>setTimeout(z,8e3));continue}let O=L.status??"none";if(O==="none"||O==="failed")return;if(O==="pending"&&tt(z=>z&&{...z,ghostcutStatus:"pending"}),O==="done"){L.swap_applied&&typeof window<"u"&&window.location.reload();return}}catch{}await new Promise(I=>setTimeout(I,2e4))}})(),()=>{b=!0,Jt.current=null}},[o]);let zt=(0,S.useRef)(null);(0,S.useEffect)(()=>{if(!o||zt.current===o)return;zt.current=o;let b=!1,E=async()=>{try{let w=await fetch(`/api/v1/compositions/${encodeURIComponent(o)}/cast.json`),I=await w.json().catch(()=>({}));return!w.ok||I?.ok===!1?null:(Array.isArray(I.cast)&&(ev.current=I.cast),I.status??"none")}catch{return null}};return(async()=>{let w=Date.now(),I=600*1e3;await new Promise(O=>setTimeout(O,3e3));let L=await E();if(!(L==="none"||L==="done"||L==="failed"))for(;!b&&Date.now()-w<I;){try{let O=await fetch(`/api/v1/compositions/${encodeURIComponent(o)}/cast-poll`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({})}),z=await O.json().catch(()=>({}));if(!O.ok||z?.ok===!1){await new Promise(K=>setTimeout(K,6e3));continue}await E();let V=z.status??"none";if(V==="none"||V==="done"||V==="failed")return}catch{}await new Promise(O=>setTimeout(O,4e3))}})(),()=>{b=!0,zt.current=null}},[o]);let Et=(0,S.useRef)(null);(0,S.useEffect)(()=>{if(!o||Et.current===o)return;Et.current=o;let b=!1;return(async()=>{let E=Date.now(),w=300*1e3;await new Promise(I=>setTimeout(I,3e3));try{let I=await fetch(`/api/v1/compositions/${encodeURIComponent(o)}/scene-annotations.json`),L=await I.json().catch(()=>({}));if(I.ok&&(L.status==="none"||L.status==="done"||L.status==="failed"))return}catch{}for(;!b&&Date.now()-E<w;){try{let I=await fetch(`/api/v1/compositions/${encodeURIComponent(o)}/scene-annotations-poll`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({})}),L=await I.json().catch(()=>({}));if(!I.ok||L?.ok===!1){await new Promise(z=>setTimeout(z,6e3));continue}let O=L.status??"none";if(O==="none"||O==="done"||O==="failed")return}catch{}await new Promise(I=>setTimeout(I,4e3))}})(),()=>{b=!0,Et.current=null}},[o]);let kc=(0,S.useCallback)(async()=>{tt(L=>L&&{...L,busy:!0,error:null});let b=we?.userPrompt?.trim()??"",E=async L=>{let O=await fetch(`/api/v1/compositions/${encodeURIComponent(L)}/auto-decompose`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({force:!0,...b?{user_prompt:b}:{}})}),z=await O.json().catch(()=>({}));return{response:O,data:z}},w=async L=>{let O=Date.now(),z=720*1e3;for(;Date.now()-O<z;){await new Promise(V=>setTimeout(V,5e3));try{let V=await fetch(`/api/v1/compositions/${encodeURIComponent(L)}/auto-decompose`,{method:"GET"});if(!V.ok)continue;let K=await V.json().catch(()=>({}));if(K?.ok===!1)continue;let j=K.status??"none";if(j==="done"||j==="failed")return K}catch{}}return null},I=async L=>{let O=Date.now(),z=600*1e3;for(;Date.now()-O<z;){await new Promise(V=>setTimeout(V,2e4));try{let V=await fetch(`/api/v1/compositions/${encodeURIComponent(L)}/remove-video-captions-poll`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({})}),K=await V.json().catch(()=>({}));if(!V.ok||K?.ok===!1)continue;let j=K.status??"none",be=typeof K.progress=="number"?K.progress:null;if(tt(ye=>ye&&{...ye,ghostcutStatus:j,ghostcutProgress:be}),j==="done"||j==="failed"||j==="none")return}catch{}}};try{let L=o??await i(),{response:O,data:z}=await E(L);if(O.status===404||/fork not found/i.test(z?.error||"")){let Ee=await fetch("/api/v1/compositions",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({source:n.id,title:n.title})}),ct=await Ee.json().catch(()=>({}));if(!Ee.ok||!ct?.fork_id)throw new Error(ct?.error||`Fork creation failed (${Ee.status})`);if(L=ct.fork_id,a(L),typeof window<"u"){let Ft=n.templateId??n.id,Qt=new URL(window.location.href);Qt.pathname=`/editor/${encodeURIComponent(Ft)}/fork/${encodeURIComponent(L)}`,Qt.searchParams.delete("fork"),window.history.replaceState(null,"",Qt)}({response:O,data:z}=await E(L))}let K=z;if(!(O.ok&&z?.ok!==!1&&z?.status==="done")){let Ee=await w(L);if(!Ee)throw new Error(z?.error||"Decompose is taking longer than expected. It may still finish \u2014 reload in a moment.");K=Ee}if(K.status==="failed")throw new Error(K.error||z?.error||"Decompose failed.");let be=typeof K.scene_count=="number"&&Number.isFinite(K.scene_count)?K.scene_count:null,ye=K.ghostcut_pending?"pending":"none";tt(Ee=>Ee&&{...Ee,busy:!1,finished:!0,error:null,scenesCreated:be,ghostcutStatus:ye,ghostcutProgress:null}),K.ghostcut_pending&&I(L)}catch(L){let O=L instanceof Error?L.message:String(L);tt(z=>z&&{...z,busy:!1,error:O})}},[i,o,n.id,n.title,a,we?.userPrompt]),F_=(0,S.useCallback)(()=>{tt(null),typeof window<"u"&&window.location.reload()},[]),Ek=(0,S.useCallback)(()=>{tt(null)},[]),M4=(0,S.useCallback)(()=>{tt(b=>b&&{...b,dismissed:!0})},[]),O4=(0,S.useCallback)(()=>{tt(b=>b&&{...b,dismissed:!1})},[]),yg=(0,S.useCallback)(async b=>{let E=o||await i(),w=await fetch(`/api/v1/compositions/${encodeURIComponent(E)}/fork`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({from:b})}),I=await w.json().catch(()=>({}));if(!w.ok||!I?.fork_id)throw new Error(I?.error||`Fork failed (${w.status})`);if(typeof window<"u"){let L=I.template_id??n.templateId??n.id;window.location.href=`/editor/${encodeURIComponent(L)}/fork/${encodeURIComponent(I.fork_id)}`}},[o,i,n]),[H_,_g]=(0,S.useState)(null),D4=(0,S.useCallback)(async()=>{try{o||await i()}catch{}_g({busy:!1,error:null})},[i,o]),L4=(0,S.useCallback)(async b=>{_g(E=>E&&{...E,busy:!0,error:null});try{await yg(b)}catch(E){let w=E instanceof Error?E.message:String(E);_g(I=>I&&{...I,busy:!1,error:w})}},[yg]),U4=(0,S.useCallback)(async()=>{try{o||await i()}catch{}tt({mode:"redo",dismissed:!1,busy:!1,finished:!1,error:null,scenesCreated:null,ghostcutStatus:null,ghostcutProgress:null,userPrompt:""})},[i,o]),P4=(0,S.useCallback)(async()=>{if(!o)try{await i()}catch{}An(!0)},[i,o]),B4=(0,S.useCallback)(()=>{o&&We(!0)},[o]),z4=(0,S.useCallback)(()=>{We(!1),typeof window<"u"&&window.location.reload()},[]),Tk=o?`/composition/current.html?fork=${encodeURIComponent(o)}&rev=${v}`:`/composition/current.html?composition=${encodeURIComponent(n.id)}&rev=${v}`,{iframeRef:vg,onIframeLoad:F4,resetPlayer:wk}=m(),Ac=u(b=>b.selectedElementId),G_=u(b=>b.selectedElementIds),Ic=u(b=>b.elements),xk=u(b=>b.timelineReady),H4=u(b=>b.isPlaying),Ur=(0,S.useMemo)(()=>Ic.map(b=>{let E=Se(b);return B6(b,H.get(E))}),[Ic,H]),Sg=(0,S.useMemo)(()=>j1(Ur),[Ur]),Nc=Sg.length>0&&xk,[kk,G4]=(0,S.useState)(0),[Ak,$4]=(0,S.useState)(0),[Ik,j4]=(0,S.useState)(0);(0,S.useEffect)(()=>{if(!Nc)return;let b=Hi.current?.querySelector('[aria-label="Timeline"]'),E=b?.firstElementChild instanceof HTMLElement?b.firstElementChild:null;if(!E)return;let w=()=>{G4(E.scrollTop),$4(E.scrollLeft),j4(E.scrollWidth)};w(),E.addEventListener("scroll",w,{passive:!0});let I=typeof ResizeObserver<"u"?new ResizeObserver(w):null;return I?.observe(E),E.firstElementChild instanceof HTMLElement&&I?.observe(E.firstElementChild),()=>{E.removeEventListener("scroll",w),I?.disconnect()}},[Nc]);let Nk=(0,S.useMemo)(()=>{if(!p||p<=0)return 0;let b=Ik-E_;return b>0?b/p:0},[p,Ik]),$_=(0,S.useMemo)(()=>{if(!Nc)return[];let b=fg(g),E=new Map(Sg.map((L,O)=>[L,O])),w=new Map;for(let L of Ur){if(!E.has(L.track))continue;let O=cn(b,L);if(!O)continue;let z=O.tagName.toLowerCase();if(z==="audio"||O.hasAttribute("data-vf-playback-source"))continue;let V=O.getAttribute("data-layer-kind");if(!(z==="video"||z==="img"||O.getAttribute("data-vf-timeline-proxy")==="video"||V==="video"||V==="image"))continue;let j=w.get(L.track)??[];j.push({element:L,node:O}),w.set(L.track,j)}let I=[];for(let[L,O]of w){O.sort((K,j)=>K.element.start-j.element.start);let z=E.get(L);if(z===void 0)continue;let V=K=>{let j=Number.parseFloat(K.node.getAttribute("data-transition-hold")||"");return K.element.start+K.element.duration-(Number.isFinite(j)&&j>0?j:0)};for(let K=0;K<O.length;K+=1){let j=O[K],be=K>0?O[K-1]:null,ye=K+1<O.length?O[K+1]:null,Ee=be!==null&&Math.abs(V(be)-j.element.start)<=.05,ct=ye!==null&&Math.abs(V(j)-ye.element.start)<=.05;I.push({key:`${Se(j.element)}:in`,kind:Ee?"junction":"in",element:j.element,time:j.element.start,rowIndex:z,preset:j.node.getAttribute("data-transition")||null,duration:Js(Number.parseFloat(j.node.getAttribute("data-transition-duration")??""))}),ct||I.push({key:`${Se(j.element)}:out`,kind:"out",element:j.element,time:V(j),rowIndex:z,preset:j.node.getAttribute("data-transition-out")||null,duration:Js(Number.parseFloat(j.node.getAttribute("data-transition-out-duration")??""))})}}return I},[g,Ur,Nc,Sg]),[bf,Rk]=(0,S.useState)(null),j_=bf?$_.find(b=>b.key===bf.chipKey)??null:null,In=Ur.find(b=>Se(b)===Ac)??null,q4=In?H.get(Se(In)):void 0,Ck=In?te.get(Se(In))?.frame:void 0,V4=Xt>=0&&zo.current.length>0,W4=Xt>=0&&La.current.length>0,Mk=dt>0,Y4="Render",K4=(0,S.useMemo)(()=>{let b=Xs();return b?.localRender&&b?.cloudRenderAvailable?[{key:"local",label:"Render Local (Free)",hint:"Render in-process on this machine \u2014 no cloud charge"},{key:"cloud",label:"Render in Cloud",hint:"Render on the cloud account \u2014 billed to its wallet"}]:null},[]),Eg=(0,S.useMemo)(()=>new Set([...Ac?[Ac]:[],...Array.from(G_)]),[Ac,G_]),X4=(0,S.useMemo)(()=>{if(Eg.size===0)return!1;let b=fg(g);return Ic.some(E=>Eg.has(Se(E))&&M6(b,E))},[g,Ic,Eg]),Nn=(0,S.useCallback)(()=>{cancelAnimationFrame(rl.current),rl.current=0,xc.current=0,hf.current=-1},[]);(0,S.useEffect)(()=>{if(!hg.current){hg.current=!0;return}wk(),Nn(),N(!0),k("1"),F(null),X(null),se(new Map),ve(new Map),Ge([]),Je(null),it(!1),Le.current=new Set,Bo(!1),zo.current=[],La.current=[],Ua.current=null,ze.current=null,$i.current=!1,Lr.current=null,Gi.current=null;let b=g4(n);h.current=b,_(b),T(E=>E+1),wc(E=>E+1)},[n.id,n,wk,Nn]);let Rc=(0,S.useCallback)(()=>{wc(b=>b+1)},[]),Cc=(0,S.useCallback)(()=>{let b=u.getState();return{html:h.current,time:b.currentTime,selectedElementId:b.selectedElementId,selectedElementIds:Array.from(b.selectedElementIds)}},[u]),pr=(0,S.useCallback)(b=>{let E=zo.current,w=Date.now(),I=Ua.current;Ua.current=b?{key:b,at:w}:null;let L=Cc();!!!(b&&I&&I.key===b&&w-I.at<1200&&E.length>0)&&E[E.length-1]?.html!==L.html&&(zo.current=[...E.slice(-49),L]),La.current=[],Rc()},[Rc,Cc]),Me=(0,S.useCallback)(()=>{let b=d(ce.current);return b?(vg.current=b,b):vg.current},[vg,d]),Ok=(0,S.useCallback)(b=>{if(!b)return Me();for(let E of Array.from(document.querySelectorAll("iframe")))if(E.contentWindow===b)return E;return Me()},[Me]),Dk=(0,S.useCallback)((b,E)=>{let w=Me()?.getBoundingClientRect(),I=gf.current?.getBoundingClientRect(),L=w&&w.width>1&&w.height>1?w:I;if(!L)return{x:12,y:70,width:42,height:12};let O=(b-L.left)/Math.max(1,L.width)*100,z=(E-L.top)/Math.max(1,L.height)*100,V=Re(O,0,95),K=Re(z,0,95);return{x:V,y:K,width:Re(42,1,100-V),height:Re(12,1,100-K)}},[Me]),Tg=(0,S.useCallback)(b=>{F(null),X(b)},[]),J4=(0,S.useCallback)(b=>{let E=b.target;if(E instanceof Element&&E.closest("button,input,textarea,select,a"))return;b.preventDefault(),b.stopPropagation();let w=u.getState();w.clearSelectedElementIds(),w.setSelectedElementId(null),Tg({x:b.clientX,y:b.clientY,time:w.currentTime,frame:Dk(b.clientX,b.clientY),elementId:null}),Ie("editor.preview-stage-context-menu",{x:b.clientX,y:b.clientY,time:w.currentTime})},[Dk,Tg,u]),Q4=(0,S.useCallback)(b=>{if(b.button!==0)return;let E=b.target;if(!(E instanceof Element)||E.closest("button,input,textarea,select,a,.canvas-frame-overlay")||E.closest("iframe"))return;let w=u.getState();w.setSelectedElementId(null),w.clearSelectedElementIds(),X(null),Ie("editor.preview-blank-unselect")},[u]),q_=(0,S.useCallback)(()=>{let b=Da(Me());if(!b)return;let E=b.getTime(),w=b.getDuration(),I=w>0&&E>=w,L=b.isPlaying()&&!I,O=performance.now();if((!L||O-xc.current>=66||Math.abs(E-hf.current)>=.25)&&(xc.current=O,hf.current=E,u.getState().setCurrentTime(E)),!L){u.getState().setIsPlaying(!1),Nn();return}rl.current=requestAnimationFrame(q_)},[Me,Nn]),Mc=(0,S.useCallback)(()=>{Nn(),rl.current=requestAnimationFrame(q_)},[Nn,q_]),yf=(0,S.useCallback)(b=>{let E=L6(b);k(String(Number(E.toFixed(2))));let w=Me(),I=Da(w);return I?.setPlaybackRate?.(E),u.getState().audioMuted||(I?.setMuted?.(!1),P6(w,"set-muted",{muted:!1})),P6(w,"set-playback-rate",{playbackRate:E}),E},[Me]),Pr=(0,S.useCallback)(b=>{let E=Me(),w=Da(E),I=u.getState(),L=w?.getDuration()||u.getState().duration||p,O=Math.max(0,Math.min(L,Number.isFinite(b)?b:0)),z=!!(w?.isPlaying()||I.isPlaying);if(Nn(),w){w.seek(O);let V=w.getTime();c.notify(V),I.setCurrentTime(V),I.setIsPlaying(!!w.isPlaying())}else c.notify(O),I.setCurrentTime(O),I.requestSeek(O);return z&&w?.isPlaying()&&Mc(),!0},[p,Me,c,Mc,Nn,u]),wg=(0,S.useCallback)(b=>!(b instanceof Element)||b.closest("button,input,textarea,select,a")||b.closest("[data-clip]")?!1:!!b.closest('[aria-label="Timeline"]'),[]),Pa=(0,S.useCallback)((b,E)=>{let w=Hi.current?.querySelector('[aria-label="Timeline"]'),I=w?.firstElementChild instanceof HTMLElement?w.firstElementChild:null,L=u.getState().duration||p;if(!I||L<=0)return null;let O=I.getBoundingClientRect(),V=Math.max(1,I.scrollWidth-E_)/L,K=b-O.left+I.scrollLeft-E_;if(K<0)return null;let j=Math.max(0,Math.min(L,K/V)),be=E-O.top+I.scrollTop-B1,ye=Gi.current?.rowOrder??j1(Ur),Ee=Math.floor(be/T_),ct=E-O.top,Ft=ye.length>0&&ct>=0&&ct<=B1,Qt=Ft?Math.max(...ye)+1:Ee>=0&&Ee<ye.length?ye[Ee]:null,de=Qt===null?null:Ur.find(Nt=>Nt.track===Qt&&j>=Nt.start&&j<=Nt.start+Nt.duration)??null;return{time:j,track:Qt,syntheticTrack:Ft,element:de,scrollLeft:I.scrollLeft,pixelsPerSecond:V}},[p,Ur,u]),Lk=(0,S.useCallback)((b,E)=>{let w=Pa(b,0);if(!w)return!1;let{time:I,scrollLeft:L,pixelsPerSecond:O}=w;return Pr(I),Ie("editor.timeline-capture-seek",{source:E,time:I,clientX:b,scrollLeft:L,pixelsPerSecond:O}),!0},[Pr,Pa]),Z4=(0,S.useCallback)(b=>{if(b.button!==0||b.shiftKey||b.metaKey||b.ctrlKey||b.altKey){Lr.current=null;return}Lr.current={clientX:b.clientX,clientY:b.clientY,button:b.button,startedOnTimeline:wg(b.target)}},[wg]),eP=(0,S.useCallback)(b=>{let E=Lr.current;Lr.current=null,!(!E||E.button!==0||!E.startedOnTimeline||!wg(b.target)||Math.hypot(b.clientX-E.clientX,b.clientY-E.clientY)>5)&&Lk(b.clientX,"click-capture")},[wg,Lk]),tP=(0,S.useCallback)(b=>{let E=b.target;if(!(E instanceof Element)||!E.closest('[aria-label="Timeline"]'))return;b.preventDefault(),b.stopPropagation();let w=Pa(b.clientX,b.clientY);if(!w)return;let I=u.getState();if(w.element){let L=Se(w.element);new Set([...I.selectedElementId?[I.selectedElementId]:[],...Array.from(I.selectedElementIds)]).has(L)||(I.clearSelectedElementIds(),I.setSelectedElementId(L))}else I.clearSelectedElementIds(),I.setSelectedElementId(null);F({x:b.clientX,y:b.clientY,time:w.time,track:w.syntheticTrack?null:w.track,element:w.element}),X(null)},[Pa,u]),xg=(0,S.useCallback)(b=>{Fi(Me(),b)},[Me]),Uk=(0,S.useCallback)(()=>mf.current?.querySelector(".dna-panel")?.scrollTop??0,[]),Pk=(0,S.useCallback)(b=>{requestAnimationFrame(()=>{let E=mf.current?.querySelector(".dna-panel");E&&(E.scrollTop=b)})},[]),Oc=(0,S.useCallback)(()=>{let b=u.getState(),E=Da(Me());return{time:E?.getTime()??b.currentTime,selectedElementId:b.selectedElementId,selectedElementIds:Array.from(b.selectedElementIds),zoomMode:b.zoomMode,manualZoomPercent:b.manualZoomPercent,rightPanelScrollTop:Uk(),playbackRate:L6(Number(M)),wasPlaying:!!(E?.isPlaying()||b.isPlaying)}},[Me,Uk,M,u]),nP=(0,S.useCallback)(()=>{let b=ze.current;if(!b){xg(In);return}let E=0,w=()=>{let I=u.getState();if(!(I.timelineReady&&I.elements.length>0)&&E<12){E+=1,requestAnimationFrame(w);return}let O=Da(Me());if(b.wasPlaying&&!O&&E<30){E+=1,requestAnimationFrame(w);return}ze.current=null,k(String(Number(b.playbackRate.toFixed(2)))),I.setZoomMode(b.zoomMode),I.setManualZoomPercent(b.manualZoomPercent),I.setPlaybackRate(b.playbackRate),I.clearSelectedElementIds();for(let V of b.selectedElementIds)I.toggleSelectedElementId(V);I.setSelectedElementId(b.selectedElementId);let z=b.selectedElementId?I.elements.find(V=>Se(V)===b.selectedElementId)??null:null;Fi(Me(),z),Pk(b.rightPanelScrollTop),yf(b.playbackRate),Pr(b.time),b.wasPlaying&&O?(O.play(),I.setIsPlaying(!0),Mc()):I.setIsPlaying(!1),Ie("editor.restore-after-reload",{time:b.time,selectedElementId:b.selectedElementId,selectedCount:b.selectedElementIds.length,zoomMode:b.zoomMode,manualZoomPercent:b.manualZoomPercent,rightPanelScrollTop:b.rightPanelScrollTop})};requestAnimationFrame(w)},[yf,Pr,Me,Pk,In,Mc,xg,u]);(0,S.useEffect)(()=>()=>Nn(),[Nn]),(0,S.useEffect)(()=>{h.current=g},[g]),(0,S.useEffect)(()=>{xg(In)},[In,xg]),(0,S.useEffect)(()=>{let b=E=>{let w=E.data;if(!w||w.source!=="vidfarm-composition")return;let I=u.getState();if(w.action==="preview-context-menu"){let O=Ok(E.source),z=O?.getBoundingClientRect(),V=O?.contentWindow?.innerWidth||z?.width||1,K=O?.contentWindow?.innerHeight||z?.height||1,j=(z?.width??1)/Math.max(1,V),be=(z?.height??1)/Math.max(1,K),ye=(z?.left??0)+Number(w.clientX??0)*j,Ee=(z?.top??0)+Number(w.clientY??0)*be,ct={x:Number(w.frame?.x??12),y:Number(w.frame?.y??70),width:Number(w.frame?.width??42),height:Number(w.frame?.height??12)},Ft={x:Re(ct.x,0,95),y:Re(ct.y,0,95),width:Re(ct.width,1,100-Re(ct.x,0,95)),height:Re(ct.height,1,100-Re(ct.y,0,95))};Tg({x:ye,y:Ee,time:Number.isFinite(Number(w.time))?Number(w.time):I.currentTime,frame:Ft,elementId:w.id??null}),Ie("editor.preview-context-menu",{id:w.id??null,time:Number(w.time),frame:Ft});return}if(w.action!=="select-layer")return;if(I.clearSelectedElementIds(),!w.id){I.setSelectedElementId(null),X(null),Ie("editor.canvas-empty-select");return}let L=I.elements.find(O=>O.hfId===w.id||O.domId===w.id||O.id===w.id||O.key===w.id);I.setSelectedElementId(L?Se(L):null),X(null),Ie("editor.canvas-layer-select",{id:w.id,elementKey:L?Se(L):null})};return window.addEventListener("message",b),()=>window.removeEventListener("message",b)},[Ok,Tg,u]);let V_=(0,S.useCallback)(()=>{let b=he.current;if(b.active)return;if(b.pendingBody===null){b.pendingRevBump&&(b.pendingRevBump=!1,T(w=>w+1),requestAnimationFrame(()=>N(!0)));return}let E=b.pendingBody;b.pendingBody=null,b.active=!0,(async()=>{try{let w=await i(),I=await fetch(`/api/v1/compositions/${encodeURIComponent(w)}/composition.html`,{method:"PUT",headers:{"content-type":"text/html; charset=utf-8"},body:E});if(I.ok)tg.current={status:"ok"},B(null);else{let L=I.status===403||I.status===401;tg.current={status:"error",httpStatus:I.status,readOnly:L,message:L?"This video is read-only from this link \u2014 your edits preview but aren't saved.":I.status===429?"Editing too fast \u2014 the last change wasn't saved. Try again in a moment.":`Couldn't save the last change (HTTP ${I.status}).`},B(tg.current.message??"The last change wasn't saved."),dr("editor.composition-put-rejected",{status:I.status,forkId:w})}}catch(w){tg.current={status:"error",message:"Network error \u2014 the last change wasn't saved."},B("Network error \u2014 the last change wasn't saved."),dr("editor.composition-put-failed",w instanceof Error?w.message:w)}finally{b.active=!1,V_()}})()},[i]),Dc=(0,S.useCallback)((b,E)=>{let w=he.current;w.pendingBody=vc(b),E.bumpRev&&(w.pendingRevBump=!0),V_()},[V_]),ao=(0,S.useCallback)((b,E)=>{Ie("editor.composition-persist",{bytes:b.length,mode:E}),Dc(b,{bumpRev:!1})},[Dc]),Lc=(0,S.useCallback)((b,E)=>{b=vc(b);let w={...Oc(),...E};$i.current&&(w.wasPlaying=!0,$i.current=!1),ze.current=w,h.current=b,_(b),Nn(),u.getState().reset(),N(!1),Ie("editor.composition-publish",{bytes:b.length}),Dc(b,{bumpRev:!0})},[Oc,Dc,Nn,u]),Ho=(0,S.useCallback)(b=>{pr(),Lc(b)},[Lc,pr]),Bk=(0,S.useCallback)((b,E)=>{pr(),Lc(b,{selectedElementId:E,selectedElementIds:[]})},[Lc,pr]),yZ=(0,S.useCallback)((b,E)=>{b=vc(b),pr(),h.current=b,_(b);let w=Me(),I=G1(w,b),L=u.getState(),O=L.selectedElementId?L.elements.find(z=>Se(z)===L.selectedElementId)??null:null;Fi(w,O),ao(b,"soft"),E!==void 0&&Pr(E),Ie("editor.timeline-timing-soft-patch",{bytes:b.length,patchedCount:I,seekTime:E})},[Pr,Me,ao,pr,u]),zk=(0,S.useCallback)((b,E)=>{let w=h.current,I=ci(w,b,E);if(I===w){Ie("editor.live-patch-skipped-missing",{elementKey:Se(b)});return}pr(`live:${Se(b)}`),h.current=I,_(I);let L=Me(),O=eg(L,b,E);O&&U6(L),Fi(L,b),Ie("editor.live-patch",{elementKey:Se(b),hfId:b.hfId,domId:b.domId,tag:b.tag,hasIframe:!!L,patched:O}),O?ao(I,"soft"):Lc(I)},[Me,ao,Lc,pr]),rP=(0,S.useCallback)((b,E)=>{let w=Me(),I=eg(w,b,E);I&&U6(w),Fi(w,b),Ie("editor.live-preview-patch",{elementKey:Se(b),patched:I})},[Me]),kg=(0,S.useCallback)(b=>{let E=h.current;h.current=b.html,_(b.html);let w=Me(),I=k6(w,b.html),L=I?w_(w):!1;$1(u,E,b.html),ao(b.html,"soft");let O=u.getState(),z=new Set(O.elements.map(j=>Se(j))),V=b.selectedElementId&&z.has(b.selectedElementId)?b.selectedElementId:null,K=b.selectedElementIds.filter(j=>z.has(j));if(I&&L){O.clearSelectedElementIds();for(let be of K)O.toggleSelectedElementId(be);O.setSelectedElementId(V);let j=V?O.elements.find(be=>Se(be)===V)??null:null;Fi(w,j),Pr(b.time),Ie("editor.history-live-swap",{bytes:b.html.length});return}if(ze.current={...Oc(),time:b.time,selectedElementId:V,selectedElementIds:K},Nn(),A6(w,b.html)){Ie("editor.history-document-write",{bytes:b.html.length});return}Dc(b.html,{bumpRev:!0}),Ie("editor.history-reload-fallback",{bytes:b.html.length})},[Oc,Pr,Dc,Me,ao,Nn,u]),W_=(0,S.useCallback)(b=>{let E=Me(),w=E?.contentDocument??null,I=w?gg(w):h.current;h.current=b,_(b);let L=k6(E,b),O=L?w_(E):!1;if($1(u,I,b),L&&O){Pr(u.getState().currentTime),Ie("editor.dev-reload-live-swap",{bytes:b.length});return}if(ze.current={...Oc()},Nn(),A6(E,YJ(b))){Ie("editor.dev-reload-document-write",{bytes:b.length});return}dr("editor.dev-reload-apply-failed",{bytes:b.length})},[Oc,Pr,Me,Nn,u]);(0,S.useEffect)(()=>{if(!o||!Xs()?.liveReload)return;let b=new EventSource("/api/v1/dev/events"),E=w=>{let I={};try{I=JSON.parse(w.data)}catch{}I.forkId&&I.forkId!==o||fetch(`/api/v1/compositions/${encodeURIComponent(o)}/composition.html`,{cache:"reload"}).then(L=>L.ok?L.text():null).then(L=>{L!=null&&W_(vc(L))}).catch(L=>dr("editor.live-reload-fetch-failed",L instanceof Error?L.message:String(L)))};return b.addEventListener("reload",E),b.onerror=()=>dr("editor.live-reload-sse-error"),()=>{b.removeEventListener("reload",E),b.close()}},[W_,o]);let _f=(0,S.useCallback)(()=>{Fo.current.flushAll();let b=zo.current.pop();b&&(La.current=[Cc(),...La.current.slice(0,49)],Ua.current=null,Rc(),kg(b))},[kg,Rc,Cc]),Uc=(0,S.useCallback)(()=>{Fo.current.flushAll();let b=La.current.shift();b&&(zo.current=[...zo.current.slice(-49),Cc()],Ua.current=null,Rc(),kg(b))},[kg,Rc,Cc]),Y_=(0,S.useRef)({undo:()=>{},redo:()=>{}});(0,S.useEffect)(()=>{Y_.current={undo:_f,redo:Uc}},[Uc,_f]);let oP=(0,S.useCallback)(()=>{let b=Me()?.contentDocument;!b||w6.has(b)||(w6.add(b),b.addEventListener("keydown",E=>{if(!(E.metaKey||E.ctrlKey)||E.altKey)return;let w=E.key.toLowerCase();w!=="z"&&w!=="y"||(E.preventDefault(),E.stopPropagation(),w==="y"||E.shiftKey?Y_.current.redo():Y_.current.undo())},!0))},[Me]),iP=(0,S.useCallback)(b=>{io.current=b.commit,Bo(b.dirty)},[]),K_=(0,S.useCallback)(b=>{ve(E=>{if(!E.has(b))return E;let w=new Map(E);return w.delete(b),w})},[]),aP=(0,S.useCallback)(b=>{let E=Se(b),w=P_(h.current,b);if(w){let I=v4(w);eg(Me(),b,L=>rk(L,I)),Fi(Me(),b)}K_(E)},[K_,Me]),Ag=(0,S.useCallback)((b,E)=>{let w=Se(b),I={x:Re(E.x,0,Math.max(0,100-E.width)),y:Re(E.y,0,Math.max(0,100-E.height)),width:Re(E.width,1,100-E.x),height:Re(E.height,1,100-E.y),...Number.isFinite(E.fontSize)?{fontSize:Math.max(8,Math.min(180,Number(E.fontSize)))}:{}};ve(L=>{let O=new Map(L);return O.set(w,{element:b,frame:I}),O}),Fi(Me(),b),Bo(!0)},[Me]),sP=(0,S.useCallback)(()=>{window.setTimeout(()=>Fo.current.visual(),0)},[]),Pc=(0,S.useCallback)(()=>{let b=Array.from(te.values());if(b.length===0)return!1;pr();let E=h.current;for(let w of b)E=ci(E,w.element,I=>rk(I,w.frame));return h.current=E,_(E),ve(new Map),ao(E,"soft"),Fi(Me(),In),Ie("editor.visual-frame-drafts-commit",{count:b.length}),!0},[Me,ao,pr,In,te]);(0,S.useEffect)(()=>{let b=E=>{let w=E.data;if(!w||w.source!=="vidfarm-composition"||w.action!=="visual-frame-draft"||!w.id||!w.frame)return;let I=u.getState(),L=I.elements.find(V=>V.hfId===w.id||V.domId===w.id||V.id===w.id||V.key===w.id);if(!L||!bk(L))return;let O=Number(w.frame.fontSize),z={x:Number(w.frame.x),y:Number(w.frame.y),width:Number(w.frame.width),height:Number(w.frame.height),...Number.isFinite(O)?{fontSize:O}:{}};[z.x,z.y,z.width,z.height].every(Number.isFinite)&&(I.clearSelectedElementIds(),I.setSelectedElementId(Se(L)),Ag(L,z),w.phase==="end"&&window.setTimeout(()=>Fo.current.visual(),0),Ie("editor.iframe-visual-frame-draft",{elementKey:Se(L),phase:w.phase,frame:z}))};return window.addEventListener("message",b),()=>window.removeEventListener("message",b)},[Ag,u]);let Fk=(0,S.useCallback)(b=>{let E=Array.from(H.entries()).filter(([w])=>w!==b).map(([,w])=>w);return E.length===0?h.current:og(h.current,E).html},[H]),X_=(0,S.useCallback)(b=>{se(E=>{if(!E.has(b))return E;let w=new Map(E);return w.delete(b),w})},[]),lP=(0,S.useCallback)(b=>{let E=H.get(b);if(E){let w=nk(h.current,E.element);u.getState().updateElement(b,{start:w.start,duration:w.duration,track:w.track,playbackStart:w.playbackStart})}X_(b)},[X_,H,u]),ji=(0,S.useCallback)((b,E,w)=>{let I=Se(b),L=nk(h.current,b),z={...H.get(I)?.updates??{},...E};if(!w?.bypassCollisionGuard){let ye={start:z.start??L.start,duration:z.duration??L.duration,track:z.track??L.track},Ee=C6(u.getState().elements,b,h.current),ct={start:L.start,duration:L.duration,track:L.track};if(q1(ye,Ee)&&!q1(ct,Ee))return dr("editor.timeline-stage-collision-rejected",{elementKey:I,proposed:ye}),!1}let V=h.current;try{let ye=Array.from(H.entries()).filter(([Ee])=>Ee!==I).map(([,Ee])=>Ee);V=og(h.current,[...ye,{element:L,updates:z}]).html}catch(ye){return dr("editor.timeline-stage-rejected",ye instanceof Error?ye.message:ye),!1}let K=u.getState();K.setSelectedElementId(I),K.updateElement(I,E),se(ye=>{let Ee=new Map(ye);return Ee.set(I,{element:L,updates:z}),Ee});let j=Me(),be=G1(j,V);return Fi(j,{...L,...z}),Ie("editor.timeline-stage-applied",{elementKey:I,updates:z,patchedCount:be}),!0},[Me,H,u]),Bc=(0,S.useCallback)((b=new Set)=>{let E=Array.from(H.entries()).filter(([K])=>!b.has(K));if(E.length===0)return;pr();let w=h.current,{html:I,resolvedCollisions:L}=og(w,E.map(([,K])=>K)),O=vc(I);se(K=>{let j=new Map(K);for(let[be]of E)j.delete(be);return j}),h.current=O,_(O),u.getState().elements.length>0&&$1(u,w,O);let z=Me(),V=G1(z,O);w_(z),ao(O,"soft"),Ie("editor.timeline-timing-commit",{count:E.length,patchedCount:V,resolvedCollisions:L})},[Me,ao,pr,H,u]),Ig=(0,S.useCallback)(()=>{let b=!1;oo&&io.current&&(io.current(),io.current=null,Bo(!1),b=!0);let E=In?Se(In):null;return H.size>0&&Bc(b&&E?new Set([E]):new Set),te.size>0&&Pc(),h.current},[Bc,Pc,oo,In,H.size,te.size]);(0,S.useEffect)(()=>{Fo.current={timing:()=>Bc(),visual:()=>Pc(),flushAll:()=>{Ig()}}},[Ig,Bc,Pc]);let Ng=(0,S.useCallback)(async b=>{let E=n.title,w=`render-${Z.current+=1}`,I=Date.now(),L=!1;if(Ge(O=>O.some(z=>z.state.phase==="starting")?(L=!0,O):[...O,{localId:w,forkId:o,startedAt:I,state:{phase:"starting",title:E,status:"STARTING",progress:0,framesRendered:0,totalFrames:null,lambdasInvoked:0,cost:"$0.0000"}}]),!L){Je(w),it(!1);try{let O=Ig(),z=await i();Ge(j=>j.map(be=>be.localId===w?{...be,forkId:z}:be));let V=await fetch(`/api/v1/compositions/${encodeURIComponent(z)}/render`,{method:"POST",headers:{"content-type":"application/json; charset=utf-8"},body:JSON.stringify({title:E,html:O,...b==="cloud"?{render_target:"cloud"}:{}})}),K=await V.json().catch(()=>({}));if(!V.ok||K.ok===!1)throw new Error(K.error||`Publish failed with ${V.status}`);Ie("editor.publish-started",{forkId:z,renderId:K.renderId}),me(w,o4(K,E))}catch(O){Po("editor.publish-start-error",O instanceof Error?O.stack:O),me(w,{phase:"failed",title:E,status:"FAILED",progress:0,error:O instanceof Error?O.message:String(O)})}}},[Ig,n.title,i,o,me]),cP=(0,S.useCallback)(()=>{let b=Me(),E=Da(b);if(!E)return;if(E.isPlaying()||u.getState().isPlaying){E.pause(),u.getState().setCurrentTime(E.getTime()),u.getState().setIsPlaying(!1),Nn();return}(oo||H.size>0||te.size>0)&&($i.current=!0);let I=!1;oo&&io.current&&(io.current(),io.current=null,Bo(!1),I=!0);let L=In?Se(In):null;H.size>0&&Bc(I&&L?new Set([L]):new Set),te.size>0&&Pc(),$i.current&&($i.current=!1);let O=yf(Number(M));E.getTime()>=E.getDuration()&&E.seek(0),E.setPlaybackRate?.(O),E.play(),u.getState().setIsPlaying(!0),Mc()},[yf,Pc,Bc,Me,oo,In,M,Mc,Nn,H.size,u,te.size]),uP=(0,S.useCallback)((b,E)=>{try{let w=new DOMParser().parseFromString(Fk(),"text/html"),I=cn(w,b);if(!I)return;let L=I.getAttribute("data-vf-group"),O=ek(w,L,I),z=Sc(I),V=E.start-z.start,K=E.track-z.track,j=new Map;for(let be of O){let ye=ui(be);if(!ye)continue;let Ee=Sc(be);j.set(ye,{start:Math.max(0,Ee.start+V),duration:Ee.duration,track:Math.max(0,Ee.track+K)})}eQ(w,O,j);for(let be of O){let ye=ui(be),Ee=ye?j.get(ye):null;if(!ye||!Ee)continue;let ct=Ic.find(Qt=>Se(Qt)===ye||Qt.hfId===ye||Qt.domId===ye||Qt.id===ye)??(ye===ui(I)?b:null);if(!ct)continue;if(!ji(ct,{start:Ee.start,track:Ee.track},{bypassCollisionGuard:!0}))throw new Error("Timeline move could not be staged.")}window.setTimeout(()=>Fo.current.timing(),0)}catch(w){return dr("editor.timeline-move-rejected",w instanceof Error?w.message:w),Promise.reject(w)}},[Ic,Fk,ji]),dP=(0,S.useCallback)((b,E)=>{try{if(!ji(b,E))throw new Error("Timeline resize could not be staged.");window.setTimeout(()=>Fo.current.timing(),0)}catch(w){return dr("editor.timeline-resize-rejected",w instanceof Error?w.message:w),Promise.reject(w)}},[ji]),J_=(0,S.useCallback)((b,E,w)=>{if(w.button!==0||w.shiftKey||w.metaKey||w.ctrlKey)return;if(w.altKey){w.preventDefault(),w.stopPropagation();return}let I=Se(b),L=B6(b,H.get(I)),O=Pa(w.clientX,w.clientY);if(!O)return;w.preventDefault(),w.stopPropagation();let z=u.getState();z.clearSelectedElementIds(),z.setSelectedElementId(I),Lr.current=null;let V=QJ(Ur.filter(K=>O_(h.current,K)!=="track-placeholder"));Gi.current={element:L,mode:E,originClientX:w.clientX,originClientY:w.clientY,originPointerTime:O.time,originStart:L.start,originDuration:L.duration,originTrack:L.track,originPlaybackStart:L.playbackStart,moved:!1,rowOrder:j1(Ur),laneAudioFlags:V},Ie("editor.manual-timeline-drag-start",{elementKey:I,mode:E,start:L.start,duration:L.duration,track:L.track})},[Ur,Pa,H,u]);(0,S.useEffect)(()=>{function b(w){let I=Gi.current;if(!I)return;let L=Math.hypot(w.clientX-I.originClientX,w.clientY-I.originClientY);if(!I.moved&&L<2)return;I.moved=!0,w.preventDefault();let O=Pa(w.clientX,w.clientY);if(!O)return;let z=O.time-I.originPointerTime,V=I.originStart+I.originDuration,K=C6(u.getState().elements,I.element,h.current),j=!1,be=!1;if(I.mode==="move"){let ye=Re(I.originStart+z,0,Math.max(0,p-I.originDuration)),Ee=O.track??I.originTrack,ct=K.reduce((Nt,qn)=>Math.max(Nt,qn.track),-1),Ft=O.syntheticTrack?Math.min(Ee,Math.max(ct+1,I.originTrack)):Ee,Qt=I.element.tag==="audio",de=I.laneAudioFlags.get(Ft);if(!O.syntheticTrack&&Ft!==I.originTrack&&de!==void 0&&de!==Qt)be=!0;else{let Nt={start:ye,duration:I.originDuration,track:Ft},qn=q1(Nt,K)?ZJ(K,Ft,I.originDuration,ye,p):ye;qn===null?be=!0:j=ji(I.element,{start:qn,track:Ft})}}else if(I.mode==="trim-start"){let ye=K.reduce((Nt,qn)=>dg(qn)&&qn.track===I.originTrack&&qn.start+qn.duration<=I.originStart+.001?Math.max(Nt,qn.start+qn.duration):Nt,0),Ee=Math.max(0,V-.05),ct=Math.min(ye,Ee),Ft=Re(I.originStart+z,ct,Ee),Qt=Ft-I.originStart,de=I.originPlaybackStart===void 0?void 0:Math.max(0,I.originPlaybackStart+Qt);j=ji(I.element,{start:Ft,duration:Math.max(.05,V-Ft),playbackStart:de})}else{let ye=K.reduce((Ft,Qt)=>dg(Qt)&&Qt.track===I.originTrack&&Qt.start>=V-.001?Math.min(Ft,Qt.start):Ft,p),Ee=Math.max(I.originStart+.05,ye),ct=Re(V+z,I.originStart+.05,Ee);j=ji(I.element,{duration:Math.max(.05,ct-I.originStart)})}be?Ie("editor.manual-timeline-drag-lane-full",{elementKey:Se(I.element),mode:I.mode,track:O.track??I.originTrack}):j||dr("editor.manual-timeline-drag-rejected",{elementKey:Se(I.element),mode:I.mode})}function E(){let w=Gi.current;w&&(Ie("editor.manual-timeline-drag-end",{elementKey:Se(w.element),mode:w.mode,moved:w.moved}),Gi.current=null,w.moved&&window.setTimeout(()=>Fo.current.timing(),0))}return window.addEventListener("pointermove",b,{passive:!1}),window.addEventListener("pointerup",E),window.addEventListener("pointercancel",E),()=>{window.removeEventListener("pointermove",b),window.removeEventListener("pointerup",E),window.removeEventListener("pointercancel",E)}},[p,Pa,ji,u]);let Hk=(0,S.useCallback)((b,E)=>{let w=ci(g,b,I=>{let L=Number(I.getAttribute("data-start")??b.start),O=Number(I.getAttribute("data-duration")??b.duration),z=L+O;if(E<=L||E>=z)return;let V=E-L,K=z-E,j=I.cloneNode(!0),be=`element_split_${Date.now().toString(36)}${Math.floor(Math.random()*1e3).toString(36)}`,ye=Number(I.getAttribute("data-playback-start")??I.getAttribute("data-media-start")??b.playbackStart??0),Ee=I.getAttribute("data-layer-kind")||hk(b)?.kind||(b.tag==="audio"?"audio":b.tag==="video"?"video":"layer"),ct=He(ye+V);I.setAttribute("data-duration",He(V)),I.setAttribute("data-layer-kind",Ee),j.id=be,j.setAttribute("data-hf-id",be),j.setAttribute("data-start",He(E)),j.setAttribute("data-duration",He(K)),j.setAttribute("data-media-start",ct),j.setAttribute("data-playback-start",ct),j.setAttribute("data-layer-kind",Ee),j.setAttribute("data-label",`${b.label??b.id} split`),I.after(j)});Ho(w)},[g,Ho]),fP=(0,S.useCallback)((b,E)=>{let w=Math.max(0,E==="above"?b+1:b),{html:I}=fr(g,L=>{for(let K of Array.from(L.querySelectorAll("[data-start]"))){if(!rt(K))continue;let j=Number(K.getAttribute("data-track-index")??0);j>=w&&K.setAttribute("data-track-index",String(j+1))}let O=L.querySelector("[data-composition-id]");if(!rt(O))return;let z=`element_track_${w}_${Date.now().toString(36)}`,V=L.createElement("div");V.id=z,V.setAttribute("data-hf-id",z),V.setAttribute("data-layer-mode","publish"),V.setAttribute("data-layer-kind","track-placeholder"),V.setAttribute("data-viral-note","Empty layer row."),V.setAttribute("data-start","0"),V.setAttribute("data-duration","0"),V.setAttribute("data-track-index",String(w)),V.setAttribute("data-label","Empty layer"),V.setAttribute("data-timeline-locked","true"),V.style.cssText="position:absolute;left:0%;top:0%;width:1%;height:1%;display:none;",O.append(V)});Ho(I),Ie("editor.timeline-layer-inserted",{anchorTrack:b,placement:E,insertAt:w})},[g,Ho,u]),zc=(0,S.useCallback)((b,E,w="video")=>{io.current?.();let I=b==="media"&&w==="audio",O=`element_${b==="media"?w:b}_${Date.now().toString(36)}${Math.floor(Math.random()*1e3).toString(36)}`,z=u.getState().currentTime,V=Math.max(0,Math.min(p-.5,Number.isFinite(E.time)?E.time:z)),K=Math.max(.5,Math.min(4,p-V)),j=E.frame??{x:b==="captions"?10:12,y:b==="media"?18:b==="captions"?70:68,width:b==="media"?54:b==="captions"?80:76,height:b==="media"?32:b==="captions"?14:12},{html:be}=fr(h.current,ye=>{let Ee=ye.querySelector("[data-composition-id]");if(!rt(Ee))return;let Ft=Array.from(ye.querySelectorAll("[data-start]")).filter(Nt=>rt(Nt)).reduce((Nt,qn)=>{let Kk=Number(qn.getAttribute("data-track-index")??0);return Number.isFinite(Kk)?Math.max(Nt,Kk+1):Nt},0),Qt=w==="image"?"img":w==="audio"?"audio":"video",de=b==="media"?ye.createElement(Qt):ye.createElement("div");if(de.id=O,de.setAttribute("data-hf-id",O),de.setAttribute("data-layer-mode","publish"),de.setAttribute("data-layer-kind",b==="media"?w:"caption"),de.setAttribute("data-viral-note",b==="media"?`Inserted ${w} layer.`:"Inserted caption layer."),de.setAttribute("data-start",He(V)),de.setAttribute("data-duration",He(K)),de.setAttribute("data-track-index",String(Ft)),de.setAttribute("data-label",b==="media"?w==="audio"?"New audio":w==="image"?"New image":"New video":b==="captions"?"Captions":"New text"),(b==="text"||b==="captions")&&(de.setAttribute("data-text-background-style","plain"),de.setAttribute("data-text-background-color","#000000"),de.setAttribute("data-font-family","Montserrat")),I||(de.style.position="absolute",de.style.left=`${Re(j.x,0,95)}%`,de.style.top=`${Re(j.y,0,95)}%`,de.style.width=`${Re(j.width,1,100-Re(j.x,0,95))}%`,de.style.height=`${Re(j.height,1,100-Re(j.y,0,95))}%`,de.style.zIndex=String(100+Ft),de.style.overflow="hidden"),b==="media"&&de instanceof HTMLVideoElement)de.setAttribute("src",lg),de.setAttribute("playsinline",""),de.setAttribute("muted",""),de.setAttribute("preload","auto"),de.setAttribute("data-media-start","0"),de.setAttribute("data-playback-start","0"),de.style.objectFit="cover",de.style.background="#050604";else if(b==="media"&&w==="image")de.setAttribute("src",d4),de.setAttribute("alt","New image"),de.style.objectFit="cover",de.style.background="#050604";else if(b==="media"&&w==="audio")de.setAttribute("preload","auto"),de.setAttribute("data-media-start","0"),de.setAttribute("data-playback-start","0");else if(de.style.display="flex",de.style.alignItems="center",de.style.justifyContent="center",de.style.padding="3px",de.style.boxSizing="border-box",de.style.textAlign="center",de.style.color="#ffffff",de.style.background="transparent",de.style.fontFamily="Montserrat, 'TikTok Sans', sans-serif",de.style.fontWeight="600",de.style.fontSize=b==="captions"?"38px":"22px",de.style.lineHeight="1.2",de.style.textTransform="none",b==="captions"){de.style.overflow="visible";let Nt=L_[0],qn="Animated captions";de.style.fontWeight=String(Nt.fontWeight??800),tl(de,qn,Nt.textBackgroundStyle??"plain",Nt.color??"#ffffff",Nt.background??"#000000","Montserrat",Nt.fontWeight??800),mg(de,Nt.animation,{activeColor:Nt.activeColor,highlightColor:Nt.highlightColor,uppercase:Nt.uppercase,text:qn})}else tl(de,"New text","plain","#ffffff","#000000","Montserrat",600);Ee.append(de)});Bk(be,O),F(null),X(null),Ie("editor.layer-inserted",{id:O,kind:b,start:V,duration:K})},[p,Bk,u]),Q_=(0,S.useCallback)(()=>{let b=u.getState(),E=new Set([...b.selectedElementId?[b.selectedElementId]:[],...Array.from(b.selectedElementIds)]),w=b.elements.filter(O=>E.has(Se(O)));if(w.length<2)return;let I=`vf-group-${Date.now().toString(36)}`,{html:L}=fr(g,O=>{for(let z of w){let V=cn(O,z);V&&(V.setAttribute("data-vf-group",I),V.setAttribute("data-vf-group-label","Vidfarm group"))}});Ho(L),Ie("editor.group-created",{groupId:I,count:w.length})},[g,Ho,u]),Z_=(0,S.useCallback)(()=>{let b=u.getState(),E=new Set([...b.selectedElementId?[b.selectedElementId]:[],...Array.from(b.selectedElementIds)]);if(E.size===0)return;let{html:w}=fr(g,I=>{let L=new Set;for(let O of b.elements){if(!E.has(Se(O)))continue;let z=M6(I,O);z&&L.add(z)}for(let O of L)for(let z of ek(I,O,I.body))z.removeAttribute("data-vf-group"),z.removeAttribute("data-vf-group-label")});Ho(w),Ie("editor.group-removed")},[g,Ho,u]),vf=(0,S.useCallback)(b=>{if(b.hfId==="source-video")return;pr();let E=ci(h.current,b,K=>K.remove());h.current=E,_(E);let w=Me(),I=eg(w,b,K=>{K instanceof HTMLMediaElement&&K.pause(),K.remove()}),L=w_(w),O=new Set([Se(b),b.hfId,b.domId,b.id].filter(K=>!!K)),z=u.getState();z.setElements(z.elements.filter(K=>![Se(K),K.hfId,K.domId,K.id].some(be=>be&&O.has(be)))),z.clearSelectedElementIds(),z.setSelectedElementId(null),se(K=>{let j=new Map(K);for(let be of O)j.delete(be);return j}),ve(K=>{let j=new Map(K);for(let be of O)j.delete(be);return j}),ao(E,"soft");let V=Da(w);if(V){let K=V.getTime();V.seek(K),z.setCurrentTime(V.getTime()),z.setIsPlaying(V.isPlaying())}Ie("editor.layer-delete-soft",{elementKey:Se(b),patched:I,refreshed:L}),(!I||!L)&&T(K=>K+1)},[Me,ao,pr,T,u]);(0,S.useEffect)(()=>{let b=E=>{let w=E.target;if(!(w instanceof HTMLInputElement||w instanceof HTMLTextAreaElement||w instanceof HTMLSelectElement||w instanceof HTMLElement&&w.isContentEditable)){if((E.metaKey||E.ctrlKey)&&!E.altKey&&E.key.toLowerCase()==="z"){E.preventDefault(),E.shiftKey?Uc():_f();return}if((E.metaKey||E.ctrlKey)&&!E.altKey&&!E.shiftKey&&E.key.toLowerCase()==="y"){E.preventDefault(),Uc();return}if((E.metaKey||E.ctrlKey)&&E.key.toLowerCase()==="g"){E.preventDefault(),E.shiftKey?Z_():Q_();return}if(E.key==="Delete"||E.key==="Backspace"){let I=u.getState(),L=new Set([...I.selectedElementId?[I.selectedElementId]:[],...Array.from(I.selectedElementIds)]);if(L.size===0)return;let O=I.elements.filter(z=>L.has(Se(z)));if(O.length===0)return;E.preventDefault();for(let z of O)z.hfId!=="source-video"&&vf(z)}}};return window.addEventListener("keydown",b),()=>window.removeEventListener("keydown",b)},[vf,Q_,Uc,_f,Z_,u]);let Fc=(0,S.useCallback)((b,E)=>{navigator.clipboard?.writeText(b).then(()=>{Ie("editor.clipboard-copy",{label:E,value:b})}).catch(w=>{dr("editor.clipboard-copy-failed",{label:E,error:w instanceof Error?w.message:w})})},[]),Gk=(0,S.useCallback)(b=>{Fc(Ys(b),"timestamp")},[Fc]),pP=(0,S.useCallback)(b=>{Fc(`time=${Ys(b.time)} track=${b.track??"none"}`,"timeline-coordinates")},[Fc]),mP=(0,S.useCallback)(b=>{Fc(`x=${He(b.x)} y=${He(b.y)} width=${He(b.width)} height=${He(b.height)}`,"preview-coordinates")},[Fc]),gP=(0,S.useMemo)(()=>new Map(cg.map(b=>[b.id,b])),[cg]),hP=(0,S.useCallback)(()=>{let b=u.getState();b.setSelectedElementId(null),b.clearSelectedElementIds()},[u]);function bP(b,E){let w=gP.get(b.hfId??b.domId??b.id),I=O_(h.current,b),L=_4(h.current,b),O=I??w?.kind??(b.tag==="audio"?"audio":b.tag==="video"?"video":"layer"),z=b.label??w?.label??b.id,V=Se(b),K=G_.has(V);return(0,f.jsxs)("div",{"data-clip":"true",className:`native-clip-label ${K?"multi-selected":""}`,onPointerDown:j=>{(j.shiftKey||j.metaKey||j.ctrlKey)&&j.stopPropagation()},onClick:j=>{if(!(j.shiftKey||j.metaKey||j.ctrlKey))return;j.preventDefault(),j.stopPropagation();let be=u.getState();be.selectedElementId?(be.selectedElementId,be.toggleSelectedElementId(V)):be.setSelectedElementId(V),Ie("editor.timeline-multi-select",{elementKey:V,selected:Array.from(u.getState().selectedElementIds)})},children:[(0,f.jsx)("span",{className:"native-clip-trim-hit start","aria-label":"Trim clip start",onPointerDown:j=>J_(b,"trim-start",j),onClick:j=>{j.preventDefault(),j.stopPropagation()}}),(0,f.jsx)("span",{className:"native-clip-drag-hit","aria-label":"Move clip",onPointerDown:j=>J_(b,"move",j),onClick:j=>{j.preventDefault(),j.stopPropagation()}}),(0,f.jsx)("span",{className:"native-clip-trim-hit end","aria-label":"Trim clip end",onPointerDown:j=>J_(b,"trim-end",j),onClick:j=>{j.preventDefault(),j.stopPropagation()}}),(0,f.jsx)("span",{className:`native-clip-thumb ${O}`,children:VJ(O,L==="html"?"html":w?.customHtml)}),(0,f.jsx)("strong",{style:{color:E.label},children:z}),(0,f.jsxs)("small",{children:["L",b.track," \xB7 drag / edge trim"]}),K&&(0,f.jsx)("em",{children:"SEL"})]})}let Ba=(0,S.useRef)({url:null,title:null,status:null,renderId:null}),ev=(0,S.useRef)(null),tv=(0,S.useRef)(Mk);tv.current=Mk;let nv=(0,S.useRef)(Ng);nv.current=Ng,(0,S.useEffect)(()=>{let b=pe.filter(E=>E.state.phase==="succeeded"&&E.state.outputUrl);if(b.length){let E=b.reduce((w,I)=>I.startedAt>w.startedAt?I:w);Ba.current={url:E.state.outputUrl??null,title:E.state.title??null,status:E.state.status??"SUCCEEDED",renderId:E.state.renderId??null};for(let w of b){let I=w.state.renderId??w.localId;Le.current.has(I)||(Le.current.add(I),MQ({url:w.state.outputUrl,title:w.state.title??null,renderId:w.state.renderId??null}))}return}et?.status&&(Ba.current={...Ba.current,status:et.status})},[pe,et?.status]);let $k=(0,S.useRef)(null);(0,S.useEffect)(()=>{if(!o||$k.current===o)return;$k.current=o;let b=!1;return(async()=>{try{let E=await fetch(`/api/v1/compositions/${encodeURIComponent(o)}/versions?limit=25`);if(!E.ok)return;let w=await E.json().catch(()=>null),L=(Array.isArray(w?.versions)?w.versions:[]).filter(O=>typeof O.render_job_id=="string"&&O.render_job_id.length>0).map(O=>({version:Number(O.version),renderJobId:O.render_job_id})).filter(O=>Number.isFinite(O.version)).sort((O,z)=>z.version-O.version).slice(0,5);for(let O of L){if(b)return;let z=await fetch(`/api/v1/compositions/${encodeURIComponent(o)}/renders/${encodeURIComponent(O.renderJobId)}`);if(!z.ok)continue;let V=await z.json().catch(()=>({}));if(b)return;if(V?.status==="SUCCEEDED"&&typeof V.outputUrl=="string"&&V.outputUrl){if(Ba.current.url&&Ba.current.renderId===V.renderId)return;Ba.current={url:V.outputUrl,title:V.title??n.title??null,status:V.status,renderId:V.renderId??O.renderJobId};return}}}catch{}})(),()=>{b=!0}},[o,n.title]);let qi=(0,S.useRef)({compositionHtmlRef:h,patchCompositionHtml:Ho,draftedElements:Ur,selectedElementId:Ac,composition:n,activeCompositionDuration:p,startExport:()=>{nv.current()},isExportInFlight:()=>tv.current,getLastExport:()=>Ba.current,getCast:()=>ev.current,forkComposition:b=>{yg(b).catch(()=>{})}});(0,S.useEffect)(()=>{qi.current={compositionHtmlRef:h,patchCompositionHtml:Ho,draftedElements:Ur,selectedElementId:Ac,composition:n,activeCompositionDuration:p,startExport:()=>{nv.current()},isExportInFlight:()=>tv.current,getLastExport:()=>Ba.current,getCast:()=>ev.current,forkComposition:b=>{yg(b).catch(()=>{})}}}),(0,S.useEffect)(()=>(df.current={getSnapshot:()=>j6(qi.current),applyAction:b=>K1(b,qi.current)},typeof window<"u"&&(window.__vidfarmEditorAction={apply:b=>{let E=N4(b);if(!E)return{ok:!1,error:"Not a recognized editor_action."};try{let w=K1(E,qi.current);return ok({action_type:E.action_type,layer_key:E.layer_key,ok:w.ok,error:w.ok?void 0:w.error,summary:w.ok?w.summary:void 0}),w}catch(w){let I=w instanceof Error?w.message:String(w);return ok({action_type:E.action_type,layer_key:E.layer_key,ok:!1,error:I}),{ok:!1,error:I}}},getSnapshot:()=>j6(qi.current),getCompositionHtml:()=>qi.current.compositionHtmlRef.current}),()=>{df.current=null,typeof window<"u"&&delete window.__vidfarmEditorAction}),[]),(0,S.useEffect)(()=>{let b=!1,E=async()=>{let w=h.current;if(!w||!w.includes('data-vf-gen-status="generating"'))return;let I=new DOMParser().parseFromString(w,"text/html"),L=Array.from(I.querySelectorAll('[data-vf-gen-status="generating"][data-vf-gen-job]'));for(let O of L){if(b)return;let z=O.getAttribute("data-hf-id")||O.id,V=O.getAttribute("data-vf-gen-job");if(!(!z||!V))try{let K=await fetch(`/api/v1/user/me/jobs/${encodeURIComponent(V)}`);if(!K.ok)continue;let j=await K.json().catch(()=>null);if(!j)continue;let be=JQ(j);if(be){QQ(qi.current,z,be);continue}let ye=typeof j.status=="string"?j.status:"";if(ye==="failed"||ye==="cancelled"){let Ee=typeof j.error=="string"&&j.error?j.error:`generation ${ye}`;sg(qi.current,z,ct=>{ct.setAttribute("data-vf-gen-status","error"),ct.setAttribute("data-vf-gen-error",Ee.slice(0,200))})}}catch{}}};return(async()=>{for(;!b;){if(await new Promise(w=>setTimeout(w,6e3)),b)return;await E()}})(),()=>{b=!0}},[]);let yP=(0,S.useCallback)((b,E)=>{dr("editor.timeline-edit-blocked",{elementKey:Se(b),intent:E,tag:b.tag,timingSource:b.timingSource,timelineLocked:b.timelineLocked})},[]),_P=(0,S.useCallback)(b=>{let E=u.getState();E.setSelectedElementId(b?Se(b):null),E.clearSelectedElementIds()},[u]),vP=(0,S.useCallback)(()=>F(null),[]),SP=(0,S.useCallback)(()=>X(null),[]),EP=(0,S.useCallback)(()=>Je(null),[]),jk=(0,S.useCallback)(()=>{Je(null),it(!0)},[]),TP=(0,S.useCallback)(b=>{it(!1),Je(b)},[]),qk=(0,S.useCallback)(b=>zc("text",b),[zc]),Vk=(0,S.useCallback)((b,E="video")=>zc("media",b,E),[zc]),Wk=(0,S.useCallback)(b=>zc("captions",b),[zc]),Yk=(0,S.useCallback)(b=>{R.current={time:Number.isFinite(b.time)?b.time:u.getState().currentTime,frame:b.frame};let E=G.current;E&&(E.value="",E.click())},[u]),wP=(0,S.useCallback)(async b=>{let E=b.target.files?.[0]??null;if(b.target.value="",!E)return;let w=R.current??{time:u.getState().currentTime};R.current=null;let I=E4(E);if(!I){$(`Unsupported file type: ${E.type||E.name}`),window.setTimeout(()=>$(null),4e3);return}io.current?.(),$(`Uploading ${E.name}\u2026`);try{let{url:L}=await _k(E),O=`element_${I}_${Date.now().toString(36)}${Math.floor(Math.random()*1e3).toString(36)}`,z=w.frame,V={action_type:"add_layer",kind:I,src:L,start:w.time,layer_key:O,label:E.name,note:"Uploaded from computer"};if(I!=="audio"){let be=z??{x:12,y:18,width:54,height:32};V.x=be.x,V.y=be.y,V.width=be.width,V.height=be.height}let K=K1(V,qi.current);if(!K.ok){$(K.error??"Could not add the uploaded media."),window.setTimeout(()=>$(null),5e3);return}let j=u.getState();j.setSelectedElementId(O),j.clearSelectedElementIds(),$(null)}catch(L){$(L instanceof Error?L.message:"Upload failed."),window.setTimeout(()=>$(null),5e3)}},[u]),xP=(0,f.jsxs)("div",{className:"preview-pane",children:[(0,f.jsxs)("div",{className:"player-stage",ref:gf,onPointerDown:Q4,onContextMenu:J4,children:[(0,f.jsxs)("div",{className:`source-watermark source-titlebar ${H4?"playing":""}`,children:[(0,f.jsx)("span",{children:"Studio"}),(0,f.jsx)("strong",{children:n.title})]}),x?(0,f.jsx)(s,{ref:b=>{ce.current=b,vg.current=d(b)},directUrl:Tk,onLoad:()=>{F4(),nP(),oP(),Xs()?.liveReload&&o&&!bg.current&&(bg.current=!0,W_(h.current))},portrait:!0,suppressLoadingOverlay:!0},Tk):(0,f.jsx)("section",{className:"editor-loading-shell","aria-label":"Composition loading",children:(0,f.jsx)("span",{children:"Loading composition"})}),(0,f.jsx)(RQ,{selected:In,html:g,visualFrameDraft:Ck,stageRef:gf,getIframe:Me,onStageFrame:Ag,onCommitDrag:sP})]}),(0,f.jsx)(aQ,{disabled:!xk,speedDraft:M,onSpeedDraftChange:k,onCommitSpeed:yf,onSeek:Pr,onTogglePlay:cP,onUndo:_f,onRedo:Uc,canUndo:V4,canRedo:W4,usePlayerStore:u,onOpenUploadMedia:()=>ge(b=>!b),uploadMediaActive:oe})]});return(0,f.jsxs)("section",{className:"studio-shell","aria-label":"Video editor output","data-m-preview":an.preview?"true":"false","data-m-inspector":an.inspector?"true":"false","data-m-timeline":an.timeline?"true":"false",children:[we&&!we.dismissed&&(0,f.jsx)(EQ,{mode:we.mode,busy:we.busy,finished:we.finished,error:we.error,scenesCreated:we.scenesCreated,ghostcutStatus:we.ghostcutStatus,ghostcutProgress:we.ghostcutProgress,userPrompt:we.userPrompt,onUserPromptChange:b=>tt(E=>E&&{...E,userPrompt:b}),onDecompose:kc,onFinish:F_,onCancel:we.mode==="redo"?Ek:void 0,onDismiss:we.mode==="initial"?M4:void 0}),H_&&(0,f.jsx)(TQ,{busy:H_.busy,error:H_.error,onCreate:L4,onCancel:()=>_g(null)}),vn&&o&&(0,f.jsx)(wQ,{forkId:o,templateId:n.templateId??n.id,onClose:()=>An(!1)}),Te&&o&&(0,f.jsx)(xQ,{forkId:o,templateId:n.templateId??n.id,currentVersion:$e,onClose:()=>We(!1),onReverted:z4}),(0,f.jsxs)("section",{className:"studio-main",ref:mf,children:[(0,f.jsxs)("button",{type:"button",className:"mobile-panel-toggle","aria-expanded":an.preview,onClick:()=>Ve("preview"),children:["Video Preview",(0,f.jsx)("svg",{viewBox:"0 0 20 20","aria-hidden":"true",focusable:"false",children:(0,f.jsx)("path",{d:"m5 8 5 5 5-5"})})]}),xP,(0,f.jsxs)("button",{type:"button",className:"mobile-panel-toggle","aria-expanded":an.inspector,onClick:()=>Ve("inspector"),children:["Edit Panel",(0,f.jsx)("svg",{viewBox:"0 0 20 20","aria-hidden":"true",focusable:"false",children:(0,f.jsx)("path",{d:"m5 8 5 5 5-5"})})]}),oe?(0,f.jsx)(DQ,{onClose:()=>ge(!1),onInsertMedia:Ce}):(0,f.jsx)(CQ,{composition:y,selected:In,html:g,onPatchHtml:Ho,onPatchLiveElement:zk,onPreviewLiveElement:rP,onUnselect:hP,onDraftStateChange:iP,onStageTimelineDraft:ji,onStageVisualFrameDraft:Ag,timelineDraft:q4,visualFrameDraft:Ck,onClearTimelineDraft:X_,onClearVisualFrameDraft:K_,onDiscardVisualFrameDraft:aP,onDiscardTimelineDraft:lP,onDelete:vf,maxDuration:p,onPublish:()=>Ng(),publishOptions:K4,onPublishOption:b=>Ng(b==="cloud"?"cloud":"local"),publishDisabled:!1,publishLabel:Y4,templateId:n.templateId??null,forkId:o,publishVersion:et?.version??$e,originalUrl:n.originalUrl??null,songName:n.songName??null,songUrl:n.songUrl??null,onOpenShare:P4,onOpenDecompose:U4,onOpenNewFork:D4,onOpenHistory:B4,renderActiveCount:dt,renderTotalCount:pe.length,onOpenRenderHistory:jk,decomposeDismissed:!!we?.dismissed,decomposeBusy:!!we?.busy,onResumeDecompose:O4})]}),(0,f.jsxs)("button",{type:"button",className:"mobile-panel-toggle","aria-expanded":an.timeline,onClick:()=>Ve("timeline"),children:["Trackpad",(0,f.jsx)("svg",{viewBox:"0 0 20 20","aria-hidden":"true",focusable:"false",children:(0,f.jsx)("path",{d:"m5 8 5 5 5-5"})})]}),(0,f.jsxs)("section",{className:"native-timeline",ref:Hi,onPointerDownCapture:Z4,onClickCapture:eP,onContextMenuCapture:tP,children:[(0,f.jsx)(l,{onSeek:Pr,onMoveElement:uP,onResizeElement:dP,onBlockedEditAttempt:yP,onSplitElement:Hk,onDeleteElement:vf,onSelectElement:_P,renderClipContent:bP,theme:IJ}),Nc&&(0,f.jsx)("div",{className:"timeline-layer-numbers","aria-hidden":"true",style:{left:-Ak},children:Sg.map((b,E)=>(0,f.jsxs)("span",{className:"timeline-layer-number",style:{top:E*T_+2-kk},children:["L",b]},b))}),Nc&&Nk>0&&$_.length>0&&(0,f.jsx)("div",{className:"timeline-transition-chips",children:$_.map(b=>{let E=b.kind==="in"?10:b.kind==="out"?-10:0,w=b.time*Nk+E_-Ak+E,I=b.rowIndex*T_+B1-kk+T_/2,L=b.kind==="junction"?"Transition":b.kind==="in"?"Transition in":"Transition out",O=b.preset?(b.kind==="out"?ak:ik).find(z=>z.value===b.preset)?.label??b.preset:null;return(0,f.jsx)("button",{type:"button",className:`timeline-transition-chip${b.preset?" set":""}`,style:{left:w,top:I},title:O?`${L}: ${O} \xB7 ${b.duration}s`:`Add ${L.toLowerCase()}`,onClick:z=>{z.stopPropagation(),Rk({chipKey:b.key,x:z.clientX,y:z.clientY})},children:b.kind==="junction"?(0,f.jsxs)("svg",{viewBox:"0 0 18 18","aria-hidden":"true",children:[(0,f.jsx)("path",{d:"M3.5 4.5 L8.2 9 L3.5 13.5 Z"}),(0,f.jsx)("path",{d:"M14.5 4.5 L9.8 9 L14.5 13.5 Z"})]}):b.kind==="in"?(0,f.jsxs)("svg",{viewBox:"0 0 18 18","aria-hidden":"true",children:[(0,f.jsx)("path",{d:"M4.5 4.5 L11 9 L4.5 13.5 Z"}),(0,f.jsx)("rect",{x:"12.6",y:"4.5",width:"1.9",height:"9",rx:"0.9"})]}):(0,f.jsxs)("svg",{viewBox:"0 0 18 18","aria-hidden":"true",children:[(0,f.jsx)("rect",{x:"3.5",y:"4.5",width:"1.9",height:"9",rx:"0.9"}),(0,f.jsx)("path",{d:"M13.5 4.5 L7 9 L13.5 13.5 Z"})]})},b.key)})}),j_&&bf&&(0,f.jsx)(uQ,{chip:j_,x:bf.x,y:bf.y,onClose:()=>Rk(null),onApply:(b,E)=>{let w=j_;zk(w.element,I=>{w.kind==="out"?Ec(I,b,E):Qs(I,b,E),Q1(I)})}}),P&&(0,f.jsx)(dQ,{state:P,usePlayerStore:u,canGroup:Eg.size>=2,canUngroup:X4,onClose:vP,onSeek:Pr,onSplit:Hk,onInsertLayer:fP,onInsertText:qk,onInsertCaptions:Wk,onInsertMedia:Vk,onUploadMedia:Yk,onCopyTimestamp:Gk,onCopyCoordinates:pP,onGroup:Q_,onUngroup:Z_,onDelete:vf})]}),U&&(0,f.jsx)(fQ,{state:U,onClose:SP,onInsertText:qk,onInsertCaptions:Wk,onInsertMedia:Vk,onUploadMedia:Yk,onCopyTimestamp:Gk,onCopyCoordinates:mP}),(0,f.jsx)("input",{ref:G,type:"file",accept:"video/*,image/*,audio/*",style:{display:"none"},onChange:wP}),C&&(0,f.jsx)("div",{className:"editor-upload-toast",role:"status",children:C}),ee&&(0,f.jsxs)("div",{className:"editor-save-error-banner",role:"alert",children:[(0,f.jsx)("span",{children:ee}),(0,f.jsx)("button",{type:"button",onClick:()=>B(null),"aria-label":"Dismiss",children:"\xD7"})]}),pe.filter(b=>b.state.phase==="running"&&b.state.renderId&&b.forkId).map(b=>(0,f.jsx)(mQ,{forkId:b.forkId,renderId:b.state.renderId,fallbackTitle:b.state.title,onUpdate:E=>me(b.localId,E)},b.localId)),et&&De&&(0,f.jsx)(pQ,{state:et,forkId:De.forkId??o,onClose:EP,onViewAllRenders:jk,otherRenderCount:Math.max(0,pe.length-1)}),Kt&&(0,f.jsx)(gQ,{renders:pe,onClose:()=>it(!1),onOpen:TP})]})}function Xs(){if(typeof window>"u")return null;let e=window.__HF_BOOT__;if(e&&typeof e=="object"&&!Array.isArray(e))return V6(e);if(typeof document<"u"){let t=document.getElementById("hf-boot");if(t&&t.textContent)try{let n=JSON.parse(t.textContent);if(n&&typeof n=="object"&&!Array.isArray(n))return V6(n)}catch{}}return null}function V6(e){let t=typeof e.compositionId=="string"?e.compositionId:null;return t?{compositionId:t,draftPath:typeof e.draftPath=="string"?e.draftPath:void 0,slugId:typeof e.slugId=="string"?e.slugId:void 0,templateId:typeof e.templateId=="string"?e.templateId:null,title:typeof e.title=="string"?e.title:void 0,lambdaMemoryMb:typeof e.lambdaMemoryMb=="number"?e.lambdaMemoryMb:void 0,apiBase:typeof e.apiBase=="string"?e.apiBase:void 0,editorChatApiUrl:typeof e.editorChatApiUrl=="string"?e.editorChatApiUrl:null,vidfarmApiKey:typeof e.vidfarmApiKey=="string"?e.vidfarmApiKey:null,originalUrl:typeof e.originalUrl=="string"?e.originalUrl:null,songName:typeof e.songName=="string"?e.songName:null,songUrl:typeof e.songUrl=="string"?e.songUrl:null,origin:e.origin==="raw"||e.origin==="inspiration"?e.origin:null,localRender:e.localRender===!0,cloudRenderAvailable:e.cloudRenderAvailable===!0,initialThreadId:typeof e.initialThreadId=="string"?e.initialThreadId:null,liveReload:e.liveReload===!0}:null}function hZ(e){if(!e)return ug[0];let t=ug.find(n=>n.id===e.compositionId);return t?{...t,templateId:e.templateId??t.templateId??null,originalUrl:e.originalUrl??t.originalUrl??null,songName:e.songName??t.songName??null,songUrl:e.songUrl??t.songUrl??null,origin:e.origin??t.origin??null}:{id:e.compositionId,eyebrow:"TEMPLATE",title:e.title??e.compositionId,sourceFolder:"",sourceType:"video",duration:12,width:720,height:1280,summary:"Template composition.",media:{type:"video",src:""},templateId:e.templateId??e.compositionId,originalUrl:e.originalUrl??null,songName:e.songName??null,songUrl:e.songUrl??null,origin:e.origin??null,viralDna:{hook:"",retention:"",payoff:"",preserve:[],avoid:[]},layers:[],editable:!0}}function R4({boot:e}={}){let t=(0,S.useMemo)(()=>hZ(e),[e]),n=!!e,[r,o]=(0,S.useState)(n?"edit":"preview"),[i,a]=(0,S.useState)(!1),[s,l]=(0,S.useState)(!1),[c,d]=(0,S.useState)(t);(0,S.useEffect)(()=>{let m=RJ(),p=n?()=>{}:CJ();return()=>{m(),p()}},[n]),(0,S.useEffect)(()=>{Ie("app.view-mode",{viewMode:r})},[r]);let u=r==="preview"?(0,f.jsx)("section",{className:"markdown-preview-shell","aria-label":"Preview output",children:(0,f.jsx)(pZ,{onEdit:m=>{d(m),Ie("app.mode-change-request",{from:"preview",to:"edit",id:m.id}),o("edit")}})}):(0,f.jsx)(mZ,{composition:c,onPreview:()=>{if(n){Ie("app.mode-change-request",{from:"edit",to:"discover",boot:!0}),typeof window<"u"&&(window.location.href="/discover");return}Ie("app.mode-change-request",{from:"edit",to:"preview"}),o("preview")}},c.id);return(0,f.jsxs)("main",{className:"vidfarm-workbench","data-chat-open":i?"true":"false","data-chat-expanded":s?"true":"false",children:[(0,f.jsxs)("div",{className:"chat-dock",children:[(0,f.jsxs)("div",{className:"chat-dock-controls",children:[(0,f.jsx)("button",{type:"button",className:"chat-dock-expand","aria-label":s?"Shrink chat":"Expand chat","aria-pressed":s,onClick:()=>l(m=>!m),children:s?(0,f.jsxs)("svg",{viewBox:"0 0 20 20","aria-hidden":"true",focusable:"false",children:[(0,f.jsx)("path",{d:"M16.5 8.5h-5v-5"}),(0,f.jsx)("path",{d:"M11.5 8.5 17 3"}),(0,f.jsx)("path",{d:"M3.5 11.5h5v5"}),(0,f.jsx)("path",{d:"M8.5 11.5 3 17"})]}):(0,f.jsxs)("svg",{viewBox:"0 0 20 20","aria-hidden":"true",focusable:"false",children:[(0,f.jsx)("path",{d:"M11.5 3.5h5v5"}),(0,f.jsx)("path",{d:"M16.5 3.5 11 9"}),(0,f.jsx)("path",{d:"M8.5 16.5h-5v-5"}),(0,f.jsx)("path",{d:"M3.5 16.5 9 11"})]})}),(0,f.jsx)("button",{type:"button",className:"chat-dock-minimize","aria-label":"Minimize chat",onClick:()=>a(!1),children:"\xD7"})]}),(0,f.jsx)(PQ,{boot:e??null,composition:c})]}),(0,f.jsx)("button",{type:"button",className:"chat-dock-fab","aria-label":"Open chat","aria-expanded":i,onClick:()=>{l(!1),a(!0)},children:(0,f.jsx)("svg",{viewBox:"0 0 24 24","aria-hidden":"true",focusable:"false",children:(0,f.jsx)("path",{d:"M20 11.5a7.5 7.5 0 0 1-9.8 7.1L4 20l1.5-5.3A7.5 7.5 0 1 1 20 11.5Z"})})}),(0,f.jsx)("section",{className:"editor-output",children:(0,f.jsx)(Z1,{children:u})})]})}var nl=so(Cg(),1);S6();Ie("boot.entry-loaded");var Sk=document.getElementById("root");if(!Sk){Po("boot.root-missing");let e=new Error("Missing #root element");throw pa(e),e}var pf=Xs();Ie("boot.config-resolved",pf??{source:"none"});pf?.templateId&&yd.setTag("hyperframes.template_id",pf.templateId);pf?.compositionId&&yd.setTag("hyperframes.composition_id",pf.compositionId);function bZ(){return(0,nl.jsxs)("section",{style:{display:"grid",placeItems:"center",height:"100vh",padding:"24px",textAlign:"center",gap:"12px",color:"#fffbe6",background:"#050604"},children:[(0,nl.jsx)("strong",{style:{fontSize:"0.72rem",letterSpacing:"0.14em",textTransform:"uppercase"},children:"Editor crashed"}),(0,nl.jsx)("span",{style:{fontSize:"0.92rem",opacity:.75},children:"Something went wrong loading the editor. Reload the page to try again."})]})}try{Ie("boot.render-start",{rootChildren:Sk.childNodes.length}),(0,C4.createRoot)(Sk).render((0,nl.jsx)(yd.ErrorBoundary,{fallback:(0,nl.jsx)(bZ,{}),onError:e=>Po("boot.render-error",e instanceof Error?e.stack:e),children:(0,nl.jsx)(R4,{boot:pf})})),Ie("boot.render-called")}catch(e){throw Po("boot.render-error",e instanceof Error?e.stack:e),pa(e),e}
1824
- /*! Bundled license information:
1825
-
1826
- scheduler/cjs/scheduler.production.js:
1827
- (**
1828
- * @license React
1829
- * scheduler.production.js
1830
- *
1831
- * Copyright (c) Meta Platforms, Inc. and affiliates.
1832
- *
1833
- * This source code is licensed under the MIT license found in the
1834
- * LICENSE file in the root directory of this source tree.
1835
- *)
1836
-
1837
- react-dom/cjs/react-dom-client.production.js:
1838
- (**
1839
- * @license React
1840
- * react-dom-client.production.js
1841
- *
1842
- * Copyright (c) Meta Platforms, Inc. and affiliates.
1843
- *
1844
- * This source code is licensed under the MIT license found in the
1845
- * LICENSE file in the root directory of this source tree.
1846
- *)
1847
-
1848
- @sentry/core/build/esm/utils/env.js:
1849
- (*! __SENTRY_SDK_SOURCE__ *)
1850
- */