{"size": 5873, "ext": "js", "max_stars_repo_path": "dist/resources/sap/ui/core/hyphenation/Hyphenation.js", "max_stars_repo_name": "fleischr/sapui5-metamask-shoppingcart", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "dist/resources/sap/ui/core/hyphenation/Hyphenation.js", "max_issues_repo_name": "fleischr/sapui5-metamask-shoppingcart", "max_issues_repo_issues_event_min_datetime": "2022-02-23T17:30:35.000Z", "max_issues_repo_issues_event_max_datetime": "2022-03-23T02:24:32.000Z", "max_forks_repo_path": "dist/resources/sap/ui/core/hyphenation/Hyphenation.js", "max_forks_repo_name": "fleischr/sapui5-metamask-shoppingcart", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": 15, "max_forks_count": null, "avg_line_length": 652.5555555556, "max_line_length": 5327, "alphanum_fraction": 0.7311425166}
/*!
* OpenUI5
 * (c) Copyright 2009-2022 SAP SE or an SAP affiliate company.
 * Licensed under the Apache License, Version 2.0 - see LICENSE.txt.
*/
sap.ui.define(["./HyphenationTestingWords","sap/ui/base/ManagedObject","sap/base/Log","sap/ui/core/Locale"],function(e,n,t,r){"use strict";var i={bg:true,ca:true,hr:true,cs:false,// no valid license
da:true,nl:true,"en-us":true,et:true,fi:true,fr:true,de:true,"el-monoton":true,hi:true,hu:true,it:true,lt:true,"nb-no":true,pl:false,// no valid license
pt:true,ru:true,sr:false,// no valid license
sl:true,es:true,sv:true,th:true,tr:true,uk:true};var a={bg:"Bulgarian",ca:"Catalan",hr:"Croatian",cs:"Czech",da:"Danish",nl:"Dutch",en:"English",et:"Estonian",fi:"Finnish",fr:"French",de:"German",el:"Greek",hi:"Hindi",hu:"Hungarian",it:"Italian",lt:"Lithuanian",nb:"Norwegian Bokmål",no:"Norwegian",pl:"Polish",pt:"Portuguese",ru:"Russian",sr:"Serbian",sl:"Slovenian",es:"Spanish",sv:"Swedish",th:"Thai",tr:"Turkish",uk:"Ukrainian"};var o={};var u={};var s={};var p=null;var h=null;var l={};function y(e){t.info("[UI5 Hyphenation] Initializing third-party module for language "+I(e),"sap.ui.core.hyphenation.Hyphenation.initialize()");var n=c();n.require[e]="FORCEHYPHENOPOLY";return d(sap.ui.require.toUrl("sap/ui/thirdparty/hyphenopoly/"),"Hyphenopoly_Loader.js").then(function(){delete n.require[e];return window.Hyphenopoly.hyphenators[e]})}function c(){if(!window.Hyphenopoly){window.Hyphenopoly={require:{},setup:{selectors:{".hyphenate":{hyphen:"­",leftmin:3,rightmin:3,compound:"all"}},hide:"DONT_HIDE"},handleEvent:{error:function(e){if(e.msg.match(/engine for language .* loaded, but no elements found./)){e.preventDefault()}}}}}return window.Hyphenopoly}function d(e,n){return new Promise(function(t,r){var i=document.createElement("script");i.async=true;i.src=e+n;i.addEventListener("load",t);i.addEventListener("error",function(){return r("Error loading script: "+n)});i.addEventListener("abort",function(){return r(n+" Script loading aborted.")});document.head.appendChild(i)})}var f=function e(){var n=["visibility:hidden;","-moz-hyphens:auto;","-webkit-hyphens:auto;","hyphens:auto;","width:48px;","font-size:12px;","line-height:12px;","border:none;","padding:0;","word-wrap:normal"];return n.join("")}();function g(e,n){if(!h){h=document.createElement("body")}var t=document.createElement("div");t.lang=e;t.id=e;t.style.cssText=f;t.appendChild(document.createTextNode(n));h.appendChild(t)}function v(e){if(h){e.appendChild(h);return h}return null}function m(){if(h){h.parentNode.removeChild(h)}}function H(e){return e.style.hyphens==="auto"||e.style.webkitHyphens==="auto"||e.style.msHyphens==="auto"||e.style["-moz-hyphens"]==="auto"}function b(e){var n;if(e){n=new r(e)}else{n=sap.ui.getCore().getConfiguration().getLocale()}var t=n.getLanguage().toLowerCase();switch(t){case"en":t="en-us";break;case"nb":t="nb-no";break;case"no":t="nb-no";break;case"el":t="el-monoton";break;default:break}return t}function w(e){if(e){return new r(e).toString()}return sap.ui.getCore().getConfiguration().getLocale().toString()}function L(e){if(typeof e==="string"){return e.substring(0,2)}else{return null}}function I(e){var n=L(e);if(a.hasOwnProperty(n)){return"'"+a[n]+"' (code:'"+n+"')"}else{return"'"+n+"'"}}function P(e){p.fireError(e);t.error("[UI5 Hyphenation] "+e,"sap.ui.core.hyphenation.Hyphenation")}var E=n.extend("sap.ui.core.hyphenation.Hyphenation",{metadata:{library:"sap.ui.core",events:{error:{parameters:{sErrorMessage:{type:"string"}}}}}});E.prototype.canUseNativeHyphenation=function(n){var r=w(n),i=b(n),a;if(!this.isLanguageSupported(i)){return null}if(!o.hasOwnProperty(r)){g(r,e[i.toLowerCase()]);var u=v(document.documentElement);if(u!==null){var s=document.getElementById(r);if(H(s)&&s.offsetHeight>12){a=true}else{a=false}m()}o[r]=a;if(a){t.info("[UI5 Hyphenation] Browser-native hyphenation can be used for language "+I(r),"sap.ui.core.hyphenation.Hyphenation.canUseNativeHyphenation()")}else{t.info("[UI5 Hyphenation] Browser-native hyphenation is not supported by current platform for language "+I(r),"sap.ui.core.hyphenation.Hyphenation.canUseNativeHyphenation()")}}else{a=o[r]}return a};E.prototype.canUseThirdPartyHyphenation=function(e){var n=b(e),r;if(!this.isLanguageSupported(e)){return null}if(!s.hasOwnProperty(n)){r=i.hasOwnProperty(n)&&i[n];if(r){t.info("[UI5 Hyphenation] Third-party hyphenation can be used for language "+I(n),"sap.ui.core.hyphenation.Hyphenation.canUseThirdPartyHyphenation()")}else{t.info("[UI5 Hyphenation] Third-party hyphenation is not supported for language "+I(n),"sap.ui.core.hyphenation.Hyphenation.canUseThirdPartyHyphenation()")}s[n]=r}else{r=s[n]}return r};E.prototype.isLanguageSupported=function(n){var r=b(n),i;if(!u.hasOwnProperty(r)){i=e.hasOwnProperty(r);if(!i){t.info("[UI5 Hyphenation] Language "+I(r)+" is not known to the Hyphenation API","sap.ui.core.hyphenation.Hyphenation.isLanguageSupported()")}u[r]=i}else{i=u[r]}return i};E.prototype.hyphenate=function(e,n){var t=b(n);if(!l.hasOwnProperty(t)){P("Language "+I(t)+" is not initialized. You have to initialize it first with method 'initialize()'");return e}return l[t](e)};E.prototype.getInitializedLanguages=function(){return Object.keys(l).map(function(e){return L(e)})};E.prototype.isLanguageInitialized=function(e){var e=b(e);return Object.keys(l).indexOf(e)!=-1};E.prototype.initialize=function(e){var n=b(e);if(!i[n]){var t="Language "+I(e)+" can not be initialized. It is either not supported by the third-party module or an error occurred";P(t);return Promise.reject(t)}if(l[n]){return Promise.resolve()}var r;if(!this._pInitLanguage){r=this._pInitLanguage=y(n).then(function(e){l[n]=e;this._pInitLanguage=null}.bind(this))}else{r=this._pInitLanguage.then(function(){return this.initialize(e)}.bind(this))}return r};E.getInstance=function(){if(!p){p=new E}return p};return E});