(function () {
  'use strict';

  // Generated by @auroraview/sdk

  // src/inject/bridge_stub.ts
  (function() {
    if (window.auroraview && window.auroraview._ready) {
      console.log("[AuroraView Stub] Bridge already initialized, skipping stub");
      return;
    }
    if (window.auroraview && window.auroraview._isStub) {
      console.log("[AuroraView Stub] Stub already exists");
      return;
    }
    console.log("[AuroraView Stub] Creating bridge stub...");
    const pendingCalls = [];
    window.auroraview = {
      _isStub: true,
      _ready: false,
      _pendingCalls: pendingCalls,
      _boundMethods: {},
      call: function(method, params) {
        console.warn("[AuroraView Stub] Queuing call:", method, "(bridge not ready)");
        return new Promise(function(resolve, reject) {
          pendingCalls.push({
            method,
            params,
            resolve,
            reject
          });
        });
      },
      send_event: function(event, detail) {
        console.warn("[AuroraView Stub] Event queued (bridge not ready):", event);
        pendingCalls.push({
          type: "event",
          event,
          detail
        });
      },
      on: function(event, handler) {
        console.log("[AuroraView Stub] Handler queued for:", event);
        pendingCalls.push({
          type: "handler",
          event,
          handler
        });
        return () => {
        };
      },
      off: function(_event, _handler) {
      },
      trigger: function(_event, _detail) {
      },
      invoke: function(cmd, args) {
        console.warn("[AuroraView Stub] Queuing invoke:", cmd, "(bridge not ready)");
        return new Promise(function(resolve, reject) {
          pendingCalls.push({
            type: "invoke",
            method: cmd,
            params: args,
            resolve,
            reject
          });
        });
      },
      whenReady: function() {
        return new Promise(function(resolve) {
          if (window.auroraview._ready && !window.auroraview._isStub) {
            resolve(window.auroraview);
          }
        });
      },
      isReady: function() {
        return false;
      },
      _registerApiMethods: function(namespace, methods) {
        console.log("[AuroraView Stub] API registration queued:", namespace);
        pendingCalls.push({
          type: "register",
          namespace,
          methods
        });
      },
      api: {}
    };
    console.log("[AuroraView Stub] \u2713 Bridge stub created, calls will be queued");
  })();

})();
