webstudio 0.304.0 → 0.305.0

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.
package/lib/cli.js CHANGED
@@ -52586,6 +52586,446 @@ const assetQueryResourceConfigurationPatchInput = strictObject({
52586
52586
  output: assetQueryResourceConfigurationInput.shape.output.removeDefault().optional(),
52587
52587
  content: assetQueryResourceConfigurationInput.shape.content.removeDefault().optional()
52588
52588
  });
52589
+ /**
52590
+ * @remix-run/router v1.23.0
52591
+ *
52592
+ * Copyright (c) Remix Software Inc.
52593
+ *
52594
+ * This source code is licensed under the MIT license found in the
52595
+ * LICENSE.md file in the root directory of this source tree.
52596
+ *
52597
+ * @license MIT
52598
+ */
52599
+ function _extends$3() {
52600
+ _extends$3 = Object.assign ? Object.assign.bind() : function(target) {
52601
+ for (var i = 1; i < arguments.length; i++) {
52602
+ var source = arguments[i];
52603
+ for (var key2 in source) {
52604
+ if (Object.prototype.hasOwnProperty.call(source, key2)) {
52605
+ target[key2] = source[key2];
52606
+ }
52607
+ }
52608
+ }
52609
+ return target;
52610
+ };
52611
+ return _extends$3.apply(this, arguments);
52612
+ }
52613
+ var Action;
52614
+ (function(Action2) {
52615
+ Action2["Pop"] = "POP";
52616
+ Action2["Push"] = "PUSH";
52617
+ Action2["Replace"] = "REPLACE";
52618
+ })(Action || (Action = {}));
52619
+ function invariant$2(value2, message) {
52620
+ if (value2 === false || value2 === null || typeof value2 === "undefined") {
52621
+ throw new Error(message);
52622
+ }
52623
+ }
52624
+ function warning$2(cond, message) {
52625
+ if (!cond) {
52626
+ if (typeof console !== "undefined") console.warn(message);
52627
+ try {
52628
+ throw new Error(message);
52629
+ } catch (e2) {
52630
+ }
52631
+ }
52632
+ }
52633
+ function createPath$1(_ref) {
52634
+ let {
52635
+ pathname = "/",
52636
+ search: search2 = "",
52637
+ hash: hash2 = ""
52638
+ } = _ref;
52639
+ if (search2 && search2 !== "?") pathname += search2.charAt(0) === "?" ? search2 : "?" + search2;
52640
+ if (hash2 && hash2 !== "#") pathname += hash2.charAt(0) === "#" ? hash2 : "#" + hash2;
52641
+ return pathname;
52642
+ }
52643
+ function parsePath$1(path2) {
52644
+ let parsedPath = {};
52645
+ if (path2) {
52646
+ let hashIndex = path2.indexOf("#");
52647
+ if (hashIndex >= 0) {
52648
+ parsedPath.hash = path2.substr(hashIndex);
52649
+ path2 = path2.substr(0, hashIndex);
52650
+ }
52651
+ let searchIndex = path2.indexOf("?");
52652
+ if (searchIndex >= 0) {
52653
+ parsedPath.search = path2.substr(searchIndex);
52654
+ path2 = path2.substr(0, searchIndex);
52655
+ }
52656
+ if (path2) {
52657
+ parsedPath.pathname = path2;
52658
+ }
52659
+ }
52660
+ return parsedPath;
52661
+ }
52662
+ var ResultType;
52663
+ (function(ResultType2) {
52664
+ ResultType2["data"] = "data";
52665
+ ResultType2["deferred"] = "deferred";
52666
+ ResultType2["redirect"] = "redirect";
52667
+ ResultType2["error"] = "error";
52668
+ })(ResultType || (ResultType = {}));
52669
+ function matchRoutes$1(routes, locationArg, basename2) {
52670
+ if (basename2 === void 0) {
52671
+ basename2 = "/";
52672
+ }
52673
+ return matchRoutesImpl$1(routes, locationArg, basename2);
52674
+ }
52675
+ function matchRoutesImpl$1(routes, locationArg, basename2, allowPartial) {
52676
+ let location = typeof locationArg === "string" ? parsePath$1(locationArg) : locationArg;
52677
+ let pathname = stripBasename$1(location.pathname || "/", basename2);
52678
+ if (pathname == null) {
52679
+ return null;
52680
+ }
52681
+ let branches = flattenRoutes$1(routes);
52682
+ rankRouteBranches$1(branches);
52683
+ let matches2 = null;
52684
+ for (let i = 0; matches2 == null && i < branches.length; ++i) {
52685
+ let decoded = decodePath$1(pathname);
52686
+ matches2 = matchRouteBranch$1(branches[i], decoded);
52687
+ }
52688
+ return matches2;
52689
+ }
52690
+ function convertRouteMatchToUiMatch$1(match, loaderData) {
52691
+ let {
52692
+ route,
52693
+ pathname,
52694
+ params
52695
+ } = match;
52696
+ return {
52697
+ id: route.id,
52698
+ pathname,
52699
+ params,
52700
+ data: loaderData[route.id],
52701
+ handle: route.handle
52702
+ };
52703
+ }
52704
+ function flattenRoutes$1(routes, branches, parentsMeta, parentPath) {
52705
+ if (branches === void 0) {
52706
+ branches = [];
52707
+ }
52708
+ if (parentsMeta === void 0) {
52709
+ parentsMeta = [];
52710
+ }
52711
+ if (parentPath === void 0) {
52712
+ parentPath = "";
52713
+ }
52714
+ let flattenRoute = (route, index2, relativePath) => {
52715
+ let meta2 = {
52716
+ relativePath: relativePath === void 0 ? route.path || "" : relativePath,
52717
+ caseSensitive: route.caseSensitive === true,
52718
+ childrenIndex: index2,
52719
+ route
52720
+ };
52721
+ if (meta2.relativePath.startsWith("/")) {
52722
+ invariant$2(meta2.relativePath.startsWith(parentPath), 'Absolute route path "' + meta2.relativePath + '" nested under path ' + ('"' + parentPath + '" is not valid. An absolute child route path ') + "must start with the combined path of all its parent routes.");
52723
+ meta2.relativePath = meta2.relativePath.slice(parentPath.length);
52724
+ }
52725
+ let path2 = joinPaths$1([parentPath, meta2.relativePath]);
52726
+ let routesMeta = parentsMeta.concat(meta2);
52727
+ if (route.children && route.children.length > 0) {
52728
+ invariant$2(
52729
+ // Our types know better, but runtime JS may not!
52730
+ // @ts-expect-error
52731
+ route.index !== true,
52732
+ "Index routes must not have child routes. Please remove " + ('all child routes from route path "' + path2 + '".')
52733
+ );
52734
+ flattenRoutes$1(route.children, branches, routesMeta, path2);
52735
+ }
52736
+ if (route.path == null && !route.index) {
52737
+ return;
52738
+ }
52739
+ branches.push({
52740
+ path: path2,
52741
+ score: computeScore$1(path2, route.index),
52742
+ routesMeta
52743
+ });
52744
+ };
52745
+ routes.forEach((route, index2) => {
52746
+ var _route$path;
52747
+ if (route.path === "" || !((_route$path = route.path) != null && _route$path.includes("?"))) {
52748
+ flattenRoute(route, index2);
52749
+ } else {
52750
+ for (let exploded of explodeOptionalSegments$1(route.path)) {
52751
+ flattenRoute(route, index2, exploded);
52752
+ }
52753
+ }
52754
+ });
52755
+ return branches;
52756
+ }
52757
+ function explodeOptionalSegments$1(path2) {
52758
+ let segments = path2.split("/");
52759
+ if (segments.length === 0) return [];
52760
+ let [first, ...rest] = segments;
52761
+ let isOptional = first.endsWith("?");
52762
+ let required2 = first.replace(/\?$/, "");
52763
+ if (rest.length === 0) {
52764
+ return isOptional ? [required2, ""] : [required2];
52765
+ }
52766
+ let restExploded = explodeOptionalSegments$1(rest.join("/"));
52767
+ let result2 = [];
52768
+ result2.push(...restExploded.map((subpath) => subpath === "" ? required2 : [required2, subpath].join("/")));
52769
+ if (isOptional) {
52770
+ result2.push(...restExploded);
52771
+ }
52772
+ return result2.map((exploded) => path2.startsWith("/") && exploded === "" ? "/" : exploded);
52773
+ }
52774
+ function rankRouteBranches$1(branches) {
52775
+ branches.sort((a2, b2) => a2.score !== b2.score ? b2.score - a2.score : compareIndexes$1(a2.routesMeta.map((meta2) => meta2.childrenIndex), b2.routesMeta.map((meta2) => meta2.childrenIndex)));
52776
+ }
52777
+ const paramRe$1 = /^:[\w-]+$/;
52778
+ const dynamicSegmentValue$1 = 3;
52779
+ const indexRouteValue$1 = 2;
52780
+ const emptySegmentValue$1 = 1;
52781
+ const staticSegmentValue$1 = 10;
52782
+ const splatPenalty$1 = -2;
52783
+ const isSplat$1 = (s2) => s2 === "*";
52784
+ function computeScore$1(path2, index2) {
52785
+ let segments = path2.split("/");
52786
+ let initialScore = segments.length;
52787
+ if (segments.some(isSplat$1)) {
52788
+ initialScore += splatPenalty$1;
52789
+ }
52790
+ if (index2) {
52791
+ initialScore += indexRouteValue$1;
52792
+ }
52793
+ return segments.filter((s2) => !isSplat$1(s2)).reduce((score, segment) => score + (paramRe$1.test(segment) ? dynamicSegmentValue$1 : segment === "" ? emptySegmentValue$1 : staticSegmentValue$1), initialScore);
52794
+ }
52795
+ function compareIndexes$1(a2, b2) {
52796
+ let siblings2 = a2.length === b2.length && a2.slice(0, -1).every((n2, i) => n2 === b2[i]);
52797
+ return siblings2 ? (
52798
+ // If two routes are siblings, we should try to match the earlier sibling
52799
+ // first. This allows people to have fine-grained control over the matching
52800
+ // behavior by simply putting routes with identical paths in the order they
52801
+ // want them tried.
52802
+ a2[a2.length - 1] - b2[b2.length - 1]
52803
+ ) : (
52804
+ // Otherwise, it doesn't really make sense to rank non-siblings by index,
52805
+ // so they sort equally.
52806
+ 0
52807
+ );
52808
+ }
52809
+ function matchRouteBranch$1(branch, pathname, allowPartial) {
52810
+ let {
52811
+ routesMeta
52812
+ } = branch;
52813
+ let matchedParams = {};
52814
+ let matchedPathname = "/";
52815
+ let matches2 = [];
52816
+ for (let i = 0; i < routesMeta.length; ++i) {
52817
+ let meta2 = routesMeta[i];
52818
+ let end = i === routesMeta.length - 1;
52819
+ let remainingPathname = matchedPathname === "/" ? pathname : pathname.slice(matchedPathname.length) || "/";
52820
+ let match = matchPath$1({
52821
+ path: meta2.relativePath,
52822
+ caseSensitive: meta2.caseSensitive,
52823
+ end
52824
+ }, remainingPathname);
52825
+ let route = meta2.route;
52826
+ if (!match) {
52827
+ return null;
52828
+ }
52829
+ Object.assign(matchedParams, match.params);
52830
+ matches2.push({
52831
+ // TODO: Can this as be avoided?
52832
+ params: matchedParams,
52833
+ pathname: joinPaths$1([matchedPathname, match.pathname]),
52834
+ pathnameBase: normalizePathname$1(joinPaths$1([matchedPathname, match.pathnameBase])),
52835
+ route
52836
+ });
52837
+ if (match.pathnameBase !== "/") {
52838
+ matchedPathname = joinPaths$1([matchedPathname, match.pathnameBase]);
52839
+ }
52840
+ }
52841
+ return matches2;
52842
+ }
52843
+ function matchPath$1(pattern, pathname) {
52844
+ if (typeof pattern === "string") {
52845
+ pattern = {
52846
+ path: pattern,
52847
+ caseSensitive: false,
52848
+ end: true
52849
+ };
52850
+ }
52851
+ let [matcher, compiledParams] = compilePath$1(pattern.path, pattern.caseSensitive, pattern.end);
52852
+ let match = pathname.match(matcher);
52853
+ if (!match) return null;
52854
+ let matchedPathname = match[0];
52855
+ let pathnameBase = matchedPathname.replace(/(.)\/+$/, "$1");
52856
+ let captureGroups = match.slice(1);
52857
+ let params = compiledParams.reduce((memo, _ref, index2) => {
52858
+ let {
52859
+ paramName,
52860
+ isOptional
52861
+ } = _ref;
52862
+ if (paramName === "*") {
52863
+ let splatValue = captureGroups[index2] || "";
52864
+ pathnameBase = matchedPathname.slice(0, matchedPathname.length - splatValue.length).replace(/(.)\/+$/, "$1");
52865
+ }
52866
+ const value2 = captureGroups[index2];
52867
+ if (isOptional && !value2) {
52868
+ memo[paramName] = void 0;
52869
+ } else {
52870
+ memo[paramName] = (value2 || "").replace(/%2F/g, "/");
52871
+ }
52872
+ return memo;
52873
+ }, {});
52874
+ return {
52875
+ params,
52876
+ pathname: matchedPathname,
52877
+ pathnameBase,
52878
+ pattern
52879
+ };
52880
+ }
52881
+ function compilePath$1(path2, caseSensitive, end) {
52882
+ if (caseSensitive === void 0) {
52883
+ caseSensitive = false;
52884
+ }
52885
+ if (end === void 0) {
52886
+ end = true;
52887
+ }
52888
+ warning$2(path2 === "*" || !path2.endsWith("*") || path2.endsWith("/*"), 'Route path "' + path2 + '" will be treated as if it were ' + ('"' + path2.replace(/\*$/, "/*") + '" because the `*` character must ') + "always follow a `/` in the pattern. To get rid of this warning, " + ('please change the route path to "' + path2.replace(/\*$/, "/*") + '".'));
52889
+ let params = [];
52890
+ let regexpSource = "^" + path2.replace(/\/*\*?$/, "").replace(/^\/*/, "/").replace(/[\\.*+^${}|()[\]]/g, "\\$&").replace(/\/:([\w-]+)(\?)?/g, (_2, paramName, isOptional) => {
52891
+ params.push({
52892
+ paramName,
52893
+ isOptional: isOptional != null
52894
+ });
52895
+ return isOptional ? "/?([^\\/]+)?" : "/([^\\/]+)";
52896
+ });
52897
+ if (path2.endsWith("*")) {
52898
+ params.push({
52899
+ paramName: "*"
52900
+ });
52901
+ regexpSource += path2 === "*" || path2 === "/*" ? "(.*)$" : "(?:\\/(.+)|\\/*)$";
52902
+ } else if (end) {
52903
+ regexpSource += "\\/*$";
52904
+ } else if (path2 !== "" && path2 !== "/") {
52905
+ regexpSource += "(?:(?=\\/|$))";
52906
+ } else ;
52907
+ let matcher = new RegExp(regexpSource, caseSensitive ? void 0 : "i");
52908
+ return [matcher, params];
52909
+ }
52910
+ function decodePath$1(value2) {
52911
+ try {
52912
+ return value2.split("/").map((v2) => decodeURIComponent(v2).replace(/\//g, "%2F")).join("/");
52913
+ } catch (error) {
52914
+ warning$2(false, 'The URL path "' + value2 + '" could not be decoded because it is is a malformed URL segment. This is probably due to a bad percent ' + ("encoding (" + error + ")."));
52915
+ return value2;
52916
+ }
52917
+ }
52918
+ function stripBasename$1(pathname, basename2) {
52919
+ if (basename2 === "/") return pathname;
52920
+ if (!pathname.toLowerCase().startsWith(basename2.toLowerCase())) {
52921
+ return null;
52922
+ }
52923
+ let startIndex = basename2.endsWith("/") ? basename2.length - 1 : basename2.length;
52924
+ let nextChar = pathname.charAt(startIndex);
52925
+ if (nextChar && nextChar !== "/") {
52926
+ return null;
52927
+ }
52928
+ return pathname.slice(startIndex) || "/";
52929
+ }
52930
+ function resolvePath$1(to2, fromPathname) {
52931
+ if (fromPathname === void 0) {
52932
+ fromPathname = "/";
52933
+ }
52934
+ let {
52935
+ pathname: toPathname,
52936
+ search: search2 = "",
52937
+ hash: hash2 = ""
52938
+ } = typeof to2 === "string" ? parsePath$1(to2) : to2;
52939
+ let pathname = toPathname ? toPathname.startsWith("/") ? toPathname : resolvePathname$1(toPathname, fromPathname) : fromPathname;
52940
+ return {
52941
+ pathname,
52942
+ search: normalizeSearch$1(search2),
52943
+ hash: normalizeHash$1(hash2)
52944
+ };
52945
+ }
52946
+ function resolvePathname$1(relativePath, fromPathname) {
52947
+ let segments = fromPathname.replace(/\/+$/, "").split("/");
52948
+ let relativeSegments = relativePath.split("/");
52949
+ relativeSegments.forEach((segment) => {
52950
+ if (segment === "..") {
52951
+ if (segments.length > 1) segments.pop();
52952
+ } else if (segment !== ".") {
52953
+ segments.push(segment);
52954
+ }
52955
+ });
52956
+ return segments.length > 1 ? segments.join("/") : "/";
52957
+ }
52958
+ function getInvalidPathError$1(char, field, dest, path2) {
52959
+ return "Cannot include a '" + char + "' character in a manually specified " + ("`to." + field + "` field [" + JSON.stringify(path2) + "]. Please separate it out to the ") + ("`to." + dest + "` field. Alternatively you may provide the full path as ") + 'a string in <Link to="..."> and the router will parse it for you.';
52960
+ }
52961
+ function getPathContributingMatches$1(matches2) {
52962
+ return matches2.filter((match, index2) => index2 === 0 || match.route.path && match.route.path.length > 0);
52963
+ }
52964
+ function getResolveToMatches$1(matches2, v7_relativeSplatPath) {
52965
+ let pathMatches = getPathContributingMatches$1(matches2);
52966
+ if (v7_relativeSplatPath) {
52967
+ return pathMatches.map((match, idx) => idx === pathMatches.length - 1 ? match.pathname : match.pathnameBase);
52968
+ }
52969
+ return pathMatches.map((match) => match.pathnameBase);
52970
+ }
52971
+ function resolveTo$1(toArg, routePathnames, locationPathname, isPathRelative) {
52972
+ if (isPathRelative === void 0) {
52973
+ isPathRelative = false;
52974
+ }
52975
+ let to2;
52976
+ if (typeof toArg === "string") {
52977
+ to2 = parsePath$1(toArg);
52978
+ } else {
52979
+ to2 = _extends$3({}, toArg);
52980
+ invariant$2(!to2.pathname || !to2.pathname.includes("?"), getInvalidPathError$1("?", "pathname", "search", to2));
52981
+ invariant$2(!to2.pathname || !to2.pathname.includes("#"), getInvalidPathError$1("#", "pathname", "hash", to2));
52982
+ invariant$2(!to2.search || !to2.search.includes("#"), getInvalidPathError$1("#", "search", "hash", to2));
52983
+ }
52984
+ let isEmptyPath2 = toArg === "" || to2.pathname === "";
52985
+ let toPathname = isEmptyPath2 ? "/" : to2.pathname;
52986
+ let from;
52987
+ if (toPathname == null) {
52988
+ from = locationPathname;
52989
+ } else {
52990
+ let routePathnameIndex = routePathnames.length - 1;
52991
+ if (!isPathRelative && toPathname.startsWith("..")) {
52992
+ let toSegments = toPathname.split("/");
52993
+ while (toSegments[0] === "..") {
52994
+ toSegments.shift();
52995
+ routePathnameIndex -= 1;
52996
+ }
52997
+ to2.pathname = toSegments.join("/");
52998
+ }
52999
+ from = routePathnameIndex >= 0 ? routePathnames[routePathnameIndex] : "/";
53000
+ }
53001
+ let path2 = resolvePath$1(to2, from);
53002
+ let hasExplicitTrailingSlash = toPathname && toPathname !== "/" && toPathname.endsWith("/");
53003
+ let hasCurrentTrailingSlash = (isEmptyPath2 || toPathname === ".") && locationPathname.endsWith("/");
53004
+ if (!path2.pathname.endsWith("/") && (hasExplicitTrailingSlash || hasCurrentTrailingSlash)) {
53005
+ path2.pathname += "/";
53006
+ }
53007
+ return path2;
53008
+ }
53009
+ const joinPaths$1 = (paths) => paths.join("/").replace(/\/\/+/g, "/");
53010
+ const normalizePathname$1 = (pathname) => pathname.replace(/\/+$/, "").replace(/^\/*/, "/");
53011
+ const normalizeSearch$1 = (search2) => !search2 || search2 === "?" ? "" : search2.startsWith("?") ? search2 : "?" + search2;
53012
+ const normalizeHash$1 = (hash2) => !hash2 || hash2 === "#" ? "" : hash2.startsWith("#") ? hash2 : "#" + hash2;
53013
+ class AbortedDeferredError extends Error {
53014
+ }
53015
+ const validMutationMethodsArr$1 = ["post", "put", "patch", "delete"];
53016
+ new Set(validMutationMethodsArr$1);
53017
+ const validRequestMethodsArr$1 = ["get", ...validMutationMethodsArr$1];
53018
+ new Set(validRequestMethodsArr$1);
53019
+ const IDLE_FETCHER$1 = {
53020
+ state: "idle",
53021
+ data: void 0,
53022
+ formMethod: void 0,
53023
+ formAction: void 0,
53024
+ formEncType: void 0,
53025
+ formData: void 0,
53026
+ json: void 0,
53027
+ text: void 0
53028
+ };
52589
53029
  const basicLoginErrors = (login) => {
52590
53030
  const issues = [];
52591
53031
  if (login.length === 0) {
@@ -52677,6 +53117,22 @@ const isRecord$1 = (value2) => {
52677
53117
  return typeof value2 === "object" && value2 !== null && Array.isArray(value2) === false;
52678
53118
  };
52679
53119
  const parameterSegment = /^:\w+[?*]?$/;
53120
+ const decodeStaticSegment = (segment) => {
53121
+ if (segment.includes("%") === false) {
53122
+ return { path: segment };
53123
+ }
53124
+ try {
53125
+ const decoded = decodeURIComponent(segment);
53126
+ return {
53127
+ // Remix decodes request paths; keep encoded slashes within one segment.
53128
+ path: decoded.replaceAll("/", "%2F"),
53129
+ // These were valid literal segments before route matching used Remix.
53130
+ literal: decoded.startsWith(":") || /[?*%]/.test(decoded)
53131
+ };
53132
+ } catch {
53133
+ return { path: segment, literal: true };
53134
+ }
53135
+ };
52680
53136
  const validatePathnamePattern$1 = (route) => {
52681
53137
  if (route.startsWith("/") === false) {
52682
53138
  return 'Route must start with "/"';
@@ -52684,7 +53140,7 @@ const validatePathnamePattern$1 = (route) => {
52684
53140
  if (route === "/") {
52685
53141
  return;
52686
53142
  }
52687
- if (route !== "/" && route.endsWith("/")) {
53143
+ if (route.endsWith("/")) {
52688
53144
  return 'Route must not end with "/"';
52689
53145
  }
52690
53146
  if (route.includes("//")) {
@@ -52705,6 +53161,9 @@ const validatePathnamePattern$1 = (route) => {
52705
53161
  if (segment.startsWith(":") && parameterSegment.test(segment) === false) {
52706
53162
  return `Invalid route parameter "${segment}"`;
52707
53163
  }
53164
+ if (segment.includes("?") && parameterSegment.test(segment) === false) {
53165
+ return 'Optional marker "?" is only allowed on a named parameter';
53166
+ }
52708
53167
  if (segment.includes("*")) {
52709
53168
  return "Wildcard can only be used as * or :name*";
52710
53169
  }
@@ -52863,38 +53322,75 @@ const createWsAuthResources = ({
52863
53322
  ].join("\n")
52864
53323
  };
52865
53324
  };
52866
- const normalizePathname$2 = (pathname) => {
52867
- if (pathname === "" || pathname === "/") {
52868
- return "/";
52869
- }
52870
- return pathname.endsWith("/") ? pathname.slice(0, -1) : pathname;
52871
- };
52872
- const matchesPathnamePattern = (route, pathname) => {
52873
- const routeSegments = normalizePathname$2(route).slice(1).split("/");
52874
- const pathnameSegments = normalizePathname$2(pathname).slice(1).split("/");
52875
- const matchSegments = (routeIndex, pathnameIndex) => {
52876
- const routeSegment = routeSegments[routeIndex];
52877
- const pathnameSegment = pathnameSegments[pathnameIndex];
52878
- if (routeSegment === void 0) {
52879
- return pathnameSegment === void 0;
52880
- }
52881
- if (routeSegment === "*" || /^:\w+\*$/.test(routeSegment)) {
52882
- return routeIndex === routeSegments.length - 1;
53325
+ const toRouterPattern = (pattern, literals, decodedPathname) => {
53326
+ const segments = [];
53327
+ for (const segment of (pattern || "/").replace(/:\w+\*$/, "*").split("/")) {
53328
+ if (segment === "*" || segment.startsWith(":")) {
53329
+ segments.push(segment);
53330
+ continue;
52883
53331
  }
52884
- if (/^:\w+\?$/.test(routeSegment)) {
52885
- return matchSegments(routeIndex + 1, pathnameIndex) || pathnameSegment !== void 0 && matchSegments(routeIndex + 1, pathnameIndex + 1);
53332
+ const decoded = decodeStaticSegment(segment);
53333
+ if (decoded.literal) {
53334
+ let marker = literals.get(segment);
53335
+ if (marker === void 0) {
53336
+ let index2 = literals.size;
53337
+ marker = `\0${index2}\0`;
53338
+ while (decodedPathname.includes(marker) || Array.from(literals.values()).includes(marker)) {
53339
+ index2 += 1;
53340
+ marker = `\0${index2}\0`;
53341
+ }
53342
+ literals.set(segment, marker);
53343
+ }
53344
+ segments.push(marker);
53345
+ continue;
52886
53346
  }
52887
- if (pathnameSegment === void 0) {
52888
- return false;
53347
+ segments.push(decoded.path);
53348
+ }
53349
+ return segments.join("/");
53350
+ };
53351
+ const matchPathnameRoutes = (routes, pathname) => {
53352
+ const literals = /* @__PURE__ */ new Map();
53353
+ const decodedPathname = pathname.split("/").map((segment) => {
53354
+ try {
53355
+ return decodeURIComponent(segment);
53356
+ } catch {
53357
+ return segment;
52889
53358
  }
52890
- if (/^:\w+$/.test(routeSegment)) {
52891
- return matchSegments(routeIndex + 1, pathnameIndex + 1);
53359
+ }).join("/");
53360
+ const routerRoutes = routes.map((route) => ({
53361
+ path: toRouterPattern(route.pattern, literals, decodedPathname),
53362
+ caseSensitive: false,
53363
+ source: route
53364
+ }));
53365
+ const decodedLiterals = Array.from(literals, ([literal2, marker]) => {
53366
+ try {
53367
+ return [marker, decodeURIComponent(literal2)];
53368
+ } catch {
53369
+ return [marker, literal2];
52892
53370
  }
52893
- return routeSegment === pathnameSegment && matchSegments(routeIndex + 1, pathnameIndex + 1);
53371
+ });
53372
+ const routerPathname = pathname.split("/").map((segment) => literals.get(segment) ?? segment).join("/");
53373
+ const match = matchRoutes$1(routerRoutes, routerPathname)?.at(-1);
53374
+ if (match === void 0) {
53375
+ return;
53376
+ }
53377
+ return {
53378
+ value: match.route.source.value,
53379
+ params: Object.fromEntries(
53380
+ Object.entries(match.params).map(([name2, value2]) => [
53381
+ name2,
53382
+ value2 === void 0 ? value2 : decodedLiterals.reduce(
53383
+ (result2, [marker, literal2]) => result2.replaceAll(marker, literal2),
53384
+ value2
53385
+ )
53386
+ ])
53387
+ )
52894
53388
  };
52895
- return matchSegments(0, 0);
52896
53389
  };
52897
- const findWsAuthRoute = (authRoutes, pathname) => authRoutes.find(({ route }) => matchesPathnamePattern(route, pathname));
53390
+ const matchPathnamePattern = (pattern, pathname) => matchPathnameRoutes([{ pattern, value: true }], pathname)?.params;
53391
+ const findWsAuthRoute = (authRoutes, pathname) => authRoutes.find(
53392
+ ({ route }) => matchPathnamePattern(route, pathname) !== void 0
53393
+ );
52898
53394
  const platformHeaderNames = /* @__PURE__ */ new Set([
52899
53395
  "x-powered-by",
52900
53396
  "x-content-type-options",
@@ -200634,35 +201130,13 @@ const getSerializedPagePath = (pages2, page2) => joinPath$1(
200634
201130
  page2.path
200635
201131
  );
200636
201132
  const normalizeSerializedPagePath = (path2) => path2 === "/" ? "" : path2;
200637
- const escapeRegExp = (value2) => value2.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
200638
- const isSerializedPagePathMatch = (pattern, path2) => {
200639
- if (pattern === path2) {
200640
- return true;
200641
- }
200642
- const segments = pattern.split("/");
200643
- const pathSegments = path2.split("/");
200644
- const regexParts = segments.map((segment, index2) => {
200645
- if (segment === "*") {
200646
- return index2 === segments.length - 1 ? ".*" : "[^/]+";
200647
- }
200648
- const param = segment.match(/^:(\w+)([?*]?)$/);
200649
- if (param === null) {
200650
- return escapeRegExp(segment);
200651
- }
200652
- const modifier = param[2];
200653
- if (modifier === "?") {
200654
- return "[^/]*";
200655
- }
200656
- if (modifier === "*") {
200657
- return index2 === segments.length - 1 ? ".*" : "[^/]+";
200658
- }
200659
- return "[^/]+";
200660
- });
200661
- if (segments.length !== pathSegments.length && pattern.endsWith("*") === false) {
200662
- return false;
200663
- }
200664
- return new RegExp(`^${regexParts.join("/")}$`).test(path2);
200665
- };
201133
+ const findMatchingSerializedPageByPath = (pages2, path2) => matchPathnameRoutes(
201134
+ pages2.pages.map((page2) => ({
201135
+ pattern: getSerializedPagePath(pages2, page2),
201136
+ value: page2
201137
+ })),
201138
+ normalizeSerializedPagePath(path2)
201139
+ )?.value;
200666
201140
  const serializePageSummary = (pages2, page2) => ({
200667
201141
  id: page2.id,
200668
201142
  name: page2.name,
@@ -200699,9 +201173,7 @@ const findSerializedPageByInput = (pages2, input2) => {
200699
201173
  const exactPage = pages2.pages.find(
200700
201174
  (page2) => getSerializedPagePath(pages2, page2) === pagePath2
200701
201175
  );
200702
- return exactPage ?? pages2.pages.find(
200703
- (page2) => isSerializedPagePathMatch(getSerializedPagePath(pages2, page2), pagePath2)
200704
- );
201176
+ return exactPage ?? findMatchingSerializedPageByPath(pages2, pagePath2);
200705
201177
  }
200706
201178
  };
200707
201179
  const findExactSerializedPageByPath = (pages2, path2) => {
@@ -200710,12 +201182,6 @@ const findExactSerializedPageByPath = (pages2, path2) => {
200710
201182
  (page2) => getSerializedPagePath(pages2, page2) === pagePath2
200711
201183
  );
200712
201184
  };
200713
- const findMatchingSerializedPageByPath = (pages2, path2) => {
200714
- const pagePath2 = normalizeSerializedPagePath(path2);
200715
- return pages2.pages.find(
200716
- (page2) => isSerializedPagePathMatch(getSerializedPagePath(pages2, page2), pagePath2)
200717
- );
200718
- };
200719
201185
  const isSerializedFallbackPage = (pages2, page2) => {
200720
201186
  const path2 = getSerializedPagePath(pages2, page2);
200721
201187
  return page2.meta.status === "404" || path2 === "/*" || path2 === "*";
@@ -205400,31 +205866,7 @@ const generateRemixRoute = (pathname) => {
205400
205866
  const tail = pathname.endsWith("*") ? "" : "._index";
205401
205867
  return `${base2}${tail}`;
205402
205868
  };
205403
- const generateRemixParams = (pathname) => {
205404
- const name2 = pathname.match(/:(?<name>\w+)\*$/)?.groups?.name;
205405
- let generated2 = "";
205406
- generated2 += `type Params = Record<string, string | undefined>;
205407
- `;
205408
- generated2 += `export const getRemixParams = ({ ...params }: Params): Params => {
205409
- `;
205410
- if (name2) {
205411
- generated2 += ` params["${name2}"] = params["*"]
205412
- `;
205413
- generated2 += ` delete params["*"]
205414
- `;
205415
- }
205416
- if (pathname.endsWith("/*")) {
205417
- generated2 += ` params[0] = params["*"]
205418
- `;
205419
- generated2 += ` delete params["*"]
205420
- `;
205421
- }
205422
- generated2 += ` return params
205423
- `;
205424
- generated2 += `}
205425
- `;
205426
- return generated2;
205427
- };
205869
+ const generateRemixParams = (pathname) => `export const getRemixParams = (params: Record<string, string | undefined>) => toWebstudioParams(${JSON.stringify(pathname)}, params);`;
205428
205870
  const normalizeProps = ({
205429
205871
  props: props2,
205430
205872
  assetBaseUrl,
@@ -257555,10 +257997,10 @@ function requireParse() {
257555
257997
  Container.registerParse(parse6);
257556
257998
  return parse_1;
257557
257999
  }
257558
- var warning$2;
258000
+ var warning$1;
257559
258001
  var hasRequiredWarning;
257560
258002
  function requireWarning() {
257561
- if (hasRequiredWarning) return warning$2;
258003
+ if (hasRequiredWarning) return warning$1;
257562
258004
  hasRequiredWarning = 1;
257563
258005
  class Warning {
257564
258006
  constructor(text2, opts = {}) {
@@ -257587,9 +258029,9 @@ function requireWarning() {
257587
258029
  return this.text;
257588
258030
  }
257589
258031
  }
257590
- warning$2 = Warning;
258032
+ warning$1 = Warning;
257591
258033
  Warning.default = Warning;
257592
- return warning$2;
258034
+ return warning$1;
257593
258035
  }
257594
258036
  var result;
257595
258037
  var hasRequiredResult;
@@ -332824,7 +333266,7 @@ class HandledCliError extends Error {
332824
333266
  }
332825
333267
  const isHandledCliError = (error) => error instanceof HandledCliError;
332826
333268
  const name = "webstudio";
332827
- const version$1 = "0.304.0";
333269
+ const version$1 = "0.305.0";
332828
333270
  const description = "Webstudio CLI";
332829
333271
  const author = "Webstudio <github@webstudio.is>";
332830
333272
  const homepage = "https://webstudio.is";
@@ -341545,446 +341987,6 @@ const createFrameworkComponentRegistry = ({
341545
341987
  }
341546
341988
  return { components: components2, metas, buildHooks: buildHooks$1 };
341547
341989
  };
341548
- /**
341549
- * @remix-run/router v1.23.0
341550
- *
341551
- * Copyright (c) Remix Software Inc.
341552
- *
341553
- * This source code is licensed under the MIT license found in the
341554
- * LICENSE.md file in the root directory of this source tree.
341555
- *
341556
- * @license MIT
341557
- */
341558
- function _extends$3() {
341559
- _extends$3 = Object.assign ? Object.assign.bind() : function(target) {
341560
- for (var i = 1; i < arguments.length; i++) {
341561
- var source = arguments[i];
341562
- for (var key2 in source) {
341563
- if (Object.prototype.hasOwnProperty.call(source, key2)) {
341564
- target[key2] = source[key2];
341565
- }
341566
- }
341567
- }
341568
- return target;
341569
- };
341570
- return _extends$3.apply(this, arguments);
341571
- }
341572
- var Action;
341573
- (function(Action2) {
341574
- Action2["Pop"] = "POP";
341575
- Action2["Push"] = "PUSH";
341576
- Action2["Replace"] = "REPLACE";
341577
- })(Action || (Action = {}));
341578
- function invariant$2(value2, message) {
341579
- if (value2 === false || value2 === null || typeof value2 === "undefined") {
341580
- throw new Error(message);
341581
- }
341582
- }
341583
- function warning$1(cond, message) {
341584
- if (!cond) {
341585
- if (typeof console !== "undefined") console.warn(message);
341586
- try {
341587
- throw new Error(message);
341588
- } catch (e2) {
341589
- }
341590
- }
341591
- }
341592
- function createPath$1(_ref) {
341593
- let {
341594
- pathname = "/",
341595
- search: search2 = "",
341596
- hash: hash2 = ""
341597
- } = _ref;
341598
- if (search2 && search2 !== "?") pathname += search2.charAt(0) === "?" ? search2 : "?" + search2;
341599
- if (hash2 && hash2 !== "#") pathname += hash2.charAt(0) === "#" ? hash2 : "#" + hash2;
341600
- return pathname;
341601
- }
341602
- function parsePath$1(path2) {
341603
- let parsedPath = {};
341604
- if (path2) {
341605
- let hashIndex = path2.indexOf("#");
341606
- if (hashIndex >= 0) {
341607
- parsedPath.hash = path2.substr(hashIndex);
341608
- path2 = path2.substr(0, hashIndex);
341609
- }
341610
- let searchIndex = path2.indexOf("?");
341611
- if (searchIndex >= 0) {
341612
- parsedPath.search = path2.substr(searchIndex);
341613
- path2 = path2.substr(0, searchIndex);
341614
- }
341615
- if (path2) {
341616
- parsedPath.pathname = path2;
341617
- }
341618
- }
341619
- return parsedPath;
341620
- }
341621
- var ResultType;
341622
- (function(ResultType2) {
341623
- ResultType2["data"] = "data";
341624
- ResultType2["deferred"] = "deferred";
341625
- ResultType2["redirect"] = "redirect";
341626
- ResultType2["error"] = "error";
341627
- })(ResultType || (ResultType = {}));
341628
- function matchRoutes$1(routes, locationArg, basename2) {
341629
- if (basename2 === void 0) {
341630
- basename2 = "/";
341631
- }
341632
- return matchRoutesImpl$1(routes, locationArg, basename2);
341633
- }
341634
- function matchRoutesImpl$1(routes, locationArg, basename2, allowPartial) {
341635
- let location = typeof locationArg === "string" ? parsePath$1(locationArg) : locationArg;
341636
- let pathname = stripBasename$1(location.pathname || "/", basename2);
341637
- if (pathname == null) {
341638
- return null;
341639
- }
341640
- let branches = flattenRoutes$1(routes);
341641
- rankRouteBranches$1(branches);
341642
- let matches2 = null;
341643
- for (let i = 0; matches2 == null && i < branches.length; ++i) {
341644
- let decoded = decodePath$1(pathname);
341645
- matches2 = matchRouteBranch$1(branches[i], decoded);
341646
- }
341647
- return matches2;
341648
- }
341649
- function convertRouteMatchToUiMatch$1(match, loaderData) {
341650
- let {
341651
- route,
341652
- pathname,
341653
- params
341654
- } = match;
341655
- return {
341656
- id: route.id,
341657
- pathname,
341658
- params,
341659
- data: loaderData[route.id],
341660
- handle: route.handle
341661
- };
341662
- }
341663
- function flattenRoutes$1(routes, branches, parentsMeta, parentPath) {
341664
- if (branches === void 0) {
341665
- branches = [];
341666
- }
341667
- if (parentsMeta === void 0) {
341668
- parentsMeta = [];
341669
- }
341670
- if (parentPath === void 0) {
341671
- parentPath = "";
341672
- }
341673
- let flattenRoute = (route, index2, relativePath) => {
341674
- let meta2 = {
341675
- relativePath: relativePath === void 0 ? route.path || "" : relativePath,
341676
- caseSensitive: route.caseSensitive === true,
341677
- childrenIndex: index2,
341678
- route
341679
- };
341680
- if (meta2.relativePath.startsWith("/")) {
341681
- invariant$2(meta2.relativePath.startsWith(parentPath), 'Absolute route path "' + meta2.relativePath + '" nested under path ' + ('"' + parentPath + '" is not valid. An absolute child route path ') + "must start with the combined path of all its parent routes.");
341682
- meta2.relativePath = meta2.relativePath.slice(parentPath.length);
341683
- }
341684
- let path2 = joinPaths$1([parentPath, meta2.relativePath]);
341685
- let routesMeta = parentsMeta.concat(meta2);
341686
- if (route.children && route.children.length > 0) {
341687
- invariant$2(
341688
- // Our types know better, but runtime JS may not!
341689
- // @ts-expect-error
341690
- route.index !== true,
341691
- "Index routes must not have child routes. Please remove " + ('all child routes from route path "' + path2 + '".')
341692
- );
341693
- flattenRoutes$1(route.children, branches, routesMeta, path2);
341694
- }
341695
- if (route.path == null && !route.index) {
341696
- return;
341697
- }
341698
- branches.push({
341699
- path: path2,
341700
- score: computeScore$1(path2, route.index),
341701
- routesMeta
341702
- });
341703
- };
341704
- routes.forEach((route, index2) => {
341705
- var _route$path;
341706
- if (route.path === "" || !((_route$path = route.path) != null && _route$path.includes("?"))) {
341707
- flattenRoute(route, index2);
341708
- } else {
341709
- for (let exploded of explodeOptionalSegments$1(route.path)) {
341710
- flattenRoute(route, index2, exploded);
341711
- }
341712
- }
341713
- });
341714
- return branches;
341715
- }
341716
- function explodeOptionalSegments$1(path2) {
341717
- let segments = path2.split("/");
341718
- if (segments.length === 0) return [];
341719
- let [first, ...rest] = segments;
341720
- let isOptional = first.endsWith("?");
341721
- let required2 = first.replace(/\?$/, "");
341722
- if (rest.length === 0) {
341723
- return isOptional ? [required2, ""] : [required2];
341724
- }
341725
- let restExploded = explodeOptionalSegments$1(rest.join("/"));
341726
- let result2 = [];
341727
- result2.push(...restExploded.map((subpath) => subpath === "" ? required2 : [required2, subpath].join("/")));
341728
- if (isOptional) {
341729
- result2.push(...restExploded);
341730
- }
341731
- return result2.map((exploded) => path2.startsWith("/") && exploded === "" ? "/" : exploded);
341732
- }
341733
- function rankRouteBranches$1(branches) {
341734
- branches.sort((a2, b2) => a2.score !== b2.score ? b2.score - a2.score : compareIndexes$1(a2.routesMeta.map((meta2) => meta2.childrenIndex), b2.routesMeta.map((meta2) => meta2.childrenIndex)));
341735
- }
341736
- const paramRe$1 = /^:[\w-]+$/;
341737
- const dynamicSegmentValue$1 = 3;
341738
- const indexRouteValue$1 = 2;
341739
- const emptySegmentValue$1 = 1;
341740
- const staticSegmentValue$1 = 10;
341741
- const splatPenalty$1 = -2;
341742
- const isSplat$1 = (s2) => s2 === "*";
341743
- function computeScore$1(path2, index2) {
341744
- let segments = path2.split("/");
341745
- let initialScore = segments.length;
341746
- if (segments.some(isSplat$1)) {
341747
- initialScore += splatPenalty$1;
341748
- }
341749
- if (index2) {
341750
- initialScore += indexRouteValue$1;
341751
- }
341752
- return segments.filter((s2) => !isSplat$1(s2)).reduce((score, segment) => score + (paramRe$1.test(segment) ? dynamicSegmentValue$1 : segment === "" ? emptySegmentValue$1 : staticSegmentValue$1), initialScore);
341753
- }
341754
- function compareIndexes$1(a2, b2) {
341755
- let siblings2 = a2.length === b2.length && a2.slice(0, -1).every((n2, i) => n2 === b2[i]);
341756
- return siblings2 ? (
341757
- // If two routes are siblings, we should try to match the earlier sibling
341758
- // first. This allows people to have fine-grained control over the matching
341759
- // behavior by simply putting routes with identical paths in the order they
341760
- // want them tried.
341761
- a2[a2.length - 1] - b2[b2.length - 1]
341762
- ) : (
341763
- // Otherwise, it doesn't really make sense to rank non-siblings by index,
341764
- // so they sort equally.
341765
- 0
341766
- );
341767
- }
341768
- function matchRouteBranch$1(branch, pathname, allowPartial) {
341769
- let {
341770
- routesMeta
341771
- } = branch;
341772
- let matchedParams = {};
341773
- let matchedPathname = "/";
341774
- let matches2 = [];
341775
- for (let i = 0; i < routesMeta.length; ++i) {
341776
- let meta2 = routesMeta[i];
341777
- let end = i === routesMeta.length - 1;
341778
- let remainingPathname = matchedPathname === "/" ? pathname : pathname.slice(matchedPathname.length) || "/";
341779
- let match = matchPath$1({
341780
- path: meta2.relativePath,
341781
- caseSensitive: meta2.caseSensitive,
341782
- end
341783
- }, remainingPathname);
341784
- let route = meta2.route;
341785
- if (!match) {
341786
- return null;
341787
- }
341788
- Object.assign(matchedParams, match.params);
341789
- matches2.push({
341790
- // TODO: Can this as be avoided?
341791
- params: matchedParams,
341792
- pathname: joinPaths$1([matchedPathname, match.pathname]),
341793
- pathnameBase: normalizePathname$1(joinPaths$1([matchedPathname, match.pathnameBase])),
341794
- route
341795
- });
341796
- if (match.pathnameBase !== "/") {
341797
- matchedPathname = joinPaths$1([matchedPathname, match.pathnameBase]);
341798
- }
341799
- }
341800
- return matches2;
341801
- }
341802
- function matchPath$1(pattern, pathname) {
341803
- if (typeof pattern === "string") {
341804
- pattern = {
341805
- path: pattern,
341806
- caseSensitive: false,
341807
- end: true
341808
- };
341809
- }
341810
- let [matcher, compiledParams] = compilePath$1(pattern.path, pattern.caseSensitive, pattern.end);
341811
- let match = pathname.match(matcher);
341812
- if (!match) return null;
341813
- let matchedPathname = match[0];
341814
- let pathnameBase = matchedPathname.replace(/(.)\/+$/, "$1");
341815
- let captureGroups = match.slice(1);
341816
- let params = compiledParams.reduce((memo, _ref, index2) => {
341817
- let {
341818
- paramName,
341819
- isOptional
341820
- } = _ref;
341821
- if (paramName === "*") {
341822
- let splatValue = captureGroups[index2] || "";
341823
- pathnameBase = matchedPathname.slice(0, matchedPathname.length - splatValue.length).replace(/(.)\/+$/, "$1");
341824
- }
341825
- const value2 = captureGroups[index2];
341826
- if (isOptional && !value2) {
341827
- memo[paramName] = void 0;
341828
- } else {
341829
- memo[paramName] = (value2 || "").replace(/%2F/g, "/");
341830
- }
341831
- return memo;
341832
- }, {});
341833
- return {
341834
- params,
341835
- pathname: matchedPathname,
341836
- pathnameBase,
341837
- pattern
341838
- };
341839
- }
341840
- function compilePath$1(path2, caseSensitive, end) {
341841
- if (caseSensitive === void 0) {
341842
- caseSensitive = false;
341843
- }
341844
- if (end === void 0) {
341845
- end = true;
341846
- }
341847
- warning$1(path2 === "*" || !path2.endsWith("*") || path2.endsWith("/*"), 'Route path "' + path2 + '" will be treated as if it were ' + ('"' + path2.replace(/\*$/, "/*") + '" because the `*` character must ') + "always follow a `/` in the pattern. To get rid of this warning, " + ('please change the route path to "' + path2.replace(/\*$/, "/*") + '".'));
341848
- let params = [];
341849
- let regexpSource = "^" + path2.replace(/\/*\*?$/, "").replace(/^\/*/, "/").replace(/[\\.*+^${}|()[\]]/g, "\\$&").replace(/\/:([\w-]+)(\?)?/g, (_2, paramName, isOptional) => {
341850
- params.push({
341851
- paramName,
341852
- isOptional: isOptional != null
341853
- });
341854
- return isOptional ? "/?([^\\/]+)?" : "/([^\\/]+)";
341855
- });
341856
- if (path2.endsWith("*")) {
341857
- params.push({
341858
- paramName: "*"
341859
- });
341860
- regexpSource += path2 === "*" || path2 === "/*" ? "(.*)$" : "(?:\\/(.+)|\\/*)$";
341861
- } else if (end) {
341862
- regexpSource += "\\/*$";
341863
- } else if (path2 !== "" && path2 !== "/") {
341864
- regexpSource += "(?:(?=\\/|$))";
341865
- } else ;
341866
- let matcher = new RegExp(regexpSource, caseSensitive ? void 0 : "i");
341867
- return [matcher, params];
341868
- }
341869
- function decodePath$1(value2) {
341870
- try {
341871
- return value2.split("/").map((v2) => decodeURIComponent(v2).replace(/\//g, "%2F")).join("/");
341872
- } catch (error) {
341873
- warning$1(false, 'The URL path "' + value2 + '" could not be decoded because it is is a malformed URL segment. This is probably due to a bad percent ' + ("encoding (" + error + ")."));
341874
- return value2;
341875
- }
341876
- }
341877
- function stripBasename$1(pathname, basename2) {
341878
- if (basename2 === "/") return pathname;
341879
- if (!pathname.toLowerCase().startsWith(basename2.toLowerCase())) {
341880
- return null;
341881
- }
341882
- let startIndex = basename2.endsWith("/") ? basename2.length - 1 : basename2.length;
341883
- let nextChar = pathname.charAt(startIndex);
341884
- if (nextChar && nextChar !== "/") {
341885
- return null;
341886
- }
341887
- return pathname.slice(startIndex) || "/";
341888
- }
341889
- function resolvePath$1(to2, fromPathname) {
341890
- if (fromPathname === void 0) {
341891
- fromPathname = "/";
341892
- }
341893
- let {
341894
- pathname: toPathname,
341895
- search: search2 = "",
341896
- hash: hash2 = ""
341897
- } = typeof to2 === "string" ? parsePath$1(to2) : to2;
341898
- let pathname = toPathname ? toPathname.startsWith("/") ? toPathname : resolvePathname$1(toPathname, fromPathname) : fromPathname;
341899
- return {
341900
- pathname,
341901
- search: normalizeSearch$1(search2),
341902
- hash: normalizeHash$1(hash2)
341903
- };
341904
- }
341905
- function resolvePathname$1(relativePath, fromPathname) {
341906
- let segments = fromPathname.replace(/\/+$/, "").split("/");
341907
- let relativeSegments = relativePath.split("/");
341908
- relativeSegments.forEach((segment) => {
341909
- if (segment === "..") {
341910
- if (segments.length > 1) segments.pop();
341911
- } else if (segment !== ".") {
341912
- segments.push(segment);
341913
- }
341914
- });
341915
- return segments.length > 1 ? segments.join("/") : "/";
341916
- }
341917
- function getInvalidPathError$1(char, field, dest, path2) {
341918
- return "Cannot include a '" + char + "' character in a manually specified " + ("`to." + field + "` field [" + JSON.stringify(path2) + "]. Please separate it out to the ") + ("`to." + dest + "` field. Alternatively you may provide the full path as ") + 'a string in <Link to="..."> and the router will parse it for you.';
341919
- }
341920
- function getPathContributingMatches$1(matches2) {
341921
- return matches2.filter((match, index2) => index2 === 0 || match.route.path && match.route.path.length > 0);
341922
- }
341923
- function getResolveToMatches$1(matches2, v7_relativeSplatPath) {
341924
- let pathMatches = getPathContributingMatches$1(matches2);
341925
- if (v7_relativeSplatPath) {
341926
- return pathMatches.map((match, idx) => idx === pathMatches.length - 1 ? match.pathname : match.pathnameBase);
341927
- }
341928
- return pathMatches.map((match) => match.pathnameBase);
341929
- }
341930
- function resolveTo$1(toArg, routePathnames, locationPathname, isPathRelative) {
341931
- if (isPathRelative === void 0) {
341932
- isPathRelative = false;
341933
- }
341934
- let to2;
341935
- if (typeof toArg === "string") {
341936
- to2 = parsePath$1(toArg);
341937
- } else {
341938
- to2 = _extends$3({}, toArg);
341939
- invariant$2(!to2.pathname || !to2.pathname.includes("?"), getInvalidPathError$1("?", "pathname", "search", to2));
341940
- invariant$2(!to2.pathname || !to2.pathname.includes("#"), getInvalidPathError$1("#", "pathname", "hash", to2));
341941
- invariant$2(!to2.search || !to2.search.includes("#"), getInvalidPathError$1("#", "search", "hash", to2));
341942
- }
341943
- let isEmptyPath2 = toArg === "" || to2.pathname === "";
341944
- let toPathname = isEmptyPath2 ? "/" : to2.pathname;
341945
- let from;
341946
- if (toPathname == null) {
341947
- from = locationPathname;
341948
- } else {
341949
- let routePathnameIndex = routePathnames.length - 1;
341950
- if (!isPathRelative && toPathname.startsWith("..")) {
341951
- let toSegments = toPathname.split("/");
341952
- while (toSegments[0] === "..") {
341953
- toSegments.shift();
341954
- routePathnameIndex -= 1;
341955
- }
341956
- to2.pathname = toSegments.join("/");
341957
- }
341958
- from = routePathnameIndex >= 0 ? routePathnames[routePathnameIndex] : "/";
341959
- }
341960
- let path2 = resolvePath$1(to2, from);
341961
- let hasExplicitTrailingSlash = toPathname && toPathname !== "/" && toPathname.endsWith("/");
341962
- let hasCurrentTrailingSlash = (isEmptyPath2 || toPathname === ".") && locationPathname.endsWith("/");
341963
- if (!path2.pathname.endsWith("/") && (hasExplicitTrailingSlash || hasCurrentTrailingSlash)) {
341964
- path2.pathname += "/";
341965
- }
341966
- return path2;
341967
- }
341968
- const joinPaths$1 = (paths) => paths.join("/").replace(/\/\/+/g, "/");
341969
- const normalizePathname$1 = (pathname) => pathname.replace(/\/+$/, "").replace(/^\/*/, "/");
341970
- const normalizeSearch$1 = (search2) => !search2 || search2 === "?" ? "" : search2.startsWith("?") ? search2 : "?" + search2;
341971
- const normalizeHash$1 = (hash2) => !hash2 || hash2 === "#" ? "" : hash2.startsWith("#") ? hash2 : "#" + hash2;
341972
- class AbortedDeferredError extends Error {
341973
- }
341974
- const validMutationMethodsArr$1 = ["post", "put", "patch", "delete"];
341975
- new Set(validMutationMethodsArr$1);
341976
- const validRequestMethodsArr$1 = ["get", ...validMutationMethodsArr$1];
341977
- new Set(validRequestMethodsArr$1);
341978
- const IDLE_FETCHER$1 = {
341979
- state: "idle",
341980
- data: void 0,
341981
- formMethod: void 0,
341982
- formAction: void 0,
341983
- formEncType: void 0,
341984
- formData: void 0,
341985
- json: void 0,
341986
- text: void 0
341987
- };
341988
341990
  /**
341989
341991
  * React Router v6.30.0
341990
341992
  *
@@ -342125,7 +342127,7 @@ function useNavigateUnstable$1() {
342125
342127
  if (options === void 0) {
342126
342128
  options = {};
342127
342129
  }
342128
- process.env.NODE_ENV !== "production" ? warning$1(activeRef.current, navigateEffectWarning$1) : void 0;
342130
+ process.env.NODE_ENV !== "production" ? warning$2(activeRef.current, navigateEffectWarning$1) : void 0;
342129
342131
  if (!activeRef.current) return;
342130
342132
  if (typeof to2 === "number") {
342131
342133
  navigator2.go(to2);
@@ -342233,7 +342235,7 @@ function useNavigateStable$1() {
342233
342235
  if (options === void 0) {
342234
342236
  options = {};
342235
342237
  }
342236
- process.env.NODE_ENV !== "production" ? warning$1(activeRef.current, navigateEffectWarning$1) : void 0;
342238
+ process.env.NODE_ENV !== "production" ? warning$2(activeRef.current, navigateEffectWarning$1) : void 0;
342237
342239
  if (!activeRef.current) return;
342238
342240
  if (typeof to2 === "number") {
342239
342241
  router.navigate(to2);
@@ -342427,7 +342429,7 @@ function isFormDataSubmitterSupported$1() {
342427
342429
  const supportedFormEncTypes$1 = /* @__PURE__ */ new Set(["application/x-www-form-urlencoded", "multipart/form-data", "text/plain"]);
342428
342430
  function getFormEncType$1(encType) {
342429
342431
  if (encType != null && !supportedFormEncTypes$1.has(encType)) {
342430
- process.env.NODE_ENV !== "production" ? warning$1(false, '"' + encType + '" is not a valid `encType` for `<Form>`/`<fetcher.Form>` ' + ('and will default to "' + defaultEncType$1 + '"')) : void 0;
342432
+ process.env.NODE_ENV !== "production" ? warning$2(false, '"' + encType + '" is not a valid `encType` for `<Form>`/`<fetcher.Form>` ' + ('and will default to "' + defaultEncType$1 + '"')) : void 0;
342431
342433
  return null;
342432
342434
  }
342433
342435
  return encType;
@@ -342539,7 +342541,7 @@ const Link$4 = /* @__PURE__ */ reactExports.forwardRef(function LinkWithRef(_ref
342539
342541
  isExternal = true;
342540
342542
  }
342541
342543
  } catch (e2) {
342542
- process.env.NODE_ENV !== "production" ? warning$1(false, '<Link to="' + to2 + '"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.') : void 0;
342544
+ process.env.NODE_ENV !== "production" ? warning$2(false, '<Link to="' + to2 + '"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.') : void 0;
342543
342545
  }
342544
342546
  }
342545
342547
  }
@@ -342921,7 +342923,7 @@ function useScrollRestoration$1(_temp4) {
342921
342923
  try {
342922
342924
  sessionStorage.setItem(storageKey || SCROLL_RESTORATION_STORAGE_KEY$1, JSON.stringify(savedScrollPositions$1));
342923
342925
  } catch (error) {
342924
- process.env.NODE_ENV !== "production" ? warning$1(false, "Failed to save scroll positions in sessionStorage, <ScrollRestoration /> will not work properly (" + error + ").") : void 0;
342926
+ process.env.NODE_ENV !== "production" ? warning$2(false, "Failed to save scroll positions in sessionStorage, <ScrollRestoration /> will not work properly (" + error + ").") : void 0;
342925
342927
  }
342926
342928
  window.history.scrollRestoration = "auto";
342927
342929
  }, [storageKey, getKey2, navigation.state, location, matches2]));
@@ -347958,6 +347960,7 @@ Please check webstudio --help for more details`
347958
347960
 
347959
347961
 
347960
347962
  import type { PageMeta } from "@webstudio-is/sdk";
347963
+ import { toWebstudioParams } from "@webstudio-is/react-sdk";
347961
347964
  ${generateResources({
347962
347965
  scope: scope2,
347963
347966
  // XML generation removes the body wrapper from the instance map.