"use strict";var __create=Object.create;var __defProp=Object.defineProperty;var __getOwnPropDesc=Object.getOwnPropertyDescriptor;var __getOwnPropNames=Object.getOwnPropertyNames;var __getProtoOf=Object.getPrototypeOf,__hasOwnProp=Object.prototype.hasOwnProperty;var __export=(target,all)=>{for(var name in all)__defProp(target,name,{get:all[name],enumerable:!0})},__copyProps=(to,from,except,desc)=>{if(from&&typeof from=="object"||typeof from=="function")for(let key of __getOwnPropNames(from))!__hasOwnProp.call(to,key)&&key!==except&&__defProp(to,key,{get:()=>from[key],enumerable:!(desc=__getOwnPropDesc(from,key))||desc.enumerable});return to};var __toESM=(mod,isNodeMode,target)=>(target=mod!=null?__create(__getProtoOf(mod)):{},__copyProps(isNodeMode||!mod||!mod.__esModule?__defProp(target,"default",{value:mod,enumerable:!0}):target,mod)),__toCommonJS=mod=>__copyProps(__defProp({},"__esModule",{value:!0}),mod);var next_swc_loader_patch_exports={};__export(next_swc_loader_patch_exports,{default:()=>swcLoader,pitch:()=>pitch,raw:()=>raw});module.exports=__toCommonJS(next_swc_loader_patch_exports);var import_swc=require("next/dist/build/swc"),import_options=require("next/dist/build/swc/options"),import_path=__toESM(require("path")),mockCurrentTraceSpan={traceChild:name=>mockCurrentTraceSpan,traceAsyncFn:async fn=>fn()};async function loaderTransform(parentTrace,source,inputSourceMap){var _a,_b,_c;let filename=this.resourcePath,loaderOptions=this.getOptions()||{},{isServer,rootDir,pagesDir,appDir,hasReactRefresh,nextConfig,jsConfig,supportedBrowsers,swcCacheDir,serverComponents,isReactServerLayer}=loaderOptions,isPageFile=filename.startsWith(pagesDir),relativeFilePathFromRoot=import_path.default.relative(rootDir,filename),programmaticOptions={...(0,import_options.getLoaderSWCOptions)({pagesDir,appDir,filename,isServer,isPageFile,development:this.mode==="development",hasReactRefresh,modularizeImports:nextConfig==null?void 0:nextConfig.modularizeImports,optimizePackageImports:(_a=nextConfig==null?void 0:nextConfig.experimental)==null?void 0:_a.optimizePackageImports,swcPlugins:(_b=nextConfig==null?void 0:nextConfig.experimental)==null?void 0:_b.swcPlugins,compilerOptions:nextConfig==null?void 0:nextConfig.compiler,optimizeServerReact:(_c=nextConfig==null?void 0:nextConfig.experimental)==null?void 0:_c.optimizeServerReact,jsConfig,supportedBrowsers,swcCacheDir,relativeFilePathFromRoot,serverComponents,isReactServerLayer}),filename,inputSourceMap:inputSourceMap?JSON.stringify(inputSourceMap):void 0,sourceMaps:this.sourceMap,inlineSourcesContent:this.sourceMap,sourceFileName:filename};return programmaticOptions.inputSourceMap||delete programmaticOptions.inputSourceMap,this.mode&&programmaticOptions.jsc&&programmaticOptions.jsc.transform&&programmaticOptions.jsc.transform.react&&!Object.prototype.hasOwnProperty.call(programmaticOptions.jsc.transform.react,"development")&&(programmaticOptions.jsc.transform.react.development=this.mode==="development"),parentTrace.traceChild("next-swc-transform").traceAsyncFn(()=>(0,import_swc.transform)(source,programmaticOptions).then(output=>{if(output.eliminatedPackages&&this.eliminatedPackages)for(let pkg of JSON.parse(output.eliminatedPackages))this.eliminatedPackages.add(pkg);return[output.code,output.map?JSON.parse(output.map):void 0]}))}var EXCLUDED_PATHS=/[\\/](cache[\\/][^\\/]+\.zip[\\/]node_modules|__virtual__)[\\/]/g;function pitch(){let callback=this.async();(async()=>{if(!process.versions.pnp&&!EXCLUDED_PATHS.test(this.resourcePath)&&this.loaders.length-1===this.loaderIndex&&(0,import_path.isAbsolute)(this.resourcePath)&&!await(0,import_swc.isWasm)()){let loaderSpan=mockCurrentTraceSpan.traceChild("next-swc-loader");return this.addDependency(this.resourcePath),loaderSpan.traceAsyncFn(()=>loaderTransform.call(this,loaderSpan))}return null})().then(r=>r?callback(null,...r):(callback(),null),callback)}function sanitizeSourceMap(rawSourceMap){let{sourcesContent,...sourceMap}=rawSourceMap??{};return JSON.parse(JSON.stringify(sourceMap))}function swcLoader(inputSource,inputSourceMap){let loaderSpan=mockCurrentTraceSpan.traceChild("next-swc-loader"),callback=this.async();loaderSpan.traceAsyncFn(()=>loaderTransform.call(this,loaderSpan,inputSource,sanitizeSourceMap(inputSourceMap))).then(([transformedSource,outputSourceMap])=>{callback(null,transformedSource,outputSourceMap||inputSourceMap)},err=>{callback(err)})}var raw=!0;0&&(module.exports={pitch,raw});