@mborecki/crossword 0.3.0 → 0.4.0
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/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/mb-crossword.cjs.entry.js +65 -17
- package/dist/cjs/mb-crossword.cjs.js +1 -1
- package/dist/collection/components/crossword/clue.js +1 -1
- package/dist/collection/components/crossword/mb-crossword.css +40 -6
- package/dist/collection/components/crossword/mb-crossword.js +44 -16
- package/dist/components/mb-crossword.js +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/esm/mb-crossword.entry.js +65 -17
- package/dist/esm/mb-crossword.js +1 -1
- package/dist/mb-crossword/mb-crossword.esm.js +1 -1
- package/dist/mb-crossword/p-a8347a29.entry.js +1 -0
- package/dist/types/components/crossword/mb-crossword.d.ts +10 -0
- package/dist/types/roboczy/mb-puzzle/apps/crossword/.stencil/shared/grid/src/grid.d.ts +4 -2
- package/package.json +4 -1
- package/dist/mb-crossword/p-d1ad544f.entry.js +0 -1
package/dist/cjs/loader.cjs.js
CHANGED
|
@@ -6,7 +6,7 @@ var appGlobals = require('./app-globals-V2Kpy_OQ.js');
|
|
|
6
6
|
const defineCustomElements = async (win, options) => {
|
|
7
7
|
if (typeof window === 'undefined') return undefined;
|
|
8
8
|
await appGlobals.globalScripts();
|
|
9
|
-
return index.bootstrapLazy([["mb-crossword.cjs",[[529,"mb-crossword",{"init":[4],"data":[16],"showCluePreview":[4,"show-clue-preview"],"clueListStyle":[1,"clue-list-style"],"hWords":[32],"vWords":[32],"currentClueId":[32],"currentClue":[32],"isFocused":[32],"selectedCell":[32],"specialBorders":[32],"specialCells":[32],"labels":[32],"boardWidth":[32],"boardHeight":[32],"cells":[32],"initGame":[64],"checkAnswer":[64],"selectClue":[64]},null,{"data":[{"watchData":0}]}]]]], options);
|
|
9
|
+
return index.bootstrapLazy([["mb-crossword.cjs",[[529,"mb-crossword",{"init":[4],"data":[16],"showCluePreview":[4,"show-clue-preview"],"clueListStyle":[1,"clue-list-style"],"hWords":[32],"vWords":[32],"currentClueId":[32],"currentClue":[32],"isFocused":[32],"selectedCell":[32],"specialBorders":[32],"specialCells":[32],"labels":[32],"boardWidth":[32],"boardHeight":[32],"cells":[32],"floatingPreviewHackParams":[32],"initGame":[64],"checkAnswer":[64],"selectClue":[64]},null,{"data":[{"watchData":0}]}]]]], options);
|
|
10
10
|
};
|
|
11
11
|
|
|
12
12
|
exports.setNonce = index.setNonce;
|
|
@@ -5,7 +5,7 @@ var index$1 = require('./index-CEGyCfpa.js');
|
|
|
5
5
|
|
|
6
6
|
function Clue({ isCurrent, word, onPointerDown, preview, showPreview, tagName }) {
|
|
7
7
|
const Tag = tagName ?? 'div';
|
|
8
|
-
return index.h(Tag, { onPointerDown: onPointerDown, part: "clue", class: {
|
|
8
|
+
return index.h(Tag, { role: 'button', onPointerDown: onPointerDown, part: "clue", class: {
|
|
9
9
|
"--current": isCurrent
|
|
10
10
|
} }, word.clue, showPreview && index.h("span", { class: "preview" }, preview));
|
|
11
11
|
}
|
|
@@ -34,7 +34,29 @@ const ClueList = ({ type }, children) => {
|
|
|
34
34
|
}
|
|
35
35
|
};
|
|
36
36
|
|
|
37
|
-
|
|
37
|
+
function getDefaultExportFromCjs (x) {
|
|
38
|
+
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
var es5$1 = {exports: {}};
|
|
42
|
+
|
|
43
|
+
var es5 = es5$1.exports;
|
|
44
|
+
|
|
45
|
+
var hasRequiredEs5;
|
|
46
|
+
|
|
47
|
+
function requireEs5 () {
|
|
48
|
+
if (hasRequiredEs5) return es5$1.exports;
|
|
49
|
+
hasRequiredEs5 = 1;
|
|
50
|
+
(function (module, exports) {
|
|
51
|
+
!function(e,t){module.exports=t();}(es5,(function(){return function(e){var t={};function r(i){if(t[i])return t[i].exports;var n=t[i]={i:i,l:false,exports:{}};return e[i].call(n.exports,n,n.exports,r),n.l=true,n.exports}return r.m=e,r.c=t,r.d=function(e,t,i){r.o(e,t)||Object.defineProperty(e,t,{enumerable:true,get:i});},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:true});},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var i=Object.create(null);if(r.r(i),Object.defineProperty(i,"default",{enumerable:true,value:e}),2&t&&"string"!=typeof e)for(var n in e)r.d(i,n,function(t){return e[t]}.bind(null,n));return i},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=90)}({17:function(e,t,r){t.__esModule=true,t.default=void 0;var i=r(18),n=function(){function e(){}return e.getFirstMatch=function(e,t){var r=t.match(e);return r&&r.length>0&&r[1]||""},e.getSecondMatch=function(e,t){var r=t.match(e);return r&&r.length>1&&r[2]||""},e.matchAndReturnConst=function(e,t,r){if(e.test(t))return r},e.getWindowsVersionName=function(e){switch(e){case "NT":return "NT";case "XP":return "XP";case "NT 5.0":return "2000";case "NT 5.1":return "XP";case "NT 5.2":return "2003";case "NT 6.0":return "Vista";case "NT 6.1":return "7";case "NT 6.2":return "8";case "NT 6.3":return "8.1";case "NT 10.0":return "10";default:return}},e.getMacOSVersionName=function(e){var t=e.split(".").splice(0,2).map((function(e){return parseInt(e,10)||0}));t.push(0);var r=t[0],i=t[1];if(10===r)switch(i){case 5:return "Leopard";case 6:return "Snow Leopard";case 7:return "Lion";case 8:return "Mountain Lion";case 9:return "Mavericks";case 10:return "Yosemite";case 11:return "El Capitan";case 12:return "Sierra";case 13:return "High Sierra";case 14:return "Mojave";case 15:return "Catalina";default:return}switch(r){case 11:return "Big Sur";case 12:return "Monterey";case 13:return "Ventura";case 14:return "Sonoma";case 15:return "Sequoia";default:return}},e.getAndroidVersionName=function(e){var t=e.split(".").splice(0,2).map((function(e){return parseInt(e,10)||0}));if(t.push(0),!(1===t[0]&&t[1]<5))return 1===t[0]&&t[1]<6?"Cupcake":1===t[0]&&t[1]>=6?"Donut":2===t[0]&&t[1]<2?"Eclair":2===t[0]&&2===t[1]?"Froyo":2===t[0]&&t[1]>2?"Gingerbread":3===t[0]?"Honeycomb":4===t[0]&&t[1]<1?"Ice Cream Sandwich":4===t[0]&&t[1]<4?"Jelly Bean":4===t[0]&&t[1]>=4?"KitKat":5===t[0]?"Lollipop":6===t[0]?"Marshmallow":7===t[0]?"Nougat":8===t[0]?"Oreo":9===t[0]?"Pie":void 0},e.getVersionPrecision=function(e){return e.split(".").length},e.compareVersions=function(t,r,i){ void 0===i&&(i=false);var n=e.getVersionPrecision(t),a=e.getVersionPrecision(r),o=Math.max(n,a),s=0,u=e.map([t,r],(function(t){var r=o-e.getVersionPrecision(t),i=t+new Array(r+1).join(".0");return e.map(i.split("."),(function(e){return new Array(20-e.length).join("0")+e})).reverse()}));for(i&&(s=o-Math.min(n,a)),o-=1;o>=s;){if(u[0][o]>u[1][o])return 1;if(u[0][o]===u[1][o]){if(o===s)return 0;o-=1;}else if(u[0][o]<u[1][o])return -1}},e.map=function(e,t){var r,i=[];if(Array.prototype.map)return Array.prototype.map.call(e,t);for(r=0;r<e.length;r+=1)i.push(t(e[r]));return i},e.find=function(e,t){var r,i;if(Array.prototype.find)return Array.prototype.find.call(e,t);for(r=0,i=e.length;r<i;r+=1){var n=e[r];if(t(n,r))return n}},e.assign=function(e){for(var t,r,i=e,n=arguments.length,a=new Array(n>1?n-1:0),o=1;o<n;o++)a[o-1]=arguments[o];if(Object.assign)return Object.assign.apply(Object,[e].concat(a));var s=function(){var e=a[t];"object"==typeof e&&null!==e&&Object.keys(e).forEach((function(t){i[t]=e[t];}));};for(t=0,r=a.length;t<r;t+=1)s();return e},e.getBrowserAlias=function(e){return i.BROWSER_ALIASES_MAP[e]},e.getBrowserTypeByAlias=function(e){return i.BROWSER_MAP[e]||""},e}();t.default=n,e.exports=t.default;},18:function(e,t,r){t.__esModule=true,t.ENGINE_MAP=t.OS_MAP=t.PLATFORMS_MAP=t.BROWSER_MAP=t.BROWSER_ALIASES_MAP=void 0;t.BROWSER_ALIASES_MAP={AmazonBot:"amazonbot","Amazon Silk":"amazon_silk","Android Browser":"android",BaiduSpider:"baiduspider",Bada:"bada",BingCrawler:"bingcrawler",BlackBerry:"blackberry","ChatGPT-User":"chatgpt_user",Chrome:"chrome",ClaudeBot:"claudebot",Chromium:"chromium",Diffbot:"diffbot",DuckDuckBot:"duckduckbot",Electron:"electron",Epiphany:"epiphany",FacebookExternalHit:"facebookexternalhit",Firefox:"firefox",Focus:"focus",Generic:"generic","Google Search":"google_search",Googlebot:"googlebot",GPTBot:"gptbot","Internet Explorer":"ie",InternetArchiveCrawler:"internetarchivecrawler","K-Meleon":"k_meleon",LibreWolf:"librewolf",Maxthon:"maxthon","Meta-ExternalAds":"meta_externalads","Meta-ExternalAgent":"meta_externalagent","Meta-ExternalFetcher":"meta_externalfetcher","Meta-WebIndexer":"meta_webindexer","Microsoft Edge":"edge","MZ Browser":"mz","NAVER Whale Browser":"naver","OAI-SearchBot":"oai_searchbot",Omgilibot:"omgilibot",Opera:"opera","Opera Coast":"opera_coast","Pale Moon":"pale_moon",PerplexityBot:"perplexitybot","Perplexity-User":"perplexity_user",PhantomJS:"phantomjs",PingdomBot:"pingdombot",Puffin:"puffin",QQ:"qq",QQLite:"qqlite",QupZilla:"qupzilla",Roku:"roku",Safari:"safari",Sailfish:"sailfish","Samsung Internet for Android":"samsung_internet",SeaMonkey:"seamonkey",Sleipnir:"sleipnir","Sogou Browser":"sogou",Swing:"swing",Tizen:"tizen","UC Browser":"uc",Vivaldi:"vivaldi","WebOS Browser":"webos",WeChat:"wechat",YahooSlurp:"yahooslurp","Yandex Browser":"yandex",YandexBot:"yandexbot",YouBot:"youbot"};t.BROWSER_MAP={amazonbot:"AmazonBot",amazon_silk:"Amazon Silk",android:"Android Browser",baiduspider:"BaiduSpider",bada:"Bada",bingcrawler:"BingCrawler",blackberry:"BlackBerry",chatgpt_user:"ChatGPT-User",chrome:"Chrome",claudebot:"ClaudeBot",chromium:"Chromium",diffbot:"Diffbot",duckduckbot:"DuckDuckBot",edge:"Microsoft Edge",electron:"Electron",epiphany:"Epiphany",facebookexternalhit:"FacebookExternalHit",firefox:"Firefox",focus:"Focus",generic:"Generic",google_search:"Google Search",googlebot:"Googlebot",gptbot:"GPTBot",ie:"Internet Explorer",internetarchivecrawler:"InternetArchiveCrawler",k_meleon:"K-Meleon",librewolf:"LibreWolf",maxthon:"Maxthon",meta_externalads:"Meta-ExternalAds",meta_externalagent:"Meta-ExternalAgent",meta_externalfetcher:"Meta-ExternalFetcher",meta_webindexer:"Meta-WebIndexer",mz:"MZ Browser",naver:"NAVER Whale Browser",oai_searchbot:"OAI-SearchBot",omgilibot:"Omgilibot",opera:"Opera",opera_coast:"Opera Coast",pale_moon:"Pale Moon",perplexitybot:"PerplexityBot",perplexity_user:"Perplexity-User",phantomjs:"PhantomJS",pingdombot:"PingdomBot",puffin:"Puffin",qq:"QQ Browser",qqlite:"QQ Browser Lite",qupzilla:"QupZilla",roku:"Roku",safari:"Safari",sailfish:"Sailfish",samsung_internet:"Samsung Internet for Android",seamonkey:"SeaMonkey",sleipnir:"Sleipnir",sogou:"Sogou Browser",swing:"Swing",tizen:"Tizen",uc:"UC Browser",vivaldi:"Vivaldi",webos:"WebOS Browser",wechat:"WeChat",yahooslurp:"YahooSlurp",yandex:"Yandex Browser",yandexbot:"YandexBot",youbot:"YouBot"};t.PLATFORMS_MAP={bot:"bot",desktop:"desktop",mobile:"mobile",tablet:"tablet",tv:"tv"};t.OS_MAP={Android:"Android",Bada:"Bada",BlackBerry:"BlackBerry",ChromeOS:"Chrome OS",HarmonyOS:"HarmonyOS",iOS:"iOS",Linux:"Linux",MacOS:"macOS",PlayStation4:"PlayStation 4",Roku:"Roku",Tizen:"Tizen",WebOS:"WebOS",Windows:"Windows",WindowsPhone:"Windows Phone"};t.ENGINE_MAP={Blink:"Blink",EdgeHTML:"EdgeHTML",Gecko:"Gecko",Presto:"Presto",Trident:"Trident",WebKit:"WebKit"};},90:function(e,t,r){t.__esModule=true,t.default=void 0;var i,n=(i=r(91))&&i.__esModule?i:{default:i},a=r(18);function o(e,t){for(var r=0;r<t.length;r++){var i=t[r];i.enumerable=i.enumerable||false,i.configurable=true,"value"in i&&(i.writable=true),Object.defineProperty(e,i.key,i);}}var s=function(){function e(){}var t,r,i;return e.getParser=function(e,t){if(void 0===t&&(t=false),"string"!=typeof e)throw new Error("UserAgent should be a string");return new n.default(e,t)},e.parse=function(e){return new n.default(e).getResult()},t=e,i=[{key:"BROWSER_MAP",get:function(){return a.BROWSER_MAP}},{key:"ENGINE_MAP",get:function(){return a.ENGINE_MAP}},{key:"OS_MAP",get:function(){return a.OS_MAP}},{key:"PLATFORMS_MAP",get:function(){return a.PLATFORMS_MAP}}],(r=null)&&o(t.prototype,r),i&&o(t,i),e}();t.default=s,e.exports=t.default;},91:function(e,t,r){t.__esModule=true,t.default=void 0;var i=u(r(92)),n=u(r(93)),a=u(r(94)),o=u(r(95)),s=u(r(17));function u(e){return e&&e.__esModule?e:{default:e}}var d=function(){function e(e,t){if(void 0===t&&(t=false),null==e||""===e)throw new Error("UserAgent parameter can't be empty");this._ua=e,this.parsedResult={},true!==t&&this.parse();}var t=e.prototype;return t.getUA=function(){return this._ua},t.test=function(e){return e.test(this._ua)},t.parseBrowser=function(){var e=this;this.parsedResult.browser={};var t=s.default.find(i.default,(function(t){if("function"==typeof t.test)return t.test(e);if(Array.isArray(t.test))return t.test.some((function(t){return e.test(t)}));throw new Error("Browser's test function is not valid")}));return t&&(this.parsedResult.browser=t.describe(this.getUA())),this.parsedResult.browser},t.getBrowser=function(){return this.parsedResult.browser?this.parsedResult.browser:this.parseBrowser()},t.getBrowserName=function(e){return e?String(this.getBrowser().name).toLowerCase()||"":this.getBrowser().name||""},t.getBrowserVersion=function(){return this.getBrowser().version},t.getOS=function(){return this.parsedResult.os?this.parsedResult.os:this.parseOS()},t.parseOS=function(){var e=this;this.parsedResult.os={};var t=s.default.find(n.default,(function(t){if("function"==typeof t.test)return t.test(e);if(Array.isArray(t.test))return t.test.some((function(t){return e.test(t)}));throw new Error("Browser's test function is not valid")}));return t&&(this.parsedResult.os=t.describe(this.getUA())),this.parsedResult.os},t.getOSName=function(e){var t=this.getOS().name;return e?String(t).toLowerCase()||"":t||""},t.getOSVersion=function(){return this.getOS().version},t.getPlatform=function(){return this.parsedResult.platform?this.parsedResult.platform:this.parsePlatform()},t.getPlatformType=function(e){ void 0===e&&(e=false);var t=this.getPlatform().type;return e?String(t).toLowerCase()||"":t||""},t.parsePlatform=function(){var e=this;this.parsedResult.platform={};var t=s.default.find(a.default,(function(t){if("function"==typeof t.test)return t.test(e);if(Array.isArray(t.test))return t.test.some((function(t){return e.test(t)}));throw new Error("Browser's test function is not valid")}));return t&&(this.parsedResult.platform=t.describe(this.getUA())),this.parsedResult.platform},t.getEngine=function(){return this.parsedResult.engine?this.parsedResult.engine:this.parseEngine()},t.getEngineName=function(e){return e?String(this.getEngine().name).toLowerCase()||"":this.getEngine().name||""},t.parseEngine=function(){var e=this;this.parsedResult.engine={};var t=s.default.find(o.default,(function(t){if("function"==typeof t.test)return t.test(e);if(Array.isArray(t.test))return t.test.some((function(t){return e.test(t)}));throw new Error("Browser's test function is not valid")}));return t&&(this.parsedResult.engine=t.describe(this.getUA())),this.parsedResult.engine},t.parse=function(){return this.parseBrowser(),this.parseOS(),this.parsePlatform(),this.parseEngine(),this},t.getResult=function(){return s.default.assign({},this.parsedResult)},t.satisfies=function(e){var t=this,r={},i=0,n={},a=0;if(Object.keys(e).forEach((function(t){var o=e[t];"string"==typeof o?(n[t]=o,a+=1):"object"==typeof o&&(r[t]=o,i+=1);})),i>0){var o=Object.keys(r),u=s.default.find(o,(function(e){return t.isOS(e)}));if(u){var d=this.satisfies(r[u]);if(void 0!==d)return d}var c=s.default.find(o,(function(e){return t.isPlatform(e)}));if(c){var f=this.satisfies(r[c]);if(void 0!==f)return f}}if(a>0){var l=Object.keys(n),b=s.default.find(l,(function(e){return t.isBrowser(e,true)}));if(void 0!==b)return this.compareVersion(n[b])}},t.isBrowser=function(e,t){ void 0===t&&(t=false);var r=this.getBrowserName().toLowerCase(),i=e.toLowerCase(),n=s.default.getBrowserTypeByAlias(i);return t&&n&&(i=n.toLowerCase()),i===r},t.compareVersion=function(e){var t=[0],r=e,i=false,n=this.getBrowserVersion();if("string"==typeof n)return ">"===e[0]||"<"===e[0]?(r=e.substr(1),"="===e[1]?(i=true,r=e.substr(2)):t=[],">"===e[0]?t.push(1):t.push(-1)):"="===e[0]?r=e.substr(1):"~"===e[0]&&(i=true,r=e.substr(1)),t.indexOf(s.default.compareVersions(n,r,i))>-1},t.isOS=function(e){return this.getOSName(true)===String(e).toLowerCase()},t.isPlatform=function(e){return this.getPlatformType(true)===String(e).toLowerCase()},t.isEngine=function(e){return this.getEngineName(true)===String(e).toLowerCase()},t.is=function(e,t){return void 0===t&&(t=false),this.isBrowser(e,t)||this.isOS(e)||this.isPlatform(e)},t.some=function(e){var t=this;return void 0===e&&(e=[]),e.some((function(e){return t.is(e)}))},e}();t.default=d,e.exports=t.default;},92:function(e,t,r){t.__esModule=true,t.default=void 0;var i,n=(i=r(17))&&i.__esModule?i:{default:i};var a=/version\/(\d+(\.?_?\d+)+)/i,o=[{test:[/gptbot/i],describe:function(e){var t={name:"GPTBot"},r=n.default.getFirstMatch(/gptbot\/(\d+(\.\d+)+)/i,e)||n.default.getFirstMatch(a,e);return r&&(t.version=r),t}},{test:[/chatgpt-user/i],describe:function(e){var t={name:"ChatGPT-User"},r=n.default.getFirstMatch(/chatgpt-user\/(\d+(\.\d+)+)/i,e)||n.default.getFirstMatch(a,e);return r&&(t.version=r),t}},{test:[/oai-searchbot/i],describe:function(e){var t={name:"OAI-SearchBot"},r=n.default.getFirstMatch(/oai-searchbot\/(\d+(\.\d+)+)/i,e)||n.default.getFirstMatch(a,e);return r&&(t.version=r),t}},{test:[/claudebot/i,/claude-web/i,/claude-user/i,/claude-searchbot/i],describe:function(e){var t={name:"ClaudeBot"},r=n.default.getFirstMatch(/(?:claudebot|claude-web|claude-user|claude-searchbot)\/(\d+(\.\d+)+)/i,e)||n.default.getFirstMatch(a,e);return r&&(t.version=r),t}},{test:[/omgilibot/i,/webzio-extended/i],describe:function(e){var t={name:"Omgilibot"},r=n.default.getFirstMatch(/(?:omgilibot|webzio-extended)\/(\d+(\.\d+)+)/i,e)||n.default.getFirstMatch(a,e);return r&&(t.version=r),t}},{test:[/diffbot/i],describe:function(e){var t={name:"Diffbot"},r=n.default.getFirstMatch(/diffbot\/(\d+(\.\d+)+)/i,e)||n.default.getFirstMatch(a,e);return r&&(t.version=r),t}},{test:[/perplexitybot/i],describe:function(e){var t={name:"PerplexityBot"},r=n.default.getFirstMatch(/perplexitybot\/(\d+(\.\d+)+)/i,e)||n.default.getFirstMatch(a,e);return r&&(t.version=r),t}},{test:[/perplexity-user/i],describe:function(e){var t={name:"Perplexity-User"},r=n.default.getFirstMatch(/perplexity-user\/(\d+(\.\d+)+)/i,e)||n.default.getFirstMatch(a,e);return r&&(t.version=r),t}},{test:[/youbot/i],describe:function(e){var t={name:"YouBot"},r=n.default.getFirstMatch(/youbot\/(\d+(\.\d+)+)/i,e)||n.default.getFirstMatch(a,e);return r&&(t.version=r),t}},{test:[/meta-webindexer/i],describe:function(e){var t={name:"Meta-WebIndexer"},r=n.default.getFirstMatch(/meta-webindexer\/(\d+(\.\d+)+)/i,e)||n.default.getFirstMatch(a,e);return r&&(t.version=r),t}},{test:[/meta-externalads/i],describe:function(e){var t={name:"Meta-ExternalAds"},r=n.default.getFirstMatch(/meta-externalads\/(\d+(\.\d+)+)/i,e)||n.default.getFirstMatch(a,e);return r&&(t.version=r),t}},{test:[/meta-externalagent/i],describe:function(e){var t={name:"Meta-ExternalAgent"},r=n.default.getFirstMatch(/meta-externalagent\/(\d+(\.\d+)+)/i,e)||n.default.getFirstMatch(a,e);return r&&(t.version=r),t}},{test:[/meta-externalfetcher/i],describe:function(e){var t={name:"Meta-ExternalFetcher"},r=n.default.getFirstMatch(/meta-externalfetcher\/(\d+(\.\d+)+)/i,e)||n.default.getFirstMatch(a,e);return r&&(t.version=r),t}},{test:[/googlebot/i],describe:function(e){var t={name:"Googlebot"},r=n.default.getFirstMatch(/googlebot\/(\d+(\.\d+))/i,e)||n.default.getFirstMatch(a,e);return r&&(t.version=r),t}},{test:[/amazonbot/i],describe:function(e){var t={name:"AmazonBot"},r=n.default.getFirstMatch(/amazonbot\/(\d+(\.\d+)+)/i,e)||n.default.getFirstMatch(a,e);return r&&(t.version=r),t}},{test:[/bingbot/i],describe:function(e){var t={name:"BingCrawler"},r=n.default.getFirstMatch(/bingbot\/(\d+(\.\d+)+)/i,e)||n.default.getFirstMatch(a,e);return r&&(t.version=r),t}},{test:[/baiduspider/i],describe:function(e){var t={name:"BaiduSpider"},r=n.default.getFirstMatch(/baiduspider\/(\d+(\.\d+)+)/i,e)||n.default.getFirstMatch(a,e);return r&&(t.version=r),t}},{test:[/duckduckbot/i],describe:function(e){var t={name:"DuckDuckBot"},r=n.default.getFirstMatch(/duckduckbot\/(\d+(\.\d+)+)/i,e)||n.default.getFirstMatch(a,e);return r&&(t.version=r),t}},{test:[/ia_archiver/i],describe:function(e){var t={name:"InternetArchiveCrawler"},r=n.default.getFirstMatch(/ia_archiver\/(\d+(\.\d+)+)/i,e)||n.default.getFirstMatch(a,e);return r&&(t.version=r),t}},{test:[/facebookexternalhit/i,/facebookcatalog/i],describe:function(){return {name:"FacebookExternalHit"}}},{test:[/yahoo!?[\s/]*slurp/i],describe:function(){return {name:"YahooSlurp"}}},{test:[/yandexbot/i,/yandexmobilebot/i],describe:function(){return {name:"YandexBot"}}},{test:[/pingdom/i],describe:function(){return {name:"PingdomBot"}}},{test:[/opera/i],describe:function(e){var t={name:"Opera"},r=n.default.getFirstMatch(a,e)||n.default.getFirstMatch(/(?:opera)[\s/](\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/opr\/|opios/i],describe:function(e){var t={name:"Opera"},r=n.default.getFirstMatch(/(?:opr|opios)[\s/](\S+)/i,e)||n.default.getFirstMatch(a,e);return r&&(t.version=r),t}},{test:[/SamsungBrowser/i],describe:function(e){var t={name:"Samsung Internet for Android"},r=n.default.getFirstMatch(a,e)||n.default.getFirstMatch(/(?:SamsungBrowser)[\s/](\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/Whale/i],describe:function(e){var t={name:"NAVER Whale Browser"},r=n.default.getFirstMatch(a,e)||n.default.getFirstMatch(/(?:whale)[\s/](\d+(?:\.\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/PaleMoon/i],describe:function(e){var t={name:"Pale Moon"},r=n.default.getFirstMatch(a,e)||n.default.getFirstMatch(/(?:PaleMoon)[\s/](\d+(?:\.\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/MZBrowser/i],describe:function(e){var t={name:"MZ Browser"},r=n.default.getFirstMatch(/(?:MZBrowser)[\s/](\d+(?:\.\d+)+)/i,e)||n.default.getFirstMatch(a,e);return r&&(t.version=r),t}},{test:[/focus/i],describe:function(e){var t={name:"Focus"},r=n.default.getFirstMatch(/(?:focus)[\s/](\d+(?:\.\d+)+)/i,e)||n.default.getFirstMatch(a,e);return r&&(t.version=r),t}},{test:[/swing/i],describe:function(e){var t={name:"Swing"},r=n.default.getFirstMatch(/(?:swing)[\s/](\d+(?:\.\d+)+)/i,e)||n.default.getFirstMatch(a,e);return r&&(t.version=r),t}},{test:[/coast/i],describe:function(e){var t={name:"Opera Coast"},r=n.default.getFirstMatch(a,e)||n.default.getFirstMatch(/(?:coast)[\s/](\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/opt\/\d+(?:.?_?\d+)+/i],describe:function(e){var t={name:"Opera Touch"},r=n.default.getFirstMatch(/(?:opt)[\s/](\d+(\.?_?\d+)+)/i,e)||n.default.getFirstMatch(a,e);return r&&(t.version=r),t}},{test:[/yabrowser/i],describe:function(e){var t={name:"Yandex Browser"},r=n.default.getFirstMatch(/(?:yabrowser)[\s/](\d+(\.?_?\d+)+)/i,e)||n.default.getFirstMatch(a,e);return r&&(t.version=r),t}},{test:[/ucbrowser/i],describe:function(e){var t={name:"UC Browser"},r=n.default.getFirstMatch(a,e)||n.default.getFirstMatch(/(?:ucbrowser)[\s/](\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/Maxthon|mxios/i],describe:function(e){var t={name:"Maxthon"},r=n.default.getFirstMatch(a,e)||n.default.getFirstMatch(/(?:Maxthon|mxios)[\s/](\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/epiphany/i],describe:function(e){var t={name:"Epiphany"},r=n.default.getFirstMatch(a,e)||n.default.getFirstMatch(/(?:epiphany)[\s/](\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/puffin/i],describe:function(e){var t={name:"Puffin"},r=n.default.getFirstMatch(a,e)||n.default.getFirstMatch(/(?:puffin)[\s/](\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/sleipnir/i],describe:function(e){var t={name:"Sleipnir"},r=n.default.getFirstMatch(a,e)||n.default.getFirstMatch(/(?:sleipnir)[\s/](\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/k-meleon/i],describe:function(e){var t={name:"K-Meleon"},r=n.default.getFirstMatch(a,e)||n.default.getFirstMatch(/(?:k-meleon)[\s/](\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/micromessenger/i],describe:function(e){var t={name:"WeChat"},r=n.default.getFirstMatch(/(?:micromessenger)[\s/](\d+(\.?_?\d+)+)/i,e)||n.default.getFirstMatch(a,e);return r&&(t.version=r),t}},{test:[/qqbrowser/i],describe:function(e){var t={name:/qqbrowserlite/i.test(e)?"QQ Browser Lite":"QQ Browser"},r=n.default.getFirstMatch(/(?:qqbrowserlite|qqbrowser)[/](\d+(\.?_?\d+)+)/i,e)||n.default.getFirstMatch(a,e);return r&&(t.version=r),t}},{test:[/msie|trident/i],describe:function(e){var t={name:"Internet Explorer"},r=n.default.getFirstMatch(/(?:msie |rv:)(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/\sedg\//i],describe:function(e){var t={name:"Microsoft Edge"},r=n.default.getFirstMatch(/\sedg\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/edg([ea]|ios)/i],describe:function(e){var t={name:"Microsoft Edge"},r=n.default.getSecondMatch(/edg([ea]|ios)\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/vivaldi/i],describe:function(e){var t={name:"Vivaldi"},r=n.default.getFirstMatch(/vivaldi\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/seamonkey/i],describe:function(e){var t={name:"SeaMonkey"},r=n.default.getFirstMatch(/seamonkey\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/sailfish/i],describe:function(e){var t={name:"Sailfish"},r=n.default.getFirstMatch(/sailfish\s?browser\/(\d+(\.\d+)?)/i,e);return r&&(t.version=r),t}},{test:[/silk/i],describe:function(e){var t={name:"Amazon Silk"},r=n.default.getFirstMatch(/silk\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/phantom/i],describe:function(e){var t={name:"PhantomJS"},r=n.default.getFirstMatch(/phantomjs\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/slimerjs/i],describe:function(e){var t={name:"SlimerJS"},r=n.default.getFirstMatch(/slimerjs\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/blackberry|\bbb\d+/i,/rim\stablet/i],describe:function(e){var t={name:"BlackBerry"},r=n.default.getFirstMatch(a,e)||n.default.getFirstMatch(/blackberry[\d]+\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/(web|hpw)[o0]s/i],describe:function(e){var t={name:"WebOS Browser"},r=n.default.getFirstMatch(a,e)||n.default.getFirstMatch(/w(?:eb)?[o0]sbrowser\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/bada/i],describe:function(e){var t={name:"Bada"},r=n.default.getFirstMatch(/dolfin\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/tizen/i],describe:function(e){var t={name:"Tizen"},r=n.default.getFirstMatch(/(?:tizen\s?)?browser\/(\d+(\.?_?\d+)+)/i,e)||n.default.getFirstMatch(a,e);return r&&(t.version=r),t}},{test:[/qupzilla/i],describe:function(e){var t={name:"QupZilla"},r=n.default.getFirstMatch(/(?:qupzilla)[\s/](\d+(\.?_?\d+)+)/i,e)||n.default.getFirstMatch(a,e);return r&&(t.version=r),t}},{test:[/librewolf/i],describe:function(e){var t={name:"LibreWolf"},r=n.default.getFirstMatch(/(?:librewolf)[\s/](\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/firefox|iceweasel|fxios/i],describe:function(e){var t={name:"Firefox"},r=n.default.getFirstMatch(/(?:firefox|iceweasel|fxios)[\s/](\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/electron/i],describe:function(e){var t={name:"Electron"},r=n.default.getFirstMatch(/(?:electron)\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/sogoumobilebrowser/i,/metasr/i,/se 2\.[x]/i],describe:function(e){var t={name:"Sogou Browser"},r=n.default.getFirstMatch(/(?:sogoumobilebrowser)[\s/](\d+(\.?_?\d+)+)/i,e),i=n.default.getFirstMatch(/(?:chrome|crios|crmo)\/(\d+(\.?_?\d+)+)/i,e),a=n.default.getFirstMatch(/se ([\d.]+)x/i,e),o=r||i||a;return o&&(t.version=o),t}},{test:[/MiuiBrowser/i],describe:function(e){var t={name:"Miui"},r=n.default.getFirstMatch(/(?:MiuiBrowser)[\s/](\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/chromium/i],describe:function(e){var t={name:"Chromium"},r=n.default.getFirstMatch(/(?:chromium)[\s/](\d+(\.?_?\d+)+)/i,e)||n.default.getFirstMatch(a,e);return r&&(t.version=r),t}},{test:[/chrome|crios|crmo/i],describe:function(e){var t={name:"Chrome"},r=n.default.getFirstMatch(/(?:chrome|crios|crmo)\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/GSA/i],describe:function(e){var t={name:"Google Search"},r=n.default.getFirstMatch(/(?:GSA)\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:function(e){var t=!e.test(/like android/i),r=e.test(/android/i);return t&&r},describe:function(e){var t={name:"Android Browser"},r=n.default.getFirstMatch(a,e);return r&&(t.version=r),t}},{test:[/playstation 4/i],describe:function(e){var t={name:"PlayStation 4"},r=n.default.getFirstMatch(a,e);return r&&(t.version=r),t}},{test:[/safari|applewebkit/i],describe:function(e){var t={name:"Safari"},r=n.default.getFirstMatch(a,e);return r&&(t.version=r),t}},{test:[/.*/i],describe:function(e){var t=-1!==e.search("\\(")?/^(.*)\/(.*)[ \t]\((.*)/:/^(.*)\/(.*) /;return {name:n.default.getFirstMatch(t,e),version:n.default.getSecondMatch(t,e)}}}];t.default=o,e.exports=t.default;},93:function(e,t,r){t.__esModule=true,t.default=void 0;var i,n=(i=r(17))&&i.__esModule?i:{default:i},a=r(18);var o=[{test:[/Roku\/DVP/],describe:function(e){var t=n.default.getFirstMatch(/Roku\/DVP-(\d+\.\d+)/i,e);return {name:a.OS_MAP.Roku,version:t}}},{test:[/windows phone/i],describe:function(e){var t=n.default.getFirstMatch(/windows phone (?:os)?\s?(\d+(\.\d+)*)/i,e);return {name:a.OS_MAP.WindowsPhone,version:t}}},{test:[/windows /i],describe:function(e){var t=n.default.getFirstMatch(/Windows ((NT|XP)( \d\d?.\d)?)/i,e),r=n.default.getWindowsVersionName(t);return {name:a.OS_MAP.Windows,version:t,versionName:r}}},{test:[/Macintosh(.*?) FxiOS(.*?)\//],describe:function(e){var t={name:a.OS_MAP.iOS},r=n.default.getSecondMatch(/(Version\/)(\d[\d.]+)/,e);return r&&(t.version=r),t}},{test:[/macintosh/i],describe:function(e){var t=n.default.getFirstMatch(/mac os x (\d+(\.?_?\d+)+)/i,e).replace(/[_\s]/g,"."),r=n.default.getMacOSVersionName(t),i={name:a.OS_MAP.MacOS,version:t};return r&&(i.versionName=r),i}},{test:[/(ipod|iphone|ipad)/i],describe:function(e){var t=n.default.getFirstMatch(/os (\d+([_\s]\d+)*) like mac os x/i,e).replace(/[_\s]/g,".");return {name:a.OS_MAP.iOS,version:t}}},{test:[/OpenHarmony/i],describe:function(e){var t=n.default.getFirstMatch(/OpenHarmony\s+(\d+(\.\d+)*)/i,e);return {name:a.OS_MAP.HarmonyOS,version:t}}},{test:function(e){var t=!e.test(/like android/i),r=e.test(/android/i);return t&&r},describe:function(e){var t=n.default.getFirstMatch(/android[\s/-](\d+(\.\d+)*)/i,e),r=n.default.getAndroidVersionName(t),i={name:a.OS_MAP.Android,version:t};return r&&(i.versionName=r),i}},{test:[/(web|hpw)[o0]s/i],describe:function(e){var t=n.default.getFirstMatch(/(?:web|hpw)[o0]s\/(\d+(\.\d+)*)/i,e),r={name:a.OS_MAP.WebOS};return t&&t.length&&(r.version=t),r}},{test:[/blackberry|\bbb\d+/i,/rim\stablet/i],describe:function(e){var t=n.default.getFirstMatch(/rim\stablet\sos\s(\d+(\.\d+)*)/i,e)||n.default.getFirstMatch(/blackberry\d+\/(\d+([_\s]\d+)*)/i,e)||n.default.getFirstMatch(/\bbb(\d+)/i,e);return {name:a.OS_MAP.BlackBerry,version:t}}},{test:[/bada/i],describe:function(e){var t=n.default.getFirstMatch(/bada\/(\d+(\.\d+)*)/i,e);return {name:a.OS_MAP.Bada,version:t}}},{test:[/tizen/i],describe:function(e){var t=n.default.getFirstMatch(/tizen[/\s](\d+(\.\d+)*)/i,e);return {name:a.OS_MAP.Tizen,version:t}}},{test:[/linux/i],describe:function(){return {name:a.OS_MAP.Linux}}},{test:[/CrOS/],describe:function(){return {name:a.OS_MAP.ChromeOS}}},{test:[/PlayStation 4/],describe:function(e){var t=n.default.getFirstMatch(/PlayStation 4[/\s](\d+(\.\d+)*)/i,e);return {name:a.OS_MAP.PlayStation4,version:t}}}];t.default=o,e.exports=t.default;},94:function(e,t,r){t.__esModule=true,t.default=void 0;var i,n=(i=r(17))&&i.__esModule?i:{default:i},a=r(18);var o=[{test:[/googlebot/i],describe:function(){return {type:a.PLATFORMS_MAP.bot,vendor:"Google"}}},{test:[/amazonbot/i],describe:function(){return {type:a.PLATFORMS_MAP.bot,vendor:"Amazon"}}},{test:[/gptbot/i],describe:function(){return {type:a.PLATFORMS_MAP.bot,vendor:"OpenAI"}}},{test:[/chatgpt-user/i],describe:function(){return {type:a.PLATFORMS_MAP.bot,vendor:"OpenAI"}}},{test:[/oai-searchbot/i],describe:function(){return {type:a.PLATFORMS_MAP.bot,vendor:"OpenAI"}}},{test:[/baiduspider/i],describe:function(){return {type:a.PLATFORMS_MAP.bot,vendor:"Baidu"}}},{test:[/bingbot/i],describe:function(){return {type:a.PLATFORMS_MAP.bot,vendor:"Bing"}}},{test:[/duckduckbot/i],describe:function(){return {type:a.PLATFORMS_MAP.bot,vendor:"DuckDuckGo"}}},{test:[/claudebot/i,/claude-web/i,/claude-user/i,/claude-searchbot/i],describe:function(){return {type:a.PLATFORMS_MAP.bot,vendor:"Anthropic"}}},{test:[/omgilibot/i,/webzio-extended/i],describe:function(){return {type:a.PLATFORMS_MAP.bot,vendor:"Webz.io"}}},{test:[/diffbot/i],describe:function(){return {type:a.PLATFORMS_MAP.bot,vendor:"Diffbot"}}},{test:[/perplexitybot/i],describe:function(){return {type:a.PLATFORMS_MAP.bot,vendor:"Perplexity AI"}}},{test:[/perplexity-user/i],describe:function(){return {type:a.PLATFORMS_MAP.bot,vendor:"Perplexity AI"}}},{test:[/youbot/i],describe:function(){return {type:a.PLATFORMS_MAP.bot,vendor:"You.com"}}},{test:[/ia_archiver/i],describe:function(){return {type:a.PLATFORMS_MAP.bot,vendor:"Internet Archive"}}},{test:[/meta-webindexer/i],describe:function(){return {type:a.PLATFORMS_MAP.bot,vendor:"Meta"}}},{test:[/meta-externalads/i],describe:function(){return {type:a.PLATFORMS_MAP.bot,vendor:"Meta"}}},{test:[/meta-externalagent/i],describe:function(){return {type:a.PLATFORMS_MAP.bot,vendor:"Meta"}}},{test:[/meta-externalfetcher/i],describe:function(){return {type:a.PLATFORMS_MAP.bot,vendor:"Meta"}}},{test:[/facebookexternalhit/i,/facebookcatalog/i],describe:function(){return {type:a.PLATFORMS_MAP.bot,vendor:"Meta"}}},{test:[/yahoo/i],describe:function(){return {type:a.PLATFORMS_MAP.bot,vendor:"Yahoo"}}},{test:[/yandexbot/i,/yandexmobilebot/i],describe:function(){return {type:a.PLATFORMS_MAP.bot,vendor:"Yandex"}}},{test:[/pingdom/i],describe:function(){return {type:a.PLATFORMS_MAP.bot,vendor:"Pingdom"}}},{test:[/huawei/i],describe:function(e){var t=n.default.getFirstMatch(/(can-l01)/i,e)&&"Nova",r={type:a.PLATFORMS_MAP.mobile,vendor:"Huawei"};return t&&(r.model=t),r}},{test:[/nexus\s*(?:7|8|9|10).*/i],describe:function(){return {type:a.PLATFORMS_MAP.tablet,vendor:"Nexus"}}},{test:[/ipad/i],describe:function(){return {type:a.PLATFORMS_MAP.tablet,vendor:"Apple",model:"iPad"}}},{test:[/Macintosh(.*?) FxiOS(.*?)\//],describe:function(){return {type:a.PLATFORMS_MAP.tablet,vendor:"Apple",model:"iPad"}}},{test:[/kftt build/i],describe:function(){return {type:a.PLATFORMS_MAP.tablet,vendor:"Amazon",model:"Kindle Fire HD 7"}}},{test:[/silk/i],describe:function(){return {type:a.PLATFORMS_MAP.tablet,vendor:"Amazon"}}},{test:[/tablet(?! pc)/i],describe:function(){return {type:a.PLATFORMS_MAP.tablet}}},{test:function(e){var t=e.test(/ipod|iphone/i),r=e.test(/like (ipod|iphone)/i);return t&&!r},describe:function(e){var t=n.default.getFirstMatch(/(ipod|iphone)/i,e);return {type:a.PLATFORMS_MAP.mobile,vendor:"Apple",model:t}}},{test:[/nexus\s*[0-6].*/i,/galaxy nexus/i],describe:function(){return {type:a.PLATFORMS_MAP.mobile,vendor:"Nexus"}}},{test:[/Nokia/i],describe:function(e){var t=n.default.getFirstMatch(/Nokia\s+([0-9]+(\.[0-9]+)?)/i,e),r={type:a.PLATFORMS_MAP.mobile,vendor:"Nokia"};return t&&(r.model=t),r}},{test:[/[^-]mobi/i],describe:function(){return {type:a.PLATFORMS_MAP.mobile}}},{test:function(e){return "blackberry"===e.getBrowserName(true)},describe:function(){return {type:a.PLATFORMS_MAP.mobile,vendor:"BlackBerry"}}},{test:function(e){return "bada"===e.getBrowserName(true)},describe:function(){return {type:a.PLATFORMS_MAP.mobile}}},{test:function(e){return "windows phone"===e.getBrowserName()},describe:function(){return {type:a.PLATFORMS_MAP.mobile,vendor:"Microsoft"}}},{test:function(e){var t=Number(String(e.getOSVersion()).split(".")[0]);return "android"===e.getOSName(true)&&t>=3},describe:function(){return {type:a.PLATFORMS_MAP.tablet}}},{test:function(e){return "android"===e.getOSName(true)},describe:function(){return {type:a.PLATFORMS_MAP.mobile}}},{test:function(e){return "macos"===e.getOSName(true)},describe:function(){return {type:a.PLATFORMS_MAP.desktop,vendor:"Apple"}}},{test:function(e){return "windows"===e.getOSName(true)},describe:function(){return {type:a.PLATFORMS_MAP.desktop}}},{test:function(e){return "linux"===e.getOSName(true)},describe:function(){return {type:a.PLATFORMS_MAP.desktop}}},{test:function(e){return "playstation 4"===e.getOSName(true)},describe:function(){return {type:a.PLATFORMS_MAP.tv}}},{test:function(e){return "roku"===e.getOSName(true)},describe:function(){return {type:a.PLATFORMS_MAP.tv}}}];t.default=o,e.exports=t.default;},95:function(e,t,r){t.__esModule=true,t.default=void 0;var i,n=(i=r(17))&&i.__esModule?i:{default:i},a=r(18);var o=[{test:function(e){return "microsoft edge"===e.getBrowserName(true)},describe:function(e){if(/\sedg\//i.test(e))return {name:a.ENGINE_MAP.Blink};var t=n.default.getFirstMatch(/edge\/(\d+(\.?_?\d+)+)/i,e);return {name:a.ENGINE_MAP.EdgeHTML,version:t}}},{test:[/trident/i],describe:function(e){var t={name:a.ENGINE_MAP.Trident},r=n.default.getFirstMatch(/trident\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:function(e){return e.test(/presto/i)},describe:function(e){var t={name:a.ENGINE_MAP.Presto},r=n.default.getFirstMatch(/presto\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:function(e){var t=e.test(/gecko/i),r=e.test(/like gecko/i);return t&&!r},describe:function(e){var t={name:a.ENGINE_MAP.Gecko},r=n.default.getFirstMatch(/gecko\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/(apple)?webkit\/537\.36/i],describe:function(){return {name:a.ENGINE_MAP.Blink}}},{test:[/(apple)?webkit/i],describe:function(e){var t={name:a.ENGINE_MAP.WebKit},r=n.default.getFirstMatch(/webkit\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}}];t.default=o,e.exports=t.default;}})}));
|
|
52
|
+
} (es5$1));
|
|
53
|
+
return es5$1.exports;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
var es5Exports = requireEs5();
|
|
57
|
+
var Bowser = /*@__PURE__*/getDefaultExportFromCjs(es5Exports);
|
|
58
|
+
|
|
59
|
+
const mbCrosswordCss = () => `*[part=main]{position:relative;display:grid;grid-template-areas:"board" "clues";grid-template-columns:1fr}@media (min-width: 768px){*[part=main]{grid-template-areas:"clues board" "clues .";grid-template-columns:1fr 1fr}*[part=main].--only-board{grid-template-columns:1fr;grid-template-areas:"board"}}*[part=main].--focused{background:lightgrey}*[part=main] input.dummy{pointer-events:none;opacity:0;grid-area:board;border:none;outline:none}[part=clues]{grid-area:clues;display:grid;grid-template-columns:1fr 1fr;gap:16px}[part=clues].oneList{grid-template-columns:1fr}[part=clue-list]{margin:0;padding:0}[part=clue].--current{background:var(--clue-current-background, lightcyan)}[part=clue] .preview{font-weight:bold;letter-spacing:0.2em;text-align:center;display:block;text-transform:uppercase}li[part=clue]{--_clue-padding:var(--clue-padding, .5em);border-radius:var(--clue-radius, 0.5em);padding:var(--_clue-padding);list-style-position:inside;padding-left:calc(1em + var(--_clue-padding));text-indent:-1em;margin:0}[part=board]{grid-area:board;display:block;position:relative;container-type:size;background:var(--board-background, darkgoldenrod);--_cell-border-width:var(--cell-border-width, 2px);--cell-width-temp:calc((100cqw - var(--_cell-border-width)) / var(--board-width, 10));--cell-width:var(--cell-width-temp);--cell-width:round(var(--cell-width-temp), 1px)}[part=cell]{display:block;color:var(--cell-color, #11138d);width:calc(var(--cell-width) - var(--_cell-border-width));aspect-ratio:1;background:var(--cell-background, #d9d9d9);position:absolute;container-type:size;top:calc(var(--y, 0) * var(--cell-width));left:calc(var(--x, 0) * var(--cell-width));border:var(--_cell-border-width) solid var(--cell-border-color, red)}[part=cell].--alt{background:var(--cell-background-alt, #999)}[part=cell].--in-current-clue{box-shadow:inset 0 0 2px 2px var(--cell-selected-background, lightblue)}[part=cell].--selected{background:var(--cell-selected-background, lightblue)}[part=cell].--special{background:var(--cell-special-background, lightgreen)}[part=cell].--special.--selected:before{content:"";background:var(--cell-selected-background, lightblue);position:absolute;top:0;left:0;right:0;bottom:0;clip-path:polygon(100% 0, 100% 100%, 50% 100%)}[part=cell] ._inner{position:absolute;top:0;left:0;right:0;bottom:0;display:grid;place-content:center;text-transform:uppercase;font-size:80cqh}[part=preview]{display:none}[part=special-border]{display:block;background:black;position:absolute;z-index:100;--s-border:max(2px, var(--_cell-border-width))}[part=special-border].left,[part=special-border].right{width:var(--s-border);height:calc(var(--cell-width) - var(--_cell-border-width));top:calc(var(--y, 0) * var(--cell-width) + var(--_cell-border-width))}[part=special-border].left{left:calc(var(--x, 0) * var(--cell-width) - var(--s-border) / 2)}[part=special-border].right{left:calc((var(--x, 0) + 1) * var(--cell-width) - var(--s-border) / 2)}[part=special-border].top,[part=special-border].bottom{width:calc(var(--cell-width) - var(--_cell-border-width));height:var(--s-border);left:calc(var(--x, 0) * var(--cell-width) + var(--_cell-border-width))}[part=special-border].top{top:calc(var(--y, 0) * var(--cell-width))}[part=special-border].bottom{top:calc((var(--y, 0) + 1) * var(--cell-width))}[part=label]{display:grid;position:absolute;container-type:size;top:calc(var(--y, 0) * var(--cell-width));left:calc(var(--x, 0) * var(--cell-width));width:calc(var(--cell-width) - var(--_cell-border-width));aspect-ratio:1;border:var(--_cell-border-width) solid transparent;--label-place-content:center end}[part=label] ._inner{position:absolute;top:var(--label-padding, 10cqh);left:var(--label-padding, 10cqh);right:var(--label-padding, 10cqh);bottom:var(--label-padding, 10cqh);display:grid;place-content:var(--label-place-content, center);text-transform:uppercase;font-size:var(--label-font-size, 60cqh)}[part=floating-clue]{position:fixed;color:white;left:0;right:0;bottom:0;--_background:var(--floating-clue-background, blue)}[part=floating-clue] .floating-clue__text{padding:8px;background:var(--_background)}[part=floating-clue] .floating-clue__preview{display:inline-block;padding:8px;background:var(--_background);font-weight:bold;letter-spacing:0.2em;text-transform:uppercase;border-radius:0 16px 0 0}[part=floating-clue] .floating-clue__preview span{display:inline-block;width:1em;text-align:center}.--sticky-bottom-hack [part=floating-clue]{top:var(--height);top:calc(var(--height) + var(--offsetTop));bottom:unset;transform:translate(0, -100%)}@media (orientation: landscape){.--sticky-bottom-hack [part=floating-clue]{top:calc(var(--height) + var(--offsetTop))}}`;
|
|
38
60
|
|
|
39
61
|
const MBCrossword = class {
|
|
40
62
|
constructor(hostRef) {
|
|
@@ -53,11 +75,20 @@ const MBCrossword = class {
|
|
|
53
75
|
currentClue = null;
|
|
54
76
|
isFocused = false;
|
|
55
77
|
selectedCell = null;
|
|
78
|
+
bowserParser = Bowser.getParser(typeof window !== 'undefined' ? window.navigator.userAgent : 'unknown');
|
|
79
|
+
abortController = new AbortController();
|
|
56
80
|
componentWillLoad() {
|
|
57
|
-
console.log('componentWillLoad', this.init, this.data);
|
|
58
81
|
if (this.init && this.data) {
|
|
59
82
|
this.initGame();
|
|
60
83
|
}
|
|
84
|
+
if (this.useStickyBottomHack && typeof window !== 'undefined') {
|
|
85
|
+
window.visualViewport.addEventListener('resize', this.updateFloatingPreview.bind(this), { signal: this.abortController.signal });
|
|
86
|
+
window.visualViewport.addEventListener('scroll', this.updateFloatingPreview.bind(this), { signal: this.abortController.signal });
|
|
87
|
+
this.updateFloatingPreview();
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
disconnectedCallback() {
|
|
91
|
+
this.abortController.abort();
|
|
61
92
|
}
|
|
62
93
|
watchData() {
|
|
63
94
|
if (this.init && this.data) {
|
|
@@ -71,7 +102,6 @@ const MBCrossword = class {
|
|
|
71
102
|
];
|
|
72
103
|
}
|
|
73
104
|
async initGame(data = this.data) {
|
|
74
|
-
console.log('initGame');
|
|
75
105
|
if (!data.words) {
|
|
76
106
|
throw new Error('Words definition missing');
|
|
77
107
|
}
|
|
@@ -96,10 +126,6 @@ const MBCrossword = class {
|
|
|
96
126
|
}
|
|
97
127
|
async checkAnswer() {
|
|
98
128
|
const cells = this.cells.filter(c => !c.isBlocked);
|
|
99
|
-
console.log(cells);
|
|
100
|
-
cells.forEach(c => {
|
|
101
|
-
console.log(`${c.value} === ${c.answer}`, `${c.x},${c.y}`, c.value === c.answer);
|
|
102
|
-
});
|
|
103
129
|
return cells.every(c => c.value === c.answer);
|
|
104
130
|
}
|
|
105
131
|
specialBorders = [];
|
|
@@ -108,6 +134,18 @@ const MBCrossword = class {
|
|
|
108
134
|
boardWidth = 0;
|
|
109
135
|
boardHeight = 0;
|
|
110
136
|
cells = [];
|
|
137
|
+
useStickyBottomHack = this.bowserParser.isOS('ios');
|
|
138
|
+
floatingPreviewHackParams = {
|
|
139
|
+
height: 0,
|
|
140
|
+
offsetTop: 0
|
|
141
|
+
};
|
|
142
|
+
updateFloatingPreview(_event) {
|
|
143
|
+
this.floatingPreviewHackParams = {
|
|
144
|
+
...this.floatingPreviewHackParams,
|
|
145
|
+
height: window.visualViewport.height,
|
|
146
|
+
offsetTop: window.visualViewport.offsetTop
|
|
147
|
+
};
|
|
148
|
+
}
|
|
111
149
|
buildBoard() {
|
|
112
150
|
let boardWidth = 0;
|
|
113
151
|
let boardHeight = 0;
|
|
@@ -270,10 +308,10 @@ const MBCrossword = class {
|
|
|
270
308
|
}
|
|
271
309
|
onFocusin() {
|
|
272
310
|
this.isFocused = true;
|
|
273
|
-
if (!this.currentClueId) {
|
|
274
|
-
|
|
275
|
-
}
|
|
276
|
-
this.textInput.focus();
|
|
311
|
+
// if (!this.currentClueId) {
|
|
312
|
+
// this.currentClueId = this.allWords[0]?.id ?? null;
|
|
313
|
+
// }
|
|
314
|
+
// this.textInput.focus();
|
|
277
315
|
}
|
|
278
316
|
onFocusOut() {
|
|
279
317
|
this.isFocused = false;
|
|
@@ -403,10 +441,15 @@ const MBCrossword = class {
|
|
|
403
441
|
const hasHWords = Boolean(this.hWords.length);
|
|
404
442
|
const hideList = this.clueListStyle === 'none';
|
|
405
443
|
const twoLists = hasHWords && hasVWords;
|
|
406
|
-
|
|
444
|
+
const showFloatingClue = this.isFocused && this.currentClue && this.bowserParser.isPlatform('mobile');
|
|
445
|
+
return index.h("div", { key: 'b18bbd3453ad8c96cf6b5f04903380b0357d5842', part: "main", class: {
|
|
407
446
|
"--focused": this.isFocused,
|
|
408
|
-
"--only-board": hideList
|
|
409
|
-
|
|
447
|
+
"--only-board": hideList,
|
|
448
|
+
"--sticky-bottom-hack": this.useStickyBottomHack
|
|
449
|
+
}, onFocusin: this.onFocusin.bind(this), onFocusout: this.onFocusOut.bind(this), onClick: () => {
|
|
450
|
+
this.textInput.blur();
|
|
451
|
+
this.textInput.focus();
|
|
452
|
+
} }, index.h("input", { key: '59e427026f09803d1077d1c36f95284fe8d1b8ae', type: "text", class: "dummy", ref: (el) => this.textInput = el, onKeyDown: this.onKeyPress.bind(this), onInput: this.onInput.bind(this) }), hideList ? '' : index.h("div", { part: "clues", class: {
|
|
410
453
|
twoLists,
|
|
411
454
|
oneList: !twoLists
|
|
412
455
|
} }, hasHWords ? index.h(ClueList, { type: this.clueListStyle }, this.hWords.map(w => {
|
|
@@ -415,7 +458,7 @@ const MBCrossword = class {
|
|
|
415
458
|
})) : '', hasVWords ? index.h(ClueList, { type: this.clueListStyle }, this.vWords.map(w => {
|
|
416
459
|
const isCurrent = w.id === this.currentClueId;
|
|
417
460
|
return index.h(Clue, { showPreview: this.showCluePreview, preview: this.getCluePreview(w), word: w, isCurrent: isCurrent, onPointerDown: () => this.selectClue(w.id), tagName: this.clueListStyle === 'ol' ? 'li' : undefined });
|
|
418
|
-
})) : ''), index.h("div", { key: '
|
|
461
|
+
})) : ''), index.h("div", { key: 'a4803d792f38119e3ba78584acdbb0db677b4869', part: "board", style: {
|
|
419
462
|
'--board-width': `${this.boardWidth}`,
|
|
420
463
|
'grid-template-columns': `repeat(${this.boardWidth}, 1fr)`,
|
|
421
464
|
aspectRatio: `${this.boardWidth / this.boardHeight}`
|
|
@@ -439,7 +482,12 @@ const MBCrossword = class {
|
|
|
439
482
|
"--x": `${label.x}`,
|
|
440
483
|
"--y": `${label.y}`
|
|
441
484
|
}, onPointerDown: () => this.selectClue(label.clueId) }, index.h("div", { class: "_inner" }, label.text));
|
|
442
|
-
}))
|
|
485
|
+
})), showFloatingClue ? index.h("div", { part: "floating-clue", style: {
|
|
486
|
+
"--height": `${this.floatingPreviewHackParams.height}px`,
|
|
487
|
+
"--offsetTop": `${this.floatingPreviewHackParams.offsetTop}px`
|
|
488
|
+
} }, index.h("div", { class: "floating-clue__preview" }, Array.from(this.getCluePreview(this.currentClue)).map((c, index$1) => {
|
|
489
|
+
return index.h("span", { key: index$1 }, c);
|
|
490
|
+
})), index.h("div", { class: "floating-clue__text" }, this.currentClue?.clue ?? '')) : '');
|
|
443
491
|
}
|
|
444
492
|
static get delegatesFocus() { return true; }
|
|
445
493
|
static get watchers() { return {
|
|
@@ -19,7 +19,7 @@ var patchBrowser = () => {
|
|
|
19
19
|
|
|
20
20
|
patchBrowser().then(async (options) => {
|
|
21
21
|
await appGlobals.globalScripts();
|
|
22
|
-
return index.bootstrapLazy([["mb-crossword.cjs",[[529,"mb-crossword",{"init":[4],"data":[16],"showCluePreview":[4,"show-clue-preview"],"clueListStyle":[1,"clue-list-style"],"hWords":[32],"vWords":[32],"currentClueId":[32],"currentClue":[32],"isFocused":[32],"selectedCell":[32],"specialBorders":[32],"specialCells":[32],"labels":[32],"boardWidth":[32],"boardHeight":[32],"cells":[32],"initGame":[64],"checkAnswer":[64],"selectClue":[64]},null,{"data":[{"watchData":0}]}]]]], options);
|
|
22
|
+
return index.bootstrapLazy([["mb-crossword.cjs",[[529,"mb-crossword",{"init":[4],"data":[16],"showCluePreview":[4,"show-clue-preview"],"clueListStyle":[1,"clue-list-style"],"hWords":[32],"vWords":[32],"currentClueId":[32],"currentClue":[32],"isFocused":[32],"selectedCell":[32],"specialBorders":[32],"specialCells":[32],"labels":[32],"boardWidth":[32],"boardHeight":[32],"cells":[32],"floatingPreviewHackParams":[32],"initGame":[64],"checkAnswer":[64],"selectClue":[64]},null,{"data":[{"watchData":0}]}]]]], options);
|
|
23
23
|
});
|
|
24
24
|
|
|
25
25
|
exports.setNonce = index.setNonce;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { h } from "@stencil/core";
|
|
2
2
|
export function Clue({ isCurrent, word, onPointerDown, preview, showPreview, tagName }) {
|
|
3
3
|
const Tag = tagName ?? 'div';
|
|
4
|
-
return h(Tag, { onPointerDown: onPointerDown, part: "clue", class: {
|
|
4
|
+
return h(Tag, { role: 'button', onPointerDown: onPointerDown, part: "clue", class: {
|
|
5
5
|
"--current": isCurrent
|
|
6
6
|
} }, word.clue, showPreview && h("span", { class: "preview" }, preview));
|
|
7
7
|
}
|
|
@@ -19,8 +19,7 @@
|
|
|
19
19
|
}
|
|
20
20
|
*[part=main] input.dummy {
|
|
21
21
|
pointer-events: none;
|
|
22
|
-
opacity: 0
|
|
23
|
-
z-index: 100;
|
|
22
|
+
opacity: 0;
|
|
24
23
|
grid-area: board;
|
|
25
24
|
border: none;
|
|
26
25
|
outline: none;
|
|
@@ -43,10 +42,6 @@
|
|
|
43
42
|
|
|
44
43
|
[part=clue].--current {
|
|
45
44
|
background: var(--clue-current-background, lightcyan);
|
|
46
|
-
position: sticky;
|
|
47
|
-
bottom: 0;
|
|
48
|
-
left: 0;
|
|
49
|
-
right: 0;
|
|
50
45
|
}
|
|
51
46
|
[part=clue] .preview {
|
|
52
47
|
font-weight: bold;
|
|
@@ -179,4 +174,43 @@ li[part=clue] {
|
|
|
179
174
|
place-content: var(--label-place-content, center);
|
|
180
175
|
text-transform: uppercase;
|
|
181
176
|
font-size: var(--label-font-size, 60cqh);
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
[part=floating-clue] {
|
|
180
|
+
position: fixed;
|
|
181
|
+
color: white;
|
|
182
|
+
left: 0;
|
|
183
|
+
right: 0;
|
|
184
|
+
bottom: 0;
|
|
185
|
+
--_background: var(--floating-clue-background, blue);
|
|
186
|
+
}
|
|
187
|
+
[part=floating-clue] .floating-clue__text {
|
|
188
|
+
padding: 8px;
|
|
189
|
+
background: var(--_background);
|
|
190
|
+
}
|
|
191
|
+
[part=floating-clue] .floating-clue__preview {
|
|
192
|
+
display: inline-block;
|
|
193
|
+
padding: 8px;
|
|
194
|
+
background: var(--_background);
|
|
195
|
+
font-weight: bold;
|
|
196
|
+
letter-spacing: 0.2em;
|
|
197
|
+
text-transform: uppercase;
|
|
198
|
+
border-radius: 0 16px 0 0;
|
|
199
|
+
}
|
|
200
|
+
[part=floating-clue] .floating-clue__preview span {
|
|
201
|
+
display: inline-block;
|
|
202
|
+
width: 1em;
|
|
203
|
+
text-align: center;
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
.--sticky-bottom-hack [part=floating-clue] {
|
|
207
|
+
top: var(--height);
|
|
208
|
+
top: calc(var(--height) + var(--offsetTop));
|
|
209
|
+
bottom: unset;
|
|
210
|
+
transform: translate(0, -100%);
|
|
211
|
+
}
|
|
212
|
+
@media (orientation: landscape) {
|
|
213
|
+
.--sticky-bottom-hack [part=floating-clue] {
|
|
214
|
+
top: calc(var(--height) + var(--offsetTop));
|
|
215
|
+
}
|
|
182
216
|
}
|
|
@@ -4,6 +4,7 @@ import { Cell } from "./cell";
|
|
|
4
4
|
import { indexFromXY, isInputEventLetter, Vec2fromIndex } from "../../utils/utils";
|
|
5
5
|
import { Vec2 } from "@mb-puzzle/vec2";
|
|
6
6
|
import { ClueList } from "./clue-list";
|
|
7
|
+
import Bowser from "bowser";
|
|
7
8
|
export class MBCrossword {
|
|
8
9
|
init = true;
|
|
9
10
|
data;
|
|
@@ -17,11 +18,20 @@ export class MBCrossword {
|
|
|
17
18
|
currentClue = null;
|
|
18
19
|
isFocused = false;
|
|
19
20
|
selectedCell = null;
|
|
21
|
+
bowserParser = Bowser.getParser(typeof window !== 'undefined' ? window.navigator.userAgent : 'unknown');
|
|
22
|
+
abortController = new AbortController();
|
|
20
23
|
componentWillLoad() {
|
|
21
|
-
console.log('componentWillLoad', this.init, this.data);
|
|
22
24
|
if (this.init && this.data) {
|
|
23
25
|
this.initGame();
|
|
24
26
|
}
|
|
27
|
+
if (this.useStickyBottomHack && typeof window !== 'undefined') {
|
|
28
|
+
window.visualViewport.addEventListener('resize', this.updateFloatingPreview.bind(this), { signal: this.abortController.signal });
|
|
29
|
+
window.visualViewport.addEventListener('scroll', this.updateFloatingPreview.bind(this), { signal: this.abortController.signal });
|
|
30
|
+
this.updateFloatingPreview();
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
disconnectedCallback() {
|
|
34
|
+
this.abortController.abort();
|
|
25
35
|
}
|
|
26
36
|
watchData() {
|
|
27
37
|
if (this.init && this.data) {
|
|
@@ -35,7 +45,6 @@ export class MBCrossword {
|
|
|
35
45
|
];
|
|
36
46
|
}
|
|
37
47
|
async initGame(data = this.data) {
|
|
38
|
-
console.log('initGame');
|
|
39
48
|
if (!data.words) {
|
|
40
49
|
throw new Error('Words definition missing');
|
|
41
50
|
}
|
|
@@ -60,10 +69,6 @@ export class MBCrossword {
|
|
|
60
69
|
}
|
|
61
70
|
async checkAnswer() {
|
|
62
71
|
const cells = this.cells.filter(c => !c.isBlocked);
|
|
63
|
-
console.log(cells);
|
|
64
|
-
cells.forEach(c => {
|
|
65
|
-
console.log(`${c.value} === ${c.answer}`, `${c.x},${c.y}`, c.value === c.answer);
|
|
66
|
-
});
|
|
67
72
|
return cells.every(c => c.value === c.answer);
|
|
68
73
|
}
|
|
69
74
|
specialBorders = [];
|
|
@@ -72,6 +77,18 @@ export class MBCrossword {
|
|
|
72
77
|
boardWidth = 0;
|
|
73
78
|
boardHeight = 0;
|
|
74
79
|
cells = [];
|
|
80
|
+
useStickyBottomHack = this.bowserParser.isOS('ios');
|
|
81
|
+
floatingPreviewHackParams = {
|
|
82
|
+
height: 0,
|
|
83
|
+
offsetTop: 0
|
|
84
|
+
};
|
|
85
|
+
updateFloatingPreview(_event) {
|
|
86
|
+
this.floatingPreviewHackParams = {
|
|
87
|
+
...this.floatingPreviewHackParams,
|
|
88
|
+
height: window.visualViewport.height,
|
|
89
|
+
offsetTop: window.visualViewport.offsetTop
|
|
90
|
+
};
|
|
91
|
+
}
|
|
75
92
|
buildBoard() {
|
|
76
93
|
let boardWidth = 0;
|
|
77
94
|
let boardHeight = 0;
|
|
@@ -234,10 +251,10 @@ export class MBCrossword {
|
|
|
234
251
|
}
|
|
235
252
|
onFocusin() {
|
|
236
253
|
this.isFocused = true;
|
|
237
|
-
if (!this.currentClueId) {
|
|
238
|
-
|
|
239
|
-
}
|
|
240
|
-
this.textInput.focus();
|
|
254
|
+
// if (!this.currentClueId) {
|
|
255
|
+
// this.currentClueId = this.allWords[0]?.id ?? null;
|
|
256
|
+
// }
|
|
257
|
+
// this.textInput.focus();
|
|
241
258
|
}
|
|
242
259
|
onFocusOut() {
|
|
243
260
|
this.isFocused = false;
|
|
@@ -367,10 +384,15 @@ export class MBCrossword {
|
|
|
367
384
|
const hasHWords = Boolean(this.hWords.length);
|
|
368
385
|
const hideList = this.clueListStyle === 'none';
|
|
369
386
|
const twoLists = hasHWords && hasVWords;
|
|
370
|
-
|
|
387
|
+
const showFloatingClue = this.isFocused && this.currentClue && this.bowserParser.isPlatform('mobile');
|
|
388
|
+
return h("div", { key: 'b18bbd3453ad8c96cf6b5f04903380b0357d5842', part: "main", class: {
|
|
371
389
|
"--focused": this.isFocused,
|
|
372
|
-
"--only-board": hideList
|
|
373
|
-
|
|
390
|
+
"--only-board": hideList,
|
|
391
|
+
"--sticky-bottom-hack": this.useStickyBottomHack
|
|
392
|
+
}, onFocusin: this.onFocusin.bind(this), onFocusout: this.onFocusOut.bind(this), onClick: () => {
|
|
393
|
+
this.textInput.blur();
|
|
394
|
+
this.textInput.focus();
|
|
395
|
+
} }, h("input", { key: '59e427026f09803d1077d1c36f95284fe8d1b8ae', type: "text", class: "dummy", ref: (el) => this.textInput = el, onKeyDown: this.onKeyPress.bind(this), onInput: this.onInput.bind(this) }), hideList ? '' : h("div", { part: "clues", class: {
|
|
374
396
|
twoLists,
|
|
375
397
|
oneList: !twoLists
|
|
376
398
|
} }, hasHWords ? h(ClueList, { type: this.clueListStyle }, this.hWords.map(w => {
|
|
@@ -379,7 +401,7 @@ export class MBCrossword {
|
|
|
379
401
|
})) : '', hasVWords ? h(ClueList, { type: this.clueListStyle }, this.vWords.map(w => {
|
|
380
402
|
const isCurrent = w.id === this.currentClueId;
|
|
381
403
|
return h(Clue, { showPreview: this.showCluePreview, preview: this.getCluePreview(w), word: w, isCurrent: isCurrent, onPointerDown: () => this.selectClue(w.id), tagName: this.clueListStyle === 'ol' ? 'li' : undefined });
|
|
382
|
-
})) : ''), h("div", { key: '
|
|
404
|
+
})) : ''), h("div", { key: 'a4803d792f38119e3ba78584acdbb0db677b4869', part: "board", style: {
|
|
383
405
|
'--board-width': `${this.boardWidth}`,
|
|
384
406
|
'grid-template-columns': `repeat(${this.boardWidth}, 1fr)`,
|
|
385
407
|
aspectRatio: `${this.boardWidth / this.boardHeight}`
|
|
@@ -403,7 +425,12 @@ export class MBCrossword {
|
|
|
403
425
|
"--x": `${label.x}`,
|
|
404
426
|
"--y": `${label.y}`
|
|
405
427
|
}, onPointerDown: () => this.selectClue(label.clueId) }, h("div", { class: "_inner" }, label.text));
|
|
406
|
-
}))
|
|
428
|
+
})), showFloatingClue ? h("div", { part: "floating-clue", style: {
|
|
429
|
+
"--height": `${this.floatingPreviewHackParams.height}px`,
|
|
430
|
+
"--offsetTop": `${this.floatingPreviewHackParams.offsetTop}px`
|
|
431
|
+
} }, h("div", { class: "floating-clue__preview" }, Array.from(this.getCluePreview(this.currentClue)).map((c, index) => {
|
|
432
|
+
return h("span", { key: index }, c);
|
|
433
|
+
})), h("div", { class: "floating-clue__text" }, this.currentClue?.clue ?? '')) : '');
|
|
407
434
|
}
|
|
408
435
|
static get is() { return "mb-crossword"; }
|
|
409
436
|
static get encapsulation() { return "shadow"; }
|
|
@@ -519,7 +546,8 @@ export class MBCrossword {
|
|
|
519
546
|
"labels": {},
|
|
520
547
|
"boardWidth": {},
|
|
521
548
|
"boardHeight": {},
|
|
522
|
-
"cells": {}
|
|
549
|
+
"cells": {},
|
|
550
|
+
"floatingPreviewHackParams": {}
|
|
523
551
|
};
|
|
524
552
|
}
|
|
525
553
|
static get events() {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{h as t,t as e,p as i,H as r,c as s,Vec2fromIndex as l,V as a,f as o,isInputEventLetter as n,indexFromXY as c}from"./index.js";function h({isCurrent:e,word:i,onPointerDown:r,preview:s,showPreview:l,tagName:a}){return t(a??"div",{onPointerDown:r,part:"clue",class:{"--current":e}},i.clue,l&&t("span",{class:"preview"},s))}function d({data:e,isInCurrentClue:i,isSelected:r,isSpecial:s,onPointerDown:l}){return t("div",{onPointerDown:l,part:"cell",class:{"--blocked":e.isBlocked,"--in-current-clue":i,"--selected":r,"--alt":!((e.x+e.y)%2),"--special":s},style:{"--x":""+e.x,"--y":""+e.y}},t("div",{class:"_inner",style:{position:"absolute",width:"100%"}},e.value))}const u=({type:e},i)=>"p"===e?t("p",{part:"clue-list"},i.map(((e,i)=>t("p",{key:i},e)))):"ol"===e?t("ol",{part:"clue-list"},i):void 0,p=i(class extends r{constructor(t){super(),!1!==t&&this.__registerHost(),this.__attachShadow(),this.clueSelected=s(this,"clueSelected")}init=!0;data;showCluePreview=!0;clueListStyle="ol";clueSelected;textInput;hWords=[];vWords=[];currentClueId=null;currentClue=null;isFocused=!1;selectedCell=null;componentWillLoad(){console.log("componentWillLoad",this.init,this.data),this.init&&this.data&&this.initGame()}watchData(){this.init&&this.data&&this.initGame()}get allWords(){return[...this.hWords,...this.vWords]}async initGame(t=this.data){if(console.log("initGame"),!t.words)throw Error("Words definition missing");this.hWords=[],this.vWords=[],t.words.forEach(((t,e)=>{const i=Math.random();void 0===t.id&&(t.id=`${i}_${e}`),"horizontal"===t.orientation&&(this.hWords=[...this.hWords,t]),"vertical"===t.orientation&&(this.vWords=[...this.vWords,t])})),this.specialBorders=t.specialBorders??[],this.specialCells=t.specialCells??[],this.labels=t.labels??[],this.buildBoard()}async checkAnswer(){const t=this.cells.filter((t=>!t.isBlocked));return console.log(t),t.forEach((t=>{console.log(`${t.value} === ${t.answer}`,`${t.x},${t.y}`,t.value===t.answer)})),t.every((t=>t.value===t.answer))}specialBorders=[];specialCells=[];labels=[];boardWidth=0;boardHeight=0;cells=[];buildBoard(){let t=0,e=0;this.allWords.forEach((i=>{"horizontal"===i.orientation&&(t=Math.max(t,i.x+i.word.length),e=Math.max(e,i.y+1)),"vertical"===i.orientation&&(t=Math.max(t,i.x+1),e=Math.max(e,i.y+i.word.length))}));const i=Array(e*t).fill(null).map(((e,i)=>{const[r,s]=l(i,t);return{index:i,x:r,y:s,value:null,isCurrent:!1,isInCurrentWord:!1,isBlocked:!0}}));this.allWords.forEach((e=>{if("horizontal"===e.orientation)for(let r=0;r<e.word.length;r++){const s=a.from(e),l=c(new a(s.x+r,s.y),t);i[l].isBlocked=!1,i[l].answer=e.word[r]}if("vertical"===e.orientation)for(let r=0;r<e.word.length;r++){const s=a.from(e),l=c(new a(s.x,s.y+r),t);i[l].isBlocked=!1,i[l].answer=e.word[r]}})),this.cells=i,this.boardWidth=t,this.boardHeight=e}getClueById(t){return this.allWords.find((e=>e.id===t))??null}isInClue(t,e=this.currentClue){return null!==e&&(t.x===e.x||t.y===e.y)&&("horizontal"===e.orientation?!(t.y!==e.y||t.x<e.x||t.x>=e.x+e.word.length):"vertical"===e.orientation?!(t.x!==e.x||t.y<e.y||t.y>=e.y+e.word.length):void 0)}isSelectedCell(t){return!!this.selectedCell&&t.x===this.selectedCell.x&&t.y===this.selectedCell.y}getNextClueId(){if(!this.currentClueId)return this.allWords[0]?.id??null;const t=this.allWords.findIndex((t=>t.id===this.currentClueId));return t<0?this.allWords[0]?.id??null:this.allWords[t+1]?.id??null}getPrevClueId(){if(!this.currentClueId)return this.allWords[0]?.id??null;const t=this.allWords.findIndex((t=>t.id===this.currentClueId));return t<0?this.allWords[0]?.id??null:this.allWords[t-1]?.id??null}inputLetter(t){this.selectedCell&&(this.selectedCell.value=t,this.selectNextCell(),o(this))}backspace(){this.selectedCell&&(this.selectedCell.value?(this.selectedCell.value="",this.selectPrevCell()):(this.selectPrevCell(),this.selectedCell.value=""),o(this))}selectNextCell(){if(!this.selectedCell||!this.currentClue)return;const t=this.currentClue.orientation;if(function(t,e){return v(t).eq(a.from(e))}(this.currentClue,this.selectedCell)){const t=this.getNextClueId(),e=this.getClueById(t);return e?void this.selectClueByXY(a.from(e)):void 0}"horizontal"===t&&this.selectClueByXY(new a(this.selectedCell.x+1,this.selectedCell.y)),"vertical"===t&&this.selectClueByXY(new a(this.selectedCell.x,this.selectedCell.y+1))}selectPrevCell(){if(!this.selectedCell||!this.currentClue)return;const t=this.currentClue.orientation;if(function(t,e){return a.from(t).eq(a.from(e))}(this.currentClue,this.selectedCell)){const t=this.getPrevClueId(),e=this.getClueById(t);if(e){const t=v(e);return console.log(t),void this.selectClueByXY(t)}}"horizontal"===t&&this.selectClueByXY(new a(this.selectedCell.x-1,this.selectedCell.y)),"vertical"===t&&this.selectClueByXY(new a(this.selectedCell.x,this.selectedCell.y-1))}onFocusin(){this.isFocused=!0,this.currentClueId||(this.currentClueId=this.allWords[0]?.id??null),this.textInput.focus()}onFocusOut(){this.isFocused=!1}async selectClue(t,{row:e,col:i}={}){if(!t)return;this.currentClueId=t;const r=this.allWords.find((e=>e.id===t));r||(this.currentClueId=null,this.currentClue=null),this.currentClue=r;const s=[r.x,r.y];void 0!==e&&"vertical"===r.orientation&&e>=r.y&&e<r.y+r.word.length&&(s[1]=e),void 0!==i&&"horizontal"===r.orientation&&i>=r.x&&i<r.x+r.word.length&&(s[0]=i),this.selectCellByXY(a.from(s))}selectCellByXY(t){const e=c(t,this.boardWidth);this.selectedCell=this.cells[e]??null}findNonblockedCell(t,e){const i=new a(t[0]+e[0],t[1]+e[1]),r=this.boardWidth*this.boardHeight;let s=0;for(;this.isCellBlocked(i)&&s<r;)s++,i[0]+=e[0],i[1]+=e[1],i[0]<0&&(i[0]=this.boardWidth-1),i[0]>=this.boardWidth&&(i[0]=0),i[1]<0&&(i[1]=this.boardHeight-1),i[1]>=this.boardHeight&&(i[1]=0);return i}isCellBlocked(t){const e=this.cells[c(t,this.boardWidth)];return e?.isBlocked??!0}selectClueByXY(t){const e=this.allWords.filter((e=>this.isInClue(t,e)));if(e.length)if(this.selectedCell&&2===e.length&&t.eq(a.from(this.selectedCell))){const i=e.find((t=>t.orientation!==this.currentClue?.orientation));this.selectClue(i?.id??e[0].id,{row:t.y,col:t.x})}else{const i=e.find((t=>t.orientation===this.currentClue?.orientation));this.selectClue(i?.id??e[0].id,{row:t.y,col:t.x})}}getCluePreview(t){if(!t)return"_";const e=Array(t.word.length).fill("_");for(let i=0;i<t.word.length;i++){const r=new a(t.x,t.y).add("vertical"===t.orientation?new a(0,1*i):new a(1*i,0)),s=this.cells[c(r,this.boardWidth)];s.value&&(e[i]=s.value)}return e.join("")}onKeyPress(t){if(console.log(t),"Tab"===t.key){const e=t.shiftKey?this.getPrevClueId():this.getNextClueId();e&&(t.preventDefault(),this.selectClue(e))}if(this.selectedCell)switch(t.key){case"ArrowLeft":return this.selectClueByXY(this.findNonblockedCell(new a(this.selectedCell.x,this.selectedCell.y),new a(-1,0))),void t.preventDefault();case"ArrowRight":return this.selectClueByXY(this.findNonblockedCell(new a(this.selectedCell.x,this.selectedCell.y),new a(1,0))),void t.preventDefault();case"ArrowUp":return this.selectClueByXY(this.findNonblockedCell(new a(this.selectedCell.x,this.selectedCell.y),new a(0,-1))),void t.preventDefault();case"ArrowDown":return this.selectClueByXY(this.findNonblockedCell(new a(this.selectedCell.x,this.selectedCell.y),new a(0,1))),void t.preventDefault();case"Backspace":console.log("BACKSPACE!"),this.backspace()}}onInput(t){n(t)&&this.inputLetter(t.data.toLowerCase()[0]),this.textInput.value=""}render(){const e=!!this.vWords.length,i=!!this.hWords.length,r="none"===this.clueListStyle,s=i&&e;return t("div",{key:"0aa26f6435a57c206eba0d518313d6248d922eaa",part:"main",class:{"--focused":this.isFocused,"--only-board":r},onFocusin:this.onFocusin.bind(this),onFocusout:this.onFocusOut.bind(this)},t("input",{key:"e15789ff3feb48df30117b501b440142ba3eccf7",type:"text",class:"dummy",ref:t=>this.textInput=t,onKeyDown:this.onKeyPress.bind(this),onInput:this.onInput.bind(this)}),r?"":t("div",{part:"clues",class:{twoLists:s,oneList:!s}},i?t(u,{type:this.clueListStyle},this.hWords.map((e=>{const i=e.id===this.currentClueId;return t(h,{showPreview:this.showCluePreview,preview:this.getCluePreview(e),word:e,isCurrent:i,onPointerDown:()=>this.selectClue(e.id),tagName:"ol"===this.clueListStyle?"li":void 0})}))):"",e?t(u,{type:this.clueListStyle},this.vWords.map((e=>{const i=e.id===this.currentClueId;return t(h,{showPreview:this.showCluePreview,preview:this.getCluePreview(e),word:e,isCurrent:i,onPointerDown:()=>this.selectClue(e.id),tagName:"ol"===this.clueListStyle?"li":void 0})}))):""),t("div",{key:"08ffd76832a1c9c9dfddf8424e9e014d104444a0",part:"board",style:{"--board-width":""+this.boardWidth,"grid-template-columns":`repeat(${this.boardWidth}, 1fr)`,aspectRatio:""+this.boardWidth/this.boardHeight}},this.cells.filter((t=>!t.isBlocked)).map((e=>{const i=this.isInClue(e),r=this.isSelectedCell(e),s=this.specialCells.some((t=>t.x===e.x&&t.y===e.y));return t(d,{isSpecial:s,onPointerDown:()=>this.selectClueByXY(a.from(e)),isInCurrentClue:i,isSelected:r,data:e})})),this.specialBorders.map(((e,i)=>t("div",{key:i,part:"special-border",class:{top:!!(4096&e.border),right:!!(256&e.border),bottom:!!(16&e.border),left:!!(1&e.border)},style:{"--x":""+e.x,"--y":""+e.y}}))),this.labels.map((e=>t("div",{part:"label",style:{"--x":""+e.x,"--y":""+e.y},onPointerDown:()=>this.selectClue(e.clueId)},t("div",{class:"_inner"},e.text))))))}static get delegatesFocus(){return!0}static get watchers(){return{data:[{watchData:0}]}}static get style(){return'*[part=main]{position:relative;display:grid;grid-template-areas:"board" "clues";grid-template-columns:1fr}@media (min-width: 768px){*[part=main]{grid-template-areas:"clues board" "clues .";grid-template-columns:1fr 1fr}*[part=main].--only-board{grid-template-columns:1fr;grid-template-areas:"board"}}*[part=main].--focused{background:lightgrey}*[part=main] input.dummy{pointer-events:none;opacity:0.2;z-index:100;grid-area:board;border:none;outline:none}[part=clues]{grid-area:clues;display:grid;grid-template-columns:1fr 1fr;gap:16px}[part=clues].oneList{grid-template-columns:1fr}[part=clue-list]{margin:0;padding:0}[part=clue].--current{background:var(--clue-current-background, lightcyan);position:sticky;bottom:0;left:0;right:0}[part=clue] .preview{font-weight:bold;letter-spacing:0.2em;text-align:center;display:block;text-transform:uppercase}li[part=clue]{--_clue-padding:var(--clue-padding, .5em);border-radius:var(--clue-radius, 0.5em);padding:var(--_clue-padding);list-style-position:inside;padding-left:calc(1em + var(--_clue-padding));text-indent:-1em;margin:0}[part=board]{grid-area:board;display:block;position:relative;container-type:size;background:var(--board-background, darkgoldenrod);--_cell-border-width:var(--cell-border-width, 2px);--cell-width-temp:calc((100cqw - var(--_cell-border-width)) / var(--board-width, 10));--cell-width:var(--cell-width-temp);--cell-width:round(var(--cell-width-temp), 1px)}[part=cell]{display:block;color:var(--cell-color, #11138d);width:calc(var(--cell-width) - var(--_cell-border-width));aspect-ratio:1;background:var(--cell-background, #d9d9d9);position:absolute;container-type:size;top:calc(var(--y, 0) * var(--cell-width));left:calc(var(--x, 0) * var(--cell-width));border:var(--_cell-border-width) solid var(--cell-border-color, red)}[part=cell].--alt{background:var(--cell-background-alt, #999)}[part=cell].--in-current-clue{box-shadow:inset 0 0 2px 2px var(--cell-selected-background, lightblue)}[part=cell].--selected{background:var(--cell-selected-background, lightblue)}[part=cell].--special{background:var(--cell-special-background, lightgreen)}[part=cell].--special.--selected:before{content:"";background:var(--cell-selected-background, lightblue);position:absolute;top:0;left:0;right:0;bottom:0;clip-path:polygon(100% 0, 100% 100%, 50% 100%)}[part=cell] ._inner{position:absolute;top:0;left:0;right:0;bottom:0;display:grid;place-content:center;text-transform:uppercase;font-size:80cqh}[part=preview]{display:none}[part=special-border]{display:block;background:black;position:absolute;z-index:100;--s-border:max(2px, var(--_cell-border-width))}[part=special-border].left,[part=special-border].right{width:var(--s-border);height:calc(var(--cell-width) - var(--_cell-border-width));top:calc(var(--y, 0) * var(--cell-width) + var(--_cell-border-width))}[part=special-border].left{left:calc(var(--x, 0) * var(--cell-width) - var(--s-border) / 2)}[part=special-border].right{left:calc((var(--x, 0) + 1) * var(--cell-width) - var(--s-border) / 2)}[part=special-border].top,[part=special-border].bottom{width:calc(var(--cell-width) - var(--_cell-border-width));height:var(--s-border);left:calc(var(--x, 0) * var(--cell-width) + var(--_cell-border-width))}[part=special-border].top{top:calc(var(--y, 0) * var(--cell-width))}[part=special-border].bottom{top:calc((var(--y, 0) + 1) * var(--cell-width))}[part=label]{display:grid;position:absolute;container-type:size;top:calc(var(--y, 0) * var(--cell-width));left:calc(var(--x, 0) * var(--cell-width));width:calc(var(--cell-width) - var(--_cell-border-width));aspect-ratio:1;border:var(--_cell-border-width) solid transparent;--label-place-content:center end}[part=label] ._inner{position:absolute;top:var(--label-padding, 10cqh);left:var(--label-padding, 10cqh);right:var(--label-padding, 10cqh);bottom:var(--label-padding, 10cqh);display:grid;place-content:var(--label-place-content, center);text-transform:uppercase;font-size:var(--label-font-size, 60cqh)}'}},[529,"mb-crossword",{init:[4],data:[16],showCluePreview:[4,"show-clue-preview"],clueListStyle:[1,"clue-list-style"],hWords:[32],vWords:[32],currentClueId:[32],currentClue:[32],isFocused:[32],selectedCell:[32],specialBorders:[32],specialCells:[32],labels:[32],boardWidth:[32],boardHeight:[32],cells:[32],initGame:[64],checkAnswer:[64],selectClue:[64]},void 0,{data:[{watchData:0}]}]);function v(t){return new a(t.x+("horizontal"===t.orientation?t.word.length-1:0),t.y+("vertical"===t.orientation?t.word.length-1:0))}function b(){"undefined"!=typeof customElements&&["mb-crossword"].forEach((t=>{"mb-crossword"===t&&(customElements.get(e(t))||customElements.define(e(t),p))}))}b();const w=p,g=b;export{w as MbCrossword,g as defineCustomElement}
|
|
1
|
+
import{h as e,t,p as r,H as i,c as n,Vec2fromIndex as o,V as a,f as s,isInputEventLetter as c,indexFromXY as u}from"./index.js";function d({isCurrent:t,word:r,onPointerDown:i,preview:n,showPreview:o,tagName:a}){return e(a??"div",{role:"button",onPointerDown:i,part:"clue",class:{"--current":t}},r.clue,o&&e("span",{class:"preview"},n))}function l({data:t,isInCurrentClue:r,isSelected:i,isSpecial:n,onPointerDown:o}){return e("div",{onPointerDown:o,part:"cell",class:{"--blocked":t.isBlocked,"--in-current-clue":r,"--selected":i,"--alt":!((t.x+t.y)%2),"--special":n},style:{"--x":""+t.x,"--y":""+t.y}},e("div",{class:"_inner",style:{position:"absolute",width:"100%"}},t.value))}const h=({type:t},r)=>"p"===t?e("p",{part:"clue-list"},r.map(((t,r)=>e("p",{key:r},t)))):"ol"===t?e("ol",{part:"clue-list"},r):void 0;function f(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var b,p={exports:{}},v=f((b||(b=1,p.exports=function(e){var t={};function r(i){if(t[i])return t[i].exports;var n=t[i]={i,l:!1,exports:{}};return e[i].call(n.exports,n,n.exports,r),n.l=!0,n.exports}return r.m=e,r.c=t,r.d=function(e,t,i){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:i})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var i=Object.create(null);if(r.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var n in e)r.d(i,n,function(t){return e[t]}.bind(null,n));return i},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=90)}({17:function(e,t,r){t.__esModule=!0,t.default=void 0;var i=r(18),n=function(){function e(){}return e.getFirstMatch=function(e,t){var r=t.match(e);return r&&r.length>0&&r[1]||""},e.getSecondMatch=function(e,t){var r=t.match(e);return r&&r.length>1&&r[2]||""},e.matchAndReturnConst=function(e,t,r){if(e.test(t))return r},e.getWindowsVersionName=function(e){switch(e){case"NT":return"NT";case"XP":case"NT 5.1":return"XP";case"NT 5.0":return"2000";case"NT 5.2":return"2003";case"NT 6.0":return"Vista";case"NT 6.1":return"7";case"NT 6.2":return"8";case"NT 6.3":return"8.1";case"NT 10.0":return"10";default:return}},e.getMacOSVersionName=function(e){var t=e.split(".").splice(0,2).map((function(e){return parseInt(e,10)||0}));t.push(0);var r=t[0];if(10===r)switch(t[1]){case 5:return"Leopard";case 6:return"Snow Leopard";case 7:return"Lion";case 8:return"Mountain Lion";case 9:return"Mavericks";case 10:return"Yosemite";case 11:return"El Capitan";case 12:return"Sierra";case 13:return"High Sierra";case 14:return"Mojave";case 15:return"Catalina";default:return}switch(r){case 11:return"Big Sur";case 12:return"Monterey";case 13:return"Ventura";case 14:return"Sonoma";case 15:return"Sequoia";default:return}},e.getAndroidVersionName=function(e){var t=e.split(".").splice(0,2).map((function(e){return parseInt(e,10)||0}));if(t.push(0),!(1===t[0]&&t[1]<5))return 1===t[0]&&t[1]<6?"Cupcake":1===t[0]&&t[1]>=6?"Donut":2===t[0]&&t[1]<2?"Eclair":2===t[0]&&2===t[1]?"Froyo":2===t[0]&&t[1]>2?"Gingerbread":3===t[0]?"Honeycomb":4===t[0]&&t[1]<1?"Ice Cream Sandwich":4===t[0]&&t[1]<4?"Jelly Bean":4===t[0]&&t[1]>=4?"KitKat":5===t[0]?"Lollipop":6===t[0]?"Marshmallow":7===t[0]?"Nougat":8===t[0]?"Oreo":9===t[0]?"Pie":void 0},e.getVersionPrecision=function(e){return e.split(".").length},e.compareVersions=function(t,r,i){void 0===i&&(i=!1);var n=e.getVersionPrecision(t),o=e.getVersionPrecision(r),a=Math.max(n,o),s=0,c=e.map([t,r],(function(t){var r=a-e.getVersionPrecision(t),i=t+Array(r+1).join(".0");return e.map(i.split("."),(function(e){return Array(20-e.length).join("0")+e})).reverse()}));for(i&&(s=a-Math.min(n,o)),a-=1;a>=s;){if(c[0][a]>c[1][a])return 1;if(c[0][a]===c[1][a]){if(a===s)return 0;a-=1}else if(c[0][a]<c[1][a])return-1}},e.map=function(e,t){var r,i=[];if(Array.prototype.map)return Array.prototype.map.call(e,t);for(r=0;r<e.length;r+=1)i.push(t(e[r]));return i},e.find=function(e,t){var r,i;if(Array.prototype.find)return Array.prototype.find.call(e,t);for(r=0,i=e.length;r<i;r+=1){var n=e[r];if(t(n,r))return n}},e.assign=function(e){for(var t,r,i=e,n=arguments.length,o=Array(n>1?n-1:0),a=1;a<n;a++)o[a-1]=arguments[a];if(Object.assign)return Object.assign.apply(Object,[e].concat(o));var s=function(){var e=o[t];"object"==typeof e&&null!==e&&Object.keys(e).forEach((function(t){i[t]=e[t]}))};for(t=0,r=o.length;t<r;t+=1)s();return e},e.getBrowserAlias=function(e){return i.BROWSER_ALIASES_MAP[e]},e.getBrowserTypeByAlias=function(e){return i.BROWSER_MAP[e]||""},e}();t.default=n,e.exports=t.default},18:function(e,t){t.__esModule=!0,t.ENGINE_MAP=t.OS_MAP=t.PLATFORMS_MAP=t.BROWSER_MAP=t.BROWSER_ALIASES_MAP=void 0,t.BROWSER_ALIASES_MAP={AmazonBot:"amazonbot","Amazon Silk":"amazon_silk","Android Browser":"android",BaiduSpider:"baiduspider",Bada:"bada",BingCrawler:"bingcrawler",BlackBerry:"blackberry","ChatGPT-User":"chatgpt_user",Chrome:"chrome",ClaudeBot:"claudebot",Chromium:"chromium",Diffbot:"diffbot",DuckDuckBot:"duckduckbot",Electron:"electron",Epiphany:"epiphany",FacebookExternalHit:"facebookexternalhit",Firefox:"firefox",Focus:"focus",Generic:"generic","Google Search":"google_search",Googlebot:"googlebot",GPTBot:"gptbot","Internet Explorer":"ie",InternetArchiveCrawler:"internetarchivecrawler","K-Meleon":"k_meleon",LibreWolf:"librewolf",Maxthon:"maxthon","Meta-ExternalAds":"meta_externalads","Meta-ExternalAgent":"meta_externalagent","Meta-ExternalFetcher":"meta_externalfetcher","Meta-WebIndexer":"meta_webindexer","Microsoft Edge":"edge","MZ Browser":"mz","NAVER Whale Browser":"naver","OAI-SearchBot":"oai_searchbot",Omgilibot:"omgilibot",Opera:"opera","Opera Coast":"opera_coast","Pale Moon":"pale_moon",PerplexityBot:"perplexitybot","Perplexity-User":"perplexity_user",PhantomJS:"phantomjs",PingdomBot:"pingdombot",Puffin:"puffin",QQ:"qq",QQLite:"qqlite",QupZilla:"qupzilla",Roku:"roku",Safari:"safari",Sailfish:"sailfish","Samsung Internet for Android":"samsung_internet",SeaMonkey:"seamonkey",Sleipnir:"sleipnir","Sogou Browser":"sogou",Swing:"swing",Tizen:"tizen","UC Browser":"uc",Vivaldi:"vivaldi","WebOS Browser":"webos",WeChat:"wechat",YahooSlurp:"yahooslurp","Yandex Browser":"yandex",YandexBot:"yandexbot",YouBot:"youbot"},t.BROWSER_MAP={amazonbot:"AmazonBot",amazon_silk:"Amazon Silk",android:"Android Browser",baiduspider:"BaiduSpider",bada:"Bada",bingcrawler:"BingCrawler",blackberry:"BlackBerry",chatgpt_user:"ChatGPT-User",chrome:"Chrome",claudebot:"ClaudeBot",chromium:"Chromium",diffbot:"Diffbot",duckduckbot:"DuckDuckBot",edge:"Microsoft Edge",electron:"Electron",epiphany:"Epiphany",facebookexternalhit:"FacebookExternalHit",firefox:"Firefox",focus:"Focus",generic:"Generic",google_search:"Google Search",googlebot:"Googlebot",gptbot:"GPTBot",ie:"Internet Explorer",internetarchivecrawler:"InternetArchiveCrawler",k_meleon:"K-Meleon",librewolf:"LibreWolf",maxthon:"Maxthon",meta_externalads:"Meta-ExternalAds",meta_externalagent:"Meta-ExternalAgent",meta_externalfetcher:"Meta-ExternalFetcher",meta_webindexer:"Meta-WebIndexer",mz:"MZ Browser",naver:"NAVER Whale Browser",oai_searchbot:"OAI-SearchBot",omgilibot:"Omgilibot",opera:"Opera",opera_coast:"Opera Coast",pale_moon:"Pale Moon",perplexitybot:"PerplexityBot",perplexity_user:"Perplexity-User",phantomjs:"PhantomJS",pingdombot:"PingdomBot",puffin:"Puffin",qq:"QQ Browser",qqlite:"QQ Browser Lite",qupzilla:"QupZilla",roku:"Roku",safari:"Safari",sailfish:"Sailfish",samsung_internet:"Samsung Internet for Android",seamonkey:"SeaMonkey",sleipnir:"Sleipnir",sogou:"Sogou Browser",swing:"Swing",tizen:"Tizen",uc:"UC Browser",vivaldi:"Vivaldi",webos:"WebOS Browser",wechat:"WeChat",yahooslurp:"YahooSlurp",yandex:"Yandex Browser",yandexbot:"YandexBot",youbot:"YouBot"},t.PLATFORMS_MAP={bot:"bot",desktop:"desktop",mobile:"mobile",tablet:"tablet",tv:"tv"},t.OS_MAP={Android:"Android",Bada:"Bada",BlackBerry:"BlackBerry",ChromeOS:"Chrome OS",HarmonyOS:"HarmonyOS",iOS:"iOS",Linux:"Linux",MacOS:"macOS",PlayStation4:"PlayStation 4",Roku:"Roku",Tizen:"Tizen",WebOS:"WebOS",Windows:"Windows",WindowsPhone:"Windows Phone"},t.ENGINE_MAP={Blink:"Blink",EdgeHTML:"EdgeHTML",Gecko:"Gecko",Presto:"Presto",Trident:"Trident",WebKit:"WebKit"}},90:function(e,t,r){t.__esModule=!0,t.default=void 0;var i,n=(i=r(91))&&i.__esModule?i:{default:i},o=r(18);function a(e,t){for(var r=0;r<t.length;r++){var i=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}var s=function(){function e(){}var t,r;return e.getParser=function(e,t){if(void 0===t&&(t=!1),"string"!=typeof e)throw Error("UserAgent should be a string");return new n.default(e,t)},e.parse=function(e){return new n.default(e).getResult()},t=e,r=[{key:"BROWSER_MAP",get:function(){return o.BROWSER_MAP}},{key:"ENGINE_MAP",get:function(){return o.ENGINE_MAP}},{key:"OS_MAP",get:function(){return o.OS_MAP}},{key:"PLATFORMS_MAP",get:function(){return o.PLATFORMS_MAP}}],null&&a(t.prototype,null),r&&a(t,r),e}();t.default=s,e.exports=t.default},91:function(e,t,r){t.__esModule=!0,t.default=void 0;var i=c(r(92)),n=c(r(93)),o=c(r(94)),a=c(r(95)),s=c(r(17));function c(e){return e&&e.__esModule?e:{default:e}}var u=function(){function e(e,t){if(void 0===t&&(t=!1),null==e||""===e)throw Error("UserAgent parameter can't be empty");this._ua=e,this.parsedResult={},!0!==t&&this.parse()}var t=e.prototype;return t.getUA=function(){return this._ua},t.test=function(e){return e.test(this._ua)},t.parseBrowser=function(){var e=this;this.parsedResult.browser={};var t=s.default.find(i.default,(function(t){if("function"==typeof t.test)return t.test(e);if(Array.isArray(t.test))return t.test.some((function(t){return e.test(t)}));throw Error("Browser's test function is not valid")}));return t&&(this.parsedResult.browser=t.describe(this.getUA())),this.parsedResult.browser},t.getBrowser=function(){return this.parsedResult.browser?this.parsedResult.browser:this.parseBrowser()},t.getBrowserName=function(e){return e?(this.getBrowser().name+"").toLowerCase()||"":this.getBrowser().name||""},t.getBrowserVersion=function(){return this.getBrowser().version},t.getOS=function(){return this.parsedResult.os?this.parsedResult.os:this.parseOS()},t.parseOS=function(){var e=this;this.parsedResult.os={};var t=s.default.find(n.default,(function(t){if("function"==typeof t.test)return t.test(e);if(Array.isArray(t.test))return t.test.some((function(t){return e.test(t)}));throw Error("Browser's test function is not valid")}));return t&&(this.parsedResult.os=t.describe(this.getUA())),this.parsedResult.os},t.getOSName=function(e){var t=this.getOS().name;return e?(t+"").toLowerCase()||"":t||""},t.getOSVersion=function(){return this.getOS().version},t.getPlatform=function(){return this.parsedResult.platform?this.parsedResult.platform:this.parsePlatform()},t.getPlatformType=function(e){void 0===e&&(e=!1);var t=this.getPlatform().type;return e?(t+"").toLowerCase()||"":t||""},t.parsePlatform=function(){var e=this;this.parsedResult.platform={};var t=s.default.find(o.default,(function(t){if("function"==typeof t.test)return t.test(e);if(Array.isArray(t.test))return t.test.some((function(t){return e.test(t)}));throw Error("Browser's test function is not valid")}));return t&&(this.parsedResult.platform=t.describe(this.getUA())),this.parsedResult.platform},t.getEngine=function(){return this.parsedResult.engine?this.parsedResult.engine:this.parseEngine()},t.getEngineName=function(e){return e?(this.getEngine().name+"").toLowerCase()||"":this.getEngine().name||""},t.parseEngine=function(){var e=this;this.parsedResult.engine={};var t=s.default.find(a.default,(function(t){if("function"==typeof t.test)return t.test(e);if(Array.isArray(t.test))return t.test.some((function(t){return e.test(t)}));throw Error("Browser's test function is not valid")}));return t&&(this.parsedResult.engine=t.describe(this.getUA())),this.parsedResult.engine},t.parse=function(){return this.parseBrowser(),this.parseOS(),this.parsePlatform(),this.parseEngine(),this},t.getResult=function(){return s.default.assign({},this.parsedResult)},t.satisfies=function(e){var t=this,r={},i=0,n={},o=0;if(Object.keys(e).forEach((function(t){var a=e[t];"string"==typeof a?(n[t]=a,o+=1):"object"==typeof a&&(r[t]=a,i+=1)})),i>0){var a=Object.keys(r),c=s.default.find(a,(function(e){return t.isOS(e)}));if(c){var u=this.satisfies(r[c]);if(void 0!==u)return u}var d=s.default.find(a,(function(e){return t.isPlatform(e)}));if(d){var l=this.satisfies(r[d]);if(void 0!==l)return l}}if(o>0){var h=s.default.find(Object.keys(n),(function(e){return t.isBrowser(e,!0)}));if(void 0!==h)return this.compareVersion(n[h])}},t.isBrowser=function(e,t){void 0===t&&(t=!1);var r=this.getBrowserName().toLowerCase(),i=e.toLowerCase(),n=s.default.getBrowserTypeByAlias(i);return t&&n&&(i=n.toLowerCase()),i===r},t.compareVersion=function(e){var t=[0],r=e,i=!1,n=this.getBrowserVersion();if("string"==typeof n)return">"===e[0]||"<"===e[0]?(r=e.substr(1),"="===e[1]?(i=!0,r=e.substr(2)):t=[],t.push(">"===e[0]?1:-1)):"="===e[0]?r=e.substr(1):"~"===e[0]&&(i=!0,r=e.substr(1)),t.indexOf(s.default.compareVersions(n,r,i))>-1},t.isOS=function(e){return this.getOSName(!0)===(e+"").toLowerCase()},t.isPlatform=function(e){return this.getPlatformType(!0)===(e+"").toLowerCase()},t.isEngine=function(e){return this.getEngineName(!0)===(e+"").toLowerCase()},t.is=function(e,t){return void 0===t&&(t=!1),this.isBrowser(e,t)||this.isOS(e)||this.isPlatform(e)},t.some=function(e){var t=this;return void 0===e&&(e=[]),e.some((function(e){return t.is(e)}))},e}();t.default=u,e.exports=t.default},92:function(e,t,r){t.__esModule=!0,t.default=void 0;var i,n=(i=r(17))&&i.__esModule?i:{default:i},o=/version\/(\d+(\.?_?\d+)+)/i,a=[{test:[/gptbot/i],describe:function(e){var t={name:"GPTBot"},r=n.default.getFirstMatch(/gptbot\/(\d+(\.\d+)+)/i,e)||n.default.getFirstMatch(o,e);return r&&(t.version=r),t}},{test:[/chatgpt-user/i],describe:function(e){var t={name:"ChatGPT-User"},r=n.default.getFirstMatch(/chatgpt-user\/(\d+(\.\d+)+)/i,e)||n.default.getFirstMatch(o,e);return r&&(t.version=r),t}},{test:[/oai-searchbot/i],describe:function(e){var t={name:"OAI-SearchBot"},r=n.default.getFirstMatch(/oai-searchbot\/(\d+(\.\d+)+)/i,e)||n.default.getFirstMatch(o,e);return r&&(t.version=r),t}},{test:[/claudebot/i,/claude-web/i,/claude-user/i,/claude-searchbot/i],describe:function(e){var t={name:"ClaudeBot"},r=n.default.getFirstMatch(/(?:claudebot|claude-web|claude-user|claude-searchbot)\/(\d+(\.\d+)+)/i,e)||n.default.getFirstMatch(o,e);return r&&(t.version=r),t}},{test:[/omgilibot/i,/webzio-extended/i],describe:function(e){var t={name:"Omgilibot"},r=n.default.getFirstMatch(/(?:omgilibot|webzio-extended)\/(\d+(\.\d+)+)/i,e)||n.default.getFirstMatch(o,e);return r&&(t.version=r),t}},{test:[/diffbot/i],describe:function(e){var t={name:"Diffbot"},r=n.default.getFirstMatch(/diffbot\/(\d+(\.\d+)+)/i,e)||n.default.getFirstMatch(o,e);return r&&(t.version=r),t}},{test:[/perplexitybot/i],describe:function(e){var t={name:"PerplexityBot"},r=n.default.getFirstMatch(/perplexitybot\/(\d+(\.\d+)+)/i,e)||n.default.getFirstMatch(o,e);return r&&(t.version=r),t}},{test:[/perplexity-user/i],describe:function(e){var t={name:"Perplexity-User"},r=n.default.getFirstMatch(/perplexity-user\/(\d+(\.\d+)+)/i,e)||n.default.getFirstMatch(o,e);return r&&(t.version=r),t}},{test:[/youbot/i],describe:function(e){var t={name:"YouBot"},r=n.default.getFirstMatch(/youbot\/(\d+(\.\d+)+)/i,e)||n.default.getFirstMatch(o,e);return r&&(t.version=r),t}},{test:[/meta-webindexer/i],describe:function(e){var t={name:"Meta-WebIndexer"},r=n.default.getFirstMatch(/meta-webindexer\/(\d+(\.\d+)+)/i,e)||n.default.getFirstMatch(o,e);return r&&(t.version=r),t}},{test:[/meta-externalads/i],describe:function(e){var t={name:"Meta-ExternalAds"},r=n.default.getFirstMatch(/meta-externalads\/(\d+(\.\d+)+)/i,e)||n.default.getFirstMatch(o,e);return r&&(t.version=r),t}},{test:[/meta-externalagent/i],describe:function(e){var t={name:"Meta-ExternalAgent"},r=n.default.getFirstMatch(/meta-externalagent\/(\d+(\.\d+)+)/i,e)||n.default.getFirstMatch(o,e);return r&&(t.version=r),t}},{test:[/meta-externalfetcher/i],describe:function(e){var t={name:"Meta-ExternalFetcher"},r=n.default.getFirstMatch(/meta-externalfetcher\/(\d+(\.\d+)+)/i,e)||n.default.getFirstMatch(o,e);return r&&(t.version=r),t}},{test:[/googlebot/i],describe:function(e){var t={name:"Googlebot"},r=n.default.getFirstMatch(/googlebot\/(\d+(\.\d+))/i,e)||n.default.getFirstMatch(o,e);return r&&(t.version=r),t}},{test:[/amazonbot/i],describe:function(e){var t={name:"AmazonBot"},r=n.default.getFirstMatch(/amazonbot\/(\d+(\.\d+)+)/i,e)||n.default.getFirstMatch(o,e);return r&&(t.version=r),t}},{test:[/bingbot/i],describe:function(e){var t={name:"BingCrawler"},r=n.default.getFirstMatch(/bingbot\/(\d+(\.\d+)+)/i,e)||n.default.getFirstMatch(o,e);return r&&(t.version=r),t}},{test:[/baiduspider/i],describe:function(e){var t={name:"BaiduSpider"},r=n.default.getFirstMatch(/baiduspider\/(\d+(\.\d+)+)/i,e)||n.default.getFirstMatch(o,e);return r&&(t.version=r),t}},{test:[/duckduckbot/i],describe:function(e){var t={name:"DuckDuckBot"},r=n.default.getFirstMatch(/duckduckbot\/(\d+(\.\d+)+)/i,e)||n.default.getFirstMatch(o,e);return r&&(t.version=r),t}},{test:[/ia_archiver/i],describe:function(e){var t={name:"InternetArchiveCrawler"},r=n.default.getFirstMatch(/ia_archiver\/(\d+(\.\d+)+)/i,e)||n.default.getFirstMatch(o,e);return r&&(t.version=r),t}},{test:[/facebookexternalhit/i,/facebookcatalog/i],describe:function(){return{name:"FacebookExternalHit"}}},{test:[/yahoo!?[\s/]*slurp/i],describe:function(){return{name:"YahooSlurp"}}},{test:[/yandexbot/i,/yandexmobilebot/i],describe:function(){return{name:"YandexBot"}}},{test:[/pingdom/i],describe:function(){return{name:"PingdomBot"}}},{test:[/opera/i],describe:function(e){var t={name:"Opera"},r=n.default.getFirstMatch(o,e)||n.default.getFirstMatch(/(?:opera)[\s/](\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/opr\/|opios/i],describe:function(e){var t={name:"Opera"},r=n.default.getFirstMatch(/(?:opr|opios)[\s/](\S+)/i,e)||n.default.getFirstMatch(o,e);return r&&(t.version=r),t}},{test:[/SamsungBrowser/i],describe:function(e){var t={name:"Samsung Internet for Android"},r=n.default.getFirstMatch(o,e)||n.default.getFirstMatch(/(?:SamsungBrowser)[\s/](\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/Whale/i],describe:function(e){var t={name:"NAVER Whale Browser"},r=n.default.getFirstMatch(o,e)||n.default.getFirstMatch(/(?:whale)[\s/](\d+(?:\.\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/PaleMoon/i],describe:function(e){var t={name:"Pale Moon"},r=n.default.getFirstMatch(o,e)||n.default.getFirstMatch(/(?:PaleMoon)[\s/](\d+(?:\.\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/MZBrowser/i],describe:function(e){var t={name:"MZ Browser"},r=n.default.getFirstMatch(/(?:MZBrowser)[\s/](\d+(?:\.\d+)+)/i,e)||n.default.getFirstMatch(o,e);return r&&(t.version=r),t}},{test:[/focus/i],describe:function(e){var t={name:"Focus"},r=n.default.getFirstMatch(/(?:focus)[\s/](\d+(?:\.\d+)+)/i,e)||n.default.getFirstMatch(o,e);return r&&(t.version=r),t}},{test:[/swing/i],describe:function(e){var t={name:"Swing"},r=n.default.getFirstMatch(/(?:swing)[\s/](\d+(?:\.\d+)+)/i,e)||n.default.getFirstMatch(o,e);return r&&(t.version=r),t}},{test:[/coast/i],describe:function(e){var t={name:"Opera Coast"},r=n.default.getFirstMatch(o,e)||n.default.getFirstMatch(/(?:coast)[\s/](\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/opt\/\d+(?:.?_?\d+)+/i],describe:function(e){var t={name:"Opera Touch"},r=n.default.getFirstMatch(/(?:opt)[\s/](\d+(\.?_?\d+)+)/i,e)||n.default.getFirstMatch(o,e);return r&&(t.version=r),t}},{test:[/yabrowser/i],describe:function(e){var t={name:"Yandex Browser"},r=n.default.getFirstMatch(/(?:yabrowser)[\s/](\d+(\.?_?\d+)+)/i,e)||n.default.getFirstMatch(o,e);return r&&(t.version=r),t}},{test:[/ucbrowser/i],describe:function(e){var t={name:"UC Browser"},r=n.default.getFirstMatch(o,e)||n.default.getFirstMatch(/(?:ucbrowser)[\s/](\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/Maxthon|mxios/i],describe:function(e){var t={name:"Maxthon"},r=n.default.getFirstMatch(o,e)||n.default.getFirstMatch(/(?:Maxthon|mxios)[\s/](\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/epiphany/i],describe:function(e){var t={name:"Epiphany"},r=n.default.getFirstMatch(o,e)||n.default.getFirstMatch(/(?:epiphany)[\s/](\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/puffin/i],describe:function(e){var t={name:"Puffin"},r=n.default.getFirstMatch(o,e)||n.default.getFirstMatch(/(?:puffin)[\s/](\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/sleipnir/i],describe:function(e){var t={name:"Sleipnir"},r=n.default.getFirstMatch(o,e)||n.default.getFirstMatch(/(?:sleipnir)[\s/](\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/k-meleon/i],describe:function(e){var t={name:"K-Meleon"},r=n.default.getFirstMatch(o,e)||n.default.getFirstMatch(/(?:k-meleon)[\s/](\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/micromessenger/i],describe:function(e){var t={name:"WeChat"},r=n.default.getFirstMatch(/(?:micromessenger)[\s/](\d+(\.?_?\d+)+)/i,e)||n.default.getFirstMatch(o,e);return r&&(t.version=r),t}},{test:[/qqbrowser/i],describe:function(e){var t={name:/qqbrowserlite/i.test(e)?"QQ Browser Lite":"QQ Browser"},r=n.default.getFirstMatch(/(?:qqbrowserlite|qqbrowser)[/](\d+(\.?_?\d+)+)/i,e)||n.default.getFirstMatch(o,e);return r&&(t.version=r),t}},{test:[/msie|trident/i],describe:function(e){var t={name:"Internet Explorer"},r=n.default.getFirstMatch(/(?:msie |rv:)(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/\sedg\//i],describe:function(e){var t={name:"Microsoft Edge"},r=n.default.getFirstMatch(/\sedg\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/edg([ea]|ios)/i],describe:function(e){var t={name:"Microsoft Edge"},r=n.default.getSecondMatch(/edg([ea]|ios)\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/vivaldi/i],describe:function(e){var t={name:"Vivaldi"},r=n.default.getFirstMatch(/vivaldi\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/seamonkey/i],describe:function(e){var t={name:"SeaMonkey"},r=n.default.getFirstMatch(/seamonkey\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/sailfish/i],describe:function(e){var t={name:"Sailfish"},r=n.default.getFirstMatch(/sailfish\s?browser\/(\d+(\.\d+)?)/i,e);return r&&(t.version=r),t}},{test:[/silk/i],describe:function(e){var t={name:"Amazon Silk"},r=n.default.getFirstMatch(/silk\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/phantom/i],describe:function(e){var t={name:"PhantomJS"},r=n.default.getFirstMatch(/phantomjs\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/slimerjs/i],describe:function(e){var t={name:"SlimerJS"},r=n.default.getFirstMatch(/slimerjs\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/blackberry|\bbb\d+/i,/rim\stablet/i],describe:function(e){var t={name:"BlackBerry"},r=n.default.getFirstMatch(o,e)||n.default.getFirstMatch(/blackberry[\d]+\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/(web|hpw)[o0]s/i],describe:function(e){var t={name:"WebOS Browser"},r=n.default.getFirstMatch(o,e)||n.default.getFirstMatch(/w(?:eb)?[o0]sbrowser\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/bada/i],describe:function(e){var t={name:"Bada"},r=n.default.getFirstMatch(/dolfin\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/tizen/i],describe:function(e){var t={name:"Tizen"},r=n.default.getFirstMatch(/(?:tizen\s?)?browser\/(\d+(\.?_?\d+)+)/i,e)||n.default.getFirstMatch(o,e);return r&&(t.version=r),t}},{test:[/qupzilla/i],describe:function(e){var t={name:"QupZilla"},r=n.default.getFirstMatch(/(?:qupzilla)[\s/](\d+(\.?_?\d+)+)/i,e)||n.default.getFirstMatch(o,e);return r&&(t.version=r),t}},{test:[/librewolf/i],describe:function(e){var t={name:"LibreWolf"},r=n.default.getFirstMatch(/(?:librewolf)[\s/](\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/firefox|iceweasel|fxios/i],describe:function(e){var t={name:"Firefox"},r=n.default.getFirstMatch(/(?:firefox|iceweasel|fxios)[\s/](\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/electron/i],describe:function(e){var t={name:"Electron"},r=n.default.getFirstMatch(/(?:electron)\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/sogoumobilebrowser/i,/metasr/i,/se 2\.[x]/i],describe:function(e){var t={name:"Sogou Browser"},r=n.default.getFirstMatch(/(?:sogoumobilebrowser)[\s/](\d+(\.?_?\d+)+)/i,e),i=n.default.getFirstMatch(/(?:chrome|crios|crmo)\/(\d+(\.?_?\d+)+)/i,e),o=n.default.getFirstMatch(/se ([\d.]+)x/i,e),a=r||i||o;return a&&(t.version=a),t}},{test:[/MiuiBrowser/i],describe:function(e){var t={name:"Miui"},r=n.default.getFirstMatch(/(?:MiuiBrowser)[\s/](\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/chromium/i],describe:function(e){var t={name:"Chromium"},r=n.default.getFirstMatch(/(?:chromium)[\s/](\d+(\.?_?\d+)+)/i,e)||n.default.getFirstMatch(o,e);return r&&(t.version=r),t}},{test:[/chrome|crios|crmo/i],describe:function(e){var t={name:"Chrome"},r=n.default.getFirstMatch(/(?:chrome|crios|crmo)\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/GSA/i],describe:function(e){var t={name:"Google Search"},r=n.default.getFirstMatch(/(?:GSA)\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:function(e){var t=!e.test(/like android/i),r=e.test(/android/i);return t&&r},describe:function(e){var t={name:"Android Browser"},r=n.default.getFirstMatch(o,e);return r&&(t.version=r),t}},{test:[/playstation 4/i],describe:function(e){var t={name:"PlayStation 4"},r=n.default.getFirstMatch(o,e);return r&&(t.version=r),t}},{test:[/safari|applewebkit/i],describe:function(e){var t={name:"Safari"},r=n.default.getFirstMatch(o,e);return r&&(t.version=r),t}},{test:[/.*/i],describe:function(e){var t=-1!==e.search("\\(")?/^(.*)\/(.*)[ \t]\((.*)/:/^(.*)\/(.*) /;return{name:n.default.getFirstMatch(t,e),version:n.default.getSecondMatch(t,e)}}}];t.default=a,e.exports=t.default},93:function(e,t,r){t.__esModule=!0,t.default=void 0;var i,n=(i=r(17))&&i.__esModule?i:{default:i},o=r(18),a=[{test:[/Roku\/DVP/],describe:function(e){var t=n.default.getFirstMatch(/Roku\/DVP-(\d+\.\d+)/i,e);return{name:o.OS_MAP.Roku,version:t}}},{test:[/windows phone/i],describe:function(e){var t=n.default.getFirstMatch(/windows phone (?:os)?\s?(\d+(\.\d+)*)/i,e);return{name:o.OS_MAP.WindowsPhone,version:t}}},{test:[/windows /i],describe:function(e){var t=n.default.getFirstMatch(/Windows ((NT|XP)( \d\d?.\d)?)/i,e),r=n.default.getWindowsVersionName(t);return{name:o.OS_MAP.Windows,version:t,versionName:r}}},{test:[/Macintosh(.*?) FxiOS(.*?)\//],describe:function(e){var t={name:o.OS_MAP.iOS},r=n.default.getSecondMatch(/(Version\/)(\d[\d.]+)/,e);return r&&(t.version=r),t}},{test:[/macintosh/i],describe:function(e){var t=n.default.getFirstMatch(/mac os x (\d+(\.?_?\d+)+)/i,e).replace(/[_\s]/g,"."),r=n.default.getMacOSVersionName(t),i={name:o.OS_MAP.MacOS,version:t};return r&&(i.versionName=r),i}},{test:[/(ipod|iphone|ipad)/i],describe:function(e){var t=n.default.getFirstMatch(/os (\d+([_\s]\d+)*) like mac os x/i,e).replace(/[_\s]/g,".");return{name:o.OS_MAP.iOS,version:t}}},{test:[/OpenHarmony/i],describe:function(e){var t=n.default.getFirstMatch(/OpenHarmony\s+(\d+(\.\d+)*)/i,e);return{name:o.OS_MAP.HarmonyOS,version:t}}},{test:function(e){var t=!e.test(/like android/i),r=e.test(/android/i);return t&&r},describe:function(e){var t=n.default.getFirstMatch(/android[\s/-](\d+(\.\d+)*)/i,e),r=n.default.getAndroidVersionName(t),i={name:o.OS_MAP.Android,version:t};return r&&(i.versionName=r),i}},{test:[/(web|hpw)[o0]s/i],describe:function(e){var t=n.default.getFirstMatch(/(?:web|hpw)[o0]s\/(\d+(\.\d+)*)/i,e),r={name:o.OS_MAP.WebOS};return t&&t.length&&(r.version=t),r}},{test:[/blackberry|\bbb\d+/i,/rim\stablet/i],describe:function(e){var t=n.default.getFirstMatch(/rim\stablet\sos\s(\d+(\.\d+)*)/i,e)||n.default.getFirstMatch(/blackberry\d+\/(\d+([_\s]\d+)*)/i,e)||n.default.getFirstMatch(/\bbb(\d+)/i,e);return{name:o.OS_MAP.BlackBerry,version:t}}},{test:[/bada/i],describe:function(e){var t=n.default.getFirstMatch(/bada\/(\d+(\.\d+)*)/i,e);return{name:o.OS_MAP.Bada,version:t}}},{test:[/tizen/i],describe:function(e){var t=n.default.getFirstMatch(/tizen[/\s](\d+(\.\d+)*)/i,e);return{name:o.OS_MAP.Tizen,version:t}}},{test:[/linux/i],describe:function(){return{name:o.OS_MAP.Linux}}},{test:[/CrOS/],describe:function(){return{name:o.OS_MAP.ChromeOS}}},{test:[/PlayStation 4/],describe:function(e){var t=n.default.getFirstMatch(/PlayStation 4[/\s](\d+(\.\d+)*)/i,e);return{name:o.OS_MAP.PlayStation4,version:t}}}];t.default=a,e.exports=t.default},94:function(e,t,r){t.__esModule=!0,t.default=void 0;var i,n=(i=r(17))&&i.__esModule?i:{default:i},o=r(18),a=[{test:[/googlebot/i],describe:function(){return{type:o.PLATFORMS_MAP.bot,vendor:"Google"}}},{test:[/amazonbot/i],describe:function(){return{type:o.PLATFORMS_MAP.bot,vendor:"Amazon"}}},{test:[/gptbot/i],describe:function(){return{type:o.PLATFORMS_MAP.bot,vendor:"OpenAI"}}},{test:[/chatgpt-user/i],describe:function(){return{type:o.PLATFORMS_MAP.bot,vendor:"OpenAI"}}},{test:[/oai-searchbot/i],describe:function(){return{type:o.PLATFORMS_MAP.bot,vendor:"OpenAI"}}},{test:[/baiduspider/i],describe:function(){return{type:o.PLATFORMS_MAP.bot,vendor:"Baidu"}}},{test:[/bingbot/i],describe:function(){return{type:o.PLATFORMS_MAP.bot,vendor:"Bing"}}},{test:[/duckduckbot/i],describe:function(){return{type:o.PLATFORMS_MAP.bot,vendor:"DuckDuckGo"}}},{test:[/claudebot/i,/claude-web/i,/claude-user/i,/claude-searchbot/i],describe:function(){return{type:o.PLATFORMS_MAP.bot,vendor:"Anthropic"}}},{test:[/omgilibot/i,/webzio-extended/i],describe:function(){return{type:o.PLATFORMS_MAP.bot,vendor:"Webz.io"}}},{test:[/diffbot/i],describe:function(){return{type:o.PLATFORMS_MAP.bot,vendor:"Diffbot"}}},{test:[/perplexitybot/i],describe:function(){return{type:o.PLATFORMS_MAP.bot,vendor:"Perplexity AI"}}},{test:[/perplexity-user/i],describe:function(){return{type:o.PLATFORMS_MAP.bot,vendor:"Perplexity AI"}}},{test:[/youbot/i],describe:function(){return{type:o.PLATFORMS_MAP.bot,vendor:"You.com"}}},{test:[/ia_archiver/i],describe:function(){return{type:o.PLATFORMS_MAP.bot,vendor:"Internet Archive"}}},{test:[/meta-webindexer/i],describe:function(){return{type:o.PLATFORMS_MAP.bot,vendor:"Meta"}}},{test:[/meta-externalads/i],describe:function(){return{type:o.PLATFORMS_MAP.bot,vendor:"Meta"}}},{test:[/meta-externalagent/i],describe:function(){return{type:o.PLATFORMS_MAP.bot,vendor:"Meta"}}},{test:[/meta-externalfetcher/i],describe:function(){return{type:o.PLATFORMS_MAP.bot,vendor:"Meta"}}},{test:[/facebookexternalhit/i,/facebookcatalog/i],describe:function(){return{type:o.PLATFORMS_MAP.bot,vendor:"Meta"}}},{test:[/yahoo/i],describe:function(){return{type:o.PLATFORMS_MAP.bot,vendor:"Yahoo"}}},{test:[/yandexbot/i,/yandexmobilebot/i],describe:function(){return{type:o.PLATFORMS_MAP.bot,vendor:"Yandex"}}},{test:[/pingdom/i],describe:function(){return{type:o.PLATFORMS_MAP.bot,vendor:"Pingdom"}}},{test:[/huawei/i],describe:function(e){var t=n.default.getFirstMatch(/(can-l01)/i,e)&&"Nova",r={type:o.PLATFORMS_MAP.mobile,vendor:"Huawei"};return t&&(r.model=t),r}},{test:[/nexus\s*(?:7|8|9|10).*/i],describe:function(){return{type:o.PLATFORMS_MAP.tablet,vendor:"Nexus"}}},{test:[/ipad/i],describe:function(){return{type:o.PLATFORMS_MAP.tablet,vendor:"Apple",model:"iPad"}}},{test:[/Macintosh(.*?) FxiOS(.*?)\//],describe:function(){return{type:o.PLATFORMS_MAP.tablet,vendor:"Apple",model:"iPad"}}},{test:[/kftt build/i],describe:function(){return{type:o.PLATFORMS_MAP.tablet,vendor:"Amazon",model:"Kindle Fire HD 7"}}},{test:[/silk/i],describe:function(){return{type:o.PLATFORMS_MAP.tablet,vendor:"Amazon"}}},{test:[/tablet(?! pc)/i],describe:function(){return{type:o.PLATFORMS_MAP.tablet}}},{test:function(e){var t=e.test(/ipod|iphone/i),r=e.test(/like (ipod|iphone)/i);return t&&!r},describe:function(e){var t=n.default.getFirstMatch(/(ipod|iphone)/i,e);return{type:o.PLATFORMS_MAP.mobile,vendor:"Apple",model:t}}},{test:[/nexus\s*[0-6].*/i,/galaxy nexus/i],describe:function(){return{type:o.PLATFORMS_MAP.mobile,vendor:"Nexus"}}},{test:[/Nokia/i],describe:function(e){var t=n.default.getFirstMatch(/Nokia\s+([0-9]+(\.[0-9]+)?)/i,e),r={type:o.PLATFORMS_MAP.mobile,vendor:"Nokia"};return t&&(r.model=t),r}},{test:[/[^-]mobi/i],describe:function(){return{type:o.PLATFORMS_MAP.mobile}}},{test:function(e){return"blackberry"===e.getBrowserName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.mobile,vendor:"BlackBerry"}}},{test:function(e){return"bada"===e.getBrowserName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.mobile}}},{test:function(e){return"windows phone"===e.getBrowserName()},describe:function(){return{type:o.PLATFORMS_MAP.mobile,vendor:"Microsoft"}}},{test:function(e){var t=Number((e.getOSVersion()+"").split(".")[0]);return"android"===e.getOSName(!0)&&t>=3},describe:function(){return{type:o.PLATFORMS_MAP.tablet}}},{test:function(e){return"android"===e.getOSName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.mobile}}},{test:function(e){return"macos"===e.getOSName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.desktop,vendor:"Apple"}}},{test:function(e){return"windows"===e.getOSName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.desktop}}},{test:function(e){return"linux"===e.getOSName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.desktop}}},{test:function(e){return"playstation 4"===e.getOSName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.tv}}},{test:function(e){return"roku"===e.getOSName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.tv}}}];t.default=a,e.exports=t.default},95:function(e,t,r){t.__esModule=!0,t.default=void 0;var i,n=(i=r(17))&&i.__esModule?i:{default:i},o=r(18),a=[{test:function(e){return"microsoft edge"===e.getBrowserName(!0)},describe:function(e){if(/\sedg\//i.test(e))return{name:o.ENGINE_MAP.Blink};var t=n.default.getFirstMatch(/edge\/(\d+(\.?_?\d+)+)/i,e);return{name:o.ENGINE_MAP.EdgeHTML,version:t}}},{test:[/trident/i],describe:function(e){var t={name:o.ENGINE_MAP.Trident},r=n.default.getFirstMatch(/trident\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:function(e){return e.test(/presto/i)},describe:function(e){var t={name:o.ENGINE_MAP.Presto},r=n.default.getFirstMatch(/presto\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:function(e){var t=e.test(/gecko/i),r=e.test(/like gecko/i);return t&&!r},describe:function(e){var t={name:o.ENGINE_MAP.Gecko},r=n.default.getFirstMatch(/gecko\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/(apple)?webkit\/537\.36/i],describe:function(){return{name:o.ENGINE_MAP.Blink}}},{test:[/(apple)?webkit/i],describe:function(e){var t={name:o.ENGINE_MAP.WebKit},r=n.default.getFirstMatch(/webkit\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}}];t.default=a,e.exports=t.default}})),p.exports));const m=r(class extends i{constructor(e){super(),!1!==e&&this.__registerHost(),this.__attachShadow(),this.clueSelected=n(this,"clueSelected")}init=!0;data;showCluePreview=!0;clueListStyle="ol";clueSelected;textInput;hWords=[];vWords=[];currentClueId=null;currentClue=null;isFocused=!1;selectedCell=null;bowserParser=v.getParser("undefined"!=typeof window?window.navigator.userAgent:"unknown");abortController=new AbortController;componentWillLoad(){this.init&&this.data&&this.initGame(),this.useStickyBottomHack&&"undefined"!=typeof window&&(window.visualViewport.addEventListener("resize",this.updateFloatingPreview.bind(this),{signal:this.abortController.signal}),window.visualViewport.addEventListener("scroll",this.updateFloatingPreview.bind(this),{signal:this.abortController.signal}),this.updateFloatingPreview())}disconnectedCallback(){this.abortController.abort()}watchData(){this.init&&this.data&&this.initGame()}get allWords(){return[...this.hWords,...this.vWords]}async initGame(e=this.data){if(!e.words)throw Error("Words definition missing");this.hWords=[],this.vWords=[],e.words.forEach(((e,t)=>{const r=Math.random();void 0===e.id&&(e.id=`${r}_${t}`),"horizontal"===e.orientation&&(this.hWords=[...this.hWords,e]),"vertical"===e.orientation&&(this.vWords=[...this.vWords,e])})),this.specialBorders=e.specialBorders??[],this.specialCells=e.specialCells??[],this.labels=e.labels??[],this.buildBoard()}async checkAnswer(){return this.cells.filter((e=>!e.isBlocked)).every((e=>e.value===e.answer))}specialBorders=[];specialCells=[];labels=[];boardWidth=0;boardHeight=0;cells=[];useStickyBottomHack=this.bowserParser.isOS("ios");floatingPreviewHackParams={height:0,offsetTop:0};updateFloatingPreview(e){this.floatingPreviewHackParams={...this.floatingPreviewHackParams,height:window.visualViewport.height,offsetTop:window.visualViewport.offsetTop}}buildBoard(){let e=0,t=0;this.allWords.forEach((r=>{"horizontal"===r.orientation&&(e=Math.max(e,r.x+r.word.length),t=Math.max(t,r.y+1)),"vertical"===r.orientation&&(e=Math.max(e,r.x+1),t=Math.max(t,r.y+r.word.length))}));const r=Array(t*e).fill(null).map(((t,r)=>{const[i,n]=o(r,e);return{index:r,x:i,y:n,value:null,isCurrent:!1,isInCurrentWord:!1,isBlocked:!0}}));this.allWords.forEach((t=>{if("horizontal"===t.orientation)for(let i=0;i<t.word.length;i++){const n=a.from(t),o=u(new a(n.x+i,n.y),e);r[o].isBlocked=!1,r[o].answer=t.word[i]}if("vertical"===t.orientation)for(let i=0;i<t.word.length;i++){const n=a.from(t),o=u(new a(n.x,n.y+i),e);r[o].isBlocked=!1,r[o].answer=t.word[i]}})),this.cells=r,this.boardWidth=e,this.boardHeight=t}getClueById(e){return this.allWords.find((t=>t.id===e))??null}isInClue(e,t=this.currentClue){return null!==t&&(e.x===t.x||e.y===t.y)&&("horizontal"===t.orientation?!(e.y!==t.y||e.x<t.x||e.x>=t.x+t.word.length):"vertical"===t.orientation?!(e.x!==t.x||e.y<t.y||e.y>=t.y+t.word.length):void 0)}isSelectedCell(e){return!!this.selectedCell&&e.x===this.selectedCell.x&&e.y===this.selectedCell.y}getNextClueId(){if(!this.currentClueId)return this.allWords[0]?.id??null;const e=this.allWords.findIndex((e=>e.id===this.currentClueId));return e<0?this.allWords[0]?.id??null:this.allWords[e+1]?.id??null}getPrevClueId(){if(!this.currentClueId)return this.allWords[0]?.id??null;const e=this.allWords.findIndex((e=>e.id===this.currentClueId));return e<0?this.allWords[0]?.id??null:this.allWords[e-1]?.id??null}inputLetter(e){this.selectedCell&&(this.selectedCell.value=e,this.selectNextCell(),s(this))}backspace(){this.selectedCell&&(this.selectedCell.value?(this.selectedCell.value="",this.selectPrevCell()):(this.selectPrevCell(),this.selectedCell.value=""),s(this))}selectNextCell(){if(!this.selectedCell||!this.currentClue)return;const e=this.currentClue.orientation;if(function(e,t){return w(e).eq(a.from(t))}(this.currentClue,this.selectedCell)){const e=this.getNextClueId(),t=this.getClueById(e);return t?void this.selectClueByXY(a.from(t)):void 0}"horizontal"===e&&this.selectClueByXY(new a(this.selectedCell.x+1,this.selectedCell.y)),"vertical"===e&&this.selectClueByXY(new a(this.selectedCell.x,this.selectedCell.y+1))}selectPrevCell(){if(!this.selectedCell||!this.currentClue)return;const e=this.currentClue.orientation;if(function(e,t){return a.from(e).eq(a.from(t))}(this.currentClue,this.selectedCell)){const e=this.getPrevClueId(),t=this.getClueById(e);if(t){const e=w(t);return console.log(e),void this.selectClueByXY(e)}}"horizontal"===e&&this.selectClueByXY(new a(this.selectedCell.x-1,this.selectedCell.y)),"vertical"===e&&this.selectClueByXY(new a(this.selectedCell.x,this.selectedCell.y-1))}onFocusin(){this.isFocused=!0}onFocusOut(){this.isFocused=!1}async selectClue(e,{row:t,col:r}={}){if(!e)return;this.currentClueId=e;const i=this.allWords.find((t=>t.id===e));i||(this.currentClueId=null,this.currentClue=null),this.currentClue=i;const n=[i.x,i.y];void 0!==t&&"vertical"===i.orientation&&t>=i.y&&t<i.y+i.word.length&&(n[1]=t),void 0!==r&&"horizontal"===i.orientation&&r>=i.x&&r<i.x+i.word.length&&(n[0]=r),this.selectCellByXY(a.from(n))}selectCellByXY(e){const t=u(e,this.boardWidth);this.selectedCell=this.cells[t]??null}findNonblockedCell(e,t){const r=new a(e[0]+t[0],e[1]+t[1]),i=this.boardWidth*this.boardHeight;let n=0;for(;this.isCellBlocked(r)&&n<i;)n++,r[0]+=t[0],r[1]+=t[1],r[0]<0&&(r[0]=this.boardWidth-1),r[0]>=this.boardWidth&&(r[0]=0),r[1]<0&&(r[1]=this.boardHeight-1),r[1]>=this.boardHeight&&(r[1]=0);return r}isCellBlocked(e){const t=this.cells[u(e,this.boardWidth)];return t?.isBlocked??!0}selectClueByXY(e){const t=this.allWords.filter((t=>this.isInClue(e,t)));if(t.length)if(this.selectedCell&&2===t.length&&e.eq(a.from(this.selectedCell))){const r=t.find((e=>e.orientation!==this.currentClue?.orientation));this.selectClue(r?.id??t[0].id,{row:e.y,col:e.x})}else{const r=t.find((e=>e.orientation===this.currentClue?.orientation));this.selectClue(r?.id??t[0].id,{row:e.y,col:e.x})}}getCluePreview(e){if(!e)return"_";const t=Array(e.word.length).fill("_");for(let r=0;r<e.word.length;r++){const i=new a(e.x,e.y).add("vertical"===e.orientation?new a(0,1*r):new a(1*r,0)),n=this.cells[u(i,this.boardWidth)];n.value&&(t[r]=n.value)}return t.join("")}onKeyPress(e){if(console.log(e),"Tab"===e.key){const t=e.shiftKey?this.getPrevClueId():this.getNextClueId();t&&(e.preventDefault(),this.selectClue(t))}if(this.selectedCell)switch(e.key){case"ArrowLeft":return this.selectClueByXY(this.findNonblockedCell(new a(this.selectedCell.x,this.selectedCell.y),new a(-1,0))),void e.preventDefault();case"ArrowRight":return this.selectClueByXY(this.findNonblockedCell(new a(this.selectedCell.x,this.selectedCell.y),new a(1,0))),void e.preventDefault();case"ArrowUp":return this.selectClueByXY(this.findNonblockedCell(new a(this.selectedCell.x,this.selectedCell.y),new a(0,-1))),void e.preventDefault();case"ArrowDown":return this.selectClueByXY(this.findNonblockedCell(new a(this.selectedCell.x,this.selectedCell.y),new a(0,1))),void e.preventDefault();case"Backspace":console.log("BACKSPACE!"),this.backspace()}}onInput(e){c(e)&&this.inputLetter(e.data.toLowerCase()[0]),this.textInput.value=""}render(){const t=!!this.vWords.length,r=!!this.hWords.length,i="none"===this.clueListStyle,n=r&&t,o=this.isFocused&&this.currentClue&&this.bowserParser.isPlatform("mobile");return e("div",{key:"b18bbd3453ad8c96cf6b5f04903380b0357d5842",part:"main",class:{"--focused":this.isFocused,"--only-board":i,"--sticky-bottom-hack":this.useStickyBottomHack},onFocusin:this.onFocusin.bind(this),onFocusout:this.onFocusOut.bind(this),onClick:()=>{this.textInput.blur(),this.textInput.focus()}},e("input",{key:"59e427026f09803d1077d1c36f95284fe8d1b8ae",type:"text",class:"dummy",ref:e=>this.textInput=e,onKeyDown:this.onKeyPress.bind(this),onInput:this.onInput.bind(this)}),i?"":e("div",{part:"clues",class:{twoLists:n,oneList:!n}},r?e(h,{type:this.clueListStyle},this.hWords.map((t=>{const r=t.id===this.currentClueId;return e(d,{showPreview:this.showCluePreview,preview:this.getCluePreview(t),word:t,isCurrent:r,onPointerDown:()=>this.selectClue(t.id),tagName:"ol"===this.clueListStyle?"li":void 0})}))):"",t?e(h,{type:this.clueListStyle},this.vWords.map((t=>{const r=t.id===this.currentClueId;return e(d,{showPreview:this.showCluePreview,preview:this.getCluePreview(t),word:t,isCurrent:r,onPointerDown:()=>this.selectClue(t.id),tagName:"ol"===this.clueListStyle?"li":void 0})}))):""),e("div",{key:"a4803d792f38119e3ba78584acdbb0db677b4869",part:"board",style:{"--board-width":""+this.boardWidth,"grid-template-columns":`repeat(${this.boardWidth}, 1fr)`,aspectRatio:""+this.boardWidth/this.boardHeight}},this.cells.filter((e=>!e.isBlocked)).map((t=>{const r=this.isInClue(t),i=this.isSelectedCell(t),n=this.specialCells.some((e=>e.x===t.x&&e.y===t.y));return e(l,{isSpecial:n,onPointerDown:()=>this.selectClueByXY(a.from(t)),isInCurrentClue:r,isSelected:i,data:t})})),this.specialBorders.map(((t,r)=>e("div",{key:r,part:"special-border",class:{top:!!(4096&t.border),right:!!(256&t.border),bottom:!!(16&t.border),left:!!(1&t.border)},style:{"--x":""+t.x,"--y":""+t.y}}))),this.labels.map((t=>e("div",{part:"label",style:{"--x":""+t.x,"--y":""+t.y},onPointerDown:()=>this.selectClue(t.clueId)},e("div",{class:"_inner"},t.text))))),o?e("div",{part:"floating-clue",style:{"--height":this.floatingPreviewHackParams.height+"px","--offsetTop":this.floatingPreviewHackParams.offsetTop+"px"}},e("div",{class:"floating-clue__preview"},Array.from(this.getCluePreview(this.currentClue)).map(((t,r)=>e("span",{key:r},t)))),e("div",{class:"floating-clue__text"},this.currentClue?.clue??"")):"")}static get delegatesFocus(){return!0}static get watchers(){return{data:[{watchData:0}]}}static get style(){return'*[part=main]{position:relative;display:grid;grid-template-areas:"board" "clues";grid-template-columns:1fr}@media (min-width: 768px){*[part=main]{grid-template-areas:"clues board" "clues .";grid-template-columns:1fr 1fr}*[part=main].--only-board{grid-template-columns:1fr;grid-template-areas:"board"}}*[part=main].--focused{background:lightgrey}*[part=main] input.dummy{pointer-events:none;opacity:0;grid-area:board;border:none;outline:none}[part=clues]{grid-area:clues;display:grid;grid-template-columns:1fr 1fr;gap:16px}[part=clues].oneList{grid-template-columns:1fr}[part=clue-list]{margin:0;padding:0}[part=clue].--current{background:var(--clue-current-background, lightcyan)}[part=clue] .preview{font-weight:bold;letter-spacing:0.2em;text-align:center;display:block;text-transform:uppercase}li[part=clue]{--_clue-padding:var(--clue-padding, .5em);border-radius:var(--clue-radius, 0.5em);padding:var(--_clue-padding);list-style-position:inside;padding-left:calc(1em + var(--_clue-padding));text-indent:-1em;margin:0}[part=board]{grid-area:board;display:block;position:relative;container-type:size;background:var(--board-background, darkgoldenrod);--_cell-border-width:var(--cell-border-width, 2px);--cell-width-temp:calc((100cqw - var(--_cell-border-width)) / var(--board-width, 10));--cell-width:var(--cell-width-temp);--cell-width:round(var(--cell-width-temp), 1px)}[part=cell]{display:block;color:var(--cell-color, #11138d);width:calc(var(--cell-width) - var(--_cell-border-width));aspect-ratio:1;background:var(--cell-background, #d9d9d9);position:absolute;container-type:size;top:calc(var(--y, 0) * var(--cell-width));left:calc(var(--x, 0) * var(--cell-width));border:var(--_cell-border-width) solid var(--cell-border-color, red)}[part=cell].--alt{background:var(--cell-background-alt, #999)}[part=cell].--in-current-clue{box-shadow:inset 0 0 2px 2px var(--cell-selected-background, lightblue)}[part=cell].--selected{background:var(--cell-selected-background, lightblue)}[part=cell].--special{background:var(--cell-special-background, lightgreen)}[part=cell].--special.--selected:before{content:"";background:var(--cell-selected-background, lightblue);position:absolute;top:0;left:0;right:0;bottom:0;clip-path:polygon(100% 0, 100% 100%, 50% 100%)}[part=cell] ._inner{position:absolute;top:0;left:0;right:0;bottom:0;display:grid;place-content:center;text-transform:uppercase;font-size:80cqh}[part=preview]{display:none}[part=special-border]{display:block;background:black;position:absolute;z-index:100;--s-border:max(2px, var(--_cell-border-width))}[part=special-border].left,[part=special-border].right{width:var(--s-border);height:calc(var(--cell-width) - var(--_cell-border-width));top:calc(var(--y, 0) * var(--cell-width) + var(--_cell-border-width))}[part=special-border].left{left:calc(var(--x, 0) * var(--cell-width) - var(--s-border) / 2)}[part=special-border].right{left:calc((var(--x, 0) + 1) * var(--cell-width) - var(--s-border) / 2)}[part=special-border].top,[part=special-border].bottom{width:calc(var(--cell-width) - var(--_cell-border-width));height:var(--s-border);left:calc(var(--x, 0) * var(--cell-width) + var(--_cell-border-width))}[part=special-border].top{top:calc(var(--y, 0) * var(--cell-width))}[part=special-border].bottom{top:calc((var(--y, 0) + 1) * var(--cell-width))}[part=label]{display:grid;position:absolute;container-type:size;top:calc(var(--y, 0) * var(--cell-width));left:calc(var(--x, 0) * var(--cell-width));width:calc(var(--cell-width) - var(--_cell-border-width));aspect-ratio:1;border:var(--_cell-border-width) solid transparent;--label-place-content:center end}[part=label] ._inner{position:absolute;top:var(--label-padding, 10cqh);left:var(--label-padding, 10cqh);right:var(--label-padding, 10cqh);bottom:var(--label-padding, 10cqh);display:grid;place-content:var(--label-place-content, center);text-transform:uppercase;font-size:var(--label-font-size, 60cqh)}[part=floating-clue]{position:fixed;color:white;left:0;right:0;bottom:0;--_background:var(--floating-clue-background, blue)}[part=floating-clue] .floating-clue__text{padding:8px;background:var(--_background)}[part=floating-clue] .floating-clue__preview{display:inline-block;padding:8px;background:var(--_background);font-weight:bold;letter-spacing:0.2em;text-transform:uppercase;border-radius:0 16px 0 0}[part=floating-clue] .floating-clue__preview span{display:inline-block;width:1em;text-align:center}.--sticky-bottom-hack [part=floating-clue]{top:var(--height);top:calc(var(--height) + var(--offsetTop));bottom:unset;transform:translate(0, -100%)}@media (orientation: landscape){.--sticky-bottom-hack [part=floating-clue]{top:calc(var(--height) + var(--offsetTop))}}'}},[529,"mb-crossword",{init:[4],data:[16],showCluePreview:[4,"show-clue-preview"],clueListStyle:[1,"clue-list-style"],hWords:[32],vWords:[32],currentClueId:[32],currentClue:[32],isFocused:[32],selectedCell:[32],specialBorders:[32],specialCells:[32],labels:[32],boardWidth:[32],boardHeight:[32],cells:[32],floatingPreviewHackParams:[32],initGame:[64],checkAnswer:[64],selectClue:[64]},void 0,{data:[{watchData:0}]}]);function w(e){return new a(e.x+("horizontal"===e.orientation?e.word.length-1:0),e.y+("vertical"===e.orientation?e.word.length-1:0))}function g(){"undefined"!=typeof customElements&&["mb-crossword"].forEach((e=>{"mb-crossword"===e&&(customElements.get(t(e))||customElements.define(t(e),m))}))}g();const y=m,x=g;export{y as MbCrossword,x as defineCustomElement}
|
package/dist/esm/loader.js
CHANGED
|
@@ -5,7 +5,7 @@ import { g as globalScripts } from './app-globals-DQuL1Twl.js';
|
|
|
5
5
|
const defineCustomElements = async (win, options) => {
|
|
6
6
|
if (typeof window === 'undefined') return undefined;
|
|
7
7
|
await globalScripts();
|
|
8
|
-
return bootstrapLazy([["mb-crossword",[[529,"mb-crossword",{"init":[4],"data":[16],"showCluePreview":[4,"show-clue-preview"],"clueListStyle":[1,"clue-list-style"],"hWords":[32],"vWords":[32],"currentClueId":[32],"currentClue":[32],"isFocused":[32],"selectedCell":[32],"specialBorders":[32],"specialCells":[32],"labels":[32],"boardWidth":[32],"boardHeight":[32],"cells":[32],"initGame":[64],"checkAnswer":[64],"selectClue":[64]},null,{"data":[{"watchData":0}]}]]]], options);
|
|
8
|
+
return bootstrapLazy([["mb-crossword",[[529,"mb-crossword",{"init":[4],"data":[16],"showCluePreview":[4,"show-clue-preview"],"clueListStyle":[1,"clue-list-style"],"hWords":[32],"vWords":[32],"currentClueId":[32],"currentClue":[32],"isFocused":[32],"selectedCell":[32],"specialBorders":[32],"specialCells":[32],"labels":[32],"boardWidth":[32],"boardHeight":[32],"cells":[32],"floatingPreviewHackParams":[32],"initGame":[64],"checkAnswer":[64],"selectClue":[64]},null,{"data":[{"watchData":0}]}]]]], options);
|
|
9
9
|
};
|
|
10
10
|
|
|
11
11
|
export { defineCustomElements };
|
|
@@ -3,7 +3,7 @@ import { V as Vec2fromIndex, a as Vec2, i as isInputEventLetter, b as indexFromX
|
|
|
3
3
|
|
|
4
4
|
function Clue({ isCurrent, word, onPointerDown, preview, showPreview, tagName }) {
|
|
5
5
|
const Tag = tagName ?? 'div';
|
|
6
|
-
return h(Tag, { onPointerDown: onPointerDown, part: "clue", class: {
|
|
6
|
+
return h(Tag, { role: 'button', onPointerDown: onPointerDown, part: "clue", class: {
|
|
7
7
|
"--current": isCurrent
|
|
8
8
|
} }, word.clue, showPreview && h("span", { class: "preview" }, preview));
|
|
9
9
|
}
|
|
@@ -32,7 +32,29 @@ const ClueList = ({ type }, children) => {
|
|
|
32
32
|
}
|
|
33
33
|
};
|
|
34
34
|
|
|
35
|
-
|
|
35
|
+
function getDefaultExportFromCjs (x) {
|
|
36
|
+
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
var es5$1 = {exports: {}};
|
|
40
|
+
|
|
41
|
+
var es5 = es5$1.exports;
|
|
42
|
+
|
|
43
|
+
var hasRequiredEs5;
|
|
44
|
+
|
|
45
|
+
function requireEs5 () {
|
|
46
|
+
if (hasRequiredEs5) return es5$1.exports;
|
|
47
|
+
hasRequiredEs5 = 1;
|
|
48
|
+
(function (module, exports) {
|
|
49
|
+
!function(e,t){module.exports=t();}(es5,(function(){return function(e){var t={};function r(i){if(t[i])return t[i].exports;var n=t[i]={i:i,l:false,exports:{}};return e[i].call(n.exports,n,n.exports,r),n.l=true,n.exports}return r.m=e,r.c=t,r.d=function(e,t,i){r.o(e,t)||Object.defineProperty(e,t,{enumerable:true,get:i});},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:true});},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var i=Object.create(null);if(r.r(i),Object.defineProperty(i,"default",{enumerable:true,value:e}),2&t&&"string"!=typeof e)for(var n in e)r.d(i,n,function(t){return e[t]}.bind(null,n));return i},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=90)}({17:function(e,t,r){t.__esModule=true,t.default=void 0;var i=r(18),n=function(){function e(){}return e.getFirstMatch=function(e,t){var r=t.match(e);return r&&r.length>0&&r[1]||""},e.getSecondMatch=function(e,t){var r=t.match(e);return r&&r.length>1&&r[2]||""},e.matchAndReturnConst=function(e,t,r){if(e.test(t))return r},e.getWindowsVersionName=function(e){switch(e){case "NT":return "NT";case "XP":return "XP";case "NT 5.0":return "2000";case "NT 5.1":return "XP";case "NT 5.2":return "2003";case "NT 6.0":return "Vista";case "NT 6.1":return "7";case "NT 6.2":return "8";case "NT 6.3":return "8.1";case "NT 10.0":return "10";default:return}},e.getMacOSVersionName=function(e){var t=e.split(".").splice(0,2).map((function(e){return parseInt(e,10)||0}));t.push(0);var r=t[0],i=t[1];if(10===r)switch(i){case 5:return "Leopard";case 6:return "Snow Leopard";case 7:return "Lion";case 8:return "Mountain Lion";case 9:return "Mavericks";case 10:return "Yosemite";case 11:return "El Capitan";case 12:return "Sierra";case 13:return "High Sierra";case 14:return "Mojave";case 15:return "Catalina";default:return}switch(r){case 11:return "Big Sur";case 12:return "Monterey";case 13:return "Ventura";case 14:return "Sonoma";case 15:return "Sequoia";default:return}},e.getAndroidVersionName=function(e){var t=e.split(".").splice(0,2).map((function(e){return parseInt(e,10)||0}));if(t.push(0),!(1===t[0]&&t[1]<5))return 1===t[0]&&t[1]<6?"Cupcake":1===t[0]&&t[1]>=6?"Donut":2===t[0]&&t[1]<2?"Eclair":2===t[0]&&2===t[1]?"Froyo":2===t[0]&&t[1]>2?"Gingerbread":3===t[0]?"Honeycomb":4===t[0]&&t[1]<1?"Ice Cream Sandwich":4===t[0]&&t[1]<4?"Jelly Bean":4===t[0]&&t[1]>=4?"KitKat":5===t[0]?"Lollipop":6===t[0]?"Marshmallow":7===t[0]?"Nougat":8===t[0]?"Oreo":9===t[0]?"Pie":void 0},e.getVersionPrecision=function(e){return e.split(".").length},e.compareVersions=function(t,r,i){ void 0===i&&(i=false);var n=e.getVersionPrecision(t),a=e.getVersionPrecision(r),o=Math.max(n,a),s=0,u=e.map([t,r],(function(t){var r=o-e.getVersionPrecision(t),i=t+new Array(r+1).join(".0");return e.map(i.split("."),(function(e){return new Array(20-e.length).join("0")+e})).reverse()}));for(i&&(s=o-Math.min(n,a)),o-=1;o>=s;){if(u[0][o]>u[1][o])return 1;if(u[0][o]===u[1][o]){if(o===s)return 0;o-=1;}else if(u[0][o]<u[1][o])return -1}},e.map=function(e,t){var r,i=[];if(Array.prototype.map)return Array.prototype.map.call(e,t);for(r=0;r<e.length;r+=1)i.push(t(e[r]));return i},e.find=function(e,t){var r,i;if(Array.prototype.find)return Array.prototype.find.call(e,t);for(r=0,i=e.length;r<i;r+=1){var n=e[r];if(t(n,r))return n}},e.assign=function(e){for(var t,r,i=e,n=arguments.length,a=new Array(n>1?n-1:0),o=1;o<n;o++)a[o-1]=arguments[o];if(Object.assign)return Object.assign.apply(Object,[e].concat(a));var s=function(){var e=a[t];"object"==typeof e&&null!==e&&Object.keys(e).forEach((function(t){i[t]=e[t];}));};for(t=0,r=a.length;t<r;t+=1)s();return e},e.getBrowserAlias=function(e){return i.BROWSER_ALIASES_MAP[e]},e.getBrowserTypeByAlias=function(e){return i.BROWSER_MAP[e]||""},e}();t.default=n,e.exports=t.default;},18:function(e,t,r){t.__esModule=true,t.ENGINE_MAP=t.OS_MAP=t.PLATFORMS_MAP=t.BROWSER_MAP=t.BROWSER_ALIASES_MAP=void 0;t.BROWSER_ALIASES_MAP={AmazonBot:"amazonbot","Amazon Silk":"amazon_silk","Android Browser":"android",BaiduSpider:"baiduspider",Bada:"bada",BingCrawler:"bingcrawler",BlackBerry:"blackberry","ChatGPT-User":"chatgpt_user",Chrome:"chrome",ClaudeBot:"claudebot",Chromium:"chromium",Diffbot:"diffbot",DuckDuckBot:"duckduckbot",Electron:"electron",Epiphany:"epiphany",FacebookExternalHit:"facebookexternalhit",Firefox:"firefox",Focus:"focus",Generic:"generic","Google Search":"google_search",Googlebot:"googlebot",GPTBot:"gptbot","Internet Explorer":"ie",InternetArchiveCrawler:"internetarchivecrawler","K-Meleon":"k_meleon",LibreWolf:"librewolf",Maxthon:"maxthon","Meta-ExternalAds":"meta_externalads","Meta-ExternalAgent":"meta_externalagent","Meta-ExternalFetcher":"meta_externalfetcher","Meta-WebIndexer":"meta_webindexer","Microsoft Edge":"edge","MZ Browser":"mz","NAVER Whale Browser":"naver","OAI-SearchBot":"oai_searchbot",Omgilibot:"omgilibot",Opera:"opera","Opera Coast":"opera_coast","Pale Moon":"pale_moon",PerplexityBot:"perplexitybot","Perplexity-User":"perplexity_user",PhantomJS:"phantomjs",PingdomBot:"pingdombot",Puffin:"puffin",QQ:"qq",QQLite:"qqlite",QupZilla:"qupzilla",Roku:"roku",Safari:"safari",Sailfish:"sailfish","Samsung Internet for Android":"samsung_internet",SeaMonkey:"seamonkey",Sleipnir:"sleipnir","Sogou Browser":"sogou",Swing:"swing",Tizen:"tizen","UC Browser":"uc",Vivaldi:"vivaldi","WebOS Browser":"webos",WeChat:"wechat",YahooSlurp:"yahooslurp","Yandex Browser":"yandex",YandexBot:"yandexbot",YouBot:"youbot"};t.BROWSER_MAP={amazonbot:"AmazonBot",amazon_silk:"Amazon Silk",android:"Android Browser",baiduspider:"BaiduSpider",bada:"Bada",bingcrawler:"BingCrawler",blackberry:"BlackBerry",chatgpt_user:"ChatGPT-User",chrome:"Chrome",claudebot:"ClaudeBot",chromium:"Chromium",diffbot:"Diffbot",duckduckbot:"DuckDuckBot",edge:"Microsoft Edge",electron:"Electron",epiphany:"Epiphany",facebookexternalhit:"FacebookExternalHit",firefox:"Firefox",focus:"Focus",generic:"Generic",google_search:"Google Search",googlebot:"Googlebot",gptbot:"GPTBot",ie:"Internet Explorer",internetarchivecrawler:"InternetArchiveCrawler",k_meleon:"K-Meleon",librewolf:"LibreWolf",maxthon:"Maxthon",meta_externalads:"Meta-ExternalAds",meta_externalagent:"Meta-ExternalAgent",meta_externalfetcher:"Meta-ExternalFetcher",meta_webindexer:"Meta-WebIndexer",mz:"MZ Browser",naver:"NAVER Whale Browser",oai_searchbot:"OAI-SearchBot",omgilibot:"Omgilibot",opera:"Opera",opera_coast:"Opera Coast",pale_moon:"Pale Moon",perplexitybot:"PerplexityBot",perplexity_user:"Perplexity-User",phantomjs:"PhantomJS",pingdombot:"PingdomBot",puffin:"Puffin",qq:"QQ Browser",qqlite:"QQ Browser Lite",qupzilla:"QupZilla",roku:"Roku",safari:"Safari",sailfish:"Sailfish",samsung_internet:"Samsung Internet for Android",seamonkey:"SeaMonkey",sleipnir:"Sleipnir",sogou:"Sogou Browser",swing:"Swing",tizen:"Tizen",uc:"UC Browser",vivaldi:"Vivaldi",webos:"WebOS Browser",wechat:"WeChat",yahooslurp:"YahooSlurp",yandex:"Yandex Browser",yandexbot:"YandexBot",youbot:"YouBot"};t.PLATFORMS_MAP={bot:"bot",desktop:"desktop",mobile:"mobile",tablet:"tablet",tv:"tv"};t.OS_MAP={Android:"Android",Bada:"Bada",BlackBerry:"BlackBerry",ChromeOS:"Chrome OS",HarmonyOS:"HarmonyOS",iOS:"iOS",Linux:"Linux",MacOS:"macOS",PlayStation4:"PlayStation 4",Roku:"Roku",Tizen:"Tizen",WebOS:"WebOS",Windows:"Windows",WindowsPhone:"Windows Phone"};t.ENGINE_MAP={Blink:"Blink",EdgeHTML:"EdgeHTML",Gecko:"Gecko",Presto:"Presto",Trident:"Trident",WebKit:"WebKit"};},90:function(e,t,r){t.__esModule=true,t.default=void 0;var i,n=(i=r(91))&&i.__esModule?i:{default:i},a=r(18);function o(e,t){for(var r=0;r<t.length;r++){var i=t[r];i.enumerable=i.enumerable||false,i.configurable=true,"value"in i&&(i.writable=true),Object.defineProperty(e,i.key,i);}}var s=function(){function e(){}var t,r,i;return e.getParser=function(e,t){if(void 0===t&&(t=false),"string"!=typeof e)throw new Error("UserAgent should be a string");return new n.default(e,t)},e.parse=function(e){return new n.default(e).getResult()},t=e,i=[{key:"BROWSER_MAP",get:function(){return a.BROWSER_MAP}},{key:"ENGINE_MAP",get:function(){return a.ENGINE_MAP}},{key:"OS_MAP",get:function(){return a.OS_MAP}},{key:"PLATFORMS_MAP",get:function(){return a.PLATFORMS_MAP}}],(r=null)&&o(t.prototype,r),i&&o(t,i),e}();t.default=s,e.exports=t.default;},91:function(e,t,r){t.__esModule=true,t.default=void 0;var i=u(r(92)),n=u(r(93)),a=u(r(94)),o=u(r(95)),s=u(r(17));function u(e){return e&&e.__esModule?e:{default:e}}var d=function(){function e(e,t){if(void 0===t&&(t=false),null==e||""===e)throw new Error("UserAgent parameter can't be empty");this._ua=e,this.parsedResult={},true!==t&&this.parse();}var t=e.prototype;return t.getUA=function(){return this._ua},t.test=function(e){return e.test(this._ua)},t.parseBrowser=function(){var e=this;this.parsedResult.browser={};var t=s.default.find(i.default,(function(t){if("function"==typeof t.test)return t.test(e);if(Array.isArray(t.test))return t.test.some((function(t){return e.test(t)}));throw new Error("Browser's test function is not valid")}));return t&&(this.parsedResult.browser=t.describe(this.getUA())),this.parsedResult.browser},t.getBrowser=function(){return this.parsedResult.browser?this.parsedResult.browser:this.parseBrowser()},t.getBrowserName=function(e){return e?String(this.getBrowser().name).toLowerCase()||"":this.getBrowser().name||""},t.getBrowserVersion=function(){return this.getBrowser().version},t.getOS=function(){return this.parsedResult.os?this.parsedResult.os:this.parseOS()},t.parseOS=function(){var e=this;this.parsedResult.os={};var t=s.default.find(n.default,(function(t){if("function"==typeof t.test)return t.test(e);if(Array.isArray(t.test))return t.test.some((function(t){return e.test(t)}));throw new Error("Browser's test function is not valid")}));return t&&(this.parsedResult.os=t.describe(this.getUA())),this.parsedResult.os},t.getOSName=function(e){var t=this.getOS().name;return e?String(t).toLowerCase()||"":t||""},t.getOSVersion=function(){return this.getOS().version},t.getPlatform=function(){return this.parsedResult.platform?this.parsedResult.platform:this.parsePlatform()},t.getPlatformType=function(e){ void 0===e&&(e=false);var t=this.getPlatform().type;return e?String(t).toLowerCase()||"":t||""},t.parsePlatform=function(){var e=this;this.parsedResult.platform={};var t=s.default.find(a.default,(function(t){if("function"==typeof t.test)return t.test(e);if(Array.isArray(t.test))return t.test.some((function(t){return e.test(t)}));throw new Error("Browser's test function is not valid")}));return t&&(this.parsedResult.platform=t.describe(this.getUA())),this.parsedResult.platform},t.getEngine=function(){return this.parsedResult.engine?this.parsedResult.engine:this.parseEngine()},t.getEngineName=function(e){return e?String(this.getEngine().name).toLowerCase()||"":this.getEngine().name||""},t.parseEngine=function(){var e=this;this.parsedResult.engine={};var t=s.default.find(o.default,(function(t){if("function"==typeof t.test)return t.test(e);if(Array.isArray(t.test))return t.test.some((function(t){return e.test(t)}));throw new Error("Browser's test function is not valid")}));return t&&(this.parsedResult.engine=t.describe(this.getUA())),this.parsedResult.engine},t.parse=function(){return this.parseBrowser(),this.parseOS(),this.parsePlatform(),this.parseEngine(),this},t.getResult=function(){return s.default.assign({},this.parsedResult)},t.satisfies=function(e){var t=this,r={},i=0,n={},a=0;if(Object.keys(e).forEach((function(t){var o=e[t];"string"==typeof o?(n[t]=o,a+=1):"object"==typeof o&&(r[t]=o,i+=1);})),i>0){var o=Object.keys(r),u=s.default.find(o,(function(e){return t.isOS(e)}));if(u){var d=this.satisfies(r[u]);if(void 0!==d)return d}var c=s.default.find(o,(function(e){return t.isPlatform(e)}));if(c){var f=this.satisfies(r[c]);if(void 0!==f)return f}}if(a>0){var l=Object.keys(n),b=s.default.find(l,(function(e){return t.isBrowser(e,true)}));if(void 0!==b)return this.compareVersion(n[b])}},t.isBrowser=function(e,t){ void 0===t&&(t=false);var r=this.getBrowserName().toLowerCase(),i=e.toLowerCase(),n=s.default.getBrowserTypeByAlias(i);return t&&n&&(i=n.toLowerCase()),i===r},t.compareVersion=function(e){var t=[0],r=e,i=false,n=this.getBrowserVersion();if("string"==typeof n)return ">"===e[0]||"<"===e[0]?(r=e.substr(1),"="===e[1]?(i=true,r=e.substr(2)):t=[],">"===e[0]?t.push(1):t.push(-1)):"="===e[0]?r=e.substr(1):"~"===e[0]&&(i=true,r=e.substr(1)),t.indexOf(s.default.compareVersions(n,r,i))>-1},t.isOS=function(e){return this.getOSName(true)===String(e).toLowerCase()},t.isPlatform=function(e){return this.getPlatformType(true)===String(e).toLowerCase()},t.isEngine=function(e){return this.getEngineName(true)===String(e).toLowerCase()},t.is=function(e,t){return void 0===t&&(t=false),this.isBrowser(e,t)||this.isOS(e)||this.isPlatform(e)},t.some=function(e){var t=this;return void 0===e&&(e=[]),e.some((function(e){return t.is(e)}))},e}();t.default=d,e.exports=t.default;},92:function(e,t,r){t.__esModule=true,t.default=void 0;var i,n=(i=r(17))&&i.__esModule?i:{default:i};var a=/version\/(\d+(\.?_?\d+)+)/i,o=[{test:[/gptbot/i],describe:function(e){var t={name:"GPTBot"},r=n.default.getFirstMatch(/gptbot\/(\d+(\.\d+)+)/i,e)||n.default.getFirstMatch(a,e);return r&&(t.version=r),t}},{test:[/chatgpt-user/i],describe:function(e){var t={name:"ChatGPT-User"},r=n.default.getFirstMatch(/chatgpt-user\/(\d+(\.\d+)+)/i,e)||n.default.getFirstMatch(a,e);return r&&(t.version=r),t}},{test:[/oai-searchbot/i],describe:function(e){var t={name:"OAI-SearchBot"},r=n.default.getFirstMatch(/oai-searchbot\/(\d+(\.\d+)+)/i,e)||n.default.getFirstMatch(a,e);return r&&(t.version=r),t}},{test:[/claudebot/i,/claude-web/i,/claude-user/i,/claude-searchbot/i],describe:function(e){var t={name:"ClaudeBot"},r=n.default.getFirstMatch(/(?:claudebot|claude-web|claude-user|claude-searchbot)\/(\d+(\.\d+)+)/i,e)||n.default.getFirstMatch(a,e);return r&&(t.version=r),t}},{test:[/omgilibot/i,/webzio-extended/i],describe:function(e){var t={name:"Omgilibot"},r=n.default.getFirstMatch(/(?:omgilibot|webzio-extended)\/(\d+(\.\d+)+)/i,e)||n.default.getFirstMatch(a,e);return r&&(t.version=r),t}},{test:[/diffbot/i],describe:function(e){var t={name:"Diffbot"},r=n.default.getFirstMatch(/diffbot\/(\d+(\.\d+)+)/i,e)||n.default.getFirstMatch(a,e);return r&&(t.version=r),t}},{test:[/perplexitybot/i],describe:function(e){var t={name:"PerplexityBot"},r=n.default.getFirstMatch(/perplexitybot\/(\d+(\.\d+)+)/i,e)||n.default.getFirstMatch(a,e);return r&&(t.version=r),t}},{test:[/perplexity-user/i],describe:function(e){var t={name:"Perplexity-User"},r=n.default.getFirstMatch(/perplexity-user\/(\d+(\.\d+)+)/i,e)||n.default.getFirstMatch(a,e);return r&&(t.version=r),t}},{test:[/youbot/i],describe:function(e){var t={name:"YouBot"},r=n.default.getFirstMatch(/youbot\/(\d+(\.\d+)+)/i,e)||n.default.getFirstMatch(a,e);return r&&(t.version=r),t}},{test:[/meta-webindexer/i],describe:function(e){var t={name:"Meta-WebIndexer"},r=n.default.getFirstMatch(/meta-webindexer\/(\d+(\.\d+)+)/i,e)||n.default.getFirstMatch(a,e);return r&&(t.version=r),t}},{test:[/meta-externalads/i],describe:function(e){var t={name:"Meta-ExternalAds"},r=n.default.getFirstMatch(/meta-externalads\/(\d+(\.\d+)+)/i,e)||n.default.getFirstMatch(a,e);return r&&(t.version=r),t}},{test:[/meta-externalagent/i],describe:function(e){var t={name:"Meta-ExternalAgent"},r=n.default.getFirstMatch(/meta-externalagent\/(\d+(\.\d+)+)/i,e)||n.default.getFirstMatch(a,e);return r&&(t.version=r),t}},{test:[/meta-externalfetcher/i],describe:function(e){var t={name:"Meta-ExternalFetcher"},r=n.default.getFirstMatch(/meta-externalfetcher\/(\d+(\.\d+)+)/i,e)||n.default.getFirstMatch(a,e);return r&&(t.version=r),t}},{test:[/googlebot/i],describe:function(e){var t={name:"Googlebot"},r=n.default.getFirstMatch(/googlebot\/(\d+(\.\d+))/i,e)||n.default.getFirstMatch(a,e);return r&&(t.version=r),t}},{test:[/amazonbot/i],describe:function(e){var t={name:"AmazonBot"},r=n.default.getFirstMatch(/amazonbot\/(\d+(\.\d+)+)/i,e)||n.default.getFirstMatch(a,e);return r&&(t.version=r),t}},{test:[/bingbot/i],describe:function(e){var t={name:"BingCrawler"},r=n.default.getFirstMatch(/bingbot\/(\d+(\.\d+)+)/i,e)||n.default.getFirstMatch(a,e);return r&&(t.version=r),t}},{test:[/baiduspider/i],describe:function(e){var t={name:"BaiduSpider"},r=n.default.getFirstMatch(/baiduspider\/(\d+(\.\d+)+)/i,e)||n.default.getFirstMatch(a,e);return r&&(t.version=r),t}},{test:[/duckduckbot/i],describe:function(e){var t={name:"DuckDuckBot"},r=n.default.getFirstMatch(/duckduckbot\/(\d+(\.\d+)+)/i,e)||n.default.getFirstMatch(a,e);return r&&(t.version=r),t}},{test:[/ia_archiver/i],describe:function(e){var t={name:"InternetArchiveCrawler"},r=n.default.getFirstMatch(/ia_archiver\/(\d+(\.\d+)+)/i,e)||n.default.getFirstMatch(a,e);return r&&(t.version=r),t}},{test:[/facebookexternalhit/i,/facebookcatalog/i],describe:function(){return {name:"FacebookExternalHit"}}},{test:[/yahoo!?[\s/]*slurp/i],describe:function(){return {name:"YahooSlurp"}}},{test:[/yandexbot/i,/yandexmobilebot/i],describe:function(){return {name:"YandexBot"}}},{test:[/pingdom/i],describe:function(){return {name:"PingdomBot"}}},{test:[/opera/i],describe:function(e){var t={name:"Opera"},r=n.default.getFirstMatch(a,e)||n.default.getFirstMatch(/(?:opera)[\s/](\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/opr\/|opios/i],describe:function(e){var t={name:"Opera"},r=n.default.getFirstMatch(/(?:opr|opios)[\s/](\S+)/i,e)||n.default.getFirstMatch(a,e);return r&&(t.version=r),t}},{test:[/SamsungBrowser/i],describe:function(e){var t={name:"Samsung Internet for Android"},r=n.default.getFirstMatch(a,e)||n.default.getFirstMatch(/(?:SamsungBrowser)[\s/](\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/Whale/i],describe:function(e){var t={name:"NAVER Whale Browser"},r=n.default.getFirstMatch(a,e)||n.default.getFirstMatch(/(?:whale)[\s/](\d+(?:\.\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/PaleMoon/i],describe:function(e){var t={name:"Pale Moon"},r=n.default.getFirstMatch(a,e)||n.default.getFirstMatch(/(?:PaleMoon)[\s/](\d+(?:\.\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/MZBrowser/i],describe:function(e){var t={name:"MZ Browser"},r=n.default.getFirstMatch(/(?:MZBrowser)[\s/](\d+(?:\.\d+)+)/i,e)||n.default.getFirstMatch(a,e);return r&&(t.version=r),t}},{test:[/focus/i],describe:function(e){var t={name:"Focus"},r=n.default.getFirstMatch(/(?:focus)[\s/](\d+(?:\.\d+)+)/i,e)||n.default.getFirstMatch(a,e);return r&&(t.version=r),t}},{test:[/swing/i],describe:function(e){var t={name:"Swing"},r=n.default.getFirstMatch(/(?:swing)[\s/](\d+(?:\.\d+)+)/i,e)||n.default.getFirstMatch(a,e);return r&&(t.version=r),t}},{test:[/coast/i],describe:function(e){var t={name:"Opera Coast"},r=n.default.getFirstMatch(a,e)||n.default.getFirstMatch(/(?:coast)[\s/](\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/opt\/\d+(?:.?_?\d+)+/i],describe:function(e){var t={name:"Opera Touch"},r=n.default.getFirstMatch(/(?:opt)[\s/](\d+(\.?_?\d+)+)/i,e)||n.default.getFirstMatch(a,e);return r&&(t.version=r),t}},{test:[/yabrowser/i],describe:function(e){var t={name:"Yandex Browser"},r=n.default.getFirstMatch(/(?:yabrowser)[\s/](\d+(\.?_?\d+)+)/i,e)||n.default.getFirstMatch(a,e);return r&&(t.version=r),t}},{test:[/ucbrowser/i],describe:function(e){var t={name:"UC Browser"},r=n.default.getFirstMatch(a,e)||n.default.getFirstMatch(/(?:ucbrowser)[\s/](\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/Maxthon|mxios/i],describe:function(e){var t={name:"Maxthon"},r=n.default.getFirstMatch(a,e)||n.default.getFirstMatch(/(?:Maxthon|mxios)[\s/](\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/epiphany/i],describe:function(e){var t={name:"Epiphany"},r=n.default.getFirstMatch(a,e)||n.default.getFirstMatch(/(?:epiphany)[\s/](\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/puffin/i],describe:function(e){var t={name:"Puffin"},r=n.default.getFirstMatch(a,e)||n.default.getFirstMatch(/(?:puffin)[\s/](\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/sleipnir/i],describe:function(e){var t={name:"Sleipnir"},r=n.default.getFirstMatch(a,e)||n.default.getFirstMatch(/(?:sleipnir)[\s/](\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/k-meleon/i],describe:function(e){var t={name:"K-Meleon"},r=n.default.getFirstMatch(a,e)||n.default.getFirstMatch(/(?:k-meleon)[\s/](\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/micromessenger/i],describe:function(e){var t={name:"WeChat"},r=n.default.getFirstMatch(/(?:micromessenger)[\s/](\d+(\.?_?\d+)+)/i,e)||n.default.getFirstMatch(a,e);return r&&(t.version=r),t}},{test:[/qqbrowser/i],describe:function(e){var t={name:/qqbrowserlite/i.test(e)?"QQ Browser Lite":"QQ Browser"},r=n.default.getFirstMatch(/(?:qqbrowserlite|qqbrowser)[/](\d+(\.?_?\d+)+)/i,e)||n.default.getFirstMatch(a,e);return r&&(t.version=r),t}},{test:[/msie|trident/i],describe:function(e){var t={name:"Internet Explorer"},r=n.default.getFirstMatch(/(?:msie |rv:)(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/\sedg\//i],describe:function(e){var t={name:"Microsoft Edge"},r=n.default.getFirstMatch(/\sedg\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/edg([ea]|ios)/i],describe:function(e){var t={name:"Microsoft Edge"},r=n.default.getSecondMatch(/edg([ea]|ios)\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/vivaldi/i],describe:function(e){var t={name:"Vivaldi"},r=n.default.getFirstMatch(/vivaldi\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/seamonkey/i],describe:function(e){var t={name:"SeaMonkey"},r=n.default.getFirstMatch(/seamonkey\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/sailfish/i],describe:function(e){var t={name:"Sailfish"},r=n.default.getFirstMatch(/sailfish\s?browser\/(\d+(\.\d+)?)/i,e);return r&&(t.version=r),t}},{test:[/silk/i],describe:function(e){var t={name:"Amazon Silk"},r=n.default.getFirstMatch(/silk\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/phantom/i],describe:function(e){var t={name:"PhantomJS"},r=n.default.getFirstMatch(/phantomjs\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/slimerjs/i],describe:function(e){var t={name:"SlimerJS"},r=n.default.getFirstMatch(/slimerjs\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/blackberry|\bbb\d+/i,/rim\stablet/i],describe:function(e){var t={name:"BlackBerry"},r=n.default.getFirstMatch(a,e)||n.default.getFirstMatch(/blackberry[\d]+\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/(web|hpw)[o0]s/i],describe:function(e){var t={name:"WebOS Browser"},r=n.default.getFirstMatch(a,e)||n.default.getFirstMatch(/w(?:eb)?[o0]sbrowser\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/bada/i],describe:function(e){var t={name:"Bada"},r=n.default.getFirstMatch(/dolfin\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/tizen/i],describe:function(e){var t={name:"Tizen"},r=n.default.getFirstMatch(/(?:tizen\s?)?browser\/(\d+(\.?_?\d+)+)/i,e)||n.default.getFirstMatch(a,e);return r&&(t.version=r),t}},{test:[/qupzilla/i],describe:function(e){var t={name:"QupZilla"},r=n.default.getFirstMatch(/(?:qupzilla)[\s/](\d+(\.?_?\d+)+)/i,e)||n.default.getFirstMatch(a,e);return r&&(t.version=r),t}},{test:[/librewolf/i],describe:function(e){var t={name:"LibreWolf"},r=n.default.getFirstMatch(/(?:librewolf)[\s/](\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/firefox|iceweasel|fxios/i],describe:function(e){var t={name:"Firefox"},r=n.default.getFirstMatch(/(?:firefox|iceweasel|fxios)[\s/](\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/electron/i],describe:function(e){var t={name:"Electron"},r=n.default.getFirstMatch(/(?:electron)\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/sogoumobilebrowser/i,/metasr/i,/se 2\.[x]/i],describe:function(e){var t={name:"Sogou Browser"},r=n.default.getFirstMatch(/(?:sogoumobilebrowser)[\s/](\d+(\.?_?\d+)+)/i,e),i=n.default.getFirstMatch(/(?:chrome|crios|crmo)\/(\d+(\.?_?\d+)+)/i,e),a=n.default.getFirstMatch(/se ([\d.]+)x/i,e),o=r||i||a;return o&&(t.version=o),t}},{test:[/MiuiBrowser/i],describe:function(e){var t={name:"Miui"},r=n.default.getFirstMatch(/(?:MiuiBrowser)[\s/](\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/chromium/i],describe:function(e){var t={name:"Chromium"},r=n.default.getFirstMatch(/(?:chromium)[\s/](\d+(\.?_?\d+)+)/i,e)||n.default.getFirstMatch(a,e);return r&&(t.version=r),t}},{test:[/chrome|crios|crmo/i],describe:function(e){var t={name:"Chrome"},r=n.default.getFirstMatch(/(?:chrome|crios|crmo)\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/GSA/i],describe:function(e){var t={name:"Google Search"},r=n.default.getFirstMatch(/(?:GSA)\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:function(e){var t=!e.test(/like android/i),r=e.test(/android/i);return t&&r},describe:function(e){var t={name:"Android Browser"},r=n.default.getFirstMatch(a,e);return r&&(t.version=r),t}},{test:[/playstation 4/i],describe:function(e){var t={name:"PlayStation 4"},r=n.default.getFirstMatch(a,e);return r&&(t.version=r),t}},{test:[/safari|applewebkit/i],describe:function(e){var t={name:"Safari"},r=n.default.getFirstMatch(a,e);return r&&(t.version=r),t}},{test:[/.*/i],describe:function(e){var t=-1!==e.search("\\(")?/^(.*)\/(.*)[ \t]\((.*)/:/^(.*)\/(.*) /;return {name:n.default.getFirstMatch(t,e),version:n.default.getSecondMatch(t,e)}}}];t.default=o,e.exports=t.default;},93:function(e,t,r){t.__esModule=true,t.default=void 0;var i,n=(i=r(17))&&i.__esModule?i:{default:i},a=r(18);var o=[{test:[/Roku\/DVP/],describe:function(e){var t=n.default.getFirstMatch(/Roku\/DVP-(\d+\.\d+)/i,e);return {name:a.OS_MAP.Roku,version:t}}},{test:[/windows phone/i],describe:function(e){var t=n.default.getFirstMatch(/windows phone (?:os)?\s?(\d+(\.\d+)*)/i,e);return {name:a.OS_MAP.WindowsPhone,version:t}}},{test:[/windows /i],describe:function(e){var t=n.default.getFirstMatch(/Windows ((NT|XP)( \d\d?.\d)?)/i,e),r=n.default.getWindowsVersionName(t);return {name:a.OS_MAP.Windows,version:t,versionName:r}}},{test:[/Macintosh(.*?) FxiOS(.*?)\//],describe:function(e){var t={name:a.OS_MAP.iOS},r=n.default.getSecondMatch(/(Version\/)(\d[\d.]+)/,e);return r&&(t.version=r),t}},{test:[/macintosh/i],describe:function(e){var t=n.default.getFirstMatch(/mac os x (\d+(\.?_?\d+)+)/i,e).replace(/[_\s]/g,"."),r=n.default.getMacOSVersionName(t),i={name:a.OS_MAP.MacOS,version:t};return r&&(i.versionName=r),i}},{test:[/(ipod|iphone|ipad)/i],describe:function(e){var t=n.default.getFirstMatch(/os (\d+([_\s]\d+)*) like mac os x/i,e).replace(/[_\s]/g,".");return {name:a.OS_MAP.iOS,version:t}}},{test:[/OpenHarmony/i],describe:function(e){var t=n.default.getFirstMatch(/OpenHarmony\s+(\d+(\.\d+)*)/i,e);return {name:a.OS_MAP.HarmonyOS,version:t}}},{test:function(e){var t=!e.test(/like android/i),r=e.test(/android/i);return t&&r},describe:function(e){var t=n.default.getFirstMatch(/android[\s/-](\d+(\.\d+)*)/i,e),r=n.default.getAndroidVersionName(t),i={name:a.OS_MAP.Android,version:t};return r&&(i.versionName=r),i}},{test:[/(web|hpw)[o0]s/i],describe:function(e){var t=n.default.getFirstMatch(/(?:web|hpw)[o0]s\/(\d+(\.\d+)*)/i,e),r={name:a.OS_MAP.WebOS};return t&&t.length&&(r.version=t),r}},{test:[/blackberry|\bbb\d+/i,/rim\stablet/i],describe:function(e){var t=n.default.getFirstMatch(/rim\stablet\sos\s(\d+(\.\d+)*)/i,e)||n.default.getFirstMatch(/blackberry\d+\/(\d+([_\s]\d+)*)/i,e)||n.default.getFirstMatch(/\bbb(\d+)/i,e);return {name:a.OS_MAP.BlackBerry,version:t}}},{test:[/bada/i],describe:function(e){var t=n.default.getFirstMatch(/bada\/(\d+(\.\d+)*)/i,e);return {name:a.OS_MAP.Bada,version:t}}},{test:[/tizen/i],describe:function(e){var t=n.default.getFirstMatch(/tizen[/\s](\d+(\.\d+)*)/i,e);return {name:a.OS_MAP.Tizen,version:t}}},{test:[/linux/i],describe:function(){return {name:a.OS_MAP.Linux}}},{test:[/CrOS/],describe:function(){return {name:a.OS_MAP.ChromeOS}}},{test:[/PlayStation 4/],describe:function(e){var t=n.default.getFirstMatch(/PlayStation 4[/\s](\d+(\.\d+)*)/i,e);return {name:a.OS_MAP.PlayStation4,version:t}}}];t.default=o,e.exports=t.default;},94:function(e,t,r){t.__esModule=true,t.default=void 0;var i,n=(i=r(17))&&i.__esModule?i:{default:i},a=r(18);var o=[{test:[/googlebot/i],describe:function(){return {type:a.PLATFORMS_MAP.bot,vendor:"Google"}}},{test:[/amazonbot/i],describe:function(){return {type:a.PLATFORMS_MAP.bot,vendor:"Amazon"}}},{test:[/gptbot/i],describe:function(){return {type:a.PLATFORMS_MAP.bot,vendor:"OpenAI"}}},{test:[/chatgpt-user/i],describe:function(){return {type:a.PLATFORMS_MAP.bot,vendor:"OpenAI"}}},{test:[/oai-searchbot/i],describe:function(){return {type:a.PLATFORMS_MAP.bot,vendor:"OpenAI"}}},{test:[/baiduspider/i],describe:function(){return {type:a.PLATFORMS_MAP.bot,vendor:"Baidu"}}},{test:[/bingbot/i],describe:function(){return {type:a.PLATFORMS_MAP.bot,vendor:"Bing"}}},{test:[/duckduckbot/i],describe:function(){return {type:a.PLATFORMS_MAP.bot,vendor:"DuckDuckGo"}}},{test:[/claudebot/i,/claude-web/i,/claude-user/i,/claude-searchbot/i],describe:function(){return {type:a.PLATFORMS_MAP.bot,vendor:"Anthropic"}}},{test:[/omgilibot/i,/webzio-extended/i],describe:function(){return {type:a.PLATFORMS_MAP.bot,vendor:"Webz.io"}}},{test:[/diffbot/i],describe:function(){return {type:a.PLATFORMS_MAP.bot,vendor:"Diffbot"}}},{test:[/perplexitybot/i],describe:function(){return {type:a.PLATFORMS_MAP.bot,vendor:"Perplexity AI"}}},{test:[/perplexity-user/i],describe:function(){return {type:a.PLATFORMS_MAP.bot,vendor:"Perplexity AI"}}},{test:[/youbot/i],describe:function(){return {type:a.PLATFORMS_MAP.bot,vendor:"You.com"}}},{test:[/ia_archiver/i],describe:function(){return {type:a.PLATFORMS_MAP.bot,vendor:"Internet Archive"}}},{test:[/meta-webindexer/i],describe:function(){return {type:a.PLATFORMS_MAP.bot,vendor:"Meta"}}},{test:[/meta-externalads/i],describe:function(){return {type:a.PLATFORMS_MAP.bot,vendor:"Meta"}}},{test:[/meta-externalagent/i],describe:function(){return {type:a.PLATFORMS_MAP.bot,vendor:"Meta"}}},{test:[/meta-externalfetcher/i],describe:function(){return {type:a.PLATFORMS_MAP.bot,vendor:"Meta"}}},{test:[/facebookexternalhit/i,/facebookcatalog/i],describe:function(){return {type:a.PLATFORMS_MAP.bot,vendor:"Meta"}}},{test:[/yahoo/i],describe:function(){return {type:a.PLATFORMS_MAP.bot,vendor:"Yahoo"}}},{test:[/yandexbot/i,/yandexmobilebot/i],describe:function(){return {type:a.PLATFORMS_MAP.bot,vendor:"Yandex"}}},{test:[/pingdom/i],describe:function(){return {type:a.PLATFORMS_MAP.bot,vendor:"Pingdom"}}},{test:[/huawei/i],describe:function(e){var t=n.default.getFirstMatch(/(can-l01)/i,e)&&"Nova",r={type:a.PLATFORMS_MAP.mobile,vendor:"Huawei"};return t&&(r.model=t),r}},{test:[/nexus\s*(?:7|8|9|10).*/i],describe:function(){return {type:a.PLATFORMS_MAP.tablet,vendor:"Nexus"}}},{test:[/ipad/i],describe:function(){return {type:a.PLATFORMS_MAP.tablet,vendor:"Apple",model:"iPad"}}},{test:[/Macintosh(.*?) FxiOS(.*?)\//],describe:function(){return {type:a.PLATFORMS_MAP.tablet,vendor:"Apple",model:"iPad"}}},{test:[/kftt build/i],describe:function(){return {type:a.PLATFORMS_MAP.tablet,vendor:"Amazon",model:"Kindle Fire HD 7"}}},{test:[/silk/i],describe:function(){return {type:a.PLATFORMS_MAP.tablet,vendor:"Amazon"}}},{test:[/tablet(?! pc)/i],describe:function(){return {type:a.PLATFORMS_MAP.tablet}}},{test:function(e){var t=e.test(/ipod|iphone/i),r=e.test(/like (ipod|iphone)/i);return t&&!r},describe:function(e){var t=n.default.getFirstMatch(/(ipod|iphone)/i,e);return {type:a.PLATFORMS_MAP.mobile,vendor:"Apple",model:t}}},{test:[/nexus\s*[0-6].*/i,/galaxy nexus/i],describe:function(){return {type:a.PLATFORMS_MAP.mobile,vendor:"Nexus"}}},{test:[/Nokia/i],describe:function(e){var t=n.default.getFirstMatch(/Nokia\s+([0-9]+(\.[0-9]+)?)/i,e),r={type:a.PLATFORMS_MAP.mobile,vendor:"Nokia"};return t&&(r.model=t),r}},{test:[/[^-]mobi/i],describe:function(){return {type:a.PLATFORMS_MAP.mobile}}},{test:function(e){return "blackberry"===e.getBrowserName(true)},describe:function(){return {type:a.PLATFORMS_MAP.mobile,vendor:"BlackBerry"}}},{test:function(e){return "bada"===e.getBrowserName(true)},describe:function(){return {type:a.PLATFORMS_MAP.mobile}}},{test:function(e){return "windows phone"===e.getBrowserName()},describe:function(){return {type:a.PLATFORMS_MAP.mobile,vendor:"Microsoft"}}},{test:function(e){var t=Number(String(e.getOSVersion()).split(".")[0]);return "android"===e.getOSName(true)&&t>=3},describe:function(){return {type:a.PLATFORMS_MAP.tablet}}},{test:function(e){return "android"===e.getOSName(true)},describe:function(){return {type:a.PLATFORMS_MAP.mobile}}},{test:function(e){return "macos"===e.getOSName(true)},describe:function(){return {type:a.PLATFORMS_MAP.desktop,vendor:"Apple"}}},{test:function(e){return "windows"===e.getOSName(true)},describe:function(){return {type:a.PLATFORMS_MAP.desktop}}},{test:function(e){return "linux"===e.getOSName(true)},describe:function(){return {type:a.PLATFORMS_MAP.desktop}}},{test:function(e){return "playstation 4"===e.getOSName(true)},describe:function(){return {type:a.PLATFORMS_MAP.tv}}},{test:function(e){return "roku"===e.getOSName(true)},describe:function(){return {type:a.PLATFORMS_MAP.tv}}}];t.default=o,e.exports=t.default;},95:function(e,t,r){t.__esModule=true,t.default=void 0;var i,n=(i=r(17))&&i.__esModule?i:{default:i},a=r(18);var o=[{test:function(e){return "microsoft edge"===e.getBrowserName(true)},describe:function(e){if(/\sedg\//i.test(e))return {name:a.ENGINE_MAP.Blink};var t=n.default.getFirstMatch(/edge\/(\d+(\.?_?\d+)+)/i,e);return {name:a.ENGINE_MAP.EdgeHTML,version:t}}},{test:[/trident/i],describe:function(e){var t={name:a.ENGINE_MAP.Trident},r=n.default.getFirstMatch(/trident\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:function(e){return e.test(/presto/i)},describe:function(e){var t={name:a.ENGINE_MAP.Presto},r=n.default.getFirstMatch(/presto\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:function(e){var t=e.test(/gecko/i),r=e.test(/like gecko/i);return t&&!r},describe:function(e){var t={name:a.ENGINE_MAP.Gecko},r=n.default.getFirstMatch(/gecko\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/(apple)?webkit\/537\.36/i],describe:function(){return {name:a.ENGINE_MAP.Blink}}},{test:[/(apple)?webkit/i],describe:function(e){var t={name:a.ENGINE_MAP.WebKit},r=n.default.getFirstMatch(/webkit\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}}];t.default=o,e.exports=t.default;}})}));
|
|
50
|
+
} (es5$1));
|
|
51
|
+
return es5$1.exports;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
var es5Exports = requireEs5();
|
|
55
|
+
var Bowser = /*@__PURE__*/getDefaultExportFromCjs(es5Exports);
|
|
56
|
+
|
|
57
|
+
const mbCrosswordCss = () => `*[part=main]{position:relative;display:grid;grid-template-areas:"board" "clues";grid-template-columns:1fr}@media (min-width: 768px){*[part=main]{grid-template-areas:"clues board" "clues .";grid-template-columns:1fr 1fr}*[part=main].--only-board{grid-template-columns:1fr;grid-template-areas:"board"}}*[part=main].--focused{background:lightgrey}*[part=main] input.dummy{pointer-events:none;opacity:0;grid-area:board;border:none;outline:none}[part=clues]{grid-area:clues;display:grid;grid-template-columns:1fr 1fr;gap:16px}[part=clues].oneList{grid-template-columns:1fr}[part=clue-list]{margin:0;padding:0}[part=clue].--current{background:var(--clue-current-background, lightcyan)}[part=clue] .preview{font-weight:bold;letter-spacing:0.2em;text-align:center;display:block;text-transform:uppercase}li[part=clue]{--_clue-padding:var(--clue-padding, .5em);border-radius:var(--clue-radius, 0.5em);padding:var(--_clue-padding);list-style-position:inside;padding-left:calc(1em + var(--_clue-padding));text-indent:-1em;margin:0}[part=board]{grid-area:board;display:block;position:relative;container-type:size;background:var(--board-background, darkgoldenrod);--_cell-border-width:var(--cell-border-width, 2px);--cell-width-temp:calc((100cqw - var(--_cell-border-width)) / var(--board-width, 10));--cell-width:var(--cell-width-temp);--cell-width:round(var(--cell-width-temp), 1px)}[part=cell]{display:block;color:var(--cell-color, #11138d);width:calc(var(--cell-width) - var(--_cell-border-width));aspect-ratio:1;background:var(--cell-background, #d9d9d9);position:absolute;container-type:size;top:calc(var(--y, 0) * var(--cell-width));left:calc(var(--x, 0) * var(--cell-width));border:var(--_cell-border-width) solid var(--cell-border-color, red)}[part=cell].--alt{background:var(--cell-background-alt, #999)}[part=cell].--in-current-clue{box-shadow:inset 0 0 2px 2px var(--cell-selected-background, lightblue)}[part=cell].--selected{background:var(--cell-selected-background, lightblue)}[part=cell].--special{background:var(--cell-special-background, lightgreen)}[part=cell].--special.--selected:before{content:"";background:var(--cell-selected-background, lightblue);position:absolute;top:0;left:0;right:0;bottom:0;clip-path:polygon(100% 0, 100% 100%, 50% 100%)}[part=cell] ._inner{position:absolute;top:0;left:0;right:0;bottom:0;display:grid;place-content:center;text-transform:uppercase;font-size:80cqh}[part=preview]{display:none}[part=special-border]{display:block;background:black;position:absolute;z-index:100;--s-border:max(2px, var(--_cell-border-width))}[part=special-border].left,[part=special-border].right{width:var(--s-border);height:calc(var(--cell-width) - var(--_cell-border-width));top:calc(var(--y, 0) * var(--cell-width) + var(--_cell-border-width))}[part=special-border].left{left:calc(var(--x, 0) * var(--cell-width) - var(--s-border) / 2)}[part=special-border].right{left:calc((var(--x, 0) + 1) * var(--cell-width) - var(--s-border) / 2)}[part=special-border].top,[part=special-border].bottom{width:calc(var(--cell-width) - var(--_cell-border-width));height:var(--s-border);left:calc(var(--x, 0) * var(--cell-width) + var(--_cell-border-width))}[part=special-border].top{top:calc(var(--y, 0) * var(--cell-width))}[part=special-border].bottom{top:calc((var(--y, 0) + 1) * var(--cell-width))}[part=label]{display:grid;position:absolute;container-type:size;top:calc(var(--y, 0) * var(--cell-width));left:calc(var(--x, 0) * var(--cell-width));width:calc(var(--cell-width) - var(--_cell-border-width));aspect-ratio:1;border:var(--_cell-border-width) solid transparent;--label-place-content:center end}[part=label] ._inner{position:absolute;top:var(--label-padding, 10cqh);left:var(--label-padding, 10cqh);right:var(--label-padding, 10cqh);bottom:var(--label-padding, 10cqh);display:grid;place-content:var(--label-place-content, center);text-transform:uppercase;font-size:var(--label-font-size, 60cqh)}[part=floating-clue]{position:fixed;color:white;left:0;right:0;bottom:0;--_background:var(--floating-clue-background, blue)}[part=floating-clue] .floating-clue__text{padding:8px;background:var(--_background)}[part=floating-clue] .floating-clue__preview{display:inline-block;padding:8px;background:var(--_background);font-weight:bold;letter-spacing:0.2em;text-transform:uppercase;border-radius:0 16px 0 0}[part=floating-clue] .floating-clue__preview span{display:inline-block;width:1em;text-align:center}.--sticky-bottom-hack [part=floating-clue]{top:var(--height);top:calc(var(--height) + var(--offsetTop));bottom:unset;transform:translate(0, -100%)}@media (orientation: landscape){.--sticky-bottom-hack [part=floating-clue]{top:calc(var(--height) + var(--offsetTop))}}`;
|
|
36
58
|
|
|
37
59
|
const MBCrossword = class {
|
|
38
60
|
constructor(hostRef) {
|
|
@@ -51,11 +73,20 @@ const MBCrossword = class {
|
|
|
51
73
|
currentClue = null;
|
|
52
74
|
isFocused = false;
|
|
53
75
|
selectedCell = null;
|
|
76
|
+
bowserParser = Bowser.getParser(typeof window !== 'undefined' ? window.navigator.userAgent : 'unknown');
|
|
77
|
+
abortController = new AbortController();
|
|
54
78
|
componentWillLoad() {
|
|
55
|
-
console.log('componentWillLoad', this.init, this.data);
|
|
56
79
|
if (this.init && this.data) {
|
|
57
80
|
this.initGame();
|
|
58
81
|
}
|
|
82
|
+
if (this.useStickyBottomHack && typeof window !== 'undefined') {
|
|
83
|
+
window.visualViewport.addEventListener('resize', this.updateFloatingPreview.bind(this), { signal: this.abortController.signal });
|
|
84
|
+
window.visualViewport.addEventListener('scroll', this.updateFloatingPreview.bind(this), { signal: this.abortController.signal });
|
|
85
|
+
this.updateFloatingPreview();
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
disconnectedCallback() {
|
|
89
|
+
this.abortController.abort();
|
|
59
90
|
}
|
|
60
91
|
watchData() {
|
|
61
92
|
if (this.init && this.data) {
|
|
@@ -69,7 +100,6 @@ const MBCrossword = class {
|
|
|
69
100
|
];
|
|
70
101
|
}
|
|
71
102
|
async initGame(data = this.data) {
|
|
72
|
-
console.log('initGame');
|
|
73
103
|
if (!data.words) {
|
|
74
104
|
throw new Error('Words definition missing');
|
|
75
105
|
}
|
|
@@ -94,10 +124,6 @@ const MBCrossword = class {
|
|
|
94
124
|
}
|
|
95
125
|
async checkAnswer() {
|
|
96
126
|
const cells = this.cells.filter(c => !c.isBlocked);
|
|
97
|
-
console.log(cells);
|
|
98
|
-
cells.forEach(c => {
|
|
99
|
-
console.log(`${c.value} === ${c.answer}`, `${c.x},${c.y}`, c.value === c.answer);
|
|
100
|
-
});
|
|
101
127
|
return cells.every(c => c.value === c.answer);
|
|
102
128
|
}
|
|
103
129
|
specialBorders = [];
|
|
@@ -106,6 +132,18 @@ const MBCrossword = class {
|
|
|
106
132
|
boardWidth = 0;
|
|
107
133
|
boardHeight = 0;
|
|
108
134
|
cells = [];
|
|
135
|
+
useStickyBottomHack = this.bowserParser.isOS('ios');
|
|
136
|
+
floatingPreviewHackParams = {
|
|
137
|
+
height: 0,
|
|
138
|
+
offsetTop: 0
|
|
139
|
+
};
|
|
140
|
+
updateFloatingPreview(_event) {
|
|
141
|
+
this.floatingPreviewHackParams = {
|
|
142
|
+
...this.floatingPreviewHackParams,
|
|
143
|
+
height: window.visualViewport.height,
|
|
144
|
+
offsetTop: window.visualViewport.offsetTop
|
|
145
|
+
};
|
|
146
|
+
}
|
|
109
147
|
buildBoard() {
|
|
110
148
|
let boardWidth = 0;
|
|
111
149
|
let boardHeight = 0;
|
|
@@ -268,10 +306,10 @@ const MBCrossword = class {
|
|
|
268
306
|
}
|
|
269
307
|
onFocusin() {
|
|
270
308
|
this.isFocused = true;
|
|
271
|
-
if (!this.currentClueId) {
|
|
272
|
-
|
|
273
|
-
}
|
|
274
|
-
this.textInput.focus();
|
|
309
|
+
// if (!this.currentClueId) {
|
|
310
|
+
// this.currentClueId = this.allWords[0]?.id ?? null;
|
|
311
|
+
// }
|
|
312
|
+
// this.textInput.focus();
|
|
275
313
|
}
|
|
276
314
|
onFocusOut() {
|
|
277
315
|
this.isFocused = false;
|
|
@@ -401,10 +439,15 @@ const MBCrossword = class {
|
|
|
401
439
|
const hasHWords = Boolean(this.hWords.length);
|
|
402
440
|
const hideList = this.clueListStyle === 'none';
|
|
403
441
|
const twoLists = hasHWords && hasVWords;
|
|
404
|
-
|
|
442
|
+
const showFloatingClue = this.isFocused && this.currentClue && this.bowserParser.isPlatform('mobile');
|
|
443
|
+
return h("div", { key: 'b18bbd3453ad8c96cf6b5f04903380b0357d5842', part: "main", class: {
|
|
405
444
|
"--focused": this.isFocused,
|
|
406
|
-
"--only-board": hideList
|
|
407
|
-
|
|
445
|
+
"--only-board": hideList,
|
|
446
|
+
"--sticky-bottom-hack": this.useStickyBottomHack
|
|
447
|
+
}, onFocusin: this.onFocusin.bind(this), onFocusout: this.onFocusOut.bind(this), onClick: () => {
|
|
448
|
+
this.textInput.blur();
|
|
449
|
+
this.textInput.focus();
|
|
450
|
+
} }, h("input", { key: '59e427026f09803d1077d1c36f95284fe8d1b8ae', type: "text", class: "dummy", ref: (el) => this.textInput = el, onKeyDown: this.onKeyPress.bind(this), onInput: this.onInput.bind(this) }), hideList ? '' : h("div", { part: "clues", class: {
|
|
408
451
|
twoLists,
|
|
409
452
|
oneList: !twoLists
|
|
410
453
|
} }, hasHWords ? h(ClueList, { type: this.clueListStyle }, this.hWords.map(w => {
|
|
@@ -413,7 +456,7 @@ const MBCrossword = class {
|
|
|
413
456
|
})) : '', hasVWords ? h(ClueList, { type: this.clueListStyle }, this.vWords.map(w => {
|
|
414
457
|
const isCurrent = w.id === this.currentClueId;
|
|
415
458
|
return h(Clue, { showPreview: this.showCluePreview, preview: this.getCluePreview(w), word: w, isCurrent: isCurrent, onPointerDown: () => this.selectClue(w.id), tagName: this.clueListStyle === 'ol' ? 'li' : undefined });
|
|
416
|
-
})) : ''), h("div", { key: '
|
|
459
|
+
})) : ''), h("div", { key: 'a4803d792f38119e3ba78584acdbb0db677b4869', part: "board", style: {
|
|
417
460
|
'--board-width': `${this.boardWidth}`,
|
|
418
461
|
'grid-template-columns': `repeat(${this.boardWidth}, 1fr)`,
|
|
419
462
|
aspectRatio: `${this.boardWidth / this.boardHeight}`
|
|
@@ -437,7 +480,12 @@ const MBCrossword = class {
|
|
|
437
480
|
"--x": `${label.x}`,
|
|
438
481
|
"--y": `${label.y}`
|
|
439
482
|
}, onPointerDown: () => this.selectClue(label.clueId) }, h("div", { class: "_inner" }, label.text));
|
|
440
|
-
}))
|
|
483
|
+
})), showFloatingClue ? h("div", { part: "floating-clue", style: {
|
|
484
|
+
"--height": `${this.floatingPreviewHackParams.height}px`,
|
|
485
|
+
"--offsetTop": `${this.floatingPreviewHackParams.offsetTop}px`
|
|
486
|
+
} }, h("div", { class: "floating-clue__preview" }, Array.from(this.getCluePreview(this.currentClue)).map((c, index) => {
|
|
487
|
+
return h("span", { key: index }, c);
|
|
488
|
+
})), h("div", { class: "floating-clue__text" }, this.currentClue?.clue ?? '')) : '');
|
|
441
489
|
}
|
|
442
490
|
static get delegatesFocus() { return true; }
|
|
443
491
|
static get watchers() { return {
|
package/dist/esm/mb-crossword.js
CHANGED
|
@@ -17,5 +17,5 @@ var patchBrowser = () => {
|
|
|
17
17
|
|
|
18
18
|
patchBrowser().then(async (options) => {
|
|
19
19
|
await globalScripts();
|
|
20
|
-
return bootstrapLazy([["mb-crossword",[[529,"mb-crossword",{"init":[4],"data":[16],"showCluePreview":[4,"show-clue-preview"],"clueListStyle":[1,"clue-list-style"],"hWords":[32],"vWords":[32],"currentClueId":[32],"currentClue":[32],"isFocused":[32],"selectedCell":[32],"specialBorders":[32],"specialCells":[32],"labels":[32],"boardWidth":[32],"boardHeight":[32],"cells":[32],"initGame":[64],"checkAnswer":[64],"selectClue":[64]},null,{"data":[{"watchData":0}]}]]]], options);
|
|
20
|
+
return bootstrapLazy([["mb-crossword",[[529,"mb-crossword",{"init":[4],"data":[16],"showCluePreview":[4,"show-clue-preview"],"clueListStyle":[1,"clue-list-style"],"hWords":[32],"vWords":[32],"currentClueId":[32],"currentClue":[32],"isFocused":[32],"selectedCell":[32],"specialBorders":[32],"specialCells":[32],"labels":[32],"boardWidth":[32],"boardHeight":[32],"cells":[32],"floatingPreviewHackParams":[32],"initGame":[64],"checkAnswer":[64],"selectClue":[64]},null,{"data":[{"watchData":0}]}]]]], options);
|
|
21
21
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{p as e,b as t}from"./p-Dcm4tLi7.js";export{s as setNonce}from"./p-Dcm4tLi7.js";import{g as
|
|
1
|
+
import{p as e,b as t}from"./p-Dcm4tLi7.js";export{s as setNonce}from"./p-Dcm4tLi7.js";import{g as a}from"./p-DQuL1Twl.js";(()=>{const s=import.meta.url,t={};return""!==s&&(t.resourcesUrl=new URL(".",s).href),e(t)})().then((async e=>(await a(),t([["p-a8347a29",[[529,"mb-crossword",{init:[4],data:[16],showCluePreview:[4,"show-clue-preview"],clueListStyle:[1,"clue-list-style"],hWords:[32],vWords:[32],currentClueId:[32],currentClue:[32],isFocused:[32],selectedCell:[32],specialBorders:[32],specialCells:[32],labels:[32],boardWidth:[32],boardHeight:[32],cells:[32],floatingPreviewHackParams:[32],initGame:[64],checkAnswer:[64],selectClue:[64]},null,{data:[{watchData:0}]}]]]],e))));
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{h as e,r as t,c as r,f as i}from"./p-Dcm4tLi7.js";import{V as n,a as o,i as a,b as s}from"./p-Dn3GSx6U.js";function c({isCurrent:t,word:r,onPointerDown:i,preview:n,showPreview:o,tagName:a}){return e(a??"div",{role:"button",onPointerDown:i,part:"clue",class:{"--current":t}},r.clue,o&&e("span",{class:"preview"},n))}function u({data:t,isInCurrentClue:r,isSelected:i,isSpecial:n,onPointerDown:o}){return e("div",{onPointerDown:o,part:"cell",class:{"--blocked":t.isBlocked,"--in-current-clue":r,"--selected":i,"--alt":!((t.x+t.y)%2),"--special":n},style:{"--x":`${t.x}`,"--y":`${t.y}`}},e("div",{class:"_inner",style:{position:"absolute",width:"100%"}},t.value))}const d=({type:t},r)=>"p"===t?e("p",{part:"clue-list"},r.map(((t,r)=>e("p",{key:r},t)))):"ol"===t?e("ol",{part:"clue-list"},r):void 0;function l(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var h,f={exports:{}},b=l((h||(h=1,f.exports=function(e){var t={};function r(i){if(t[i])return t[i].exports;var n=t[i]={i,l:!1,exports:{}};return e[i].call(n.exports,n,n.exports,r),n.l=!0,n.exports}return r.m=e,r.c=t,r.d=function(e,t,i){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:i})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var i=Object.create(null);if(r.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var n in e)r.d(i,n,function(t){return e[t]}.bind(null,n));return i},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=90)}({17:function(e,t,r){t.__esModule=!0,t.default=void 0;var i=r(18),n=function(){function e(){}return e.getFirstMatch=function(e,t){var r=t.match(e);return r&&r.length>0&&r[1]||""},e.getSecondMatch=function(e,t){var r=t.match(e);return r&&r.length>1&&r[2]||""},e.matchAndReturnConst=function(e,t,r){if(e.test(t))return r},e.getWindowsVersionName=function(e){switch(e){case"NT":return"NT";case"XP":case"NT 5.1":return"XP";case"NT 5.0":return"2000";case"NT 5.2":return"2003";case"NT 6.0":return"Vista";case"NT 6.1":return"7";case"NT 6.2":return"8";case"NT 6.3":return"8.1";case"NT 10.0":return"10";default:return}},e.getMacOSVersionName=function(e){var t=e.split(".").splice(0,2).map((function(e){return parseInt(e,10)||0}));t.push(0);var r=t[0];if(10===r)switch(t[1]){case 5:return"Leopard";case 6:return"Snow Leopard";case 7:return"Lion";case 8:return"Mountain Lion";case 9:return"Mavericks";case 10:return"Yosemite";case 11:return"El Capitan";case 12:return"Sierra";case 13:return"High Sierra";case 14:return"Mojave";case 15:return"Catalina";default:return}switch(r){case 11:return"Big Sur";case 12:return"Monterey";case 13:return"Ventura";case 14:return"Sonoma";case 15:return"Sequoia";default:return}},e.getAndroidVersionName=function(e){var t=e.split(".").splice(0,2).map((function(e){return parseInt(e,10)||0}));if(t.push(0),!(1===t[0]&&t[1]<5))return 1===t[0]&&t[1]<6?"Cupcake":1===t[0]&&t[1]>=6?"Donut":2===t[0]&&t[1]<2?"Eclair":2===t[0]&&2===t[1]?"Froyo":2===t[0]&&t[1]>2?"Gingerbread":3===t[0]?"Honeycomb":4===t[0]&&t[1]<1?"Ice Cream Sandwich":4===t[0]&&t[1]<4?"Jelly Bean":4===t[0]&&t[1]>=4?"KitKat":5===t[0]?"Lollipop":6===t[0]?"Marshmallow":7===t[0]?"Nougat":8===t[0]?"Oreo":9===t[0]?"Pie":void 0},e.getVersionPrecision=function(e){return e.split(".").length},e.compareVersions=function(t,r,i){void 0===i&&(i=!1);var n=e.getVersionPrecision(t),o=e.getVersionPrecision(r),a=Math.max(n,o),s=0,c=e.map([t,r],(function(t){var r=a-e.getVersionPrecision(t),i=t+new Array(r+1).join(".0");return e.map(i.split("."),(function(e){return new Array(20-e.length).join("0")+e})).reverse()}));for(i&&(s=a-Math.min(n,o)),a-=1;a>=s;){if(c[0][a]>c[1][a])return 1;if(c[0][a]===c[1][a]){if(a===s)return 0;a-=1}else if(c[0][a]<c[1][a])return-1}},e.map=function(e,t){var r,i=[];if(Array.prototype.map)return Array.prototype.map.call(e,t);for(r=0;r<e.length;r+=1)i.push(t(e[r]));return i},e.find=function(e,t){var r,i;if(Array.prototype.find)return Array.prototype.find.call(e,t);for(r=0,i=e.length;r<i;r+=1){var n=e[r];if(t(n,r))return n}},e.assign=function(e){for(var t,r,i=e,n=arguments.length,o=new Array(n>1?n-1:0),a=1;a<n;a++)o[a-1]=arguments[a];if(Object.assign)return Object.assign.apply(Object,[e].concat(o));var s=function(){var e=o[t];"object"==typeof e&&null!==e&&Object.keys(e).forEach((function(t){i[t]=e[t]}))};for(t=0,r=o.length;t<r;t+=1)s();return e},e.getBrowserAlias=function(e){return i.BROWSER_ALIASES_MAP[e]},e.getBrowserTypeByAlias=function(e){return i.BROWSER_MAP[e]||""},e}();t.default=n,e.exports=t.default},18:function(e,t){t.__esModule=!0,t.ENGINE_MAP=t.OS_MAP=t.PLATFORMS_MAP=t.BROWSER_MAP=t.BROWSER_ALIASES_MAP=void 0,t.BROWSER_ALIASES_MAP={AmazonBot:"amazonbot","Amazon Silk":"amazon_silk","Android Browser":"android",BaiduSpider:"baiduspider",Bada:"bada",BingCrawler:"bingcrawler",BlackBerry:"blackberry","ChatGPT-User":"chatgpt_user",Chrome:"chrome",ClaudeBot:"claudebot",Chromium:"chromium",Diffbot:"diffbot",DuckDuckBot:"duckduckbot",Electron:"electron",Epiphany:"epiphany",FacebookExternalHit:"facebookexternalhit",Firefox:"firefox",Focus:"focus",Generic:"generic","Google Search":"google_search",Googlebot:"googlebot",GPTBot:"gptbot","Internet Explorer":"ie",InternetArchiveCrawler:"internetarchivecrawler","K-Meleon":"k_meleon",LibreWolf:"librewolf",Maxthon:"maxthon","Meta-ExternalAds":"meta_externalads","Meta-ExternalAgent":"meta_externalagent","Meta-ExternalFetcher":"meta_externalfetcher","Meta-WebIndexer":"meta_webindexer","Microsoft Edge":"edge","MZ Browser":"mz","NAVER Whale Browser":"naver","OAI-SearchBot":"oai_searchbot",Omgilibot:"omgilibot",Opera:"opera","Opera Coast":"opera_coast","Pale Moon":"pale_moon",PerplexityBot:"perplexitybot","Perplexity-User":"perplexity_user",PhantomJS:"phantomjs",PingdomBot:"pingdombot",Puffin:"puffin",QQ:"qq",QQLite:"qqlite",QupZilla:"qupzilla",Roku:"roku",Safari:"safari",Sailfish:"sailfish","Samsung Internet for Android":"samsung_internet",SeaMonkey:"seamonkey",Sleipnir:"sleipnir","Sogou Browser":"sogou",Swing:"swing",Tizen:"tizen","UC Browser":"uc",Vivaldi:"vivaldi","WebOS Browser":"webos",WeChat:"wechat",YahooSlurp:"yahooslurp","Yandex Browser":"yandex",YandexBot:"yandexbot",YouBot:"youbot"},t.BROWSER_MAP={amazonbot:"AmazonBot",amazon_silk:"Amazon Silk",android:"Android Browser",baiduspider:"BaiduSpider",bada:"Bada",bingcrawler:"BingCrawler",blackberry:"BlackBerry",chatgpt_user:"ChatGPT-User",chrome:"Chrome",claudebot:"ClaudeBot",chromium:"Chromium",diffbot:"Diffbot",duckduckbot:"DuckDuckBot",edge:"Microsoft Edge",electron:"Electron",epiphany:"Epiphany",facebookexternalhit:"FacebookExternalHit",firefox:"Firefox",focus:"Focus",generic:"Generic",google_search:"Google Search",googlebot:"Googlebot",gptbot:"GPTBot",ie:"Internet Explorer",internetarchivecrawler:"InternetArchiveCrawler",k_meleon:"K-Meleon",librewolf:"LibreWolf",maxthon:"Maxthon",meta_externalads:"Meta-ExternalAds",meta_externalagent:"Meta-ExternalAgent",meta_externalfetcher:"Meta-ExternalFetcher",meta_webindexer:"Meta-WebIndexer",mz:"MZ Browser",naver:"NAVER Whale Browser",oai_searchbot:"OAI-SearchBot",omgilibot:"Omgilibot",opera:"Opera",opera_coast:"Opera Coast",pale_moon:"Pale Moon",perplexitybot:"PerplexityBot",perplexity_user:"Perplexity-User",phantomjs:"PhantomJS",pingdombot:"PingdomBot",puffin:"Puffin",qq:"QQ Browser",qqlite:"QQ Browser Lite",qupzilla:"QupZilla",roku:"Roku",safari:"Safari",sailfish:"Sailfish",samsung_internet:"Samsung Internet for Android",seamonkey:"SeaMonkey",sleipnir:"Sleipnir",sogou:"Sogou Browser",swing:"Swing",tizen:"Tizen",uc:"UC Browser",vivaldi:"Vivaldi",webos:"WebOS Browser",wechat:"WeChat",yahooslurp:"YahooSlurp",yandex:"Yandex Browser",yandexbot:"YandexBot",youbot:"YouBot"},t.PLATFORMS_MAP={bot:"bot",desktop:"desktop",mobile:"mobile",tablet:"tablet",tv:"tv"},t.OS_MAP={Android:"Android",Bada:"Bada",BlackBerry:"BlackBerry",ChromeOS:"Chrome OS",HarmonyOS:"HarmonyOS",iOS:"iOS",Linux:"Linux",MacOS:"macOS",PlayStation4:"PlayStation 4",Roku:"Roku",Tizen:"Tizen",WebOS:"WebOS",Windows:"Windows",WindowsPhone:"Windows Phone"},t.ENGINE_MAP={Blink:"Blink",EdgeHTML:"EdgeHTML",Gecko:"Gecko",Presto:"Presto",Trident:"Trident",WebKit:"WebKit"}},90:function(e,t,r){t.__esModule=!0,t.default=void 0;var i,n=(i=r(91))&&i.__esModule?i:{default:i},o=r(18);function a(e,t){for(var r=0;r<t.length;r++){var i=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}var s=function(){function e(){}var t,r;return e.getParser=function(e,t){if(void 0===t&&(t=!1),"string"!=typeof e)throw new Error("UserAgent should be a string");return new n.default(e,t)},e.parse=function(e){return new n.default(e).getResult()},t=e,r=[{key:"BROWSER_MAP",get:function(){return o.BROWSER_MAP}},{key:"ENGINE_MAP",get:function(){return o.ENGINE_MAP}},{key:"OS_MAP",get:function(){return o.OS_MAP}},{key:"PLATFORMS_MAP",get:function(){return o.PLATFORMS_MAP}}],null&&a(t.prototype,null),r&&a(t,r),e}();t.default=s,e.exports=t.default},91:function(e,t,r){t.__esModule=!0,t.default=void 0;var i=c(r(92)),n=c(r(93)),o=c(r(94)),a=c(r(95)),s=c(r(17));function c(e){return e&&e.__esModule?e:{default:e}}var u=function(){function e(e,t){if(void 0===t&&(t=!1),null==e||""===e)throw new Error("UserAgent parameter can't be empty");this._ua=e,this.parsedResult={},!0!==t&&this.parse()}var t=e.prototype;return t.getUA=function(){return this._ua},t.test=function(e){return e.test(this._ua)},t.parseBrowser=function(){var e=this;this.parsedResult.browser={};var t=s.default.find(i.default,(function(t){if("function"==typeof t.test)return t.test(e);if(Array.isArray(t.test))return t.test.some((function(t){return e.test(t)}));throw new Error("Browser's test function is not valid")}));return t&&(this.parsedResult.browser=t.describe(this.getUA())),this.parsedResult.browser},t.getBrowser=function(){return this.parsedResult.browser?this.parsedResult.browser:this.parseBrowser()},t.getBrowserName=function(e){return e?String(this.getBrowser().name).toLowerCase()||"":this.getBrowser().name||""},t.getBrowserVersion=function(){return this.getBrowser().version},t.getOS=function(){return this.parsedResult.os?this.parsedResult.os:this.parseOS()},t.parseOS=function(){var e=this;this.parsedResult.os={};var t=s.default.find(n.default,(function(t){if("function"==typeof t.test)return t.test(e);if(Array.isArray(t.test))return t.test.some((function(t){return e.test(t)}));throw new Error("Browser's test function is not valid")}));return t&&(this.parsedResult.os=t.describe(this.getUA())),this.parsedResult.os},t.getOSName=function(e){var t=this.getOS().name;return e?String(t).toLowerCase()||"":t||""},t.getOSVersion=function(){return this.getOS().version},t.getPlatform=function(){return this.parsedResult.platform?this.parsedResult.platform:this.parsePlatform()},t.getPlatformType=function(e){void 0===e&&(e=!1);var t=this.getPlatform().type;return e?String(t).toLowerCase()||"":t||""},t.parsePlatform=function(){var e=this;this.parsedResult.platform={};var t=s.default.find(o.default,(function(t){if("function"==typeof t.test)return t.test(e);if(Array.isArray(t.test))return t.test.some((function(t){return e.test(t)}));throw new Error("Browser's test function is not valid")}));return t&&(this.parsedResult.platform=t.describe(this.getUA())),this.parsedResult.platform},t.getEngine=function(){return this.parsedResult.engine?this.parsedResult.engine:this.parseEngine()},t.getEngineName=function(e){return e?String(this.getEngine().name).toLowerCase()||"":this.getEngine().name||""},t.parseEngine=function(){var e=this;this.parsedResult.engine={};var t=s.default.find(a.default,(function(t){if("function"==typeof t.test)return t.test(e);if(Array.isArray(t.test))return t.test.some((function(t){return e.test(t)}));throw new Error("Browser's test function is not valid")}));return t&&(this.parsedResult.engine=t.describe(this.getUA())),this.parsedResult.engine},t.parse=function(){return this.parseBrowser(),this.parseOS(),this.parsePlatform(),this.parseEngine(),this},t.getResult=function(){return s.default.assign({},this.parsedResult)},t.satisfies=function(e){var t=this,r={},i=0,n={},o=0;if(Object.keys(e).forEach((function(t){var a=e[t];"string"==typeof a?(n[t]=a,o+=1):"object"==typeof a&&(r[t]=a,i+=1)})),i>0){var a=Object.keys(r),c=s.default.find(a,(function(e){return t.isOS(e)}));if(c){var u=this.satisfies(r[c]);if(void 0!==u)return u}var d=s.default.find(a,(function(e){return t.isPlatform(e)}));if(d){var l=this.satisfies(r[d]);if(void 0!==l)return l}}if(o>0){var h=Object.keys(n),f=s.default.find(h,(function(e){return t.isBrowser(e,!0)}));if(void 0!==f)return this.compareVersion(n[f])}},t.isBrowser=function(e,t){void 0===t&&(t=!1);var r=this.getBrowserName().toLowerCase(),i=e.toLowerCase(),n=s.default.getBrowserTypeByAlias(i);return t&&n&&(i=n.toLowerCase()),i===r},t.compareVersion=function(e){var t=[0],r=e,i=!1,n=this.getBrowserVersion();if("string"==typeof n)return">"===e[0]||"<"===e[0]?(r=e.substr(1),"="===e[1]?(i=!0,r=e.substr(2)):t=[],t.push(">"===e[0]?1:-1)):"="===e[0]?r=e.substr(1):"~"===e[0]&&(i=!0,r=e.substr(1)),t.indexOf(s.default.compareVersions(n,r,i))>-1},t.isOS=function(e){return this.getOSName(!0)===String(e).toLowerCase()},t.isPlatform=function(e){return this.getPlatformType(!0)===String(e).toLowerCase()},t.isEngine=function(e){return this.getEngineName(!0)===String(e).toLowerCase()},t.is=function(e,t){return void 0===t&&(t=!1),this.isBrowser(e,t)||this.isOS(e)||this.isPlatform(e)},t.some=function(e){var t=this;return void 0===e&&(e=[]),e.some((function(e){return t.is(e)}))},e}();t.default=u,e.exports=t.default},92:function(e,t,r){t.__esModule=!0,t.default=void 0;var i,n=(i=r(17))&&i.__esModule?i:{default:i},o=/version\/(\d+(\.?_?\d+)+)/i,a=[{test:[/gptbot/i],describe:function(e){var t={name:"GPTBot"},r=n.default.getFirstMatch(/gptbot\/(\d+(\.\d+)+)/i,e)||n.default.getFirstMatch(o,e);return r&&(t.version=r),t}},{test:[/chatgpt-user/i],describe:function(e){var t={name:"ChatGPT-User"},r=n.default.getFirstMatch(/chatgpt-user\/(\d+(\.\d+)+)/i,e)||n.default.getFirstMatch(o,e);return r&&(t.version=r),t}},{test:[/oai-searchbot/i],describe:function(e){var t={name:"OAI-SearchBot"},r=n.default.getFirstMatch(/oai-searchbot\/(\d+(\.\d+)+)/i,e)||n.default.getFirstMatch(o,e);return r&&(t.version=r),t}},{test:[/claudebot/i,/claude-web/i,/claude-user/i,/claude-searchbot/i],describe:function(e){var t={name:"ClaudeBot"},r=n.default.getFirstMatch(/(?:claudebot|claude-web|claude-user|claude-searchbot)\/(\d+(\.\d+)+)/i,e)||n.default.getFirstMatch(o,e);return r&&(t.version=r),t}},{test:[/omgilibot/i,/webzio-extended/i],describe:function(e){var t={name:"Omgilibot"},r=n.default.getFirstMatch(/(?:omgilibot|webzio-extended)\/(\d+(\.\d+)+)/i,e)||n.default.getFirstMatch(o,e);return r&&(t.version=r),t}},{test:[/diffbot/i],describe:function(e){var t={name:"Diffbot"},r=n.default.getFirstMatch(/diffbot\/(\d+(\.\d+)+)/i,e)||n.default.getFirstMatch(o,e);return r&&(t.version=r),t}},{test:[/perplexitybot/i],describe:function(e){var t={name:"PerplexityBot"},r=n.default.getFirstMatch(/perplexitybot\/(\d+(\.\d+)+)/i,e)||n.default.getFirstMatch(o,e);return r&&(t.version=r),t}},{test:[/perplexity-user/i],describe:function(e){var t={name:"Perplexity-User"},r=n.default.getFirstMatch(/perplexity-user\/(\d+(\.\d+)+)/i,e)||n.default.getFirstMatch(o,e);return r&&(t.version=r),t}},{test:[/youbot/i],describe:function(e){var t={name:"YouBot"},r=n.default.getFirstMatch(/youbot\/(\d+(\.\d+)+)/i,e)||n.default.getFirstMatch(o,e);return r&&(t.version=r),t}},{test:[/meta-webindexer/i],describe:function(e){var t={name:"Meta-WebIndexer"},r=n.default.getFirstMatch(/meta-webindexer\/(\d+(\.\d+)+)/i,e)||n.default.getFirstMatch(o,e);return r&&(t.version=r),t}},{test:[/meta-externalads/i],describe:function(e){var t={name:"Meta-ExternalAds"},r=n.default.getFirstMatch(/meta-externalads\/(\d+(\.\d+)+)/i,e)||n.default.getFirstMatch(o,e);return r&&(t.version=r),t}},{test:[/meta-externalagent/i],describe:function(e){var t={name:"Meta-ExternalAgent"},r=n.default.getFirstMatch(/meta-externalagent\/(\d+(\.\d+)+)/i,e)||n.default.getFirstMatch(o,e);return r&&(t.version=r),t}},{test:[/meta-externalfetcher/i],describe:function(e){var t={name:"Meta-ExternalFetcher"},r=n.default.getFirstMatch(/meta-externalfetcher\/(\d+(\.\d+)+)/i,e)||n.default.getFirstMatch(o,e);return r&&(t.version=r),t}},{test:[/googlebot/i],describe:function(e){var t={name:"Googlebot"},r=n.default.getFirstMatch(/googlebot\/(\d+(\.\d+))/i,e)||n.default.getFirstMatch(o,e);return r&&(t.version=r),t}},{test:[/amazonbot/i],describe:function(e){var t={name:"AmazonBot"},r=n.default.getFirstMatch(/amazonbot\/(\d+(\.\d+)+)/i,e)||n.default.getFirstMatch(o,e);return r&&(t.version=r),t}},{test:[/bingbot/i],describe:function(e){var t={name:"BingCrawler"},r=n.default.getFirstMatch(/bingbot\/(\d+(\.\d+)+)/i,e)||n.default.getFirstMatch(o,e);return r&&(t.version=r),t}},{test:[/baiduspider/i],describe:function(e){var t={name:"BaiduSpider"},r=n.default.getFirstMatch(/baiduspider\/(\d+(\.\d+)+)/i,e)||n.default.getFirstMatch(o,e);return r&&(t.version=r),t}},{test:[/duckduckbot/i],describe:function(e){var t={name:"DuckDuckBot"},r=n.default.getFirstMatch(/duckduckbot\/(\d+(\.\d+)+)/i,e)||n.default.getFirstMatch(o,e);return r&&(t.version=r),t}},{test:[/ia_archiver/i],describe:function(e){var t={name:"InternetArchiveCrawler"},r=n.default.getFirstMatch(/ia_archiver\/(\d+(\.\d+)+)/i,e)||n.default.getFirstMatch(o,e);return r&&(t.version=r),t}},{test:[/facebookexternalhit/i,/facebookcatalog/i],describe:function(){return{name:"FacebookExternalHit"}}},{test:[/yahoo!?[\s/]*slurp/i],describe:function(){return{name:"YahooSlurp"}}},{test:[/yandexbot/i,/yandexmobilebot/i],describe:function(){return{name:"YandexBot"}}},{test:[/pingdom/i],describe:function(){return{name:"PingdomBot"}}},{test:[/opera/i],describe:function(e){var t={name:"Opera"},r=n.default.getFirstMatch(o,e)||n.default.getFirstMatch(/(?:opera)[\s/](\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/opr\/|opios/i],describe:function(e){var t={name:"Opera"},r=n.default.getFirstMatch(/(?:opr|opios)[\s/](\S+)/i,e)||n.default.getFirstMatch(o,e);return r&&(t.version=r),t}},{test:[/SamsungBrowser/i],describe:function(e){var t={name:"Samsung Internet for Android"},r=n.default.getFirstMatch(o,e)||n.default.getFirstMatch(/(?:SamsungBrowser)[\s/](\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/Whale/i],describe:function(e){var t={name:"NAVER Whale Browser"},r=n.default.getFirstMatch(o,e)||n.default.getFirstMatch(/(?:whale)[\s/](\d+(?:\.\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/PaleMoon/i],describe:function(e){var t={name:"Pale Moon"},r=n.default.getFirstMatch(o,e)||n.default.getFirstMatch(/(?:PaleMoon)[\s/](\d+(?:\.\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/MZBrowser/i],describe:function(e){var t={name:"MZ Browser"},r=n.default.getFirstMatch(/(?:MZBrowser)[\s/](\d+(?:\.\d+)+)/i,e)||n.default.getFirstMatch(o,e);return r&&(t.version=r),t}},{test:[/focus/i],describe:function(e){var t={name:"Focus"},r=n.default.getFirstMatch(/(?:focus)[\s/](\d+(?:\.\d+)+)/i,e)||n.default.getFirstMatch(o,e);return r&&(t.version=r),t}},{test:[/swing/i],describe:function(e){var t={name:"Swing"},r=n.default.getFirstMatch(/(?:swing)[\s/](\d+(?:\.\d+)+)/i,e)||n.default.getFirstMatch(o,e);return r&&(t.version=r),t}},{test:[/coast/i],describe:function(e){var t={name:"Opera Coast"},r=n.default.getFirstMatch(o,e)||n.default.getFirstMatch(/(?:coast)[\s/](\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/opt\/\d+(?:.?_?\d+)+/i],describe:function(e){var t={name:"Opera Touch"},r=n.default.getFirstMatch(/(?:opt)[\s/](\d+(\.?_?\d+)+)/i,e)||n.default.getFirstMatch(o,e);return r&&(t.version=r),t}},{test:[/yabrowser/i],describe:function(e){var t={name:"Yandex Browser"},r=n.default.getFirstMatch(/(?:yabrowser)[\s/](\d+(\.?_?\d+)+)/i,e)||n.default.getFirstMatch(o,e);return r&&(t.version=r),t}},{test:[/ucbrowser/i],describe:function(e){var t={name:"UC Browser"},r=n.default.getFirstMatch(o,e)||n.default.getFirstMatch(/(?:ucbrowser)[\s/](\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/Maxthon|mxios/i],describe:function(e){var t={name:"Maxthon"},r=n.default.getFirstMatch(o,e)||n.default.getFirstMatch(/(?:Maxthon|mxios)[\s/](\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/epiphany/i],describe:function(e){var t={name:"Epiphany"},r=n.default.getFirstMatch(o,e)||n.default.getFirstMatch(/(?:epiphany)[\s/](\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/puffin/i],describe:function(e){var t={name:"Puffin"},r=n.default.getFirstMatch(o,e)||n.default.getFirstMatch(/(?:puffin)[\s/](\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/sleipnir/i],describe:function(e){var t={name:"Sleipnir"},r=n.default.getFirstMatch(o,e)||n.default.getFirstMatch(/(?:sleipnir)[\s/](\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/k-meleon/i],describe:function(e){var t={name:"K-Meleon"},r=n.default.getFirstMatch(o,e)||n.default.getFirstMatch(/(?:k-meleon)[\s/](\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/micromessenger/i],describe:function(e){var t={name:"WeChat"},r=n.default.getFirstMatch(/(?:micromessenger)[\s/](\d+(\.?_?\d+)+)/i,e)||n.default.getFirstMatch(o,e);return r&&(t.version=r),t}},{test:[/qqbrowser/i],describe:function(e){var t={name:/qqbrowserlite/i.test(e)?"QQ Browser Lite":"QQ Browser"},r=n.default.getFirstMatch(/(?:qqbrowserlite|qqbrowser)[/](\d+(\.?_?\d+)+)/i,e)||n.default.getFirstMatch(o,e);return r&&(t.version=r),t}},{test:[/msie|trident/i],describe:function(e){var t={name:"Internet Explorer"},r=n.default.getFirstMatch(/(?:msie |rv:)(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/\sedg\//i],describe:function(e){var t={name:"Microsoft Edge"},r=n.default.getFirstMatch(/\sedg\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/edg([ea]|ios)/i],describe:function(e){var t={name:"Microsoft Edge"},r=n.default.getSecondMatch(/edg([ea]|ios)\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/vivaldi/i],describe:function(e){var t={name:"Vivaldi"},r=n.default.getFirstMatch(/vivaldi\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/seamonkey/i],describe:function(e){var t={name:"SeaMonkey"},r=n.default.getFirstMatch(/seamonkey\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/sailfish/i],describe:function(e){var t={name:"Sailfish"},r=n.default.getFirstMatch(/sailfish\s?browser\/(\d+(\.\d+)?)/i,e);return r&&(t.version=r),t}},{test:[/silk/i],describe:function(e){var t={name:"Amazon Silk"},r=n.default.getFirstMatch(/silk\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/phantom/i],describe:function(e){var t={name:"PhantomJS"},r=n.default.getFirstMatch(/phantomjs\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/slimerjs/i],describe:function(e){var t={name:"SlimerJS"},r=n.default.getFirstMatch(/slimerjs\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/blackberry|\bbb\d+/i,/rim\stablet/i],describe:function(e){var t={name:"BlackBerry"},r=n.default.getFirstMatch(o,e)||n.default.getFirstMatch(/blackberry[\d]+\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/(web|hpw)[o0]s/i],describe:function(e){var t={name:"WebOS Browser"},r=n.default.getFirstMatch(o,e)||n.default.getFirstMatch(/w(?:eb)?[o0]sbrowser\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/bada/i],describe:function(e){var t={name:"Bada"},r=n.default.getFirstMatch(/dolfin\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/tizen/i],describe:function(e){var t={name:"Tizen"},r=n.default.getFirstMatch(/(?:tizen\s?)?browser\/(\d+(\.?_?\d+)+)/i,e)||n.default.getFirstMatch(o,e);return r&&(t.version=r),t}},{test:[/qupzilla/i],describe:function(e){var t={name:"QupZilla"},r=n.default.getFirstMatch(/(?:qupzilla)[\s/](\d+(\.?_?\d+)+)/i,e)||n.default.getFirstMatch(o,e);return r&&(t.version=r),t}},{test:[/librewolf/i],describe:function(e){var t={name:"LibreWolf"},r=n.default.getFirstMatch(/(?:librewolf)[\s/](\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/firefox|iceweasel|fxios/i],describe:function(e){var t={name:"Firefox"},r=n.default.getFirstMatch(/(?:firefox|iceweasel|fxios)[\s/](\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/electron/i],describe:function(e){var t={name:"Electron"},r=n.default.getFirstMatch(/(?:electron)\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/sogoumobilebrowser/i,/metasr/i,/se 2\.[x]/i],describe:function(e){var t={name:"Sogou Browser"},r=n.default.getFirstMatch(/(?:sogoumobilebrowser)[\s/](\d+(\.?_?\d+)+)/i,e),i=n.default.getFirstMatch(/(?:chrome|crios|crmo)\/(\d+(\.?_?\d+)+)/i,e),o=n.default.getFirstMatch(/se ([\d.]+)x/i,e),a=r||i||o;return a&&(t.version=a),t}},{test:[/MiuiBrowser/i],describe:function(e){var t={name:"Miui"},r=n.default.getFirstMatch(/(?:MiuiBrowser)[\s/](\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/chromium/i],describe:function(e){var t={name:"Chromium"},r=n.default.getFirstMatch(/(?:chromium)[\s/](\d+(\.?_?\d+)+)/i,e)||n.default.getFirstMatch(o,e);return r&&(t.version=r),t}},{test:[/chrome|crios|crmo/i],describe:function(e){var t={name:"Chrome"},r=n.default.getFirstMatch(/(?:chrome|crios|crmo)\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/GSA/i],describe:function(e){var t={name:"Google Search"},r=n.default.getFirstMatch(/(?:GSA)\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:function(e){var t=!e.test(/like android/i),r=e.test(/android/i);return t&&r},describe:function(e){var t={name:"Android Browser"},r=n.default.getFirstMatch(o,e);return r&&(t.version=r),t}},{test:[/playstation 4/i],describe:function(e){var t={name:"PlayStation 4"},r=n.default.getFirstMatch(o,e);return r&&(t.version=r),t}},{test:[/safari|applewebkit/i],describe:function(e){var t={name:"Safari"},r=n.default.getFirstMatch(o,e);return r&&(t.version=r),t}},{test:[/.*/i],describe:function(e){var t=-1!==e.search("\\(")?/^(.*)\/(.*)[ \t]\((.*)/:/^(.*)\/(.*) /;return{name:n.default.getFirstMatch(t,e),version:n.default.getSecondMatch(t,e)}}}];t.default=a,e.exports=t.default},93:function(e,t,r){t.__esModule=!0,t.default=void 0;var i,n=(i=r(17))&&i.__esModule?i:{default:i},o=r(18),a=[{test:[/Roku\/DVP/],describe:function(e){var t=n.default.getFirstMatch(/Roku\/DVP-(\d+\.\d+)/i,e);return{name:o.OS_MAP.Roku,version:t}}},{test:[/windows phone/i],describe:function(e){var t=n.default.getFirstMatch(/windows phone (?:os)?\s?(\d+(\.\d+)*)/i,e);return{name:o.OS_MAP.WindowsPhone,version:t}}},{test:[/windows /i],describe:function(e){var t=n.default.getFirstMatch(/Windows ((NT|XP)( \d\d?.\d)?)/i,e),r=n.default.getWindowsVersionName(t);return{name:o.OS_MAP.Windows,version:t,versionName:r}}},{test:[/Macintosh(.*?) FxiOS(.*?)\//],describe:function(e){var t={name:o.OS_MAP.iOS},r=n.default.getSecondMatch(/(Version\/)(\d[\d.]+)/,e);return r&&(t.version=r),t}},{test:[/macintosh/i],describe:function(e){var t=n.default.getFirstMatch(/mac os x (\d+(\.?_?\d+)+)/i,e).replace(/[_\s]/g,"."),r=n.default.getMacOSVersionName(t),i={name:o.OS_MAP.MacOS,version:t};return r&&(i.versionName=r),i}},{test:[/(ipod|iphone|ipad)/i],describe:function(e){var t=n.default.getFirstMatch(/os (\d+([_\s]\d+)*) like mac os x/i,e).replace(/[_\s]/g,".");return{name:o.OS_MAP.iOS,version:t}}},{test:[/OpenHarmony/i],describe:function(e){var t=n.default.getFirstMatch(/OpenHarmony\s+(\d+(\.\d+)*)/i,e);return{name:o.OS_MAP.HarmonyOS,version:t}}},{test:function(e){var t=!e.test(/like android/i),r=e.test(/android/i);return t&&r},describe:function(e){var t=n.default.getFirstMatch(/android[\s/-](\d+(\.\d+)*)/i,e),r=n.default.getAndroidVersionName(t),i={name:o.OS_MAP.Android,version:t};return r&&(i.versionName=r),i}},{test:[/(web|hpw)[o0]s/i],describe:function(e){var t=n.default.getFirstMatch(/(?:web|hpw)[o0]s\/(\d+(\.\d+)*)/i,e),r={name:o.OS_MAP.WebOS};return t&&t.length&&(r.version=t),r}},{test:[/blackberry|\bbb\d+/i,/rim\stablet/i],describe:function(e){var t=n.default.getFirstMatch(/rim\stablet\sos\s(\d+(\.\d+)*)/i,e)||n.default.getFirstMatch(/blackberry\d+\/(\d+([_\s]\d+)*)/i,e)||n.default.getFirstMatch(/\bbb(\d+)/i,e);return{name:o.OS_MAP.BlackBerry,version:t}}},{test:[/bada/i],describe:function(e){var t=n.default.getFirstMatch(/bada\/(\d+(\.\d+)*)/i,e);return{name:o.OS_MAP.Bada,version:t}}},{test:[/tizen/i],describe:function(e){var t=n.default.getFirstMatch(/tizen[/\s](\d+(\.\d+)*)/i,e);return{name:o.OS_MAP.Tizen,version:t}}},{test:[/linux/i],describe:function(){return{name:o.OS_MAP.Linux}}},{test:[/CrOS/],describe:function(){return{name:o.OS_MAP.ChromeOS}}},{test:[/PlayStation 4/],describe:function(e){var t=n.default.getFirstMatch(/PlayStation 4[/\s](\d+(\.\d+)*)/i,e);return{name:o.OS_MAP.PlayStation4,version:t}}}];t.default=a,e.exports=t.default},94:function(e,t,r){t.__esModule=!0,t.default=void 0;var i,n=(i=r(17))&&i.__esModule?i:{default:i},o=r(18),a=[{test:[/googlebot/i],describe:function(){return{type:o.PLATFORMS_MAP.bot,vendor:"Google"}}},{test:[/amazonbot/i],describe:function(){return{type:o.PLATFORMS_MAP.bot,vendor:"Amazon"}}},{test:[/gptbot/i],describe:function(){return{type:o.PLATFORMS_MAP.bot,vendor:"OpenAI"}}},{test:[/chatgpt-user/i],describe:function(){return{type:o.PLATFORMS_MAP.bot,vendor:"OpenAI"}}},{test:[/oai-searchbot/i],describe:function(){return{type:o.PLATFORMS_MAP.bot,vendor:"OpenAI"}}},{test:[/baiduspider/i],describe:function(){return{type:o.PLATFORMS_MAP.bot,vendor:"Baidu"}}},{test:[/bingbot/i],describe:function(){return{type:o.PLATFORMS_MAP.bot,vendor:"Bing"}}},{test:[/duckduckbot/i],describe:function(){return{type:o.PLATFORMS_MAP.bot,vendor:"DuckDuckGo"}}},{test:[/claudebot/i,/claude-web/i,/claude-user/i,/claude-searchbot/i],describe:function(){return{type:o.PLATFORMS_MAP.bot,vendor:"Anthropic"}}},{test:[/omgilibot/i,/webzio-extended/i],describe:function(){return{type:o.PLATFORMS_MAP.bot,vendor:"Webz.io"}}},{test:[/diffbot/i],describe:function(){return{type:o.PLATFORMS_MAP.bot,vendor:"Diffbot"}}},{test:[/perplexitybot/i],describe:function(){return{type:o.PLATFORMS_MAP.bot,vendor:"Perplexity AI"}}},{test:[/perplexity-user/i],describe:function(){return{type:o.PLATFORMS_MAP.bot,vendor:"Perplexity AI"}}},{test:[/youbot/i],describe:function(){return{type:o.PLATFORMS_MAP.bot,vendor:"You.com"}}},{test:[/ia_archiver/i],describe:function(){return{type:o.PLATFORMS_MAP.bot,vendor:"Internet Archive"}}},{test:[/meta-webindexer/i],describe:function(){return{type:o.PLATFORMS_MAP.bot,vendor:"Meta"}}},{test:[/meta-externalads/i],describe:function(){return{type:o.PLATFORMS_MAP.bot,vendor:"Meta"}}},{test:[/meta-externalagent/i],describe:function(){return{type:o.PLATFORMS_MAP.bot,vendor:"Meta"}}},{test:[/meta-externalfetcher/i],describe:function(){return{type:o.PLATFORMS_MAP.bot,vendor:"Meta"}}},{test:[/facebookexternalhit/i,/facebookcatalog/i],describe:function(){return{type:o.PLATFORMS_MAP.bot,vendor:"Meta"}}},{test:[/yahoo/i],describe:function(){return{type:o.PLATFORMS_MAP.bot,vendor:"Yahoo"}}},{test:[/yandexbot/i,/yandexmobilebot/i],describe:function(){return{type:o.PLATFORMS_MAP.bot,vendor:"Yandex"}}},{test:[/pingdom/i],describe:function(){return{type:o.PLATFORMS_MAP.bot,vendor:"Pingdom"}}},{test:[/huawei/i],describe:function(e){var t=n.default.getFirstMatch(/(can-l01)/i,e)&&"Nova",r={type:o.PLATFORMS_MAP.mobile,vendor:"Huawei"};return t&&(r.model=t),r}},{test:[/nexus\s*(?:7|8|9|10).*/i],describe:function(){return{type:o.PLATFORMS_MAP.tablet,vendor:"Nexus"}}},{test:[/ipad/i],describe:function(){return{type:o.PLATFORMS_MAP.tablet,vendor:"Apple",model:"iPad"}}},{test:[/Macintosh(.*?) FxiOS(.*?)\//],describe:function(){return{type:o.PLATFORMS_MAP.tablet,vendor:"Apple",model:"iPad"}}},{test:[/kftt build/i],describe:function(){return{type:o.PLATFORMS_MAP.tablet,vendor:"Amazon",model:"Kindle Fire HD 7"}}},{test:[/silk/i],describe:function(){return{type:o.PLATFORMS_MAP.tablet,vendor:"Amazon"}}},{test:[/tablet(?! pc)/i],describe:function(){return{type:o.PLATFORMS_MAP.tablet}}},{test:function(e){var t=e.test(/ipod|iphone/i),r=e.test(/like (ipod|iphone)/i);return t&&!r},describe:function(e){var t=n.default.getFirstMatch(/(ipod|iphone)/i,e);return{type:o.PLATFORMS_MAP.mobile,vendor:"Apple",model:t}}},{test:[/nexus\s*[0-6].*/i,/galaxy nexus/i],describe:function(){return{type:o.PLATFORMS_MAP.mobile,vendor:"Nexus"}}},{test:[/Nokia/i],describe:function(e){var t=n.default.getFirstMatch(/Nokia\s+([0-9]+(\.[0-9]+)?)/i,e),r={type:o.PLATFORMS_MAP.mobile,vendor:"Nokia"};return t&&(r.model=t),r}},{test:[/[^-]mobi/i],describe:function(){return{type:o.PLATFORMS_MAP.mobile}}},{test:function(e){return"blackberry"===e.getBrowserName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.mobile,vendor:"BlackBerry"}}},{test:function(e){return"bada"===e.getBrowserName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.mobile}}},{test:function(e){return"windows phone"===e.getBrowserName()},describe:function(){return{type:o.PLATFORMS_MAP.mobile,vendor:"Microsoft"}}},{test:function(e){var t=Number(String(e.getOSVersion()).split(".")[0]);return"android"===e.getOSName(!0)&&t>=3},describe:function(){return{type:o.PLATFORMS_MAP.tablet}}},{test:function(e){return"android"===e.getOSName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.mobile}}},{test:function(e){return"macos"===e.getOSName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.desktop,vendor:"Apple"}}},{test:function(e){return"windows"===e.getOSName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.desktop}}},{test:function(e){return"linux"===e.getOSName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.desktop}}},{test:function(e){return"playstation 4"===e.getOSName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.tv}}},{test:function(e){return"roku"===e.getOSName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.tv}}}];t.default=a,e.exports=t.default},95:function(e,t,r){t.__esModule=!0,t.default=void 0;var i,n=(i=r(17))&&i.__esModule?i:{default:i},o=r(18),a=[{test:function(e){return"microsoft edge"===e.getBrowserName(!0)},describe:function(e){if(/\sedg\//i.test(e))return{name:o.ENGINE_MAP.Blink};var t=n.default.getFirstMatch(/edge\/(\d+(\.?_?\d+)+)/i,e);return{name:o.ENGINE_MAP.EdgeHTML,version:t}}},{test:[/trident/i],describe:function(e){var t={name:o.ENGINE_MAP.Trident},r=n.default.getFirstMatch(/trident\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:function(e){return e.test(/presto/i)},describe:function(e){var t={name:o.ENGINE_MAP.Presto},r=n.default.getFirstMatch(/presto\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:function(e){var t=e.test(/gecko/i),r=e.test(/like gecko/i);return t&&!r},describe:function(e){var t={name:o.ENGINE_MAP.Gecko},r=n.default.getFirstMatch(/gecko\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/(apple)?webkit\/537\.36/i],describe:function(){return{name:o.ENGINE_MAP.Blink}}},{test:[/(apple)?webkit/i],describe:function(e){var t={name:o.ENGINE_MAP.WebKit},r=n.default.getFirstMatch(/webkit\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}}];t.default=a,e.exports=t.default}})),f.exports));const p=class{constructor(e){t(this,e),this.clueSelected=r(this,"clueSelected")}init=!0;data;showCluePreview=!0;clueListStyle="ol";clueSelected;textInput;hWords=[];vWords=[];currentClueId=null;currentClue=null;isFocused=!1;selectedCell=null;bowserParser=b.getParser("undefined"!=typeof window?window.navigator.userAgent:"unknown");abortController=new AbortController;componentWillLoad(){this.init&&this.data&&this.initGame(),this.useStickyBottomHack&&"undefined"!=typeof window&&(window.visualViewport.addEventListener("resize",this.updateFloatingPreview.bind(this),{signal:this.abortController.signal}),window.visualViewport.addEventListener("scroll",this.updateFloatingPreview.bind(this),{signal:this.abortController.signal}),this.updateFloatingPreview())}disconnectedCallback(){this.abortController.abort()}watchData(){this.init&&this.data&&this.initGame()}get allWords(){return[...this.hWords,...this.vWords]}async initGame(e=this.data){if(!e.words)throw new Error("Words definition missing");this.hWords=[],this.vWords=[],e.words.forEach(((e,t)=>{const r=Math.random();void 0===e.id&&(e.id=`${r}_${t}`),"horizontal"===e.orientation&&(this.hWords=[...this.hWords,e]),"vertical"===e.orientation&&(this.vWords=[...this.vWords,e])})),this.specialBorders=e.specialBorders??[],this.specialCells=e.specialCells??[],this.labels=e.labels??[],this.buildBoard()}async checkAnswer(){return this.cells.filter((e=>!e.isBlocked)).every((e=>e.value===e.answer))}specialBorders=[];specialCells=[];labels=[];boardWidth=0;boardHeight=0;cells=[];useStickyBottomHack=this.bowserParser.isOS("ios");floatingPreviewHackParams={height:0,offsetTop:0};updateFloatingPreview(e){this.floatingPreviewHackParams={...this.floatingPreviewHackParams,height:window.visualViewport.height,offsetTop:window.visualViewport.offsetTop}}buildBoard(){let e=0,t=0;this.allWords.forEach((r=>{"horizontal"===r.orientation&&(e=Math.max(e,r.x+r.word.length),t=Math.max(t,r.y+1)),"vertical"===r.orientation&&(e=Math.max(e,r.x+1),t=Math.max(t,r.y+r.word.length))}));const r=Array(t*e).fill(null).map(((t,r)=>{const[i,o]=n(r,e);return{index:r,x:i,y:o,value:null,isCurrent:!1,isInCurrentWord:!1,isBlocked:!0}}));this.allWords.forEach((t=>{if("horizontal"===t.orientation)for(let i=0;i<t.word.length;i++){const n=o.from(t),a=s(new o(n.x+i,n.y),e);r[a].isBlocked=!1,r[a].answer=t.word[i]}if("vertical"===t.orientation)for(let i=0;i<t.word.length;i++){const n=o.from(t),a=s(new o(n.x,n.y+i),e);r[a].isBlocked=!1,r[a].answer=t.word[i]}})),this.cells=r,this.boardWidth=e,this.boardHeight=t}getClueById(e){return this.allWords.find((t=>t.id===e))??null}isInClue(e,t=this.currentClue){return null!==t&&(e.x===t.x||e.y===t.y)&&("horizontal"===t.orientation?!(e.y!==t.y||e.x<t.x||e.x>=t.x+t.word.length):"vertical"===t.orientation?!(e.x!==t.x||e.y<t.y||e.y>=t.y+t.word.length):void 0)}isSelectedCell(e){return!!this.selectedCell&&e.x===this.selectedCell.x&&e.y===this.selectedCell.y}getNextClueId(){if(!this.currentClueId)return this.allWords[0]?.id??null;const e=this.allWords.findIndex((e=>e.id===this.currentClueId));return e<0?this.allWords[0]?.id??null:this.allWords[e+1]?.id??null}getPrevClueId(){if(!this.currentClueId)return this.allWords[0]?.id??null;const e=this.allWords.findIndex((e=>e.id===this.currentClueId));return e<0?this.allWords[0]?.id??null:this.allWords[e-1]?.id??null}inputLetter(e){this.selectedCell&&(this.selectedCell.value=e,this.selectNextCell(),i(this))}backspace(){this.selectedCell&&(this.selectedCell.value?(this.selectedCell.value="",this.selectPrevCell()):(this.selectPrevCell(),this.selectedCell.value=""),i(this))}selectNextCell(){if(!this.selectedCell||!this.currentClue)return;const e=this.currentClue.orientation;if(t=this.selectedCell,v(this.currentClue).eq(o.from(t))){const e=this.getNextClueId(),t=this.getClueById(e);return t?void this.selectClueByXY(o.from(t)):void 0}var t;"horizontal"===e&&this.selectClueByXY(new o(this.selectedCell.x+1,this.selectedCell.y)),"vertical"===e&&this.selectClueByXY(new o(this.selectedCell.x,this.selectedCell.y+1))}selectPrevCell(){if(!this.selectedCell||!this.currentClue)return;const e=this.currentClue.orientation;if(t=this.selectedCell,o.from(this.currentClue).eq(o.from(t))){const e=this.getPrevClueId(),t=this.getClueById(e);if(t){const e=v(t);return console.log(e),void this.selectClueByXY(e)}}var t;"horizontal"===e&&this.selectClueByXY(new o(this.selectedCell.x-1,this.selectedCell.y)),"vertical"===e&&this.selectClueByXY(new o(this.selectedCell.x,this.selectedCell.y-1))}onFocusin(){this.isFocused=!0}onFocusOut(){this.isFocused=!1}async selectClue(e,{row:t,col:r}={}){if(!e)return;this.currentClueId=e;const i=this.allWords.find((t=>t.id===e));i||(this.currentClueId=null,this.currentClue=null),this.currentClue=i;const n=[i.x,i.y];void 0!==t&&"vertical"===i.orientation&&t>=i.y&&t<i.y+i.word.length&&(n[1]=t),void 0!==r&&"horizontal"===i.orientation&&r>=i.x&&r<i.x+i.word.length&&(n[0]=r),this.selectCellByXY(o.from(n))}selectCellByXY(e){const t=s(e,this.boardWidth);this.selectedCell=this.cells[t]??null}findNonblockedCell(e,t){const r=new o(e[0]+t[0],e[1]+t[1]),i=this.boardWidth*this.boardHeight;let n=0;for(;this.isCellBlocked(r)&&n<i;)n++,r[0]+=t[0],r[1]+=t[1],r[0]<0&&(r[0]=this.boardWidth-1),r[0]>=this.boardWidth&&(r[0]=0),r[1]<0&&(r[1]=this.boardHeight-1),r[1]>=this.boardHeight&&(r[1]=0);return r}isCellBlocked(e){const t=this.cells[s(e,this.boardWidth)];return t?.isBlocked??!0}selectClueByXY(e){const t=this.allWords.filter((t=>this.isInClue(e,t)));if(t.length)if(this.selectedCell&&2===t.length&&e.eq(o.from(this.selectedCell))){const r=t.find((e=>e.orientation!==this.currentClue?.orientation));this.selectClue(r?.id??t[0].id,{row:e.y,col:e.x})}else{const r=t.find((e=>e.orientation===this.currentClue?.orientation));this.selectClue(r?.id??t[0].id,{row:e.y,col:e.x})}}getCluePreview(e){if(!e)return"_";const t=Array(e.word.length).fill("_");for(let r=0;r<e.word.length;r++){const i=new o(e.x,e.y).add("vertical"===e.orientation?new o(0,1*r):new o(1*r,0)),n=this.cells[s(i,this.boardWidth)];n.value&&(t[r]=n.value)}return t.join("")}onKeyPress(e){if(console.log(e),"Tab"===e.key){const t=e.shiftKey?this.getPrevClueId():this.getNextClueId();t&&(e.preventDefault(),this.selectClue(t))}if(this.selectedCell)switch(e.key){case"ArrowLeft":return this.selectClueByXY(this.findNonblockedCell(new o(this.selectedCell.x,this.selectedCell.y),new o(-1,0))),void e.preventDefault();case"ArrowRight":return this.selectClueByXY(this.findNonblockedCell(new o(this.selectedCell.x,this.selectedCell.y),new o(1,0))),void e.preventDefault();case"ArrowUp":return this.selectClueByXY(this.findNonblockedCell(new o(this.selectedCell.x,this.selectedCell.y),new o(0,-1))),void e.preventDefault();case"ArrowDown":return this.selectClueByXY(this.findNonblockedCell(new o(this.selectedCell.x,this.selectedCell.y),new o(0,1))),void e.preventDefault();case"Backspace":console.log("BACKSPACE!"),this.backspace()}}onInput(e){a(e)&&this.inputLetter(e.data.toLowerCase()[0]),this.textInput.value=""}render(){const t=Boolean(this.vWords.length),r=Boolean(this.hWords.length),i="none"===this.clueListStyle,n=r&&t,a=this.isFocused&&this.currentClue&&this.bowserParser.isPlatform("mobile");return e("div",{key:"b18bbd3453ad8c96cf6b5f04903380b0357d5842",part:"main",class:{"--focused":this.isFocused,"--only-board":i,"--sticky-bottom-hack":this.useStickyBottomHack},onFocusin:this.onFocusin.bind(this),onFocusout:this.onFocusOut.bind(this),onClick:()=>{this.textInput.blur(),this.textInput.focus()}},e("input",{key:"59e427026f09803d1077d1c36f95284fe8d1b8ae",type:"text",class:"dummy",ref:e=>this.textInput=e,onKeyDown:this.onKeyPress.bind(this),onInput:this.onInput.bind(this)}),i?"":e("div",{part:"clues",class:{twoLists:n,oneList:!n}},r?e(d,{type:this.clueListStyle},this.hWords.map((t=>{const r=t.id===this.currentClueId;return e(c,{showPreview:this.showCluePreview,preview:this.getCluePreview(t),word:t,isCurrent:r,onPointerDown:()=>this.selectClue(t.id),tagName:"ol"===this.clueListStyle?"li":void 0})}))):"",t?e(d,{type:this.clueListStyle},this.vWords.map((t=>{const r=t.id===this.currentClueId;return e(c,{showPreview:this.showCluePreview,preview:this.getCluePreview(t),word:t,isCurrent:r,onPointerDown:()=>this.selectClue(t.id),tagName:"ol"===this.clueListStyle?"li":void 0})}))):""),e("div",{key:"a4803d792f38119e3ba78584acdbb0db677b4869",part:"board",style:{"--board-width":`${this.boardWidth}`,"grid-template-columns":`repeat(${this.boardWidth}, 1fr)`,aspectRatio:""+this.boardWidth/this.boardHeight}},this.cells.filter((e=>!e.isBlocked)).map((t=>{const r=this.isInClue(t),i=this.isSelectedCell(t),n=this.specialCells.some((e=>e.x===t.x&&e.y===t.y));return e(u,{isSpecial:n,onPointerDown:()=>this.selectClueByXY(o.from(t)),isInCurrentClue:r,isSelected:i,data:t})})),this.specialBorders.map(((t,r)=>e("div",{key:r,part:"special-border",class:{top:Boolean(4096&t.border),right:Boolean(256&t.border),bottom:Boolean(16&t.border),left:Boolean(1&t.border)},style:{"--x":`${t.x}`,"--y":`${t.y}`}}))),this.labels.map((t=>e("div",{part:"label",style:{"--x":`${t.x}`,"--y":`${t.y}`},onPointerDown:()=>this.selectClue(t.clueId)},e("div",{class:"_inner"},t.text))))),a?e("div",{part:"floating-clue",style:{"--height":`${this.floatingPreviewHackParams.height}px`,"--offsetTop":`${this.floatingPreviewHackParams.offsetTop}px`}},e("div",{class:"floating-clue__preview"},Array.from(this.getCluePreview(this.currentClue)).map(((t,r)=>e("span",{key:r},t)))),e("div",{class:"floating-clue__text"},this.currentClue?.clue??"")):"")}static get delegatesFocus(){return!0}static get watchers(){return{data:[{watchData:0}]}}};function v(e){return new o(e.x+("horizontal"===e.orientation?e.word.length-1:0),e.y+("vertical"===e.orientation?e.word.length-1:0))}p.style='*[part=main]{position:relative;display:grid;grid-template-areas:"board" "clues";grid-template-columns:1fr}@media (min-width: 768px){*[part=main]{grid-template-areas:"clues board" "clues .";grid-template-columns:1fr 1fr}*[part=main].--only-board{grid-template-columns:1fr;grid-template-areas:"board"}}*[part=main].--focused{background:lightgrey}*[part=main] input.dummy{pointer-events:none;opacity:0;grid-area:board;border:none;outline:none}[part=clues]{grid-area:clues;display:grid;grid-template-columns:1fr 1fr;gap:16px}[part=clues].oneList{grid-template-columns:1fr}[part=clue-list]{margin:0;padding:0}[part=clue].--current{background:var(--clue-current-background, lightcyan)}[part=clue] .preview{font-weight:bold;letter-spacing:0.2em;text-align:center;display:block;text-transform:uppercase}li[part=clue]{--_clue-padding:var(--clue-padding, .5em);border-radius:var(--clue-radius, 0.5em);padding:var(--_clue-padding);list-style-position:inside;padding-left:calc(1em + var(--_clue-padding));text-indent:-1em;margin:0}[part=board]{grid-area:board;display:block;position:relative;container-type:size;background:var(--board-background, darkgoldenrod);--_cell-border-width:var(--cell-border-width, 2px);--cell-width-temp:calc((100cqw - var(--_cell-border-width)) / var(--board-width, 10));--cell-width:var(--cell-width-temp);--cell-width:round(var(--cell-width-temp), 1px)}[part=cell]{display:block;color:var(--cell-color, #11138d);width:calc(var(--cell-width) - var(--_cell-border-width));aspect-ratio:1;background:var(--cell-background, #d9d9d9);position:absolute;container-type:size;top:calc(var(--y, 0) * var(--cell-width));left:calc(var(--x, 0) * var(--cell-width));border:var(--_cell-border-width) solid var(--cell-border-color, red)}[part=cell].--alt{background:var(--cell-background-alt, #999)}[part=cell].--in-current-clue{box-shadow:inset 0 0 2px 2px var(--cell-selected-background, lightblue)}[part=cell].--selected{background:var(--cell-selected-background, lightblue)}[part=cell].--special{background:var(--cell-special-background, lightgreen)}[part=cell].--special.--selected:before{content:"";background:var(--cell-selected-background, lightblue);position:absolute;top:0;left:0;right:0;bottom:0;clip-path:polygon(100% 0, 100% 100%, 50% 100%)}[part=cell] ._inner{position:absolute;top:0;left:0;right:0;bottom:0;display:grid;place-content:center;text-transform:uppercase;font-size:80cqh}[part=preview]{display:none}[part=special-border]{display:block;background:black;position:absolute;z-index:100;--s-border:max(2px, var(--_cell-border-width))}[part=special-border].left,[part=special-border].right{width:var(--s-border);height:calc(var(--cell-width) - var(--_cell-border-width));top:calc(var(--y, 0) * var(--cell-width) + var(--_cell-border-width))}[part=special-border].left{left:calc(var(--x, 0) * var(--cell-width) - var(--s-border) / 2)}[part=special-border].right{left:calc((var(--x, 0) + 1) * var(--cell-width) - var(--s-border) / 2)}[part=special-border].top,[part=special-border].bottom{width:calc(var(--cell-width) - var(--_cell-border-width));height:var(--s-border);left:calc(var(--x, 0) * var(--cell-width) + var(--_cell-border-width))}[part=special-border].top{top:calc(var(--y, 0) * var(--cell-width))}[part=special-border].bottom{top:calc((var(--y, 0) + 1) * var(--cell-width))}[part=label]{display:grid;position:absolute;container-type:size;top:calc(var(--y, 0) * var(--cell-width));left:calc(var(--x, 0) * var(--cell-width));width:calc(var(--cell-width) - var(--_cell-border-width));aspect-ratio:1;border:var(--_cell-border-width) solid transparent;--label-place-content:center end}[part=label] ._inner{position:absolute;top:var(--label-padding, 10cqh);left:var(--label-padding, 10cqh);right:var(--label-padding, 10cqh);bottom:var(--label-padding, 10cqh);display:grid;place-content:var(--label-place-content, center);text-transform:uppercase;font-size:var(--label-font-size, 60cqh)}[part=floating-clue]{position:fixed;color:white;left:0;right:0;bottom:0;--_background:var(--floating-clue-background, blue)}[part=floating-clue] .floating-clue__text{padding:8px;background:var(--_background)}[part=floating-clue] .floating-clue__preview{display:inline-block;padding:8px;background:var(--_background);font-weight:bold;letter-spacing:0.2em;text-transform:uppercase;border-radius:0 16px 0 0}[part=floating-clue] .floating-clue__preview span{display:inline-block;width:1em;text-align:center}.--sticky-bottom-hack [part=floating-clue]{top:var(--height);top:calc(var(--height) + var(--offsetTop));bottom:unset;transform:translate(0, -100%)}@media (orientation: landscape){.--sticky-bottom-hack [part=floating-clue]{top:calc(var(--height) + var(--offsetTop))}}';export{p as mb_crossword}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { EventEmitter } from '../../stencil-public-runtime';
|
|
2
2
|
import { CellData, PuzzleData, PuzzleClue, Border, SpecialCell, PuzzleLabel } from './types';
|
|
3
3
|
import { Vec2 } from '@mb-puzzle/vec2';
|
|
4
|
+
import Bowser from 'bowser';
|
|
4
5
|
export declare class MBCrossword {
|
|
5
6
|
init: boolean;
|
|
6
7
|
data: PuzzleData;
|
|
@@ -14,7 +15,10 @@ export declare class MBCrossword {
|
|
|
14
15
|
currentClue: PuzzleClue | null;
|
|
15
16
|
isFocused: boolean;
|
|
16
17
|
selectedCell: CellData | null;
|
|
18
|
+
bowserParser: Bowser.Parser.Parser;
|
|
19
|
+
abortController: AbortController;
|
|
17
20
|
componentWillLoad(): void;
|
|
21
|
+
disconnectedCallback(): void;
|
|
18
22
|
watchData(): void;
|
|
19
23
|
get allWords(): PuzzleClue[];
|
|
20
24
|
initGame(data?: PuzzleData): Promise<void>;
|
|
@@ -25,6 +29,12 @@ export declare class MBCrossword {
|
|
|
25
29
|
boardWidth: number;
|
|
26
30
|
boardHeight: number;
|
|
27
31
|
cells: CellData[];
|
|
32
|
+
useStickyBottomHack: boolean;
|
|
33
|
+
floatingPreviewHackParams: {
|
|
34
|
+
height: number;
|
|
35
|
+
offsetTop: number;
|
|
36
|
+
};
|
|
37
|
+
updateFloatingPreview(_event?: Event): void;
|
|
28
38
|
buildBoard(): void;
|
|
29
39
|
getClueById(id: string): PuzzleClue | null;
|
|
30
40
|
isInClue(xy: {
|
|
@@ -7,6 +7,8 @@ export declare class Grid {
|
|
|
7
7
|
isBlack(v: Vec2): boolean;
|
|
8
8
|
isWhite(v: Vec2): boolean;
|
|
9
9
|
isInGrid(v: Vec2): boolean;
|
|
10
|
-
static getVecFromIndex(index: number, width: number): Vec2;
|
|
11
|
-
static getIndexFromVec(v: Vec2, width: number): number;
|
|
10
|
+
static getVecFromIndex(index: number, width: number | Vec2): Vec2;
|
|
11
|
+
static getIndexFromVec(v: Vec2, width: number | Vec2): number;
|
|
12
|
+
static isInGrid(v: Vec2, size: Vec2): boolean;
|
|
13
|
+
static getOrtoSiblings(v: Vec2, size: Vec2): Vec2[];
|
|
12
14
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mborecki/crossword",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"description": "Crossword Puzzle",
|
|
@@ -49,6 +49,9 @@
|
|
|
49
49
|
"vitest": "4.0.16",
|
|
50
50
|
"@mb-puzzle/vec2": "0.5.0"
|
|
51
51
|
},
|
|
52
|
+
"dependencies": {
|
|
53
|
+
"bowser": "^2.13.1"
|
|
54
|
+
},
|
|
52
55
|
"scripts": {
|
|
53
56
|
"test": "vitest",
|
|
54
57
|
"build": "stencil build",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{h as t,r as e,c as i,f as r}from"./p-Dcm4tLi7.js";import{V as s,a as l,i as a,b as o}from"./p-Dn3GSx6U.js";function n({isCurrent:e,word:i,onPointerDown:r,preview:s,showPreview:l,tagName:a}){return t(a??"div",{onPointerDown:r,part:"clue",class:{"--current":e}},i.clue,l&&t("span",{class:"preview"},s))}function c({data:e,isInCurrentClue:i,isSelected:r,isSpecial:s,onPointerDown:l}){return t("div",{onPointerDown:l,part:"cell",class:{"--blocked":e.isBlocked,"--in-current-clue":i,"--selected":r,"--alt":!((e.x+e.y)%2),"--special":s},style:{"--x":`${e.x}`,"--y":`${e.y}`}},t("div",{class:"_inner",style:{position:"absolute",width:"100%"}},e.value))}const h=({type:e},i)=>"p"===e?t("p",{part:"clue-list"},i.map(((e,i)=>t("p",{key:i},e)))):"ol"===e?t("ol",{part:"clue-list"},i):void 0,d=class{constructor(t){e(this,t),this.clueSelected=i(this,"clueSelected")}init=!0;data;showCluePreview=!0;clueListStyle="ol";clueSelected;textInput;hWords=[];vWords=[];currentClueId=null;currentClue=null;isFocused=!1;selectedCell=null;componentWillLoad(){console.log("componentWillLoad",this.init,this.data),this.init&&this.data&&this.initGame()}watchData(){this.init&&this.data&&this.initGame()}get allWords(){return[...this.hWords,...this.vWords]}async initGame(t=this.data){if(console.log("initGame"),!t.words)throw new Error("Words definition missing");this.hWords=[],this.vWords=[],t.words.forEach(((t,e)=>{const i=Math.random();void 0===t.id&&(t.id=`${i}_${e}`),"horizontal"===t.orientation&&(this.hWords=[...this.hWords,t]),"vertical"===t.orientation&&(this.vWords=[...this.vWords,t])})),this.specialBorders=t.specialBorders??[],this.specialCells=t.specialCells??[],this.labels=t.labels??[],this.buildBoard()}async checkAnswer(){const t=this.cells.filter((t=>!t.isBlocked));return console.log(t),t.forEach((t=>{console.log(`${t.value} === ${t.answer}`,`${t.x},${t.y}`,t.value===t.answer)})),t.every((t=>t.value===t.answer))}specialBorders=[];specialCells=[];labels=[];boardWidth=0;boardHeight=0;cells=[];buildBoard(){let t=0,e=0;this.allWords.forEach((i=>{"horizontal"===i.orientation&&(t=Math.max(t,i.x+i.word.length),e=Math.max(e,i.y+1)),"vertical"===i.orientation&&(t=Math.max(t,i.x+1),e=Math.max(e,i.y+i.word.length))}));const i=Array(e*t).fill(null).map(((e,i)=>{const[r,l]=s(i,t);return{index:i,x:r,y:l,value:null,isCurrent:!1,isInCurrentWord:!1,isBlocked:!0}}));this.allWords.forEach((e=>{if("horizontal"===e.orientation)for(let r=0;r<e.word.length;r++){const s=l.from(e),a=o(new l(s.x+r,s.y),t);i[a].isBlocked=!1,i[a].answer=e.word[r]}if("vertical"===e.orientation)for(let r=0;r<e.word.length;r++){const s=l.from(e),a=o(new l(s.x,s.y+r),t);i[a].isBlocked=!1,i[a].answer=e.word[r]}})),this.cells=i,this.boardWidth=t,this.boardHeight=e}getClueById(t){return this.allWords.find((e=>e.id===t))??null}isInClue(t,e=this.currentClue){return null!==e&&(t.x===e.x||t.y===e.y)&&("horizontal"===e.orientation?!(t.y!==e.y||t.x<e.x||t.x>=e.x+e.word.length):"vertical"===e.orientation?!(t.x!==e.x||t.y<e.y||t.y>=e.y+e.word.length):void 0)}isSelectedCell(t){return!!this.selectedCell&&t.x===this.selectedCell.x&&t.y===this.selectedCell.y}getNextClueId(){if(!this.currentClueId)return this.allWords[0]?.id??null;const t=this.allWords.findIndex((t=>t.id===this.currentClueId));return t<0?this.allWords[0]?.id??null:this.allWords[t+1]?.id??null}getPrevClueId(){if(!this.currentClueId)return this.allWords[0]?.id??null;const t=this.allWords.findIndex((t=>t.id===this.currentClueId));return t<0?this.allWords[0]?.id??null:this.allWords[t-1]?.id??null}inputLetter(t){this.selectedCell&&(this.selectedCell.value=t,this.selectNextCell(),r(this))}backspace(){this.selectedCell&&(this.selectedCell.value?(this.selectedCell.value="",this.selectPrevCell()):(this.selectPrevCell(),this.selectedCell.value=""),r(this))}selectNextCell(){if(!this.selectedCell||!this.currentClue)return;const t=this.currentClue.orientation;if(e=this.selectedCell,p(this.currentClue).eq(l.from(e))){const t=this.getNextClueId(),e=this.getClueById(t);return e?void this.selectClueByXY(l.from(e)):void 0}var e;"horizontal"===t&&this.selectClueByXY(new l(this.selectedCell.x+1,this.selectedCell.y)),"vertical"===t&&this.selectClueByXY(new l(this.selectedCell.x,this.selectedCell.y+1))}selectPrevCell(){if(!this.selectedCell||!this.currentClue)return;const t=this.currentClue.orientation;if(e=this.selectedCell,l.from(this.currentClue).eq(l.from(e))){const t=this.getPrevClueId(),e=this.getClueById(t);if(e){const t=p(e);return console.log(t),void this.selectClueByXY(t)}}var e;"horizontal"===t&&this.selectClueByXY(new l(this.selectedCell.x-1,this.selectedCell.y)),"vertical"===t&&this.selectClueByXY(new l(this.selectedCell.x,this.selectedCell.y-1))}onFocusin(){this.isFocused=!0,this.currentClueId||(this.currentClueId=this.allWords[0]?.id??null),this.textInput.focus()}onFocusOut(){this.isFocused=!1}async selectClue(t,{row:e,col:i}={}){if(!t)return;this.currentClueId=t;const r=this.allWords.find((e=>e.id===t));r||(this.currentClueId=null,this.currentClue=null),this.currentClue=r;const s=[r.x,r.y];void 0!==e&&"vertical"===r.orientation&&e>=r.y&&e<r.y+r.word.length&&(s[1]=e),void 0!==i&&"horizontal"===r.orientation&&i>=r.x&&i<r.x+r.word.length&&(s[0]=i),this.selectCellByXY(l.from(s))}selectCellByXY(t){const e=o(t,this.boardWidth);this.selectedCell=this.cells[e]??null}findNonblockedCell(t,e){const i=new l(t[0]+e[0],t[1]+e[1]),r=this.boardWidth*this.boardHeight;let s=0;for(;this.isCellBlocked(i)&&s<r;)s++,i[0]+=e[0],i[1]+=e[1],i[0]<0&&(i[0]=this.boardWidth-1),i[0]>=this.boardWidth&&(i[0]=0),i[1]<0&&(i[1]=this.boardHeight-1),i[1]>=this.boardHeight&&(i[1]=0);return i}isCellBlocked(t){const e=this.cells[o(t,this.boardWidth)];return e?.isBlocked??!0}selectClueByXY(t){const e=this.allWords.filter((e=>this.isInClue(t,e)));if(e.length)if(this.selectedCell&&2===e.length&&t.eq(l.from(this.selectedCell))){const i=e.find((t=>t.orientation!==this.currentClue?.orientation));this.selectClue(i?.id??e[0].id,{row:t.y,col:t.x})}else{const i=e.find((t=>t.orientation===this.currentClue?.orientation));this.selectClue(i?.id??e[0].id,{row:t.y,col:t.x})}}getCluePreview(t){if(!t)return"_";const e=Array(t.word.length).fill("_");for(let i=0;i<t.word.length;i++){const r=new l(t.x,t.y).add("vertical"===t.orientation?new l(0,1*i):new l(1*i,0)),s=this.cells[o(r,this.boardWidth)];s.value&&(e[i]=s.value)}return e.join("")}onKeyPress(t){if(console.log(t),"Tab"===t.key){const e=t.shiftKey?this.getPrevClueId():this.getNextClueId();e&&(t.preventDefault(),this.selectClue(e))}if(this.selectedCell)switch(t.key){case"ArrowLeft":return this.selectClueByXY(this.findNonblockedCell(new l(this.selectedCell.x,this.selectedCell.y),new l(-1,0))),void t.preventDefault();case"ArrowRight":return this.selectClueByXY(this.findNonblockedCell(new l(this.selectedCell.x,this.selectedCell.y),new l(1,0))),void t.preventDefault();case"ArrowUp":return this.selectClueByXY(this.findNonblockedCell(new l(this.selectedCell.x,this.selectedCell.y),new l(0,-1))),void t.preventDefault();case"ArrowDown":return this.selectClueByXY(this.findNonblockedCell(new l(this.selectedCell.x,this.selectedCell.y),new l(0,1))),void t.preventDefault();case"Backspace":console.log("BACKSPACE!"),this.backspace()}}onInput(t){a(t)&&this.inputLetter(t.data.toLowerCase()[0]),this.textInput.value=""}render(){const e=Boolean(this.vWords.length),i=Boolean(this.hWords.length),r="none"===this.clueListStyle,s=i&&e;return t("div",{key:"0aa26f6435a57c206eba0d518313d6248d922eaa",part:"main",class:{"--focused":this.isFocused,"--only-board":r},onFocusin:this.onFocusin.bind(this),onFocusout:this.onFocusOut.bind(this)},t("input",{key:"e15789ff3feb48df30117b501b440142ba3eccf7",type:"text",class:"dummy",ref:t=>this.textInput=t,onKeyDown:this.onKeyPress.bind(this),onInput:this.onInput.bind(this)}),r?"":t("div",{part:"clues",class:{twoLists:s,oneList:!s}},i?t(h,{type:this.clueListStyle},this.hWords.map((e=>{const i=e.id===this.currentClueId;return t(n,{showPreview:this.showCluePreview,preview:this.getCluePreview(e),word:e,isCurrent:i,onPointerDown:()=>this.selectClue(e.id),tagName:"ol"===this.clueListStyle?"li":void 0})}))):"",e?t(h,{type:this.clueListStyle},this.vWords.map((e=>{const i=e.id===this.currentClueId;return t(n,{showPreview:this.showCluePreview,preview:this.getCluePreview(e),word:e,isCurrent:i,onPointerDown:()=>this.selectClue(e.id),tagName:"ol"===this.clueListStyle?"li":void 0})}))):""),t("div",{key:"08ffd76832a1c9c9dfddf8424e9e014d104444a0",part:"board",style:{"--board-width":`${this.boardWidth}`,"grid-template-columns":`repeat(${this.boardWidth}, 1fr)`,aspectRatio:""+this.boardWidth/this.boardHeight}},this.cells.filter((t=>!t.isBlocked)).map((e=>{const i=this.isInClue(e),r=this.isSelectedCell(e),s=this.specialCells.some((t=>t.x===e.x&&t.y===e.y));return t(c,{isSpecial:s,onPointerDown:()=>this.selectClueByXY(l.from(e)),isInCurrentClue:i,isSelected:r,data:e})})),this.specialBorders.map(((e,i)=>t("div",{key:i,part:"special-border",class:{top:Boolean(4096&e.border),right:Boolean(256&e.border),bottom:Boolean(16&e.border),left:Boolean(1&e.border)},style:{"--x":`${e.x}`,"--y":`${e.y}`}}))),this.labels.map((e=>t("div",{part:"label",style:{"--x":`${e.x}`,"--y":`${e.y}`},onPointerDown:()=>this.selectClue(e.clueId)},t("div",{class:"_inner"},e.text))))))}static get delegatesFocus(){return!0}static get watchers(){return{data:[{watchData:0}]}}};function p(t){return new l(t.x+("horizontal"===t.orientation?t.word.length-1:0),t.y+("vertical"===t.orientation?t.word.length-1:0))}d.style='*[part=main]{position:relative;display:grid;grid-template-areas:"board" "clues";grid-template-columns:1fr}@media (min-width: 768px){*[part=main]{grid-template-areas:"clues board" "clues .";grid-template-columns:1fr 1fr}*[part=main].--only-board{grid-template-columns:1fr;grid-template-areas:"board"}}*[part=main].--focused{background:lightgrey}*[part=main] input.dummy{pointer-events:none;opacity:0.2;z-index:100;grid-area:board;border:none;outline:none}[part=clues]{grid-area:clues;display:grid;grid-template-columns:1fr 1fr;gap:16px}[part=clues].oneList{grid-template-columns:1fr}[part=clue-list]{margin:0;padding:0}[part=clue].--current{background:var(--clue-current-background, lightcyan);position:sticky;bottom:0;left:0;right:0}[part=clue] .preview{font-weight:bold;letter-spacing:0.2em;text-align:center;display:block;text-transform:uppercase}li[part=clue]{--_clue-padding:var(--clue-padding, .5em);border-radius:var(--clue-radius, 0.5em);padding:var(--_clue-padding);list-style-position:inside;padding-left:calc(1em + var(--_clue-padding));text-indent:-1em;margin:0}[part=board]{grid-area:board;display:block;position:relative;container-type:size;background:var(--board-background, darkgoldenrod);--_cell-border-width:var(--cell-border-width, 2px);--cell-width-temp:calc((100cqw - var(--_cell-border-width)) / var(--board-width, 10));--cell-width:var(--cell-width-temp);--cell-width:round(var(--cell-width-temp), 1px)}[part=cell]{display:block;color:var(--cell-color, #11138d);width:calc(var(--cell-width) - var(--_cell-border-width));aspect-ratio:1;background:var(--cell-background, #d9d9d9);position:absolute;container-type:size;top:calc(var(--y, 0) * var(--cell-width));left:calc(var(--x, 0) * var(--cell-width));border:var(--_cell-border-width) solid var(--cell-border-color, red)}[part=cell].--alt{background:var(--cell-background-alt, #999)}[part=cell].--in-current-clue{box-shadow:inset 0 0 2px 2px var(--cell-selected-background, lightblue)}[part=cell].--selected{background:var(--cell-selected-background, lightblue)}[part=cell].--special{background:var(--cell-special-background, lightgreen)}[part=cell].--special.--selected:before{content:"";background:var(--cell-selected-background, lightblue);position:absolute;top:0;left:0;right:0;bottom:0;clip-path:polygon(100% 0, 100% 100%, 50% 100%)}[part=cell] ._inner{position:absolute;top:0;left:0;right:0;bottom:0;display:grid;place-content:center;text-transform:uppercase;font-size:80cqh}[part=preview]{display:none}[part=special-border]{display:block;background:black;position:absolute;z-index:100;--s-border:max(2px, var(--_cell-border-width))}[part=special-border].left,[part=special-border].right{width:var(--s-border);height:calc(var(--cell-width) - var(--_cell-border-width));top:calc(var(--y, 0) * var(--cell-width) + var(--_cell-border-width))}[part=special-border].left{left:calc(var(--x, 0) * var(--cell-width) - var(--s-border) / 2)}[part=special-border].right{left:calc((var(--x, 0) + 1) * var(--cell-width) - var(--s-border) / 2)}[part=special-border].top,[part=special-border].bottom{width:calc(var(--cell-width) - var(--_cell-border-width));height:var(--s-border);left:calc(var(--x, 0) * var(--cell-width) + var(--_cell-border-width))}[part=special-border].top{top:calc(var(--y, 0) * var(--cell-width))}[part=special-border].bottom{top:calc((var(--y, 0) + 1) * var(--cell-width))}[part=label]{display:grid;position:absolute;container-type:size;top:calc(var(--y, 0) * var(--cell-width));left:calc(var(--x, 0) * var(--cell-width));width:calc(var(--cell-width) - var(--_cell-border-width));aspect-ratio:1;border:var(--_cell-border-width) solid transparent;--label-place-content:center end}[part=label] ._inner{position:absolute;top:var(--label-padding, 10cqh);left:var(--label-padding, 10cqh);right:var(--label-padding, 10cqh);bottom:var(--label-padding, 10cqh);display:grid;place-content:var(--label-place-content, center);text-transform:uppercase;font-size:var(--label-font-size, 60cqh)}';export{d as mb_crossword}
|