<!DOCTYPE html><!-- Last Published: Thu Apr 16 2026 08:45:51 GMT+0000 (Coordinated Universal Time) --><html data-wf-domain="webflow.bowtie.com.hk" data-wf-page="65efccd522a8c8171e035e62" data-wf-site="5ee7a33b5edf8fb0bcb51fdd" lang="zh"><head><meta charset="utf-8"/><title>找不到網頁</title><meta content="找不到網頁" property="og:title"/><meta content="找不到網頁" property="twitter:title"/><meta content="width=device-width, initial-scale=1" name="viewport"/><meta content="jW7KD30Dcns8Z4aicT0CBZSBfZG9F4DqaoG_7Qh5Y1s" name="google-site-verification"/><link href="https://cdn.prod.website-files.com/5ee7a33b5edf8fb0bcb51fdd/css/bowtie-site.shared.1b68ad84e.min.css" rel="stylesheet" type="text/css" integrity="sha384-G2ithONNzYlewp5/8NZ1w3Db4a/2lYksR6UZdVNx9wK38MRPgy7cpM7l3Jm9r16k" crossorigin="anonymous"/><link href="https://fonts.googleapis.com" rel="preconnect"/><link href="https://fonts.gstatic.com" rel="preconnect" crossorigin="anonymous"/><script src="https://ajax.googleapis.com/ajax/libs/webfont/1.6.26/webfont.js" type="text/javascript"></script><script type="text/javascript">WebFont.load({  google: {    families: ["Noto Sans TC:300,400,500,600,700"]  }});</script><script type="text/javascript">!function(o,c){var n=c.documentElement,t=" w-mod-";n.className+=t+"js",("ontouchstart"in o||o.DocumentTouch&&c instanceof DocumentTouch)&&(n.className+=t+"touch")}(window,document);</script><link href="https://cdn.prod.website-files.com/5ee7a33b5edf8fb0bcb51fdd/5ee7a33b5edf8f27c8b521fd_bowtie.png" rel="shortcut icon" type="image/x-icon"/><link href="https://cdn.prod.website-files.com/5ee7a33b5edf8fb0bcb51fdd/5ee7a33b5edf8f679ab52241_bowtie2.png" rel="apple-touch-icon"/><link href="https://www.bowtie.com.hk/404" rel="canonical"/><meta name="theme-color" content="#ff0068">
<meta property="og:image" content="https://www.bowtie.com.hk/assets/bowtie_og_image.png">
<meta name='zd-site-verification' content='c7fg8se1yi61npjhu3pq8c' />
<link href="https://app.bowtie.com.hk" rel="preconnect"/>
<script type="text/javascript">
var language;
(function (w, l, n) {
  /* Redirect non-proxied pageviews */
  if (!(localStorage.getItem('WebflowEditor') || /(edit|bt)=1/.test(w[l].search))) {
    var h = w[l].host,
        v = 'dev.',
        s = 'staging.',
        p = 'www.',
        d = 'bowtie.com.hk';
    if (/webflow.io$/.test(h) || RegExp(v).test(h)) {
      p = v;
    } else if (h.startsWith(s)) {
      p = s;
    }
    var t = w[l].toString().replace(h, p + d);
    if (String(w[l]) !== t && !/webflow/i.test(w.navigator.userAgent)) w[l] = t;
  }
  /* Init DataLayer */
  language = document.documentElement.lang || (w[l][n].match(/^\/en($|\/)/) ? 'en-US' : 'zh-HK');
  w.dataLayer = [{
    event: 'dataLayer.init',
    url: w[l].origin + w[l][n],
    language: language,
  }];
})(window, 'location', 'pathname')
</script>

<!-- Statsig Sidecar -->
<script src="https://cdn.jsdelivr.net/npm/statsig-sidecar/dist/index.min.js?apikey=client-EvofLcQg1gUDnjm0F9vurAh1fqdU2p3plGRn5QamVhj"></script>

<!-- Structured Data -->
<script type="application/ld+json">
{
  "@context": "https://schema.org",
  "@id": "https://www.bowtie.com.hk/#organization",
  "@type": ["Organization","Corporation"],
  "name": "Bowtie",
  "description": "Bowtie (保泰人壽, Bowtie Life Insurance) 是香港首間虛擬保險公司，專注提供自願醫保 (VHIS)、危疾、癌症醫療、意外及人壽保險等純保障產品。秉承「有人幫、無人Sell」的理念，Bowtie 透過免佣金直銷模式與科技創新，較市面其他保險節省高達 40% 保費，讓客戶以合理價格獲得全面保障，同時提供優質客服及一對一索償服務。根據保險業監管局數據，Bowtie 在直銷渠道的新造個人非整付保費保單數量位居全港第一，並在網上渠道銷售的新造個人非整付保費佔有 32% 的份額，累計總保障額超過 1,330 億港元。憑藉卓越表現，Bowtie 獲選《金融時報》「亞太高增長企業 2025」香港榜首，並在亞太區排名第 65 位，展現強勁增長潛力。Bowtie 的發展獲得業界認可，不單由前財政司司長曾俊華擔任資深顧問，並於 2025 年獲 Sun Life 領投 7,000 萬美元融資。自 2018 年 12 月取得香港保監局虛擬保險牌照以來，Bowtie持續以透明、高效的數位化服務，推動香港保險業轉型，致力縮小港人的保障缺口。",
  "alternateName": [
    "Bowtie Insurance",
    "Bowtie Life Insurance",
    "Bowtie Life Insurance Company Limited",
    "保泰",
    "保泰人壽",
    "保泰人壽保險有限公司"
  ],
  "legalName": [
    "Bowtie Life Insurance Company Limited",
    "保泰人壽保險有限公司"
  ],
  "url": "https://www.bowtie.com.hk/",
  "logo": "https://www.bowtie.com.hk/assets/favicon.png",
  "sameAs": [
    "https://www.facebook.com/bowtiehongkong/",
    "https://www.linkedin.com/company/bowtiehongkong/",
    "https://www.instagram.com/bowtiehongkong/",
    "https://www.threads.com/@bowtiehongkong",
    "https://www.youtube.com/bowtiehongkong/",
    "https://zh.wikipedia.org/zh-hk/%E4%BF%9D%E6%B3%B0%E4%BA%BA%E5%A3%BD",
    "https://en.wikipedia.org/wiki/Bowtie_Life_Insurance"
  ],
  "address": {
    "@type": "PostalAddress",
    "streetAddress": "G/F, Bowtie Life Insurance Tower, 68 Johnston Road",
    "addressLocality": "Wan Chai",
    "addressRegion": "Hong Kong",
    "addressCountry": "HK"
  },
  "contactPoint": [{
    "@type": "ContactPoint",
    "telephone": "+852-3008-8123",
    "email": "hello@bowtie.com.hk",
    "contactType": "customer service",
    "areaServed": "HK",
    "availableLanguage": ["en","zh"]
  }],
  "email": "hello@bowtie.com.hk",
  "telephone": "+852-3008-8123",
  "knowsLanguage": ["en","zh"],
  "isicV4": ["6511","6512"],
  "naics": ["524113","524114"]
}
}
</script>
<script type="application/ld+json">
{
  "@context": "https://schema.org",
  "@type": "WebSite",
  "@id": "https://www.bowtie.com.hk/#website",
  "url": "https://www.bowtie.com.hk/",
  "name": "Bowtie",
  "inLanguage": ["en-HK","zh-HK"],
  "publisher": { "@id": "https://www.bowtie.com.hk/#organization" },
  "potentialAction": {
    "@type": "SearchAction",
    "target": {
      "@type": "EntryPoint",
      "urlTemplate": "https://www.bowtie.com.hk/search?query={search_term_string}"
    },
    "query-input": "required name=search_term_string"
  }
}
</script>

<!-- Custom Styles -->
<style>
.w-webflow-badge {
  display: none !important
}
.bowtie-honey {
  opacity: 0;
  position: absolute;
  top: 0;
  left: 0;
  height: 0;
  width: 0;
  border: 0;
  padding: 0;
  z-index: -1;
}
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
input[type="number"] {
  -moz-appearance: textfield;
}
body {
  font-family: Gilroy, 'Noto Sans TC',sans-serif;
}
p:last-child {
  margin-bottom: 0;
}
.en .ts--h2, .en .ts--body-lg {
  letter-spacing: 0;
}
  
@media only screen and (min-width: 991px) {
  .new--subnav {
    background-color: transparent;
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
  }
  .is--sticky.new--subnav {
    border-bottom: 1px solid rgba(0,0,0,.2);
    background-color: rgba(255,255,255,.7);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    backdrop-filter: saturate(180%) blur(20px);
  }
  .is--reverse,
  .is--reverse .new--subnav-link {
    color: white;
  }
  .is--sticky.is--reverse, 
  .is--sticky.is--reverse .new--subnav-link {
    color: #333;
  }
  .is--sticky.is--reverse .new--subnav-link.w--current {
    color: #ff0068;
  }
}
.new--subnav-icon {
  -webkit-transform: rotate(0deg);
  transform: rotate(0deg);
}
.is--opened .new--subnav-icon {
  -webkit-transform: rotate(180deg);
  transform: rotate(180deg);
}
.new--subnav .new--subnav-cta {
  transition: transform 0.3s ease;
  -webkit-transform: translate(0,-500%);
  transform: translate(0,-500%);
}
.new--subnav.is--active .new--subnav-cta {
  -webkit-transform: translate(0,-50%);
  transform: translate(0,-50%);
}
@media only screen and (max-width: 992px) {
  .new--subnav .new--subnav-cta {
    -webkit-transform: none;
    transform: none;
  }
}
.new--subnav .new--subnav-list {
  right: 0;
  transition: transform 0.3s ease;
}
.new--subnav.is--active .new--subnav-list {
  -webkit-transform: translateX(-100px);
  transform: translateX(-100px);
}
.en .new--subnav.is--active .new--subnav-list,
.gm .new--subnav.is--active .new--subnav-list {
  -webkit-transform: translateX(-120px);
  transform: translateX(-120px);
}
.is--opened .new--subnav-list {
  -webkit-transform: translate(0, 0);
  transform: translate(0, 0);
}
.promo-bar-wrapper {
  pointer-events: none;
}
</style>
<!-- Zendesk faq -->
<style>
.zd-faq-plus-wrap {
  transition: transform 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}
.zd-faq-plus, .zd-faq-plus-l {
  transition: all 0.5s linear;
}
.zd-faq-answer {
  height: 0;
  transition: height 0.3s ease-in-out;
}
.zd-faq-answer .table-wrapper {
  overflow-x: scroll;
  padding: 10px;
}
.zd-faq-answer .table-bordered, .zd-faq-answer .table-bordered th, .zd-faq-answer .table-bordered td {
  border: 1px solid #d0daff;
}
.zd-faq-answer .table th,
.zd-faq-answer .table td {
  padding: 0.75rem;
  vertical-align: top;
  background-color: #f4f6fc;
  box-shadow: 7px 7px 0px 0px #e0e6f9;
}
.zd-faq-answer .casestudy {
  padding: 1rem;
  margin: 2rem 0;
  background-color: #f4f6fc;
  border-radius: 0.25rem;
  border-left: 4px solid #d7dfff;
}
.zd-faq-answer .casestudy::before {
  content: "🔍️ 實際案例";
  display: block;
  font-weight: 700;
  color: #2a2e42;
  margin-bottom: 0.75rem;
}
.zd-faq-answer .casestudy-en {
  padding: 1rem;
  margin: 2rem 0;
  background-color: #f4f6fc;
  border-radius: 0.25rem;
  border-left: 4px solid #d7dfff;
}
.zd-faq-answer .casestudy-en::before {
  content: "🔍️ Case Study";
  display: block;
  font-weight: 700;
  color: #2a2e42;
  margin-bottom: 0.75rem;
}
.zd-faq-answer .footnote {
  padding: 0.5rem;
  margin: 0;
  font-style: oblique;
  font-size: 0.75rem;
  color: #687188;
  border-radius: 0rem;
  border-top: 0.5px solid #c2c6d1;
  margin-bottom: 0.5rem;
}
.zd-faq-answer .footnote::before {
  content: "備註";
  display: block;
  font-style: normal;
  font-weight: 400;
  color: #687188;
  margin-bottom: 0.75rem;
}
.zd-faq-answer .footnote-en {
  padding: 0.5rem;
  margin: 0;
  font-style: oblique;
  font-size: 0.75rem;
  color: #687188;
  border-radius: 0rem;
  border-top: 0.5px solid #c2c6d1;
  margin-bottom: 0.5rem;
}
.zd-faq-answer .footnote-en::before {
  content: "Remarks";
  display: block;
  font-style: normal;
  font-weight: 400;
  color: #687188;
  margin-bottom: 0.75rem;
}
.zd-faq-answer .callout {
  padding: 1rem;
  margin: 2rem 0;
  background-color: #ffffff;
  border-radius: 0.25rem;
  border: 1px solid #ebecf0;
  border-left: 4px solid #ebecf0;
}
.zd-faq-answer .callout-dark {
  padding: 1rem;
  margin: 2rem 0;
  background-color: #ffffff;
  border-radius: 0.25rem;
  border: 1px solid #c2c6d1;
  border-left: 4px solid #c2c6d1;
}
.zd-faq-answer .list-check,
.zd-faq-answer .list-number {
  list-style: none;
  padding-left: 0;
}
.zd-faq-answer .list-check > .list-item,
.zd-faq-answer .list-number > .list-item {
  position: relative;
  padding-left: 2.75em;
}
.zd-faq-answer .list-check > .list-item::before,
.zd-faq-answer .list-number > .list-item::before {
  position: absolute;
  left: 0.5em;
  display: inline-block;
  width: 1.725em;
  height: 1.725em;
  line-height: 1.725em;
  text-align: center;
  font-size: 1em;
  font-weight: 700;
  border-radius: 50%;
}
.zd-faq-answer .list-check > .list-item::before {
  content: "✓";
  background-color: #e2e8f0;
}
.zd-faq-answer .list-number {
  counter-reset: list;
}
.zd-faq-answer .list-number > .list-item,
.zd-faq-answer .list-step > .list-item {
  counter-increment: list;
}
.zd-faq-answer .list-number > .list-item::before {
  content: counter(list);
  background-color: #ffebf3;
}
.zd-faq-answer .cta-block {
  display: none;
}
.zd-faq-answer .list-item {
  margin: 1rem 0;
}
.zd-faq-answer .zd-faq-ans-inner ul {
  margin-top: 10px;
  padding-left: 34px;
}
</style>
<!-- Start GTM to be deleted 2025Q4 -->
<script id="gtmScript" type="text/javascript">
window.dataLayer = window.dataLayer || [];
window.dataLayer.push({
  'gtm.start': new Date().getTime(),
  event: 'gtm.js',
});
</script>
<script async src="https://www.googletagmanager.com/gtm.js?id=GTM-KBZGF2T"></script>
<!-- End GTM to be deleted 2025Q4 -->
<!-- first party gtm -->
<script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
'https://gtm.bowtie.com.hk/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
})(window,document,'script','dataLayer','GTM-5KSXN77M');</script>
<!-- end gtm -->

<!-- CoBrowse -->
<script type="text/javascript">
(function(d,w,t,c,p,s,e) {
  h = w.location.hostname;
  prod = h === 'www.bowtie.com.hk';
  license = prod ? "xdBAyhtw1NV0_w" : "suuY5Li2tpeq6w";
  prefix = prod ? 'www' : h.split('.')[0];
  trustedOrigins = prod ? [
    h,
    'https://app.bowtie.com.hk',
    'https://help.bowtie.com.hk',
  ] : [
    h,
    `https://app.${prefix}.bowtie.com.hk`,
    `https://pr-app.${prefix}.bowtie.com.hk`,
  ];
  p = new Promise(function(r) {
    w[c] = {
      client: function() {
        if(!s){
          s=d.createElement(t);
          s.src=`https://js.cobrowse.io/${c}.js`;
          s.async=1;
          s.crossOrigin='anonymous';
          e=d.getElementsByTagName(t)[0];
          e.parentNode.insertBefore(s,e);
          s.onload=function() {
            r(w[c]);
          };
        }
        return p;
      },
      license,
      trustedOrigins,
    };
  });
  let session = new URLSearchParams(w.location.search).get('_cobrowse_active_session');
  let cbCookies = d.cookie.split('; ').map(el => el.split('=')).filter(el => el[0] === `BT-${c}-DeviceCode`);
  if (session || cbCookies.length) {
    let device_id = cbCookies[0][1];
    if (device_id) {
      w[c].customData = {device_id};
    }
    if (device_id || session) {
      w[c].client().then(function(){
        w[c].start({allowIFrameStart:true});
      });
    }
  }
})(document,window,'script','CobrowseIO');
</script>

<style>
/* Gilroy – Regular */
@font-face {
  font-family: "Gilroy";
  src: url("https://www.bowtie.com.hk/assets/fonts/gilroy-regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

/* Gilroy – Medium */
@font-face {
  font-family: "Gilroy";
  src: url("https://www.bowtie.com.hk/assets/fonts/gilroy-medium.woff2") format("woff2");
  font-weight: 500; /* use 500 OR 600, not both */
  font-style: normal;
  font-display: swap;
}

/* Gilroy – Bold */
@font-face {
  font-family: "Gilroy";
  src: url("https://www.bowtie.com.hk/assets/fonts/gilroy-bold.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}
</style><script type="text/javascript">window.__WEBFLOW_CURRENCY_SETTINGS = {"currencyCode":"USD","symbol":"$","decimal":".","fractionDigits":2,"group":",","template":"{{wf {\"path\":\"symbol\",\"type\":\"PlainText\"} }} {{wf {\"path\":\"amount\",\"type\":\"CommercePrice\"} }} {{wf {\"path\":\"currencyCode\",\"type\":\"PlainText\"} }}","hideDecimalForWholeNumbers":false};</script></head><body class="bgc--light-pink"><div class="s-section"><div class="s-container"><div class="txt--center"><div class="div-block-289"><img src="https://cdn.prod.website-files.com/5ee7a33b5edf8fb0bcb51fdd/6467dd9d864ec9991ba3a355_404-cat.gif" alt="" class="image-112"/></div><h1 src="https://cdn.prod.website-files.com/5ee7a33b5edf8fb0bcb51fdd/5ee7a33b5edf8f25e5b52193_404.png" class="ts--h1">Oops…<br/></h1><p class="ts--body-lg"> &lt;404 error&gt;<br/>對不起，我們找不到你的網頁。<br/>Sorry, We couldn&#x27;t find the page.<br/></p><a href="/" class="btn--main btn--pink w-button">返回主頁</a></div></div></div><script src="https://d3e54v103j8qbb.cloudfront.net/js/jquery-3.5.1.min.dc5e7f18c8.js?site=5ee7a33b5edf8fb0bcb51fdd" type="text/javascript" integrity="sha256-9/aliU8dGd2tb6OSsuzixeV4y/faTqgFtohetphbbj0=" crossorigin="anonymous"></script><script src="https://cdn.prod.website-files.com/5ee7a33b5edf8fb0bcb51fdd/js/bowtie-site.schunk.1a807f015b216e46.js" type="text/javascript" integrity="sha384-oY4R8SfnVBTWnix6ULiWbZs/5tyRyxEiWcG+WrT3unnu5pmfsIYJEraZcyFVlvND" crossorigin="anonymous"></script><script src="https://cdn.prod.website-files.com/5ee7a33b5edf8fb0bcb51fdd/js/bowtie-site.schunk.d8ca5c307c726b3e.js" type="text/javascript" integrity="sha384-eRG1pNmgNEsnH3FuME/0qyjLXA1JSaccwfcsexSr1zeFGjB+uk8PZk8388JCVe0Z" crossorigin="anonymous"></script><script src="https://cdn.prod.website-files.com/5ee7a33b5edf8fb0bcb51fdd/js/bowtie-site.48eec5ee.fe72ca58cdaee245.js" type="text/javascript" integrity="sha384-09rzhoXcYrjHKIuxcY/x9jAa5WZPV1HXzRbetiEA0f840htc4XtvC9+HMq+IYIhR" crossorigin="anonymous"></script><script src="https://cdnjs.cloudflare.com/ajax/libs/jquery-scrollTo/2.1.3/jquery.scrollTo.min.js" integrity="sha512-PsJ1f4lw0Jrga4wbDOvdWs9DFl88C1vlcH2VQYqgljHBmzmqtGivUkzRHWx2ZxFlnysKUcROqLeuOpYh9q4YNg==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
<script src="https://cdn.jsdelivr.net/npm/@finsweet/attributes-modal@1.1.3/modal.js" integrity="sha256-1oPmPSxOVKVHDxujKZJVQCirwfLCqKvXW4hCwa02M9U=" crossorigin="anonymous"></script>

<!-- Start GTM to be deleted 2025Q4 -->
<noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-KBZGF2T" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
<!-- End GTM to be deleted 2025Q4 -->
<!-- first party gtm -->
<noscript><iframe src="https://gtm.bowtie.com.hk/ns.html?id=GTM-5KSXN77M"
height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>

<!-- Hidden UTM Fields -->
<script type="text/javascript">
(function (d) {
	const params = new URLSearchParams(window.location.search);
	d.querySelectorAll('form').forEach(f => {
	  for (let key of params.keys()) {
        if (!key.startsWith('utm_')) continue;
	    const e = d.createElement('input');
	    e.name = key;
	    e.type = 'hidden';
	    e.value = params.get(e.name);
	    f.appendChild(e);
	  }
	})
}(document))
</script>

<!-- ReCaptcha -->
<script type="text/javascript">
  (function (d, t, s, e, c) {
    s = d.createElement(t);
    s.src = '/assets/js/recaptcha.js';
    s.async = true;
    d.body.appendChild(s);
  })(document, 'script');
</script>

<!-- Nav Widget -->
<script type="text/javascript">
!function (d, w) {
  const l = w.location;
  const MOBILE_MAX_WIDTH = 992;
  const HEIGHT_COLLAPSED = 40;
  const HEIGHT_EXPANDED = 200;
  const ZH = 'zh-HK';

  const appOrigin = 'https://app.bowtie.com.hk';
  const prOrigin = 'https://app.bowtie.com.hk';
  const marketingSiteOrigin = l.origin;
  const getAppLanguage = (lang) => lang.startsWith('zh') ? ZH : 'en';
  const iframeEl = d.getElementById('nav-iframe');
  const newIframeEl = d.getElementById('nav-iframe-new');
  const iframeWrap = d.getElementById('nav-iframe-wrap');
  const newIframeWrap = d.getElementById('nav-iframe-wrap-new');

  if ((iframeWrap || newIframeWrap) && (iframeEl || newIframeEl)) {
    let appLang = getAppLanguage(d.documentElement.lang);
    const updateHeight = (expanded) => {
      if(iframeEl){
      	iframeEl.style.height = `${expanded ? HEIGHT_EXPANDED : HEIGHT_COLLAPSED}px`;
      };
      if(newIframeEl){
      	newIframeEl.style.height = `${expanded ? HEIGHT_EXPANDED : HEIGHT_COLLAPSED}px`;
      };
    };
        
    w.addEventListener('message', (e) => {
      if (e.origin === appOrigin || e.origin === prOrigin) {
        let { message, value } = e.data;
        switch (message) {
          case 'expand':
            updateHeight(value);
            break;
          case 'locale':
            let newLang = getAppLanguage(value);
            if (newLang !== appLang) {
              l.href = `${marketingSiteOrigin}/${newLang === ZH ? '' : newLang}`;
            }
            break;
        }
      }
    }, false);
    w.addEventListener('click', (e) => {
      if(iframeEl){
      	iframeEl.contentWindow.postMessage({ message: 'expand', value: false }, appOrigin);
        iframeEl.contentWindow.postMessage({ message: 'expand', value: false }, prOrigin);

      };
      if(newIframeEl){
      	newIframeEl.contentWindow.postMessage({ message: 'expand', value: false }, appOrigin);
        newIframeEl.contentWindow.postMessage({ message: 'expand', value: false }, prOrigin);
      };
      updateHeight(false);
    });
  }
}(document, window);
</script>

<!-- ZenDesk Widget -->
<script defer src="https://static.zdassets.com/ekr/snippet.js?key=c7cd9851-c582-4c02-b523-1ca7841a7013" id="ze-snippet"></script>
<script type="text/javascript">
window.zESettings = {
  webWidget: {
    chat: {
      departments: {
        enabled: [],
      },
    },
  },
};   
document.getElementById('ze-snippet').onload = function () {
  window.zE('webWidget', 'setLocale', language || 'zh-HK');
};
</script>

<!-- Link Preload -->
<script async src="https://www.bowtie.com.hk/assets/js/instant-page-5.1.0.min.js" type="module" integrity="sha384-by67kQnR+pyfy8yWP4kPO12fHKRLHZPfEsiSXR8u2IKcTdxD805MGUXBzVPnkLHw"></script>

<script>
var ww,wh,ws;
function us() {
  ww = $(window).width(), wh = $(window).height(), ws = $(window).scrollTop();
}
function pad(num, size) {
  var s = '0' + num;
  return s.substr(s.length - size);
}
function getTimeRemaining(endtime) {
  var t = Date.parse(endtime) - Date.parse(new Date());
  return {
    total: t,
    days: Math.floor(t / (1000 * 60 * 60 * 24)),
    hours: Math.floor((t / (1000 * 60 * 60)) % 24),
    minutes: Math.floor((t / 1000 / 60) % 60),
    seconds: Math.floor((t / 1000) % 60),
  };
}
function clock(id, endtime) {
  var days = document.querySelectorAll('#' + id + '-days'),
    hours = document.querySelectorAll('#' + id + '-hours'),
    minutes = document.querySelectorAll('#' + id + '-minutes'),
    seconds = document.querySelectorAll('#' + id + '-seconds');

  // Get the last element of each NodeList
  days = days[days.length - 1];
  hours = hours[hours.length - 1];
  minutes = minutes[minutes.length - 1];
  seconds = seconds[seconds.length - 1];

  if (!(days || hours || minutes || seconds)) return;
    var timeinterval = setInterval(function () {
      var t = getTimeRemaining(endtime);
      if (t.total <= 0) {
      clearInterval(timeinterval);
    } else {
      if (days) days.innerHTML = pad(t.days, 2);
      if (hours) hours.innerHTML = pad(t.hours, 2);
      if (minutes) minutes.innerHTML = pad(t.minutes, 2);
      if (seconds) seconds.innerHTML = pad(t.seconds, 2);
    }
  }, 1000);
}
clock('top-nav-timer', 'Fri May 1 2026 00:00:00 GMT+8:00');

/* lead form marketing msg */
$('select[name=Doubt-Type]').on('change', function() {
  if( $(this).val()=='想了解Bowtie的產品' || $(this).val()=='Product Information' ){
    $('.form-condi--product').show();
    $('.form-condi--non-product').hide();
    $('select[name=Product-Type]').prop("selectedIndex", 0);
  } else {
    $('.form-condi--product').hide();
    $('.form-condi--non-product').show();
    $('select[name=Product-Type]').val(null);
  }
});
/* adjust website padding top */
function adjustSitePaddtop() {
  /*var topH = $('.header-new').outerHeight();
  $('.s--content').css('padding-top',topH);*/
}
$('.nav-notice-close').click(function(){
  $('.nav-notice').hide();
  adjustSitePaddtop();
});
/* submenu item total width */
function submenuWidth() {
  var totalWidth = 0;
  $('.s--submenu-link').each(function(index) {
    totalWidth += $(this).outerWidth(true);
  });
  $('.s--submenu-wid').css('width',totalWidth+20);
}
/* check subnav scroll position */
function checkSubnavPosition() {
  us();
  $(".s--section").each(function() {
    if ( $(this)[0].hasAttribute('id') ) {
      var top = $(this).offset().top, btm = $(this).outerHeight();
      if ( top <= ws+wh*0.5 && top+btm >= ws ) {
        var tar = $(this).attr('id');
        $('.s--submenu-box').stop(1, 0).scrollTo('[href="#'+tar+'"]', 400);
      }
    }
  });
}
/* mobile content toggle */
$('.mobile-toggle--btn').click(function(){
  var $this = $(this),
  $body = $this.siblings('.mobile-toggle--content');
  if ( $this.hasClass('is-active') ) {
    $this.removeClass('is-active');
    $this.find('.mobile-toggle--btn-on').show();
    $this.find('.mobile-toggle--btn-off').hide();
    $body.slideUp(400);
  } else {
    $this.addClass('is-active');
    $this.find('.mobile-toggle--btn-on').hide();
    $this.find('.mobile-toggle--btn-off').show();
    $body.slideDown(400);
  }
});
/* new */
/* scroll to step */
$('.claim-tab').click(function(){
  $('body').scrollTo('.tab-content.is--product',600);
});
/* close step section */
$('.tab-close-wrap .icon--close').click(function(){
  $('.tab-close-trigger').click();
  $('body').scrollTo('.claim-tab',600,{offset: -200});
});
/* hero widget */ 
$('.widget-hero--widget-trigger').click(function(){
  $('.widget-hero--widget-trigger').hide();
  $('.widget-hero--widget-wrap').css({'height': 'auto'});
});
/* new product subnav */
function productSubnavVar() {
  $a = $('.new--subnav');
  $b = $('.new--subnav-title');
  $c = $('.new--subnav-name');
  $d = $('.new--subnav-link');
  $e = $('.widget-hero');
  _c = 'is--opened';
  _d = 'is--active';
  _e = 'is--sticky';
}
function productSubnav() {
  productSubnavVar();
  var _a = $c.text();
  $(window).scroll(function(){
    us();
    if( ww<992 ) {
      productSubnavUpdateText();
      if( ws<60 ) $c.text(_a);
    } else {
      $c.text(_a);
    }
  });
}
function productSubnavUpdateText() {
  productSubnavVar();
  $d.each(function() {
    if ( $(this).hasClass('w--current') ) {
      var _b = $(this).text();
      $c.text(_b);
    }
  });
}
function productSubnavToggle() {
  productSubnavVar();
  us();
  $b.click(function(){
    if( ww<992 ) {
      if ( $a.hasClass(_c) ) {
        $a.removeClass(_c);
      } else {
        $a.addClass(_c);
      }
    }
  });
  $d.click(function(){
    if( ww<992 ) $a.removeClass(_c);
  });
}
function productSubnavCTACheckScroll() {
  productSubnavVar();
  us();
  /* $e could be non-existent */
  /* check sticky */
  if ($e.length>0) {
    _y = $e.offset().top;
    if ( ws>_y ) {
      $a.addClass(_e);
    } else {
      $a.removeClass(_e);
    }
    /* check position to show CTA  */
    _t = $e.offset().top+$e.outerHeight();
    if ( ww>991 && ws>_t*0.7 ) {
      $a.addClass(_d);
    } else {
      $a.removeClass(_d);
    }
  }
}
$(function() {
  productSubnav();
  productSubnavToggle();
  $(window).scroll(productSubnavCTACheckScroll);
  $(window).resize(productSubnavCTACheckScroll);
});
/* new product subnav END */
  
/* doc ready */
$(function() {
  adjustSitePaddtop();
  submenuWidth();
  checkSubnavPosition();
  $(window).on("scroll", function(){
    checkSubnavPosition();
  });
  $(window).on("resize", function(){
    adjustSitePaddtop();
    submenuWidth();
  });
  
  if ( window.location.href.indexOf('affiliate') > -1 ) {
    $('.promo-bar').hide();
    $('#promo-bc-detail').hide();
    $('.termlife-promo-msg').hide();
  }
  $('#benefit-button').click(function() {
    setTimeout(function() {
      $("body").scrollTo('#benefit-details',800);
    }, 100);
  });
});
</script>

<!-- Nav user-data to Quotation -->
<script type="text/javascript">
  !(function (w, d) {
    const l = w.location;
    const appOrigin = "https://app.bowtie.com.hk";
    const appDevOrigin = "https://app.dev.bowtie.com.hk";

    const quotationWidgetIframes = Array.from(
      document.getElementsByTagName("iframe")
    ).filter((element) => element.src?.includes("bowtie.com.hk/quotation"));

    const forwardToQuotations = (data) => {
      if (quotationWidgetIframes.length > 0) {
        data.value = {
          ...data.value,
          authenticationCallbackUrl: window.location.href,
        };
        quotationWidgetIframes.forEach((iframe, i) => {
          iframe.contentWindow.postMessage(data, appOrigin);
          iframe.contentWindow.postMessage(data, appDevOrigin);
          iframe.contentWindow.postMessage(data, window.location.origin);
          console.log("Parent: Forwarded message to quotation iframe " + i);
        });
      }
    };

    if (quotationWidgetIframes.length > 0) {
      w.addEventListener(
        "message",
        (e) => {
          if (e.origin === appOrigin || e.origin === appDevOrigin || e.origin === window.location.origin) {
            let { message, value } = e.data;
            switch (message) {
              case "quotation-ready":
                console.log("Parent: Quotation iframe ready, processing queue");
                window.quotationReady = true;
                (window.messageQueue || []).forEach((data) =>
                  forwardToQuotations(data)
                );
                window.messageQueue = [];
                break;
              case "user-data":
                if (value && typeof value === "object") {
                  console.log("Parent: Received user data from /nav:", value);

                  const userData = { message: "user-data", value };

                  if (window.quotationReady) {
                    forwardToQuotations(userData);
                  } else {
                    console.log("Parent: Quotation not ready, queuing message");
                    window.messageQueue = window.messageQueue || [];
                    window.messageQueue.push(userData);
                  }
                }
                break;
            }
          }
        },
        false
      );
    }
  })(window, document);
</script>

<!-- Quotation Anchor Link -->
<script type="text/javascript">
  (function (d, w) {
    const l = w.location;
    const appOrigin = 'https://app.bowtie.com.hk';
    const quotationOrigin = 'https://www.bowtie.com.hk';

    const simplifiedRecommendation = d.getElementById('recommendation');
    const scrollToRecommendationWidget = () => {
      if (!!simplifiedRecommendation) {
        simplifiedRecommendation.scrollIntoView({ behavior: 'smooth' });
      }
    };

    const vhisProductChoices = d.getElementById('vhis-product-choices');
    const scrollToVhisProductChoices = () => {
      if (!!vhisProductChoices) {
        vhisProductChoices.scrollIntoView({ behavior: 'smooth' });
      }
    };

    const riderDetails = d.getElementById('rider-details');
    const scrollToRiderDetails = () => {
      if (!!riderDetails) {
        riderDetails.scrollIntoView({ behavior: 'smooth' });
      }
    };

    w.addEventListener(
      'message',
      e => {
        if (e.origin === appOrigin || e.origin === quotationOrigin) {
          let { message } = e.data;
          switch (message) {
            case 'scroll-to-recommendation-anchor':
              scrollToRecommendationWidget();
              break;
            case 'scroll-to-vhis-product-choices-anchor':
              scrollToVhisProductChoices();
              break;
            case 'scroll-to-rider-details-anchor':
              scrollToRiderDetails();
              break;
          }
        }
      },
      false,
    );
  })(document, window);
</script>


<!-- Recommendation Widget Result -->
<script type="text/javascript">
  (function (d,w) {
    const l = w.location;
    const appOrigin = 'https://app.bowtie.com.hk';
    const quotationOrigin = 'https://www.bowtie.com.hk';
    const lang = w.language.startsWith('zh') ? 'zh' : 'en';
    const resultIframeEl = document.getElementById("recommendation-result-page");
    
    const jumpToResult = () => {
      const resultPageUrl = `/${lang}/insurance/recommendation/result`;
      l.assign(resultPageUrl);
    };
    
    const postDemographicData = () => {
    	const quotationParamsStr = localStorage.getItem('quotationParams');
      	if(resultIframeEl) {
        	resultIframeEl.contentWindow.postMessage(
              {
              	message: 'quotationDemographicData',
                value: quotationParamsStr ? JSON.parse(quotationParamsStr) : undefined,
              },
              appOrigin
            )
        };
    };

    w.addEventListener(
      'message',
      e => {
        if (e.origin === appOrigin || e.origin === quotationOrigin) {
          let { message } = e.data;
        	switch(message){
          	  case 'question-flow-done':
            	jumpToResult();
            	break;
              case 'recommendation-iframe-loaded':
                postDemographicData();
                break;
          }             
        }
      },
      false,
    );
  })(document, window);
</script>
<script type="text/javascript">
(function(d, i, s){
  i=d.getElementById('nav-iframe');
  function s() {
    i.style.display='inline-block';
    i.style.position='unset';
	  d.querySelectorAll('.iframe-nav-placeholder').forEach(function(e){e.style.display='none';});
  }
  if (i) {
    window.addEventListener('message', function(event) {
      if (i.src.startsWith(event.origin)) s();
    });
    i.addEventListener('load', function(){ setTimeout(s, 3000) });
  }
})(document);
</script>

<!-- Claim Calculator Qs -->
<script type="text/javascript">
(function (d) {
  	const claimPredictionId =  new URLSearchParams(window.location.search).get('claim_prediction_id');
	d.querySelectorAll('iframe').forEach(f => {
      if (f.src.startsWith('https://app.bowtie.com.hk/claim-calculator/')){
        if (claimPredictionId){
          f.src += "&claim_prediction_id="+ claimPredictionId;
        }
      }   
	})
}(document));
</script>

<!-- Nav App Start Button -->
<script type="text/javascript">
  (function (w, d) {
    const APP_START_BTN_ID = 'header_btn_quote';
    const QUOTATION_PATHNAME = '/quotation'; 
    const LOCAL_STORAGE_KEY = 'quotationAppStartUrl';

    const appStartBtn = d.getElementById(APP_START_BTN_ID);
    const quotationIframes = Array.from(d.querySelectorAll('iframe')).filter(
      f => f.src.includes(QUOTATION_PATHNAME),
    );

    if (quotationIframes.length === 1 && !!appStartBtn) {
      w.addEventListener('storage', e => {
        const quotationAppStartUrl = JSON.parse(
          w.localStorage.getItem(LOCAL_STORAGE_KEY),
        );

        if (!!quotationAppStartUrl) {
          appStartBtn.href = quotationAppStartUrl;
        }
      });
    }
  })(window, document);
</script>

<!-- Zendesk Faq -->
<script>
(function (d) {
  const tabs = d.querySelectorAll(".zd-faq-tab");

  Promise.all(Array.from(tabs).map((tab) => renderQuestions(tab))).then(() => {
    const questions = d.querySelectorAll(".zd-faq-question");

    questions.forEach((q) => {
      q.addEventListener("click", () => {
        toggleAccordion(q);
      });
    });
  });

  async function renderQuestions(tab) {
    const query = tab.getAttribute("zd-data-query");

    if (!query) return;

    const tabLabel = tab.getAttribute("data-w-tab");

    const lang = d.documentElement.lang.startsWith("zh") ? "zh-tw" : "en-gb";

    const articles = await getFaq(lang, query);

    const filteredArticles = getFilteredArticles(articles);

    await getQuestionsHtml(lang, tabLabel, filteredArticles);
  }

  async function getFaq(lang, qs) {
    try {
      const response = await fetch(
        `https://help.bowtie.com.hk/api/v2/help_center/${lang}/articles.json?per_page=100&label_names=${qs}`
      );
      if (response.ok) {
        const data = await response.json();

        return data.articles;
      } else {
        console.error("An error occurred during the request.");
      }
    } catch (error) {
      console.error("An error occurred:", error);

      return [];
    }
  }

  function getFilteredArticles(articles) {
    return articles.filter(
      (value, index, self) =>
        index === self.findIndex((t) => t.title === value.title)
    );
  }

  function getQuestionsHtml(lang, tabLabel, articles) {
    const tabPanel = document.querySelector(`div[data-w-tab="${tabLabel}"]`);

    tabPanel.innerHTML = `<div class="w-dyn-list"><div class="w-dyn-items" role="listitem"></div></div>`;
    
    const listContainer = tabPanel.querySelector(".w-dyn-items");

    listContainer.innerHTML = "";

    if (!articles.length) {
      const message =
        lang === "zh-tw"
          ? "前往我們的<a href='https://help.bowtie.com.hk/hc/zh-tw'>幫助中心</a>獲取更多資訊。"
          : "Visit our&nbsp<a href='https://help.bowtie.com.hk/hc/en-gb'>Help Center</a>&nbspfor more information.";

      listContainer.innerHTML = `<div style='display:flex; justify-content: center;'>
      ${message}
      </div>`;
    }

    articles.forEach((article) => {
      const questionDiv = document.createElement("div");
      questionDiv.innerHTML = `
          <div class="w-dyn-item" role="listitem">
    <div class="w-container">
      <div class="faq-wrap">
        <div
          class="faq-question zd-faq-question"
          data-track-event="Content Interacted"
          data-interaction-type="Accordion FAQ"
        >
          <div class="faq-plus-wrap zd-faq-plus-wrap">
            <div class="faq-plus-l zd-faq-plus-l"></div>
            <div class="faq-plus zd-faq-plus"></div>
          </div>
          <div class="ts--h4 faq-q-text">
            ${article.title}
          </div>
        </div>
        <div class="faq-answer zd-faq-answer">
          <div class="ts--body faq-ans-inner zd-faq-ans-inner w-richtext">
            ${article.body}
          </div>
        </div>
      </div>
    </div>
  </div>
        `;

      const tables = questionDiv.querySelectorAll("table");
      tables.forEach((table) => {
        const wrapper = document.createElement("div");
        wrapper.className = "table-wrapper";
        table.parentNode.insertBefore(wrapper, table);
        wrapper.appendChild(table);
      });

      return new Promise((resolve) => {
        listContainer.appendChild(questionDiv);
        resolve();
      });
    });
  }

  function toggleAccordion(q) {
    const answer = q.nextElementSibling;
    const plusWrap = q.querySelector(".faq-plus-wrap");
    const plusL = q.querySelector(".faq-plus-l");

    const isOpen = answer.style.height === "auto";

    if (isOpen) {
      answer.style.height = answer.scrollHeight + "px";
      requestAnimationFrame(() => {
        answer.style.height = "0";
      });
      plusWrap.style.transform = "rotate(0deg)";
      plusL.style.transform = "scaleY(1)";
    } else {
      answer.style.height = answer.scrollHeight + "px";
      answer.addEventListener("transitionend", function handler() {
        if (answer.style.height !== "0px") {
          answer.style.height = "auto";
        }
        answer.removeEventListener("transitionend", handler);
      });
      plusWrap.style.transform = "rotate(180deg)";
      plusL.style.transform = "scaleY(0)";
    }
  }
})(document);
</script>

<!-- Carry forward coupon setting to all URL in site -->
<script>
  document.addEventListener('DOMContentLoaded', function () {
    // Get the defaultCoupon parameter from the URL
    const urlParams = new URLSearchParams(window.location.search);
    const defaultCoupon = urlParams.get('defaultCoupon');
    const defaultCouponType = urlParams.get('defaultCouponType');
    const referer = urlParams.get('referer');
    const referrer = urlParams.get('referrer');

    // Check if the defaultCoupon parameter exists
    if (!!referer || !!referrer) {
      // Select all relevant links:
      // 1. Links pointing to bowtie.com.hk or app.bowtie.com.hk (absolute links)
      // 2. All relative links (internal links without a domain)
      document
        .querySelectorAll(
          `
            a[href*="bowtie.com.hk"], 
            a[href*="app.bowtie.com.hk"], 
            a[href]:not([href^="http://"]):not([href^="https://"]):not([href^="#"])
        `,
        )
        .forEach(link => {
          // Parse the link's URL, resolving relative URLs with the current location's origin
          let linkUrl = new URL(
            link.getAttribute('href'),
            window.location.origin,
          );

          let params = new URLSearchParams(linkUrl.search);

          if (referer) {
            params.set('referer', referer);
          }
          if (referrer) {
            params.set('referrer', referrer);
          }
          if (!!defaultCoupon) {
            params.set('defaultCoupon', defaultCoupon);
          }
          if (!!defaultCouponType) {
            params.set('defaultCouponType', defaultCouponType);
          }

          // Update the href attribute with the modified URL
          //link.href = `${linkUrl.origin}?${params.toString()}`;
          linkUrl.search = params;
          link.setAttribute('href', linkUrl);
        });
    }
  });
</script>

<!-- AI Search Zendesk Widget Flow -->
<script type="text/javascript">
  (function (d, w) {
    const l = w.location;
    const appOrigin = 'https://app.bowtie.com.hk';
    const aiSearchOrigin = 'https://www.bowtie.com.hk';

    w.addEventListener(
      'message',
      e => {
        if (e.origin === appOrigin || e.origin === aiSearchOrigin) {
          let { message, value } = e.data;

          switch (message) {
            case 'ai-search-cs-transfer':
              const { email, name, phone } = value.userData;
              const departments = zE('webWidget:get', 'chat:departments');
              const hasOnline = departments.some(dept => dept.status === 'online');
              const ticketId = value.ticketId;
              const language = d.documentElement.lang;

              zE('webWidget', 'prefill', {
                name: {
                  value: name,
                },
                email: {
                  value: email
                },
                phone: {
                  value: phone,
                }
              });

              if (hasOnline || window.tester) {
                const customMessage = language.startsWith('zh')
                  ? `我想與客戶服務團隊交談！我的查詢編號是 #${ticketId}`
                  : `I would like to talk to the customer service team. My ticket ID is ${ticketId}`;

                zE('webWidget', 'chat:addTags', ['delegated_from_ai_search']);
                const removeTags = (event) => {
                  if (
                    ['Chat Offline Message Sent', 'Web Widget Minimised'].includes(
                      event.action,
                    )
                  ) {
                    zE('webWidget', 'chat:removeTags', ['delegated_from_ai_search']);
                  }
                };
                zE('webWidget:on', 'userEvent', removeTags);
                zE('webWidget', 'chat:send', customMessage);
              }

              zE('webWidget', 'open');
              break;
          }
        }
      },
      false,
    );
  })(document, window);
</script>

<!-- temp script for showing ai-search at dev/staging, shall be removed after AI-search was fully launched -->
<script type="text/javascript">
  !(function (d, w) {
    const promptBtnsWrappers = d.getElementsByClassName(
      'ai_sticky_button_wrapper',
    );
    const promptBtnsWrapperCovers = d.getElementsByClassName(
      'ai_search_button_cover',
    );
    
    const isNotProduction =
      w.location.hostname.includes('dev') ||
      w.location.hostname.includes('staging');

    if (isNotProduction) {
      if (promptBtnsWrappers.length) {
        Array.from(promptBtnsWrappers).forEach(element => {
          element.style.display = 'flex';
        });
      }

      if (promptBtnsWrapperCovers.length) {
        Array.from(promptBtnsWrapperCovers).forEach(element => {
          element.style.display = 'block';
        });
      }
      
    }
  })(document, window);
</script>

<!-- AI Search Webflow Interaction -->
<script type="text/javascript">
  !(function (d, w) {
    const l = w.location;
    const isStaging = l.origin.includes('staging');
    const isDev = l.origin.includes('dev');

    const isEnglish = l.href.includes('/en/');

    const btns = d.getElementsByClassName('ai-search-prompt-btn');
    const iframe = d.getElementById('ai-search-iframe');

    const iframeWrapper = d.getElementsByClassName('ai_search_body')[0];

    if (iframeWrapper) {
      iframeWrapper.style =
        'background: linear-gradient(to right, #1f8cfb 0%, #cf54ce 25%, #ff0068 50%, #ff364d 75%, #ff860a 100%); background-clip: border-box; background-origin: border-box; border: 4px solid transparent;';
    }
    
    /** Set iframe URL. (comment out until fully launched) */
    /** 
    if (iframe) {
      const url = new URL(iframe.src);
      const params = new URLSearchParams(url.search);
      params.set('parentUrl', w.location.href);
      params.set('lng', isEnglish ? 'en-US' : 'zh-HK');
      url.search = params;
      iframe.src = url;
    }
    */
    
    const isNotProduction = isStaging || isDev;

    /** Set iframe URL for dev and staging. */
    if (iframe && isNotProduction) {
      const prefix = isStaging ? 'staging' : 'dev';
      const url = new URL(
        'https://app.' + prefix + '.bowtie.com.hk/ai-search/?lng=zh-HK',
      );
      const params = new URLSearchParams(url.search);
      params.set('parentUrl', w.location.href);
      params.set('lng', isEnglish ? 'en-US' : 'zh-HK');
      url.search = params;
      iframe.src = url;
    }
  

    /** Set the intersecting section to intersectingSectionsMapping. */
    const sections = d.getElementsByClassName('s-section');
    let observers = [];
    const intersectingSectionsMapping = new Map();
    const getSectionIdByLargestValue = mapping => {
      const entries = mapping.entries();

      return entries.reduce((largestKey, [currentKey, currentValue]) => {
        const largestValue = mapping.get(largestKey) || 0;
        return currentValue > largestValue ? currentKey : largestKey;
      }, 0);
    };
    Array.from(sections)
      .filter(({ id }) => !!id)
      .forEach((section, id) => {
        const options = {
          root: null,
          rootMargin: '0px',
          threshold: Array.from({ length: 100 }, (_, i) => i / 100),
        };

        const callback = (entries, observer) => {
          if (entries.some(entry => entry.isIntersecting)) {
            intersectingSectionsMapping.set(
              section.id,
              entries[entries.length - 1].intersectionRatio,
            );
          } else {
            intersectingSectionsMapping.delete(section.id);
          }
        };

        observers[id] = new IntersectionObserver(callback, options);
        observers[id].observe(section);
      });

    /** Set click listener to the prompt button for providing default prompt and intersecting section. */
    Array.from(btns).forEach(btn => {
      btn.addEventListener('click', () => {
        iframe.contentWindow.postMessage(
          {
            message: 'ai-search-prompt',
            value: btn.getAttribute('prompt') || '',
          },
          '*',
        );
        iframe.contentWindow.postMessage(
          {
            message: 'ai-search-site-section',
            value: {
              siteSectionId: getSectionIdByLargestValue(
                intersectingSectionsMapping,
              ),
              url: w.location.href,
            },
          },
          '*',
        );
      });
    });
	
    /** Automatically open ai-search with the default prompt from the query string and enable chat history transfer. */
    const openWidgetAndInputPrompt = () => {
      const urlParams = new URLSearchParams(w.location.search);
      const autoOpen = urlParams.get('aiSearchAutoOpen');
      const autoOpenDefaultPrompt =
        urlParams.get('aiSearchDefaultPrompt') || '';
      
      if (autoOpen === 'true' && !!autoOpenDefaultPrompt) {
        const wrapper = d.getElementsByClassName('ai_search_wrapper')[0];

        if (wrapper) {
          wrapper.style = 'display: block;';
        }
        iframe.contentWindow.postMessage(
          {
            message: 'ai-search-prompt',
            value: decodeURIComponent(autoOpenDefaultPrompt),
          },
          '*',
        );
        iframe.contentWindow.postMessage(
          {
            message: 'ai-search-is-redirected-from-auth-flow',
            value: true,
          },
          '*',
        );
      }
    };

    w.addEventListener(
      'message',
      event => {
        if (event.origin.includes('bowtie.com.hk')) {
          const { message, value } = event.data;

          /** Provide intersecting section when the iframe asking for it using post message. */
          if (message === 'ai-search-site-section') {
            iframe.contentWindow.postMessage(
              {
                message: 'ai-search-site-section',
                value: {
                  siteSectionId: getSectionIdByLargestValue(
                    intersectingSectionsMapping,
                  ),
                  url:
                    isStaging || isDev
                      ? isEnglish
                        ? 'https://www.bowtie.com.hk/en/insurance/vhis/flexi'
                        : 'https://www.bowtie.com.hk/zh/insurance/vhis/flexi'
                      : `${l.protocol}//${l.host}${l.pathname}`,
                },
              },
              '*',
            );
          }

          /** Provide default prompt when the iframe asking for it using post message. */
          if (message === 'ai-search-is-ready') {
            setTimeout(() => {
              openWidgetAndInputPrompt();
            }, 500);
          }
          
          /** Open the url that is returned by embedded tool */
          /** TODO: remove hardcoded #quote-now for other destinations */
          if (message === 'ai-search-navigation') {
            const lng = isEnglish ? 'en' : 'zh';
            const href = '/' + lng + value;
            const quotationSectionId = '#quote-now';
            if (w.location.href.includes(href)) {
              const quotationSectionElement = d.querySelectorAll(
                quotationSectionId + ':not(.is--hide)',
              )[0];
              if (quotationSectionElement) {
                quotationSectionElement.scrollIntoView({
                  behavior: 'smooth',
                  block: 'start',
                  inline: 'nearest',
                });
              }
            } else {
              w.location.href = href + quotationSectionId;
            }
          }
        }
      },
      false,
    );
  })(document, window);
</script>


<script src="https://cdn.prod.website-files.com/5ee7a33b5edf8fb0bcb51fdd%2F689e5ba67671442434f3ca35%2F69cb4f812ee8d98dfe46c007%2Fpricing_calc_v3-3.0.1.js" type="text/javascript"></script><script src="https://cdn.prod.website-files.com/5ee7a33b5edf8fb0bcb51fdd%2F689e5ba67671442434f3ca35%2F69df6490ca33f83e02559aae%2Fgm_occu_list_a-1.0.0.js" type="text/javascript"></script><script src="https://cdn.prod.website-files.com/5ee7a33b5edf8fb0bcb51fdd%2F689e5ba67671442434f3ca35%2F69df6491fdb8da10a710c685%2Fgm_occu_exec-1.0.0.js" type="text/javascript"></script></body></html>