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

32 lines
489 KiB
JavaScript
Raw Normal View History

2021-04-05 14:57:36 +02:00
/*! For license information please see main.js.LICENSE.txt */
(()=>{var e,t,n,i,r,o={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,
materiau(id: ${this.item.id}, lang: "${drupalDecoupled.lang_code}") {
...MateriauFields
}
}
${y()}
2021-04-06 12:41:28 +02:00
`;p.E.post("",{query:(0,h.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),setTimeout(function(){this.activateLazyLoad()}.bind(this),5)})).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){this.$modal.hide(`modal-${this.item.id}`)},prettyFileSize:e=>b(parseInt(e)),shortUrl:e=>e.replace(/^http:\/\//,"").replace(/^www\./,""),saveNote(){this.note,this.note_nid?this.updateNote():this.createNote()},updateNote(){let e={type:[{target_id:"note"}],field_contenu:this.note},t={headers:{"X-CSRF-Token":this.csrf_token}};f.Z.patch(`/node/${this.note_nid}?_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}};f.Z.post("/node?_format=json",e,t).then((({data:e})=>{this.note_nid=e.nid[0].value,this.addNoteId(this.note_nid)})).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){this.$refs.tools.querySelectorAll("section.tool").forEach(((e,t)=>{e.classList.remove("tapped")}))}}};var k=(0,l.Z)(w,i,[],!1,null,"62d62e96",null);k.options.__file="web/themes/custom/materiotheme/vuejs/components/Content/ModalCard.vue";const S=k.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){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s="fb15")}({"00ee":function(e,t,n){var i={};i[n("b622")("toStringTag")]="z",e.exports="[object z]"===String(i)},
searchresults(ids: [${n.nids}], lang: "${drupalDecoupled.lang_code}") {
...SearchResultFields
}
}
${b()}
`;s.E.post("",{query:(0,c.S)(i)}).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()}
`;s.E.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=>(e.nid,e.nid===i))),getPrevNextItems:({dispatch:e,commit:t,state:n},i)=>({prev:n.items[i-1],next:n.items[i+1]})}},k={namespaced:!0,state:{items:[],showrooms_by_tid:{}},getters:{},mutations:{setItems(e,t){e.items=e.items.concat(t),t.forEach(((t,n)=>{e.showrooms_by_tid[t.tid]=t}))}},actions:{getItems({dispatch:e,commit:t,state:n}){f.Z.get("/showrooms_rest?_format=json",{}).then((({data:e})=>{t("setItems",e)})).catch((e=>{console.warn("Issue with showrooms",e),Promise.reject(e)}))}}};var S=n(5277),x=n.n(S);const T={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}]) {
...ProductsFields
}
}
${x()}
`;s.E.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 O=(0,a.M)(o.ZP.Store,{modules:{Common:d,User:g,Search:_,Blabla:w,Showrooms:k,Pages:T},mixins:{actions:{loadMaterialsGQL({dispatch:e},{ids:t,gqlfragment:n,callBack:i,callBackArgs:r}){const o=u()`{
materiaux(ids: [${t}]) {
...MateriauFields
}
}
${n}
2021-04-06 12:41:28 +02:00
`;s.E.post("",{query:(0,c.S)(o)}).then((t=>{e(i,{items:t.data.data.materiaux,callBackArgs:r})})).catch((e=>{console.warn("Issue with loadMaterials",e),Promise.reject(e)}))}}}})}},a={};function s(e){var t=a[e];if(void 0!==t)return t.exports;var n=a[e]={exports:{}};return o[e].call(n.exports,n,n.exports,s),n.exports}s.m=o,e=[],s.O=(t,n,i,r)=>{if(!n){var o=1/0;for(l=0;l<e.length;l++){for(var[n,i,r]=e[l],a=!0,c=0;c<n.length;c++)(!1&r||o>=r)&&Object.keys(s.O).every((e=>s.O[e](n[c])))?n.splice(c--,1):(a=!1,r<o&&(o=r));a&&(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]},s.F={},s.E=e=>{Object.keys(s.F).map((t=>{s.F[t](e)}))},s.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return s.d(t,{a:t}),t},s.d=(e,t)=>{for(var n in t)s.o(t,n)&&!s.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},s.f={},s.e=e=>Promise.all(Object.keys(s.f).reduce(((t,n)=>(s.f[n](e,t),t)),[])),s.u=e=>({67:"module-blabla",204:"module-showrooms",282:"module-thematique",462:"module-mdi",665:"module-pricing",694:"module-base",790:"module-article",876:"module-font-ubuntu"}[e]+".bundle.js"),s.miniCssF=e=>({462:"module-mdi",665:"module-pricing",876:"module-font-ubuntu"}[e]+".css"),s.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),s.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),t={},n="materio.com:",s.l=(e,i,r,o)=>{if(t[e])t[e].push(i);else{var a,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){a=d;break}}a||(c=!0,(a=document.createElement("script")).charset="utf-8",a.timeout=120,s.nc&&a.setAttribute("nonce",s.nc),a.setAttribute("data-webpack",n+r),a.src=e),t[e]=[i];var f=(n,i)=>{a.onerror=a.onload=null,clearTimeout(p);var r=t[e];if(delete t[e],a.parentNode&&a.parentNode.removeChild(a),r&&r.forEach((e=>e(i))),n)return n(i)},p=setTimeout(f.bind(null,void 0,{type:"timeout",target:a}),12e4);a.onerror=f.bind(null,a.onerror),a.onload=f.bind(null,a.onload),c&&document.head.appendChild(a)}},s.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},s.p="/themes/custom/materiotheme/assets/dist/",i=e=>new Promise(((t,n)=>{var i=s.miniCssF(e),r=s.p+i;if(((e,t)=>{for(var n=document.getElementsByTagName("link"),i=0;i<n.length;i++){var r=(a=n[i]).getAttribute("data-href")||a.getAttribute("href");if("stylesheet"===a.rel&&(r===e||r===t))return a}var o=document.getElementsByTagName("style");for(i=0;i<o.length;i++){var a;if((r=(a=o[i]).getAttribute("data-href"))===e||r===t)return a}})(i,r))return t();((e,t,n,i)=>{var r=document.createElement("link");r.rel="stylesheet",r.type="text/css",r.onerror=r.onload=o=>{if(r.onerror=r.onload=null,"load"===o.type)n();else{var a=o&&("load"===o.type?"missing":o.type),s=o&&o.target&&o.target.href||t,c=new Error("Loading CSS chunk "+e+" failed.\n("+s+")");c.code="CSS_CHUNK_LOAD_FAILED",c.type=a,c.request=s,r.parentNode.removeChild(r),i(c)}},r.href=t,document.head.appendChild(r)})(e,r,t,n)})),r={179:0},s.f.miniCss=(e,t)=>{r[e]?t.push(r[e]):0!==r[e]&&{462:1,665:1,876:1}[e]&&t.push(r[e]=i(e).then((()=>{r[e]=0}),(t=>{throw delete r[e],t})))},(()=>{var e={179:0};s.f.j=(t,n)=>{var i=s.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 o=s.p+s.u(t),a=new Error;s.l(o,(n=>{if(s.o(e,t)&&(0!==(i=e[t])&&(e[t]=void 0),i)){var r=n&&("load"===n.type?"missing":n.type),o=n&&n.target&&n.target.src;a.message="Loading chunk "+t+" failed.\n("+r+": "+o+")",a.name="ChunkLoadError",a.type=r,a.request=o,i[1](a)}}),"chunk-"+t,t)}},s.F.j=t=>{if(!s.o(e,t)||void 0===e[t]){e[t]=null;var n=document.createElement("link");s.nc&&n.setAttribute("nonce",s.nc),n.rel="prefetch",n.as="script",n.href=s.p+s.u(t),document.head.appendChild(n)}},s.O.j=t=>0===e[t];var t=(t,n)=>{var i,r,[o,a,c]=n,l=0;for(i in a)s.o(a,i)&&(s.m