materio-d9/web/themes/custom/materiotheme/assets/dist/main.js

38 lines
481 KiB
JavaScript
Raw Permalink Normal View History

/*! For license information please see main.js.LICENSE.txt */
2022-10-31 11:10:51 +01:00
(()=>{var e,t,n,i={9669:(e,t,n)=>{e.exports=n(1609)},5448:(e,t,n)=>{"use strict";var i=n(4867),r=n(6026),o=n(4372),a=n(5327),s=n(4097),c=n(4109),l=n(7985),u=n(5061);e.exports=function(e){return new Promise((function(t,n){var d=e.data,f=e.headers;i.isFormData(d)&&delete f["Content-Type"];var p=new XMLHttpRequest;if(e.auth){var h=e.auth.username||"",m=e.auth.password?unescape(encodeURIComponent(e.auth.password)):"";f.Authorization="Basic "+btoa(h+":"+m)}var v=s(e.baseURL,e.url);if(p.open(e.method.toUpperCase(),a(v,e.params,e.paramsSerializer),!0),p.timeout=e.timeout,p.onreadystatechange=function(){if(p&&4===p.readyState&&(0!==p.status||p.responseURL&&0===p.responseURL.indexOf("file:"))){var i="getAllResponseHeaders"in p?c(p.getAllResponseHeaders()):null,o={data:e.responseType&&"text"!==e.responseType?p.response:p.responseText,status:p.status,statusText:p.statusText,headers:i,config:e,request:p};r(t,n,o),p=null}},p.onabort=function(){p&&(n(u("Request aborted",e,"ECONNABORTED",p)),p=null)},p.onerror=function(){n(u("Network Error",e,null,p)),p=null},p.ontimeout=function(){var t="timeout of "+e.timeout+"ms exceeded";e.timeoutErrorMessage&&(t=e.timeoutErrorMessage),n(u(t,e,"ECONNABORTED",p)),p=null},i.isStandardBrowserEnv()){var g=(e.withCredentials||l(v))&&e.xsrfCookieName?o.read(e.xsrfCookieName):void 0;g&&(f[e.xsrfHeaderName]=g)}if("setRequestHeader"in p&&i.forEach(f,(function(e,t){void 0===d&&"content-type"===t.toLowerCase()?delete f[t]:p.setRequestHeader(t,e)})),i.isUndefined(e.withCredentials)||(p.withCredentials=!!e.withCredentials),e.responseType)try{p.responseType=e.responseType}catch(t){if("json"!==e.responseType)throw t}"function"==typeof e.onDownloadProgress&&p.addEventListener("progress",e.onDownloadProgress),"function"==typeof e.onUploadProgress&&p.upload&&p.upload.addEventListener("progress",e.onUploadProgress),e.cancelToken&&e.cancelToken.promise.then((function(e){p&&(p.abort(),n(e),p=null)})),d||(d=null),p.send(d)}))}},1609:(e,t,n)=>{"use strict";var i=n(4867),r=n(1849),o=n(321),a=n(7185);function s(e){var t=new o(e),n=r(o.prototype.request,t);return i.extend(n,o.prototype,t),i.extend(n,t),n}var c=s(n(5655));c.Axios=o,c.create=function(e){return s(a(c.defaults,e))},c.Cancel=n(5263),c.CancelToken=n(4972),c.isCancel=n(6502),c.all=function(e){return Promise.all(e)},c.spread=n(8713),c.isAxiosError=n(6268),e.exports=c,e.exports.default=c},5263:e=>{"use strict";function t(e){this.message=e}t.prototype.toString=function(){return"Cancel"+(this.message?": "+this.message:"")},t.prototype.__CANCEL__=!0,e.exports=t},4972:(e,t,n)=>{"use strict";var i=n(5263);function r(e){if("function"!=typeof e)throw new TypeError("executor must be a function.");var t;this.promise=new Promise((function(e){t=e}));var n=this;e((function(e){n.reason||(n.reason=new i(e),t(n.reason))}))}r.prototype.throwIfRequested=function(){if(this.reason)throw this.reason},r.source=function(){var e;return{token:new r((function(t){e=t})),cancel:e}},e.exports=r},6502:e=>{"use strict";e.exports=function(e){return!(!e||!e.__CANCEL__)}},321:(e,t,n)=>{"use strict";var i=n(4867),r=n(5327),o=n(782),a=n(3572),s=n(7185);function c(e){this.defaults=e,this.interceptors={request:new o,response:new o}}c.prototype.request=function(e){"string"==typeof e?(e=arguments[1]||{}).url=arguments[0]:e=e||{},(e=s(this.defaults,e)).method?e.method=e.method.toLowerCase():this.defaults.method?e.method=this.defaults.method.toLowerCase():e.method="get";var t=[a,void 0],n=Promise.resolve(e);for(this.interceptors.request.forEach((function(e){t.unshift(e.fulfilled,e.rejected)})),this.interceptors.response.forEach((function(e){t.push(e.fulfilled,e.rejected)}));t.length;)n=n.then(t.shift(),t.shift());return n},c.prototype.getUri=function(e){return e=s(this.defaults,e),r(e.url,e.params,e.paramsSerializer).replace(/^\?/,"")},i.forEach(["delete","get","head","options"],(function(e){c.prototype[e]=function(t,n){return this.request(s(n||{},{method:e,url:t,data:(n||{}).data}))}})),i.forEach(["post","put","patch"],(function(e){c.prototype[e]=function(t,n,i){return this.request(s(i||{},{method:e,url:
materiau(id: ${this.item.id}, lang: "${drupalDecoupled.lang_code}") {
...MateriauModalFields
}
}
${b()}
2022-10-31 11:10:51 +01:00
`;h.Z.post("",{query:(0,m.S)(e)}).then((({data:{data:{materiau:e}}})=>{this.material=e,this.loading=!1,e.note&&e.note.id&&(this.note_id=e.note.id,this.note=e.note.contenu),this.setcoolLightBoxItems(this.material.images)})).catch((e=>{console.warn("Issue with loadMaterial",e),Promise.reject(e)}))},onCreateFlagColl(){this.new_folder_name,this.is_creating_folder=!0,this.createFlagColl(this.new_folder_name).then((e=>{this.new_folder_name="",this.is_creating_folder=!1;let t=e.id;this.loadingFlag=t,this.flagUnflag({action:"flag",id:this.item.id,collid:t}).then((e=>{this.loadingFlag=!1}))}))},flagIsActive(e){return-1!==this.flagcolls[e].items.indexOf(this.item.id)},flagIsLoading(e){return e===this.loadingFlag},onFlagActionCard(e){if(!this.loadingFlag){let t=e.target.getAttribute("collid"),n=this.flagIsActive(t)?"unflag":"flag";this.loadingFlag=t,this.flagUnflag({action:n,id:this.item.id,collid:t}).then((e=>{this.loadingFlag=!1}))}},onCloseModalCard(e){this.$modal.hide(`modal-${this.item.id}`)},onSwipeCard(e){switch(e){case"top":case"bottom":break;case"left":case"right":this.$modal.hide(`modal-${this.item.id}`)}},prettyFileSize:e=>_(parseInt(e)),shortUrl:e=>e.replace(/^http:\/\//,"").replace(/^www\./,""),onNoteInput(e){this.note,this.note=e.target.value,this.debouncedSaveNote()},saveNote(){this.note_id,this.note,this.note_id?this.updateNote():this.createNote()},updateNote(){let e={type:[{target_id:"note"}],field_contenu:this.note},t={headers:{"X-CSRF-Token":this.csrf_token}};p.Z.patch(`/node/${this.note_id}?_format=json`,e,t).then((({data:e})=>{})).catch((e=>{console.warn("Issue with updateNote",e)}))},createNote(){let e={type:[{target_id:"note"}],title:[{value:"note"}],field_contenu:this.note,field_target:this.item.id},t={headers:{"X-CSRF-Token":this.csrf_token}};p.Z.post("/node?_format=json",e,t).then((({data:e})=>{this.note_id=e.nid[0].value,this.addNoteId(this.note_id)})).catch((e=>{console.warn("Issue with createNote",e)}))},onTapTool(e){e.target.parentNode.parentNode.querySelectorAll("section.tool").forEach(((e,t)=>{e.classList.remove("tapped")})),e.target.parentNode.classList.add("tapped")},onTapCard(e){if(e.target.tagName,"TEXTAREA"==e.target.tagName)return;this.$refs.tools.querySelectorAll("section.tool").forEach(((e,t)=>{e.classList.remove("tapped")}))},setLightBox(e){this.setcoolLightBoxItems(this.material.images),this.setcoolLightBoxIndex(e)}}};var S=(0,u.Z)(k,i,[],!1,null,"62d62e96",null);S.options.__file="web/themes/custom/materiotheme/vuejs/components/Content/ModalCard.vue";const x=S.exports},1900:(e,t,n)=>{"use strict";function i(e,t,n,i,r,o,a,s){var c,l="function"==typeof e?e.options:e;if(t&&(l.render=t,l.staticRenderFns=n,l._compiled=!0),i&&(l.functional=!0),o&&(l._scopeId="data-v-"+o),a?(c=function(e){(e=e||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext)||"undefined"==typeof __VUE_SSR_CONTEXT__||(e=__VUE_SSR_CONTEXT__),r&&r.call(this,e),e&&e._registeredComponents&&e._registeredComponents.add(a)},l._ssrRegister=c):r&&(c=s?function(){r.call(this,(l.functional?this.parent:this).$root.$options.shadowRoot)}:r),c)if(l.functional){l._injectStyles=c;var u=l.render;l.render=function(e,t){return c.call(t),u(e,t)}}else{var d=l.beforeCreate;l.beforeCreate=d?[].concat(d,c):[c]}return{exports:e,options:l}}n.d(t,{Z:()=>i})},6850:e=>{e.exports=function(e){var t={};function n(i){if(t[i])return t[i].exports;var r=t[i]={i,l:!1,exports:{}};return e[i].call(r.exports,r,r.exports,n),r.l=!0,r.exports}return n.m=e,n.c=t,n.d=function(e,t,i){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:i})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var i=Object.create(null);if(n.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)n.d(i,r,function(t){return e[t]}.bind(null,r));return i},n.n=function(e){va
searchresults(ids: [${i.nids}], lang: "${drupalDecoupled.lang_code}") {
...SearchResultFields
}
}
${b()}
`;s.Z.post("",{query:(0,c.S)(n)}).then((t=>{e("loadSearchResultsCallBack",{items:t.data.data.searchresults})})).catch((e=>{console.warn("Issue with loadSearchResults",e),Promise.reject(e)}))}else t("setNoresults")})).catch((e=>{console.warn("Issue with getResults",e),Promise.reject(e)}))},loadSearchResultsCallBack({commit:e,state:t},{items:n,callBackArgs:i}){e("setResults",n),t.infiniteLoadingState&&(t.offset+t.limit>t.count?t.infiniteLoadingState.complete():t.infiniteLoadingState.loaded())},refreshItem({commit:e,state:t},{id:n}){const i=u()`{
searchresult(id: ${n}, lang: "${drupalDecoupled.lang_code}") {
...SearchResultFields
}
}
${b()}
2022-09-19 15:58:11 +02:00
`;s.Z.post("",{query:(0,c.S)(i)}).then((t=>{e("updateItem",t.data.data.searchresult)})).catch((e=>{console.warn("Issue with refreshItem",e),Promise.reject(e)}))}}},w={namespaced:!0,state:{contenttype:null,items:[],page:0,infiniteLoadingState:null},getters:{},mutations:{setItems(e,t){e.items=e.items.concat(t)},incrementPage(e){e.page+=1},setInfiniteState(e,t){e.infiniteLoadingState=t}},actions:{getItems:({dispatch:e,commit:t,state:n})=>f.Z.get(`/blabla_rest?_format=json&page=${n.page}`,{}).then((({data:e})=>{e.length?(t("setItems",e),n.infiniteLoadingState&&n.infiniteLoadingState.loaded()):n.infiniteLoadingState&&n.infiniteLoadingState.complete()})).catch((e=>{console.warn("Issue with blabla getitems",e),Promise.reject(e)})),nextPage({dispatch:e,commit:t,state:n},i){t("incrementPage"),t("setInfiniteState",i),e("getItems")},getItemIndex:({dispatch:e,commit:t,state:n},i)=>n.items.findIndex((e=>parseInt(e.nid)===i)),getPrevNextItems:({dispatch:e,commit:t,state:n},i)=>({prev:n.items[i-1],next:n.items[i+1]})}};var k=n(5104),S=n.n(k);const x={namespaced:!0,state:{items:[],showrooms_by_tid:{}},getters:{},mutations:{setItems(e,t){e.items=t,t.forEach(((t,n)=>{e.showrooms_by_tid[t.id]=t}))}},actions:{getShowrooms({dispatch:e,commit:t,state:n}){const i=u()`{
allshowrooms(lang: "${drupalDecoupled.lang_code}") {
...ShowroomFields
}
}
${S()}
`;s.Z.post("",{query:(0,c.S)(i)}).then((({data:{data:{allshowrooms:e}}})=>{t("setItems",e)})).catch((e=>{console.warn("Issue with getShowrooms",e),Promise.reject(e)}))}}};var T=n(5277),O=n.n(T);const E={namespaced:!0,state:{products_ids:[],products:[]},getters:{},mutations:{setProductsIds(e,t){e.products_ids=t},setProducts(e,t){e.products=t}},actions:{getProducts({dispatch:e,commit:t,state:n}){e("loadProductsIds")},loadProductsIds({dispatch:e,commit:t,state:n}){f.Z.get("/pricing_rest?_format=json",{}).then((({data:n})=>{const i=[];for(let e=0;e<n.length;e++)i.push(n[e].product_id);t("setProductsIds",i),e("loadProducts")})).catch((e=>{console.warn("Issue with pricing",e),Promise.reject(e)}))},loadProducts({dispatch:e,commit:t,state:n}){const i=u()`{
products(ids: [${n.products_ids}], lang: "${drupalDecoupled.lang_code}") {
...ProductsFields
}
}
2022-09-19 15:58:11 +02:00
${O()}
`;s.Z.post("",{query:(0,c.S)(i)}).then((e=>{t("setProducts",e.data.data.products)})).catch((e=>{console.warn("Issue with loadProducts",e),Promise.reject(e)}))}}};r().use(o.ZP);const C=(0,a.M)(o.ZP.Store,{modules:{Common:d,User:g,Search:_,Blabla:w,Showrooms:x,Pages:E},mixins:{actions:{loadMaterialsGQL({dispatch:e},{ids:t,gqlfragment:n,gqlFragmentfields:i,callBack:r,callBackArgs:o}){const a=u()`{
materiaux(ids: [${t}]) {
2022-02-24 20:58:32 +01:00
...${i}
}
}
${n}
2022-10-31 11:10:51 +01:00
`;s.Z.post("",{query:(0,c.S)(a)}).then((t=>{e(r,{items:t.data.data.materiaux,callBackArgs:o})})).catch((e=>{console.warn("Issue with loadMaterials",e),Promise.reject(e)}))}}}})}},r={};function o(e){var t=r[e];if(void 0!==t)return t.exports;var n=r[e]={exports:{}};return i[e].call(n.exports,n,n.exports,o),n.exports}o.m=i,e=[],o.O=(t,n,i,r)=>{if(!n){var a=1/0;for(l=0;l<e.length;l++){for(var[n,i,r]=e[l],s=!0,c=0;c<n.length;c++)(!1&r||a>=r)&&Object.keys(o.O).every((e=>o.O[e](n[c])))?n.splice(c--,1):(s=!1,r<a&&(a=r));s&&(e.splice(l--,1),t=i())}return t}r=r||0;for(var l=e.length;l>0&&e[l-1][2]>r;l--)e[l]=e[l-1];e[l]=[n,i,r]},o.F={},o.E=e=>{Object.keys(o.F).map((t=>{o.F[t](e)}))},o.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return o.d(t,{a:t}),t},o.d=(e,t)=>{for(var n in t)o.o(t,n)&&!o.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},o.f={},o.e=e=>Promise.all(Object.keys(o.f).reduce(((t,n)=>(o.f[n](e,t),t)),[])),o.u=e=>({67:"module-blabla",204:"module-showrooms",282:"module-thematique",665:"module-pricing",694:"module-base",790:"module-article"}[e]+"."+{67:"d2a190261f0858b2929c",204:"ea51a71e33e126273a2e",282:"8b067b3da8f434cd4886",665:"46c403a3723d5309dc4b",694:"caf964cb87814d5d91ab",790:"d8d77f5bb48e390b376c"}[e]+".bundle.js"),o.miniCssF=e=>{},o.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),o.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),t={},n="materio.com:",o.l=(e,i,r,a)=>{if(t[e])t[e].push(i);else{var s,c;if(void 0!==r)for(var l=document.getElementsByTagName("script"),u=0;u<l.length;u++){var d=l[u];if(d.getAttribute("src")==e||d.getAttribute("data-webpack")==n+r){s=d;break}}s||(c=!0,(s=document.createElement("script")).charset="utf-8",s.timeout=120,o.nc&&s.setAttribute("nonce",o.nc),s.setAttribute("data-webpack",n+r),s.src=e),t[e]=[i];var f=(n,i)=>{s.onerror=s.onload=null,clearTimeout(p);var r=t[e];if(delete t[e],s.parentNode&&s.parentNode.removeChild(s),r&&r.forEach((e=>e(i))),n)return n(i)},p=setTimeout(f.bind(null,void 0,{type:"timeout",target:s}),12e4);s.onerror=f.bind(null,s.onerror),s.onload=f.bind(null,s.onload),c&&document.head.appendChild(s)}},o.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},o.p="/themes/custom/materiotheme/assets/dist/",(()=>{var e={179:0};o.f.j=(t,n)=>{var i=o.o(e,t)?e[t]:void 0;if(0!==i)if(i)n.push(i[2]);else{var r=new Promise(((n,r)=>i=e[t]=[n,r]));n.push(i[2]=r);var a=o.p+o.u(t),s=new Error;o.l(a,(n=>{if(o.o(e,t)&&(0!==(i=e[t])&&(e[t]=void 0),i)){var r=n&&("load"===n.type?"missing":n.type),a=n&&n.target&&n.target.src;s.message="Loading chunk "+t+" failed.\n("+r+": "+a+")",s.name="ChunkLoadError",s.type=r,s.request=a,i[1](s)}}),"chunk-"+t,t)}},o.F.j=t=>{if(!o.o(e,t)||void 0===e[t]){e[t]=null;var n=document.createElement("link");o.nc&&n.setAttribute("nonce",o.nc),n.rel="prefetch",n.as="script",n.href=o.p+o.u(t),document.head.appendChild(n)}},o.O.j=t=>0===e[t];var t=(t,n)=>{var i,r,[a,s,c]=n,l=0;for(i in s)o.o(s,i)&&(o.m[i]=s[i]);for(c&&c(o),t&&t(n);l<a.length;l++)r=a[l],o.o(e,r)&&e[r]&&e[r][0](),e[a[l]]=0;o.O()},n=self.webpackChunkmaterio_com=self.webpackChunkmaterio_com||[];n.forEach(t.bind(null,0)),n.push=t.bind(null,n.push.bind(n))})(),o.O(0,[179],(()=>[694,282,67,790,204,665].map(o.E)),5);var a=o.O(void 0,[289],(()=>o(1456)));a=o.O(a)})();