import{i as c}from"./url.f92805c8.js";import"./index.f8cd7fc7.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},r=new Error().stack;r&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[r]="d3d474e3-df9f-42e1-8265-670e65c2b9be",e._sentryDebugIdIdentifier="sentry-dbid-d3d474e3-df9f-42e1-8265-670e65c2b9be")}catch{}})();function i(e){return e.startsWith("/")?e.slice(1):e}function f(e,r,n={}){if(c(r)){const t=new URL(r),a=new URLSearchParams(n),o=new URLSearchParams(t.search),s=new URLSearchParams([...o,...a]);return t.search=s.toString(),{action:"REPLACE_LOCAL_HREF",newHref:t.toString()}}else{const t=r.replace(/\/$/,"");if(e==="player")return{action:"GOTO_FORM_PLAYER",path:i(t),queryParams:n};if(e==="editor")return{action:"GOTO_FORM_EDITOR",path:i(t),queryParams:n};if(e==="preview")return{action:"GOTO_FORM_PLAYER",path:i(t),queryParams:n};throw new Error(`Invalid routing ${e}`)}}async function w(e,r,n,t={}){const a=f(e,n,t);switch(a.action){case"REPLACE_LOCAL_HREF":window.location.href=a.newHref;break;case"GOTO_FORM_EDITOR":await r.push({name:"formEditor",params:{formPath:a.path},query:a.queryParams});break;case"GOTO_FORM_PLAYER":await r.push({name:e==="preview"?"formPreview":"formPlayer",params:{formPath:a.path},query:a.queryParams});break;default:throw new Error("Invalid routing")}}export{w as r};
//# sourceMappingURL=redirect.8814a686.js.map
