@telia-ace/widget-types-grid 1.0.37 → 1.1.1-rc.1
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/index-008a4ecb.js +1 -0
- package/index-1489b1e4.mjs +75 -0
- package/index-31330b2a.mjs +9945 -0
- package/index-48ee95ae.js +1 -0
- package/index-61eaf406.js +703 -0
- package/index-dc8062c1.js +9 -0
- package/index-ebd3abf1.mjs +76 -0
- package/index-fa7051e6.mjs +816 -0
- package/index.js +1 -0
- package/index.mjs +12 -0
- package/package.json +21 -53
- package/render-37a76217.mjs +51 -0
- package/render-5f9647e7.js +1 -0
- package/{dist/unmount-063d8ea3.js → unmount-063d8ea3.mjs} +0 -1
- package/unmount-481ce5a7.js +1 -0
- package/LICENSE.txt +0 -6
- package/README.md +0 -3
- package/dist/index.js +0 -950
- package/dist/index.js.map +0 -1
- package/dist/render-668e4aa4.js +0 -64
- package/dist/render-668e4aa4.js.map +0 -1
- package/dist/ui/index.d.ts +0 -6
- package/dist/unmount-063d8ea3.js.map +0 -1
- /package/{dist/component-platform-factory.d.ts → component-platform-factory.d.ts} +0 -0
- /package/{dist/index.d.ts → index.d.ts} +0 -0
- /package/{dist/services.d.ts → services.d.ts} +0 -0
- /package/{dist/ui → ui}/animated-view.d.ts +0 -0
- /package/{dist/ui → ui}/component.d.ts +0 -0
- /package/{dist/ui → ui}/detached-component.d.ts +0 -0
- /package/{dist/ui → ui}/determine-slide-direction.d.ts +0 -0
- /package/{dist/ui → ui}/html-element-handlers.d.ts +0 -0
- /package/{dist/ui → ui}/not-found.d.ts +0 -0
- /package/{dist/ui → ui}/prepare-dom.d.ts +0 -0
- /package/{dist/ui → ui}/render.d.ts +0 -0
- /package/{dist/ui → ui}/resolvable-component.d.ts +0 -0
- /package/{dist/ui → ui}/styles.d.ts +0 -0
- /package/{dist/ui → ui}/switch.d.ts +0 -0
- /package/{dist/ui → ui}/unmount.d.ts +0 -0
- /package/{dist/ui → ui}/use-component-node-properties.d.ts +0 -0
- /package/{dist/ui → ui}/use-router.d.ts +0 -0
- /package/{dist/ui → ui}/view-outlet.d.ts +0 -0
- /package/{dist/ui → ui}/view.d.ts +0 -0
- /package/{dist/ui → ui}/wrapper.d.ts +0 -0
- /package/{dist/widget.d.ts → widget.d.ts} +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var yt=Object.defineProperty;var vt=(r,t,e)=>t in r?yt(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e;var T=(r,t,e)=>(vt(r,typeof t!="symbol"?t+"":t,e),e);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("./index-61eaf406.js");require("react/jsx-runtime");require("react");require("react-dom");function wt(r={}){const{phrase:t="",category:e,guideCategory:n,contactCategory:i,take:a,connectionKey:c,accordion:p,id:f,uriName:d,sorting:P,tag:m,tagId:k,tagTitle:D,...I}=r,h={};return Object.keys(I).forEach(E=>{typeof r[E]=="string"&&(h[E]=r[E])}),typeof t=="string"&&t.length&&(h.phrase=t),t===null&&(h.phrase=t),typeof n=="string"&&n!=="0"&&(h.guideCategory=n),typeof n=="number"&&n!==0&&(h.guideCategory=n),typeof n=="object"&&n!==null&&(typeof n.id=="string"&&n.id!=="0"&&(h.guideCategory=n.id),typeof n.id=="number"&&n.id!==0&&(h.guideCategory=n.id)),typeof i=="string"&&i!=="0"&&(h.contactCategory=i),typeof i=="number"&&i!==0&&(h.contactCategory=i),typeof i=="object"&&i!==null&&(typeof i.id=="string"&&i.id!=="0"&&(h.contactCategory=i.id),typeof i.id=="number"&&i.id!==0&&(h.contactCategory=i.id)),typeof e=="string"&&e!=="0"&&(h.category=e),typeof e=="number"&&e!==0&&(h.category=e),typeof e=="object"&&e!==null&&(typeof e.id=="string"&&e.id!=="0"&&(h.category=e.id),typeof e.id=="number"&&e.id!==0&&(h.category=e.id)),f&&(h.id=f),d&&(+h.category||+h.guideCategory||+h.guide||+h.contactCategory||+h.contactMethod)&&(h.uriName=d),c&&(h.connectionKey=c),a&&(h.take=a),P&&(h.sorting=P),typeof p=="string"&&p.length>0&&(h.accordion=p),typeof m=="string"&&m!=="0"&&(h.tag=m),typeof m=="number"&&m!==0&&(h.tag=m),Array.isArray(m)&&m.length&&(h.tag=m),(typeof k=="string"||typeof k=="number")&&(h.tagId=k),typeof D=="string"&&(h.tagTitle=D),typeof h.tag=="string"&&(h.tag=h.tag.split(",")),h}const tt=(r,t)=>{let e=!0;return Object.keys(r).length!==Object.keys(t).length||Object.keys(r).some(i=>!Object.keys(t).some(c=>i===c))?!1:(Object.keys(r).forEach(i=>{if(e){const a=typeof r[i]>"u"?"":r[i],c=typeof t[i]>"u"?"":t[i];e=a.toString()===c.toString()}}),e)};var Pt=function(r,t,e,n,i,a,c,p){if(process.env.NODE_ENV!=="production"&&t===void 0)throw new Error("invariant requires an error message argument");if(!r){var f;if(t===void 0)f=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var d=[e,n,i,a,c,p],P=0;f=new Error(t.replace(/%s/g,function(){return d[P++]})),f.name="Invariant Violation"}throw f.framesToPop=1,f}},bt=Pt;const St=o.getDefaultExportFromCjs(bt);var xt=function(t){return t.charAt(0)==="/"?t:"/"+t},lt=function(t,e){return new RegExp("^"+e+"(\\/|\\?|#|$)","i").test(t)},Lt=function(t,e){return lt(t,e)?t.substr(e.length):t},Ht=function(t){return t.charAt(t.length-1)==="/"?t.slice(0,-1):t},Ot=function(t){var e=t||"/",n="",i="",a=e.indexOf("#");a!==-1&&(i=e.substr(a),e=e.substr(0,a));var c=e.indexOf("?");return c!==-1&&(n=e.substr(c),e=e.substr(0,c)),{pathname:e,search:n==="?"?"":n,hash:i==="#"?"":i}},gt=function(t){var e=t.pathname,n=t.search,i=t.hash,a=e||"/";return n&&n!=="?"&&(a+=n.charAt(0)==="?"?n:"?"+n),i&&i!=="#"&&(a+=i.charAt(0)==="#"?i:"#"+i),a},Mt=Object.assign||function(r){for(var t=1;t<arguments.length;t++){var e=arguments[t];for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(r[n]=e[n])}return r},K=function(t,e,n,i){var a=void 0;typeof t=="string"?(a=Ot(t),a.state=e):(a=Mt({},t),a.pathname===void 0&&(a.pathname=""),a.search?a.search.charAt(0)!=="?"&&(a.search="?"+a.search):a.search="",a.hash?a.hash.charAt(0)!=="#"&&(a.hash="#"+a.hash):a.hash="",e!==void 0&&a.state===void 0&&(a.state=e));try{a.pathname=decodeURI(a.pathname)}catch(c){throw c instanceof URIError?new URIError('Pathname "'+a.pathname+'" could not be decoded. This is likely caused by an invalid percent-encoding.'):c}return n&&(a.key=n),i?a.pathname?a.pathname.charAt(0)!=="/"&&(a.pathname=o.resolvePathname(a.pathname,i.pathname)):a.pathname=i.pathname:a.pathname||(a.pathname="/"),a},pt=function(){var t=null,e=function(f){return o.warning(t==null,"A history supports only one prompt at a time"),t=f,function(){t===f&&(t=null)}},n=function(f,d,P,m){if(t!=null){var k=typeof t=="function"?t(f,d):t;typeof k=="string"?typeof P=="function"?P(k,m):(o.warning(!1,"A history needs a getUserConfirmation function in order to use a prompt message"),m(!0)):m(k!==!1)}else m(!0)},i=[],a=function(f){var d=!0,P=function(){d&&f.apply(void 0,arguments)};return i.push(P),function(){d=!1,i=i.filter(function(m){return m!==P})}},c=function(){for(var f=arguments.length,d=Array(f),P=0;P<f;P++)d[P]=arguments[P];i.forEach(function(m){return m.apply(void 0,d)})};return{setPrompt:e,confirmTransitionTo:n,appendListener:a,notifyListeners:c}},Et=!!(typeof window<"u"&&window.document&&window.document.createElement),et=function(t,e,n){return t.addEventListener?t.addEventListener(e,n,!1):t.attachEvent("on"+e,n)},nt=function(t,e,n){return t.removeEventListener?t.removeEventListener(e,n,!1):t.detachEvent("on"+e,n)},Rt=function(t,e){return e(window.confirm(t))},kt=function(){var t=window.navigator.userAgent;return(t.indexOf("Android 2.")!==-1||t.indexOf("Android 4.0")!==-1)&&t.indexOf("Mobile Safari")!==-1&&t.indexOf("Chrome")===-1&&t.indexOf("Windows Phone")===-1?!1:window.history&&"pushState"in window.history},Ct=function(){return window.navigator.userAgent.indexOf("Trident")===-1},Tt=function(t){return t.state===void 0&&navigator.userAgent.indexOf("CriOS")===-1},at=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(r){return typeof r}:function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},It=Object.assign||function(r){for(var t=1;t<arguments.length;t++){var e=arguments[t];for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(r[n]=e[n])}return r},rt="popstate",it="hashchange",ot=function(){try{return window.history.state||{}}catch{return{}}},_t=function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};St(Et,"Browser history needs a DOM");var e=window.history,n=kt(),i=!Ct(),a=t.forceRefresh,c=a===void 0?!1:a,p=t.getUserConfirmation,f=p===void 0?Rt:p,d=t.keyLength,P=d===void 0?6:d,m=t.basename?Ht(xt(t.basename)):"",k=function(s){var y=s||{},b=y.key,v=y.state,M=window.location,x=M.pathname,_=M.search,B=M.hash,A=x+_+B;return o.warning(!m||lt(A,m),'You are attempting to use a basename on a page whose URL path does not begin with the basename. Expected path "'+A+'" to begin with "'+m+'".'),m&&(A=Lt(A,m)),K(A,v,b)},D=function(){return Math.random().toString(36).substr(2,P)},I=pt(),h=function(s){It(g,s),g.length=e.length,I.notifyListeners(g.location,g.action)},E=function(s){Tt(s)||W(k(s.state))},U=function(){W(k(ot()))},F=!1,W=function(s){if(F)F=!1,h();else{var y="POP";I.confirmTransitionTo(s,y,f,function(b){b?h({action:y,location:s}):Y(s)})}},Y=function(s){var y=g.location,b=$.indexOf(y.key);b===-1&&(b=0);var v=$.indexOf(s.key);v===-1&&(v=0);var M=b-v;M&&(F=!0,L(M))},V=k(ot()),$=[V.key],w=function(s){return m+gt(s)},H=function(s,y){o.warning(!((typeof s>"u"?"undefined":at(s))==="object"&&s.state!==void 0&&y!==void 0),"You should avoid providing a 2nd state argument to push when the 1st argument is a location-like object that already has state; it is ignored");var b="PUSH",v=K(s,y,D(),g.location);I.confirmTransitionTo(v,b,f,function(M){if(M){var x=w(v),_=v.key,B=v.state;if(n)if(e.pushState({key:_,state:B},null,x),c)window.location.href=x;else{var A=$.indexOf(g.location.key),G=$.slice(0,A===-1?0:A+1);G.push(v.key),$=G,h({action:b,location:v})}else o.warning(B===void 0,"Browser history cannot push state in browsers that do not support HTML5 history"),window.location.href=x}})},S=function(s,y){o.warning(!((typeof s>"u"?"undefined":at(s))==="object"&&s.state!==void 0&&y!==void 0),"You should avoid providing a 2nd state argument to replace when the 1st argument is a location-like object that already has state; it is ignored");var b="REPLACE",v=K(s,y,D(),g.location);I.confirmTransitionTo(v,b,f,function(M){if(M){var x=w(v),_=v.key,B=v.state;if(n)if(e.replaceState({key:_,state:B},null,x),c)window.location.replace(x);else{var A=$.indexOf(g.location.key);A!==-1&&($[A]=v.key),h({action:b,location:v})}else o.warning(B===void 0,"Browser history cannot replace state in browsers that do not support HTML5 history"),window.location.replace(x)}})},L=function(s){e.go(s)},C=function(){return L(-1)},O=function(){return L(1)},j=0,z=function(s){j+=s,j===1?(et(window,rt,E),i&&et(window,it,U)):j===0&&(nt(window,rt,E),i&&nt(window,it,U))},N=!1,R=function(){var s=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,y=I.setPrompt(s);return N||(z(1),N=!0),function(){return N&&(N=!1,z(-1)),y()}},l=function(s){var y=I.appendListener(s);return z(1),function(){z(-1),y()}},g={length:e.length,action:"POP",location:V,createHref:w,push:H,replace:S,go:L,goBack:C,goForward:O,block:R,listen:l};return g},st=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(r){return typeof r}:function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},At=Object.assign||function(r){for(var t=1;t<arguments.length;t++){var e=arguments[t];for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(r[n]=e[n])}return r},ct=function(t,e,n){return Math.min(Math.max(t,e),n)},Dt=function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},e=t.getUserConfirmation,n=t.initialEntries,i=n===void 0?["/"]:n,a=t.initialIndex,c=a===void 0?0:a,p=t.keyLength,f=p===void 0?6:p,d=pt(),P=function(S){At(w,S),w.length=w.entries.length,d.notifyListeners(w.location,w.action)},m=function(){return Math.random().toString(36).substr(2,f)},k=ct(c,0,i.length-1),D=i.map(function(H){return typeof H=="string"?K(H,void 0,m()):K(H,void 0,H.key||m())}),I=gt,h=function(S,L){o.warning(!((typeof S>"u"?"undefined":st(S))==="object"&&S.state!==void 0&&L!==void 0),"You should avoid providing a 2nd state argument to push when the 1st argument is a location-like object that already has state; it is ignored");var C="PUSH",O=K(S,L,m(),w.location);d.confirmTransitionTo(O,C,e,function(j){if(j){var z=w.index,N=z+1,R=w.entries.slice(0);R.length>N?R.splice(N,R.length-N,O):R.push(O),P({action:C,location:O,index:N,entries:R})}})},E=function(S,L){o.warning(!((typeof S>"u"?"undefined":st(S))==="object"&&S.state!==void 0&&L!==void 0),"You should avoid providing a 2nd state argument to replace when the 1st argument is a location-like object that already has state; it is ignored");var C="REPLACE",O=K(S,L,m(),w.location);d.confirmTransitionTo(O,C,e,function(j){j&&(w.entries[w.index]=O,P({action:C,location:O}))})},U=function(S){var L=ct(w.index+S,0,w.entries.length-1),C="POP",O=w.entries[L];d.confirmTransitionTo(O,C,e,function(j){j?P({action:C,location:O,index:L}):P()})},F=function(){return U(-1)},W=function(){return U(1)},Y=function(S){var L=w.index+S;return L>=0&&L<w.entries.length},V=function(){var S=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1;return d.setPrompt(S)},$=function(S){return d.appendListener(S)},w={length:D.length,action:"POP",location:D[k],index:k,entries:D,createHref:I,push:h,replace:E,go:U,goBack:F,goForward:W,canGo:Y,block:V,listen:$};return w};const ht="hashchange",$t={hashbang:{encodePath:r=>r.charAt(0)==="!"?r:"!/"+o.stripLeadingSlash_1(r),decodePath:r=>r.charAt(0)==="!"?r.substr(1):r},noslash:{encodePath:o.stripLeadingSlash_1,decodePath:o.addLeadingSlash_1},slash:{encodePath:o.addLeadingSlash_1,decodePath:o.addLeadingSlash_1}},q=()=>{const r=window.location.href,t=r.indexOf("#");return t===-1?"":r.substring(t+1)},ut=r=>window.location.hash=r,ft=r=>{const t=window.location.href.indexOf("#");window.location.replace(window.location.href.slice(0,t>=0?t:0)+"#"+r)},Q=(r="")=>{const t=r.replace(";","?"),e=[{from:/\;+/gi,to:"&"},{from:/:+/gi,to:"="}];let n=t;return e.forEach(({to:i,from:a})=>{n=n.replace(a,i)}),n},mt=(r={})=>{const t=window.history,{getUserConfirmation:e=o.getConfirmation_1,hashType:n="slash"}=r,i=r.basename?o.stripTrailingSlash_1(o.addLeadingSlash_1(r.basename)):"",{encodePath:a}=$t[n],c=()=>{const l=q(),g=P(l);return o.createLocation(g,Q)},p=r.transitionManager||o._default(),f=l=>{Object.assign(R,l),R.length=t.length,p.notifyListeners(R.location,R.action,r.widgetName)};let d=!1;const P=l=>{const g=y=>{function b(v,M){const x={};let _;for(;_=M.exec(v);)x[_[1]]=_[2];return x}return b(y,/([^#?&=]+)=([^&#]*)(?!.*?\#)/gi)||null},u="humany-"+r.widgetName;return g(l)[u]},m=()=>{const l=c(),g=R.location;!d&&o.locationsAreEqual_1(g,l)||k(l)},k=l=>{if(d)d=!1,f();else{const g="POP";p.confirmTransitionTo(l,g,e,u=>{u?f({action:g,location:l}):D(l)})}},D=l=>{const g=R.location;let u=E.lastIndexOf(o.createPath_1(g));u===-1&&(u=0);let s=E.lastIndexOf(o.createPath_1(l));s===-1&&(s=0);const y=u-s;y&&(d=!0,w(y))},I=q(),h=a(I);I!==h&&ft(h);let E=[];const U=c();U.pathname!==null&&E.push(o.createPath_1(U));const F=(l="")=>{const g=[{from:/\?+/gi,to:";"},{from:/\&+/gi,to:";"},{from:/\&+/gi,to:";"},{from:/=+/gi,to:":"}];let u=l;return g.forEach(({to:s,from:y})=>{u=u.replace(y,s)}),u},W=(l,g,u)=>{let s="",y=!1;return l.split("&").forEach(v=>{const M=v.split("="),x=M[0],_=M[1];if(x===g){if(y=!0,u===null)return;s.length>0&&(s+="&"),typeof u<"u"?s+=x+"="+u:s+=x}else x&&(s.length>0&&(s+="&"),s+=x+"="+_)}),!y&&u!==null&&(s.length>0&&(s+="&"),typeof u<"u"?s+=g+"="+u:s+=g),s},Y=l=>{const g=l.pathname,u=F(l.search),s=g+(u?`;${u}`:""),b=`humany-${r.widgetName}`,v=q();return`#${W(v,b,s).replace(";;",";")}`},V=(l,g)=>{const u="PUSH",s=o.createLocation(l,Q),y=s.pathname,b=F(s.search),v=y+(b?`${b}`:""),x=`humany-${r.widgetName}`,_=q(),B=W(_,x,v);p.confirmTransitionTo(s,u,e,A=>{if(!A)return;const G=o.createPath_1(s),J=a(B);if(q()!==J){ut(J);const X=E.lastIndexOf(o.createPath_1(R.location)),Z=E.slice(0,X===-1?0:X+1);Z.push(G),E=Z,f({action:u,location:s})}else f()})},$=(l,g)=>{const u="REPLACE",s=o.createLocation(l,Q);p.confirmTransitionTo(s,u,e,y=>{if(!y)return;const b=o.createPath_1(s),v=a(i+b);q()!==v&&ft(v);const x=E.indexOf(o.createPath_1(R.location));x!==-1&&(E[x]=b),f({action:u,location:s})})},w=l=>{t.go(l)},H=()=>w(-1),S=()=>w(1);let L=0;const C=l=>{L+=l,L===1?window.addEventListener(ht,m):L===0&&window.removeEventListener(ht,m)};let O=!1;const j=(l=!1)=>{const g=p.setPrompt(l);return O||(C(1),O=!0),()=>(O&&(O=!1,C(-1)),g())},z=l=>{const g=p.appendListener(l);return C(1),()=>{C(-1),g()}},N=()=>{const l=q(),g=W(l,`humany-${r.widgetName}`,null),u=a(g);ut(u)},R={createHref:Y,createLocation:o.createLocation,push:V,replace:$,go:w,goBack:H,goForward:S,block:j,listen:z,stop:N,length:t.length,action:"POP",location:U};return R},jt=Object.freeze(Object.defineProperty({__proto__:null,decodeSearch:Q,default:mt,getHashPath:q},Symbol.toStringTag,{value:"Module"})),dt="routeData";class Nt{constructor(t,e){T(this,"settings");T(this,"routes");T(this,"steps",[]);T(this,"location");T(this,"history");T(this,"widget");T(this,"match");T(this,"currentRoute");T(this,"historyListenSubscription",()=>{});T(this,"initialized");T(this,"sticky",!1);T(this,"storageWriter",null);T(this,"storageMedium");this.container=t,this.widget=t.get("$widget");const{routes:n,...i}=e;this.settings={...i,...t.get("routingSettings")},this.sticky=o.determineIfSticky(this.settings),this.storageMedium=this.sticky?o.StorageMedium.Local:o.StorageMedium.Session,o.createStorageWriter(t,dt,o.StorageCategory.Necessary,{medium:this.storageMedium}).then(a=>this.storageWriter=a),this.routes=n}initialize(){return this.initialized=this.initialized||this.createHistory().then(t=>{this.history=t,this.location=t.location,this.historyListenSubscription=t.listen((e,n,i)=>this.handleLocationChange(e,i))})}setMatch(t){if(this.match=t,this.location){const e=this.getRouteData(),n={routeData:e,location:this.location},i=this.steps[0],a=e.name===(i==null?void 0:i.routeData.name),c=tt(e.params,(i==null?void 0:i.routeData.params)||{});(!a||!c)&&(this.widget.events.dispatch("router:change",{next:n,previous:i}),this.steps.unshift(n),this.storageWriter&&this.storageWriter(n.routeData),this.widget.events.dispatch("router:changed",{previous:i,current:n}))}}onRouteChange(t){return this.widget.events.subscribe("router:change",t)}isSticky(){return this.sticky}generate(t,e={}){const n=o.findRoute(t,this.routes);if(!n||!this.history)throw`No route found for ${t}`;const i=o.createParamsPath(e,n.path);if(!i)throw`Unable to generate path for "${t}".`;const a=o.createLocation(i,this.settings.decodeSearch);let c=this.history.createHref(a);const{mode:p,basePath:f}=this.settings;return p==="browser"&&f&&(c=c.replace(f,"")),c.charAt(0)!=="/"&&(c=`/${c}`),c}navigate(t,e={}){const n=o.findRoute(t,this.routes);if(!n||!this.history)return;const i=o.createParamsPath(e,n.path);if(!i)return;const a=this.getRouteData(),c=a&&a.name===t&&o.compareParams(a.params,e);if(this.steps[0]&&c)return;const{decodeSearch:f}=this.settings,d=f?f(i):i;this.widget.events.dispatch("router:navigate",{decodedPath:d}),d.charAt(0)!=="/"?this.history.push(`/${d}`):this.history.push(d)}hasBack(){if(this.steps.length>1)return!0;const t=this.getRouteData(this.settings.initialPath),e=this.getRouteData(),n=e.name===t.name,i=tt(e.params,t.params);return!n||!i}goBack(t=1){if(this.steps.length<2){const e=this.getRouteData(this.settings.initialPath);e&&e.name&&(this.navigate(e.name,e.params),this.steps=[])}else{const e=t>=this.steps.length?this.steps.length-1:t,{routeData:n}=this.steps[e];this.steps=[...this.steps.slice(e+1)],this.navigate(n.name,wt(n.params))}}goForward(){this.history&&this.history.goForward()}current(){return this.location}getInitialRoute(){const{name:t}=this.getRouteData(this.settings.initialPath),e=this.routes.find(n=>n.name===t);return e||(this.routes.length>0?this.routes[0]:(process.env.NODE_ENV!=="production"&&o.Logger.warn("Unable to get initial route as no routes are defined."),null))}getRouteData(t){const e=o.getNotFoundRoute(this.container);if(t){const n=o.matchRoute(t,this.routes);return n?{params:o.removeNullAndUndefinedValues(o.matchParams(t,n.path)),name:n.name}:e||{name:"",params:{}}}if(this.location){const{pathname:n,search:i}=this.location;if(this.currentRoute=this.currentRoute||o.matchRoute(n,this.routes),this.currentRoute){const{path:a,name:c}=this.currentRoute;this.match||(this.match={params:o.matchParams(n,a),isExact:!0,path:a,url:n});const p=o.removeNullAndUndefinedValues({...this.match.params,...i.length>0&&o.queryStringAsObject(i)});return{name:c,params:p}}}return e||{name:"",params:{}}}dispose(){return this.historyListenSubscription(),this.stop()}setupInitialRoute(){return o.readStorage(this.container,dt,this.storageMedium).then(t=>{if(!this.location||!this.history)return;const{initialPath:e,mode:n}=this.settings;switch((()=>{const a=o.onWidgetUrl(this.container);return n===o.HistoryMode.browser||a?o.InitializationMode.path:n===o.HistoryMode.memory&&t?o.InitializationMode.storage:o.InitializationMode.initialPath})()){case o.InitializationMode.initialPath:{const a=this.getRouteData(e);return a&&a.name?this.navigate(a.name,a.params):void 0}case o.InitializationMode.path:{const{pathname:a}=this.location;if(this.currentRoute=o.matchRoute(a,this.routes),this.currentRoute){const{path:p}=this.currentRoute;return this.setMatch({params:o.matchParams(a,p),isExact:!0,path:p,url:a})}const c=o.getNotFoundRoute(this.container);return c?this.setMatch({params:{},isExact:!0,path:c.name,url:a}):void 0}case o.InitializationMode.storage:{const{pathname:a}=this.location;this.currentRoute=o.matchRoute(a,this.routes);const{name:c="",params:p={}}=t||{},f=o.findRoute(c,this.routes);if(f){const d=o.createParamsPath(p,f.path);if(d)return this.history.push(d),this.location={...this.location,pathname:d},this.currentRoute=o.matchRoute(d,this.routes),this.setMatch({params:p,isExact:!0,path:f.path,url:d})}return}}})}start(){return this.setupInitialRoute()}stop(){return this.history&&(this.settings.mode===o.HistoryMode.scopedHash&&this.history.stop(),this.steps=[],this.storageWriter)?this.storageWriter():Promise.resolve()}handleLocationChange(t,e){const{pathname:n}=t,{mode:i}=this.settings;if(n.indexOf("?")>-1||n.indexOf(";")>-1||i===o.HistoryMode.scopedHash&&e!==this.widget.name)return;this.location=t,this.currentRoute=o.matchRoute(n,this.routes);const a=o.getNotFoundRoute(this.container);if(this.currentRoute){const{path:c}=this.currentRoute;this.setMatch({params:o.matchParams(n,c),isExact:!0,path:c,url:n})}else a&&this.setMatch({params:{},isExact:!0,path:a.name,url:n})}createHistory(){return new Promise(t=>{const{mode:e,basePath:n}=this.settings;if(e===o.HistoryMode.scopedHash){const i=this.widget.name,a=o.getTransitionManager(this.container);return Promise.resolve().then(()=>jt).then(c=>{const p=c.default({widgetName:i,transitionManager:a,hashType:"noslash"});return t(p)})}if(e===o.HistoryMode.memory)return t(Dt());if(e===o.HistoryMode.browser)return t(_t({basename:n}));throw"RoutingService: History could not be created."})}}exports.HistoryMode=o.HistoryMode;exports.getScopedHashDOMLocation=o.getScopedHashDOMLocation;exports.getSpecificWidgetPath=o.getSpecificWidgetPath;exports.matchParams=o.matchParams;exports.onWidgetUrl=o.onWidgetUrl;exports.RoutingService=Nt;exports.createHashHistory=mt;
|