05-tilda-export-backup/Tilda_ Маргинальная лексика_files/t-previewbox.min.js

1 line
15 KiB
JavaScript
Raw Permalink Normal View History

2025-10-29 16:50:39 +00:00
(()=>{"use strict";const e={ru:"com",by:"biz",kz:"pro",cc:"one"}[function(){const e={ru:"com",by:"biz",kz:"pro",cc:"one"};let t="cc";if("undefined"!=typeof window){const n=window.location.origin.split(".").pop()||"";Object.keys(e).includes(n)&&(t=n)}return t}()],t=[`https://app.tildacdn.${e}/tfront/plugins/tooltip/t-tooltip.min.js`,`https://app.tildacdn.${e}/tfront/plugins/tooltip/t-tooltip.min.css`],n={position:"bottom",closeDelay:0,maxWidth:200,zIndex:999999999},o={position:"top",type:"info",closeDelay:0,maxWidth:250,zIndex:999999999};var i=function(e,t,n,o){var s;t[0]=0;for(var r=1;r<t.length;r++){var d=t[r++],a=t[r]?(t[0]|=d?1:2,n[t[r++]]):t[++r];3===d?o[0]=a:4===d?o[1]=Object.assign(o[1]||{},a):5===d?(o[1]=o[1]||{})[t[++r]]=a:6===d?o[1][t[++r]]+=a+"":d?(s=e.apply(a,i(e,a,n,["",null])),o.push(s),a[0]?t[0]|=2:(t[r-2]=0,t[r]=s)):o.push(a)}return o},s=new Map;(function(e){var t=s.get(this);return t||(t=new Map,s.set(this,t)),(t=i(this,t.get(e)||(t.set(e,t=function(e){for(var t,n,o=1,i="",s="",r=[0],d=function(e){1===o&&(e||(i=i.replace(/^\s*\n\s*|\s*\n\s*$/g,"")))?r.push(0,e,i):3===o&&(e||i)?(r.push(3,e,i),o=2):2===o&&"..."===i&&e?r.push(4,e,0):2===o&&i&&!e?r.push(5,0,!0,i):o>=5&&((i||!e&&5===o)&&(r.push(o,0,i,n),o=6),e&&(r.push(o,e,0,n),o=6)),i=""},a=0;a<e.length;a++){a&&(1===o&&d(),d(a));for(var l=0;l<e[a].length;l++)t=e[a][l],1===o?"<"===t?(d(),r=[r],o=3):i+=t:4===o?"--"===i&&">"===t?(o=1,i=""):i=t+i[0]:s?t===s?s="":i+=t:'"'===t||"'"===t?s=t:">"===t?(d(),o=1):o&&("="===t?(o=5,n=i,i=""):"/"===t&&(o<5||">"===e[a][l+1])?(d(),3===o&&(r=r[0]),o=r,(r=r[0]).push(2,0,o),o=0):" "===t||"\t"===t||"\n"===t||"\r"===t?(d(),o=2):i+=t),3===o&&"!--"===i&&(o=4,r=r[0])}return d(),r}(e)),t),arguments,[])).length>1?t:t[0]}).bind((function(e,i){this[0]=3;for(var s=arguments.length,d=new Array(s>2?s-2:0),a=2;a<s;a++)d[a-2]=arguments[a];if("function"==typeof e){const t=i?.bindTo;t&&delete i.bindTo;const n=new e(i).render(),o=n.querySelector("[children-container]")||n;if(o.append(...d.flat()),o.removeAttribute("children-container"),Array.isArray(t)){const[e,o]=t;e&&"object"==typeof e&&["string","number"].includes(typeof o)&&(e[o]=n)}return n}if("string"==typeof e){const s=document.createElement(e);return i&&Object.entries(i).forEach((e=>{let[i,d]=e;if(i.startsWith("on"))Array.isArray(d)?d.forEach((e=>s.addEventListener(i.substring(2).toLowerCase(),e))):"function"==typeof d&&s.addEventListener(i.substring(2).toLowerCase(),d);else if("className"===i&&"string"==typeof d)s.classList.add(...d.split(" "));else if("tooltip"===i&&"string"==typeof d)a=s,l=d,r(t).then((()=>{if(!window.Tooltip)return;const e=new window.Tooltip({...n,target:a,content:{title:l}});a.updateTooltipContent=e.updateContent.bind(e)}));else if("infoTooltip"===i&&d&&"object"==typeof d)!function(e,n){r(t).then((()=>{if(!window.Tooltip)return;const t=new window.Tooltip({...o,target:e,content:n});e.updateTooltipContent=t.updateContent.bind(t)}))}(s,d);else if("bindTo"===i){if(Array.isArray(d)){const[e,t]=d;e&&"object"==typeof e&&["string","number"].includes(typeof t)&&(e[t]=s)}}else"testid"===i||("string"==typeof d||"number"==typeof d?s.setAttribute(i,d.toString()):"boolean"==typeof d&&d?s.setAttribute(i,""):d&&(s[i]=d));var a,l})),s.append(...d.flat()),s}if(e instanceof Element)return e;throw new Error("Неверный тип для создания элемента")}));function r(e){const t=(Array.isArray(e)?e:[e]).map((e=>{const t=e.split("."),n=t.pop()?.toLowerCase(),o=window.ver?"?v="+window.ver:"";return"js"===n||"css"===n?function(e,t){return new Promise(((n,o)=>{const i="style"===t,s=i?"link":"script",r=i?"href":"src";let d;try{const{pathname:t}=new URL(e,window.location.href);d=t}catch(t){d=e}const a=document.querySelector(`${s}[${r}*="${d}"]`);if(a)return"true"===a.getAttribute("data-loading")?(a.addEventListener("load",n),void a.addEventListener("error",o)):n(new Event("load"));const l=document.createElement(s);l.setAttribute(r,e),i&&l.setAttribute("rel","stylesheet"),l.setAttribute("data-loading","true"),l.addEventListener("load",(()=>{l.removeAttribute("data-loading