/**
 * Minified by jsDelivr using Terser v5.39.0.
 * Original file: /npm/backbone-named-routes@2.0.4/src/router.js
 *
 * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files
 */
!function(t,e){"function"==typeof define&&define.amd?define(["jquery","backbone","underscore"],e):"object"==typeof module&&module.exports?module.exports=e(require("jquery"),require("backbone"),require("underscore")):t.BackboneNamedRouter=e(t.jQuery,t.Backbone,t._)}(this,(function(t,e,o){var r=/\((.*?)\)|(\(\?)?:\w+|\*\w+/g,n=/\((.*?)\)/g,i=/\:\w+/,s=/\(|\)/g,u=/\:\w+|\*\w+/,a=/\/$/,c=function(t){return t?t.replace(a,""):""},h=function(t,e){return t.substr(0,e.length)===e},p=e.Router.extend({constructor:function(t){this.options=o.extend({baseUrl:"undefined"!=typeof window?window.location.protocol+"//"+window.location.host:"",usesPushState:!1,root:""},t),e.Router.apply(this,arguments)},getHistoryStartParams:function(t){return o.extend({pushState:this.options.usesPushState,root:this.options.root},t)},route:function(t,o,r){this.namedRoutes=this.namedRoutes||{},this.namedRoutes[o]=t,e.Router.prototype.route.apply(this,arguments)},url:function(e,o,a){var h=this.namedRoutes[e],p=this.options.baseUrl,l=this.options.usesPushState,d=this.options.root,f="";if(void 0===h)throw new Error('Route "'+e+'" is not defined');return 0===h.length?f=p+c(d):(h=h.replace(r,(function(t){var r=t.match(u)[0].slice(1),a=o[r],c=void 0!==a;if(t.match(n))return c?t.replace(s,"").replace(i,a):"";if(c)return a;throw new Error('Required route parameter "'+r+'" for route "'+e+'" is missing')})),f=l?p+d+h:p+c(d)+"#"+h),a&&(f+="?"+t.param(a)),f},navigateToUrl:function(o,r){var n=o instanceof t?o.attr("href"):o,i=this.options.baseUrl,s=this.options.usesPushState,u=c(this.options.root);h(n,i)&&(n=n.replace(i,"")),h(n,u)&&(n=n.replace(u,"")),h(n,"/")&&(n=n.slice(1)),!s&&h(n,"#")&&(n=n.slice(1)),r&&n===e.history.fragment?e.history.loadUrl(n):this.navigate(n,{trigger:Boolean(r)})},navigateToRoute:function(t,e,o,r){this.navigateToUrl(this.url(t,e,o),r)}});return p}));
//# sourceMappingURL=/sm/4f265fc0acded406b7e5dc816036f99dd2760b80a810c2c17b62a5b3857197aa.map