import{i as s}from"./url-CoyBb3Dp.js";import"./jwt-decode.esm-Dca5fHH5.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]="6cf8ec1c-5622-4b2f-86cc-ff29c5918cfc",e._sentryDebugIdIdentifier="sentry-dbid-6cf8ec1c-5622-4b2f-86cc-ff29c5918cfc")}catch{}})();function n(e){return e.startsWith("/")?e.slice(1):e}function f(e,r,c={}){if(s(r)){const t=new URL(r),a=new URLSearchParams(c),i=new URLSearchParams(t.search),o=new URLSearchParams([...i,...a]);return t.search=o.toString(),{action:"REPLACE_LOCAL_HREF",newHref:t.toString()}}else{const t=r.replace(/\/$/,"");if(e==="player")return{action:"GOTO_FORM_PLAYER",path:n(t),queryParams:c};if(e==="editor")return{action:"GOTO_FORM_EDITOR",path:n(t),queryParams:c};if(e==="preview")return{action:"GOTO_FORM_PLAYER",path:n(t),queryParams:c};throw new Error(`Invalid routing ${e}`)}}async function w(e,r,c,t={}){const a=f(e,c,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-DfjkTFaH.js.map
