@visitscotland/component-library
Version:
VisitScotland Component Library
2 lines • 6.53 kB
JavaScript
/*! For license information please see 1beb02ee89c86a88fd16.js.LICENSE.txt */
(self.webpackChunk_visitscotland_component_library=self.webpackChunk_visitscotland_component_library||[]).push([[8086],{48086:function(t,e,n){"use strict";t.exports=n(73527)},73527:function(t,e,n){"use strict";var i=n(87561);let s;const o=t=>s=t,r=Symbol();function c(t){return t&&"object"==typeof t&&"[object Object]"===Object.prototype.toString.call(t)&&"function"!=typeof t.toJSON}var a;e.MutationType=void 0,(a=e.MutationType||(e.MutationType={})).direct="direct",a.patchObject="patch object",a.patchFunction="patch function";const u="undefined"!=typeof window,p=()=>{};function f(t,e,n,s=p){t.push(e);const o=()=>{const n=t.indexOf(e);n>-1&&(t.splice(n,1),s())};return!n&&i.getCurrentScope()&&i.onScopeDispose(o),o}function l(t,...e){t.slice().forEach((t=>{t(...e)}))}const h=t=>t(),d=Symbol(),y=Symbol();function v(t,e){t instanceof Map&&e instanceof Map?e.forEach(((e,n)=>t.set(n,e))):t instanceof Set&&e instanceof Set&&e.forEach(t.add,t);for(const n in e){if(!e.hasOwnProperty(n))continue;const s=e[n],o=t[n];c(o)&&c(s)&&t.hasOwnProperty(n)&&!i.isRef(s)&&!i.isReactive(s)?t[n]=v(o,s):t[n]=s}return t}const _=Symbol();function b(t){return!c(t)||!t.hasOwnProperty(_)}const{assign:$}=Object;function j(t,n,s={},r,c,a){let u;const _=$({actions:{}},s),j={deep:!0};let m,S,g,O=[],R=[];const V=r.state.value[t];let A;function P(n){let s;m=S=!1,"function"==typeof n?(n(r.state.value[t]),s={type:e.MutationType.patchFunction,storeId:t,events:g}):(v(r.state.value[t],n),s={type:e.MutationType.patchObject,payload:n,storeId:t,events:g});const o=A=Symbol();i.nextTick().then((()=>{A===o&&(m=!0)})),S=!0,l(O,s,r.state.value[t])}a||V||(i.isVue2?i.set(r.state.value,t,{}):r.state.value[t]={}),i.ref({});const k=a?function(){const{state:t}=s,e=t?t():{};this.$patch((t=>{$(t,e)}))}:p,w=(e,n="")=>{if(d in e)return e[y]=n,e;const i=function(){o(r);const n=Array.from(arguments),s=[],c=[];let a;l(R,{args:n,name:i[y],store:x,after:function(t){s.push(t)},onError:function(t){c.push(t)}});try{a=e.apply(this&&this.$id===t?this:x,n)}catch(t){throw l(c,t),t}return a instanceof Promise?a.then((t=>(l(s,t),t))).catch((t=>(l(c,t),Promise.reject(t)))):(l(s,a),a)};return i[d]=!0,i[y]=n,i},M={_p:r,$id:t,$onAction:f.bind(null,R),$patch:P,$reset:k,$subscribe(n,s={}){const o=f(O,n,s.detached,(()=>c())),c=u.run((()=>i.watch((()=>r.state.value[t]),(i=>{("sync"===s.flush?S:m)&&n({storeId:t,type:e.MutationType.direct,events:g},i)}),$({},j,s))));return o},$dispose:function(){u.stop(),O=[],R=[],r._s.delete(t)}};i.isVue2&&(M._r=!1);const x=i.reactive(M);r._s.set(t,x);const E=(r._a&&r._a.runWithContext||h)((()=>r._e.run((()=>(u=i.effectScope()).run((()=>n({action:w})))))));for(const e in E){const n=E[e];if(i.isRef(n)&&(T=n,!i.isRef(T)||!T.effect)||i.isReactive(n))a||(V&&b(n)&&(i.isRef(n)?n.value=V[e]:v(n,V[e])),i.isVue2?i.set(r.state.value[t],e,n):r.state.value[t][e]=n);else if("function"==typeof n){const t=w(n,e);i.isVue2?i.set(E,e,t):E[e]=t,_.actions[e]=n}}var T;return i.isVue2?Object.keys(E).forEach((t=>{i.set(x,t,E[t])})):($(x,E),$(i.toRaw(x),E)),Object.defineProperty(x,"$state",{get:()=>r.state.value[t],set:t=>{P((e=>{$(e,t)}))}}),i.isVue2&&(x._r=!0),r._p.forEach((t=>{$(x,u.run((()=>t({store:x,app:r._a,pinia:r,options:_}))))})),V&&a&&s.hydrate&&s.hydrate(x.$state,V),m=!0,S=!0,x}let m="Store";function S(t,e){return Array.isArray(e)?e.reduce(((e,n)=>(e[n]=function(){return t(this.$pinia)[n]},e)),{}):Object.keys(e).reduce(((n,i)=>(n[i]=function(){const n=t(this.$pinia),s=e[i];return"function"==typeof s?s.call(this,n):n[s]},n)),{})}const g=S;e.PiniaVuePlugin=function(t){t.mixin({beforeCreate(){const t=this.$options;if(t.pinia){const e=t.pinia;if(!this._provided){const t={};Object.defineProperty(this,"_provided",{get:()=>t,set:e=>Object.assign(t,e)})}this._provided[r]=e,this.$pinia||(this.$pinia=e),e._a=this,u&&o(e)}else!this.$pinia&&t.parent&&t.parent.$pinia&&(this.$pinia=t.parent.$pinia)},destroyed(){delete this._pStores}})},e.acceptHMRUpdate=function(t,e){return()=>{}},e.createPinia=function(){const t=i.effectScope(!0),e=t.run((()=>i.ref({})));let n=[],s=[];const c=i.markRaw({install(t){o(c),i.isVue2||(c._a=t,t.provide(r,c),t.config.globalProperties.$pinia=c,s.forEach((t=>n.push(t))),s=[])},use(t){return this._a||i.isVue2?n.push(t):s.push(t),this},_p:n,_a:null,_e:t,_s:new Map,state:e});return c},e.defineStore=function(t,e,n){let c,a;const u="function"==typeof e;function p(t,n){const p=i.hasInjectionContext();return(t=t||(p?i.inject(r,null):null))&&o(t),(t=s)._s.has(c)||(u?j(c,e,a,t):function(t,e,n){const{state:s,actions:r,getters:c}=e,a=n.state.value[t];let u;u=j(t,(function(){a||(i.isVue2?i.set(n.state.value,t,s?s():{}):n.state.value[t]=s?s():{});const e=i.toRefs(n.state.value[t]);return $(e,r,Object.keys(c||{}).reduce(((e,s)=>(e[s]=i.markRaw(i.computed((()=>{o(n);const e=n._s.get(t);if(!i.isVue2||e._r)return c[s].call(e,e)}))),e)),{}))}),e,n,0,!0)}(c,a,t)),t._s.get(c)}return"string"==typeof t?(c=t,a=u?n:e):(a=t,c=t.id),p.$id=c,p},e.disposePinia=function(t){t._e.stop(),t._s.clear(),t._p.splice(0),t.state.value={},t._a=null},e.getActivePinia=()=>i.hasInjectionContext()&&i.inject(r)||s,e.mapActions=function(t,e){return Array.isArray(e)?e.reduce(((e,n)=>(e[n]=function(...e){return t(this.$pinia)[n](...e)},e)),{}):Object.keys(e).reduce(((n,i)=>(n[i]=function(...n){return t(this.$pinia)[e[i]](...n)},n)),{})},e.mapGetters=g,e.mapState=S,e.mapStores=function(...t){return t.reduce(((t,e)=>(t[e.$id+m]=function(){return e(this.$pinia)},t)),{})},e.mapWritableState=function(t,e){return Array.isArray(e)?e.reduce(((e,n)=>(e[n]={get(){return t(this.$pinia)[n]},set(e){return t(this.$pinia)[n]=e}},e)),{}):Object.keys(e).reduce(((n,i)=>(n[i]={get(){return t(this.$pinia)[e[i]]},set(n){return t(this.$pinia)[e[i]]=n}},n)),{})},e.setActivePinia=o,e.setMapStoreSuffix=function(t){m=t},e.shouldHydrate=b,e.skipHydrate=function(t){return Object.defineProperty(t,_,{})},e.storeToRefs=function(t){if(i.isVue2)return i.toRefs(t);{const e=i.toRaw(t),n={};for(const s in e){const o=e[s];o.effect?n[s]=i.computed({get:()=>t[s],set(e){t[s]=e}}):(i.isRef(o)||i.isReactive(o))&&(n[s]=i.toRef(t,s))}return n}}},87561:function(t,e,n){var i=n(17527);Object.keys(i).forEach((function(t){e[t]=i[t]})),e.set=function(t,e,n){return Array.isArray(t)?(t.length=Math.max(t.length,e),t.splice(e,1,n),n):(t[e]=n,n)},e.del=function(t,e){Array.isArray(t)?t.splice(e,1):delete t[e]},e.Vue=i,e.Vue2=void 0,e.isVue2=!1,e.isVue3=!0,e.install=function(){}}}]);